Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_genconfig():
args1 = docopt(doc, "genconfig project1 google.com")
assert_equals(args1[''], 'project1')
assert_equals(args1[''], 'google.com')
assert_equals(args1['--type'], 'scraper')
assert_equals(args1['--selector'], 'xpath')
args2 = docopt(doc, "genconfig project1 google.com --type=crawler")
assert_equals(args2[''], 'project1')
assert_equals(args2[''], 'google.com')
assert_equals(args2['--type'], 'crawler')
assert_equals(args2['--selector'], 'xpath')
args3 = docopt(doc, "genconfig project1 google.com -s css")
assert_equals(args3[''], 'project1')
assert_equals(args3[''], 'google.com')
assert_equals(args3['--type'], 'scraper')
assert_equals(args3['--selector'], 'css')
def main():
args = docopt(__doc__, version=__version__)
success = holepunch(args)
if not success:
sys.exit(1)
def main():
"""Entry point for the HTML5 Linter."""
# Wrap sys stdout for python 2, so print can understand unicode.
if sys.version_info[0] < 3:
sys.stdout = codecs.getwriter("utf-8")(sys.stdout)
options = docopt.docopt(__doc__,
help=True,
version='html5_lint v%s' % __VERSION__)
disable_str = options['--disable'] or ''
disable = disable_str.split(',')
invalid_disable = set(disable) - set(_DISABLE_MAP.keys()) - set(('',))
if invalid_disable:
sys.stderr.write(
'Invalid --disable arguments: %s\n\n' % ', '.join(invalid_disable))
sys.stderr.write(__doc__)
return 1
exclude = [_DISABLE_MAP[d] for d in disable if d in _DISABLE_MAP]
clean_html = template_remover.clean(io.open(options['FILENAME']).read())
print(html_linter.lint(clean_html, exclude=exclude))
docoptOps.py --version | -v
docoptOps.py --help | -h
Arguments:
SERVICE_NAME service name
SERVICE_ACTION service action
Options:
-h --help show this help message and exit
-v --version show version and exit
"""
from docopt import docopt
import sys
service_action = ['start', 'stop', 'restart', 'reload', 'status']
if __name__ == '__main__':
arguments = docopt(__doc__, version='1.0.0rc2')
if arguments['SERVICE_ACTION'] in service_action:
pass
elif arguments['SERVICE_NAME'] in service_action:
tmp = arguments['SERVICE_ACTION']
arguments['SERVICE_ACTION'] = arguments['SERVICE_NAME']
arguments['SERVICE_NAME'] = tmp
else:
print(arguments)
sys.exit(1)
print("service", arguments['SERVICE_NAME'], arguments['SERVICE_ACTION'])
model.add_parameters("bias", len(alphabet))
# rnn's
encoder_frnn = LSTMBuilder(layers, input_dim, hidden_dim, model)
encoder_rrnn = LSTMBuilder(layers, input_dim, hidden_dim, model)
# 3 * INPUT_DIM + 2 * HIDDEN_DIM, as it gets previous output, input index, output index, BLSTM[i]
decoder_rnn = LSTMBuilder(layers, 2 * hidden_dim + 4 * input_dim + len(feature_types) * feat_input_dim, hidden_dim,
model)
model.load(tmp_model_path)
return model, encoder_frnn, encoder_rrnn, decoder_rnn
if __name__ == '__main__':
arguments = docopt.docopt(__doc__)
ts = time.time()
st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d_%H:%M:%S')
# default values
if arguments['TRAIN_PATH']:
train_path = arguments['TRAIN_PATH']
else:
train_path = '/Users/roeeaharoni/research_data/sigmorphon2016-master/data/turkish-task1-train'
if arguments['TEST_PATH']:
test_path = arguments['TEST_PATH']
else:
test_path = '/Users/roeeaharoni/research_data/sigmorphon2016-master/data/turkish-task1-dev'
if arguments['RESULTS_PATH']:
results_file_path = arguments['RESULTS_PATH']
else:
def main():
args = docopt(__doc__)
config_file = args[""] or "config/wireframe.yaml"
C.update(C.from_yaml(filename=config_file))
M.update(C.model)
pprint.pprint(C, indent=4)
random.seed(0)
np.random.seed(0)
torch.manual_seed(0)
device_name = "cpu"
os.environ["CUDA_VISIBLE_DEVICES"] = args["--devices"]
if torch.cuda.is_available():
device_name = "cuda"
torch.backends.cudnn.deterministic = True
torch.cuda.manual_seed(0)
print("Let's use", torch.cuda.device_count(), "GPU(s)!")
def main():
args = docopt(__doc__, version=cms.__version__)
if args['pyflakes']:
return static_analysis.pyflakes((cms, menus))
if args['authors']:
return generate_authors()
# configure django
warnings.filterwarnings(
'error', r"DateTimeField received a naive datetime",
RuntimeWarning, r'django\.db\.models\.fields')
default_name = ':memory:' if args['test'] else 'local.sqlite'
db_url = os.environ.get(
"DATABASE_URL",
def main():
arguments = docopt(__doc__)
data_dir = arguments['--data-dir']
pipeline = regression_pipeline(data_dir, val_every=0, batch_size=1)
show_image(pipeline)
def main():
args = docopt.docopt(__doc__)
teuthology.results.main(args)
Options:
-h --help Show this screen.
--version Show version.
"""
from docopt import docopt
from c42SharedLibrary import c42Lib
import json
import csv
import logging
import requests
import getpass
if __name__ == '__main__':
arguments = docopt(__doc__, version='moveUsersByOrg 1.0')
print(arguments)
c42Lib.cp_host = "http://aj-proserver"
c42Lib.cp_port = "4280"
c42Lib.cp_username = "admin"
c42Lib.cp_password = getpass.getpass('Enter your CrashPlan console password: ') # You will be prompted for your password
c42Lib.cp_logLevel = "INFO"
c42Lib.cp_logFileName = "moveUsersByOrg.log"
c42Lib.setLoggingLevel()
# ARG1 - Source Org ID
# ARG2 - Destination Org ID