code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def pickle(self): <NEW_LINE> <INDENT> print("Do you want to pickle the current twitter attributes? ") <NEW_LINE> pickle_yn = input("Y/N: ") <NEW_LINE> if 'y' in pickle_yn.lower(): <NEW_LINE> <INDENT> with open(self.file_path, 'wb') as file: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> pickle.dump(pickling_thingy, file,... | Saves the current tweet, search, and trend attributes to a file for later retrieval. | 625941dfd268445f265b51c6 |
def make_kegg_dict(kegg_pathways): <NEW_LINE> <INDENT> global kegg_dict <NEW_LINE> kegg_dict = {} <NEW_LINE> for line in kegg_pathways: <NEW_LINE> <INDENT> fields = line.strip("\n").split("\t") <NEW_LINE> kegg= fields[0] <NEW_LINE> description= " ".join(fields[1::]).rstrip(" ") <NEW_LINE> kegg_dict[kegg]= description <... | generamos el diccionario con los kegg pathways y sus descripciones | 625941df8da39b475bd652ce |
def contact_language_data(self, contact=None, language=None, language_type=None): <NEW_LINE> <INDENT> contact = contact or self.contact <NEW_LINE> language = language or self.language <NEW_LINE> language_type = (language_type or self.language_type) <NEW_LINE> data = dict(contact=self.contact.id, language=language.id, l... | return contact language data | 625941dfadb09d7d5db6cae4 |
def is_column_definition_inside_create_table(self, query_type: str) -> bool: <NEW_LINE> <INDENT> return ( query_type == QueryType.CREATE and self.is_in_parenthesis and self.previous_token.is_punctuation and self.last_keyword_normalized == "TABLE" ) | Checks for column names in create table
Previous token is either ( or , -> indicates the column name | 625941df8a43f66fc4b543b9 |
def test_shift_not_found_8(self): <NEW_LINE> <INDENT> text = "aacabcacaabaaaaaa" <NEW_LINE> index = 2 <NEW_LINE> res = self.heuristics.get_shift_pattern_not_found(next_letter=text[4], next_next_letter=text[5], index = index) <NEW_LINE> self.assertEqual(res,5) | aacabcacaabaaaaaa
cbba
^
*****cbba <- resulting | 625941dfa79ad161976cc49d |
def MonitorCallback(self, value, index): <NEW_LINE> <INDENT> self.value[index] = value <NEW_LINE> self.changed += 1 <NEW_LINE> self.updates += value.update_count | This routine is called each time any of the monitored elements
changes. | 625941df23849d37ff7b33e4 |
def update_prediction_center(one_batch): <NEW_LINE> <INDENT> wins = [] <NEW_LINE> for row_begin, row_end, col_begin, col_end in one_batch: <NEW_LINE> <INDENT> win = pad_x[row_begin:row_end, col_begin:col_end, :] <NEW_LINE> win = np.expand_dims(win, 0) <NEW_LINE> wins.append(win) <NEW_LINE> <DEDENT> x_window = np.concat... | 根据预测结果更新原图中的一个小窗口,只取预测结果正中间的1/4的区域 | 625941df3c8af77a43ae3afa |
@csrf_exempt <NEW_LINE> @login_required(login_url='/accounts/login/') <NEW_LINE> def RemoveProductFromCart(request): <NEW_LINE> <INDENT> remove_product_from_cart(request, request.POST['id']) <NEW_LINE> return JsonResponse({"cartCount": get_cart_count(request)}) | Удалить товар из корзины | 625941df21bff66bcd684ca7 |
@cli.command() <NEW_LINE> @click.argument("dest", type=click.STRING) <NEW_LINE> @click.option("--existing", is_flag=True) <NEW_LINE> @click.pass_context <NEW_LINE> def recipients(ctx, dest, existing): <NEW_LINE> <INDENT> if existing: <NEW_LINE> <INDENT> existing_forwarders = get_existing_forwarders(ctx.obj[FORWARDERS_H... | Prints final recipients for a mail that gets sent to a forwarder | 625941df435de62698dfdfa4 |
def _extract_taxonomy_xml_tree(tree): <NEW_LINE> <INDENT> head_as_etrees = tree.xpath('.//%s' % CODE_DESCRIPTION_XML_TAG) <NEW_LINE> id_as_etrees = tree.xpath('.//%s' % CODE_ID_XML_TAG) <NEW_LINE> synonyms_as_etrees = tree.xpath('.//%s' % INSTANCE_DESCRIPTION_XML_TAG) <NEW_LINE> head_as_str = head_as_etrees[0].text <NE... | Given a code xml etree, extract its id, head and synonyms.
params:
etree (lxml etree)
returns
str: id
str: taxonomy head token
list[str]: synonyms tokens | 625941dfa17c0f6771cbe3a7 |
def rmsprop(x, dx, config=None): <NEW_LINE> <INDENT> if config is None: config = {} <NEW_LINE> learning_rate = config.setdefault('learning_rate', 1e-2) <NEW_LINE> decay_rate = config.setdefault('decay_rate', 0.99) <NEW_LINE> epsilon = config.setdefault('epsilon', 1e-8) <NEW_LINE> cache = config.setdefault('cache', np.z... | Uses the RMSProp update rule, which uses a moving average of squared
gradient values to set adaptive per-parameter learning rates.
config format:
- learning_rate: Scalar learning rate.
- decay_rate: Scalar between 0 and 1 giving the decay rate for the squared
gradient cache.
- epsilon: Small scalar used for smoothin... | 625941df4c3428357757c67e |
def main(mod_type='bigram', smoothing='laplace_smoothing', threshold=5, n_sentences=10000, n_folds=5, interpolation=False): <NEW_LINE> <INDENT> logger.info('Running Model for given parameters: ') <NEW_LINE> logger.info('Model N-Grams: {0},' ' Smoothing Type: {1},' ' Vocabulary Base Limit: {2},' ' Number of Sentences: {... | :param mod_type:
:param smoothing:
:param threshold:
:param n_sentences:
:param n_folds:
:param interpolation:
:return: | 625941dfbe7bc26dc91cd951 |
def group_to_finiteset(group): <NEW_LINE> <INDENT> if iterable(group): <NEW_LINE> <INDENT> return FiniteSet(*group) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return group | Converts ``group`` to a :class:``FiniteSet`` if it is an
iterable. | 625941df187af65679ca5477 |
def __init__(self): <NEW_LINE> <INDENT> self._shape = None <NEW_LINE> self._latitude = None <NEW_LINE> self._longitude = None <NEW_LINE> self._radius = None <NEW_LINE> self._beginat = None <NEW_LINE> self._endat = None <NEW_LINE> self._name = None <NEW_LINE> self._city = None <NEW_LINE> self._le... | initializing the NoFlyZoneDB class with the parameters
setted to None by default | 625941dfb545ff76a891416d |
def loadcsv(file): <NEW_LINE> <INDENT> reader = csv.DictReader(decode_utf8(file), delimiter=';') <NEW_LINE> for row in reader: <NEW_LINE> <INDENT> book_queryset=Book.objects.all() <NEW_LINE> book_authors = [] <NEW_LINE> book_jenre = [] <NEW_LINE> for autor in row['authors'].split(','): <NEW_LINE> <INDENT> a = autor.str... | Load books to catalog without any validation
Create or update books, key values: authors and name
:param file: uploaded file, which open as binary
:return: None | 625941dff8510a7c17cf9a56 |
def delete_replaygain_tags(fname: str) -> None: <NEW_LINE> <INDENT> RGTrack(fname).cleanup_tags() | Delete all ReplayGain tags from a music file. | 625941df435de62698dfdfa5 |
def log(message, prefix=True, **kwargs): <NEW_LINE> <INDENT> return _print(message, log_level=0, prefix=prefix, **kwargs) | Print a default level log message. | 625941df26238365f5f0f1ca |
def mouse_scroll(self, event): <NEW_LINE> <INDENT> width, height = self.Size <NEW_LINE> origin = ((width/2 - self.mouse[0]) / self.scale - self.center[0], (self.mouse[1] - height/2) / self.scale - self.center[1]) <NEW_LINE> dScale = 1.0025 <NEW_LINE> if event.GetWheelRotation() < 0: <NEW_LINE> <INDENT> dScale = 1 / dSc... | Handles mouse scrolling by adjusting window scale. | 625941df377c676e912724ff |
def submit_data_and_verify(username, pwd, uri, body, expected_rst, sql_path, yml_path, send_method, **params): <NEW_LINE> <INDENT> sql_file = sql_path <NEW_LINE> yml_file = yml_path <NEW_LINE> setUp_dict = params['setUp'] <NEW_LINE> body = format_data_by_setup(body, setUp_dict) <NEW_LINE> conditions = format_data_by_se... | 提交数据请求后,验证数据库结果
:param expected_rst: 预期结果
:param url: 请求url
:param body: 请求报文
:param sql_path: sql文件
:param yml_path: yml格式化文件
:param send_method: 请求方法
:return: | 625941df4527f215b584c7ab |
@pytest.fixture() <NEW_LINE> def mocked_tf_session(mocker): <NEW_LINE> <INDENT> return mocker.patch("tensorflow.Session") | Return mocked :class:`tensorflow.Session`. | 625941df3c8af77a43ae3afb |
def Hlines(ys, x1, x2, **options): <NEW_LINE> <INDENT> options = _UnderrideColor(options) <NEW_LINE> options = _Underride(options, linewidth=1, alpha=0.5) <NEW_LINE> pyplot.hlines(ys, x1, x2, **options) | Plots a set of horizontal lines.
Args:
ys: sequence of y values
x1: sequence of x values
x2: sequence of x values
options: keyword args passed to pyplot.vlines | 625941df38b623060ff0b145 |
def _expected_device(requested_device): <NEW_LINE> <INDENT> prefix = b"/dev/sd" <NEW_LINE> if requested_device.startswith(prefix): <NEW_LINE> <INDENT> return FilePath(b"/dev").child(b"xvd" + requested_device[len(prefix):]) <NEW_LINE> <DEDENT> raise ValueError( "Unsupported requested device {!r}".format(requested_device... | Given a device we requested from AWS EBS, determine the OS device path that
will actually be created.
This maps EBS required ``/dev/sdX`` names to ``/dev/vbdX`` names that are
used by currently supported platforms (Ubuntu 14.04 and CentOS 7). | 625941df92d797404e3044e3 |
def __init__(self, value=0): <NEW_LINE> <INDENT> self.value = value | Create an immutable counter | 625941dfa219f33f34628cbd |
def getArtistByName(sp, artistName): <NEW_LINE> <INDENT> spotifyInfo = searchByArtistName(sp, artistName) <NEW_LINE> indexCount = 0 <NEW_LINE> for artistInfo in spotifyInfo["artists"]["items"]: <NEW_LINE> <INDENT> if artistInfo["name"].lower() == artistName.lower(): <NEW_LINE> <INDENT> return spotifyInfo["artists"]["it... | :param sp:
:param artistName:
:return: Spotify Artist Object | 625941df4428ac0f6e5bab4c |
def build(self): <NEW_LINE> <INDENT> if compat.PY2: <NEW_LINE> <INDENT> sort_args = {'cmp': locale.strcoll} <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> from functools import cmp_to_key <NEW_LINE> sort_args = {'key': cmp_to_key(locale.strcoll)} <NEW_LINE> <DEDENT> for path, dirnames, filenames in os.walk(self.basepath... | Build the list of directories with images | 625941dfa934411ee37519ec |
def dfs(board_code): <NEW_LINE> <INDENT> board = util.code_to_board(board_code) <NEW_LINE> if util.board_is_solved(board): <NEW_LINE> <INDENT> return util.board_to_code(board) <NEW_LINE> <DEDENT> return dfs_from_board(board) | Depth first search of board solutions, selecting branches with fewest possible guesses.
Parameters
----------
board_code : string
Board code listed from top left to bottom right.
Returns
-------
string
Board code for solved board.
Raises
------
UnsolvableBoardException
If the board does not have a solutio... | 625941dfc4546d3d9de72d8e |
def __create_chart(self, title: str, adapter: IMetricAdapter, figure: Figure , cont_key: int) -> Callable: <NEW_LINE> <INDENT> css_id: str = f"{TEXT['pane_css_prefix']}{ChartPaneLayout.pane_id()}" <NEW_LINE> layout: ChartPaneLayout = ChartPaneLayout( title=title, css_id=css_id, figure=figure ) <NEW_LINE> layout.configu... | Creates the chart layout and its controller, and returns a callable
to get the html representation. | 625941df31939e2706e4d1bd |
def MergeServiceList(base_list, new_list): <NEW_LINE> <INDENT> if new_list is None: <NEW_LINE> <INDENT> return base_list <NEW_LINE> <DEDENT> if isinstance(new_list, list): <NEW_LINE> <INDENT> for svc in new_list: <NEW_LINE> <INDENT> if not svc in base_list: <NEW_LINE> <INDENT> base_list.append(svc) <NEW_LINE> <DEDENT> ... | Merge new_list into base_list.
For each service in new_list (which is a dictionary),
if the value is True, add it to base_list.
If new_list is an array, simply add each item to
base_list; if it's a dict, we check the value. | 625941df55399d3f05588a0d |
def p_block_error(p): <NEW_LINE> <INDENT> p[0] = ast.SkipStmt(p.lineno(1)) | block : LBRACE block_begin stmt_list error block_end RBRACE | 625941df4f88993c3716c3bc |
def mapping_names(self): <NEW_LINE> <INDENT> return sorted([self.basename] + [name for selector in self.selections.normal_values() for name in selector.mapping_names()]) | Returns a list of mapping files associated with this Mapping | 625941df627d3e7fe0d691a9 |
def set_token(token): <NEW_LINE> <INDENT> with open("token.json", "w") as file: <NEW_LINE> <INDENT> file.write(json.dumps(token)) | :param token: token (dict)
:return: None | 625941df91f36d47f21ac84d |
def test_write_metadata(self, tmpdir, n_rows): <NEW_LINE> <INDENT> dtypes = {v: "int" for v in 'ABCD'} <NEW_LINE> self.base_write_metadata_test(tmpdir, n_rows, [dtypes]) | basic sanity check - test writing metadata | 625941df167d2b6e31218eed |
def create_energy_dic(input_log_names): <NEW_LINE> <INDENT> energy_dic = {} <NEW_LINE> for log in input_log_names: <NEW_LINE> <INDENT> with open(log, 'rb') as f: <NEW_LINE> <INDENT> log_txt = f.read() <NEW_LINE> <DEDENT> ZPE_abs = re.findall('Sum of electronic and zero-point Energies=\s+(-\d+\.\d+)', log_txt)[0] <NEW_L... | Returns dictionary with ZPE, enthalpy and gibbs energies of given
finished log files.
Dictionary has format: mol_name : (ZPE, H, G)
Energyies are in kcal/mol | 625941df32920d7e50b2852b |
def add_dependency_or(self, *keys): <NEW_LINE> <INDENT> self.__or_dependency_relations.append(list([key.lower() for key in keys])) <NEW_LINE> return self | Dependencies that exclude one another (only one given dependency can
exist as key/option in config for current key to work)
:param keys:
:return: | 625941df26068e7796caf03b |
def test_members(self): <NEW_LINE> <INDENT> self.auto_login() <NEW_LINE> cassette_name = self.cassette_name("members") <NEW_LINE> with self.recorder.use_cassette(cassette_name): <NEW_LINE> <INDENT> o = self.get_organization() <NEW_LINE> for member in o.members(): <NEW_LINE> <INDENT> assert isinstance(member, github3.us... | Test the ability to retrieve an organization's members. | 625941df8e05c05ec3eea6cf |
def set_Password(self, value): <NEW_LINE> <INDENT> super(AddBookmarkInputSet, self)._set_input('Password', value) | Set the value of the Password input for this Choreo. ((required, password) The password that corresponds to the specified Delicious account username.) | 625941dfa8370b7717052bf6 |
def bas_config_write(): <NEW_LINE> <INDENT> global bas_config_file <NEW_LINE> return weechat.config_write(bas_config_file) | Write configuration file. | 625941dfa05bb46b383ecb77 |
def find_region(sorted_region_list, index): <NEW_LINE> <INDENT> for r in sorted_region_list: <NEW_LINE> <INDENT> if r[0] > index: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if r[0] <= index and r[1] >= index: <NEW_LINE> <INDENT> return r <NEW_LINE> <DEDENT> <DEDENT> return None | Tests whether a list of (start, end) index pairs includes the given index in
one of the listed regions. Returns either the earliest-starting (and
earliest-ending, if there's a tie) region including the listed index, or
None. | 625941dfc4546d3d9de72d8f |
def convert_to_numeric(self, columns: Union[str, List[str]], errors: Optional[str] = 'coerce'): <NEW_LINE> <INDENT> if isinstance(columns, list): <NEW_LINE> <INDENT> assert all(i in self.data.columns for i in columns), KeyError( "One or more columns specified are not " "contained in the table.") <NEW_LINE> <DEDENT> els... | Converts specified column(s) to numeric. By default, coerces
all invalid records (ones which cannot be cast to numeric)
to np.NaN.
Parameters
----------
columns : str or list or 'all', optional.
The columns in which to do the replacement.
Default = 'all'.
errors : {'ignore', 'raise', 'coerce'}, optional
... | 625941df3346ee7daa2b30c6 |
def _get_available_index(target, config): <NEW_LINE> <INDENT> indices = _INDICES[target] <NEW_LINE> reg = _REG[target] <NEW_LINE> available = indices - set([int(''.join(x)) for x in reg.findall(config)]) <NEW_LINE> if len(available) > 0: <NEW_LINE> <INDENT> return sorted(available)[0] <NEW_LINE> <DEDENT> else: <NEW_LIN... | Gets an available index for specified target resource. | 625941dfdd821e528d63b4ff |
def create_nsr(nsd, input_param_list, cloud_account_name): <NEW_LINE> <INDENT> nsr = RwNsrYang.YangData_Nsr_NsInstanceConfig_Nsr() <NEW_LINE> nsr.id = str(uuid.uuid4()) <NEW_LINE> nsr.name = rift.auto.mano.resource_name(nsr.id) <NEW_LINE> nsr.short_name = "nsr_short_name" <NEW_LINE> nsr.description = "This is a descrip... | Create the NSR record object
Arguments:
nsd - NSD
input_param_list - list of input-parameter objects
cloud_account_name - name of cloud account
Return:
NSR object | 625941df15fb5d323cde0e6c |
def get_obj_id_from_path(*path: os.PathSpec) -> Iterator: <NEW_LINE> <INDENT> for entry in path: <NEW_LINE> <INDENT> entry = os.fspath(entry) <NEW_LINE> basename = os.path.basename(entry) <NEW_LINE> if basename: <NEW_LINE> <INDENT> hist = database.get_historian() <NEW_LINE> try: <NEW_LINE> <INDENT> yield hist.archive.c... | Given a path yield the id of the corresponding object. Yields None if not found. | 625941dfbe383301e01b57d8 |
def modify_user(self, usersId: str, user: dict): <NEW_LINE> <INDENT> return self.call("PUT", f"/perms/users/{usersId}", data=user) | Modify an existing user
``PUT /perms/users/{usersId}``
Args:
usersId (str)
user (dict): See Schema below
Returns:
dict: See Schema below
Raises:
OkapiRequestError: Bad Request
OkapiRequestNotFound: Not Found
OkapiFatalError: Server Error
OkapiRequestUnprocessableEntity: Unprocessable Ent... | 625941dffbf16365ca6f6522 |
def test_denglu(self): <NEW_LINE> <INDENT> driver = self.driver <NEW_LINE> driver.get("http://localhost/index.php?m=user&c=public&a=login") <NEW_LINE> driver.find_element_by_id("username").send_keys("testing") <NEW_LINE> driver.find_element_by_id("password").send_keys("testing123") <NEW_LINE> driver.find_element_by_cla... | 登录测试正常测试用例 | 625941df187af65679ca5478 |
def h_tubeside_laminar_Eubank_Proctor(Gz, Gr, Pr, D, L): <NEW_LINE> <INDENT> return 1.8*(Gz+12.6*(Gr*Pr*D/L)**0.4)**(1./3) | Coeficiente de transferencia de calor por calor sensible en el interior de tubos horizontales en regimen laminar
Eubank, D. C. and Proctor W. S. - Effect of natural convection on heat transfer with laminar flow in tubes, MS Thesis, Chemical Engineering Department, Massachusetts Institute of Technology, 1951. | 625941df3d592f4c4ed1d3be |
def execute(self, world): <NEW_LINE> <INDENT> return world.event_db_get(self.content) | RETURNS: EventDbEntry
The '.count' = 0 and '.last_time' = World.BEGIN_OF_TIME if the event
has not yet occurred. | 625941df283ffb24f3c55c56 |
def actions_get(context, uuid): <NEW_LINE> <INDENT> return IMPL.actions_get(context, uuid) | Get all instance actions for the provided instance. | 625941df596a897236089e15 |
def __init__(self): <NEW_LINE> <INDENT> pass | Not much of an object... | 625941df99fddb7c1c9de6e8 |
def getLovedTracks(self, user=None, limit=None, page=None): <NEW_LINE> <INDENT> user = self._getUsername(user) <NEW_LINE> xml = self.conn._api_get_request(user=user, method="user.getLovedTracks") <NEW_LINE> return self.conn.create_objects(xml, Track) | Get the last 50 tracks loved by a user. Authentication not required.
@param user: (Optional) A string of the user to fetch results for,
a L{User} object or None for user of the current session
@param limit: (Optional) An integer used to limit the number of tracks
returned per page. The default is 50.
@param page: (Opti... | 625941df5e10d32532c5f27e |
def read_true_false_file(file_name): <NEW_LINE> <INDENT> parser = {'TRUE': True, 'FALSE': False} <NEW_LINE> out = [] <NEW_LINE> with open(file_name) as in_file: <NEW_LINE> <INDENT> for line in in_file.readlines(): <NEW_LINE> <INDENT> out.append(parser[line[:-1].upper()]) <NEW_LINE> <DEDENT> <DEDENT> return np.array(out... | Reads file with values True or False into a boolean numpy array.
To save such a file, just use:
np.savetxt(FILE_NAME, BOOL_ARRAY, fmt='%r') | 625941dfe5267d203edcdff1 |
def createWorkBeach(self): <NEW_LINE> <INDENT> pass | :return true or false: | 625941dffff4ab517eb2f796 |
def __init__(self, description=None, isolation_network_domain_cidr=None, isolation_network_domain_id=None, tags=None, fabric_network_ids=None, custom_properties=None, region_id=None, security_group_ids=None, name=None, isolation_external_fabric_network_id=None, isolation_type=None, isolated_network_cidr_prefix=None, lo... | NetworkProfileSpecification - a model defined in Swagger | 625941df6aa9bd52df0370fe |
def random_element(self): <NEW_LINE> <INDENT> from sage.misc.prandom import randint <NEW_LINE> result = self.one() <NEW_LINE> for g in self.gens(): <NEW_LINE> <INDENT> order = g.order() <NEW_LINE> if order not in ZZ: <NEW_LINE> <INDENT> order = 42 <NEW_LINE> <DEDENT> result *= g**(randint(0,order)) <NEW_LINE> <DEDENT> ... | Return a random element of this group.
EXAMPLES::
sage: G = AbelianGroup([2,3,9])
sage: G.random_element().parent() is G
True | 625941dff8510a7c17cf9a57 |
def __ne__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, IETotalsByCandidate): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return self.to_dict() != other.to_dict() | Returns true if both objects are not equal | 625941dff548e778e58cd8d8 |
def sub_account_router_delete_with_http_info(self, x_account_api_key, sub_account_id, **kwargs): <NEW_LINE> <INDENT> all_params = ['x_account_api_key', 'sub_account_id'] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW... | sub_account_router_delete # noqa: E501
Delete SubAccount # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.sub_account_router_delete_with_http_info(x_account_api_key, sub_account_id, async_req=True)
>>> result = thr... | 625941df56ac1b37e6264522 |
def test_5_remove_voyage_plan_subscription(self): <NEW_LINE> <INDENT> query_string = [('callbackEndpoint', callbackEndpoint), ('uvid', voyageuvid)] <NEW_LINE> response = self.client.open('/voyagePlans/subscription', method='DELETE', query_string=query_string) <NEW_LINE> self.assert200(response, "Response body is : " + ... | Test case for remove_voyage_plan_subscription | 625941df0a50d4780f6671ee |
def test_detach_with_nonexistent_database_results_in_404(self): <NEW_LINE> <INDENT> params = self.params <NEW_LINE> params['action'] = "database-detach-forest" <NEW_LINE> params['database-name'] = "knives" <NEW_LINE> response, body = self.booster.request(params) <NEW_LINE> err = response.get("x-booster-error", "none") ... | A forest detach to a non-existent db should result in a 404 | 625941df56ac1b37e6264523 |
def resnet_scene_segmentation_head(config, inputs, F, base_fdim, is_training, init='xavier', weight_decay=0, activation_fn='relu', bn=True, bn_momentum=0.98, bn_eps=1e-3): <NEW_LINE> <INDENT> with tf.variable_scope('resnet_scene_segmentation_head') as sc: <NEW_LINE> <INDENT> fdim = base_fdim <NEW_LINE> features = F[-1]... | A head for scene segmentation with resnet backbone.
Args:
config: config file
inputs: a dict contains all inputs
F: all stage features
base_fdim: the base feature dim
is_training: True indicates training phase
init: weight initialization method
weight_decay: If > 0, add L2Loss weight decay ... | 625941df7cff6e4e81117cde |
def openPlot(self, index): <NEW_LINE> <INDENT> item=self.model().itemFromIndex(index) <NEW_LINE> if item.data() is not None: <NEW_LINE> <INDENT> item.data().openPlot() | Responds to double click to open plot.
Parameters
----------
index : QStandardItemIndex
Index of plot item in tree. | 625941df60cbc95b062c689c |
def parse_xml(self, body, url=None): <NEW_LINE> <INDENT> return self._parse(XmlXPathExtractor(body), {'url': url}) | Force `etree.XMLParser`. | 625941dfd4950a0f3b08c6a3 |
def _getDZDt1Dt2(self, time1, time2): <NEW_LINE> <INDENT> a = self.theta[1] <NEW_LINE> b = self.theta[2] <NEW_LINE> firstSummand = b / self._getZNorm(time1, time2) <NEW_LINE> secondSummand = -b**2*time2**2/( self._getZNorm(time1, time2)*(a + b*time2**2 + 1)) <NEW_LINE> thirdSummand = -b*time1/(a + b*time1**2 + 1) * ... | second order derivative of Z w.r.t. time1 and time2 | 625941dfb57a9660fec33be1 |
def needs_schema(type_): <NEW_LINE> <INDENT> return is_attrs(type_) or ( _is_from_typing_module(type_) and is_attrs(_obtain_referred_type(type_)) ) | Helper function to ensure that the given attribute (type_) needs a strict yaml schema | 625941df63b5f9789fde743f |
def simulate( infiniStep, inival, interval=[0, 1], Nts=100) : <NEW_LINE> <INDENT> t0, te = interval[0], interval[1] <NEW_LINE> h = 1./Nts*(te-t0) <NEW_LINE> N = inival.size <NEW_LINE> sollist = [inival.reshape((1, N))] <NEW_LINE> tlist = [t0] <NEW_LINE> xk = inival <NEW_LINE> for k in range(1, Nts+1): <NEW_LINE> <INDEN... | Run simulation / Finite time integrator | 625941dff7d966606f6aa361 |
def forms(self): <NEW_LINE> <INDENT> return self.__request('forms') | Returns a list of forms in an account. The response includes all of the
information returned by the form method, with the exception of
information about each form field and the HTML or JavaScript required to
display the form. | 625941dffb3f5b602dac39f0 |
def forwards(self, orm): <NEW_LINE> <INDENT> db.start_transaction() <NEW_LINE> self.set_foreign_key_checks(False) <NEW_LINE> for ci_type_id in db.execute( 'SELECT id FROM cmdb_citype WHERE id > 10;' ): <NEW_LINE> <INDENT> old_id = ci_type_id[0] <NEW_LINE> new_id = old_id + 1000 <NEW_LINE> self.change_id('cmdb_cilayer_c... | Migration moves ci_types ids added by the user. Migration reserves
ids from 1 to 1000 ci_type for added by fixtures. | 625941dfbaa26c4b54cb1475 |
def __init__(self, G0, phen, delta=None, cov=None, REML=False, G1=None, mixing=0.0): <NEW_LINE> <INDENT> self.REML = REML <NEW_LINE> self.G0 = G0 <NEW_LINE> self.test_snps = G0 <NEW_LINE> self.phen = phen <NEW_LINE> if delta is None: <NEW_LINE> <INDENT> self.delta=None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self... | set up GWAS object | 625941df1b99ca400220ae0b |
def set_ObjectID(self, value): <NEW_LINE> <INDENT> super(UnlikeInputSet, self)._set_input('ObjectID', value) | Set the value of the ObjectID input for this Choreo. ((required, string) The id of a graph api object to unlike.) | 625941df377c676e91272500 |
def normvec(vector): <NEW_LINE> <INDENT> return vector / np.linalg.norm(vector) | Returns the unit vector of the vector. | 625941dfd6c5a102081443a6 |
def deploy(): <NEW_LINE> <INDENT> clear_compiled_python_files() <NEW_LINE> git_pull() <NEW_LINE> update_requirements() <NEW_LINE> run_migrations() <NEW_LINE> collectstatic() <NEW_LINE> reload_http() | deploys code to the given role; migrates, loads initial data, installs requirements & restarts, CANNOT RUN LOCALLY | 625941df44b2445a339323ed |
def reset(self): <NEW_LINE> <INDENT> if self.telnet: <NEW_LINE> <INDENT> self.telnet.set("/fdm/jsbsim/simulation/reset", ) | Resume simulation | 625941df45492302aab5e620 |
@pytest.fixture <NEW_LINE> def s3cmd_client(ctrl_remote): <NEW_LINE> <INDENT> return os_cli.S3CMD(ctrl_remote) | Client to s3cmd tool | 625941dfe1aae11d1e74a013 |
def add_url(self, url, timeout=0, package="", options="", priority=1, custom="", machine="", platform="", tags=None, memory=False, enforce_timeout=False, clock=None): <NEW_LINE> <INDENT> if not timeout: <NEW_LINE> <INDENT> timeout = 0 <NEW_LINE> <DEDENT> if not priority: <NEW_LINE> <INDENT> priority = 1 <NEW_LINE> <DED... | Add a task to database from url.
@param url: url.
@param timeout: selected timeout.
@param options: analysis options.
@param priority: analysis priority.
@param custom: custom options.
@param machine: selected machine.
@param platform: platform.
@param tags: tags for machine selection
@param memory: toggle full memory ... | 625941dfb5575c28eb68e35c |
@csrf_exempt <NEW_LINE> @login_required <NEW_LINE> def show_coupons(request): <NEW_LINE> <INDENT> r = {} <NEW_LINE> u = request.user <NEW_LINE> offer_loc = WesabeLocation.objects.get(id=request.POST['loc_id']) <NEW_LINE> coupons = Coupon.objects.filter(location=offer_loc) <NEW_LINE> r["result"] = [c.get_json() for c in... | Shows coupons for certain location
:url: /wesabe/coupons/
:param POST['loc_id']: WesabeLocation ID
:param POST['lat']: latitude
:param POST['lon']: longitude
:rtype: JSON
::
# if no coupons
{'result':[]}
# else
{
"result": [
{
"location": {
"id": "6",
... | 625941df4e4d5625662d472d |
def test_instance(self): <NEW_LINE> <INDENT> self.assertTrue(isinstance(self.test_image, Image)) | test method to ensure image instance creation | 625941df38b623060ff0b146 |
def manifest_item(self, url, mediatype, id_=None): <NEW_LINE> <INDENT> if id_ is None or xpath(self.manifest, "//*[@id = '%s']" % id_): <NEW_LINE> <INDENT> self.item_id += 1 <NEW_LINE> id_ = 'item%d' % self.item_id <NEW_LINE> <DEDENT> self.manifest.append( self.opf.item(**{ 'href': url, 'id': id_, 'media-type': mediaty... | Add item to manifest. | 625941df07d97122c4178bec |
def run(configurator, **kwargs): <NEW_LINE> <INDENT> global indent, printer <NEW_LINE> printer = configurator.setup() <NEW_LINE> global data <NEW_LINE> data = configurator.get_variable() <NEW_LINE> usearg = configurator.arg('use') <NEW_LINE> if not usearg: <NEW_LINE> <INDENT> use = 'cart_meas' <NEW_LINE> <DEDENT> else:... | Main interface function called by the plugin manager.
The 'use' argument specifies which ADP contribution
should be tested. The options are: 'cart_int', 'cart_ext'
, 'cart_sum' 'cart_meas'.
The 'tex' argument specifies whether a latex format
table should be written to 'hirshfeld_'use'.tex'.
The 'full' argument speci... | 625941dfac7a0e7691ed441f |
def test_repeat_apply_iterator_transform(): <NEW_LINE> <INDENT> reader = LocalReader('tests/fixtures/local_reader_test') <NEW_LINE> transform = RecordsTransform(reader, [ ('copy', 'id', 'header.identifier._text'), ('copy', 'set', 'header.setSpec._text'), ('copy', 'title', ['metadata', '{http://www.openarchives.org/OAI/... | Test that the repeat iteration transform works. | 625941df498bea3a759b9e07 |
def determine_role(self, players): <NEW_LINE> <INDENT> self.shuffle() <NEW_LINE> self.deal_cards(players) <NEW_LINE> players[0].role = 'landlord' <NEW_LINE> self.landlord = players[0] <NEW_LINE> players[1].role = 'peasant' <NEW_LINE> players[2].role = 'peasant' <NEW_LINE> self.landlord.current_hand.extend(self.deck[-1:... | Determine landlord and peasants according to players' hand
Args:
players (list): list of DoudizhuPlayer objects
Returns:
int: landlord's player_id | 625941df8a43f66fc4b543bb |
def setUp(self): <NEW_LINE> <INDENT> self.dialog = CSIROMarineValuesDialog(None) | Runs before each test. | 625941df596a897236089e16 |
def SetInput1(self, *args): <NEW_LINE> <INDENT> return _itkCompose2DCovariantVectorImageFilterPython.itkCompose2DCovariantVectorImageFilterIF2ICVF22_Superclass_SetInput1(self, *args) | SetInput1(self, itkImageF2 image1) | 625941df23849d37ff7b33e6 |
def multi_process(x): <NEW_LINE> <INDENT> image = get_image() <NEW_LINE> images = handle_split_image(image) <NEW_LINE> image.save( "modeltest/"+_predict_image(images) + '.png') <NEW_LINE> print("ok") | 获取预测并保存图片,图片名为预测值 | 625941dfff9c53063f47c54b |
def pcap_3d_one_scan(source: client.PacketSource, metadata: client.SensorInfo, num: int = 0) -> None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import open3d as o3d <NEW_LINE> <DEDENT> except ModuleNotFoundError: <NEW_LINE> <INDENT> print( "This example requires open3d, which may not be available on all " "platforms... | Render one scan from a pcap file in the Open3D viewer.
Args:
source: PacketSource from pcap
metadata: associated SensorInfo for PacketSource
num: scan number in a given pcap file (satrs from *0*) | 625941df8c3a873295158717 |
def boolean_sparse(a, b, operation=np.logical_and): <NEW_LINE> <INDENT> import sparse <NEW_LINE> extrema = np.array([a.min(axis=0), a.max(axis=0), b.min(axis=0), b.max(axis=0)]) <NEW_LINE> origin = extrema.min(axis=0) - 1 <NEW_LINE> size = tuple(extrema.ptp(axis=0) + 2) <NEW_LINE> sp_a = sparse.COO((a - origin).T, data... | Find common rows between two arrays very quickly
using 3D boolean sparse matrices.
Parameters
-----------
a: (n, d) int, coordinates in space
b: (m, d) int, coordinates in space
operation: numpy operation function, ie:
np.logical_and
np.logical_or
Returns
-----------
coords: (q, d) int, ... | 625941df3eb6a72ae02ec83f |
def loadData(): <NEW_LINE> <INDENT> datfile = glob.glob(DATA_PATH + 'consolidated.npy') <NEW_LINE> return np.load(datfile[0]) | Loads data from consolidated array, assumes only one consolidated file is in the directory! | 625941dfd99f1b3c44c678e3 |
def test_simple_cubic(self): <NEW_LINE> <INDENT> self.atomcoords={'Mn1':np.array([0.0,0.0,0.0]), 'O1': np.array([0.25, 0.25, 0.25])} <NEW_LINE> self.orthom = np.array([[4.5, 0.0, 0.0],[0.0, 4.5, 0.0],[0.0, 0.0, 4.5]]) <NEW_LINE> self.atomtypes = {'Mn1':'Mn', 'O1':'O'} <NEW_LINE> correctligands = {'O1': np.array([0.25, ... | Find one ligand in simple cubic cell. | 625941df851cf427c661a865 |
def __call__(self, a, b): <NEW_LINE> <INDENT> perc_a = self.antifp_scores[a.getSMILES()] <NEW_LINE> perc_b = self.antifp_scores[b.getSMILES()] <NEW_LINE> minimum = min(perc_a, perc_b, self.minimum_common_bits_perc) <NEW_LINE> maximum = max(perc_a, perc_b, self.minimum_common_bits_perc) <NEW_LINE> if minimum < self.mini... | Overrides the abstract method in the base class.
Compares two morphs according to the percentage
of bits that they have in common with the
anti-fingerprint.
:param a: morph on the left side of the comparison
:param b: morph on the right side of the comparison
:return: `True` if morph on the right side is less similar ... | 625941df435de62698dfdfa6 |
def _compute_step_vector(self, g: tf.Tensor, H_inv_g: tf.Tensor) -> tf.Tensor: <NEW_LINE> <INDENT> g_H_inv_g = tf.reduce_sum(g * H_inv_g) <NEW_LINE> lm = tf.sqrt(g_H_inv_g / (2 * self.max_kl)) <NEW_LINE> step = H_inv_g / lm <NEW_LINE> return step | Compute the step vector given by the Natural Policy Gradient
Args:
g: tf.Tensor, shape [None]. Contains the policy gradient g
H_inv_g: tf.Tensor, shape [None]. Contains the product H^-1 g
Returns:
tf.Tensor, shape [None]. Contains the full NPG step | 625941dfcc0a2c11143dd1ea |
def message_subscribers(self, *args, **kwargs): <NEW_LINE> <INDENT> return _noaa_swig.hrpt_deframer_sptr_message_subscribers(self, *args, **kwargs) | message_subscribers(hrpt_deframer_sptr self, swig_int_ptr which_port) -> swig_int_ptr | 625941df8e71fb1e9831db01 |
def make_postactivate_file(site_url, file_path=None): <NEW_LINE> <INDENT> if file_path is None: <NEW_LINE> <INDENT> file_path = '%s/postactivate.%s' % (path.dirname(__file__), site_url) <NEW_LINE> <DEDENT> contents, settings = make_postactivate_text(site_url) <NEW_LINE> with open(file_path, 'w') as f: <NEW_LINE> <INDEN... | Make a postactivate file and return settings as a dictionary. | 625941df10dbd63aa1bd2efc |
def test_create_slices(): <NEW_LINE> <INDENT> assert_true(create_slices(0, 0) == []) <NEW_LINE> assert_true(len(create_slices(0, 100)) == 100) <NEW_LINE> assert_true(len(create_slices(50, 100)) == 50) <NEW_LINE> assert_true(len(create_slices(0, 100, length=2)) == 50) <NEW_LINE> assert_true(len(create_slices(0, 100, ste... | Test checking the create of time create_slices. | 625941df3346ee7daa2b30c7 |
def insert(PatientInfo, SensorData): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> PatientInfo = json.loads(PatientInfo) <NEW_LINE> SensorData = json.loads(SensorData) <NEW_LINE> dict = {} <NEW_LINE> for id in PatientInfo: <NEW_LINE> <INDENT> dict['PatientID'] = id <NEW_LINE> for k, v in PatientInfo[id].items(): <NEW_LI... | this function will receive the json information returned by getPatientInfo() and readSensorData()
in input.py from input module and insert them as a whole table into database. | 625941dfcc0a2c11143dd1eb |
def test_auto_close(self): <NEW_LINE> <INDENT> r = UploadRequest(self.conn, 'test_zip_key.zip', self.dummy_data, 'bucket', close=True) <NEW_LINE> mock = self._mock_adapter(r) <NEW_LINE> expected_headers = { 'x-amz-acl': 'public-read', 'Content-Type': 'application/zip', } <NEW_LINE> mock.should_receive('put').with_args(... | Test auto closing of the stream automatically | 625941dfb545ff76a891416f |
def prepare_screens(): <NEW_LINE> <INDENT> global prepared <NEW_LINE> if prepared: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> predict_cache.clear() <NEW_LINE> old_predicting = renpy.display.predict.predicting <NEW_LINE> renpy.display.predict.predicting = True <NEW_LINE> try: <NEW_LINE> <INDENT> if not analyzed: <NE... | Prepares all screens for use. | 625941df5510c4643540f736 |
def pathSum(self, root, sum): <NEW_LINE> <INDENT> self.res = [] <NEW_LINE> path = [] <NEW_LINE> self.travel(path,root,sum) <NEW_LINE> print(self.res) <NEW_LINE> return self.res | :type root: TreeNode
:type sum: int
:rtype: List[List[int]] | 625941df656771135c3ebbcc |
def population_analysis(file='simulations/PopulationInfectionReport.json'): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open(file) as reportfile: <NEW_LINE> <INDENT> report=json.loads(reportfile.read()) <NEW_LINE> <DEDENT> <DEDENT> except IOError as e: <NEW_LINE> <INDENT> sys.exit(e) <NEW_LINE> <DEDENT> firstday=... | Analysis of the PopulationInfectionReport output | 625941df925a0f43d254a1d3 |
def correlation_categories(data_retina): <NEW_LINE> <INDENT> stim_categories = {'white': 3, 'fullfield': 0, 'multiscale': 1, 'spatexp': 2, 'spattempexp': 2, 'tempexp': 4, 'natmov': 1, 'scramnat': 3, 'lowcont_white': 3, 'lowcont_multiscale': 1} <NEW_LINE> stim = data_retina['stimTimes'][0, 0] <NEW_LINE> categories_stim ... | assign numerical values to stimuli based on correlation category as per variable stim_categories | 625941df24f1403a92600ebd |
def upload_files_in_folder(self, arg, dirname, fnames): <NEW_LINE> <INDENT> if not self.consider(dirname): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> for fname in (nm for nm in fnames if self.consider(nm)): <NEW_LINE> <INDENT> if self.client._should_abort_folder_upload(self.upload_key): <NEW_LINE> <INDENT> re... | Handles the iteration across files within a folder. | 625941df50812a4eaa59c678 |
def import_convert_pixelize(image_path): <NEW_LINE> <INDENT> img = cv2.imread(image_path) <NEW_LINE> img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) <NEW_LINE> img_HSV = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) <NEW_LINE> plt.imshow(img_rgb); <NEW_LINE> pixels = np.float32(img_HSV.reshape(-1, 3)) <NEW_LINE> return pixels | imports image, shows the image and transforms into pixels
Parameters
----------
image_path : srt
location of image
Returns
-------
pixels : array
single dimention array of pixel images. | 625941df30c21e258bdfa7f9 |
def testWifiNotificationRSN_Belkin_G_wrongpassword(self): <NEW_LINE> <INDENT> self._WifiNotification('Belkin_G', WifiNotification.password1) | wifi disconnect notification for Belkin_G (rsn)-wrong password | 625941dff7d966606f6aa362 |
def docstring_temp(a, b, c): <NEW_LINE> <INDENT> print (c, (a + b) * 0.5 ) | Given two numbers a and b, return their average value.
Arguments
----------
a (number): default = 0
A number
b (number):
Another number
c (str):
a string
Returns
-------
res (number):
The average of a and b, computed using 0.5*(a + b)
Exceptions
-------
TypeError: if a or b is not a number; c is no... | 625941df627d3e7fe0d691ab |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.