Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main(doi=None, prefix=PREFIX):
sys.excepthook = quiet_errors
config.setsocketstimeout(TO)
try:
doi = sys.argv[1] if not doi else doi[1]
data = doi2tex(doi)
if data:
print(data)
except:
usage(prefix)
def main(args=None, prefix=PREFIX):
sys.excepthook = quiet_errors
try:
args = sys.argv[1] if not args else args[1]
lnks = cover(args)
for k, v in lnks.items():
print("%s: %s" % (k, v))
except:
usage(prefix)
def main():
sys.excepthook = quiet_errors
success = ren(sys.argv[1:]) if len(sys.argv) > 1 else False
if success:
return
providers = list(registry.services.keys())
if 'default' in providers:
providers.remove('default')
available = '|'.join(providers)
usage(available)
def main(isbn=None, prefix=PREFIX):
sys.excepthook = quiet_errors
try:
isbn = sys.argv[1] if not isbn else isbn[1]
print(ean13(isbn))
except:
usage(prefix)
def main(isbn=None, prefix=PREFIX):
sys.excepthook = quiet_errors
try:
isterminal = sys.stdin.isatty()
if not isterminal:
return do_pipe()
isbn = sys.argv[1] if not isbn else isbn[1]
out = get_canonical_isbn(isbn)
if out:
print(out)
except:
return usage(prefix)
def main(args=None, prefix=PREFIX):
"""Metadata for a given ISBN."""
sys.excepthook = quiet_errors
try:
return do_terminal(args) if sys.stdin.isatty() else do_pipe()
except:
providers = list(registry.services.keys())[:]
try:
providers.remove('default')
except:
pass
available = '|'.join(sorted(providers))
bibf = fmts[:]
try:
bibf.remove('labels')
except:
pass
ofmts = '|'.join(sorted(bibf))
return usage(prefix, available, ofmts)
def main(args=None, prefix=PREFIX):
sys.excepthook = quiet_errors
try:
args = sys.argv[1] if not args else args[1]
content = desc(args)
content = fill(content, width=75) if content else None
if content:
uprint(content)
except:
usage(prefix)
def main(args=None, prefix=PREFIX):
sys.excepthook = quiet_errors
try:
args = sys.argv if not args else args
except:
return usage(prefix)
if len(args) < 2:
return usage(prefix)
try:
if PY2:
words = args[1].decode(sys.stdin.encoding)
words = words.encode('UTF-8')
else:
# FIXME see: isbnlib.dev.webservice
words = args[1]
print(isbn_from_words(words))
return 0
def main(isbn=None, prefix=PREFIX):
sys.excepthook = quiet_errors
try:
isbn = sys.argv[1] if not isbn else isbn[1]
isbn13 = to_isbn13(isbn)
if isbn13:
print(isbn13)
except:
return usage(prefix)
def main(isbn=None, prefix=PREFIX):
sys.excepthook = quiet_errors
try:
isbn = sys.argv[1] if not isbn else isbn[1]
output = mask(isbn)
if output:
print(output)
except:
usage(prefix)