Skip to content

Commit c2f7bac

Browse files
authored
Black (#2)
* Added Hound Badge to the README, and ran python modernize. * Ran black * Added the black badge to the README. * Added Azure config. * Adds the Azure build badge to the README.
1 parent 26b3b47 commit c2f7bac

15 files changed

Lines changed: 177 additions & 108 deletions

File tree

.pre-commit-config.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright (c) 2019 Shotgun Software Inc.
2+
#
3+
# CONFIDENTIAL AND PROPRIETARY
4+
#
5+
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
6+
# Source Code License included in this distribution package. See LICENSE.
7+
# By accessing, using, copying or modifying this work you indicate your
8+
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
9+
# not expressly granted therein are reserved by Shotgun Software Inc.
10+
11+
# Styles the code properly
12+
# Exclude the UI files, as they are auto-generated.
13+
exclude: "ui\/.*py$"
14+
# List of super useful formatters.
15+
repos:
16+
- repo: https://github.com/pre-commit/pre-commit-hooks
17+
rev: v2.4.0
18+
hooks:
19+
# Ensures the code is syntaxically correct
20+
- id: check-ast
21+
language_version: python3
22+
# Ensures a file name will resolve on all platform
23+
- id: check-case-conflict
24+
# Checks files with the execute bit set have shebangs
25+
- id: check-executables-have-shebangs
26+
# Ensure there's no incomplete merges
27+
- id: check-merge-conflict
28+
# Adds an empty line if missing at the end of a file.
29+
- id: end-of-file-fixer
30+
# Makes sure requirements.txt is properly formatted
31+
- id: requirements-txt-fixer
32+
# Removes trailing whitespaces.
33+
- id: trailing-whitespace
34+
# Leave black at the bottom so all touchups are done before it is run.
35+
- repo: https://github.com/ambv/black
36+
rev: 19.10b0
37+
hooks:
38+
- id: black
39+
language_version: python3

LICENSE

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Version: 7/07/2013
44

55
Shotgun Software Inc. ("Company") provides the Shotgun Pipeline Toolkit,
66
software, including source code, in this package or repository folder (the
7-
"Shotgun Toolkit Code") subject to your acceptance of and compliance with
7+
"Shotgun Toolkit Code") subject to your acceptance of and compliance with
88
the following terms and conditions (the "License Terms"). By accessing,
9-
downloading, copying, using or modifying any of the Shotgun Toolkit Code,
9+
downloading, copying, using or modifying any of the Shotgun Toolkit Code,
1010
you agree to these License Terms.
1111

1212
Eligibility
@@ -33,7 +33,7 @@ to the Shotgun Toolkit Code or any of Company's other software or intellectual
3333
property rights. You agree not to take any action with respect to the Shotgun
3434
Toolkit Code that is not expressly authorized above.
3535

36-
You must keep intact (and, in the case of copies, reproduce) all copyright
36+
You must keep intact (and, in the case of copies, reproduce) all copyright
3737
and other proprietary notices, including all references to and copies of these
3838
License Terms, as originally included on, in, or with the Shotgun Toolkit
3939
Code. You must ensure that all derivative works you make of the Shotgun
@@ -64,7 +64,7 @@ Company).
6464
Liability
6565

6666
You agree to be solely responsible for your use and modifications of the
67-
Shotgun Toolkit Code, and for any harm or liability arising out of such use
67+
Shotgun Toolkit Code, and for any harm or liability arising out of such use
6868
or modifications, including but not limited to any liability for infringement
6969
of third-party intellectual property rights.
7070

@@ -78,7 +78,7 @@ advised of the possibility of such damages; and (b) in any event, Company's
7878
aggregate liability under these License Terms or in connection with the
7979
Shotgun Toolkit Code, regardless of the form of action and under any theory
8080
(whether in contract, tort, statutory, or otherwise), will not exceed the
81-
greater of $50 or the amount (if any) that you actually paid for access to
81+
greater of $50 or the amount (if any) that you actually paid for access to
8282
the Shotgun Toolkit Code.
8383

8484
Ownership
@@ -115,7 +115,7 @@ Company grants you a non-exclusive right to continue to modify, make
115115
derivative works of, reproduce, and use the Contribution for your
116116
non-commercial or internal business purposes, and to further Company's
117117
development of Company Programs. This grant does not: (a) limit Company's
118-
rights, (b) grant you any rights with respect to the Company Programs; nor
118+
rights, (b) grant you any rights with respect to the Company Programs; nor
119119
(c) permit you to distribute, operate for the benefit of third parties (for
120120
example, on a hosted basis), or otherwise commercially exploit the
121121
Contribution.
@@ -143,4 +143,4 @@ employees, and agents against any and all claims, actions or damages
143143
account of a breach or alleged breach of the foregoing warranty. You make no
144144
other express or implied warranty (including without limitation any warranty
145145
of merchantability or fitness for a particular purpose) regarding the
146-
Contribution.
146+
Contribution.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[![Build Status](https://dev.azure.com/shotgun-ecosystem/Toolkit/_apis/build/status/Apps/tk-multi-devutils?branchName=master)](https://dev.azure.com/shotgun-ecosystem/Toolkit/_build/latest?definitionId=78&branchName=master)
2+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
3+
[![Linting](https://img.shields.io/badge/PEP8%20by-Hound%20CI-a873d1.svg)](https://houndci.com)
4+
15
## Documentation
26
This repository is a part of the Shotgun Pipeline Toolkit.
37

@@ -6,7 +10,7 @@ This repository is a part of the Shotgun Pipeline Toolkit.
610
- For information about Shotgun in general, click here: http://www.shotgunsoftware.com/toolkit
711

812
## Using this app in your Setup
9-
All the apps that are part of our standard app suite are pushed to our App Store.
13+
All the apps that are part of our standard app suite are pushed to our App Store.
1014
This is where you typically go if you want to install an app into a project you are
1115
working on. For an overview of all the Apps and Engines in the Toolkit App Store,
1216
click here: https://support.shotgunsoftware.com/entries/95441247.

app.py

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Copyright (c) 2018 Shotgun Software Inc.
2-
#
2+
#
33
# CONFIDENTIAL AND PROPRIETARY
4-
#
5-
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
4+
#
5+
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
66
# Source Code License included in this distribution package. See LICENSE.
7-
# By accessing, using, copying or modifying this work you indicate your
8-
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
7+
# By accessing, using, copying or modifying this work you indicate your
8+
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
99
# not expressly granted therein are reserved by Shotgun Software Inc.
1010

1111
import os
@@ -36,9 +36,7 @@ def init_app(self):
3636
"type": "context_menu",
3737
}
3838
self.engine.register_command(
39-
"New config sandbox...",
40-
self._new_config_sandbox,
41-
menu_options
39+
"New config sandbox...", self._new_config_sandbox, menu_options
4240
)
4341

4442
# certain menu options are only available if you
@@ -52,9 +50,7 @@ def init_app(self):
5250
"type": "context_menu",
5351
}
5452
self.engine.register_command(
55-
"Open config location on disk",
56-
self._jump_to_dev_area,
57-
menu_options
53+
"Open config location on disk", self._jump_to_dev_area, menu_options
5854
)
5955

6056
# command to check for updates
@@ -64,9 +60,7 @@ def init_app(self):
6460
"type": "context_menu",
6561
}
6662
self.engine.register_command(
67-
"Check for config updates...",
68-
self._updates,
69-
menu_options
63+
"Check for config updates...", self._updates, menu_options
7064
)
7165

7266
# command to validate
@@ -76,32 +70,22 @@ def init_app(self):
7670
"type": "context_menu",
7771
}
7872
self.engine.register_command(
79-
"Check for core updates...",
80-
self._check_core_updates,
81-
menu_options
73+
"Check for core updates...", self._check_core_updates, menu_options
8274
)
8375

8476
def _updates(self):
8577
"""
8678
Callback to launch check for updates tank command
8779
"""
8880
command_runner = self.import_module("command_runner")
89-
command_runner.show_dialog(
90-
self,
91-
"Check for Updates",
92-
"updates"
93-
)
81+
command_runner.show_dialog(self, "Check for Updates", "updates")
9482

9583
def _check_core_updates(self):
9684
"""
9785
Callback to launch the validate tank command
9886
"""
9987
command_runner = self.import_module("command_runner")
100-
command_runner.show_dialog(
101-
self,
102-
"Check for core updates",
103-
"core"
104-
)
88+
command_runner.show_dialog(self, "Check for core updates", "core")
10589

10690
def _new_config_sandbox(self):
10791
"""

azure-pipelines.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (c) 2019 Shotgun Software Inc.
2+
#
3+
# CONFIDENTIAL AND PROPRIETARY
4+
#
5+
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
6+
# Source Code License included in this distribution package. See LICENSE.
7+
# By accessing, using, copying or modifying this work you indicate your
8+
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
9+
# not expressly granted therein are reserved by Shotgun Software Inc.
10+
11+
# Imports the shared Azure CI tools
12+
resources:
13+
repositories:
14+
- repository: templates
15+
type: github
16+
name: shotgunsoftware/tk-ci-tools
17+
ref: refs/heads/master
18+
endpoint: shotgunsoftware
19+
20+
# We want builds to trigger for 3 reasons:
21+
# - The master branch sees new commits
22+
# - Each PR should get rebuilt when commits are added to it.
23+
# - When we tag something
24+
trigger:
25+
branches:
26+
include:
27+
- master
28+
tags:
29+
include:
30+
- v*
31+
pr:
32+
branches:
33+
include:
34+
- "*"
35+
36+
# This pulls in a variable group from Azure. Variables can be encrypted or not.
37+
variables:
38+
- group: deploy-secrets
39+
40+
jobs:
41+
- template: build-pipeline.yml@templates
42+
parameters:
43+
skip_tests: true

info.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,32 @@
11
# Copyright (c) 2018 Shotgun Software Inc.
2-
#
2+
#
33
# CONFIDENTIAL AND PROPRIETARY
4-
#
5-
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
4+
#
5+
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
66
# Source Code License included in this distribution package. See LICENSE.
7-
# By accessing, using, copying or modifying this work you indicate your
8-
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
7+
# By accessing, using, copying or modifying this work you indicate your
8+
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
99
# not expressly granted therein are reserved by Shotgun Software Inc.
1010

1111
configuration:
1212

1313
# the Shotgun fields that this app needs in order to operate correctly
1414
requires_shotgun_fields:
1515

16-
# More verbose description of this item
16+
# More verbose description of this item
1717
display_name: "Developer Tools"
1818
description: "Tools for development."
1919

2020
# Required minimum versions for this item to run
2121
requires_shotgun_version:
2222
requires_core_version: "v0.18.158"
23-
requires_engine_version:
23+
requires_engine_version:
2424

25-
# this app works in all engines - it does not contain
25+
# this app works in all engines - it does not contain
2626
# any host application specific commands
27-
supported_engines:
27+
supported_engines:
2828

2929
# the frameworks required to run this app
3030
frameworks:
3131
- {"name": "tk-framework-shotgunutils", "version": "v5.x.x"}
3232
- {"name": "tk-framework-qtwidgets", "version": "v2.x.x", "minimum_version": "v2.7.0"}
33-

python/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Copyright (c) 2018 Shotgun Software Inc.
2-
#
2+
#
33
# CONFIDENTIAL AND PROPRIETARY
4-
#
5-
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
4+
#
5+
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
66
# Source Code License included in this distribution package. See LICENSE.
7-
# By accessing, using, copying or modifying this work you indicate your
8-
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
7+
# By accessing, using, copying or modifying this work you indicate your
8+
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
99
# not expressly granted therein are reserved by Shotgun Software Inc.
1010

1111
from . import create_sandbox

python/command_runner/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Copyright (c) 2018 Shotgun Software Inc.
2-
#
2+
#
33
# CONFIDENTIAL AND PROPRIETARY
4-
#
5-
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
4+
#
5+
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
66
# Source Code License included in this distribution package. See LICENSE.
7-
# By accessing, using, copying or modifying this work you indicate your
8-
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
7+
# By accessing, using, copying or modifying this work you indicate your
8+
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
99
# not expressly granted therein are reserved by Shotgun Software Inc.
1010

1111
import sgtk

python/command_runner/dialog.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ def _doit(self):
6565
self._command_obj = None
6666

6767
self._logger.info("")
68-
self._logger.info("The command has finished execution. Press Close to continue.")
68+
self._logger.info(
69+
"The command has finished execution. Press Close to continue."
70+
)
6971

7072
# turn cancel button into close button
7173
self.ui.cancel.setEnabled(True)

python/command_runner/interact.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616

1717
class QtInteraction(sgtk.CommandInteraction):
18-
1918
def __init__(self, parent):
2019
self._parent = parent
2120
self._always_enabled = False
@@ -35,11 +34,7 @@ def request_input(self, message):
3534
:returns: Information entered by user.
3635
:rtype: str
3736
"""
38-
input, ok = QtGui.QInputDialog.getText(
39-
self._parent,
40-
"Shotgun",
41-
message
42-
)
37+
input, ok = QtGui.QInputDialog.getText(self._parent, "Shotgun", message)
4338
return input
4439

4540
def ask_yn_question(self, message):
@@ -54,7 +49,7 @@ def ask_yn_question(self, message):
5449
self._parent,
5550
"Shotgun",
5651
message,
57-
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
52+
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
5853
)
5954

6055
if res == QtGui.QMessageBox.Yes:
@@ -82,7 +77,7 @@ def ask_yna_question(self, message, force_prompt=False):
8277
self._parent,
8378
"Shotgun",
8479
message,
85-
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No | QtGui.QMessageBox.YesToAll
80+
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No | QtGui.QMessageBox.YesToAll,
8681
)
8782

8883
if res == QtGui.QMessageBox.YesToAll:

0 commit comments

Comments
 (0)