code stringlengths 281 23.7M |
|---|
def extractDthoursonpalmerCom(item):
(vol, chp, frag, postfix) = extractVolChapterFragmentPostfix(item['title'])
if ((not (chp or vol)) or ('preview' in item['title'].lower())):
return None
tagmap = [('PRC', 'PRC', 'translated'), ('Loiterous', 'Loiterous', 'oel')]
for (tagname, name, tl_type) in... |
def downgrade():
op.drop_index(op.f('ix_privacypreferencehistory_created_at'), table_name='privacypreferencehistory')
op.drop_index(op.f('ix_currentprivacypreference_updated_at'), table_name='currentprivacypreference')
op.drop_index(op.f('ix_currentprivacypreference_created_at'), table_name='currentprivacyp... |
_flyte_cli.command('register-project', cls=_FlyteSubCommand)
_project_identifier_option
_project_name_option
_project_description_option
_host_option
_insecure_option
def register_project(identifier, name, description, host, insecure):
_welcome_message()
client = _get_client(host, insecure)
client.register_... |
class Result():
body: Optional[bytes]
def __init__(self, query, res):
self.query = query
query.result = self
self.parent = query.parent
self.status = res.get('status')
self.headers = res.get('headers')
self.messages = res.get('messages')
self.tls = res.get... |
def test_owly_short_method():
params = urlencode({'apiKey': 'TEST_KEY', 'longUrl': expanded})
body = json.dumps({'results': {'shortUrl': shorten}})
mock_url = f'{owly.api_url}shorten?{params}'
responses.add(responses.GET, mock_url, body=body, match_querystring=True)
shorten_result = owly.short(expan... |
def mock_gids_in_passwd_pass(self, cmd):
if ('/etc/group' in cmd):
output = ['1000', '1001', '']
elif ('/etc/passwd' in cmd):
output = ['1000', '1001', '']
else:
output = ['']
error = ['']
returncode = 0
return SimpleNamespace(stdout=output, stderr=error, returncode=retur... |
class LPDDR4Output():
def __init__(self, nphases, databits):
self.clk = Signal((2 * nphases))
self.cke = Signal(nphases)
self.odt = Signal(nphases)
self.reset_n = Signal(nphases)
self.cs = Signal(nphases)
self.ca = [Signal(nphases) for _ in range(6)]
self.dmi_... |
class TokenCollection(object):
def __init__(self):
self.tokens = []
self.lookup = {}
self.patterns = {}
def __getattr__(self, attr):
try:
return self.lookup[attr]
except AttributeError:
pass
return object.__getattribute__(self, attr)
de... |
class MetaDataSelect(widgets.Select):
def render_option(self, selected_choices, option_value, option_label):
try:
properties = ' '.join((('%s="%s"' % kv) for kv in iteritems(option_value[2])))
except IndexError:
properties = ''
metadata = option_value[1]
optio... |
_bgp_error_metadata(code=RUNTIME_CONF_ERROR_CODE, sub_code=4, def_desc='Incorrect Value for configuration.')
class ConfigValueError(RuntimeConfigError):
def __init__(self, **kwargs):
conf_name = kwargs.get(CONF_NAME)
conf_value = kwargs.get(CONF_VALUE)
if (conf_name and conf_value):
... |
def enlarge_bins(bin_intervals):
chr_start = True
for idx in range((len(bin_intervals) - 1)):
(chrom, start, end, extra) = bin_intervals[idx]
(chrom_next, start_next, end_next, extra_next) = bin_intervals[(idx + 1)]
if (chr_start is True):
start = 0
chr_start = Fa... |
def path_relative_to_dir(path, dir):
partial_path_elems = []
while True:
(head, tail) = os.path.split(path)
partial_path_elems.append(tail)
if (tail == dir):
break
elif (not head):
print(path)
print(dir)
raise RuntimeError('no dir i... |
class AnyFileSearcher(AbstractSearcher):
exts = []
def __init__(self, path):
self._path = os.path.normpath(decode(path))
def __str__(self):
return ('%s{"%s"}' % (self.__class__.__name__, self._path))
def fileExists(self, mibname, mtime, rebuild=False):
if rebuild:
((d... |
('', doc={'description': 'Initiate a comparison'})
class RestComparePut(RestResourceBase):
URL = '/rest/compare'
_accepted(*PRIVILEGES['compare'])
(compare_model)
def put(self):
data = self.validate_payload_data(compare_model)
compare_id = normalize_compare_id(';'.join(data['uid_list']))... |
def validate_datapoint_format(datapoint: dict[(str, Any)], kind: str, zone_key: ZoneKey):
standard_keys = ['datetime', 'source']
keys_dict = {'production': (['zoneKey', 'production'] + standard_keys), 'consumption': (['zoneKey', 'consumption'] + standard_keys), 'exchange': (['sortedZoneKeys', 'netFlow'] + stand... |
class BasePlot(object):
def __init__(self):
clsname = f'{type(self).__module__}.{type(self).__name__}'
logger.info(clsname)
self._contourlevels = 3
self._colormap = _get_colormap('viridis')
self._ax = None
self._tight = False
self._showok = True
self._... |
def use_oserdese2(p, luts, connects):
p['oddr_mux_config'] = 'none'
p['tddr_mux_config'] = 'none'
p['DATA_RATE_OQ'] = verilog.quote(random.choice(('SDR', 'DDR')))
p['DATA_RATE_TQ'] = verilog.quote(random.choice(('BUF', 'SDR', 'DDR')))
if (verilog.unquote(p['DATA_RATE_OQ']) == 'SDR'):
data_wi... |
('tomate.ui.preference.extension', scope=SingletonScope)
class ExtensionTab():
(bus='tomate.bus', config='tomate.config', plugin_engine='tomate.plugin')
def __init__(self, bus: Bus, config: Config, plugin_engine: PluginEngine):
self._plugins = plugin_engine
self._config = config
self._bu... |
class TestObjectPropertiesClass(DefaultObject):
attr1 = AttributeProperty(default='attr1')
attr2 = AttributeProperty(default='attr2', category='attrcategory')
attr3 = AttributeProperty(default='attr3', autocreate=False)
attr4 = SubAttributeProperty(default='attr4')
cusattr = CustomizedProperty(defau... |
class DE94(DeltaE):
NAME = '94'
def __init__(self, kl: float=1, k1: float=0.045, k2: float=0.015, space: str='lab-d65'):
self.kl = kl
self.k1 = k1
self.k2 = k2
self.space = space
def distance(self, color: Color, sample: Color, kl: (float | None)=None, k1: (float | None)=None,... |
.parametrize('sync_mode, expected_full_db, expected_node_class', (('light', False, LightNode), ('fast', True, FullNode), ('full', True, FullNode), ('warp', True, FullNode)))
def test_sync_mode_effect_on_db_and_node_type(sync_mode, expected_full_db, expected_node_class):
trinity_config = TrinityConfig(network_id=1)
... |
def get_right_audio_support_and_sampling_rate(audio_format: str, sampling_rate: int, list_audio_formats: List):
if (not audio_format):
audio_format = 'mp3'
right_extension_sampling = next(filter((lambda x: (x[0] == audio_format)), audio_format_list_extensions), None)
samplings = right_extension_samp... |
def _build_argument_parser():
description = 'Wrapper script to run rms.'
usage = 'The script must be invoked with minimum three positional arguments:\n\n rms iens project workflow \n\nOptional arguments supported: \n target file [-t][--target-file]\n run path [-r][--run-path] default=rms/model\n import ... |
def downgrade():
op.drop_index(op.f('ix_ruletarget_key'), table_name='ruletarget')
op.drop_index(op.f('ix_ruletarget_id'), table_name='ruletarget')
op.drop_table('ruletarget')
op.drop_index(op.f('ix_rule_key'), table_name='rule')
op.drop_index(op.f('ix_rule_id'), table_name='rule')
op.drop_table... |
def import_optional_dependency(name: str, extra: str='', raise_on_missing: bool=True, on_version: str='raise') -> Optional['ModuleType']:
try:
module = importlib.import_module(name)
except ImportError:
if raise_on_missing:
raise ImportError(message.format(name=name, extra=extra)) fro... |
def _check_if_items_are_defined(method):
(method)
def check_items(self, *args, **kwargs):
if (getattr(self, 'items') is None):
raise KeyError('No items are defined in Pagination. Perhaps you forgot to specify it when creating Pagination instance?')
return method(self, *args, **kwargs... |
class StatsLabel(QLabel):
def __init__(self, text, align_right=False, parent=None):
super(StatsLabel, self).__init__('', parent)
self.format_text = '<font size=16>%s</font>'
self.setText(text)
if align_right:
self.setAlignment(Qt.AlignRight)
else:
self... |
def main():
import argparse
parser = argparse.ArgumentParser(description='Parse a db file, checking for consistency')
db_root_arg(parser)
parser.add_argument('--verbose', action='store_true', help='')
parser.add_argument('--strict', action='store_true', help='Complain on unresolved entries (ex: <0 c... |
class TestTransactionTable():
def setup_class(cls):
cls.db_context = _db_context()
cls.store = TransactionTable(cls.db_context)
cls.tx_hash = os.urandom(32)
def teardown_class(cls):
cls.store.close()
cls.db_context.close()
def setup_method(self):
db = self.sto... |
('copr_cli.main.next_page')
('configparser.ConfigParser.read')
def test_list_packages(read, next_page, capsys):
read.return_value = []
response_data = json.loads(read_res('list_packages_response.json'))
expected_output = read_res('list_packages_expected.json')
responses.add(responses.GET, ' json=respons... |
def dump(config: Dataclass, stream=None, omit_defaults: bool=False, **kwargs):
config_dict = encode(config)
if omit_defaults:
defaults_dict = encode(utils.get_defaults_dict(config))
config_dict = utils.remove_matching(config_dict, defaults_dict)
return save_config(config_dict, stream, **kwar... |
.xfail(reason='we use two spaces, Apple uses tabs')
def test_apple_formatting(parametrized_pl):
(pl, use_builtin_types) = parametrized_pl
pl = plistlib.loads(TESTDATA, use_builtin_types=use_builtin_types)
data = plistlib.dumps(pl, use_builtin_types=use_builtin_types)
assert (data == TESTDATA) |
class PanelSlide(Panel):
name = 'Slide Panel'
_option_cls = OptPanel.OptionPanelSliding
tag = 'div'
def __init__(self, page: primitives.PageModel, components: Optional[List[Html.Html]], title: Union[(Html.Html, str)], color: Optional[str], width: types.SIZE_TYPE, height: types.SIZE_TYPE, html_code: Opti... |
class FlexEdge(BaseEdge):
char = 'X'
description = 'Flex cut'
def __call__(self, x, h, **kw):
dist = self.settings.distance
connection = self.settings.connection
width = self.settings.width
burn = self.boxes.burn
h += (2 * burn)
lines = int((x // dist))
... |
(u'build of {distgit} DistGit namespaced {package_name} package from {committish} {committish_type} in {namespace} is done')
def step_build_from_fork(context, distgit, package_name, committish, committish_type, namespace):
_ = committish_type
distgit = distgit.lower()
build = context.cli.run_build(['build-d... |
class EvAdventureNPC(LivingMixin, DefaultCharacter):
is_pc = False
hit_dice = AttributeProperty(default=1, autocreate=False)
armor = AttributeProperty(default=1, autocreate=False)
morale = AttributeProperty(default=9, autocreate=False)
hp_multiplier = AttributeProperty(default=4, autocreate=False)
... |
def check_password_formatting(form, field):
ok = True
min = 6
if (len(field.data) < min):
field.errors.append('Password must be more than {} characters.'.format(min))
ok = False
if ((not any((s.isupper() for s in field.data))) and (not any((s.islower() for s in field.data)))):
fi... |
class CGPoint(object):
def __init__(self, element):
super(CGPoint, self).__init__()
self.element = element
def summary(self):
x = self.element.GetChildMemberWithName('x')
y = self.element.GetChildMemberWithName('y')
x_value = float(x.GetValue())
y_value = float(y.... |
_production
class AstNode(AstNodeBase, ProductionOps):
id: int
cfg = synthesized(default=UndefinedAttribute('CFG not defined'))
stage1_context: Stage1Context = inherited()
stage2_context: Stage2Context = inherited()
_solc_version = inherited()
def resolve_reference(self, node_id):
return... |
def test_one_form(M, f):
one_form = assemble(action(M, f))
assert isinstance(one_form, Cofunction)
for f in one_form.subfunctions:
if (f.function_space().rank == 2):
assert (abs((f.dat.data.sum() - (0.5 * sum(f.function_space().shape)))) < 1e-12)
else:
assert (abs((f.... |
def utf8(s, errors='replace'):
if (sys.version_info[0] <= 2):
if isinstance(s, (str, buffer)):
return unicode(s, 'utf-8', errors=errors)
elif (not isinstance(s, unicode)):
return unicode(str(s))
elif isinstance(s, bytes):
return s.decode('utf-8')
elif (not isi... |
class TestBaseTCFQuery():
.usefixtures('emerse_system')
def test_get_matching_privacy_declarations_enable_purpose_override_is_false(self, db):
(declarations, _, _) = get_tcf_base_query_and_filters(db)
assert (declarations.count() == 13)
mapping = {declaration.data_use: declaration.purpos... |
class FlattenConcatStateActionValueNet(FlattenConcatBaseNet):
def __init__(self, obs_shapes: Dict[(str, Sequence[int])], output_shapes: Dict[(str, Sequence[int])], hidden_units: List[int], non_lin: nn.Module):
super().__init__(obs_shapes, hidden_units, non_lin)
module_init = make_module_init_normc(s... |
class MidiThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.running = True
self.enabled = False
def setEnabled(self, enabled):
self.enabled = enabled
def stop(self):
self.enables = False
self.running = False
def run(self):
... |
class AccountChangeForm(UserChangeForm):
class Meta(object):
model = AccountDB
fields = '__all__'
username = forms.RegexField(label='Username', max_length=30, regex='^[\\w. +-]+$', widget=forms.TextInput(attrs={'size': '30'}), error_messages={'invalid': 'This value may contain only letters, spac... |
def show_schedule_dialog(parent_window):
index = get_index()
original_sched = Reader.note.reminder
nid = Reader.note_id
dialog = ScheduleDialog(Reader.note, parent_window)
if dialog.exec_():
schedule = dialog.schedule()
if (schedule != original_sched):
update_reminder(nid... |
class Options(object):
def __init__(self, options: Dict[(str, Any)]):
self.node = options.get('node', 'localhost')
self.listen = options.get('listen', '')
self.backend = options.get('backend', '')
self.interconnect = options.get('interconnect', '')
self.archive_path = options... |
class Place(ctlarg):
_fields = ('name', 'place')
_attributes = ('lineno', 'col_offset')
def __init__(self, name, place, lineno=0, col_offset=0, **ARGS):
ctlarg.__init__(self, **ARGS)
self.name = name
self.place = place
self.lineno = int(lineno)
self.col_offset = int(c... |
def push_urls_into_table(mapdict):
with db.session_context() as db_sess:
pbar = tqdm.tqdm(mapdict.items())
for (netloc, urls) in pbar:
have_item = db_sess.query(db.NewNetlocTracker).filter((db.NewNetlocTracker.netloc == netloc)).scalar()
if ((not have_item) and netloc):
... |
def main(finder, args, source=None):
try:
if (source is None):
source = os.path.dirname(snakes.__file__)
target = args[0]
exclude = args[1:]
if (not os.path.isdir(source)):
raise Exception('could not find SNAKES sources')
elif (not os.path.isdir(target... |
class TestFilterMatch(ApiBaseTest):
filter_match_fields = [('filer_type', models.CommitteeReports.means_filed)]
def setUp(self):
super(TestFilterMatch, self).setUp()
self.dates = [factories.CalendarDateFactory(event_id=123, calendar_category_id=1, summary='July Quarterly Report Due'), factories.... |
class Test_rans2p(object):
def setup_class(cls):
cls._scriptdir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, cls._scriptdir)
def teardown_class(cls):
sys.path.remove(cls._scriptdir)
pass
def setup_method(self, method):
self.aux_names = []
def te... |
class Analyser(MTModule):
errored = False
def __init__(self, config, module, storage=None):
super().__init__(config, module, storage)
if ((not isinstance(module, str)) or (module == '')):
raise InvalidAnalyserConfigError('You must provide a name for your analyser')
if (not is... |
class CompareRoutes(ComponentBase):
def __init__(self, **kwargs):
super().__init__(**kwargs)
_accepted(*PRIVILEGES['compare'])
('/compare/<compare_id>', GET)
def show_compare_result(self, compare_id):
compare_id = normalize_compare_id(compare_id)
with get_shared_session(self.db.c... |
def main():
global_config = config['Global']
valid_dataloader = build_dataloader(config, 'Eval', device, logger)
post_process_class = build_post_process(config['PostProcess'], global_config)
if hasattr(post_process_class, 'character'):
char_num = len(getattr(post_process_class, 'character'))
... |
def _check_min(rule):
value = rule['value']
if (rule['type'] in ('integer', 'float')):
if (value < rule['min']):
raise UnprocessableEntityException(BELOW_MINIMUM_MSG.format(**rule))
if (rule['type'] in ('text', 'enum', 'array', 'object')):
if (len(value) < rule['min']):
... |
class SphinxBuilder():
def __init__(self, app: SphinxTestApp, src_path: Path):
self.app = app
self._src_path = src_path
def src_path(self) -> Path:
return self._src_path
def out_path(self) -> Path:
return Path(self.app.outdir)
def build(self, assert_pass=True):
se... |
def test_field_io():
grid = make_pupil_grid(128)
field = make_circular_aperture(1)(grid)
formats = ['asdf', 'fits', 'fits.gz', 'pkl', 'pickle']
filenames = [('field_test.' + fmt) for fmt in formats]
for fname in filenames:
write_field(field, fname)
new_field = read_field(fname)
... |
def geocode_filter_subaward_locations(scope: str, values: list) -> Q:
or_queryset = Q()
location_mappings = {'country_code': {'sub_legal_entity': 'country_code', 'sub_place_of_perform': 'country_co'}, 'zip5': {'sub_legal_entity': 'zip5', 'sub_place_of_perform': 'zip5'}, 'city_name': {'sub_legal_entity': 'city_n... |
class TestMaxReactionsConfigVariable(BaseConfigTestVariable):
OPTION_NAME = 'max_reactions'
CONFIG_ATTR_NAME = 'max_reactions'
GOOD_VALUES = [1, 10]
INCORRECT_VALUES = ['sTrING?', (- 1), 0, 1.1]
REQUIRED = False
AEA_ATTR_NAME = 'max_reactions'
AEA_DEFAULT_VALUE = AEABuilder.DEFAULT_MAX_REACT... |
def pairing(Q: Optimized_Point3D[FQ2], P: Optimized_Point3D[FQ], final_exponentiate: bool=True) -> FQ12:
assert is_on_curve(Q, b2)
assert is_on_curve(P, b)
if ((P[(- 1)] == P[(- 1)].zero()) or (Q[(- 1)] == Q[(- 1)].zero())):
return FQ12.one()
return miller_loop(Q, P, final_exponentiate=final_exp... |
()
def get_procedure_prescribed(patient):
return frappe.db.sql('\n\t\t\tSELECT\n\t\t\t\tpp.name, pp.procedure, pp.parent, ct.practitioner,\n\t\t\t\tct.encounter_date, pp.practitioner, pp.date, pp.department\n\t\t\tFROM\n\t\t\t\t`tabPatient Encounter` ct, `tabProcedure Prescription` pp\n\t\t\tWHERE\n\t\t\t\tct.patie... |
class RegMap():
DATA_ADDR = 0
DATA_VAL_POS = 0
DATA_VAL_MSK =
CTRL_ADDR = 4
CTRL_VAL_POS = 0
CTRL_VAL_MSK = 65535
STATUS_ADDR = 8
STATUS_VAL_POS = 0
STATUS_VAL_MSK = 255
START_ADDR = 256
START_VAL_POS = 0
START_VAL_MSK = 1
def __init__(self, interface):
self.... |
class ApplicationDefault(Base):
def __init__(self):
super(ApplicationDefault, self).__init__()
self._g_credential = None
def get_credential(self):
self._load_credential()
return self._g_credential
def project_id(self):
self._load_credential()
return self._proj... |
class FaucetIPv6TupleTest(FaucetIPv4TupleTest):
MAX_RULES = 1024
ETH_TYPE = IPV6_ETH
NET_BASE = ipaddress.IPv6Network('fc00::00/64')
START_ACL_CONFIG = '\nacls:\n 1:\n exact_match: True\n rules:\n - rule:\n actions: {allow: 1}\n eth_type: 34525\n ip_proto: 6\n ipv6_... |
class TypeWafActiveRule(ModelSimple):
allowed_values = {('value',): {'WAF_ACTIVE_RULE': 'waf_active_rule'}}
validations = {}
additional_properties_type = None
_nullable = False
_property
def openapi_types():
return {'value': (str,)}
_property
def discriminator():
return N... |
class HSI(HSV):
BASE = 'srgb'
NAME = 'hsi'
SERIALIZE = ('--hsi',)
CHANNELS = (Channel('h', 0.0, 360.0, flags=FLG_ANGLE), Channel('s', 0.0, 1.0, bound=True), Channel('i', 0.0, 1.0, bound=True))
CHANNEL_ALIASES = {'hue': 'h', 'saturation': 's', 'intensity': 'i'}
WHITE = WHITES['2deg']['D65']
G... |
def extractNotfoundtlWordpressCom(item):
(vol, chp, frag, postfix) = extractVolChapterFragmentPostfix(item['title'])
if ((not (chp or vol)) or ('preview' in item['title'].lower())):
return None
tagmap = [('PRC', 'PRC', 'translated'), ('Loiterous', 'Loiterous', 'oel')]
for (tagname, name, tl_type... |
class Event(EventT):
def __init__(self, app: AppT, key: K, value: V, headers: Optional[HeadersArg], message: Message) -> None:
self.app: AppT = app
self.key: K = key
self.value: V = value
self.message: Message = message
if (headers is not None):
if (not isinstance... |
class TestText(util.PluginTestCase):
def setup_fs(self):
config = self.dedent("\n matrix:\n - name: text\n sources:\n - '{}/**/*.txt'\n aspell:\n lang: en\n d: en_US\n hunspell:\n d: en_US\... |
class TestGetUsers():
def _map_user_record_to_uid_email_phones(user_record):
return {'uid': user_record.uid, 'email': user_record.email, 'phone_number': user_record.phone_number}
def test_multiple_uid_types(self, new_user_record_list, new_user_with_provider):
get_users_results = auth.get_users([... |
def create_engine(db_uri, print_sql, auto_create):
if db_uri.startswith(_SQLITE_SCHEME):
path = db_uri[len(_SQLITE_SCHEME):]
if ((not auto_create) and (path != ':memory:')):
if (not Path(path).exists()):
raise ConnectError(("File %r doesn't exist. To create it, set auto_c... |
def test_bulk_all_errors_from_chunk_are_raised_on_failure(sync_client):
sync_client.indices.create(index='i', body={'mappings': {'properties': {'a': {'type': 'integer'}}}, 'settings': {'number_of_shards': 1, 'number_of_replicas': 0}})
sync_client.cluster.health(wait_for_status='yellow')
try:
for (ok... |
class OptionPlotoptionsVariablepieSonificationTracksActivewhen(Options):
def crossingDown(self):
return self._config_get(None)
def crossingDown(self, num: float):
self._config(num, js_type=False)
def crossingUp(self):
return self._config_get(None)
def crossingUp(self, num: float)... |
class flow_add(flow_mod):
version = 4
type = 14
_command = 0
def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
if (xid != None)... |
def _graphs_with_dangerous_reference_use() -> Tuple[(ControlFlowGraph, ControlFlowGraph)]:
in_cfg = ControlFlowGraph()
x = vars('x', 2, aliased=False)
y = vars('y', 2, aliased=True)
c = const(11)
in_node = BasicBlock(0, [_call('rand', [x[0]], []), _assign(y[0], _add(x[0], c[5])), _assign(x[1], y[0])... |
def copyright(ctx):
for (dirpath, dirnames, filenames) in os.walk(ROOT_DIR):
reldirpath = os.path.relpath(dirpath, ROOT_DIR)
if ((reldirpath[0] in '._') or reldirpath.endswith('__pycache__')):
continue
if (os.path.split(reldirpath)[0] in ('build', 'dist')):
continue
... |
def create_user(username, password, email=None, name=None, job_title=None, locale=None, disabled=None):
password = hash_password(password)
register = FlicketUser(username=username, email=email, name=name, password=password, job_title=job_title, date_added=datetime.datetime.now(), locale=locale, disabled=disable... |
def cleanup(fips_dir, proj_dir):
clion_dir = (proj_dir + '/.idea')
if os.path.isdir(clion_dir):
log.info(((log.RED + 'Please confirm to delete the following directory:') + log.DEF))
log.info(' {}'.format(clion_dir))
if util.confirm(((log.RED + 'Delete this directory?') + log.DEF)):
... |
def extractBuzyhoneybeeBlog(item):
(vol, chp, frag, postfix) = extractVolChapterFragmentPostfix(item['title'])
if ((not (chp or vol)) or ('preview' in item['title'].lower())):
return None
tagmap = [('PRC', 'PRC', 'translated'), ('Loiterous', 'Loiterous', 'oel')]
for (tagname, name, tl_type) in t... |
class OrderingDottedRelatedSerializer(serializers.ModelSerializer):
related_text = serializers.CharField(source='related_object.text')
related_title = serializers.CharField(source='related_object.title')
class Meta():
model = OrderingFilterRelatedModel
fields = ('related_text', 'related_titl... |
.parametrize('sending_elasticapm_client', [{'api_request_time': '2s'}], indirect=True)
def test_send_timer(sending_elasticapm_client, caplog):
with caplog.at_level('DEBUG', 'elasticapm.transport'):
assert (sending_elasticapm_client.config.api_request_time.total_seconds() == 2)
sending_elasticapm_cli... |
class LinearAD_SteadyState(AnalyticalSolutions.SteadyState):
from math import exp, sqrt
def __init__(self, b=[1.0, 0, 0], a=0.5):
self.b_ = b
self.a_ = a
bn = sqrt((((b[0] ** 2) + (b[1] ** 2)) + (b[2] ** 2)))
self.bn = bn
if (bn != 0.0):
self.D_ = old_div(1.0,... |
def test_wave_load_tablefile(wave, mocker, tmp_path):
wavegen = WaveformGenerator(mocker.Mock())
wavegen.load_function('SI1', 'tria')
def tria(x):
return (AnalogOutput.RANGE[1] * (abs(((x % 4) - 2)) - 1))
span = [(- 1), 3]
x = np.arange(span[0], span[1], ((span[1] - span[0]) / 512))
tabl... |
class OptionPlotoptionsPyramid3dSonificationDefaultinstrumentoptionsMappingVolume(Options):
def mapFunction(self):
return self._config_get(None)
def mapFunction(self, value: Any):
self._config(value, js_type=False)
def mapTo(self):
return self._config_get(None)
def mapTo(self, te... |
class ConfigurationWindow():
def __init__(self) -> None:
super().__init__()
builder = Gtk.Builder()
builder.add_from_file(os.path.join(TOP_DIR, 'glade_files/configure.glade'))
self.window = builder.get_object('configuration_window')
self.stt_combobox = builder.get_object('stt... |
class OefSearchDialogues(BaseOefSearchDialogues):
def __init__(self, self_address: Address, **kwargs) -> None:
def role_from_first_message(message: Message, receiver_address: Address) -> BaseDialogue.Role:
return OefSearchDialogue.Role.AGENT
BaseOefSearchDialogues.__init__(self, self_add... |
class PyPIChecker(Checker):
CHECKER_DATA_TYPE = 'pypi'
CHECKER_DATA_SCHEMA = {'type': 'object', 'properties': {'name': {'type': 'string'}, 'packagetype': {'type': 'string', 'enum': ['sdist', 'bdist_wheel']}, 'versions': OPERATORS_SCHEMA, 'stable-only': {'type': 'boolean'}}, 'required': ['name']}
async def c... |
class DebugSolverFrame():
def __init__(self):
self.commands = []
def str_lines(self, show_smt=False):
lines = []
for c in self.commands:
if (c[0] == 'bind'):
(cmd, names, rhs, smt) = c
cmd = 'bind '
for (nm, r) in zip(names, ... |
def extractTheklreadsBlogspotCom(item):
(vol, chp, frag, postfix) = extractVolChapterFragmentPostfix(item['title'])
if ((not (chp or vol)) or ('preview' in item['title'].lower())):
return None
tagmap = [('PRC', 'PRC', 'translated'), ('Loiterous', 'Loiterous', 'oel')]
for (tagname, name, tl_type)... |
class ConfigLoader(ABC):
def load_configuration(self, config_name: Optional[str], overrides: List[str], run_mode: RunMode, from_shell: bool=True, validate_sweep_overrides: bool=True) -> DictConfig:
...
def load_sweep_config(self, master_config: DictConfig, sweep_overrides: List[str]) -> DictConfig:
... |
.parametrize('text,input_strings,result_strings,result_offsets', [('Felipe and Jaime went to the library.', ['Felipe', 'Jaime', 'library'], ['Felipe', 'Jaime', 'library'], [(0, 6), (11, 16), (29, 36)]), ('The Manila Observatory was founded in 1865 in Manila.', ['Manila', 'The Manila Observatory'], ['Manila', 'Manila', ... |
def create():
root = getRootDir.getEnvsDir()
template = getFlag.getFlag('-t')
name = getArg.getArg(0)
if (not name):
sys.exit(text.createHelper)
if (not isRoot.isRoot()):
sys.exit(text.notRoot)
path = (root + name)
if (not createDir(path)):
sys.exit(text.envAlreadyExi... |
class MetaHandler(type):
def __new__(cls, name, bases, attrs):
new_class = type.__new__(cls, name, bases, attrs)
declared_events = OrderedDict()
all_events = OrderedDict()
events = []
for (key, value) in list(attrs.items()):
if isinstance(value, EventHandlerWrappe... |
def extractRinxlyWordpressCom(item):
(vol, chp, frag, postfix) = extractVolChapterFragmentPostfix(item['title'])
if ((not (chp or vol)) or ('preview' in item['title'].lower())):
return None
tagmap = [('PRC', 'PRC', 'translated'), ('Loiterous', 'Loiterous', 'oel')]
for (tagname, name, tl_type) in... |
.parametrize('original,translated', EVM_EQUIVALENTS.items())
def test_compile_input_json_evm_translates(solc5source, original, translated):
compiler.set_solc_version('0.5.7')
input_json = compiler.generate_input_json({'path.sol': solc5source}, True, 200, original)
compiler.compile_from_input_json(input_json... |
class NotificationEvent(BaseObject):
def __init__(self, api=None, body=None, id=None, recipients=None, subject=None, type=None, via=None, **kwargs):
self.api = api
self.body = body
self.id = id
self.recipients = recipients
self.subject = subject
self.type = type
... |
class Business(BusinessMixin, AbstractCrudObject):
def __init__(self, fbid=None, parent_id=None, api=None):
self._isBusiness = True
super(Business, self).__init__(fbid, parent_id, api)
class Field(AbstractObject.Field):
block_offline_analytics = 'block_offline_analytics'
collabor... |
def extractDaoIst(item):
(vol, chp, frag, postfix) = extractVolChapterFragmentPostfix(item['title'])
if ((not (chp or vol)) or ('preview' in item['title'].lower())):
return None
tagmap = [('zombie master', 'Zombie Master', 'translated'), ("Master's Smile", "Master's Smile", 'translated'), ('I became... |
def parse_args():
parser = argparse.ArgumentParser('Script for plotting rollout statistics.')
parser.add_argument('config', help='path to plot config file (args get updated).', type=str, default=None)
parser.add_argument('experiment_name_and_event_dir', type=str, nargs='+', help='list of experiments to plot... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.