Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
logilab-common
Commits
823dfc0d719f
Commit
7a3fcfd6
authored
Jul 28, 2021
by
Laurent Peuch
Browse files
chore(format-source): black the code
parent
bb83797bb54a
Changes
9
Hide whitespace changes
Inline
Side-by-side
.hg-format-source
View file @
823dfc0d
...
...
@@ -238,3 +238,83 @@
{"pattern": "test/test_ureports_text.py", "tool": "autoflake"}
{"pattern": "test/test_xmlutils.py", "tool": "autoflake"}
{"pattern": "test/utils.py", "tool": "autoflake"}
{"pattern": "logilab/common/cache.py", "tool": "black"}
{"pattern": "logilab/common/changelog.py", "tool": "black"}
{"pattern": "logilab/common/clcommands.py", "tool": "black"}
{"pattern": "logilab/common/compat.py", "tool": "black"}
{"pattern": "logilab/common/configuration.py", "tool": "black"}
{"pattern": "logilab/common/daemon.py", "tool": "black"}
{"pattern": "logilab/common/date.py", "tool": "black"}
{"pattern": "logilab/common/debugger.py", "tool": "black"}
{"pattern": "logilab/common/decorators.py", "tool": "black"}
{"pattern": "logilab/common/deprecation.py", "tool": "black"}
{"pattern": "logilab/common/fileutils.py", "tool": "black"}
{"pattern": "logilab/common/graph.py", "tool": "black"}
{"pattern": "logilab/common/interface.py", "tool": "black"}
{"pattern": "logilab/common/logging_ext.py", "tool": "black"}
{"pattern": "logilab/common/modutils.py", "tool": "black"}
{"pattern": "logilab/common/optik_ext.py", "tool": "black"}
{"pattern": "logilab/common/optparser.py", "tool": "black"}
{"pattern": "logilab/common/proc.py", "tool": "black"}
{"pattern": "logilab/common/pytest.py", "tool": "black"}
{"pattern": "logilab/common/registry.py", "tool": "black"}
{"pattern": "logilab/common/shellutils.py", "tool": "black"}
{"pattern": "logilab/common/sphinx_ext.py", "tool": "black"}
{"pattern": "logilab/common/sphinxutils.py", "tool": "black"}
{"pattern": "logilab/common/table.py", "tool": "black"}
{"pattern": "logilab/common/tasksqueue.py", "tool": "black"}
{"pattern": "logilab/common/testlib.py", "tool": "black"}
{"pattern": "logilab/common/textutils.py", "tool": "black"}
{"pattern": "logilab/common/tree.py", "tool": "black"}
{"pattern": "logilab/common/types.py", "tool": "black"}
{"pattern": "logilab/common/umessage.py", "tool": "black"}
{"pattern": "logilab/common/ureports/__init__.py", "tool": "black"}
{"pattern": "logilab/common/ureports/docbook_writer.py", "tool": "black"}
{"pattern": "logilab/common/ureports/html_writer.py", "tool": "black"}
{"pattern": "logilab/common/ureports/nodes.py", "tool": "black"}
{"pattern": "logilab/common/ureports/text_writer.py", "tool": "black"}
{"pattern": "logilab/common/urllib2ext.py", "tool": "black"}
{"pattern": "logilab/common/vcgutils.py", "tool": "black"}
{"pattern": "logilab/common/visitor.py", "tool": "black"}
{"pattern": "logilab/common/xmlutils.py", "tool": "black"}
{"pattern": "setup.py", "tool": "black"}
{"pattern": "test/data/__pkginfo__.py", "tool": "black"}
{"pattern": "test/data/deprecation.py", "tool": "black"}
{"pattern": "test/data/find_test/__init__.py", "tool": "black"}
{"pattern": "test/data/find_test/module.py", "tool": "black"}
{"pattern": "test/data/find_test/module2.py", "tool": "black"}
{"pattern": "test/data/find_test/noendingnewline.py", "tool": "black"}
{"pattern": "test/data/find_test/nonregr.py", "tool": "black"}
{"pattern": "test/data/find_test/sub/momo.py", "tool": "black"}
{"pattern": "test/data/lmfp/__init__.py", "tool": "black"}
{"pattern": "test/data/lmfp/foo.py", "tool": "black"}
{"pattern": "test/data/module.py", "tool": "black"}
{"pattern": "test/data/module2.py", "tool": "black"}
{"pattern": "test/data/noendingnewline.py", "tool": "black"}
{"pattern": "test/data/nonregr.py", "tool": "black"}
{"pattern": "test/data/regobjects.py", "tool": "black"}
{"pattern": "test/data/regobjects2.py", "tool": "black"}
{"pattern": "test/data/sub/momo.py", "tool": "black"}
{"pattern": "test/test_cache.py", "tool": "black"}
{"pattern": "test/test_changelog.py", "tool": "black"}
{"pattern": "test/test_configuration.py", "tool": "black"}
{"pattern": "test/test_date.py", "tool": "black"}
{"pattern": "test/test_decorators.py", "tool": "black"}
{"pattern": "test/test_deprecation.py", "tool": "black"}
{"pattern": "test/test_fileutils.py", "tool": "black"}
{"pattern": "test/test_graph.py", "tool": "black"}
{"pattern": "test/test_interface.py", "tool": "black"}
{"pattern": "test/test_modutils.py", "tool": "black"}
{"pattern": "test/test_pytest.py", "tool": "black"}
{"pattern": "test/test_registry.py", "tool": "black"}
{"pattern": "test/test_shellutils.py", "tool": "black"}
{"pattern": "test/test_table.py", "tool": "black"}
{"pattern": "test/test_taskqueue.py", "tool": "black"}
{"pattern": "test/test_testlib.py", "tool": "black"}
{"pattern": "test/test_textutils.py", "tool": "black"}
{"pattern": "test/test_tree.py", "tool": "black"}
{"pattern": "test/test_umessage.py", "tool": "black"}
{"pattern": "test/test_ureports_html.py", "tool": "black"}
{"pattern": "test/test_ureports_text.py", "tool": "black"}
{"pattern": "test/test_xmlutils.py", "tool": "black"}
{"pattern": "test/utils.py", "tool": "black"}
logilab/common/changelog.py
View file @
823dfc0d
...
...
@@ -134,7 +134,7 @@ class ChangeLogEntry(object):
raise
NotImplementedError
(
"sub message to specific key "
"are not implemented yet"
)
def
write
(
self
,
stream
:
StringIO
=
sys
.
stdout
)
->
None
:
"""write the entry to file
"""
"""write the entry to file"""
stream
.
write
(
"%s -- %s
\n
"
%
(
self
.
date
or
""
,
self
.
version
or
""
))
for
msg
,
sub_msgs
in
self
.
messages
:
stream
.
write
(
"%s%s %s
\n
"
%
(
INDENT
,
BULLET
,
msg
[
0
]))
...
...
@@ -193,7 +193,7 @@ class ChangeLog(object):
entry
.
add_message
(
msg
)
def
load
(
self
)
->
None
:
"""
read a logilab's ChangeLog from file
"""
"""read a logilab's ChangeLog from file"""
try
:
stream
=
codecs
.
open
(
self
.
file
,
encoding
=
"utf-8"
)
except
IOError
:
...
...
logilab/common/configuration.py
View file @
823dfc0d
...
...
@@ -820,7 +820,7 @@ class OptionsManagerMixIn(object):
# help methods ############################################################
def
add_help_section
(
self
,
title
:
str
,
description
:
str
,
level
:
int
=
0
)
->
None
:
"""add a dummy option section for help purpose
"""
"""add a dummy option section for help purpose"""
group
=
optik_ext
.
OptionGroup
(
self
.
cmdline_parser
,
title
=
title
.
capitalize
(),
description
=
description
)
...
...
@@ -851,7 +851,7 @@ class OptionsManagerMixIn(object):
optik_ext
.
HelpFormatter
.
expand_default
=
self
.
__expand_default_backup
# type: ignore
def
help
(
self
,
level
:
int
=
0
)
->
str
:
"""return the usage string for available options
"""
"""return the usage string for available options"""
# mypy: "HelpFormatter" has no attribute "output_level"
# set in optik_ext
self
.
cmdline_parser
.
formatter
.
output_level
=
level
# type: ignore
...
...
logilab/common/registry.py
View file @
823dfc0d
...
...
@@ -1056,7 +1056,7 @@ class RegistryStore(dict):
reg
.
initialization_completed
()
def
_mdate
(
self
,
filepath
:
str
)
->
Optional
[
int
]:
"""
return the modification date of a file path
"""
"""return the modification date of a file path"""
try
:
return
stat
(
filepath
)[
-
2
]
except
OSError
:
...
...
@@ -1086,7 +1086,7 @@ class RegistryStore(dict):
return
False
def
load_file
(
self
,
filepath
:
str
,
modname
:
str
)
->
None
:
"""
load registrable objects (if any) from a python file
"""
"""load registrable objects (if any) from a python file"""
if
modname
in
self
.
_loadedmods
:
return
self
.
_loadedmods
[
modname
]
=
{}
...
...
logilab/common/ureports/docbook_writer.py
View file @
823dfc0d
...
...
@@ -62,7 +62,9 @@ class DocbookWriter(HTMLWriter):
def
visit_table
(
self
,
layout
):
"""display a table as html"""
self
.
writeln
(
self
.
_indent
(
" <table{}><title>{}</title>"
.
format
(
self
.
handle_attrs
(
layout
),
layout
.
title
))
self
.
_indent
(
" <table{}><title>{}</title>"
.
format
(
self
.
handle_attrs
(
layout
),
layout
.
title
)
)
)
self
.
writeln
(
self
.
_indent
(
' <tgroup cols="%s">'
%
layout
.
cols
))
for
i
in
range
(
layout
.
cols
):
...
...
@@ -124,8 +126,9 @@ class DocbookWriter(HTMLWriter):
def
visit_link
(
self
,
layout
):
"""display links (using <ulink>)"""
self
.
write
(
'<ulink url="{}"{}>{}</ulink>'
.
format
(
layout
.
url
,
self
.
handle_attrs
(
layout
),
layout
.
label
)
'<ulink url="{}"{}>{}</ulink>'
.
format
(
layout
.
url
,
self
.
handle_attrs
(
layout
),
layout
.
label
)
)
def
visit_verbatimtext
(
self
,
layout
):
...
...
test/data/__pkginfo__.py
View file @
823dfc0d
...
...
@@ -17,6 +17,7 @@
# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
"""logilab.common packaging information"""
from
os.path
import
join
__docformat__
=
"restructuredtext en"
import
sys
import
os
...
...
test/test_decorators.py
View file @
823dfc0d
...
...
@@ -110,16 +110,16 @@ class DecoratorsTC(TestCase):
class
Foo
:
@
cached
def
foo
(
self
):
"""
what's up doc ?
"""
"""what's up doc ?"""
def
bar
(
self
,
zogzog
):
"""
what's up doc ?
"""
"""what's up doc ?"""
bar
=
cached
(
bar
,
1
)
@
cached
def
quux
(
self
,
zogzog
):
"""
what's up doc ?
"""
"""what's up doc ?"""
self
.
assertEqual
(
Foo
.
foo
.
__doc__
,
""" what's up doc ? """
)
self
.
assertEqual
(
Foo
.
foo
.
__name__
,
"foo"
)
...
...
@@ -132,7 +132,7 @@ class DecoratorsTC(TestCase):
class
Foo
:
@
cached
(
cacheattr
=
"_foo"
)
def
foo
(
self
):
"""
what's up doc ?
"""
"""what's up doc ?"""
foo
=
Foo
()
foo
.
foo
()
...
...
@@ -144,7 +144,7 @@ class DecoratorsTC(TestCase):
class
Foo
:
@
cached
(
cacheattr
=
"_foo"
)
def
foo
(
self
,
args
):
"""
what's up doc ?
"""
"""what's up doc ?"""
foo
=
Foo
()
foo
.
foo
(
1
)
...
...
@@ -156,7 +156,7 @@ class DecoratorsTC(TestCase):
class
Foo
:
@
cached
(
cacheattr
=
"_foo"
,
keyarg
=
1
)
def
foo
(
self
,
other
,
args
):
"""
what's up doc ?
"""
"""what's up doc ?"""
foo
=
Foo
()
foo
.
foo
(
2
,
1
)
...
...
@@ -169,7 +169,7 @@ class DecoratorsTC(TestCase):
@
property
@
cached
(
cacheattr
=
"_foo"
)
def
foo
(
self
):
"""
what's up doc ?
"""
"""what's up doc ?"""
foo
=
Foo
()
foo
.
foo
...
...
@@ -181,7 +181,7 @@ class DecoratorsTC(TestCase):
class
Foo
:
@
cached
(
cacheattr
=
"_foo"
)
def
foo
(
self
,
args
):
"""
what's up doc ?
"""
"""what's up doc ?"""
foo
=
Foo
()
foo
.
foo
(
1
)
...
...
@@ -202,7 +202,7 @@ class DecoratorsTC(TestCase):
@
cachedproperty
def
quux
(
self
):
"""
some prop
"""
"""some prop"""
return
42
foo
=
Foo
()
...
...
test/test_modutils.py
View file @
823dfc0d
...
...
@@ -80,7 +80,7 @@ class ModuleFileTC(ModutilsTestCase):
class
load_module_from_name_tc
(
ModutilsTestCase
):
"""
load a python module from it's name
"""
"""load a python module from it's name"""
def
test_knownValues_load_module_from_name_1
(
self
):
self
.
assertEqual
(
modutils
.
load_module_from_name
(
"sys"
),
sys
)
...
...
@@ -127,7 +127,7 @@ class get_module_part_tc(ModutilsTestCase):
class
modpath_from_file_tc
(
ModutilsTestCase
):
"""
given an absolute file path return the python module's path as a list
"""
"""given an absolute file path return the python module's path as a list"""
def
test_knownValues_modpath_from_file_1
(
self
):
with
warnings
.
catch_warnings
(
record
=
True
)
as
warns
:
...
...
test/test_tree.py
View file @
823dfc0d
...
...
@@ -47,10 +47,10 @@ def make_tree(tuple):
class
Node_ClassTest
(
TestCase
):
"""
a basic tree node, caracterised by an id"""
"""a basic tree node, caracterised by an id"""
def
setUp
(
self
):
"""
called before each test from this class
"""
"""called before each test from this class"""
self
.
o
=
make_tree
(
tree
)
def
test_flatten
(
self
):
...
...
@@ -195,7 +195,7 @@ class post_order_list_FunctionTest(TestCase):
""""""
def
setUp
(
self
):
"""
called before each test from this class
"""
"""called before each test from this class"""
self
.
o
=
make_tree
(
tree
)
def
test_known_values_post_order_list
(
self
):
...
...
@@ -235,7 +235,7 @@ class PostfixedDepthFirstIterator_ClassTest(TestCase):
""""""
def
setUp
(
self
):
"""
called before each test from this class
"""
"""called before each test from this class"""
self
.
o
=
make_tree
(
tree
)
def
test_known_values_next
(
self
):
...
...
@@ -253,7 +253,7 @@ class pre_order_list_FunctionTest(TestCase):
""""""
def
setUp
(
self
):
"""
called before each test from this class
"""
"""called before each test from this class"""
self
.
o
=
make_tree
(
tree
)
def
test_known_values_pre_order_list
(
self
):
...
...
@@ -293,7 +293,7 @@ class PrefixedDepthFirstIterator_ClassTest(TestCase):
""""""
def
setUp
(
self
):
"""
called before each test from this class
"""
"""called before each test from this class"""
self
.
o
=
make_tree
(
tree
)
def
test_known_values_next
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment