Skip to content

Commit 992e7a6

Browse files
noqa: E501 tidying
1 parent 8ac66d7 commit 992e7a6

Some content is hidden

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

52 files changed

+109
-105
lines changed

cardinal_pythonlib/argparse_func.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ShowAllSubparserHelpAction(_HelpAction):
5555
shows help for all subparsers. As per
5656
5757
https://stackoverflow.com/questions/20094215/argparse-subparser-monolithic-help-output
58-
""" # noqa
58+
""" # noqa: E501
5959

6060
def __call__(
6161
self,
@@ -147,7 +147,7 @@ def str2bool(v: str) -> bool:
147147
default=NICE, # if the argument is entirely absent
148148
help="Activate nice mode.")
149149
150-
""" # noqa
150+
""" # noqa: E501
151151
lv = v.lower()
152152
if lv in ("yes", "true", "t", "y", "1"):
153153
return True

cardinal_pythonlib/athena_ohdsi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def match_tuple(self, target: "AthenaConceptRow") -> Tuple[float, float]:
213213
- https://www.nltk.org/
214214
215215
BINNED. We will use human judgement.
216-
""" # noqa
216+
""" # noqa: E501
217217
self_words = set(x.lower() for x in self.concept_name.split())
218218
other_words = set(x.lower() for x in target.concept_name.split())
219219
# More matching words better

cardinal_pythonlib/buildfunc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def git_clone(
136136
)
137137
run_func([git, "-C", directory, "reset", "--hard", commit])
138138
# Using a Git repository that's not in the working directory:
139-
# https://stackoverflow.com/questions/1386291/git-git-dir-not-working-as-expected # noqa
139+
# https://stackoverflow.com/questions/1386291/git-git-dir-not-working-as-expected # noqa: E501
140140
return True
141141

142142

cardinal_pythonlib/classes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
https://stackoverflow.com/questions/1776994
3838
https://docs.python.org/3/library/inspect.html
3939
https://github.com/edoburu/django-fluent-contents/issues/43
40-
https://bytes.com/topic/python/answers/843424-python-2-6-3-0-determining-if-method-inherited # noqa
40+
https://bytes.com/topic/python/answers/843424-python-2-6-3-0-determining-if-method-inherited # noqa: E501
4141
https://docs.python.org/3/reference/datamodel.html
4242
4343
In Python 2, you can do this:

cardinal_pythonlib/cmdline.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ def cmdline_split(s: str, platform: Union[int, str] = "this") -> List[str]:
4848
- ``1`` = POSIX;
4949
- ``0`` = Windows/CMD
5050
- (other values reserved)
51-
""" # noqa
51+
""" # noqa: E501
5252
if platform == "this":
5353
platform = sys.platform != "win32" # RNC: includes 64-bit Windows
5454

5555
if platform == 1: # POSIX
56-
re_cmd_lex = r""""((?:\\["\\]|[^"])*)"|'([^']*)'|(\\.)|(&&?|\|\|?|\d?\>|[<])|([^\s'"\\&|<>]+)|(\s+)|(.)""" # noqa
56+
re_cmd_lex = r""""((?:\\["\\]|[^"])*)"|'([^']*)'|(\\.)|(&&?|\|\|?|\d?\>|[<])|([^\s'"\\&|<>]+)|(\s+)|(.)""" # noqa: E501
5757
elif platform == 0: # Windows/CMD
58-
re_cmd_lex = r""""((?:""|\\["\\]|[^"])*)"?()|(\\\\(?=\\*")|\\")|(&&?|\|\|?|\d?>|[<])|([^\s"&|<>]+)|(\s+)|(.)""" # noqa
58+
re_cmd_lex = r""""((?:""|\\["\\]|[^"])*)"?()|(\\\\(?=\\*")|\\")|(&&?|\|\|?|\d?>|[<])|([^\s"&|<>]+)|(\s+)|(.)""" # noqa: E501
5959
else:
6060
raise AssertionError(f"unknown platform {platform!r}")
6161

cardinal_pythonlib/compression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def gzip_string(text: str, encoding: str = "utf-8") -> bytes:
8888
print(gz1 == gz2) # False
8989
# ... but the difference is probably in the timestamp bytes!
9090
91-
""" # noqa
91+
""" # noqa: E501
9292
data = text.encode(encoding)
9393
return gzip.compress(data)
9494

cardinal_pythonlib/contexts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ def dummy_context_mgr():
3838
- https://stackoverflow.com/questions/27803059/conditional-with-statement-in-python
3939
- See also
4040
https://stackoverflow.com/questions/893333/multiple-variables-in-a-with-statement
41-
""" # noqa
41+
""" # noqa: E501
4242
yield None

cardinal_pythonlib/datetimefunc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def pendulum_to_utc_datetime_without_tz(x: DateTime) -> datetime.datetime:
222222
dt_utc_from_moscow = pendulum_to_utc_datetime_without_tz(in_moscow) # 6am, no timezone info
223223
dt_utc_from_london = pendulum_to_utc_datetime_without_tz(in_london) # 6am, no timezone info
224224
225-
""" # noqa
225+
""" # noqa: E501
226226
pendulum_in_utc = pendulum.UTC.convert(x)
227227
return pendulum_to_datetime_stripping_tz(pendulum_in_utc)
228228

cardinal_pythonlib/dbfunc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def genrows(
5656
Yields:
5757
each row
5858
"""
59-
# http://code.activestate.com/recipes/137270-use-generators-for-fetching-large-db-record-sets/ # noqa
59+
# http://code.activestate.com/recipes/137270-use-generators-for-fetching-large-db-record-sets/ # noqa: E501
6060
while True:
6161
results = cursor.fetchmany(arraysize)
6262
if not results:

cardinal_pythonlib/debugging.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@
3333
import sys
3434
import traceback
3535
from types import FrameType
36-
from typing import Any, Callable, List, Optional
36+
from typing import Any, Callable, List, Optional, TYPE_CHECKING
3737

3838
from cardinal_pythonlib.logs import get_brace_style_log_with_null_handler
3939

40+
if TYPE_CHECKING:
41+
# noinspection PyUnresolvedReferences
42+
from inspect import FrameInfo
43+
4044
log = get_brace_style_log_with_null_handler(__name__)
4145

4246

@@ -80,7 +84,7 @@ def get_class_name_from_frame(fr: FrameType) -> Optional[str]:
8084
If the call was to a member function of a class, this function attempts
8185
to read the class's name. It returns ``None`` otherwise.
8286
"""
83-
# https://stackoverflow.com/questions/2203424/python-how-to-retrieve-class-information-from-a-frame-object # noqa
87+
# https://stackoverflow.com/questions/2203424/python-how-to-retrieve-class-information-from-a-frame-object # noqa: E501
8488
args, _, _, value_dict = inspect.getargvalues(fr)
8589
# we check the first parameter for the frame function is named 'self'
8690
if len(args) and args[0] == "self":
@@ -138,7 +142,7 @@ def f1():
138142
That was called by: f1
139143
140144
"""
141-
# https://stackoverflow.com/questions/5067604/determine-function-name-from-within-that-function-without-using-traceback # noqa
145+
# https://stackoverflow.com/questions/5067604/determine-function-name-from-within-that-function-without-using-traceback # noqa: E501
142146
try:
143147
# noinspection PyProtectedMember
144148
frame = sys._getframe(back + 2)
@@ -241,7 +245,7 @@ def f1():
241245
# "0 back" is debug_callers, so "1 back" its caller
242246
# https://docs.python.org/3/library/inspect.html
243247
callers = [] # type: List[str]
244-
frameinfolist = inspect.stack() # type: List[FrameInfo] # noqa
248+
frameinfolist = inspect.stack() # type: List[FrameInfo]
245249
frameinfolist = frameinfolist[start_back:]
246250
for frameinfo in frameinfolist:
247251
frame = frameinfo.frame

0 commit comments

Comments
 (0)