prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
test_stmt_simplify
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
test_thread_extent_simplify
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
test_if_likely
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
test_basic_likely_elimination
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
f
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
test_complex_likely_elimination
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
cumsum
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
sparse_lengths_sum
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
sls
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
def __init__(self, name, uri):
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: <|fim_middle|> weechat = Fak...
def command(self, cmd): print(cmd)
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
print(cmd)
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
"""An ignore rule. This provides instrumentation for converting ignore rules into weechat filters. It handles both types of ignore-together ignore rules. """ def __init__(self, ignorelist, rulename, rationale, typename='ignore', hostmasks=[], accountnames=[], patterns=[]): self.ignorelist = ...
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
self.ignorelist = ignorelist self.rulename = rulename.replace(' ', '_') self.rationale = rationale self.typename = typename self.hostmasks = hostmasks self.accountnames = accountnames self.patterns = patterns
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
"Install an ignore rule." subrule_ctr = 0 if self.typename == 'ignore': for pattern in self.hostmasks: weechat.command('/filter add ignore-together.{ignorelist}.{rulename}.{ctr} irc.* * {pattern}'.format( ignorelist=self.ignorelist.name, rulename=s...
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
"Uninstall an ignore rule." subrule_ctr = 0 if self.typename == 'ignore': for pattern in self.hostmasks: weechat.command('/filter del ignore-together.{ignorelist}.{rulename}.{ctr}'.format( ignorelist=self.ignorelist.name, rulename=self.rulename, ct...
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
"""A downloaded collection of rules. Handles merging updates vs current state, and so on.""" def __init__(self, name, uri): self.name = name self.uri = uri self.rules = [] def load(self): def build_rules(s): for k, v in s.items(): self.rules.a...
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
self.name = name self.uri = uri self.rules = []
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
def build_rules(s): for k, v in s.items(): self.rules.append(IgnoreRule(self, k, v.get('rationale', '???'), v.get('type', 'ignore'), v.get('hostmasks', []), v.get('accountnames', []), v.get('patterns', []))) def test_load_cb(payload): build_rules(yaml.load(payload...
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
for k, v in s.items(): self.rules.append(IgnoreRule(self, k, v.get('rationale', '???'), v.get('type', 'ignore'), v.get('hostmasks', []), v.get('accountnames', []), v.get('patterns', [])))
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
build_rules(yaml.load(payload))
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
[r.install() for r in self.rules]
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
[r.uninstall() for r in self.rules]
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
for pattern in self.hostmasks: weechat.command('/filter add ignore-together.{ignorelist}.{rulename}.{ctr} irc.* * {pattern}'.format( ignorelist=self.ignorelist.name, rulename=self.rulename, ctr=subrule_ctr, pattern=pattern)) subrule_ctr += 1 # ...
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
for pattern in self.patterns: weechat.command('/filter add ignore-together.{ignorelist}.{rulename}.{ctr} irc.* * {pattern}'.format( ignorelist=self.ignorelist.name, rulename=self.rulename, ctr=subrule_ctr, pattern=pattern)) subrule_ctr += 1
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
for pattern in self.hostmasks: weechat.command('/filter del ignore-together.{ignorelist}.{rulename}.{ctr}'.format( ignorelist=self.ignorelist.name, rulename=self.rulename, ctr=subrule_ctr)) subrule_ctr += 1
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
for pattern in self.patterns: weechat.command('/filter del ignore-together.{ignorelist}.{rulename}.{ctr}'.format( ignorelist=self.ignorelist.name, rulename=self.rulename, ctr=subrule_ctr)) subrule_ctr += 1
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
d = open(self.uri, 'r') return test_load_cb(d.read())
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def <|fim_middle|>(self, cmd): ...
command
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
__init__
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
install
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
uninstall
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
__init__
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
load
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
build_rules
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
test_load_cb
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
install
<|file_name|>ignoretogether.py<|end_file_name|><|fim▁begin|># ignore-together.py - a distributed ignore list engine for IRC. from __future__ import print_function import os import sys import yaml weechat_is_fake = False try: import weechat except: class FakeWeechat: def command(self, cmd): ...
uninstall
<|file_name|>test_vec_env.py<|end_file_name|><|fim▁begin|>from slm_lab.env.vec_env import make_gym_venv import numpy as np import pytest @pytest.mark.parametrize('name,state_shape,reward_scale', [ ('PongNoFrameskip-v4', (1, 84, 84), 'sign'), ('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None), ]) ...
('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None),
<|file_name|>test_vec_env.py<|end_file_name|><|fim▁begin|>from slm_lab.env.vec_env import make_gym_venv import numpy as np import pytest @pytest.mark.parametrize('name,state_shape,reward_scale', [ ('PongNoFrameskip-v4', (1, 84, 84), 'sign'), ('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None), ]) ...
seed = 0 frame_op = None frame_op_len = None venv = make_gym_venv(name, num_envs, seed, frame_op=frame_op, frame_op_len=frame_op_len, reward_scale=reward_scale) venv.reset() for i in range(5): state, reward, done, info = venv.step([venv.action_space.sample()] * num_envs) assert isin...
<|file_name|>test_vec_env.py<|end_file_name|><|fim▁begin|>from slm_lab.env.vec_env import make_gym_venv import numpy as np import pytest @pytest.mark.parametrize('name,state_shape,reward_scale', [ ('PongNoFrameskip-v4', (1, 84, 84), 'sign'), ('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None), ]) ...
seed = 0 frame_op = 'concat' # used for image, or for concat vector frame_op_len = 4 venv = make_gym_venv(name, num_envs, seed, frame_op=frame_op, frame_op_len=frame_op_len, reward_scale=reward_scale) venv.reset() for i in range(5): state, reward, done, info = venv.step([venv.action_spa...
<|file_name|>test_vec_env.py<|end_file_name|><|fim▁begin|>from slm_lab.env.vec_env import make_gym_venv import numpy as np import pytest @pytest.mark.parametrize('name,state_shape,reward_scale', [ ('PongNoFrameskip-v4', (1, 84, 84), 'sign'), ('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None), ]) ...
seed = 0 frame_op = 'stack' # used for rnn frame_op_len = 4 venv = make_gym_venv(name, num_envs, seed, frame_op=frame_op, frame_op_len=frame_op_len, reward_scale=reward_scale) venv.reset() for i in range(5): state, reward, done, info = venv.step([venv.action_space.sample()] * num_envs) ...
<|file_name|>test_vec_env.py<|end_file_name|><|fim▁begin|>from slm_lab.env.vec_env import make_gym_venv import numpy as np import pytest @pytest.mark.parametrize('name,state_shape,reward_scale', [ ('PongNoFrameskip-v4', (1, 84, 84), 'sign'), ('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None), ]) ...
seed = 0 frame_op = None frame_op_len = None venv = make_gym_venv(name, num_envs, seed, frame_op=frame_op, frame_op_len=frame_op_len, image_downsize=image_downsize) venv.reset() for i in range(5): state, reward, done, info = venv.step([venv.action_space.sample()] * num_envs) assert ...
<|file_name|>test_vec_env.py<|end_file_name|><|fim▁begin|>from slm_lab.env.vec_env import make_gym_venv import numpy as np import pytest @pytest.mark.parametrize('name,state_shape,reward_scale', [ ('PongNoFrameskip-v4', (1, 84, 84), 'sign'), ('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None), ]) ...
test_make_gym_venv_nostack
<|file_name|>test_vec_env.py<|end_file_name|><|fim▁begin|>from slm_lab.env.vec_env import make_gym_venv import numpy as np import pytest @pytest.mark.parametrize('name,state_shape,reward_scale', [ ('PongNoFrameskip-v4', (1, 84, 84), 'sign'), ('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None), ]) ...
test_make_gym_concat
<|file_name|>test_vec_env.py<|end_file_name|><|fim▁begin|>from slm_lab.env.vec_env import make_gym_venv import numpy as np import pytest @pytest.mark.parametrize('name,state_shape,reward_scale', [ ('PongNoFrameskip-v4', (1, 84, 84), 'sign'), ('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None), ]) ...
test_make_gym_stack
<|file_name|>test_vec_env.py<|end_file_name|><|fim▁begin|>from slm_lab.env.vec_env import make_gym_venv import numpy as np import pytest @pytest.mark.parametrize('name,state_shape,reward_scale', [ ('PongNoFrameskip-v4', (1, 84, 84), 'sign'), ('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None), ]) ...
test_make_gym_venv_downsize
<|file_name|>add_dict.py<|end_file_name|><|fim▁begin|>d = {} for i in range(100000): d[i] = i JS_CODE = ''' var d = {}; for (var i = 0; i < 100000; i++) { d[i] = i;<|fim▁hole|><|fim▁end|>
} '''
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
logger.addHandler(handler) if len(sys.argv) > 1 and sys.argv[1] == 'run':
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
return render_template('index.html'), 200
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
app_settings = {'GRAPHITE_HOST': settings.GRAPHITE_HOST, 'OCULUS_HOST': settings.OCULUS_HOST, 'FULL_NAMESPACE': settings.FULL_NAMESPACE, } resp = json.dumps(app_settings) return resp, 200
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
metric = request.args.get('metric', None) try: raw_series = REDIS_CONN.get(metric) if not raw_series: resp = json.dumps({'results': 'Error: No metric by that name'}) return resp, 404 else: unpacker = Unpacker(use_list = False) unpacker.feed...
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
def __init__(self): self.stdin_path = '/dev/null' self.stdout_path = settings.LOG_PATH + '/webapp.log' self.stderr_path = settings.LOG_PATH + '/webapp.log' self.pidfile_path = settings.PID_PATH + '/webapp.pid' self.pidfile_timeout = 5 def run(self): logger.info(...
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
self.stdin_path = '/dev/null' self.stdout_path = settings.LOG_PATH + '/webapp.log' self.stderr_path = settings.LOG_PATH + '/webapp.log' self.pidfile_path = settings.PID_PATH + '/webapp.pid' self.pidfile_timeout = 5
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
logger.info('starting webapp') logger.info('hosted at %s' % settings.WEBAPP_IP) logger.info('running on port %d' % settings.WEBAPP_PORT) app.run(settings.WEBAPP_IP, settings.WEBAPP_PORT)
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
resp = json.dumps({'results': 'Error: No metric by that name'}) return resp, 404
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
unpacker = Unpacker(use_list = False) unpacker.feed(raw_series) timeseries = [item[:2] for item in unpacker] resp = json.dumps({'results': timeseries}) return resp, 200
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
""" Start the server """ webapp = App() logger = logging.getLogger("AppLog") logger.setLevel(logging.DEBUG) formatter = logging.Formatter("%(asctime)s :: %(message)s", datefmt="%Y-%m-%d %H:%M:%S") handler = logging.FileHandler(settings.LOG_PATH + '/webapp.log') handler.setFormatter...
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
webapp.run()
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
daemon_runner = runner.DaemonRunner(webapp) daemon_runner.daemon_context.files_preserve = [handler.stream] daemon_runner.do_action()
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
index
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
app_settings
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
data
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
__init__
<|file_name|>webapp.py<|end_file_name|><|fim▁begin|>import redis import logging import simplejson as json import sys from msgpack import Unpacker from flask import Flask, request, render_template from daemon import runner from os.path import dirname, abspath # add the shared settings file to namespace sys.path.insert(...
run
<|file_name|>basesingleton.py<|end_file_name|><|fim▁begin|>''' Created on Nov 19, 2011 @author: scottporter ''' class BaseSingleton(object): _instance = None @classmethod def get_instance(cls): if cls._instance is None:<|fim▁hole|> return cls._instance<|fim▁end|>
cls._instance = cls()
<|file_name|>basesingleton.py<|end_file_name|><|fim▁begin|>''' Created on Nov 19, 2011 @author: scottporter ''' class BaseSingleton(object): <|fim_middle|> <|fim▁end|>
_instance = None @classmethod def get_instance(cls): if cls._instance is None: cls._instance = cls() return cls._instance
<|file_name|>basesingleton.py<|end_file_name|><|fim▁begin|>''' Created on Nov 19, 2011 @author: scottporter ''' class BaseSingleton(object): _instance = None @classmethod def get_instance(cls): <|fim_middle|> <|fim▁end|>
if cls._instance is None: cls._instance = cls() return cls._instance
<|file_name|>basesingleton.py<|end_file_name|><|fim▁begin|>''' Created on Nov 19, 2011 @author: scottporter ''' class BaseSingleton(object): _instance = None @classmethod def get_instance(cls): if cls._instance is None: <|fim_middle|> return cls._...
cls._instance = cls()
<|file_name|>basesingleton.py<|end_file_name|><|fim▁begin|>''' Created on Nov 19, 2011 @author: scottporter ''' class BaseSingleton(object): _instance = None @classmethod def <|fim_middle|>(cls): if cls._instance is None: cls._instance = cls() return cls._inst...
get_instance
<|file_name|>home.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding:utf-8 -*- """ @author: Will """ from django import forms from app01 import models class ImportFrom(forms.Form): HOST_TYPE=((1,"001"),(2,"002")) #替換爲文件 host_type = forms.IntegerField(<|fim▁hole|> ) ho...
widget=forms.Select(choices=HOST_TYPE)
<|file_name|>home.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding:utf-8 -*- """ @author: Will """ from django import forms from app01 import models class ImportFrom(forms.Form): <|fim_middle|> <|fim▁end|>
HOST_TYPE=((1,"001"),(2,"002")) #替換爲文件 host_type = forms.IntegerField( widget=forms.Select(choices=HOST_TYPE) ) hostname = forms.CharField() def __init__(self,*args,**kwargs): super(ImportFrom,self).__init__(*args,**kwargs) HOST_TYPE=((1,"00...
<|file_name|>home.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding:utf-8 -*- """ @author: Will """ from django import forms from app01 import models class ImportFrom(forms.Form): HOST_TYPE=((1,"001"),(2,"002")) #替換爲文件 host_type = forms.IntegerField( widget=forms.Select(...
rtFrom,self).__init__(*args,**kwargs) HOST_TYPE=((1,"001"),(2,"002")) #替換爲文件 self.fields['host_type'].widget.choices = models.userInfo.objects.all().values_list("id","name") models.userInfo.objects.get() models.userInfo.objects.filter()
<|file_name|>home.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # -*- coding:utf-8 -*- """ @author: Will """ from django import forms from app01 import models class ImportFrom(forms.Form): HOST_TYPE=((1,"001"),(2,"002")) #替換爲文件 host_type = forms.IntegerField( widget=forms.Select(...
elf,*arg
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
l = get_type (type_id) if not l: return None return l['name']
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
q = "SELECT id, type "\ "FROM asset_types WHERE id=%(type_id)s;" % locals() query = Query(q) if len(query) != 1: return None ret = {'id': type_id, 'name': query['type'][0]} return ret
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
q = "SELECT id, type "\ "FROM asset_types;" % locals() query = Query(q) if not len(query): return None ret = [] for x in query: d={'id': query[x]['id'], 'name': query[x]['type']} ret.append(d) return ret
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
import sys try: type_id = sys.argv[1] except IndexError: print 'Required test parameters: type_id' sys.exit(1) print 'Types:', get_types() print 'type_id %s, type_name %s' % (type_id, get_type_name(type_id)) print get_type(type_id),
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
return None
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
return None
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
return None
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
test()
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
get_type_name
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
get_type
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
get_types
<|file_name|>Type.py<|end_file_name|><|fim▁begin|># Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de # Aplicacion de las TIC basadas en Fuentes Abiertas, Spain. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
test
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Copyright 2013 - Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
"""Activate the sqlalchemy backend.""" objects.registry.add(abstract_plan.Plan, plan.Plan) objects.registry.add(abstract_plan.PlanList, plan.PlanList) objects.registry.add(abstract_srvc.Service, service.Service)
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Copyright 2013 - Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
"""Activate the sqlalchemy backend.""" objects.registry.add(abstract_plan.Plan, plan.Plan) objects.registry.add(abstract_plan.PlanList, plan.PlanList) objects.registry.add(abstract_srvc.Service, service.Service) objects.registry.add(abstract_srvc.ServiceList, service.ServiceList) objects.registr...
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># Copyright 2013 - Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
load
<|file_name|>__manifest__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Copyright 2016 Acsone SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Account Invoice Check Total', 'summary': """ Check if the verification total is equal to the bill's total""", 'v...
'views/account_invoice.xml', ], }
<|file_name|>devfilters.py<|end_file_name|><|fim▁begin|>from django import template from django.utils.safestring import mark_safe from mezzanine.conf import settings from mezzanine_developer_extension.utils import refactor_html register = template.Library() # Checking settings.TEMPLATE_STYLE. # Possible values are...
<|file_name|>devfilters.py<|end_file_name|><|fim▁begin|>from django import template from django.utils.safestring import mark_safe from mezzanine.conf import settings from mezzanine_developer_extension.utils import refactor_html register = template.Library() # Checking settings.TEMPLATE_STYLE. # Possible values are...
""" Renders content without cleaning the original. Replaces the terminal divs for a more complext html layout. """ new_content = refactor_html(content, style) return mark_safe(new_content)
<|file_name|>devfilters.py<|end_file_name|><|fim▁begin|>from django import template from django.utils.safestring import mark_safe from mezzanine.conf import settings from mezzanine_developer_extension.utils import refactor_html register = template.Library() # Checking settings.TEMPLATE_STYLE. # Possible values are...
msg = "Wrong terminal style format. Check the value of TERMINAL_STYLE"\ " in your settings.py file." raise Exception(msg)
<|file_name|>devfilters.py<|end_file_name|><|fim▁begin|>from django import template from django.utils.safestring import mark_safe from mezzanine.conf import settings from mezzanine_developer_extension.utils import refactor_html register = template.Library() # Checking settings.TEMPLATE_STYLE. # Possible values are...
safe_developer
<|file_name|>hello.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding: utf-8 -*- def helloworld(): """ Hello world routine !<|fim▁hole|><|fim▁end|>
""" print("Hello world!")
<|file_name|>hello.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding: utf-8 -*- def helloworld(): <|fim_middle|> <|fim▁end|>
""" Hello world routine ! """ print("Hello world!")
<|file_name|>hello.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding: utf-8 -*- def <|fim_middle|>(): """ Hello world routine ! """ print("Hello world!") <|fim▁end|>
helloworld
<|file_name|>b_lanterns.py<|end_file_name|><|fim▁begin|>import fileinput def str_to_int(s): return([ int(x) for x in s.split() ]) # args = [ 'line 1', 'line 2', ... ] def proc_input(args): (n, l) = str_to_int(args[0]) a = tuple(str_to_int(args[1]))<|fim▁hole|> list_a = list(a) list_a.sort() max_dist = max(list_a...
return(l, a) def solve(args, verbose=False): (l, a) = proc_input(args)
<|file_name|>b_lanterns.py<|end_file_name|><|fim▁begin|>import fileinput def str_to_int(s): <|fim_middle|> # args = [ 'line 1', 'line 2', ... ] def proc_input(args): (n, l) = str_to_int(args[0]) a = tuple(str_to_int(args[1])) return(l, a) def solve(args, verbose=False): (l, a) = proc_input(args) list_a = list...
return([ int(x) for x in s.split() ])