code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def __init__(self, expr, datatype=None): <NEW_LINE> <INDENT> if not isinstance(expr, Basic): <NEW_LINE> <INDENT> raise TypeError("The first argument must be a sympy expression.") <NEW_LINE> <DEDENT> if datatype is None: <NEW_LINE> <INDENT> datatype = get_default_datatype(expr) <NEW_LINE> <DEDENT> elif not isinstance(da... | Initialize a (scalar) return value.
The second argument is optional. When not given, the data type will
be guessed based on the assumptions on the expression argument. | 625941ca31939e2706e4cf1e |
def process_work_artists(self, release_id, album, track, workIds, tm, count): <NEW_LINE> <INDENT> if not self.options[track]['classical_extra_artists']: <NEW_LINE> <INDENT> if self.DEBUG or self.INFO: <NEW_LINE> <INDENT> write_log(release_id, 'debug', 'Not processing work_artists as ExtraArtists not selected to be run'... | Carry out the artist processing that needs to be done in the PartLevels class
as it requires XML lookups of the works
:param release_id: name for log file - usually =musicbrainz_albumid
unless called outside metadata processor
:param album:
:param track:
:param workIds:
:param tm:
:param count:
:return: | 625941ca4d74a7450ccd4277 |
def subs_new_cat(tt, new_cat_subs): <NEW_LINE> <INDENT> for cat, dic in new_cat_subs: <NEW_LINE> <INDENT> tt[cat] = tt[cat].map(lambda v: change_val(v, dic)) | map categories in columns by new_cat_subs=[(col,{cat:new_cat,..}),..] | 625941cad6c5a102081440fd |
def get_batches_by_domain(self, domain_id): <NEW_LINE> <INDENT> return self.plain_batches[domain_id], self.transformed_batches[domain_id] | Gets the training batches for the given domain
:param domain_id:
:return: (plain_images_tensor, domain_tensor), (transformed_images_tensor, domain_tensor) | 625941ca76d4e153a657ebe4 |
def main(): <NEW_LINE> <INDENT> psr = argparse.ArgumentParser(description='text reflow') <NEW_LINE> psr.add_argument('input', metavar='DIR', help='dir with text files') <NEW_LINE> psr.add_argument('output', metavar='DIR', help='output directory') <NEW_LINE> psr.add_argument('--tokenizer', metavar='FILE', default='token... | Read input dir, dump in output dir | 625941ca99cbb53fe6792c99 |
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, CreateBatch): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__ | Returns true if both objects are equal | 625941ca7b180e01f3dc48b1 |
def pip_package_install(pip_packages, installed_pip_packages): <NEW_LINE> <INDENT> for package in pip_packages: <NEW_LINE> <INDENT> if not package in installed_pip_packages: <NEW_LINE> <INDENT> print_message("red", "Installing pip package " + package) <NEW_LINE> cmdstring = "sudo pip3 install --upgrade " + package <NEW... | Install python pip package | 625941ca2eb69b55b151c961 |
def __init__(self, start_date, end_date, currency, payer_account, usage_accounts, attributes=None, tag_cols=None): <NEW_LINE> <INDENT> super().__init__(start_date, end_date, currency, payer_account, usage_accounts, attributes, tag_cols) <NEW_LINE> self._processor_arch = choice(self.ARCHS) <NEW_LINE> self._resource_id =... | Initialize the EC2 generator. | 625941ca8e71fb1e9831d85c |
def clientId(self): <NEW_LINE> <INDENT> return _swigibpy.EClientSocketBase_clientId(self) | clientId(EClientSocketBase self) -> int | 625941ca5e10d32532c5efda |
def checkGridFull(self): <NEW_LINE> <INDENT> full = True <NEW_LINE> for i in range(3): <NEW_LINE> <INDENT> for j in range(3): <NEW_LINE> <INDENT> if self._grid[i][j] == 0: <NEW_LINE> <INDENT> full = False <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> if full: <NEW_LINE> <INDENT> self._complete = True <NEW_LINE> self._winState ... | Helper function to check if the grid is full | 625941caac7a0e7691ed4180 |
def handle_exception(self, exc): <NEW_LINE> <INDENT> if isinstance(exc, exceptions.Throttled): <NEW_LINE> <INDENT> self.headers['X-Throttle-Wait-Seconds'] = '%d' % exc.wait <NEW_LINE> <DEDENT> if isinstance(exc, exceptions.APIException): <NEW_LINE> <INDENT> return Response({'detail': exc.detail}, status=exc.status_code... | Handle any exception that occurs, by returning an appropriate response,
or re-raising the error. | 625941caa17c0f6771cbe103 |
def _open(self): <NEW_LINE> <INDENT> return open_file(self.source.filepath) | Use the open_file function on self.source.filepath in 'r' mode | 625941ca656771135c3eb921 |
def read_config_file(filename): <NEW_LINE> <INDENT> print("tools_autodoc.py - Reading configuration file : {0}".format(filename)) <NEW_LINE> cfg_file = os.path.abspath(filename) <NEW_LINE> if not os.path.isfile(cfg_file): <NEW_LINE> <INDENT> raise RuntimeError("Could not find config file: {0}".format(cfg_file)) <NEW_LI... | Read the configuration file and process | 625941ca3317a56b86939d0c |
def getEncoderPoseInterpPosition(self, *args): <NEW_LINE> <INDENT> return _AriaPy.ArRobot_getEncoderPoseInterpPosition(self, *args) | getEncoderPoseInterpPosition(self, ArTime timeStamp, ArPose position, ArPoseWithTime mostRecent = None) -> int
getEncoderPoseInterpPosition(self, ArTime timeStamp, ArPose position) -> int | 625941ca76e4537e8c351725 |
def post(self,request): <NEW_LINE> <INDENT> json_bytes = request.body <NEW_LINE> json_str = json_bytes.decode() <NEW_LINE> book_dict = json.loads(json_str) <NEW_LINE> book = BookInfo.objects.create( btitle = book_dict.get('btitle'), bpub_date=book_dict.get('bpub_date') ) <NEW_LINE> return JsonResponse({ 'id': book.id, ... | 新增图书 /books/
:param self:
:param request:
:return: | 625941caa17c0f6771cbe104 |
def __init__(self, jsondict=None, strict=True, **kwargs): <NEW_LINE> <INDENT> self.approvalDate = None <NEW_LINE> self.author = None <NEW_LINE> self.clinicalRecommendationStatement = None <NEW_LINE> self.compositeScoring = None <NEW_LINE> self.contact = None <NEW_LINE> self.copyright = None <NEW_LINE> self.date = None ... | Initialize all valid properties.
:raises: FHIRValidationError on validation errors, unless strict is False
:param dict jsondict: A JSON dictionary to use for initialization
:param bool strict: If True (the default), invalid variables will raise a TypeError | 625941ca30dc7b7665901a1a |
def test_short_nap(self): <NEW_LINE> <INDENT> self.assertEqual(nap(1), "I'm feeling refreshed after my 1 hour nap") | Short naps should be refreshing | 625941ca711fe17d82542420 |
def __iter__(self): <NEW_LINE> <INDENT> return iter(set(self.objects)) | Iterate the particles in the group | 625941ca7d43ff24873a2d53 |
def do_all_protein_pse_things(self): <NEW_LINE> <INDENT> self.create_protein_pse_file() <NEW_LINE> self.protein_pse_path = os.path.join(self.perspective_dir_pymol, str(self.gene), "00_{}.pse".format(self.gene)) <NEW_LINE> cmd.save(self.protein_pse_path) | This function creates a directory for the gene if it doesn't exist, locates
the .pdb file, loads in in a pymol session, applies all programmed settings,
and saves the file. | 625941cae76e3b2f99f3a8bf |
def writePool(poolList): <NEW_LINE> <INDENT> with open("pool.dat","w") as pool: <NEW_LINE> <INDENT> for line in poolList: <NEW_LINE> <INDENT> pool.write(line) | Writes pool to
file after any
changes. | 625941ca627d3e7fe0d68f03 |
def __init__(self, name, *args): <NEW_LINE> <INDENT> super().__init__( '{} is not a dictionary.'.format(name), *args ) | Initialize a new NotDictError.
:param str name:
Name of the object that is not a dictionary. | 625941cabf627c535bc13282 |
def get_access_token(self, installation_id, user_id=None): <NEW_LINE> <INDENT> body = {} <NEW_LINE> if user_id: <NEW_LINE> <INDENT> body = {"user_id": user_id} <NEW_LINE> <DEDENT> response = requests.post( "https://api.github.com/installations/{}/access_tokens".format(installation_id), headers={ "Authorization": "Beare... | Get an access token for the given installation id.
POSTs https://api.github.com/installations/<installation_id>/access_tokens
:param user_id: int
:param installation_id: int
:return: :class:`github.InstallationAuthorization.InstallationAuthorization` | 625941ca8da39b475bd65026 |
def list_wordlists(): <NEW_LINE> <INDENT> wordlists_path = '{}/wordlists'.format(os.path.dirname(os.path.abspath(__file__))) <NEW_LINE> return {re_wordlist.search(os.path.basename(f)).group('wordlist'): os.path.join(wordlists_path, f) for f in os.listdir(wordlists_path)} | List all installed wordlist files | 625941ca925a0f43d2549f2a |
def get_check_out_length(self): <NEW_LINE> <INDENT> length = 21 <NEW_LINE> return length | Returns how long the book can be checked out | 625941ca63f4b57ef00011ce |
@cli.command('sync', short_help='Synchronise and re-sample whole data-sets.') <NEW_LINE> @click.argument('input-file', type=click.Path(exists=True), nargs=1) <NEW_LINE> @click.argument('output-file', type=click.Path(writable=True), nargs=1) <NEW_LINE> @click.argument('data-names', nargs=-1) <NEW_LINE> @click.option( '-... | Synchronise and re-sample data-sets defined in INPUT_FILE and writes shifts
and synchronized data into the OUTPUT_FILE.
INPUT_FILE: Data-sets input file (format: .xlsx, .json).
OUTPUT_FILE: output file (format: .xlsx, .json).
DATA_NAMES: to filter out the data sets to synchronize. | 625941cabaa26c4b54cb11d3 |
def Print(self, dc): <NEW_LINE> <INDENT> if self.IsShrinkToFit(): <NEW_LINE> <INDENT> scale = self.CalculateShrinkToFit(dc) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> scale = 1 <NEW_LINE> <DEDENT> headerBlock = ColumnHeaderBlock( self.lv, self.left, self.right, scale, self.allCellWidths) <NEW_LINE> self.engine.AddBl... | Print this Block.
Return True if the Block has finished printing | 625941cabe8e80087fb20cf7 |
def run_selftest_and_wait(self, test_type, output=None, polling=5, progress_handler=None): <NEW_LINE> <INDENT> test_initiation_result = self.run_selftest(test_type) <NEW_LINE> if test_initiation_result[0] != 0: <NEW_LINE> <INDENT> return test_initiation_result[:2] <NEW_LINE> <DEDENT> if test_type == 'offline': <NEW_LIN... | This is essentially a wrapper around run_selftest() such that we
call self.run_selftest() and wait on the running selftest till
it finished before returning.
The above holds true for all pySMART supported tests with the
exception of the 'offline' test (ATA only) as it immediately
returns, since the entire test only aff... | 625941ca50812a4eaa59c3d6 |
def permute_print(seq): <NEW_LINE> <INDENT> print(' '*(3-len(seq)),'chiamata',seq) <NEW_LINE> if len(seq) <= 1: <NEW_LINE> <INDENT> perms = [seq] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> perms = [] <NEW_LINE> for i in range(len(seq)): <NEW_LINE> <INDENT> sub = permute_print(seq[:i]+seq[i+1:]) <NEW_LINE> for p in ... | Ritorna la lista di tutte le permutazioni
della sequenza seq | 625941ca44b2445a33932149 |
def on_event(self, event): <NEW_LINE> <INDENT> return self._rules[str(event)].apply() | Trigger a transition
:Args:
event : Event
Event used to select the transitional rule | 625941ca4527f215b584c50b |
def __init__( self, data, source_type="marcxml", latest_only=True, dojson_model=migrator_marc21, ): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.source_type = source_type <NEW_LINE> self.latest_only = latest_only <NEW_LINE> self.dojson_model = dojson_model <NEW_LINE> self.revisions = None <NEW_LINE> self.files ... | Initialize. | 625941cacdde0d52a9e530e6 |
def argMatchError(self, funcArgTypes, callingAstNode): <NEW_LINE> <INDENT> numArgsExpected = sum([1 for type_dict in self.element.funcArgTypes if type_dict[JSON_TYPE_FIELD] != TYPE_NOTHING]) <NEW_LINE> numArgsProvided = len(funcArgTypes); <NEW_LINE> if (numArgsExpected != numArgsProvided): <NEW_LINE> <INDENT> returner ... | @param {List of type dicts} funcArgTypes -- the types of each
argument for the function.
@param {AstNode} callingAstNode -- the astNode where the
function call is actually being invoked.
@return FuncCallArgMatchError object if the arguments do not
match.
None if the arguments match (ie, there is no t... | 625941ca85dfad0860c3af0e |
def prismaaccess_configs(self, site_id, prismaaccess_config_id, tenant_id=None, api_version="v2.0"): <NEW_LINE> <INDENT> if tenant_id is None and self._parent_class.tenant_id: <NEW_LINE> <INDENT> tenant_id = self._parent_class.tenant_id <NEW_LINE> <DEDENT> elif not tenant_id: <NEW_LINE> <INDENT> raise TypeError("tenant... | DELETE Prismaaccess_Configs API Function
**Parameters:**:
- **site_id**: Site ID
- **prismaaccess_config_id**: Prisma Acceess Config ID
- **tenant_id**: Tenant ID
- **api_version**: API version to use (default v2.0)
**Returns:** requests.Response object extended with cgx_status and cgx_content properties. | 625941cafb3f5b602dac3746 |
def update(self): <NEW_LINE> <INDENT> for i in range(self.framecount): <NEW_LINE> <INDENT> if self.timer == int((i) * self.timemod): <NEW_LINE> <INDENT> self.nextFrame() <NEW_LINE> <DEDENT> <DEDENT> if self.timer == 0: <NEW_LINE> <INDENT> self.timer = self.duration + 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self... | Updating the pointer's position. The active frame is always drawn to
the animation image surface. | 625941ca8a43f66fc4b54119 |
def ready(self): <NEW_LINE> <INDENT> import dj_vcn_accounts.signals | Code to execute when Django starts. | 625941ca8e7ae83300e4b080 |
def test_delete_network_acl(self): <NEW_LINE> <INDENT> pass | Test case for delete_network_acl
delete_network_acl_request = ncloud_vpc.DeleteNetworkAclRequest()
try:
api_response = self.api.delete_network_acl(delete_network_acl_request)
print(api_response)
except ApiException as e:
print("Exception when calling V2Api->de... | 625941ca097d151d1a222f0d |
def _cc(我, args): <NEW_LINE> <INDENT> if isinstance(args, str): <NEW_LINE> <INDENT> return args <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> r, g, b = args <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> raise TurtleGraphicsError("bad color arguments: %s" % str(args)) <NEW_LINE> <DEDENT> if 我.幕._colormode == 1.0: <NEW_... | Convert colortriples to hexstrings.
| 625941ca91af0d3eaac9bacc |
def indexOfCoi(data): <NEW_LINE> <INDENT> alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" <NEW_LINE> alphabets = list(alphabets) <NEW_LINE> count = [] <NEW_LINE> term = 0 <NEW_LINE> for i in range(len(alphabets)): <NEW_LINE> <INDENT> count.append(data.count(alphabets[i])) <NEW_LINE> <DEDENT> for j in range(len(count)): <NEW_L... | Function which returns index of coincidence for any given data
:param data: cipherext
:return: index of coincidence | 625941ca8a349b6b435e8227 |
def save_raw_input(self, df: pd.DataFrame) -> str: <NEW_LINE> <INDENT> full_path = str(self.raw_data_location) <NEW_LINE> try: <NEW_LINE> <INDENT> os.remove(full_path) <NEW_LINE> <DEDENT> except OSError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> with pd.HDFStore(full_path) as store: <NEW_LINE> <INDENT> store[self.RA... | For saving the normalized raw data
:param df: the raw data data frame | 625941caff9c53063f47c2a7 |
def test_basic_dict_functionality(self): <NEW_LINE> <INDENT> d = GlobbableDict() <NEW_LINE> d['a'] = 1 <NEW_LINE> d['b'] = 'z' <NEW_LINE> self.assertEqual(d['a'], 1) <NEW_LINE> self.assertEqual(d['b'], 'z') <NEW_LINE> self.assertRaises(KeyError, lambda: d['c']) | Test that the basic dict functionality still works. I'd be doing well if I broke it, but still... | 625941ca7c178a314d6ef513 |
def play_one_move(col, row, valid_directions): <NEW_LINE> <INDENT> victory = False <NEW_LINE> direction = input("Direction: ") <NEW_LINE> direction = direction.lower() <NEW_LINE> if not direction in valid_directions: <NEW_LINE> <INDENT> print("Not a valid direction!") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> col, ... | Plays one move of the game
Return if victory has been obtained and updated col,row | 625941ca4a966d76dd5510c3 |
def _mark(self, row, col, val): <NEW_LINE> <INDENT> self._maze_map[row][col] = self.TYPE[val] <NEW_LINE> self._moveTurtle(row, col) <NEW_LINE> self._turtle.dot(10, self.COLOR[val]) | Set the row, col position of the map according val, and move to that
position.
Args:
row (int): The current positions's row coordinate.
col (int): The current positions's column coordinate. | 625941caa934411ee3751748 |
def fan_template_data(self, level=None, reason=None): <NEW_LINE> <INDENT> data = { "address" : self.device.addr.hex, "name" : self.device.name if self.device.name else self.device.addr.hex, } <NEW_LINE> if level is not None: <NEW_LINE> <INDENT> assert isinstance(level, Dev.FanLinc.Speed) <NEW_LINE> level_int = FanLinc.... | Create the Jinja templating data variables for fan messages.
NOTE: Dimmer messages are handled via Dimmer.template_data().
Args:
level (FanLinc.Speed): The fan speed enumeration. If None, speed
attributes are not added to the data.
reason (str): The reason the device was triggered. This is an
... | 625941ca4e4d5625662d448c |
def key_shield(the_key, player, game_instance): <NEW_LINE> <INDENT> if ("_SHIELD" in the_key and player.entity_skin.current_animation in ( 'static', 'static_upgraded', 'walk', 'walk_upgraded')): <NEW_LINE> <INDENT> player.shield['on'] = True <NEW_LINE> player.entity_skin.change_animation( 'static', game_instance, param... | activate shield if asked by the player, and if possible, return
True, if the shield was activated | 625941ca29b78933be1e5760 |
def motion_b(direction="forward", pause_time=0.1, *args): <NEW_LINE> <INDENT> for leg in legs: <NEW_LINE> <INDENT> if leg.id % 2 == 0: <NEW_LINE> <INDENT> extend(leg.id) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> retract(leg.id) <NEW_LINE> <DEDENT> if leg.id % 2 == 0: <NEW_LINE> <INDENT> pivot_backwards(leg.id) <NEW... | Move Group B (leg_id % 2 = 0) legs | 625941ca3c8af77a43ae3854 |
@asyncio.coroutine <NEW_LINE> def async_setup(hass, config): <NEW_LINE> <INDENT> url = config[DOMAIN].get(CONF_URL) <NEW_LINE> auth_token = config[DOMAIN].get(CONF_ACCESS_TOKEN) <NEW_LINE> update_interval = config[DOMAIN].get(CONF_UPDATE_INTERVAL) <NEW_LINE> session = hass.helpers.aiohttp_client.async_get_clientsession... | Initialize the FreeDNS component. | 625941ca23e79379d52ee618 |
def log_event( self, message, tool_id=None, **kwargs ): <NEW_LINE> <INDENT> if self.app.config.log_events: <NEW_LINE> <INDENT> event = self.app.model.Event() <NEW_LINE> event.tool_id = tool_id <NEW_LINE> try: <NEW_LINE> <INDENT> event.message = message % kwargs <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> event.mess... | Application level logging. Still needs fleshing out (log levels and such)
Logging events is a config setting - if False, do not log. | 625941ca656771135c3eb922 |
def get_items(self, name): <NEW_LINE> <INDENT> items=[] <NEW_LINE> for item in self.my_items: <NEW_LINE> <INDENT> if item.name == name: <NEW_LINE> <INDENT> items.append(item) <NEW_LINE> <DEDENT> <DEDENT> return items | Get collection items called ``name``. | 625941cadd821e528d63b25d |
def table_route(self, table: CollectionT, shard_param: str = None, *, query_param: str = None, match_info: str = None, exact_key: str = None) -> ViewDecorator: <NEW_LINE> <INDENT> def _decorator(fun: ViewHandlerFun) -> ViewHandlerFun: <NEW_LINE> <INDENT> _query_param = query_param <NEW_LINE> if shard_param is not None:... | Decorate view method to route request to table key destination. | 625941ca30c21e258bdfa551 |
def am_admin_and_not_self(user): <NEW_LINE> <INDENT> return flask.g.am_admin and flask.g.current_user["username"].lower() != user["username"].lower() | Is the current user admin, but not the same as the given user? | 625941ca5fc7496912cc3a32 |
def test_show(self): <NEW_LINE> <INDENT> (result, out, err) = self.runsubcmd("gpo", "show", self.gpo_guid, "-H", "ldap://%s" % os.environ["SERVER"]) <NEW_LINE> self.assertCmdSuccess(result, "Ensuring gpo fetched successfully") | Show a real GPO, and make sure it passes | 625941ca10dbd63aa1bd2c58 |
def _integration_params(self): <NEW_LINE> <INDENT> for dtype, per_rank_params in self.dtype_rank_params.items(): <NEW_LINE> <INDENT> if dtype not in self.param_storages.keys(): <NEW_LINE> <INDENT> self.param_storages[dtype] = {} <NEW_LINE> <DEDENT> for dst_rank, params in enumerate(per_rank_params): <NEW_LINE> <INDENT>... | Integrate the parameters into a continuous memory according to rank, and support the update of training parameters. | 625941ca82261d6c526ab552 |
def get_cinder_client(self, interface='public'): <NEW_LINE> <INDENT> cinder_endpoint = self.session.get_endpoint(service_type='volume', interface=interface) <NEW_LINE> cinder_client = cinderclient.Client(CINDER_CLI_VER, session=self.session) <NEW_LINE> return cinder_client | Get the cinder-client object. | 625941ca435de62698dfdd00 |
def is_active_endpoint(self, endpoint_url): <NEW_LINE> <INDENT> if not self.execute_select(endpoint_url, 'SELECT ?x WHERE {?x ?y ?z}', limit=1): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return True | Checks if the given endpoint URL corresponds to an active SPARQL-served endpoint.
:param endpoint_url: The endpoint URL to check.
:return: True if endpoint is active, False if endpoint is not reachable. | 625941caaad79263cf390af4 |
def best_guard_minute_combination1(guards_to_sleep: Dict[int, Guard]) -> int: <NEW_LINE> <INDENT> most_sleepy_guard = max(guards_to_sleep.items(), key=lambda guard: guard[1].total_sleep_time)[1] <NEW_LINE> return most_sleepy_guard.number * statistics.mode(most_sleepy_guard.minutes_slept) | Return best guard/minute combination by finding the guard that has the most minutes asleep.
:param guards_to_sleep: guards' sleeping and shift changing info
:return: best guard/minute combination by most sleepy guard in total | 625941ca1f037a2d8b9462b2 |
def test_f_phone_addr_02(): <NEW_LINE> <INDENT> import program03 <NEW_LINE> check(program03.f_phone_addr('file03_03_in.txt', 'file03_04_in.txt'), {'Trani': {'address': 'Gioia Tauro'}, 'Marco': {'phone': '347 8987989'}, 'Ugo': {'address': 'via Po, 346'}, 'trani': {'phone': '07897878'}, 'GG': {'phone': '06 89786765'}, 'B... | Check a simple input | 625941ca56ac1b37e6264284 |
def load_script(args: list) -> None: <NEW_LINE> <INDENT> if len(args) <= 0: <NEW_LINE> <INDENT> click.secho('Usage: import <local path to frida-script> (optional name) (optional: --no-exception-handler)', bold=True) <NEW_LINE> return <NEW_LINE> <DEDENT> source = args[0] <NEW_LINE> if len(args) > 1: <NEW_LINE> <INDENT> ... | Loads an external Fridascript from the host filesystem
and executes it as an objection job.
:param args:
:return: | 625941ca851cf427c661a5c3 |
@pytest.mark.parametrize( "settings_label, expected_cfn_params", [ ( "test1", utils.merge_dicts( DefaultCfnParams["cluster"].value, DefaultCfnParams["efs"].value, { "MasterSubnetId": "subnet-12345678", "AvailabilityZone": "mocked_avail_zone", "ComputeSubnetId": "subnet-23456789", }, ), ), ( "test2", utils.merge_dicts( ... | Unit tests for parsing EFS related options. | 625941ca4428ac0f6e5ba8a6 |
def run_forever( lcdproc='', mpd='', lcdproc_screen=DEFAULT_LCD_SCREEN_NAME, lcdproc_charset=DEFAULT_LCDPROC_CHARSET, lcdd_debug=False, pattern='', patterns=[], refresh=DEFAULT_REFRESH, backlight_on=DEFAULT_BACKLIGHT_ON, priority_playing=DEFAULT_PRIORITY, priority_not_playing=DEFAULT_PRIORITY, retry_attempts=DEFAULT_RE... | Run the server.
Args:
lcdproc (str): the target connection (host:port) for lcdproc
mpd (str): the target connection ([pwd@]host:port) for mpd
lcdproc_screen (str): the name of the screen to use for lcdproc
lcdproc_charset (str): the charset to use with lcdproc
lcdd_debug (bool): whether to enable f... | 625941cab57a9660fec33937 |
def _data_reset(self): <NEW_LINE> <INDENT> parsed = urlparse(self.domain.config["EVENT_STORE"]["DATABASE_URI"]) <NEW_LINE> conn = psycopg2.connect( dbname=parsed.path[1:], user="postgres", port=parsed.port, host=parsed.hostname, ) <NEW_LINE> cursor = conn.cursor() <NEW_LINE> cursor.execute("TRUNCATE message_store.messa... | Utility function to empty messages, to be used only by test harness.
This method is designed to work only with the postgres instance running in the configured docker container:
User is locked to `postgres` and it is assumed that the default user does not have a password, both of which
should not be the configuration i... | 625941cab57a9660fec33938 |
def test_get_domain_flow_stat(self): <NEW_LINE> <INDENT> error = None <NEW_LINE> try: <NEW_LINE> <INDENT> response = self.cdn_client.get_domain_flow_stat( domain = 'www.example.com', startTime = '2019-03-05T12:00:00Z', endTime = '2019-03-06T13:00:00Z', period = 3600, withRegion = '') <NEW_LINE> print(response) <NEW_LIN... | use new stat api
params is optional
no domain->all domains by uid
no endTime->time by now
no startTime->24hour before endTime
no period->3600
no withRegion->false | 625941ca15baa723493c4029 |
def __init__(self, colormap='cividis', width=1200, height=800, scale=1, max_words=2000, max_font_size=120, min_font_size=4, relative_scaling='auto', font='Times New Roman', background='aliceblue', prefer_horizontal=0.8, contour_width=1, colorer="", mask=None, dpi=100): <NEW_LINE> <INDENT> self._font_name = '' <NEW_L... | WordCloud wrapper
There are issues with name collisions between WordClouder and the parent WordCloud object
By and large, WordClouder tries to use properties with similar but slighlty different names
easy_font
colorer --> colorer function
mask_image --> mask...this has too many options and is set wi... | 625941ca435de62698dfdd01 |
def test_count_not_found(self): <NEW_LINE> <INDENT> CollectionTest.objects.count(callback=self.stop) <NEW_LINE> count = self.wait() <NEW_LINE> count.should.be.equal(0) | [ManagerTestCase] - Count document when not found | 625941cae8904600ed9f1fe1 |
def query(self, point, best=None): <NEW_LINE> <INDENT> if self.node is None: <NEW_LINE> <INDENT> return best <NEW_LINE> <DEDENT> if best is None: <NEW_LINE> <INDENT> best = (self.idx, self.node) <NEW_LINE> <DEDENT> if distance(self.node, point) < distance(best[1], point): <NEW_LINE> <INDENT> best = (self.idx, self.node... | Find the nearest neighbor of point in KDTree | 625941ca0c0af96317bb829c |
def __get_element(self, selector, get_multiple=False): <NEW_LINE> <INDENT> select_by, select_value = clean_selector(selector) <NEW_LINE> if select_by == "css": <NEW_LINE> <INDENT> elements = self._driver.find_elements_by_css_selector(select_value) <NEW_LINE> <DEDENT> elif select_by == "id": <NEW_LINE> <INDENT> elements... | Gets a WebElement | 625941cafbf16365ca6f6278 |
def send_yaw(self): <NEW_LINE> <INDENT> if self.rec_dict['ROLL'] == 0 and self.rec_dict['PITCH'] == 0 and self.rec_dict['YAW'] == 0: <NEW_LINE> <INDENT> rospy.logwarn("Invalid yaw, skipping") <NEW_LINE> return <NEW_LINE> <DEDENT> current_time = rospy.get_rostime() <NEW_LINE> yaw = Imu() <NEW_LINE> yaw.header.stamp = c... | We send yaw (without ins) as an IMU message for compatibility with our
other software | 625941ca31939e2706e4cf1f |
def _process_specific(self, pinfo, take_dump, logger=None): <NEW_LINE> <INDENT> cmds = [] <NEW_LINE> dump_files = self._dump_files(pinfo) <NEW_LINE> for pid in pinfo.pidv: <NEW_LINE> <INDENT> dump_command = "" <NEW_LINE> if take_dump: <NEW_LINE> <INDENT> dump_file = dump_files[pid] <NEW_LINE> dump_command = "process sa... | Return the commands that attach to each process, dump info and detach. | 625941cabd1bec0571d906e4 |
def get_words(words_file, start_id, stop_id): <NEW_LINE> <INDENT> words = [] <NEW_LINE> for i in range(len(words_file)): <NEW_LINE> <INDENT> line = words_file[i] <NEW_LINE> if line.split(" ")[0] not in ['<word', '<phonword']: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> line_id = line.split('id=')[1].split('>')[0].... | Gets the words from word ID's from unit.xml files. | 625941ca442bda511e8be4cd |
def save(self, *args, **kwargs): <NEW_LINE> <INDENT> if not self.id: <NEW_LINE> <INDENT> self.publish_date = datetime.today() <NEW_LINE> self.slug = slugify(self.title) <NEW_LINE> <DEDENT> self.modify_date = datetime.now() <NEW_LINE> super(IYPHToolBoxItem, self).save(*args, **kwargs) | On save, update timestamps | 625941ca925a0f43d2549f2b |
@task(hosts=env.hosts) <NEW_LINE> def deploy(c): <NEW_LINE> <INDENT> package = 'slacm-' + str(env.version) + '.tar.gz' <NEW_LINE> package_path = 'dist/' + package <NEW_LINE> put(c,package_path) <NEW_LINE> sudo(c,'pip3 install %s' % package) <NEW_LINE> sudo(c,'rm -f %s' %(package)) | Deploy package on remote host(s) | 625941ca24f1403a92600c1b |
def print_new_configs(self) -> None: <NEW_LINE> <INDENT> if not self.newconfigs: <NEW_LINE> <INDENT> print('{0}No *.new configuration ' 'files found.{1}'.format(self.meta.clrs['green'], self.meta.clrs['reset'])) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print('{0}Found *.new configuration ' 'files:{1}'.format(self.... | Print *.new files | 625941cadc8b845886cb55e9 |
def firstUniqChar(self, s): <NEW_LINE> <INDENT> dic = collections.Counter(s) <NEW_LINE> for i,v in enumerate(s): <NEW_LINE> <INDENT> if dic[v] == 1: <NEW_LINE> <INDENT> return i <NEW_LINE> <DEDENT> <DEDENT> return -1 | :type s: str
:rtype: int | 625941ca283ffb24f3c559b6 |
def handle_eliminated_players(self, players: List[Player]): <NEW_LINE> <INDENT> for player in players: <NEW_LINE> <INDENT> logging.info( f"Player eliminated from the game: [game_id={self.game_id} round={self.current_round} player={player}]") <NEW_LINE> player.future.set_result(None) | Handles players who are determined to be eliminated by setting future
objects so that the websocket connections blocked in GameManager.wait_until_game_complete()
can return from the websocketserver callback and terminate the connection.
Parameters
----------
players: List[Player]
Players to be notified of el... | 625941ca7cff6e4e81117a3a |
@app.route("/api/users/create", methods=["POST"]) <NEW_LINE> def create_user(): <NEW_LINE> <INDENT> auth = request.authorization <NEW_LINE> user_service = UserService() <NEW_LINE> created_user = user_service.create(auth.username, auth.password) <NEW_LINE> if created_user: <NEW_LINE> <INDENT> user_presenter = UserPresen... | Params a username:password (required) and attempts to create a user.
Username is a unique field. | 625941ca5f7d997b87174b4c |
def problem_defaults(): <NEW_LINE> <INDENT> return ProblemDefaults() | Factory associated with ProblemDefaults.
| 625941ca2c8b7c6e89b35875 |
def interpolated_length(self, dt=None): <NEW_LINE> <INDENT> if dt is None: <NEW_LINE> <INDENT> dt = self.LineInterpolationPrecision / (self.end_point - self.start_point).magnitude <NEW_LINE> <DEDENT> length = 0 <NEW_LINE> t = 0 <NEW_LINE> while t < 1: <NEW_LINE> <INDENT> t0 = t <NEW_LINE> t = min(t + dt, 1) <NEW_LINE> ... | Length of the curve obtained via line interpolation | 625941ca3cc13d1c6d3c742f |
def test_non_blocking(self): <NEW_LINE> <INDENT> class TForm(yota.Form): <NEW_LINE> <INDENT> t = EntryNode() <NEW_LINE> _t_valid = yota.Check( NonBlockingDummyValidator(), 't') <NEW_LINE> <DEDENT> test = TForm() <NEW_LINE> block, invalid = test._gen_validate({'t': 'toolong'}) <NEW_LINE> assert(block is False) | ensure that a non-blocking validators validation is successful | 625941ca7b25080760e3950e |
def serialize(self): <NEW_LINE> <INDENT> cfg = StoreManager.serialize(self) <NEW_LINE> cfg["timepoint"] = self.timepoint <NEW_LINE> cfg["report filtered reads"] = self.report_filtered <NEW_LINE> if self.counts_file is not None: <NEW_LINE> <INDENT> cfg["counts file"] = self.counts_file <NEW_LINE> <DEDENT> return cfg | Format this object (and its children) as a config object suitable for
dumping to a config file. | 625941ca21bff66bcd684a08 |
def __init__(self, dmenu=None, proc_runner=None, **kwargs): <NEW_LINE> <INDENT> self._dmenu_args = OrderedDict() <NEW_LINE> self._dmenu_config = OrderedDict() <NEW_LINE> self._run_dmenu_process = proc_runner or _run_dmenu_process <NEW_LINE> bin = dmenu or 'dmenu' <NEW_LINE> self.add_arg('dmenu', _dmenu, default=bin) <N... | An extensible dmenu wrapper.
Args:
dmenu (str): dmenu executable to use.
proc_runner (Callable[[list, list], str]): a function that calls
dmenu as a subprocess and returns the output. This defaults to
a simple call to :class:`subprocess.Popen`.
\*\*kwargs: See :meth:`xdmenu.BaseMenu.configur... | 625941ca23849d37ff7b3144 |
def build_eval_session(module_spec, class_count): <NEW_LINE> <INDENT> eval_graph, bottleneck_tensor, resized_input_tensor, wants_quantization = ( create_module_graph(module_spec)) <NEW_LINE> eval_sess = tf.Session(graph=eval_graph) <NEW_LINE> with eval_graph.as_default(): <NEW_LINE> <INDENT> (_, _, bottleneck_input, gr... | Builds an restored eval session without train operations for exporting.
Args:
module_spec: The hub.ModuleSpec for the image module being used.
class_count: Number of classes
Returns:
Eval session containing the restored eval graph.
The bottleneck input, ground truth, eval step, and prediction tensors. | 625941ca8e05c05ec3eea429 |
def test_without_logged_in_user_raises_unauthorized(self): <NEW_LINE> <INDENT> self.request.user = None <NEW_LINE> self.assertRaises( Unauthorized, api_client.get_connection, self.request ) | If request.user is None, the get_connection raises
Unauthorized. | 625941caf9cc0f698b1406b1 |
def deserialize(self, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.array is None: <NEW_LINE> <INDENT> self.array = None <NEW_LINE> <DEDENT> end = 0 <NEW_LINE> start = end <NEW_LINE> end += 4 <NEW_LINE> (length,) = _struct_I.unpack(str[start:end]) <NEW_LINE> self.array = [] <NEW_LINE> for i in range(0, len... | unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str`` | 625941cade87d2750b85fe47 |
def reformat_errors(self): <NEW_LINE> <INDENT> errors={} <NEW_LINE> pattern=r'<ul[^>]+><li>(.*)</li></ul>' <NEW_LINE> rep=r'\1' <NEW_LINE> log.debug('reformatting %d errors' % len(self.errors)) <NEW_LINE> for k,v in self.errors.items(): <NEW_LINE> <INDENT> errors[k]=re.sub(pattern, rep, str(v)) <NEW_LINE> log.debug('re... | mixin class
self.errors is a dict() that packages each value as a <ul>...</ul>
grrrrr...
We strip away everything between the <ul ...>...</ul> | 625941cad10714528d5ffd97 |
def _attachToBlinkySensorList (self, blinkySensorList, temperature): <NEW_LINE> <INDENT> self._log("attach-to-blinky-sensor-list").debug3("attaching") <NEW_LINE> blinkySensorList.setCreateFunctor (self._createFunctorSensorListCreate(temperature, blinkySensorList)) <NEW_LINE> blinkySensorList.setDeleteFunctor (s... | attaches the alarm manager to the given blinky SensorList
Arguments:
blinkyProcess - BlinkyProcess (a BlinkyNode created by Blinky)
temperature - AlarmManager | 625941ca91f36d47f21ac5a7 |
def HotelUseItem(characterid,typeid): <NEW_LINE> <INDENT> import math <NEW_LINE> player=PlayersManager().getPlayerByID(characterid) <NEW_LINE> if typeid==0: <NEW_LINE> <INDENT> Hp=player.attribute.getMaxHp()-player.attribute._hp <NEW_LINE> Mp=player.attribute.getMaxMp()-player.attribute._mp <NEW_LINE> coin=int(math.cei... | 使用酒店物品
@param characterid: int 角色id
@param typeid: int #0魔法泡沫酒 1普通果汁酒 2神奇果汁酒 | 625941ca956e5f7376d70f22 |
def SetFont(self, font): <NEW_LINE> <INDENT> wx.PopupWindow.SetFont(self, font) <NEW_LINE> self._classParent.InitFont() <NEW_LINE> self.Invalidate() | Sets the L{SuperToolTip} font globally.
:param `font`: the font to set. | 625941ca2c8b7c6e89b35876 |
def complete(self, X): <NEW_LINE> <INDENT> imputations = self.multiple_imputations(X) <NEW_LINE> if len(imputations) == 1: <NEW_LINE> <INDENT> return imputations[0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return np.mean(imputations, axis=0) | X: scipy.sparse matrix
The incomplete, sparse matrix to be used for fitting the model.
Returns:
The SVD that best approximates the true, completed matrix X. | 625941ca99cbb53fe6792c9b |
def test_effect_creation_event_is_raised(self): <NEW_LINE> <INDENT> rng = mock() <NEW_LINE> when(rng).randint(1, 6).thenReturn(1) <NEW_LINE> pyherc.vtable['\ufdd0:attack'](self.attacker, 1) <NEW_LINE> verify(self.model).raise_event(event_type_of('poisoned')) | Test that event is raised to indicate an effect was created | 625941ca63f4b57ef00011cf |
def __call__(self, labels): <NEW_LINE> <INDENT> labels = labels[0] <NEW_LINE> labs = np.zeros((labels.shape[0],len(self.bins))) <NEW_LINE> prebe = 0 <NEW_LINE> for i,be in enumerate(self.bins): <NEW_LINE> <INDENT> labs[:,[i]] += np.sum(labels[:,prebe:be],axis=1,keepdims=True) <NEW_LINE> prebe = be <NEW_LINE> <DEDENT> w... | Convert labels into probability distribution
Parameters
----------
labels : list
length 100 histogram of age labels
Returns
-------
:class:`numpy.ndarray`
distribution of individual labeler responses across age groups | 625941ca566aa707497f461e |
def _create_temporary_grass_environment(self, source_mapset_name=None, interim_result_mapset=None, interim_result_file_path=None): <NEW_LINE> <INDENT> self._create_temp_database(self.required_mapsets) <NEW_LINE> self._create_grass_environment(grass_data_base=self.temp_grass_data_base, mapset_name="PERMANENT") <NEW_LINE... | Create a temporary GRASS GIS environment
This method will:
1. create the temporary database
2. sets-up the GRASS environment
3. Create temporary mapset
This method will link the required mapsets that are
defined in *self.required_mapsets* into the location.
The mapsets may be from the global and/or user d... | 625941ca379a373c97cfabf9 |
def fullJustify(self, words, maxWidth): <NEW_LINE> <INDENT> def addSpaces(i, spaceCnt, spaceWidth): <NEW_LINE> <INDENT> return (spaceWidth // spaceCnt) + int(i < spaceWidth % spaceCnt) <NEW_LINE> <DEDENT> def connect(begin, end, wordlength, is_last): <NEW_LINE> <INDENT> s = [] <NEW_LINE> for i in range(begin, end): <NE... | :type words: List[str]
:type maxWidth: int
:rtype: List[str] | 625941ca7cff6e4e81117a3b |
def form_valid(self, form): <NEW_LINE> <INDENT> form.save() <NEW_LINE> return HttpResponseRedirect(self.get_success_url()) | If the form is valid, redirect to the supplied URL. | 625941ca6fece00bbac2d7f3 |
def detect_peak_locally_exclusive(traces, peak_sign, abs_threholds, n_shifts, neighbours_mask): <NEW_LINE> <INDENT> assert HAVE_NUMBA, 'You need to install numba' <NEW_LINE> traces_center = traces[n_shifts:-n_shifts, :] <NEW_LINE> if peak_sign in ('pos', 'both'): <NEW_LINE> <INDENT> peak_mask = traces_center > abs_thre... | Detect peaks using the 'locally exclusive' method. | 625941ca5e10d32532c5efdc |
def delete_book(): <NEW_LINE> <INDENT> bookId = ui.delete_book() <NEW_LINE> datastore.delete_book(bookId) | delete a wishlist book | 625941ca67a9b606de4a7f6f |
def my_lab_section(): <NEW_LINE> <INDENT> return 0 | Return the number of the lab you most often attend.
>>> my_lab_section() != 15
True | 625941ca3317a56b86939d0e |
def test_abstract_class_implemented(): <NEW_LINE> <INDENT> ProxySimulatorControls(mock.Mock(), mock.Mock()) | Tests that ProxySimulatorControls implements the abstract base class | 625941ca5166f23b2e1a520e |
def tearDown(self): <NEW_LINE> <INDENT> config.fake_user_agent_exceptions = ( self.orig_fake_user_agent_exceptions) <NEW_LINE> super().tearDown() | Tear down unit test. | 625941ca6e29344779a626c7 |
def extract_policy(env, v, gamma): <NEW_LINE> <INDENT> policy = np.zeros(env.nS, dtype=int) <NEW_LINE> for i in range (env.nS): <NEW_LINE> <INDENT> policy[i] = np.argmax([env.P[i][j][0][2] + gamma * v[env.P[i][j][0][1]] for j in range (6)]) <NEW_LINE> <DEDENT> return policy | Extract the optimal policy given the optimal value-function
Parameters:
----------
env: OpenAI env.
v: np.ndarray
value function
gamma: float
Discount factor. Number in range [0, 1)
Returns:
----------
policy: np.ndarray | 625941ca9f2886367277a943 |
def _padplus_cb(self, _path, args, types): <NEW_LINE> <INDENT> for a, _t in zip(args, types): <NEW_LINE> <INDENT> if a == 1: <NEW_LINE> <INDENT> event = Gdk.EventKey() <NEW_LINE> event.keyval = Gdk.KEY_plus <NEW_LINE> App().window.on_key_press_event(None, event) <NEW_LINE> self.client.send("/pad/saisieText", "") | Pad +
Args:
args: Args
types: Types | 625941ca30c21e258bdfa552 |
def test_sleep_quiz(self): <NEW_LINE> <INDENT> create_quiz(quiz_name="Sleep quizzes.", days=-30, active_level=False) <NEW_LINE> response = self.client.get(reverse('quizzes:index')) <NEW_LINE> self.assertContains(response, "No quizzes are available.") <NEW_LINE> self.assertQuerysetEqual(response.context['latest_quiz_lis... | Inactive quizzes aren't displayed on
the index page. | 625941cac4546d3d9de72ae9 |
def _ParseReal(self, marker_lo): <NEW_LINE> <INDENT> self._LogUltraVerbose("Real size %d", marker_lo) <NEW_LINE> if marker_lo not in [2, 3]: <NEW_LINE> <INDENT> real_length = 1 << marker_lo <NEW_LINE> self._LogWarn("Non-standard real number length (%d).", real_length) <NEW_LINE> data = self.fd.read(real_length) <NEW_LI... | Parses a real object.
Reals are stored as a 4byte float or 8byte double per IEE754's format.
The on-disk length is given by marker_lo.
Args:
marker_lo: The lower nibble of the marker.
Returns:
A float or double object representing the object. | 625941ca60cbc95b062c65f8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.