code
stringlengths
281
23.7M
def hpluv_to_luv(hpluv: Vector) -> Vector: (h, s, l) = hpluv c = 0.0 if (l > (100 - 1e-07)): l = 100 elif (l < 1e-08): l = 0.0 else: _hx_max = max_safe_chroma_for_l(l) c = ((_hx_max / 100) * s) (a, b) = alg.polar_to_rect(c, h) return [l, a, b]
class PaddedDenseToJaggedTestCase(unittest.TestCase): def _test_padded_dense_to_jagged(self, jagged_max_shape: List[int], offsets_list: List[List[int]], dtype: str='float16', offsets_dtype: str='int32', use_jagged_space_indexing: bool=False, pass_jagged_int_var_as_total_length: bool=False, test_suffix: str=''): ...
class DirectoryReader(Reader): def __init__(self, source, path): super().__init__(source, path) self._content = [] filter = make_file_filter(self.filter, self.path) for (root, _, files) in os.walk(self.path): for file in files: full = os.path.join(root, fi...
class MayonaizeShrimpLiveProcessor(HtmlProcessor.HtmlPageProcessor): wanted_mimetypes = ['text/html'] want_priority = 80 loggerPath = 'Main.Text.MayonaizeShrimp' def wantsUrl(url): if re.search('^ url): print(("ms Wants url: '%s'" % url)) return True return False ...
def create_v6flowspec_actions(actions=None): from ryu.services.protocols.bgp.api.prefix import FLOWSPEC_ACTION_TRAFFIC_RATE, FLOWSPEC_ACTION_TRAFFIC_ACTION, FLOWSPEC_ACTION_REDIRECT, FLOWSPEC_ACTION_TRAFFIC_MARKING action_types = {FLOWSPEC_ACTION_TRAFFIC_RATE: BGPFlowSpecTrafficRateCommunity, FLOWSPEC_ACTION_TR...
class HackageBackendtests(DatabaseTestCase): def setUp(self): super().setUp() create_distro(self.session) self.create_project() def create_project(self): project = models.Project(name='cpphs', homepage=' backend=BACKEND) self.session.add(project) self.session.comm...
def expand_file_arguments(argv): new_args = [] expanded = False for arg in argv: if arg.startswith(''): expanded = True with open(arg[1:], 'r') as f: for line in f.readlines(): new_args += shlex.split(line) else: new_arg...
def _set_assets_details(app): with open(config.asset_build_meta_file, 'r') as f: meta_file = json.load(f) assets = [] themes = [] for (output_path, details) in meta_file['output'].items(): asset_type = details['type'] name = details['name'] filename = os.path.basename(out...
class SchedulerServiceStub(object): def __init__(self, channel): self.addNamespace = channel.unary_unary('/ai_flow.SchedulerService/addNamespace', request_serializer=message__pb2.NamespaceProto.SerializeToString, response_deserializer=message__pb2.Response.FromString) self.getNamespace = channel.una...
def _get_secret_from_env() -> Tuple[(str, str)]: openai_org = os.environ.get('LMQL_OPENAI_ORG', '') if ('LMQL_OPENAI_SECRET' in os.environ): openai_secret = os.environ['LMQL_OPENAI_SECRET'] elif ('OPENAI_API_KEY' in os.environ): openai_secret = os.environ['OPENAI_API_KEY'] else: ...
class Spiral(Layout): def __init__(self, workspace_name: str, params: List[Any]): super().__init__(LayoutName.SPIRAL, workspace_name) try: self.main_ratio = (float(params[0]) if (len(params) > 0) else 0.5) self.screen_direction = (ScreenDirection(params[1]) if (len(params) > ...
def print_help(): print() print(f'{log.default}Command Menu{log.reset}') print(f'{log.default}set{log.reset} - used to set search parameters for cyphers, double/single quotes not required for any sub-commands') print(f'{log.default} sub-commands{log.reset}') print(f'{log.default} user{log....
def test_error_if_denominator_probability_is_zero_2_vars(): df = {'var_A': (((['A'] * 6) + (['B'] * 10)) + (['C'] * 4)), 'var_B': (((['A'] * 10) + (['B'] * 6)) + (['C'] * 4)), 'var_C': (((['A'] * 6) + (['B'] * 10)) + (['C'] * 4)), 'target': [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0]} df = pd.D...
class ConfigReader(): def __init__(self, use_config=None, share_config=None, **kwargs): self._cfg_share = None self._cfg = None if (use_config is not None): self._cfg = use_config if (share_config is not None): self._cfg_share = share_config self._...
def convert_to_richtext(apps, schema_editor): ContentPage = apps.get_model('home', 'ContentPage') for page in ContentPage.objects.all(): if (page.body.raw_text is None): raw_text = ''.join([child.value.source for child in page.body if (child.block_type == 'rich_text')]) page.body...
_tuple def _compute_probabilities(miner_data: Iterable[MinerData], wait_blocks: int, sample_size: int) -> Iterable[Probability]: miner_data_by_price = tuple(sorted(miner_data, key=operator.attrgetter('low_percentile_gas_price'), reverse=True)) for idx in range(len(miner_data_by_price)): low_percentile_g...
def _get_attention(ops, Q, key_transform, X, lengths, is_train): (K, K_bp) = key_transform(X, is_train=is_train) attention = ops.gemm(K, ops.reshape2f(Q, (- 1), 1)) attention = ops.softmax_sequences(attention, lengths) def get_attention_bwd(d_attention): d_attention = ops.backprop_softmax_sequen...
def test_update_web3(deployed_safe_math, w3): new_w3 = Web3(Web3.EthereumTesterProvider()) (original_package, _) = deployed_safe_math assert (original_package.w3 is w3) new_package = original_package.update_w3(new_w3) assert (new_package.w3 is new_w3) assert (original_package is not new_package)...
def _get_protection_flags(flags): protection = '' modifier = '' if (flags & 1): protection = 'NOACCESS' elif (flags & 2): protection = 'R' elif (flags & 4): protection = 'RW' elif (flags & 8): protection = 'W Copy' elif (flags & 16): protection = 'X' ...
class OptionSeriesHistogramSonificationContexttracksActivewhen(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)...
def assert_is_canonical_chain(headerdb, headers): if (not headers): return head = headerdb.get_canonical_head() assert_headers_eq(head, headers[(- 1)]) for header in headers: canonical = headerdb.get_canonical_block_header_by_number(header.block_number) assert (canonical == heade...
def main(page: Page): main_content = Column(scroll='auto') for i in range(100): main_content.controls.append(Text(f'Line {i}')) page.padding = 0 page.spacing = 0 page.horizontal_alignment = 'stretch' page.add(Container(main_content, padding=10, expand=True), Row([Container(Text('Footer')...
class OnImageNotFound(Exception): def __init__(self, *args): if args: self.message = args[0] else: self.message = None args[1].statusCode = 200 def __str__(self): if self.message: return 'OnImageNotFound, {0} '.format(self.message) else...
def extractBluemoontranslationsTumblrCom(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, ...
def test_parse_schema_rejects_undleclared_name(): try: fastavro.parse_schema({'type': 'record', 'name': 'test_parse_schema_rejects_undleclared_name', 'fields': [{'name': 'left', 'type': 'Thinger'}]}) assert False, 'Never raised' except fastavro.schema.UnknownType as e: assert ('Thinger' ...
def example(): normal_border = ft.BorderSide(0, ft.colors.with_opacity(0, ft.colors.WHITE)) hovered_border = ft.BorderSide(6, ft.colors.WHITE) async def on_chart_event(e: ft.PieChartEvent): for (idx, section) in enumerate(chart.sections): section.border_side = (hovered_border if (idx == ...
class OptionPlotoptionsPackedbubbleStatesHoverHalo(Options): def attributes(self): return self._config_get(None) def attributes(self, value: Any): self._config(value, js_type=False) def opacity(self): return self._config_get(0.25) def opacity(self, num: float): self._conf...
(TTLCache(1, 1800)) def _build_access_token(api_key: str, secret_key: str) -> str: url = ' params = {'grant_type': 'client_credentials', 'client_id': api_key, 'client_secret': secret_key} res = requests.get(url=url, params=params) if (res.status_code == 200): return res.json().get('access_token'...
def variable_from_module(module, variable=None, default=None): if (not module): return default mod = mod_import(module) if (not mod): return default if variable: result = [] for var in make_iter(variable): if var: result.append(mod.__dict__.get...
def test_from_master_key(): keystore = from_master_key('xprv9xpBW4EdWnv4PEASBsu3VuPNAcxRiSMXTjAfZ9dkP5FCrKWCacKZBhS3cJVGCegAUNEp1uXXEncSAyro5CaJFwv7wYFcBQrF6MfWYoAXsTw') assert (keystore.xprv == 'xprv9xpBW4EdWnv4PEASBsu3VuPNAcxRiSMXTjAfZ9dkP5FCrKWCacKZBhS3cJVGCegAUNEp1uXXEncSAyro5CaJFwv7wYFcBQrF6MfWYoAXsTw') ...
def add_MsgServicer_to_server(servicer, server): rpc_method_handlers = {'StoreCode': grpc.unary_unary_rpc_method_handler(servicer.StoreCode, request_deserializer=cosmwasm_dot_wasm_dot_v1_dot_tx__pb2.MsgStoreCode.FromString, response_serializer=cosmwasm_dot_wasm_dot_v1_dot_tx__pb2.MsgStoreCodeResponse.SerializeToStr...
def test_bool(): c = Config('testconfig', foo=(True, bool, ''), bar=(False, bool, '')) assert (c.foo == True) c.foo = True assert (c.foo == True) c.foo = False assert (c.foo == False) for name in 'yes on true Yes On TRUE 1'.split(' '): c.foo = name assert (c.foo == True) ...
class TransportLayer(Module): def __init__(self, link, debug=False, loopback=False): self.link = link self.debug = debug self.loopback = loopback self.link.set_transport(self) self.command = None self.n = None def set_command(self, command): self.command =...
def test_create_chunks_with_config(chunker, text_splitter_mock, loader_mock, app_id, data_type): text_splitter_mock.split_text.return_value = ['Chunk 1', 'long chunk'] loader_mock.load_data.return_value = {'data': [{'content': 'Content 1', 'meta_data': {'url': 'URL 1'}}], 'doc_id': 'DocID'} config = Chunker...
class SessionsSpeakersLink(SoftDeletionModel): __tablename__ = 'sessions_speakers_links' id = db.Column(db.Integer, primary_key=True) event_id = db.Column(db.Integer, nullable=False) session_id = db.Column(db.Integer, nullable=False) speaker_id = db.Column(db.Integer, nullable=False) def __repr_...
class Parser(TestCase): def setUp(self): super().setUp() self.parser = expression_v2._Parser(SerializedOps()) def mkasserts(self, parse): def assertParses(expression, desired_result, desired_indices, *desired_shape): with self.subTest('without-spaces'): s_expr...
def find_placeholder_dependencies(cfg: CfgSimple): deps = dict() last_length = None while (len(deps) != last_length): last_length = len(deps) for node in cfg.graph.nodes: if isinstance(node, ir.Block): for arg in node.args: if isinstance(arg, a...
def action_create(argc, argv): args = parse_args(argv) if os.path.exists(args.path): log.error(('path %s already exists' % args.path)) quit() check = [n for n in [int(s.strip()) for s in args.hidden.split(',') if (s.strip() != '')] if (n > 0)] if (len(check) < 1): log.error('the ...
class ComparerTitle(): def find_matches(self, list_title): list_title_matches = [] for (a, b) in itertools.combinations(list_title, 2): if (a == b): list_title_matches.append(a) return list_title_matches def extract_match(self, list_title_matches): lis...
def draw_line_round_corners_polygon(surf, p1, p2, c, w): if (p1 != p2): p1v = pygame.math.Vector2(p1) p2v = pygame.math.Vector2(p2) lv = (p2v - p1v).normalize() lnv = ((pygame.math.Vector2((- lv.y), lv.x) * w) // 2) pts = [(p1v + lnv), (p2v + lnv), (p2v - lnv), (p1v - lnv)] ...
def test_LevelFormatter(): stream = StringIO() handler = logging.StreamHandler(stream) formatter = LevelFormatter(fmt={'*': '[%(levelname)s] %(message)s', 'DEBUG': '%(name)s [%(levelname)s] %(message)s', 'INFO': '%(message)s'}) handler.setFormatter(formatter) name = next(unique_logger_name) log ...
class FlyteScopedSystemException(FlyteScopedException): def __init__(self, exc_type, exc_value, exc_tb, **kwargs): super(FlyteScopedSystemException, self).__init__('SYSTEM', exc_type, exc_value, exc_tb, **kwargs) def verbose_message(self): base_msg = super(FlyteScopedSystemException, self).verbo...
('/{catchall:path}', response_class=Response, tags=['Default']) def read_other_paths(request: Request) -> Response: path = request.path_params['catchall'] logger.debug(f'Catch all path detected: {path}') try: path = sanitise_url_path(path) except MalisciousUrlException: return get_admin_...
def potenial_moves(): globVar.p_w_moves = [] globVar.p_b_moves = [] globVar.p_w_Num = 0 globVar.p_b_Num = 0 for i in range(len(globVar.w_pieces)): fpc = globVar.w_pieces[i] am = fpc.scan() globVar.r_avail = copy.deepcopy(am) globVar.r_avail_Num = len(am) am = ...
class GridPlane(Module): __version__ = 0 grid_plane = Instance(grid_plane.GridPlane, allow_none=False, record=True) actor = Instance(Actor, allow_non=False, record=True) input_info = PipelineInfo(datasets=['image_data', 'structured_grid', 'rectilinear_grid'], attribute_types=['any'], attributes=['any'])...
def _get_array_filter(field, key, value): if isinstance(value, list): return field.contains(value) if isinstance(value, dict): if ('$regex' in value): column = func.array_to_string(field, ',') return _dict_key_to_filter(column, key, value) if ('$contains' in value...
class RaiseExceptionOnRequestMiddleware(ClientMiddleware): class MiddlewareProcessedRequest(Exception): pass def request(self, send_request): def handler(request_id, meta, request, message_expiry_in_seconds): if (request.actions and (request.actions[0].body.get('middleware_was_here')...
class TestApi(unittest.TestCase): def test_api_importable(self): from pyface.action import api def test_public_attrs(self): from pyface.action import api attrs = [name for name in dir(api) if (not name.startswith('_'))] for attr in attrs: with self.subTest(attr=attr):...
class FleetClient(NamespacedClient): _rewrite_parameters() async def global_checkpoints(self, *, index: str, checkpoints: t.Optional[t.Sequence[int]]=None, error_trace: t.Optional[bool]=None, filter_path: t.Optional[t.Union[(str, t.Sequence[str])]]=None, human: t.Optional[bool]=None, pretty: t.Optional[bool]=No...
def map_scores_html(sequence, mapping_dict=emaps.fastq_emoji_map, default_value=':heart_eyes:', mapping_function=emojify, spacer=' '): mapped_values = spacer.join([mapping_function(mapping_dict.get(s, default_value)) for s in QualityIO._get_sanger_quality_str(sequence)]) return mapped_values
class TestTimeTicks(ByteTester): def test_decoding(self): result = t.TimeTicks.decode_raw(b'\n') expected = 10 self.assertEqual(result, expected) def test_encoding(self): value = t.TimeTicks(100) result = bytes(value) expected = b'C\x01d' self.assertBytesE...
class OptionPlotoptionsBubbleSonificationTracksMappingHighpassResonance(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 reader(source, path): assert isinstance(path, str), source if hasattr(source, 'reader'): reader = source.reader LOG.debug('Looking for a reader for %s (%s)', path, reader) if callable(reader): return reader(source, path) if isinstance(reader, str): ret...
class TextHash(): simhash_threshold = 10 shingleprint_threshold = 0.95 def __init__(self, text): self.text = text if (len(text) < 32): self.hash = {'type': 'simhash', 'value': Simhash(text).value} elif (len(text) < 256): self.hash = {'type': 'simhash', 'value'...
class TestExtendedLang(util.MdCase): extension = ['pymdownx.highlight', 'pymdownx.superfences', 'pymdownx.inlinehilite'] extension_configs = {'pymdownx.highlight': {'extend_pygments_lang': [{'name': 'php-inline', 'lang': 'php', 'options': {'startinline': True}}]}} def test_extended_lang_inlinehilite(self): ...
def connect_to_pslab(experiment_type): try: device = get_device(experiment_type) except serial.SerialException: time.sleep(1) try: device = get_device(experiment_type) except serial.SerialException: print('PSLab cannot be accessed.') return Non...
def pod_exec(args: List[str], *, name: str, namespace: str, container: str=None, timeout: float=float('inf')) -> Tuple[(str, str)]: core_v1_api = kubernetes.client.CoreV1Api() logger.debug('Running command in pod {}/{}: {}.'.format(namespace, name, ' '.join(args))) ws_client = stream(core_v1_api.connect_pos...
('config_path', ['dir1', 'dir2', os.path.abspath('tests/test_apps/app_with_multiple_config_dirs/dir2')]) ('config_name', ['cfg1', 'cfg2']) def test_config_name_and_path_overrides(tmpdir: Path, config_path: str, config_name: str) -> None: cmd = ['tests/test_apps/app_with_multiple_config_dirs/my_app.py', ('hydra.run....
def test_get_collections(mocker): mock_qdrant_client = mocker.patch('qdrant_client.QdrantClient', autospec=True) mocker.patch('os.getenv', side_effect=(lambda x: 'dummy_value')) qdrant = Qdrant(env_file_path='/path/to/your/env/file') mock_qdrant_client.return_value.get_collections.return_value = ['test_...
class HtmlOverlayStates(): def _add_resource(self) -> str: native_path = os.environ.get('NATIVE_JS_PATH') js_state_file = 'StateTemplate.js' js_state_name = 'stateTemplate' internal_native_path = Path(Path(__file__).resolve().parent, '..', '..', 'js', 'native', 'utils') if (n...
(scope='function') def snowflake_connection_config(db: Session, integration_config: Dict[(str, str)], snowflake_connection_config_without_secrets: ConnectionConfig) -> Generator: connection_config = snowflake_connection_config_without_secrets account_identifier = (integration_config.get('snowflake', {}).get('ac...
def test_bkz_call(block_size=10): params = fplll_bkz.Param(block_size=block_size, flags=(fplll_bkz.VERBOSE | fplll_bkz.GH_BND)) for cls in (BKZ, BKZ2): for n in dimensions: FPLLL.set_random_seed(n) A = make_integer_matrix(n) B = copy(A) cls(B)(params=param...
def upgrade(): op.create_table('privacydeclaration', sa.Column('id', sa.String(length=255), nullable=False), sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True), sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True), sa.Co...
def parse_turbo_mos(text): float_20 = make_float_class(exact=20) int_ = pp.Word(pp.nums) comment = (pp.Literal('#') + pp.restOfLine) mo_num = int_ sym = pp.Word(pp.alphanums) eigenvalue = (pp.Literal('eigenvalue=') + float_20) nsaos = (pp.Literal('nsaos=') + int_) mo_coeffs = pp.OneOrMor...
def extractHostednovelCom(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 tag...
def main(): fields = {'access_token': {'required': False, 'type': 'str', 'no_log': True}, 'vdom': {'required': False, 'type': 'str', 'default': 'root'}, 'enable_log': {'required': False, 'type': 'bool', 'default': False}, 'filters': {'required': False, 'type': 'list', 'elements': 'str'}, 'sorters': {'required': Fal...
def get_options(server): try: response = requests.options(server, allow_redirects=False, verify=False, timeout=5) except (requests.exceptions.ConnectionError, requests.exceptions.MissingSchema): return 'Server {} is not available!'.format(server) try: return {'allowed': response.head...
def post_vilar_allocation(h, k, scorer=None, num_steps=0): original_shape = h.shape (det_h, nondet_h) = h.separate_by(dc.is_deterministic) det_h.name(f'constraint_cont_{num_steps}', nopath=True) continuations_by_predecessor = h.reshape((lambda s: s.predecessor.id)) best_cont_per_predecessor = dc.top...
def main(): segmk = Segmaker('design.bits', verbose=True) with open('params.json', 'r') as fp: data = json.load(fp) idelay_types = ['FIXED', 'VARIABLE', 'VAR_LOAD'] delay_srcs = ['IDATAIN', 'DATAIN'] for params in data: segmk.add_site_tag(params['IDELAY_IN_USE'], 'IN_USE', True) ...
class OptionSeriesPackedbubbleStatesHoverMarker(Options): def enabled(self): return self._config_get(None) def enabled(self, flag: bool): self._config(flag, js_type=False) def enabledThreshold(self): return self._config_get(2) def enabledThreshold(self, num: float): self....
class AllDynamic(): def test_all_dynamic(self, arg_builder): assert (arg_builder.ConfigDynamicDefaults.x == 235) assert (arg_builder.ConfigDynamicDefaults.y == 'yarghhh') assert (arg_builder.ConfigDynamicDefaults.z == [10, 20]) assert (arg_builder.ConfigDynamicDefaults.p == 1) ...
('ecs_deploy.cli.get_client') def test_update_task_empty_docker_label_again(get_client, runner): get_client.return_value = EcsTestClient('acces_key', 'secret_key') result = runner.invoke(cli.update, (TASK_DEFINITION_ARN_1, '-d', 'webserver', 'empty', '')) assert (result.exit_code == 0) assert (not resul...
class ExistingBearerTokenAuthenticator(AbstractAuthenticator): _type = SupportedAuthProviders.EXISTING_BEARER_TOKEN def authenticate(self, kf_endpoint: str, runtime_config_name: str, token: str=None) -> Optional[str]: if _empty_or_whitespaces_only(token): raise AuthenticationError(f"A token/...
def parse_static_data(ghidra_analysis, argument): result = [] for arg in argument: addr = ghidra_analysis.flat_api.toAddr(arg) static_data = ghidra_analysis.flat_api.getDataAt(addr) if (static_data is not None): result.append(str(static_data.getDefaultValueRepresentation().st...
def main(): module_spec = schema_to_module_spec(versioned_schema) mkeyname = 'name' fields = {'access_token': {'required': False, 'type': 'str', 'no_log': True}, 'enable_log': {'required': False, 'type': 'bool', 'default': False}, 'vdom': {'required': False, 'type': 'str', 'default': 'root'}, 'member_path':...
def build_refined_target_paths(row: Row, query_paths: FieldPathNodeInput) -> List[DetailedPath]: found_paths: List[DetailedPath] = [] for (target_path, only) in query_paths.items(): path = refine_target_path(row, list(target_path.levels), only) if path: if isinstance(path[0], list): ...
.django_db def test_naics_autocomplete_success(client, naics_data): resp = client.post('/api/v2/autocomplete/naics/', content_type='application/json', data=json.dumps({'search_text': '212112'})) assert (resp.status_code == status.HTTP_200_OK) assert (len(resp.data['results']) == 1) assert (resp.data['re...
_handling.command() ('--input', type=click.File('rb')) def process_optional_file(input: click.File): if (input is None): click.echo('no input file given') else: while True: click.echo(f'Reading from {input.name}...') chunk = input.read(1024) if (not chunk): ...
class Pattern(): def __init__(self, pattern, ignore_missing_keys=False): self.ignore_missing_keys = ignore_missing_keys self.pattern = [] self.variables = [] for (i, p) in enumerate(RE1.split(pattern)): if ((i % 2) == 0): self.pattern.append(Constant(p)) ...
def _encode(source_path: str, video_format: Format, encoding_backend: BaseEncodingBackend, options: dict) -> None: with tempfile.NamedTemporaryFile(suffix='_{name}.{extension}'.format(**options)) as file_handler: target_path = file_handler.name video_format.reset_progress() encoding = encodi...
def render() -> None: global FACE_ANALYSER_ORDER_DROPDOWN global FACE_ANALYSER_AGE_DROPDOWN global FACE_ANALYSER_GENDER_DROPDOWN global FACE_DETECTOR_SIZE_DROPDOWN global FACE_DETECTOR_SCORE_SLIDER global FACE_DETECTOR_MODEL_DROPDOWN with gradio.Row(): FACE_ANALYSER_ORDER_DROPDOWN = ...
class _AsyncContextManager(): def __init__(self, coro): self._coro = coro self._obj = None async def __aenter__(self): self._obj = (await self._coro) return self._obj async def __aexit__(self, exc_type, exc, tb): (await self._obj.finalize()) self._obj = None
class Riverside(Skill): associated_action = RiversideAction skill_category = ['character', 'active'] target = t_OtherOne() usage = 'drop' def check(self): cl = self.associated_cards if (len(cl) != 1): return False return (cl[0].resides_in.type in ('cards', 'shownc...
class OptionPlotoptionsBulletSonificationTracksMappingPlaydelay(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): ...
() .usefixtures('use_tmpdir') def setup_case(storage): def func(config_text): Path('config.ert').write_text(config_text, encoding='utf-8') ert_config = ErtConfig.from_file('config.ert') prior_ensemble = storage.create_ensemble(storage.create_experiment(responses=ert_config.ensemble_config.re...
class Entities(): word_break = '<wbr>' word_break_hyphen = '&shy;' non_breaking_space = '&#160;' less_than = '&#60;' greater_than = '&#62;' ampersand = '&#38;' double_quotation_mark = '&#34;' single_quotation_mark_apostrophe = '&#39;' cent = '&#162;' pound = '&#163;' yen = '&...
class Migration(migrations.Migration): dependencies = [('awards', '0085_auto__2219'), ('references', '0055_create_new_defc_gtas_column_as_text_field')] operations = [migrations.AddField(model_name='financialaccountsbyawards', name='disaster_emergency_fund_temp', field=models.TextField(null=True, db_column='disa...
class TestSendMail(): .dict('bodhi.server.mail.config', {'exclude_mail': ['', '']}) ('bodhi.server.mail._send_mail') def test_exclude_mail(self, _send_mail): mail.send_mail('', '', 'R013X', 'Want a c00l ?') assert (_send_mail.call_count == 0) .dict('bodhi.server.mail.config', {'smtp_serv...
class QAgent(Agent): def __init__(self, model=None, n_actions=None): super().__init__() self.model = model self.n_actions = n_actions def update(self, sd): self.model.load_state_dict(sd) def __call__(self, state, observation, agent_info=None, history=None): initial_st...
def parse_arguments(argv=sys.argv): description = 'This script runs tests on the system to check for compliance against the CIS Benchmarks. No changes are made to system files by this script.' epilog = f''' Examples: Run with debug enabled: {__file__} --debug Exclude tests from section 1.1 and 1.3.2...
class OptionPlotoptionsLollipopSonificationContexttracksMappingNoteduration(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: st...
class OptionSeriesHistogramSonificationContexttracksMappingHighpassFrequency(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: s...
def test_configure_uses_default_config_if_config_name_is_none(create_test_db, create_pymel, create_maya_env): pm = create_pymel from anima.dcc.mayaEnv.render import MayaColorManagementConfigurator MayaColorManagementConfigurator.configure(config_name='scene-linear Rec.709-sRGB') cmp = pm.colorManagement...
def main(page: ft.Page): normal_border = ft.BorderSide(0, ft.colors.with_opacity(0, ft.colors.WHITE)) hovered_border = ft.BorderSide(6, ft.colors.WHITE) def on_chart_event(e: ft.PieChartEvent): for (idx, section) in enumerate(chart.sections): section.border_side = (hovered_border if (idx...
class BaseUser(CreateUpdateDictModel, Generic[models.ID]): id: models.ID email: EmailStr is_active: bool = True is_superuser: bool = False is_verified: bool = False if PYDANTIC_V2: model_config = ConfigDict(from_attributes=True) else: class Config(): orm_mode = Tr...
class TaskTemplate(_common.FlyteIdlEntity): def __init__(self, id, type, metadata, interface, custom, container=None, task_type_version=0, security_context=None, config=None, k8s_pod=None, sql=None, extended_resources=None): if (((container is not None) and (k8s_pod is not None)) or ((container is not None)...
class RpcMixin(): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.rpc_interfaces = {} self.job_map = {} self.job_counter = 0 self.rpc_timeout_s = (60 * 40) self.remote_log = logging.getLogger('Main.RPC.Remote') self.check_open_rpc_i...
def upgrade(): op.execute('alter type connectiontype rename to connectiontype_old') op.execute("create type connectiontype as enum('postgres', 'mongodb', 'mysql', ' 'snowflake', 'redshift', 'mssql')") op.execute('alter table connectionconfig alter column connection_type type connectiontype using connection_...
class TenantParams(): path_prefix: str tenant: Tenant client: Client user: User login_session: LoginSession registration_session_password: RegistrationSession registration_session_oauth: RegistrationSession session_token: SessionToken session_token_token: tuple[(str, str)]
def write_header(htmlhandle): htmlhandle.write('\n <head>\n <link rel="stylesheet" href=" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">\n <style>\n body{\n background-color: rgba(0, 0, 0, 0.1);\n margin-top: 100px;\n }\n h1 {...