code
stringlengths
281
23.7M
class EventUser(models.Model): objects = EventUserManager() created_at = models.DateTimeField(_('Created At'), auto_now_add=True) updated_at = models.DateTimeField(_('Updated At'), auto_now=True) user = models.ForeignKey(User, verbose_name=_('User'), blank=True, null=True) event = models.ForeignKey(...
class OptionPlotoptionsHistogramSonificationDefaultinstrumentoptionsMappingTremoloDepth(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...
class OptionPlotoptionsColumnSonificationDefaultinstrumentoptionsMappingPan(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...
_action_type(ofproto.OFPAT_ENQUEUE, ofproto.OFP_ACTION_ENQUEUE_SIZE) class OFPActionEnqueue(OFPAction): def __init__(self, port, queue_id): super(OFPActionEnqueue, self).__init__() self.port = port self.queue_id = queue_id def parser(cls, buf, offset): (type_, len_, port, queue_i...
class OptionPlotoptionsColumnpyramidSonificationTracksMappingTremoloSpeed(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 extractSeethroughtranslationWordpressCom(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, na...
class WorkflowCommon(): def createExternalDumpJob(): with open('dump_job', 'w', encoding='utf-8') as f: f.write('INTERNAL FALSE\n') f.write('EXECUTABLE dump.py\n') f.write('MIN_ARG 2\n') f.write('MAX_ARG 2\n') f.write('ARG_TYPE 0 STRING\n') ...
def prune_empty_awards(award_tuple: Optional[tuple]=None) -> int: _find_empty_awards_sql = '\n SELECT a.id\n FROM vw_awards a\n LEFT JOIN vw_transaction_normalized tn ON tn.award_id = a.id\n WHERE tn IS NULL {}\n '.format(('AND a.id IN %s' if award_tuple else '')) _modify_subaward...
class Organization(Base, FidesBase): __tablename__ = 'ctl_organizations' organization_parent_key = Column(String, nullable=True) controller = Column(PGEncryptedString, nullable=True) data_protection_officer = Column(PGEncryptedString, nullable=True) fidesctl_meta = Column(JSON) representative = ...
def test_subscriber_signature() -> None: with pytest.raises(LabgraphError) as err: class MyNode(Node): A = Topic(MyMessage) (A) def my_subscriber(self) -> None: pass assert ("Expected subscriber 'my_subscriber' to have signature def my_subscriber(self,...
def markup_text(source): source = source.split('') for i in range(1, len(source), 2): source[i] = (('Expr(' + source[i]) + ')') source[i] = (('$$' + eval(source[i], pygrim.__dict__).latex()) + '$$') source = ''.join(source) source = source.split('') for i in range(1, len(source), 2):...
def extractNontransblogWordpressCom(item): (vol, chp, frag, postfix) = extractVolChapterFragmentPostfix(item['title']) if ((not (chp or vol)) or ('preview' in item['title'].lower())): return None if ('WATTT' in item['tags']): return buildReleaseMessageWithType(item, 'WATTT', vol, chp, frag=f...
class Migration(migrations.Migration): dependencies = [('admin_interface', '0008_change_related_modal_background_opacity_type')] operations = [migrations.AddField(model_name='theme', name='env', field=models.CharField(choices=[('development', 'Development'), ('testing', 'Testing'), ('staging', 'Staging'), ('pro...
def test_opencascade_poisson(stepdata, order): (stepfile, h) = stepdata try: mh = OpenCascadeMeshHierarchy(stepfile, element_size=h, levels=2, order=order, cache=False, verbose=True) except ImportError: pytest.skip(msg='OpenCascade unavailable, skipping test') mesh = mh[(- 1)] V = Fu...
class SPIMaster(_SPIPrimitive): def __init__(self, device: SerialHandler=None): super().__init__(device) self.set_parameters() def set_parameters(self, primary_prescaler: int=_PPRE, secondary_prescaler: int=_SPRE, CKE: int=_CKE, CKP: int=_CKP, SMP: int=_SMP): self._set_parameters(primary...
('the following scripts are not ran') def check_script_files_dont_exist(context): python_scripts = set(_get_fal_scripts(context)) expected_scripts = set(map(_script_filename, context.table.headings)) unexpected_runs = (expected_scripts & python_scripts) if unexpected_runs: to_report = ', '.join(...
('calling_file, calling_module', [('tests/test_apps/app_with_cfg_groups/my_app.py', None), (None, 'tests.test_apps.app_with_cfg_groups.my_app')]) def test_app_with_config_groups__override_all_configs(hydra_restore_singletons: Any, hydra_task_runner: TTaskRunner, calling_file: str, calling_module: str) -> None: with...
def test_providers_value_setting(config): a = config.a ab = config.a.b abc = config.a.b.c abd = config.a.b.d config.update({'a': {'b': {'c': 1, 'd': 2}}}) assert (a() == {'b': {'c': 1, 'd': 2}}) assert (ab() == {'c': 1, 'd': 2}) assert (abc() == 1) assert (abd() == 2)
class EosApi(): def __init__(self, rpc_host: str=' timeout=120): self.rpc_host = rpc_host self.accounts: Dict[(str, Account)] = {} self.cpu_payer: Account = None self.session = requests.Session() self.session.trust_env = False self.session.headers['User-Agent'] = 'Moz...
def main(): module_spec = schema_to_module_spec(versioned_schema) mkeyname = 'id' 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 df(): df = pd.DataFrame({'Name': ['tom', 'nick', 'krish', 'jack'], 'City': ['London', 'Manchester', 'Liverpool', 'Bristol'], 'Age': [20, 21, 19, 18], 'Marks': [0.9, 0.8, 0.7, 0.6], 'date_range': pd.date_range('2020-02-24', periods=4, freq='T'), 'date_obj0': ['2020-02-24', '2020-02-25', '2020-02-26', '2020-02-27...
class TestPrivacyRequestCacheFailedStep(): def test_cache_failed_step_and_collection(self, privacy_request): privacy_request.cache_failed_checkpoint_details(step=CurrentStep.erasure, collection=paused_location) cached_data = privacy_request.get_failed_checkpoint_details() assert (cached_data...
class BrowseFlagsTests(DatabaseTestCase): def setUp(self): super().setUp() session = Session() self.user = models.User(email='', username='user') user_social_auth = social_models.UserSocialAuth(user_id=self.user.id, user=self.user) session.add(self.user) session.add(u...
def upgrade(): op.create_table('authenticationrequest', 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...
def check_image_desc(desc, parse_full_locs=True): if ('::' not in desc): return ('', []) image_url = '' full_locs = [[], [], [], [], []] items = str(desc).split('::') for pre_item in items: item = '' if ((pre_item[:3] == 'img') and ('=' in pre_item)): item = pre_i...
class OptionSeriesPictorialSonificationDefaultspeechoptionsActivewhen(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:...
class Migration(migrations.Migration): dependencies = [('sites', '0001_initial')] operations = [migrations.AddField(model_name='site', name='name', field=models.CharField(default='changeme', max_length=255, unique=True, verbose_name='Name'), preserve_default=False), migrations.AlterField(model_name='site', name...
.parametrize('test_input, expected', [('10.10.1.1', True), ('10.0.0.0', True), ('10.0.0', False), ('10.0.0.0/24', False), ('10.0.0.0/32', False), ('test', False), (10, False), (1.0, False), (True, False), ('/does/not/exist', False), ([], False), ({}, False)]) def test_ip_address_type(test_input, expected): assert (...
class VideoUploadSession(object): def __init__(self, video, wait_for_encoding=False, interval=3, timeout=180): self._video = video self._api = video.get_api_assured() if (video.Field.filepath in video): self._file_path = video[video.Field.filepath] self._slideshow_spe...
def ext_template_cfg_string(): return f''' [nlp] lang = "en" pipeline = ["llm"] batch_size = 128 [components] [components.llm] factory = "llm" [components.llm.task] _tasks = "spacy.NER.v3" description = "This is a description" labels = ["PER", "ORG", "LOC"] [component...
class OptionPlotoptionsColumnSonificationDefaultinstrumentoptionsMappingLowpassResonance(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(s...
def state_transition(chain: BlockChain, block: Block) -> None: parent_header = chain.blocks[(- 1)].header validate_header(block.header, parent_header) ensure((block.ommers == ()), InvalidBlock) (gas_used, transactions_root, receipt_root, block_logs_bloom, state) = apply_body(chain.state, get_last_256_bl...
class Generator(lg.Node): BARPLOT_OUTPUT = lg.Topic(BarPlotMessage) LINEPLOT_OUTPUT = lg.Topic(LinePlotMessage) config: GeneratorConfig (BARPLOT_OUTPUT) async def generate_noise(self) -> lg.AsyncPublisher: while True: (yield (self.BARPLOT_OUTPUT, BarPlotMessage(domain=np.arange((...
def match(d, pattern, separator='.', indexes=True): if type_util.is_regex(pattern): regex = pattern elif type_util.is_string(pattern): pattern = re.sub('([\\*]{1})', '(.)*', pattern) pattern = re.sub('(\\[([^\\[\\]]*)\\])', '\\[\\g<2>\\]', pattern) regex = re.compile(pattern, fla...
class TestEnsurePassphrase(TestCase): def __init__(self, *args, **kwargs): super(TestEnsurePassphrase, self).__init__(*args, **kwargs) self.path = None from copr_keygen import app as mock_app self.mock_app = mock_app def target(self): return os.path.join(self.path, TEST_E...
class UntypableNode(BMGError): node: BMGNode node_locations: Set[FunctionCall] def __init__(self, node: BMGNode, node_locations: Set[FunctionCall]) -> None: self.node = node self.node_locations = node_locations def __str__(self) -> str: msg = 'INTERNAL COMPILER ERROR: Untypable n...
class BulkUpdateAclEntry(ModelComposed): allowed_values = {('negated',): {'disable': 0, 'enable': 1}, ('op',): {'CREATE': 'create', 'UPDATE': 'update', 'DELETE': 'delete'}} validations = {} _property def additional_properties_type(): lazy_import() return (bool, date, datetime, dict, floa...
def get_tuple_validator(subvalidator): def validator(value): if isinstance(value, (tuple, list)): value2 = tuple(value) elif isinstance(value, basestring): value2 = tuple([s.strip() for s in value.strip('()[]').split(',')]) else: raise ValueError(('Cannot ...
class ChainDB(HeaderDB, ChainDatabaseAPI): def __init__(self, db: AtomicDatabaseAPI) -> None: self.db = db def get_chain_gaps(self) -> ChainGaps: return self._get_chain_gaps(self.db) def _get_chain_gaps(cls, db: DatabaseAPI) -> ChainGaps: try: encoded_gaps = db[SchemaV1.m...
.usefixtures('use_tmpdir') def test_forward_model_env_and_exec_env_is_set(): with open('exec', 'w', encoding='utf-8') as f: pass os.chmod('exec', ((stat.S_IXUSR | stat.S_IXGRP) | stat.S_IXOTH)) with open('CONFIG', 'w', encoding='utf-8') as f: f.write(dedent('\n EXECUTABLE exec\n ...
def compile_valcode_to_evm_bytecode(valcode_type, address): valcodes = generate_all_valcodes(address) valcode = valcodes[valcode_type] if (type(valcode) is bytes): return valcode elif (type(valcode) is list): lll_node = LLLnode.from_list(valcode) optimized = optimizer.optimize(ll...
def unsubscribe_all(date, cognito_id): print('unsubscribing user from all lists...') user = user_service.get_single_user(cognito_id) if user.subscriptions: for subscription in user.subscriptions: unsubscribe_single_list(date, cognito_id, asdict(subscription)) return
class OptionSeriesErrorbarSonificationDefaultinstrumentoptionsMappingHighpass(Options): def frequency(self) -> 'OptionSeriesErrorbarSonificationDefaultinstrumentoptionsMappingHighpassFrequency': return self._config_sub_data('frequency', OptionSeriesErrorbarSonificationDefaultinstrumentoptionsMappingHighpass...
class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument('--db_name') parser.add_argument('--db_user') parser.add_argument('--db_pass') def handle(self, *args, **options): self.IS_VERBOSE = False if (options['verbosity'] > 1): self.IS_V...
class TestPathlibMatch(TestPathlibGlobmatch): cases = [['match', 'some/path/to/match', True], ['to/match', 'some/path/to/match', True], ['path/to/match', 'some/path/to/match', True], ['some/**/match', 'some/path/to/match', False], ['some/**/match', 'some/path/to/match', True, pathlib.G]] def run(cls, path, patt...
class _MonitorThread(threading.Thread): def __init__(self, runner: LocalRunner) -> None: super().__init__() self.runner = runner def run(self) -> None: if (self.runner._options.bootstrap_info is None): return while True: if (not self.runner._running): ...
class TestPostPrivacyNotices(): (scope='function') def url(self) -> str: return (V1_URL_PREFIX + PRIVACY_NOTICE) (scope='function') def notice_request(self, load_default_data_uses) -> Dict[(str, Any)]: return {'name': 'test privacy notice 1', 'notice_key': 'test_privacy_notice_1', 'descr...
class OptionPlotoptionsPackedbubbleSonificationDefaultinstrumentoptionsMappingPlaydelay(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 test_saving_image(monkeypatch): mock_file_open = mock_open() fake_uuid = '123e4567-e89b-12d3-a456-' def mock_uuidgen(): return fake_uuid fake_image_bytes = b'fake-image-bytes' fake_request_stream = io.BytesIO(fake_image_bytes) storage_path = 'fake-storage-path' store = look.image...
class SequenceRule(LoopStructuringRule): def can_be_applied(loop_node: AbstractSyntaxTreeNode): if ((not loop_node.is_endless_loop) or (not isinstance((body := loop_node.body), SeqNode))): return False end_nodes: Set[CodeNode] = set() for end_node in body.get_end_nodes(): ...
class OptionPlotoptionsOrganizationSonificationContexttracksMappingGapbetweennotes(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, t...
.parametrize('icon', ['', '', '']) def test_usage_single_emoji(nlp, icon): nlp.add_pipe('emoji') doc = nlp(('Hello %s world' % icon)) assert doc._.has_emoji assert doc[1]._.is_emoji assert (doc[1]._.emoji_desc == nlp.get_pipe('emoji').get_emoji_desc(doc[1])) assert doc[1:3]._.has_emoji asser...
def extractForumWuxiaworldCom(item): (vol, chp, frag, postfix) = extractVolChapterFragmentPostfix(item['title']) if ((not (chp or vol)) or ('preview' in item['title'].lower())): return False if ('WATTT' in item['tags']): return buildReleaseMessageWithType(item, 'WATTT', vol, chp, frag=frag, ...
def get_module_class(python_module: str, python_class: str) -> Type[Module]: mod = importlib.import_module(python_module) if hasattr(mod, python_class): cls = getattr(mod, python_class) else: real_class_name = python_class for attr_name in dir(mod): attr = getattr(mod, at...
class AudioDataset(Dataset): def __init__(self, list_of_wav_files, sr, processor): self.list_of_wav_files = list_of_wav_files self.processor = processor self.sr = sr def __len__(self): return len(self.list_of_wav_files) def __getitem__(self, idx): wav_file = self.list...
class HCI_Cmd_LE_Set_Extended_Scan_Params(HCI_Command): def __init__(self, oaddr_type=0, nfilter=0, phys=1, scan_type=([0] * 8), interval=([10] * 8), window=([750] * 8)): super().__init__(b'\x08', b'A') self.payload.append(EnumByte('own addresss type', oaddr_type, {0: 'Public', 1: 'Random', 2: 'Priv...
class WallSettings(Settings): absolute_params: dict[(str, Any)] = {} relative_params = {'edge_width': 1.0} base_class = WallEdge def edgeObjects(self, boxes, chars='aAbBcCdD|', add=True): bc = self.base_class bn = bc.__name__ wallholes = type((bn + 'Hole'), (WallHoles, bc), {})(b...
class OptionPlotoptionsCylinderSonificationContexttracksMapping(Options): def frequency(self) -> 'OptionPlotoptionsCylinderSonificationContexttracksMappingFrequency': return self._config_sub_data('frequency', OptionPlotoptionsCylinderSonificationContexttracksMappingFrequency) def gapBetweenNotes(self) -...
class ReachFrequencyPredictionMixin(): def reserve(self, prediction_to_release=None, reach=None, budget=None, impression=None): params = {self.Field.prediction_id: self.get_id_assured(), self.Field.prediction_id_to_release: prediction_to_release, self.Field.budget: budget, self.Field.reach: reach, self.Fiel...
.skipif((arg_chip not in ['esp32s2', 'esp32s3', 'esp32s3beta1', 'esp32c3', 'esp32h2beta1', 'esp32c6', 'esp32h2', 'esp32p4']), reason='Supports 6 key blocks') class TestBurnKeyDigestCommands(EfuseTestCase): def test_burn_key_digest(self): self.espefuse_py('burn_key_digest -h') self.espefuse_py(f'burn...
class TestProcessValue(object): def setting_info(self): return {'value_type': 'choice', 'choices': {'foo': 221, 0: 170, 10: 187, 20: 204, 'multi': [17, 34]}} def test_valid_choice_int(self, setting_info): assert (choice.process_value(setting_info, 10) == [187]) def test_valid_choice_str_int(...
def test_chain_get_ancestors_from_block_5(chain): genesis = chain.get_canonical_block_by_number(0) (block_1, block_2, block_3, block_4, block_5) = [chain.mine_block() for _ in range(5)] header = block_5.header assert (header.block_number == 5) assert (chain.get_ancestors(0, header) == ()) assert...
def extractRiritranslationsBlogspotCom(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...
class OptionSeriesTilemapSonificationContexttracksMappingLowpassResonance(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)...
(nopython=True, cache=const.numba_cache) def ball_linear_cushion_collision_time(rvw, s, lx, ly, l0, p1, p2, direction, mu, m, g, R): if ((s == const.spinning) or (s == const.pocketed) or (s == const.stationary)): return np.inf phi = ptmath.angle(rvw[1]) v = ptmath.norm3d(rvw[1]) u = get_u(rvw, R...
_eh class HakuroukenHandler(THBEventHandler): interested = ['action_before'] execute_before = ['WineHandler', 'MomijiShieldHandler'] def handle(self, evt_type, act): if ((evt_type == 'action_before') and isinstance(act, basic.BaseAttack)): if act.cancelled: return act ...
class TestLinearDisplayP3Poperties(util.ColorAsserts, unittest.TestCase): def test_r(self): c = Color('color(--display-p3-linear 0.1 0.2 0.3)') self.assertEqual(c['r'], 0.1) c['r'] = 0.2 self.assertEqual(c['r'], 0.2) def test_g(self): c = Color('color(--display-p3-linear ...
class TestPubSub(unittest.TestCase): def test_on_message_published_decorator(self): func = MagicMock() func.__name__ = 'testfn' decorated_func = on_message_published(topic='hello-world')(func) endpoint = getattr(decorated_func, '__firebase_endpoint__') self.assertIsNotNone(en...
class TestCalendarExport(ApiBaseTest): def setUp(self): super().setUp() self.year = datetime.date.today().year self.dates = [factories.CalendarDateFactory(category='election', start_date=datetime.datetime(self.year, 10, 1), all_day=True), factories.CalendarDateFactory(category='Roundtables',...
class S3BlobManager(BlobManager): def __init__(self, config: Dict[(str, Any)]): super().__init__(config) self.s3_client = boto3.client(service_name=config.get('service_name', None), region_name=config.get('region_name', None), api_version=config.get('api_version', None), use_ssl=config.get('use_ssl'...
def serialise_talent_data(save_data: list[int], talents: dict[(str, Any)]) -> list[int]: save_data = write(save_data, len(talents), 4) for cat_id in talents: cat_talent_data = talents[cat_id] save_data = write(save_data, int(cat_id), 4) save_data = write(save_data, len(cat_talent_data), ...
_type(OSPF_MSG_LS_ACK) class OSPFLSAck(OSPFMessage): _MIN_LEN = OSPFMessage._HDR_LEN def __init__(self, length=None, router_id='0.0.0.0', area_id='0.0.0.0', au_type=1, authentication=0, checksum=None, version=_VERSION, lsa_headers=None): lsa_headers = (lsa_headers if lsa_headers else []) super(O...
class RWLockWriteD(RWLockableD): def __init__(self, lock_factory: Callable[([], Lockable)]=threading.Lock, time_source: Callable[([], float)]=time.perf_counter) -> None: self.v_read_count: _ThreadSafeInt = _ThreadSafeInt(lock_factory=lock_factory, initial_value=0) self.v_write_count: int = 0 ...
class WriteFontInfoVersion2TestCase(unittest.TestCase): def setUp(self): self.tempDir = tempfile.mktemp() os.mkdir(self.tempDir) self.dstDir = os.path.join(self.tempDir, 'test.ufo') def tearDown(self): shutil.rmtree(self.tempDir) def makeInfoObject(self): infoObject =...
class OptionSeriesLineSonificationDefaultinstrumentoptionsMapping(Options): def frequency(self) -> 'OptionSeriesLineSonificationDefaultinstrumentoptionsMappingFrequency': return self._config_sub_data('frequency', OptionSeriesLineSonificationDefaultinstrumentoptionsMappingFrequency) def gapBetweenNotes(s...
class WebhookServ(tornado.web.RequestHandler): def data_received(self, chunk: bytes) -> Optional[Awaitable[None]]: pass def get(self): self.write('What are you doing here?') self.finish() def post(self): if (('Content-Length' in self.request.headers) and ('Content-Type' in se...
class VideoStreamModeratorList(ResourceList): def before_post(self, args, kwargs, data): require_relationship(['video_stream'], data) stream = safe_query_kwargs(VideoStream, data, 'video_stream') if (not has_access('is_coorganizer', event_id=stream.event_id)): raise ForbiddenErro...
def parse(): s = '209.217.225.74 port 80 - hotelesmeflo.com - GET /chachapoyas/wp-content/themes/sketch/msr.exe\n SHA256 hash: a666fd9c896bc010b3fba825441e6c745d65807dfc ( File size: 9,261 bytes\n File description: Flash exploit used by Rig EK on 2019-06-17\n SHA256 hash: 2de435b78240c20dca9ae4c278417f2...
class ChangeDtypes(elmdptt.TaskOneToOne): changed_columns = luigi.Parameter() def actual_task_code(self, df: pd.DataFrame): cols = ast.literal_eval(self.changed_columns) for (col_name, col_type) in cols.items(): df[col_name] = df[col_name].astype(col_type) return df
class SimSoC(SoCCore): def __init__(self, clocks, trace_reset=1, auto_precharge=False, with_refresh=True, **kwargs): platform = Platform() sys_clk_freq = clocks['sys']['freq_hz'] SoCCore.__init__(self, platform, clk_freq=sys_clk_freq, ident='LiteX Simulation', cpu_variant='lite', **kwargs) ...
class TestOkLChProperties(util.ColorAsserts, unittest.TestCase): def test_lightness(self): c = Color('color(--oklch 0.9 0.5 270 / 1)') self.assertEqual(c['lightness'], 0.9) c['lightness'] = 0.2 self.assertEqual(c['lightness'], 0.2) def test_chroma(self): c = Color('color(...
class RendererTests(unittest.TestCase): def _make_app(self): app = FlaskAPI(__name__) ('/_love', methods=['GET']) def love(): return {'test': 'I <3 Python'} return app def test_render_json(self): app = self._make_app() renderer = renderers.JSONRenderer...
class Test_Collection(): def table(self, *, app): return MyTable(app, name='name') def test_key_type_bytes_implies_raw_serializer(self, *, app): table = MyTable(app, name='name', key_type=bytes) assert (table.key_serializer == 'raw') .asyncio async def test_init_on_recover(self, ...
class TestGlob(util.PluginTestCase): def test_glob_limit(self): config = self.dedent("\n matrix:\n - name: glob\n default_encoding: utf-8\n glob_pattern_limit: 10\n sources:\n - '{}/**/test-{{1..11}}.txt'\n aspell:\n ...
def update_model_folders(): subdirs = [] cnt = 0 for (root, dirs, files) in os.walk(os.path.abspath('./logs')): for dir_name in dirs: if (os.path.basename(dir_name) != 'eval'): subdirs.append(os.path.join(root, dir_name)) cnt += 1 print(subdirs) re...
class Attachment(BaseObject): def __init__(self, api=None, content_type=None, content_url=None, file_name=None, id=None, size=None, thumbnails=None, **kwargs): self.api = api self.content_type = content_type self.content_url = content_url self.file_name = file_name self.id = ...
class OptionSeriesArearangeSonification(Options): def contextTracks(self) -> 'OptionSeriesArearangeSonificationContexttracks': return self._config_sub_data('contextTracks', OptionSeriesArearangeSonificationContexttracks) def defaultInstrumentOptions(self) -> 'OptionSeriesArearangeSonificationDefaultinst...
class CooldownHandler(): __slots__ = ('data', 'db_attribute', 'obj') def __init__(self, obj, db_attribute='cooldowns'): if (not obj.attributes.has(db_attribute)): obj.attributes.add(db_attribute, {}) self.data = obj.attributes.get(db_attribute) self.obj = obj self.db_...
.asyncio class TestTasksCountUsers(): async def test_count_users(self, main_session_manager, workspace_session_manager, send_task_mock: MagicMock): count_users = CountUsersTask(main_session_manager, workspace_session_manager, send_task=send_task_mock) (await count_users.run()) send_task_mock...