Skip to content

Commit

Permalink
code conventions + config
Browse files Browse the repository at this point in the history
  • Loading branch information
loechel committed Jul 7, 2017
1 parent 65ebe1c commit 292bd23
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
11 changes: 11 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[run]
branch = True
source = src
omit =


[report]
precision = 2

[html]
directory = reports/coverage
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ dist/
*.egg-info/
.tox/
!.gitattributes
!.coveragerc
/reports/
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ ignore =
N806,
N812,

max_line_length = 120
max_line_length = 160
1 change: 1 addition & 0 deletions src/z3c/autoinclude/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import logging
import os


# NOQA: E501


Expand Down
10 changes: 5 additions & 5 deletions src/z3c/autoinclude/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ def distributionForDottedName(package_dottedname):
valid_dists_for_package = full_matches + sorted(partial_matches)

if len(valid_dists_for_package) == 0:
raise LookupError("No distributions found for package `%s`; are you sure it is importable?" % package_dottedname) # NOQA: E501
raise LookupError("No distributions found for package `%s`; are you sure it is importable?" % package_dottedname)

if len(valid_dists_for_package) > 1:
non_namespaced_dists = [(dist, ns_packages)
for dist, ns_packages
in valid_dists_for_package if len(ns_packages) == 0] # NOQA: E501
non_namespaced_dists = [(dist, namespace_packages)
for dist, namespace_packages
in valid_dists_for_package if len(namespace_packages) == 0]
if len(non_namespaced_dists) == 0:
# if we only have namespace packages at this point,
# 'foo.bar' and 'foo.baz', while looking for 'foo', we can
Expand All @@ -137,7 +137,7 @@ def distributionForDottedName(package_dottedname):
# Otherwise, to be deterministic (because the order depends on both sys.path
# and `find_distributions`) we will sort them by project_name and return
# the first value.
valid_dists_for_package.sort(key=lambda dist_ns: dist_ns[0].project_name) # NOQA: E501
valid_dists_for_package.sort(key=lambda dist_ns: dist_ns[0].project_name)

return valid_dists_for_package[0][0]

Expand Down

0 comments on commit 292bd23

Please sign in to comment.