code
stringlengths
281
23.7M
class DirectoryList(Processor): input_variables = {'pattern': {'description': 'Shell glob pattern to match files by', 'required': True}, 'find_method': {'description': 'Type of pattern to match. Currently only supported type is "glob" (also the default)', 'default': 'glob', 'required': False}, 'remove_extension': {...
class TypeAbbrevA(ArgumentProcessor): _shorthand = {'R': T.R, 'f16': T.f16, 'f32': T.f32, 'f64': T.f64, 'i8': T.int8, 'ui8': T.uint8, 'ui16': T.uint16, 'i32': T.int32} def __call__(self, typ, all_args): if (typ in TypeAbbrevA._shorthand): return TypeAbbrevA._shorthand[typ] else: ...
def test_get_id_range_for_partition_with_sparse_range(): min_id = 4 max_id = 5999 partition_size = 2000 id_range_item_count = ((max_id - min_id) + 1) record_ids = {4, 5, 7, 99, 101, 120, 1998, 1999, 2000, 2001, 2002, 4444, 5999} etl_config = {'partition_size': partition_size} ctrl = Postgres...
class TextLength(FeatureDescriptor): def feature(self, column_name: str) -> GeneratedFeature: return text_length_feature.TextLength(column_name, self.display_name) def for_column(self, column_name: str): return text_length_feature.TextLength(column_name, self.display_name).feature_name()
def _create_plot_component(): x = random.uniform(0.0, 10.0, 50) y = random.uniform(0.0, 5.0, 50) pd = ArrayPlotData(x=x, y=y) plot = Plot(pd, border_visible=True, overlay_border=True) scatter = plot.plot(('x', 'y'), type='scatter', color='lightblue')[0] plot.title = 'Scatter Inspector Demo' ...
class Role(Base): __tablename__ = 'sys_role' id: Mapped[id_key] = mapped_column(init=False) name: Mapped[str] = mapped_column(String(20), unique=True, comment='') data_scope: Mapped[(int | None)] = mapped_column(default=2, comment='(1: 2:)') status: Mapped[int] = mapped_column(default=1, comment='(0...
.parametrize('c', ['\\', '?', '+', ':', '*']) .usefixtures('use_tmpdir') def test_char_in_unquoted_is_allowed(c): test_config_file_name = 'test.ert' test_config_contents = dedent(f''' NUM_REALIZATIONS 1 RUNPATH path{c}a/b ''') with open(test_config_file_name, 'w', encoding='utf-8') a...
.django_db def test_non_match_from_unintuitive_tas_from_agency(client, monkeypatch, elasticsearch_award_index, subaward_with_unintuitive_agency): _setup_es(client, monkeypatch, elasticsearch_award_index) resp = query_by_tas_subaward(client, {'require': [_agency_path(ATA_TAS)]}) assert (resp.json()['results'...
def main(): meta_path = Path('dataset/tts/WenetSpeech/WenetSpeech.json') dataset_path = Path('dataset/tts/WenetSpeech') cleaned_path = Path('dataset/tts/WenetSpeech/cleaned') if (not cleaned_path.exists()): cleaned_path.mkdir(parents=True) demucs = init_model('htdemucs', device) print('M...
class TestOOOXMLFilter(util.PluginTestCase): def test_docx(self): config = self.dedent("\n matrix:\n - name: docx\n sources:\n - 'tests/**/*.docx'\n aspell:\n lang: en\n d: en_US\n hunspell:\n ...
def get_reconciled_tree_zmasek(gtree, sptree, inplace=False): def cleanup(tree): for node in tree.traverse(): node.del_prop('M') if (not inplace): gtree = gtree.copy('deepcopy') missing_sp = (gtree.get_species() - sptree.get_species()) if missing_sp: raise KeyError(('...
class Perm021FCCCRBiasTestCase(unittest.TestCase): def _test_perm021fc_ccr_bias(self, test_name='perm021fc_ccr_bias', dtype='float16'): B = 1024 M = 128 K = 742 N = 64 target = detect_target() X = Tensor(shape=[B, K, M], dtype=dtype, name='input_0', is_input=True) ...
def register_args(program: ArgumentParser) -> None: program.add_argument('--face-debugger-items', help=wording.get('face_debugger_items_help').format(choices=', '.join(frame_processors_choices.face_debugger_items)), default=['kps', 'face-mask'], choices=frame_processors_choices.face_debugger_items, nargs='+', metav...
class Admin(User): def __init__(self, first_name, last_name, username, email, location): super().__init__(first_name, last_name, username, email, location) self.privileges = [] def show_privileges(self): print('\nPrivileges:') for privilege in self.privileges: print(f...
def test_draw_affine(): with Image(width=100, height=100, background='skyblue') as img: was = img.signature img.format = 'png' with Drawing() as ctx: ctx.affine([1.5, 0.5, 0, 1.5, 45, 25]) ctx.rectangle(top=5, left=5, width=25, height=25) ctx.draw(img) ...
def extractPenjournalhappyWordpressCom(item): (vol, chp, frag, postfix) = extractVolChapterFragmentPostfix(item['title']) if ((not (chp or vol)) or ('preview' in item['title'].lower())): return None tagmap = [('Villain Reformation System', 'Pulling Together a Villain Reformation Strategy', 'translat...
def match_to_str(ofmatch): keys = {'eth_src': 'dl_src', 'eth_dst': 'dl_dst', 'eth_type': 'dl_type', 'vlan_vid': 'dl_vlan', 'ipv4_src': 'nw_src', 'ipv4_dst': 'nw_dst', 'ip_proto': 'nw_proto', 'tcp_src': 'tp_src', 'tcp_dst': 'tp_dst', 'udp_src': 'tp_src', 'udp_dst': 'tp_dst'} match = {} ofmatch = ofmatch.to_j...
class close_raw_session_result(): thrift_spec = None thrift_field_annotations = None thrift_struct_annotations = None __init__ = None def isUnion(): return False def read(self, iprot): if ((isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeade...
_PathAttribute.register_type(BGP_ATTR_TYPE_EXTENDED_COMMUNITIES) class BGPPathAttributeExtendedCommunities(_PathAttribute): _ATTR_FLAGS = (BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANSITIVE) _class_prefixes = ['BGP'] def __init__(self, communities, flags=0, type_=None, length=None): super(BGPPathAttr...
def test_difference_same_mode_raises_exceptions_if_frame_1_frame_2_different_lengths(): with pytest.raises(scared.PreprocessError): scared.preprocesses.high_order.Difference(frame_1=range(60), mode='same') with pytest.raises(scared.PreprocessError): scared.preprocesses.high_order.Difference(fram...
class CLICommand(Command): def from_cli(cls, parser, argv, cfg): parser.add_argument('--exclude-block', action='append', dest='exclude_blocks', default=cfg('exclude_block', type=List(IPNet), default=[]), help='exclude CIDR blocks from check') args = parser.parse_args(argv) return cls(**vars(...
.asyncio .workspace_host class TestGetOAuthProvider(): async def test_unauthorized(self, unauthorized_api_assertions: HTTPXResponseAssertion, test_client_api: test_data: TestData): oauth_provider = test_data['oauth_providers']['google'] response = (await test_client_api.get(f'/oauth-providers/{oaut...
class String(TraitType): default_value_type = DefaultValue.constant def __init__(self, value='', minlen=0, maxlen=sys.maxsize, regex='', **metadata): super().__init__(value, **metadata) self.minlen = max(0, minlen) self.maxlen = max(self.minlen, maxlen) self.regex = regex ...
_view(['GET']) def ghost_generics(request, format=None): date = request.query_params.get('date') entity_code = request.query_params.get('entity_code') entity_type = request.query_params.get('entity_type').lower() group_by = request.query_params.get('group_by', 'practice') if (not date): rais...
def fortios_ftp_proxy(data, fos): fos.do_member_operation('ftp-proxy', 'explicit') if data['ftp_proxy_explicit']: resp = ftp_proxy_explicit(data, fos) else: fos._module.fail_json(msg=('missing task body: %s' % 'ftp_proxy_explicit')) return ((not is_successful_status(resp)), (is_successfu...
.skipif(utils.complex_mode, reason='Not complex differentiable') def test_coefficient_derivatives(): m = UnitSquareMesh(3, 3) x = SpatialCoordinate(m) V = FunctionSpace(m, 'CG', 1) f = Function(V) g = Function(V) f.interpolate(((1 + x[0]) + x[1])) g.assign((f + 1)) cd = {g: 1} phi = ...
class OptionPlotoptionsSunburstSonificationDefaultinstrumentoptionsMappingTremoloSpeed(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(sel...
_ordering class ASPathFilter(Filter): POLICY_TOP = 2 POLICY_END = 3 POLICY_INCLUDE = 4 POLICY_NOT_INCLUDE = 5 def __init__(self, as_number, policy): super(ASPathFilter, self).__init__(policy) self._as_number = as_number def __lt__(self, other): return (self.as_number < ot...
class ComposerHandler(object): def __init__(self, db_factory: typing.Union[(transactional_session_maker, None)]=None, compose_dir: str=config.get('compose_dir')): if (not db_factory): self.db_factory = transactional_session_maker() else: self.db_factory = db_factory s...
def run_tasks(tasks: List[str]) -> None: from src.task import run_task def parse_task(t: str) -> Union[(str, Dict[(str, Any)])]: logging.debug('Parsing: %s', t) if t.startswith('{'): res = json.loads(t) assert isinstance(res, dict) return res return t ...
class OptionSeriesTimelineSonificationDefaultspeechoptionsMapping(Options): def pitch(self) -> 'OptionSeriesTimelineSonificationDefaultspeechoptionsMappingPitch': return self._config_sub_data('pitch', OptionSeriesTimelineSonificationDefaultspeechoptionsMappingPitch) def playDelay(self) -> 'OptionSeriesT...
def check_element(element, top=True): if ((element.cell.cellname() == 'hexahedron') and (element.family() not in ['Q', 'DQ'])): raise NotImplementedError("Currently can only use 'Q' and/or 'DQ' elements on hexahedral meshes, not", element.family()) if (type(element) in (finat.ufl.BrokenElement, finat.uf...
class InventoryConfig(AbstractInventoryConfig): def __init__(self, organization_id, gsuite_sa_path, gsuite_admin_email, record_file=None, replay_file=None, *args, **kwargs): super(InventoryConfig, self).__init__(*args, **kwargs) def get_root_resource_id(self): raise NotImplementedError() def...
class FunctionGenerator(ABC): def set_channel_config(self, channel_config: FunctionChannelConfig) -> None: self.channel_config = channel_config def next_sample(self) -> FunctionGeneratorMessage: raise NotImplementedError() def next_n_samples(self, n: int=1) -> List[ndarray]: samples ...
class OptionPlotoptionsTimelineDatalabelsStyle(Options): def fontSize(self): return self._config_get('0.8em') def fontSize(self, num: float): self._config(num, js_type=False) def fontWeight(self): return self._config_get('normal') def fontWeight(self, text: str): self._co...
def mark_task_logs_as_failed(year, month): print('mark_task_logs_as_failed') with open((settings.PIPELINE_METADATA_DIR + '/tasks.json')) as f: tasks = json.load(f) graph = nx.DiGraph() for (task_name, task_def) in tasks.items(): for dependency_name in task_def.get('dependencies', []): ...
class OptionPlotoptionsPackedbubbleSonificationDefaultinstrumentoptionsMappingTremolo(Options): def depth(self) -> 'OptionPlotoptionsPackedbubbleSonificationDefaultinstrumentoptionsMappingTremoloDepth': return self._config_sub_data('depth', OptionPlotoptionsPackedbubbleSonificationDefaultinstrumentoptionsMa...
class bad_action_error_msg(error_msg): version = 5 type = 1 err_type = 2 def __init__(self, xid=None, code=None, data=None): if (xid != None): self.xid = xid else: self.xid = None if (code != None): self.code = code else: se...
def index_to_coords(index: int, shape): assert isinstance(index, int), (index, type(index)) result = ([None] * len(shape)) i = (len(shape) - 1) while (i >= 0): result[i] = (index % shape[i]) index = (index // shape[i]) i -= 1 result = tuple(result) assert (len(result) == ...
class OptionPlotoptionsLineLabelStyle(Options): def fontSize(self): return self._config_get('0.8em') def fontSize(self, num: float): self._config(num, js_type=False) def fontWeight(self): return self._config_get('bold') def fontWeight(self, text: str): self._config(text, ...
class ToolbarManager(GObject.Object): toolbar_pos = GObject.property(type=str, default=TopToolbar.name) def __init__(self, plugin, main_box, viewmgr): super(ToolbarManager, self).__init__() self.plugin = plugin controllers = self._create_controllers(plugin, viewmgr) self._bars = ...
class OptionPlotoptionsWaterfallSonificationDefaultinstrumentoptionsMappingTremoloDepth(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(se...
def viewer_and_approver_user(db): user = FidesUser.create(db=db, data={'username': 'test_fides_viewer_and_approver_user', 'password': '&%3Qe2fGo7'}) client = ClientDetail(hashed_secret='thisisatest', salt='thisisstillatest', scopes=[], roles=[VIEWER_AND_APPROVER], user_id=user.id) FidesUserPermissions.creat...
class CubeAxesActor2D(tvtk.CubeAxesActor2D): use_data_bounds = Bool(True) input_info = PipelineInfo(datasets=['any'], attribute_types=['any'], attributes=['any']) traits_view = View(Group(Group(Item('visibility'), HGroup(Item('x_axis_visibility', label='X axis'), Item('y_axis_visibility', label='Y axis'), I...
def monitor_generator(copr_dir, additional_fields): anti_garbage_collector = set([copr_dir]) packages = BuildsMonitorLogic.package_build_chroots(copr_dir) first = True for package in packages: if (first is True): checkpoint('First package queried') first = False c...
() def get_drugs_to_invoice(encounter): encounter = frappe.get_doc('Patient Encounter', encounter) if encounter: patient = frappe.get_doc('Patient', encounter.patient) if patient: if patient.customer: orders_to_invoice = [] medication_requests = frappe...
def _generate_c_getopt_code(processed_args, getopt_string, opts, positionals, has_longopts): ret = '' needs_endptr = False for arg in processed_args: if (arg.type in [ArgType.INT, ArgType.FLOAT]): needs_endptr = True break if needs_endptr: ret += ' char *endptr...
_pytree_node_class class JaxCustomMedium(CustomMedium, AbstractJaxMedium): permittivity: Optional[JaxDataArray] = pd.Field(None, title='Permittivity', description='Spatial profile of relative permittivity.') conductivity: Optional[JaxDataArray] = pd.Field(None, title='Conductivity', description='Spatial profile...
_HELPER_REGISTRY.register() class TestHelper(BaseDistillationHelper): def get_pseudo_labeler(self): return TestLabeler(self.teacher) def get_preprocess_student_input(self): return (lambda x: (x + 1)) def get_preprocess_teacher_input(self): return (lambda x: (x + 2)) def get_layer...
class TestSyntaxErrorReporting(util.TestCase): def test_syntax_error_has_text_and_position(self): with self.assertRaises(sv.SelectorSyntaxError) as cm: sv.compile('input.field[type=42]') e = cm.exception self.assertEqual(e.context, 'input.field[type=42]\n ^') se...
def test_authenticate_updates_user_password_if_stalker_fails_but_ldap_successes(ldap_server, create_test_db, monkeypatch): from ldap3.extend import StandardExtendedOperations def mock_return(*arg, **kwargs): return 'pipeline' monkeypatch.setattr(StandardExtendedOperations, 'who_am_i', mock_return) ...
class HTMLPickledCorpusReader(CategorizedCorpusReader, CorpusReader): def __init__(self, root, fileids=PKL_PATTERN, **kwargs): if (not any((key.startswith('cat_') for key in kwargs.keys()))): kwargs['cat_pattern'] = CAT_PATTERN CategorizedCorpusReader.__init__(self, kwargs) Corpu...
def to_ifelse_block(node_id: str, cs: ConditionalSection) -> Tuple[(_core_wf.IfElseBlock, typing.List[Binding])]: if (len(cs.cases) == 0): raise AssertionError('Illegal Condition block, with no if-else cases') if (len(cs.cases) < 2): raise AssertionError('At least an if/else is required. Danglin...
class DQMLP(nn.Module): def __init__(self, n_observations, n_actions, n_hidden): super().__init__() self.linear = nn.Linear(n_observations, n_hidden) self.linear_adv = nn.Linear(n_hidden, n_actions) self.linear_value = nn.Linear(n_hidden, 1) self.n_actions = n_actions def...
class JsD3(JsPackage): lib_alias = {'js': 'd3'} lib_selector = 'd3' def svg(self): return D3Svg(component=self.component, selector=('%s.svg' % self._selector), page=self.page) ({'d3': '4.0.0'}) def csv(self, url): return D3File(component=self.component, filename=url, selector=('%s.cs...
class ProbaMixin(object): def _setup_2_multiplier(self, X, y, job=None): if (self.proba and (y is not None)): self.classes_ = y def _get_multiplier(self, X, y, alt=1): if self.proba: multiplier = self.classes_ else: multiplier = alt return mult...
class CodeDisplay(QPlainTextEdit): double_click_word = Signal(str) select_token = Signal(str) def __init__(self, text: str, parent: QWidget): super().__init__(text, parent=parent) self.setReadOnly(True) self.resize(self.sizeHint()) self.setLineWrapMode(QPlainTextEdit.LineWrap...
def get_printable_message_args(msg, buff=None, prefix=''): try: from cStringIO import StringIO except ImportError: from io import StringIO if (buff is None): buff = StringIO() for f in msg.__slots__: if isinstance(getattr(msg, f), Message): get_printable_messa...
class TestYaml(): def test_dump(self, tmpdir): output_file = str(tmpdir.join('map_out.yaml')) print('output_file:', output_file) rmap = utils.create_template() rmap[0].etc['the_answer'] = 42 generators.Yaml(rmap, output_file).generate() rmap_test = RegisterMap() ...
class MovieLayout(object): def __init__(self): self._cameras = {'front': Camera(layout=self, camera='front'), 'left': Camera(layout=self, camera='left'), 'right': Camera(layout=self, camera='right'), 'rear': Camera(layout=self, camera='rear')} self._clip_order = ['left', 'right', 'front', 'rear'] ...
def start_pips(argList): (blockID, start, stop, total) = argList print(((('Running instance :' + str(blockID)) + ' / ') + str(total))) subprocess.check_call(((((('${XRAY_VIVADO} -mode batch -source $FUZDIR/job.tcl -tclargs ' + str(blockID)) + ' ') + str(start)) + ' ') + str(stop)), shell=True) uphill_wi...
class OptionsBackgroundColor(DataClass): def fill(self): return self._attrs['fill'] def fill(self, val): self._attrs['fill'] = val def stroke(self): return self._attrs['stroke'] def stroke(self, val): self._attrs['stroke'] = val def strokeWidth(self): return s...
class OptionSeriesBoxplotDataAccessibility(Options): def description(self): return self._config_get(None) def description(self, text: str): self._config(text, js_type=False) def enabled(self): return self._config_get(None) def enabled(self, flag: bool): self._config(flag,...
class CitationModel(Model): def get_data_generator(self, document_features_context: DocumentFeaturesContext) -> CitationDataGenerator: return CitationDataGenerator(document_features_context=document_features_context) def get_semantic_extractor(self) -> CitationSemanticExtractor: return CitationS...
class TagListPost(ResourceList): def before_post(_args, _kwargs, data): require_relationship(['event'], data) if (get_count(db.session.query(Tag.id).filter_by(name=data.get('name'), event_id=int(data['event']), deleted_at=None)) > 0): raise ConflictError({'pointer': '/data/attributes/nam...
def compute_haplotype_edit_distance(signature1, signature2, reference, window_padding=100): window_start = (min(signature1.start, signature2.start) - window_padding) window_end = (max(signature1.start, signature2.start) + window_padding) haplotype1 = reference.fetch(signature1.contig, max(0, window_start), ...
def extractHonquehonkWordpressCom(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 multi_model(): def __init__(self, cpu_model, gpu_model=None): self.cpu_model = cpu_model self.gpu_model = gpu_model def fit(self, x, y, **kwargs): if (self.gpu_model is not None): return self.gpu_model.fit(x, y, **kwargs) return self.cpu_model.fit(x, y, **kwargs...
def extractWwwMalevolencegameCom(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)...
def mock_audit_events_for_discretionary_access_control_changes_are_collected_pass(self, cmd): if ('auditctl' in cmd): stdout = ['-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat -F auid>=1000 -F auid!=-1 -F key=perm_mod', '-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat -F auid>=1000 -F auid!=-1 -F k...
class Fuzzer(): swaps = (('dev', 'stg', 'stage', 'test', 'qa', 'uat', 'preprod'), ('in', 'out'), ('inbound', 'outbound'), ('ext', 'int'), ('extern', 'intern'), ('external', 'internal'), ('local', 'global'), ('east', 'west'), ('private', 'public'), ('priv', 'pub'), ('ap', 'eu', 'na', 'la', 'ca'), ('nam', 'emea', 'ap...
def sed(file: str, pattern: str, replace: str) -> None: try: if (sys.platform in ['linux', 'linux2']): check_run(['sed', '-i', '-e', f's#{pattern}#{replace}#g', file], capture_output=False) elif (sys.platform == 'darwin'): check_run(['sed', '-i', '', '-e', f's#{pattern}#{repl...
_EXTRACTORS.register_module() class ChineseHubert(BaseFeatureExtractor): def __init__(self, model='TencentGameMate/chinese-hubert-base'): super().__init__() self.feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained(model) self.model = HubertModel.from_pretrained(model) _grad() ...
def format_co_flags(co_flags): if (not co_flags): return '0x00' names = [] remaining = co_flags for (name, flag) in CO_FLAGS.items(): if (co_flags & flag): remaining -= flag names.append(name) if remaining: raise NotImplementedError(remaining) retu...
class OptionPlotoptionsHistogramSonificationTracksMappingLowpassResonance(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, text: str)...
def test_json_parser(): parser = JsonParser() dependencies = parser.parse(package_json_file) assert (dependencies == ['-navigation/native', '-navigation/native-stack', 'expo', 'expo-clipboard', 'expo-status-bar', 'react', 'react-dom', 'react-native', 'react-native-safe-area-context', 'react-native-screens',...
class VideoRecordingSchema(JSONAPISchema): class Meta(): type_ = 'video-recording' self_view = 'v1.video_recording_detail' self_view_kwargs = {'id': '<id>'} inflect = dasherize id = fields.Str(dump_only=True) bbb_record_id = fields.Str() participants = fields.Integer(requ...
def print_to_file(): global crawled global link_to_files global externals global allfiles global directories global emails global directories_with_indexing global host_name global main_domain try: try: output_directory = main_domain.replace(' '') o...
def run_trace_projection(x, degree=1, family='DGT'): m = UnitSquareMesh((2 ** x), (2 ** x), quadrilateral=False) x = SpatialCoordinate(m) f = (((x[0] * (2 - x[0])) * x[1]) * (2 - x[1])) V_ho = FunctionSpace(m, 'CG', 6) ref = Function(V_ho).interpolate(f) T = FunctionSpace(m, family, degree) ...
def propagate_INT_lr_bits(database, tiles_by_grid, tile_frames_map, verbose=False): (int_frames, int_words, _) = localutil.get_entry('INT', 'CLB_IO_CLK') (verbose and print('')) for tile in database: if (database[tile]['type'] not in ['INT_L', 'INT_R']): continue if (not database...
class OptionPlotoptionsLineSonificationContexttracksPointgrouping(Options): def algorithm(self): return self._config_get('minmax') def algorithm(self, text: str): self._config(text, js_type=False) def enabled(self): return self._config_get(True) def enabled(self, flag: bool): ...
def test(): plugin_lut = get_plugin_lut() if (len(sys.argv) < 2): print('ERROR:') print('You must specify a plugin to test!') debug_print(CALL_LUT, plugin_lut) return target = sys.argv[1] if (target in plugin_lut): instance = plugin_lut[target]() instance....
class GameObjectMeta(type): def __new__(mcls, clsname, bases, kw): for (k, v) in kw.items(): if isinstance(v, (list, set)): kw[k] = tuple(v) elif isinstance(v, types.FunctionType): v.__name__ = f'{clsname}.{v.__name__}' v.__code__ = v._...
class PopCoordinates(ModelNormal): allowed_values = {} validations = {} _property def additional_properties_type(): return (bool, date, datetime, dict, float, int, list, str, none_type) _nullable = False _property def openapi_types(): return {'latitude': (float,), 'longitude'...
class PEP621DependencyGetter(DependencyGetter): def get(self) -> DependenciesExtract: dependencies = [*self._get_dependencies(), *itertools.chain(*self._get_optional_dependencies().values())] self._log_dependencies(dependencies) return DependenciesExtract(dependencies, []) def _get_depen...
class cnLedPlugin(QtDesigner.QPyDesignerCustomWidgetPlugin): def __init__(self, parent=None): super().__init__(parent) self.initialized = False def initialize(self, core): if self.initialized: return self.initialized = True def isInitialized(self): return ...
class ReactTest(unittest.TestCase): def test_input_cells_have_a_value(self): input = InputCell(10) self.assertEqual(input.value, 10) def test_an_input_cell_s_value_can_be_set(self): input = InputCell(4) input.value = 20 self.assertEqual(input.value, 20) def test_compu...
class YamlConfigEntry(object): switch: str config_value_type: typing.Type = str def read_from_file(self, cfg: ConfigFile, transform: typing.Optional[typing.Callable]=None) -> typing.Optional[typing.Any]: if (not cfg): return None try: v = cfg.get(self) if ...
class OptionPlotoptionsStreamgraphSonificationDefaultinstrumentoptionsMappingLowpass(Options): def frequency(self) -> 'OptionPlotoptionsStreamgraphSonificationDefaultinstrumentoptionsMappingLowpassFrequency': return self._config_sub_data('frequency', OptionPlotoptionsStreamgraphSonificationDefaultinstrument...
def upgrade_apt(): if (len(Settings.UpdateString) > 0): if (Settings.UpdateString[0] == '!'): misc.addLog(rpieGlobals.LOG_LEVEL_INFO, 'Update in progress') return False ustr = 'Upgrading APT packages<br>Please do not interrupt!' misc.addLog(rpieGlobals.LOG_LEVEL_INFO, ustr) ...
((detect_target().name() == 'rocm'), 'Not supported by ROCM.') class ParallelGemmCatFusionTestCase(unittest.TestCase): def __init__(self, *args, **kwargs): super(ParallelGemmCatFusionTestCase, self).__init__(*args, **kwargs) self._test_id = 0 def _fuse_2_split_parallel_gemm_cat(self, b: int, ms:...
def subagency_award(db, agencies_with_subagencies): baker.make('search.AwardSearch', award_id=2, latest_transaction_id=2) baker.make('search.TransactionSearch', transaction_id=2, award_id=2, awarding_agency_code='003', awarding_toptier_agency_name='Awarding Toptier Agency 3', awarding_toptier_agency_abbreviatio...
class ActorT(ServiceT, Generic[_T]): agent: 'AgentT' stream: StreamT it: _T actor_task: Optional[asyncio.Task] active_partitions: Optional[Set[TP]] index: Optional[int] = None def __init__(self, agent: 'AgentT', stream: StreamT, it: _T, active_partitions: Optional[Set[TP]]=None, **kwargs: An...
def safe_join(base, *paths): base_path = force_text(base) base_path = base_path.rstrip('/') paths = [force_text(p) for p in paths] final_path = (base_path + '/') for path in paths: _final_path = posixpath.normpath(posixpath.join(final_path, path)) if (path.endswith('/') or ((_final_p...
def _model_dynamic_factory() -> Callable[([None], List[Type])]: from dbgpt.model.adapter.model_adapter import _dynamic_model_parser param_class = _dynamic_model_parser() fix_class = [ModelWorkerParameters] if (not param_class): param_class = [ModelParameters] fix_class += param_class ret...
_register_parser _set_msg_type(ofproto.OFPT_MULTIPART_REPLY) class OFPMultipartReply(MsgBase): _STATS_MSG_TYPES = {} def register_stats_type(body_single_struct=False): def _register_stats_type(cls): assert (cls.cls_stats_type is not None) assert (cls.cls_stats_type not in OFPMult...
class TestRPNHeads(unittest.TestCase): def test_build_rpn_heads(self): self.assertGreater(len(rpn.RPN_HEAD_REGISTRY._obj_map), 0) for (name, builder) in rpn.RPN_HEAD_REGISTRY._obj_map.items(): logger.info('Testing {}...'.format(name)) cfg = GeneralizedRCNNRunner.get_default_c...
class ValveTestConfigRevertBootstrap(ValveTestBases.ValveTestNetwork): BAD_CONFIG = '\n *** busted ***\n' GOOD_CONFIG = "\ndps:\n s1:\n dp_id: 0x1\n hardware: 'GenericTFM'\n interfaces:\n p1:\n number: 1\n native_vlan: 0x100\n" CONFIG_AUTO_...
_group.command('update-lock-versions') ('rule-ids', nargs=(- 1), required=False) def update_lock_versions(rule_ids): rules = RuleCollection.default() if rule_ids: rules = rules.filter((lambda r: (r.id in rule_ids))) else: rules = rules.filter(production_filter) if (not click.confirm(f'Ar...
_runner def append(c, runner, filename, text, partial=False, escape=True): if isinstance(text, six.string_types): text = [text] for line in text: regex = (('^' + _escape_for_regex(line)) + ('' if partial else '$')) if (line and exists(c, filename, runner=runner) and contains(c, filename,...