Skip to content

Commit

Permalink
minor lint, update token again
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 21, 2023
1 parent be7128d commit a2aeafe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,5 @@ jobs:
changelog=$(git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD)
tag="${GITHUB_REF#refs/tags/}"
gh release create --title "argopt $tag stable" --draft --notes "$changelog" "$tag" dist/${{ steps.dist.outputs.whl }} dist/${{ steps.dist.outputs.whl_asc }}
env:
GH_TOKEN: ${{ github.token }}
23 changes: 10 additions & 13 deletions argopt/_argopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@
except (ImportError, LookupError):
__version__ = "UNKNOWN"
__author__ = "Casper da Costa-Luis <[email protected]>"
__date__ = "2016-2020"
__date__ = "2016-2023"
__licence__ = __license__ = "[MPLv2.0](https://mozilla.org/MPL/2.0/)"
__copyright__ = ' '.join(("Copyright (c)", __date__, __author__, __licence__))

log = logging.getLogger(__name__)

RE_ARG_ONCE = re.compile(r"(?<!Optional\(|neOrMore\()"
r"Argument\('(\S+?)', (\S+?), (\S+?)\)")
RE_ARG_STAR = re.compile(r"Optional\(OneOrMore\(Argument\("
r"'(\S+?)', (\S+?), (\S+?)\)\)\)")
RE_ARG_PLUS = re.compile(r"(?<!Optional\()"
r"OneOrMore\(Argument\('(\S+?)', (\S+?), (\S+?)\)\)")
RE_ARG_ONCE = re.compile(r"(?<!Optional\(|neOrMore\()Argument\('(\S+?)', (\S+?), (\S+?)\)")
RE_ARG_STAR = re.compile(r"Optional\(OneOrMore\(Argument\('(\S+?)', (\S+?), (\S+?)\)\)\)")
RE_ARG_PLUS = re.compile(r"(?<!Optional\()OneOrMore\(Argument\('(\S+?)', (\S+?), (\S+?)\)\)")
RE_ARG_QEST = re.compile(r"Optional\(Argument\('(\S+?)', (\S+?), (\S+?)\)\)")


Expand All @@ -46,8 +43,8 @@ def docopt_parser(doc='', logLevel=logging.NOTSET, **_kwargs):
doc : docopt compatible, with optional type specifiers [default: '':str].
"""
options, args = parse_defaults(doc)
log.log(logLevel, "options:%r" % options)
log.log(logLevel, "args:%r" % args)
log.log(logLevel, "options:%r", options)
log.log(logLevel, "args:%r", args)
usage = printable_usage(doc)
pattern = parse_pattern(formal_usage(usage), options)
# pattern_arguments = pattern.flat(Argument)
Expand All @@ -65,8 +62,8 @@ def docopt_parser(doc='', logLevel=logging.NOTSET, **_kwargs):
opt_names.extend(filter(lambda x: x is not None, [opt.short, opt.long]))
opts.append(opt)
else:
log.warn("dropped:%r" % opt)
log.log(logLevel, "opts:%r" % opts)
log.warn("dropped:%r", opt)
log.log(logLevel, "opts:%r", opts)

if 'version' in _kwargs:
if not any(o.name == '--version' for o in opts):
Expand Down Expand Up @@ -180,15 +177,15 @@ def argopt(doc='', argparser=ArgumentParser, formatter_class=RawDescriptionHelpF
parser = argparser(formatter_class=formatter_class, **_kwargs)

for a in args:
log.log(logLevel, "a:%r" % a)
log.log(logLevel, "a:%r", a)
k = {}
if a.type is not None:
k['type'] = a.type
if a.value is not None:
k['default'] = a.value
parser.add_argument(a.name_stripped, nargs=a.nargs, help=a.desc, **k)
for o in opts:
log.log(logLevel, "o:%r" % o)
log.log(logLevel, "o:%r", o)
if o.name in ('-h', '--help'):
continue
if '--version' == o.name:
Expand Down

0 comments on commit a2aeafe

Please sign in to comment.