Skip to content

Commit f9b267e

Browse files
chore: black reformatting (#31)
1 parent ce878c4 commit f9b267e

File tree

89 files changed

+5722
-6326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+5722
-6326
lines changed

doc/conf.py

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# :coding: utf-8
22
# :copyright: Copyright (c) 2014 ftrack
33

4-
'''ftrack Python API documentation build configuration file.'''
4+
"""ftrack Python API documentation build configuration file."""
55

66
import os
77
import re
@@ -11,89 +11,91 @@
1111

1212
# Extensions.
1313
extensions = [
14-
'sphinx.ext.autodoc',
15-
'sphinx.ext.extlinks',
16-
'sphinx.ext.intersphinx',
17-
'sphinx.ext.todo',
18-
'sphinx.ext.viewcode',
19-
'lowdown'
14+
"sphinx.ext.autodoc",
15+
"sphinx.ext.extlinks",
16+
"sphinx.ext.intersphinx",
17+
"sphinx.ext.todo",
18+
"sphinx.ext.viewcode",
19+
"lowdown",
2020
]
2121

2222

2323
# The suffix of source filenames.
24-
source_suffix = '.rst'
24+
source_suffix = ".rst"
2525

2626
# The master toctree document.
27-
master_doc = 'index'
27+
master_doc = "index"
2828

2929
# General information about the project.
30-
project = u'ftrack Python API'
31-
copyright = u'2014, ftrack'
30+
project = "ftrack Python API"
31+
copyright = "2014, ftrack"
3232

3333
# contents of docs/conf.py
3434
try:
35-
release = get_distribution('ftrack-python-api').version
35+
release = get_distribution("ftrack-python-api").version
3636
# take major/minor/patch
37-
VERSION = '.'.join(release.split('.')[:3])
37+
VERSION = ".".join(release.split(".")[:3])
3838
except DistributionNotFound:
39-
# package is not installed
40-
VERSION = 'Unknown version'
39+
# package is not installed
40+
VERSION = "Unknown version"
4141

4242
version = VERSION
4343
release = VERSION
4444

4545
# List of patterns, relative to source directory, that match files and
4646
# directories to ignore when looking for source files.
47-
exclude_patterns = ['_template']
47+
exclude_patterns = ["_template"]
4848

4949
# A list of prefixes to ignore for module listings.
50-
modindex_common_prefix = [
51-
'ftrack_api.'
52-
]
50+
modindex_common_prefix = ["ftrack_api."]
5351

5452
# -- HTML output --------------------------------------------------------------
5553

56-
if not os.environ.get('READTHEDOCS', None) == 'True':
54+
if not os.environ.get("READTHEDOCS", None) == "True":
5755
# Only import and set the theme if building locally.
5856
import sphinx_rtd_theme
57+
5958
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
6059

61-
html_theme = 'sphinx_rtd_theme'
60+
html_theme = "sphinx_rtd_theme"
6261

63-
html_static_path = ['_static']
64-
html_style = 'ftrack.css'
62+
html_static_path = ["_static"]
63+
html_style = "ftrack.css"
6564

6665
# If True, copy source rst files to output for reference.
6766
html_copy_source = True
6867

6968

7069
# -- Autodoc ------------------------------------------------------------------
7170

72-
autodoc_default_options = {"members": None, 'undoc-members': None, 'inherited-members': None}
73-
autodoc_member_order = 'bysource'
71+
autodoc_default_options = {
72+
"members": None,
73+
"undoc-members": None,
74+
"inherited-members": None,
75+
}
76+
autodoc_member_order = "bysource"
7477

7578

7679
def autodoc_skip(app, what, name, obj, skip, options):
77-
'''Don't skip __init__ method for autodoc.'''
78-
if name == '__init__':
80+
"""Don't skip __init__ method for autodoc."""
81+
if name == "__init__":
7982
return False
8083

8184
return skip
8285

8386

8487
# -- Intersphinx --------------------------------------------------------------
8588

86-
intersphinx_mapping = {
87-
'python': ('http://docs.python.org/', None)
88-
}
89+
intersphinx_mapping = {"python": ("http://docs.python.org/", None)}
8990

9091

9192
# -- Todos ---------------------------------------------------------------------
9293

93-
todo_include_todos = os.environ.get('FTRACK_DOC_INCLUDE_TODOS', False) == 'True'
94+
todo_include_todos = os.environ.get("FTRACK_DOC_INCLUDE_TODOS", False) == "True"
9495

9596

9697
# -- Setup --------------------------------------------------------------------
9798

99+
98100
def setup(app):
99-
app.connect('autodoc-skip-member', autodoc_skip)
101+
app.connect("autodoc-skip-member", autodoc_skip)

doc/resource/example_plugin.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55

66

77
def register(session, **kw):
8-
'''Register plugin. Called when used as an plugin.'''
9-
logger = logging.getLogger('com.example.example-plugin')
8+
"""Register plugin. Called when used as an plugin."""
9+
logger = logging.getLogger("com.example.example-plugin")
1010

1111
# Validate that session is an instance of ftrack_api.Session. If not,
1212
# assume that register is being called from an old or incompatible API and
1313
# return without doing anything.
1414
if not isinstance(session, ftrack_api.session.Session):
1515
logger.debug(
16-
'Not subscribing plugin as passed argument {0!r} is not an '
17-
'ftrack_api.Session instance.'.format(session)
16+
"Not subscribing plugin as passed argument {0!r} is not an "
17+
"ftrack_api.Session instance.".format(session)
1818
)
1919
return
2020

2121
# Perform your logic here, such as subscribe to an event.
2222
pass
2323

24-
logger.debug('Plugin registered')
24+
logger.debug("Plugin registered")

doc/resource/example_plugin_using_session.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,32 @@
55

66

77
def register_with_session_ready(event):
8-
'''Called when session is ready to be used.'''
9-
logger = logging.getLogger('com.example.example-plugin')
10-
logger.debug('Session ready.')
11-
session = event['data']['session']
8+
"""Called when session is ready to be used."""
9+
logger = logging.getLogger("com.example.example-plugin")
10+
logger.debug("Session ready.")
11+
session = event["data"]["session"]
1212

1313
# Session is now ready and can be used to e.g. query objects.
14-
task = session.query('Task').first()
15-
print(task['name'])
14+
task = session.query("Task").first()
15+
print(task["name"])
1616

1717

1818
def register(session, **kw):
19-
'''Register plugin. Called when used as an plugin.'''
20-
logger = logging.getLogger('com.example.example-plugin')
19+
"""Register plugin. Called when used as an plugin."""
20+
logger = logging.getLogger("com.example.example-plugin")
2121

2222
# Validate that session is an instance of ftrack_api.Session. If not,
2323
# assume that register is being called from an old or incompatible API and
2424
# return without doing anything.
2525
if not isinstance(session, ftrack_api.session.Session):
2626
logger.debug(
27-
'Not subscribing plugin as passed argument {0!r} is not an '
28-
'ftrack_api.Session instance.'.format(session)
27+
"Not subscribing plugin as passed argument {0!r} is not an "
28+
"ftrack_api.Session instance.".format(session)
2929
)
3030
return
3131

3232
session.event_hub.subscribe(
33-
'topic=ftrack.api.session.ready',
34-
register_with_session_ready
33+
"topic=ftrack.api.session.ready", register_with_session_ready
3534
)
3635

37-
logger.debug('Plugin registered')
36+
logger.debug("Plugin registered")

resource/plugin/configure_locations.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010

1111
def configure_locations(event):
12-
'''Configure locations for session.'''
13-
session = event['data']['session']
12+
"""Configure locations for session."""
13+
session = event["data"]["session"]
1414

1515
# Find location(s) and customise instances.
1616
#
@@ -20,20 +20,19 @@ def configure_locations(event):
2020

2121

2222
def register(session):
23-
'''Register plugin with *session*.'''
24-
logger = logging.getLogger('ftrack_plugin:configure_locations.register')
23+
"""Register plugin with *session*."""
24+
logger = logging.getLogger("ftrack_plugin:configure_locations.register")
2525

2626
# Validate that session is an instance of ftrack_api.Session. If not, assume
2727
# that register is being called from an old or incompatible API and return
2828
# without doing anything.
2929
if not isinstance(session, ftrack_api.Session):
3030
logger.debug(
31-
'Not subscribing plugin as passed argument {0} is not an '
32-
'ftrack_api.Session instance.'.format(session)
31+
"Not subscribing plugin as passed argument {0} is not an "
32+
"ftrack_api.Session instance.".format(session)
3333
)
3434
return
3535

3636
session.event_hub.subscribe(
37-
'topic=ftrack.api.session.configure-location',
38-
configure_locations
37+
"topic=ftrack.api.session.configure-location", configure_locations
3938
)

resource/plugin/construct_entity_type.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88

99
class Factory(ftrack_api.entity.factory.StandardFactory):
10-
'''Entity class factory.'''
10+
"""Entity class factory."""
1111

1212
def create(self, schema, bases=None):
13-
'''Create and return entity class from *schema*.'''
13+
"""Create and return entity class from *schema*."""
1414
# Optionally change bases for class to be generated.
1515
cls = super(Factory, self).create(schema, bases=bases)
1616

@@ -20,27 +20,26 @@ def create(self, schema, bases=None):
2020

2121

2222
def register(session):
23-
'''Register plugin with *session*.'''
24-
logger = logging.getLogger('ftrack_plugin:construct_entity_type.register')
23+
"""Register plugin with *session*."""
24+
logger = logging.getLogger("ftrack_plugin:construct_entity_type.register")
2525

2626
# Validate that session is an instance of ftrack_api.Session. If not, assume
2727
# that register is being called from an old or incompatible API and return
2828
# without doing anything.
2929
if not isinstance(session, ftrack_api.Session):
3030
logger.debug(
31-
'Not subscribing plugin as passed argument {0!r} is not an '
32-
'ftrack_api.Session instance.'.format(session)
31+
"Not subscribing plugin as passed argument {0!r} is not an "
32+
"ftrack_api.Session instance.".format(session)
3333
)
3434
return
3535

3636
factory = Factory()
3737

3838
def construct_entity_type(event):
39-
'''Return class to represent entity type specified by *event*.'''
40-
schema = event['data']['schema']
39+
"""Return class to represent entity type specified by *event*."""
40+
schema = event["data"]["schema"]
4141
return factory.create(schema)
4242

4343
session.event_hub.subscribe(
44-
'topic=ftrack.api.session.construct-entity-type',
45-
construct_entity_type
44+
"topic=ftrack.api.session.construct-entity-type", construct_entity_type
4645
)

source/ftrack_api/__init__.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,18 @@
66

77

88
def mixin(instance, mixin_class, name=None):
9-
'''Mixin *mixin_class* to *instance*.
9+
"""Mixin *mixin_class* to *instance*.
1010
1111
*name* can be used to specify new class name. If not specified then one will
1212
be generated.
1313
14-
'''
14+
"""
1515
if name is None:
16-
name = '{0}{1}'.format(
17-
instance.__class__.__name__, mixin_class.__name__
18-
)
16+
name = "{0}{1}".format(instance.__class__.__name__, mixin_class.__name__)
1917

2018
# Check mixin class not already present in mro in order to avoid consistent
2119
# method resolution failure.
2220
if mixin_class in instance.__class__.mro():
2321
return
2422

25-
instance.__class__ = type(
26-
name,
27-
(
28-
mixin_class,
29-
instance.__class__
30-
),
31-
{}
32-
)
23+
instance.__class__ = type(name, (mixin_class, instance.__class__), {})

0 commit comments

Comments
 (0)