code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def mkdir_p(path): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.makedirs(path) <NEW_LINE> <DEDENT> except OSError as exc: <NEW_LINE> <INDENT> if exc.errno == errno.EEXIST and os.path.isdir(path): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise | mkdir -p
http://stackoverflow.com/a/600612/127816 | 625941db31939e2706e4d135 |
def __init__(self): <NEW_LINE> <INDENT> self.discriminator = None | XmlNs0ActivityType - a model defined in Swagger | 625941db0a50d4780f667163 |
def decodeSignatureInfoAndValue(self, signatureInfo, signatureValue): <NEW_LINE> <INDENT> raise RuntimeError("decodeSignatureInfoAndValue is not implemented") | Decode signatureInfo as a signature info and signatureValue as the
related SignatureValue, and return a new object which is a subclass of
Signature. Your derived class should override.
:param signatureInfo: The array with the signature info input buffer to
decode.
:type signatureInfo: An array type with int elements... | 625941dba17c0f6771cbe31e |
def test_get_appeal_hearing(self): <NEW_LINE> <INDENT> response = li.get_appeal_hearing('5') <NEW_LINE> self.assertEqual(type(response['results']), dict) <NEW_LINE> self.assertTrue('appeal_hearing_id' in response['results'].keys()) | Returns details for a single appeal hearing
| 625941dbbe383301e01b5750 |
def check_nested_dirs( run_dir: Path, install_dir: Optional[Path] = None ) -> None: <NEW_LINE> <INDENT> if install_dir is not None: <NEW_LINE> <INDENT> install_dir = Path(os.path.normpath(install_dir)) <NEW_LINE> <DEDENT> for parent_dir in run_dir.parents: <NEW_LINE> <INDENT> if parent_dir == Path(get_cylc_run_dir()): ... | Disallow nested dirs:
- Nested installed run dirs
- Nested installed workflow dirs
Args:
run_dir: Absolute workflow run directory path.
install_dir: Absolute workflow install directory path
(contains _cylc-install). If None, will not check for nested
install dirs.
Raises:
WorkflowFilesErr... | 625941db15baa723493c4246 |
def all_templates(self): <NEW_LINE> <INDENT> self.details.get_section('Relationships').click_item('Templates') <NEW_LINE> self._wait_for_results_refresh() <NEW_LINE> return VirtualMachines(self.testsetup) | Templates list
Returns Infrastructure.VirtualMachines pages | 625941dbd6c5a1020814431b |
def chunks(li, chunk_size): <NEW_LINE> <INDENT> if len(li) < 1 or chunk_size < 1: <NEW_LINE> <INDENT> return li <NEW_LINE> <DEDENT> chunk_size = int(chunk_size) <NEW_LINE> for i in range(0, len(li), chunk_size): <NEW_LINE> <INDENT> yield li[i: i + chunk_size] | list를 chunk_size로 잘라서 반환한다.
Return:
yield | 625941dba219f33f34628c35 |
def log_percent(self): <NEW_LINE> <INDENT> submitted = len(self.tasks) <NEW_LINE> queued = len(self.task_queue) <NEW_LINE> total = submitted + queued <NEW_LINE> done = submitted - self.todo <NEW_LINE> percent = int(float(done) / total * 100) <NEW_LINE> if not hasattr(self, 'prev_percent'): <NEW_LINE> <INDENT> self.prev... | Log the progress of the computation in percentage | 625941db85dfad0860c3b12a |
def find_objects(self, mql_result_filename, json_filename, result_file, stylesheet_name = props.ro_stylesheet, handler_type = ContextHandlerType.level, context_level = 0, context_mark = props.context_mark_keyword): <NEW_LINE> <INDENT> if handler_type == ContextHandlerType.level: <NEW_LINE> <INDENT> handler = ContextLev... | Find context objects for mql result.
As a default a ContextLevelHandler is used for parsing the result.
At what level in the hierarchy of a result a particular straw is treated as context
can be set with the parameter context_level.
Alternatively a ContextMarksHandler can be used. A matched_object marked ... | 625941db2eb69b55b151cb81 |
def get(self, identity): <NEW_LINE> <INDENT> t = type(identity) <NEW_LINE> if issubclass(t, (list, tuple, set, frozenset)): <NEW_LINE> <INDENT> matches = self.match().where("id(_) in %s" % cypher_repr(list(identity))) <NEW_LINE> return t(matches) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.match().where("... | Create a new :class:`.NodeMatch` that filters by identity
and returns the first matched :class:`.Node`. This can be used
to match and return a :class:`.Node` by ID.
>>> matches.get(1234)
Node('Person', name='Alice')
If no such :class:`.Node` is found, :py:const:`None` is
returned instead. Contrast with ``matc... | 625941db3317a56b86939f21 |
def cancel(self): <NEW_LINE> <INDENT> if self.alg and self.alg.isRunning(): <NEW_LINE> <INDENT> self.alg.cancel() <NEW_LINE> self.signals.finished.emit(self, 1, "Processing cancelled") | Cancel the algorithm. This function first tests if the algorithm is
currently running. It avoids emitting error signal for cancelling non
running ones. | 625941db23e79379d52ee82f |
def chamfer_distance_np_var_len(arrays): <NEW_LINE> <INDENT> x, y = arrays <NEW_LINE> x_nn = NearestNeighbors(n_neighbors=1, leaf_size=1, algorithm='kd_tree', metric='l2').fit(x) <NEW_LINE> min_y_to_x = x_nn.kneighbors(y)[0] <NEW_LINE> y_nn = NearestNeighbors(n_neighbors=1, leaf_size=1, algorithm='kd_tree', metric='l2'... | Chamfer distance in numpy supporting arrays with different lengths.
Args:
arrays:
Returns: | 625941db7b180e01f3dc4ac7 |
@pytest.fixture(scope="session", autouse=True) <NEW_LINE> def host(request): <NEW_LINE> <INDENT> os.environ["host"] = request.config.getoption("--cmdhost") <NEW_LINE> print("当前用例运行测试环境:%s" % os.environ["host"]) | 获取命令行参数 | 625941db460517430c39444e |
def is_function_attached(): <NEW_LINE> <INDENT> func = get_lambda_arn() <NEW_LINE> profile = get_env_var(_PROFILE) <NEW_LINE> session = boto3.Session(profile_name=profile) <NEW_LINE> cf_client = session.client('cloudfront', 'us-east-1') <NEW_LINE> config = cf_client.get_distribution_config( Id=get_env_var(_CFDIST) ) <N... | Is the function attached to the distribution? | 625941dbcad5886f8bd272a7 |
def ChronoSplit(self, ratio = .75, filter_by = 'user', col_user = 'UserId', col_item = 'ItemId', col_timestamp = 'Timestamp'): <NEW_LINE> <INDENT> split_by_column = col_user if filter_by == "user" else col_item <NEW_LINE> rating_grouped = self.groupBy(split_by_column).agg({col_timestamp: 'count'}) <NEW_LINE> window_spe... | Chronological Splitter - split data (items are ordered by timestamps for each customer) by
timestamps.
Args:
ratio (float): Ratio for splitting data.
It splits data into two halfs and the ratio argument indicates the ratio of training data set;
filter_by (str): either "user" or "item", dependin... | 625941dbac7a0e7691ed4396 |
def duo(xlsx_nam, data_xlsx): <NEW_LINE> <INDENT> xlsx_nam = xlsx_nam + '班' <NEW_LINE> wb = Workbook() <NEW_LINE> thin_border = Border(left=Side(style='thin'), right=Side(style='thin'), top=Side(style='thin'), bottom=Side(style='thin')) <NEW_LINE> ws = wb.create_sheet(xlsx_nam) <NEW_LINE> ws.page_setup.orientation = ws... | 重复部分. | 625941dbd4950a0f3b08c61a |
def remove_task(self, node_id, path): <NEW_LINE> <INDENT> it = self.my_get_iter(path) <NEW_LINE> if not it: <NEW_LINE> <INDENT> raise Exception( "Trying to remove node %s with no iterator" % node_id) <NEW_LINE> <DEDENT> actual_node_id = self.get_value(it, 0) <NEW_LINE> assert actual_node_id == node_id <NEW_LINE> self.r... | Remove instance of node.
@param node_id: identification of task
@param path: identification of position | 625941dbeab8aa0e5d26de27 |
def json(self, dict=False, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> graph = self.graph <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> return _netjson_networkgraph(self.protocol, self.version, self.revision, self.metric, graph.nodes(), graph.... | Outputs NetJSON format | 625941db4a966d76dd5512e0 |
def check_var_units(self, ds): <NEW_LINE> <INDENT> results = [] <NEW_LINE> for variable in self.get_applicable_variables(ds): <NEW_LINE> <INDENT> msgs = [] <NEW_LINE> unit_check = hasattr(ds.variables[variable], 'units') <NEW_LINE> no_dim_check = (getattr(ds.variables[variable], 'dimensions') == tuple()) <NEW_LINE> if ... | Checks each applicable variable for the units attribute
:param netCDF4.Dataset ds: An open netCDF dataset | 625941db1d351010ab855dea |
def testBrokenDt(self): <NEW_LINE> <INDENT> with self.assertRaises(Exception) as e: <NEW_LINE> <INDENT> self._RunBinman('-d', self.TestFile('01_invalid.dts')) <NEW_LINE> <DEDENT> self.assertIn("FATAL ERROR: Unable to parse input tree", str(e.exception)) | Test that an invalid device-tree source file generates an error
Since this is a source file it should be compiled and the error
will come from the device-tree compiler (dtc). | 625941db236d856c2ad44aac |
def test_backend_update_digital_pin_requires_pin_mode() -> None: <NEW_LINE> <INDENT> pin = 2 <NEW_LINE> backend = make_backend() <NEW_LINE> backend._digital_pins[pin].mode = GPIOPinMode.ANALOGUE_INPUT <NEW_LINE> with pytest.raises(RuntimeError): <NEW_LINE> <INDENT> backend._update_digital_pin(pin) | Test that analogue pin modes are invalid for _update_digital_pin. | 625941dbe8904600ed9f21ff |
@pytest.fixture(autouse=True) <NEW_LINE> def add_libraries(doctest_namespace): <NEW_LINE> <INDENT> doctest_namespace["os"] = os <NEW_LINE> doctest_namespace["sys"] = sys <NEW_LINE> doctest_namespace["np"] = numpy <NEW_LINE> doctest_namespace["pd"] = pandas <NEW_LINE> doctest_namespace["subprocess"] = subprocess <NEW_LI... | Definition of doctest namespace
See `more information <https://docs.pytest.org/en/latest/doctest.html#the-doctest-namespace-fixture>` | 625941db6aa9bd52df037074 |
def test_upload_with_manual_post_request(self): <NEW_LINE> <INDENT> with open(self.client_path+'/'+self.filename, "rb") as f: <NEW_LINE> <INDENT> file = f <NEW_LINE> files = {'file': file} <NEW_LINE> r = requests.post(self.url+'upload/', files=files) <NEW_LINE> <DEDENT> assert r.status_code == 200 <NEW_LINE> assert sel... | Tests whether a file can be manually uploaded to the server. | 625941db57b8e32f5248376b |
def _team_and_opp(struct, curTm=None, curOpp=None): <NEW_LINE> <INDENT> if pd.isnull(curTm): <NEW_LINE> <INDENT> if struct['isRun']: <NEW_LINE> <INDENT> pID = struct['rusher'] <NEW_LINE> <DEDENT> elif struct['isPass']: <NEW_LINE> <INDENT> pID = struct['passer'] <NEW_LINE> <DEDENT> elif struct['isFieldGoal']: <NEW_LINE>... | Given a dict representing a play and the current team with the ball,
returns (team, opp) where team is the team with the ball and opp is the
team without the ball at the end of the play.
:struct: A Series/dict representing the play.
:curTm: The current team with the ball; None means it's the first play of
the game or ... | 625941db3c8af77a43ae3a71 |
def v2_runner_on_failed(self, result, ignore_errors=False, **kwargs): <NEW_LINE> <INDENT> host = result._host <NEW_LINE> if ignore_errors: <NEW_LINE> <INDENT> status = "ignoring" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> status = 'failed' <NEW_LINE> <DEDENT> self._write_to_save({ "host": host.name, "result": result... | 处理执行失败的任务,有些任务失败会被忽略,所有有两种状态 | 625941db66673b3332b92360 |
def pprint_subclasses(self, vnclass, indent=''): <NEW_LINE> <INDENT> if isinstance(vnclass, basestring): <NEW_LINE> <INDENT> vnclass = self.vnclass(vnclass) <NEW_LINE> <DEDENT> subclasses = [subclass.get('ID') for subclass in vnclass.findall('SUBCLASSES/VNSUBCLASS')] <NEW_LINE> if not subclasses: subclasses = ['(none)'... | Return a string containing a pretty-printed representation of
the given verbnet class's subclasses.
:param vnclass: A verbnet class identifier; or an ElementTree
containing the xml contents of a verbnet class. | 625941db498bea3a759b9d7e |
def backups(self): <NEW_LINE> <INDENT> return self._list(_backup.Backup, paginated=False) | List all backups
:returns: A generator of backup object
:rtype: :class:`~openstack.rds.v1.backup.Backup | 625941dba4f1c619b28b0303 |
def testInternalArray(self): <NEW_LINE> <INDENT> def test(): <NEW_LINE> <INDENT> object = Test.InternalArrayTest() <NEW_LINE> items = object.items <NEW_LINE> <DEDENT> self.assertRaises(AttributeError, test) | Test internal arrays. | 625941db5fdd1c0f98dc0503 |
def test_dual_transformer_multiple_interspersed_regression_test(self): <NEW_LINE> <INDENT> dual_not_first_transformer = IdentityTransformer()( DualTransformer()(axl.EvolvedANN) ) <NEW_LINE> self.assert_dual_wrapper_correct(dual_not_first_transformer) <NEW_LINE> multiple_dual_transformers = DualTransformer()( DualTransf... | DualTransformer has failed when there were multiple DualTransformers.
It has also failed when DualTransformer was not the outermost
transformer or when other transformers were between multiple
DualTransformers. | 625941dbbf627c535bc1349e |
def get_one_objects(self, offerid=None, taskid=None): <NEW_LINE> <INDENT> print(offerid) <NEW_LINE> if offerid is None: <NEW_LINE> <INDENT> obj = self.get_all_object() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> obj = self.get_one_object(offerId=offerid, taskId=taskid) <NEW_LINE> <DEDENT> return obj | 查找账户信息 | 625941db711fe17d82542634 |
def _track_changes(self): <NEW_LINE> <INDENT> if self._field and getattr(self._parent, '_track_changes', None) is not None: <NEW_LINE> <INDENT> self._parent._track_changes.add(self._field) | Update the track_changes on the parent to reflect a needed update on this field | 625941db187af65679ca53ee |
def get_emission_data(gsrn): <NEW_LINE> <INDENT> hashed_gsrn = hash_gsrn(gsrn) <NEW_LINE> with open(E18_EMISSION_FILE, 'rb') as f: <NEW_LINE> <INDENT> df = pd.read_parquet(f) <NEW_LINE> if hashed_gsrn in df.index: <NEW_LINE> <INDENT> result = {} <NEW_LINE> row = df.loc[df.index == hashed_gsrn] <NEW_LINE> for key in row... | Returns emissions data as dict, or None if no data exists for the GSRN.
All values are returned in g/Wh
:param str gsrn: | 625941db66656f66f7cbc47b |
def run_window_spec_command(window_spec, run_function): <NEW_LINE> <INDENT> command = window_spec.get('command') <NEW_LINE> if command: <NEW_LINE> <INDENT> run_function(command) | Run the command from the given window spec, if it has one.
:param window_spec: the window spec whose command to run
:type window_spec: dict
:param run_function: the function to call to run the command
:type run_function: callable | 625941db167d2b6e31218e64 |
def patch(self, **kwargs): <NEW_LINE> <INDENT> query_params = {"_actions": "false", "_links": "true", "_embedded": "true"} <NEW_LINE> path_params = {} <NEW_LINE> headers = {} <NEW_LINE> body = None <NEW_LINE> if "dashboardId" in kwargs: <NEW_LINE> <INDENT> path_params["dashboardId"] = kwargs["dashboardId"] <NEW_LINE> <... | Updates information about a dashboard
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Organization, all.User, applicationDashboard.*, or applicationDashboard.patch.
Parameters:
* {string... | 625941db4428ac0f6e5baac3 |
def length(self): <NEW_LINE> <INDENT> return self.ll_length | Return the length of this linked list by traversing its nodes.
Running time: O(1) >>> since using .ll_length | 625941db7b25080760e39727 |
def check_company_name(self, indexstr, ustr): <NEW_LINE> <INDENT> ret = None <NEW_LINE> if public.str_empty(indexstr, ustr): <NEW_LINE> <INDENT> ret = u"为空" <NEW_LINE> <DEDENT> return ret | company_name 清洗验证 | 625941db3346ee7daa2b303d |
@app.task <NEW_LINE> def import_jq_stock_info(chain_param=None, refresh=False): <NEW_LINE> <INDENT> table_name = TABLE_NAME <NEW_LINE> logging.info("更新 %s 开始", table_name) <NEW_LINE> param_list = [ ('jq_code', String(20)), ('display_name', String(20)), ('name', String(20)), ('start_date', Date), ('end_date', Date), ] <... | 获取全市场股票代码及名称
| 625941db66673b3332b92361 |
def hierarchical_clustering(patterns, Clusters, clustering_algorithm=bottom_up_clustering, **kwargs): <NEW_LINE> <INDENT> microclasses = find_microclasses(patterns) <NEW_LINE> node = clustering_algorithm(patterns, microclasses, Clusters, **kwargs) <NEW_LINE> macroclasses = node.macroclasses() <NEW_LINE> if macroclasses... | Perform hierarchical clustering on patterns according to a clustering algorithm and a measure.
This function ::
Finds microclasses.
Performs the clustering,
Finds the macroclasses (and exports them),
Returns the inflection class tree.
Scoring, finding the best merges, merging nodes depends on the Clus... | 625941db627d3e7fe0d69120 |
def close_connection(request): <NEW_LINE> <INDENT> db = getattr(request, 'db', None) <NEW_LINE> if db is not None: <NEW_LINE> <INDENT> if request.exception is not None: <NEW_LINE> <INDENT> db.rollback() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> db.commit() <NEW_LINE> <DEDENT> request.db.close() | Close the database connection for this request.
If there has been an error in the processing of the
request, abort any open transactions. | 625941dbbe7bc26dc91cd8ca |
def plot_illustrative_gp_hparams(x=None, filename='gp_sample_plot.pdf'): <NEW_LINE> <INDENT> def f(x): <NEW_LINE> <INDENT> return 5*np.sin(x) + np.random.normal(scale=0.4, size=len(x))[:,np.newaxis]**2 <NEW_LINE> <DEDENT> if x == None: <NEW_LINE> <INDENT> x = np.linspace(1, 10, 30).reshape(-1, 1) <NEW_LINE> <DEDENT> y ... | Multiple plots of a GP on some hard-coded data with varying hyper parameters (signal variance,
length scales, noise variance) to show their effect on the model and predictions | 625941dbab23a570cc250454 |
def test_initialization(self): <NEW_LINE> <INDENT> self.assertEqual(self.button.text, "title") <NEW_LINE> self.assertEqual(self.button.type, "BUTTON") <NEW_LINE> self.assertEqual(self.button.actionables, []) | verify that button is initialized with the correct options | 625941db0a366e3fb873eaeb |
def run(self): <NEW_LINE> <INDENT> import maya.cmds as cmds <NEW_LINE> nodes = cmds.ls(exactType='unknown') <NEW_LINE> result = list() <NEW_LINE> if nodes: <NEW_LINE> <INDENT> for node in nodes: <NEW_LINE> <INDENT> result.append(node) <NEW_LINE> <DEDENT> return u'节点%s: 需要清理'%result <NEW_LINE> <DEDENT> return | Runs codes to start checking. | 625941db1d351010ab855deb |
def add_template_context(self, context, selected_options, **kwargs): <NEW_LINE> <INDENT> from satchmo.product.utils import serialize_options <NEW_LINE> context['options'] = serialize_options(self, selected_options) <NEW_LINE> return context | Add context for the product template.
Return the updated context. | 625941dbcc0a2c11143dd160 |
def create_order(self, stripe_transaction, amount, name, description, recurring, sales_type): <NEW_LINE> <INDENT> transaction_obj = Transaction(name, description, stripe_transaction, amount, recurring, sales_type,self.id) <NEW_LINE> db.session.add(transaction_obj) <NEW_LINE> return db.session.commit() | :rtype : object | 625941db851cf427c661a7dc |
def post(self, related, ds): <NEW_LINE> <INDENT> data = self.dict(related) <NEW_LINE> es_class = ELASTICSEARCH_CLASSES_BY_MODEL['wrarecord'] <NEW_LINE> return es_class.from_dict(data['id'], data).save( index=ds.index_name('wrarecord'), using=ds.es ) | Post record to Elasticsearch
| 625941dbe64d504609d74b0f |
def importData(database, filename, user): <NEW_LINE> <INDENT> if DbMixin not in database.__class__.__bases__: <NEW_LINE> <INDENT> database.__class__.__bases__ = (DbMixin,) + database.__class__.__bases__ <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> ifile = open(filename, "rb") <NEW... | Try to handle ANSEL encoded files that are not really ANSEL encoded | 625941db7b25080760e39728 |
def on_post_save(self, view): <NEW_LINE> <INDENT> global ch_project_thread <NEW_LINE> s = sublime.load_settings('color_helper.sublime-settings') <NEW_LINE> show_current_palette = s.get('enable_current_file_palette', True) <NEW_LINE> show_current_project_palette = s.get('enable_project_palette', True) <NEW_LINE> if show... | Run current file scan and/or project scan on save | 625941dbec188e330fd5aa6a |
def sortedArrayToBST(self, nums): <NEW_LINE> <INDENT> if len(nums) == 0: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> i, j = 0, len(nums)-1 <NEW_LINE> mid = (i+j)/2 <NEW_LINE> root = TreeNode(nums[mid]) <NEW_LINE> root.left = self.sortedArrayToBST(nums[:mid]) <NEW_LINE> root.right = self.sortedArrayToBST(nums[mi... | :type nums: List[int]
:rtype: TreeNode | 625941dbd99f1b3c44c6785a |
def fetchall(self): <NEW_LINE> <INDENT> return [row for row in self] | Fetch all (remaining) rows of a query result.
Returns:
List of tuples, where each tuple is one row of returned values.
Raises:
fdb.DatabaseError: When error is returned by server.
fdb.ProgrammingError: When underlying :class:`PreparedStatement` is
closed, statement was not yet executed, or
... | 625941db462c4b4f79d1d9a0 |
def get_perms(filemode): <NEW_LINE> <INDENT> perm_vals = [ (stat.S_IRUSR, "r"), (stat.S_IWUSR, "w"), (stat.S_IXUSR, "x"), (stat.S_IRGRP, "r"), (stat.S_IWGRP, "w"), (stat.S_IXGRP, "x"), (stat.S_IROTH, "r"), (stat.S_IWOTH, "w"), (stat.S_IXOTH, "x"), ] <NEW_LINE> perms = (perm if filemode & val else "-" for val, perm in p... | get the permissions string | 625941db9b70327d1c4e10a6 |
def get_paravaginal_gap_distance_horiz(fiducial, vagproperties): <NEW_LINE> <INDENT> if (fiducial == None) or (vagproperties._Pubic_Symphysis == None): <NEW_LINE> <INDENT> print("Error, 'None' passed to get_paravaginal_gap_distance_is!") <NEW_LINE> return None <NEW_LINE> <DEDENT> gap_vec = get_paravaginal_gap_vector(fi... | Compute the distance from "fiducial" to the nearest Pubis->Ischial Spine line, aka the "Paravaginal Gap Distance",
along the AP/LR Plane. | 625941db63b5f9789fde73b6 |
def _swap_lattice_gens(vec1: Vec, vec2: Vec, bcast_swap_info): <NEW_LINE> <INDENT> swap_info: _SwapInfo = bcast_swap_info.value <NEW_LINE> base_ranks = swap_info.base_ranks <NEW_LINE> comms = swap_info.comms <NEW_LINE> assume_comm = swap_info.assume_comm <NEW_LINE> vecs = (vec1, vec2) <NEW_LINE> indices1, indices2 = [i... | Swap the generators with lattice indices. | 625941dbf7d966606f6aa2d7 |
def __write_group(self): <NEW_LINE> <INDENT> if self.__open_bracket: <NEW_LINE> <INDENT> self.__write_obj.write( 'cb<nu<clos-brack<0003\n' ) <NEW_LINE> self.__open_bracket = False <NEW_LINE> <DEDENT> inline_string = ''.join(['%s<nu<%s\n' % (k, v) for k, v in self.__inline.iteritems() i... | Write a tempory group after accepted control words end
But this is mostly useless in my opinion as there is no list of rejected cw
This may be a way to implement future old rtf processing for cw
Utility: open a group to just put brackets but why be so complicated?
Scheme: open brackets, write cw then go to body and bac... | 625941db3317a56b86939f22 |
def setEnableHideColumnsPopup(self, enablePopup): <NEW_LINE> <INDENT> self.__hide_columns_popup = enablePopup | Enable/disable a popup to allow to hide/show each column of the
model.
:param bool enablePopup: Enable/disable popup to hide/show columns | 625941dba934411ee3751964 |
def set_theme(self, image_name, emote_name, sound_name): <NEW_LINE> <INDENT> self.image_name = image_name <NEW_LINE> self.emote_name = emote_name <NEW_LINE> self.sound_name = sound_name <NEW_LINE> self.theme_path = os.path.join("themes", "images", self.image_name) <NEW_LINE> self.conv_themes_path = os.path.join(os.getc... | set the theme name and change all the paths to reflect the change | 625941dbb57a9660fec33b58 |
def serialization_get_childs(self): <NEW_LINE> <INDENT> childs = self.channels[:] + self.output_channels[:] + [self.gui_factory] <NEW_LINE> return childs | Get child objects that require and support serialization. | 625941db30bbd722463cc098 |
def dict2obj(d:'Mapping[str, Any]', cls_name:str='Namespace', escapes:str='-')->'Any': <NEW_LINE> <INDENT> d_ = dict() <NEW_LINE> for k, v in d.items(): <NEW_LINE> <INDENT> for s in escapes: <NEW_LINE> <INDENT> k = k.replace(s, '_') <NEW_LINE> <DEDENT> if is_dict(v): <NEW_LINE> <INDENT> d_[k] = dict2obj(v, cls_name=k) ... | convert 'dict' to read-only fields recursively
if mutable keys wanted, try EasyDict | 625941db8e05c05ec3eea646 |
def _construct_dict_and_constraints(self): <NEW_LINE> <INDENT> constraints = {'key1': {'type:values': ['val1', 'val2'], 'required': True}, 'key2': {'type:string': None, 'required': False}, 'key3': {'type:dict': {'k4': {'type:string': None, 'required': True}}, 'required': True}} <NEW_LINE> dictionary = {'key1': 'val1', ... | Constructs a test dictionary and a definition of constraints.
:return: A (dictionary, constraint) tuple | 625941db99cbb53fe6792eb6 |
def checkPhotoElemType(elem): <NEW_LINE> <INDENT> elem_type = None <NEW_LINE> empty_textView = None <NEW_LINE> count_textView = None <NEW_LINE> view_num, text_num, image_num = 0, 0, 0 <NEW_LINE> for child in elem.iter(): <NEW_LINE> <INDENT> if child.attrib["class"] == "android.widget.TextView" and (child... | 检查相册列表发布动态的类型
动态的类型:纯文字、纯视频、纯图片列表、图文(一张图)、图文列表(大于1张)、视频文字、空类型
7 中类型:word photoList video photoWord videoWord photoWordList empty half None | 625941db3cc13d1c6d3c7649 |
def get_state(self, **kwargs): <NEW_LINE> <INDENT> LOG.warning('WARNING: Collector mappings are deprecated and will ' 'be removed in a future release') <NEW_LINE> if not kwargs.get('name'): <NEW_LINE> <INDENT> raise exc.ArgumentRequired("'name' argument is required.") <NEW_LINE> <DEDENT> authorized_args = ['name'] <NEW... | Returns the state of a collector.
:param name: Name of the collector.
:type name: str | 625941db30c21e258bdfa76f |
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, ViewProperties): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__ | Returns true if both objects are equal | 625941db8da39b475bd65246 |
def filterSig(self, order, lowcut, highcut, decimationFactor, method='lfilter'): <NEW_LINE> <INDENT> if self.a==None: <NEW_LINE> <INDENT> self._createFilter(lowcut, highcut, order=order) <NEW_LINE> <DEDENT> if method.lower() in ('default','filtfilt'): <NEW_LINE> <INDENT> self.mainSignal = decimate(filtfilt(self.b, self... | if method equals 'default' or 'filtfilt' do forward-backward filter method
else do lfilter | 625941dbfbf16365ca6f6498 |
@with_setup(setup=None, teardown=teardown_s3) <NEW_LINE> @patch('stream_alert.rule_processor.payload.S3Payload._get_object') <NEW_LINE> @patch('logging.Logger.debug') <NEW_LINE> @patch('stream_alert.rule_processor.payload.S3Payload._read_downloaded_s3_object') <NEW_LINE> def test_pre_parse_s3_debug(s3_mock, log_mock, _... | S3Payload - Pre Parse, Debug On | 625941dbd8ef3951e324380e |
def put(self): <NEW_LINE> <INDENT> self._raise_400_if_invalid_id(self.record_id) <NEW_LINE> id_field = self.model.id_field <NEW_LINE> existing = None <NEW_LINE> tombstones = None <NEW_LINE> try: <NEW_LINE> <INDENT> existing = self._get_record_or_404(self.record_id) <NEW_LINE> <DEDENT> except HTTPNotFound: <NEW_LINE> <I... | Record ``PUT`` endpoint: create or replace the provided record and
return it.
:raises:
:exc:`~pyramid:pyramid.httpexceptions.HTTPPreconditionFailed` if
``If-Match`` header is provided and record modified
in the iterim.
.. note::
If ``If-None-Match: *`` request header is provided, the
``PUT`` will... | 625941db63d6d428bbe447c0 |
def RNAparser(text): <NEW_LINE> <INDENT> upper_text = text.upper() <NEW_LINE> RNAsequence = "" <NEW_LINE> no_space_text_array = upper_text.split() <NEW_LINE> for no_space_sequence in no_space_text_array: <NEW_LINE> <INDENT> for letter in no_space_sequence: <NEW_LINE> <INDENT> if isRNANucleotide(letter): <NEW_LINE> <IND... | Parses text to create valid RNA sequence | 625941db7cff6e4e81117c55 |
def _IsRn_SFS_B82(phi, d, xi, delta, t, **kwargs): <NEW_LINE> <INDENT> a = d/xi; t=kb*t; delta = e*delta <NEW_LINE> prefac = np.pi*delta*a**2/2/e <NEW_LINE> f = lambda y: prefac*y**(-3) *(np.sin((phi-y)/2)*np.tanh(delta*np.cos((phi-y)/2)/(2*t)) + np.sin((phi+y)/2)*np.tanh(delta*np.cos((phi+y)/2)/... | clean limit supercurrent-phase relationship in Buzdin-1982
xi = vf*hbar/2Ex
kwargs for numpy.quad | 625941db97e22403b379d26b |
def testGetName(self): <NEW_LINE> <INDENT> self.assertEquals(self.app.name, 'gtk3-demo') <NEW_LINE> self.assertEquals(dogtail.tree.root.name, 'main') | Node.name of the gtk-demo app should be "gtk-demo" | 625941dbcdde0d52a9e53305 |
def tap(self,x,y): <NEW_LINE> <INDENT> self.driver.tap([(x,y)]) | 根据坐标点击
:param x: x坐标
:param y: y坐标
:return: None | 625941db63f4b57ef00013e2 |
def emptyBack(n, gridsize, ndim): <NEW_LINE> <INDENT> ndim = int(ndim) <NEW_LINE> c = ndim / 2 <NEW_LINE> o = np.array([c, c, c]) <NEW_LINE> rad = ndim / (gridsize * 2) <NEW_LINE> x1 = np.linspace(0, ndim - 1, ndim) <NEW_LINE> y1 = x1 <NEW_LINE> z1 = x1 <NEW_LINE> X, Y, Z = np.meshgrid(x1, y1, z1) <NEW_LINE> d = np.vst... | Function to set the density within and behind the star to zero (or 1e-40 in this case to avoid dividing by 0)
Inputs:
n : the grid of densities to be edited
gridsize: the size of the grid in rstar
ndim : the number of indices in the grid in each dimension
Output:
n : The original grid ... | 625941db94891a1f4081bd7a |
def browse_mask_file(self): <NEW_LINE> <INDENT> self._event_handler.browse_mask_file() | set IPTS number
:return: | 625941dbd268445f265b513e |
def __init__(self, params): <NEW_LINE> <INDENT> self._params = params <NEW_LINE> self._make_dataset() <NEW_LINE> self._make_placeholders() <NEW_LINE> if self._params.emb_variable: <NEW_LINE> <INDENT> self._make_variables() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._one_hot_encode_x() <NEW_LINE> <DEDENT> self._... | Create the model. | 625941db5f7d997b87174d6a |
def __init__(self): <NEW_LINE> <INDENT> self.adj = {} <NEW_LINE> self.lociList = [] <NEW_LINE> self.locus_id_dict = {} <NEW_LINE> self.locus_id_list = [] <NEW_LINE> self.current_default_id = 0 | Initializes chromosome object
| 625941dbf9cc0f698b1408c9 |
def test_mtso_mto(self): <NEW_LINE> <INDENT> warehouse = self.env['stock.warehouse'].search([('company_id', '=', self.env.user.id)], limit=1) <NEW_LINE> warehouse.delivery_steps = 'pick_pack_ship' <NEW_LINE> partner_demo_customer = self.partner <NEW_LINE> final_location = partner_demo_customer.property_stock_customer <... | Run a procurement for 5 products when there are only 4 in stock then
check that MTO is applied on the moves when the rule is set to 'mts_else_mto' | 625941db167d2b6e31218e65 |
def visit_AugAssign(self, node: ast.AugAssign) -> None: <NEW_LINE> <INDENT> self._check_negation(node.op, node.value) <NEW_LINE> self._check_string_concat(node.value, node.op) <NEW_LINE> self.generic_visit(node) | Visits augmented assigns. | 625941db6e29344779a628e0 |
def perms(s): <NEW_LINE> <INDENT> if (len(s) <= 1): <NEW_LINE> <INDENT> return set(s) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> result = set() <NEW_LINE> for i in range(len(s)): <NEW_LINE> <INDENT> char = s[i] <NEW_LINE> s_minus = s[:i] + s[i+1:] <NEW_LINE> perms_minus = perms(s_minus) <NEW_LINE> for p in perms_min... | (str) -> set of str
Takes in a str and returns the permutation of the str in a set of str
>>>perms('abc')
{'abc', 'bca', 'bac', 'acb', 'cba', 'cab'}
>>>perms('ab')
{'ba', 'ab'}
>>>perms('abcd')
{'cadb', 'cbad', 'dacb', 'acbd', 'bdac', 'abdc', 'abcd', 'bdca', 'dcba',
'adbc', 'cdba', 'cabd', 'dcab', 'acdb', 'cbda', 'bacd... | 625941db460517430c39444f |
@allure.title("A some test title with param {param}") <NEW_LINE> @pytest.mark.parametrize('param', [False]) <NEW_LINE> def test_display_name_template(param): <NEW_LINE> <INDENT> assert param | >>> allure_report = getfixture('allure_report')
>>> assert_that(allure_report,
... has_test_case('test_display_name_template[False]',
... has_title("A some test title with param False")
... )
... ) | 625941dbcc40096d61595c20 |
def _create_amv_item(amv_info, context_menu): <NEW_LINE> <INDENT> amv_id = amv_info['id'] <NEW_LINE> if amv_info['subtitles']: <NEW_LINE> <INDENT> path = PLUGIN.url_for('play_with_subtitles', amv_id=amv_id, subtitles_id=_choose_subtitles(amv_info)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> path = PLUGIN.url_for('pl... | Create list item for AMV.
:param dict amv_info: AMV information.
:param list context_menu: Context menu for item.
:return: List item for AMV.
:rtype: dict | 625941db7047854f462a16d7 |
def _apply_filters(self, metadata): <NEW_LINE> <INDENT> if "keywords" in self.filters: <NEW_LINE> <INDENT> if not metadata.keywords: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if not all(keyword in metadata.keywords for keyword in self.filters["keywords"]): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT>... | Apply filters to metadata.
Args:
metadata (pylith.utils.SimulationMetadata)
Simulation metadata.
Returns: (bool)
True if metadata meets filter requirements, False otherwise. | 625941db091ae3566866722a |
def readOnlyNetwork(nodes, network): <NEW_LINE> <INDENT> flowNodes, cleanNetwork = [], {} <NEW_LINE> for i in network: <NEW_LINE> <INDENT> for z in nodes: <NEW_LINE> <INDENT> if z[0] == i: <NEW_LINE> <INDENT> x, y, height, flow, forceKriteria, nodeFlow, trench = z[1], z[2], z[3], z[4], z[5], z[8], z[3] - z[10] <NEW_LIN... | Get only the nodes which are part of a network.
Input Arguments:
nodes -- nodes
network -- Network
Output Arguments:
flowNodes -- All Nodes of Network with flow
cleanNetwork -- Networks with only nodes where there is a flow. | 625941db0a50d4780f667165 |
def test_short_read_quorum_delete(self): <NEW_LINE> <INDENT> cluster = self.cluster <NEW_LINE> cluster.set_configuration_options(values={'hinted_handoff_enabled': False}) <NEW_LINE> cluster.set_batch_commitlog(enabled=True) <NEW_LINE> cluster.populate(3).start(wait_other_notice=True) <NEW_LINE> node1, node2, node3 = cl... | @jira_ticket CASSANDRA-8933 | 625941dbf8510a7c17cf99ce |
def get_dataverse_assignments(self, identifier, auth=False): <NEW_LINE> <INDENT> url = "{0}/dataverses/{1}/assignments".format( self.base_url_api_native, identifier ) <NEW_LINE> return self.get_request(url, auth=auth) | Get dataverse assignments by alias or id.
View assignments of a dataverse.
.. code-block:: bash
GET http://$SERVER/api/dataverses/$id/assignments
Parameters
----------
identifier : str
Can either be a dataverse id (long), a dataverse alias (more
robust), or the special value ``:root``.
Returns
-------
... | 625941db596a897236089d8e |
def data_collection_status(self, **kwargs): <NEW_LINE> <INDENT> return self.api_request(self._get_method_fullname("data_collection_status"), kwargs) | All information about collection of data for this device
**Inputs**
| ``api version min:`` None
| ``api version max:`` None
| ``required:`` True
| ``default:`` None
:param DeviceID: An internal NetMRI identifier for the device.
:type DeviceID: Integer
**Outputs**
| ``api version min:`` None
| ``api version... | 625941dbd10714528d5fffb6 |
def register_extensions(app): <NEW_LINE> <INDENT> cache.init_app(app) <NEW_LINE> babel.init_app(app) <NEW_LINE> csrf.init_app(app) <NEW_LINE> jwt.init_app(app) <NEW_LINE> db.init_app(app) | Register extensions with the Flask application. | 625941db21a7993f00bc7fc4 |
def is_dcp(self): <NEW_LINE> <INDENT> return all(list(map(lambda x:x.is_dcp(),self))) | Determines if all constraints are DCP-compliant. | 625941dba17c0f6771cbe320 |
def vp_start_gui(l_serialconfig): <NEW_LINE> <INDENT> global val, w, root <NEW_LINE> root = Tk() <NEW_LINE> global serialconfig <NEW_LINE> serialconfig = readconfig() <NEW_LINE> root.title('SWC1 Comport1: ' + ',' + serialconfig['baudrate'] + ',' + serialconfig['comport']) <NEW_LINE> root.geometry('600x450+497+117') <NE... | Starting point when module is the main routine. | 625941dbf7d966606f6aa2d8 |
def _generate_winning_positions(self): <NEW_LINE> <INDENT> winning_combos = [] <NEW_LINE> for row in range(3): <NEW_LINE> <INDENT> win_set = set() <NEW_LINE> for col in range(3): <NEW_LINE> <INDENT> win_set.add((row,col)) <NEW_LINE> <DEDENT> winning_combos.append(win_set) <NEW_LINE> <DEDENT> for col in range(3): <NEW_L... | Returns a list of Winning combination sets across rows, columns and diagonal
| 625941db60cbc95b062c6814 |
def get_min(self): <NEW_LINE> <INDENT> if not self._list: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._list[0] | return the object with the smallest key
>>> k = PriorityQueueMinHeap()
>>> k.insert (23,'3')
>>> k.insert (22,'4')
>>> k.insert (21,'5')
>>> k.insert (20,'6')
>>> k.get_min()
'PriorityQueueItem(20, '6', 0)' | 625941db442bda511e8be6e5 |
def __call__(self, inputs, state, scope=None): <NEW_LINE> <INDENT> with vs.variable_scope(scope or type(self).__name__): <NEW_LINE> <INDENT> if self._state_is_tuple: <NEW_LINE> <INDENT> state, attns, attn_states = state <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> states = state <NEW_LINE> state = array_ops.slice(stat... | Long short-term memory cell with attention (LSTMA). | 625941db15baa723493c4248 |
def delete_window(self): <NEW_LINE> <INDENT> if pm.window(self.window_name, exists=True): <NEW_LINE> <INDENT> pm.deleteUI(self.window_name, window=True) | Delete the window.
:return: None | 625941dbe76e3b2f99f3aad8 |
def metadata_save(self): <NEW_LINE> <INDENT> out = json.dumps(self.metadata, indent=2, sort_keys=True) <NEW_LINE> DEBUG("metadata:\n%s" % out) <NEW_LINE> path = self.metadata_path // "metadata.json" <NEW_LINE> VERBOSE("writing metadata file: %s" % path) <NEW_LINE> file_write(path, out + "\n") <NEW_LINE> path = self.met... | Dump image's metadata to disk, including the main data structure but
also all auxiliary files, e.g. ch/environment. | 625941db435de62698dfdf1e |
def test_01_can_get_xml_data_for_all_projects(self): <NEW_LINE> <INDENT> self.assert_element(self.all_projects_root).is_not_none_and_has_tag("response") <NEW_LINE> expected_total_projects = 171 <NEW_LINE> self.assert_element(self.all_projects_root).has_at_least(2).children() <NEW_LINE> self.assert_element(self.all_proj... | api.xml.AllProjectsTest 1. Can get XML data for all projects | 625941db7cff6e4e81117c56 |
def layer_sizes(X, Y): <NEW_LINE> <INDENT> n_x = X.shape[0] <NEW_LINE> n_y = Y.shape[0] <NEW_LINE> return (n_x, n_y) | Arguments:
X -- input dataset of shape (input size, number of examples)
Y -- labels of shape (output size, number of examples)
Returns:
n_x -- the size of the input layer
n_y -- the size of the output layer | 625941db30bbd722463cc099 |
@pytest.mark.parametrize( 'command_sub', [ 'upload', 'delete-manifest', 'refresh-manifest', 'manifest-history' ] ) <NEW_LINE> def test_cli_subscription_method_called(mocker, command_sub): <NEW_LINE> <INDENT> mocker.patch('robottelo.cli.subscription.bz_bug_is_open') <NEW_LINE> execute = mocker.patch('robottelo.cli.subsc... | Check Subscription methods are called and command_sub edited
This is a parametrized test called by Pytest for each
of Subscription methods | 625941dbfb3f5b602dac3967 |
def read_chunks(path, size=1024): <NEW_LINE> <INDENT> with open(path) as f: <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> chunk_data = f.read(size) <NEW_LINE> if not chunk_data: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> yield chunk_data | Lazy function (generator) to read a file piece by piece.
Default chunk size: 1K | 625941db7b180e01f3dc4ac9 |
def __init__(self, *args): <NEW_LINE> <INDENT> this = _blocks_swig0.new_delay_sptr(*args) <NEW_LINE> try: self.this.append(this) <NEW_LINE> except: self.this = this | __init__(boost::shared_ptr<(gr::blocks::delay)> self) -> delay_sptr
__init__(boost::shared_ptr<(gr::blocks::delay)> self, delay p) -> delay_sptr | 625941db046cf37aa974d016 |
def env_name(): <NEW_LINE> <INDENT> env_name = find_env_name() <NEW_LINE> if ( builtins.__xonsh__.env.get("VIRTUAL_ENV_DISABLE_PROMPT") or not env_name ): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> venv_prompt = builtins.__xonsh__.env.get("VIRTUAL_ENV_PROMPT") <NEW_LINE> if venv_prompt is not None: <NEW_LINE> <INDE... | Returns the current env_name if it non-empty, surrounded by the
``{env_prefix}`` and ``{env_postfix}`` fields. | 625941db67a9b606de4a8188 |
def status_code(self,url,code): <NEW_LINE> <INDENT> reqr = requests.get(url) <NEW_LINE> self.assertEqual(reqr.status_code, code) | 验证访问的错误页的状态码 | 625941db566aa707497f4836 |
def to_slate(self, text): <NEW_LINE> <INDENT> fragments = html5parser.fragments_fromstring(text) <NEW_LINE> nodes = [] <NEW_LINE> for f in fragments: <NEW_LINE> <INDENT> nodes += self.deserialize(f) <NEW_LINE> <DEDENT> return self.normalize(nodes) | Convert text to a slate value. A slate value is a list of elements | 625941db2ae34c7f2600d402 |
def emergency_exit(self, asset, signal): <NEW_LINE> <INDENT> if self.take_profit.order: <NEW_LINE> <INDENT> self.ib.cancelOrder(self.take_profit.order) <NEW_LINE> <DEDENT> if self.stop_loss.order: <NEW_LINE> <INDENT> self.ib.cancelOrder(self.stop_loss.order) <NEW_LINE> <DEDENT> action = self.ib_actions[signal] <NEW_LIN... | Blocking | 625941db4a966d76dd5512e2 |
def toJSONFilters(actions): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> input_stream = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8') <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> input_stream = codecs.getreader("utf-8")(sys.stdin) <NEW_LINE> <DEDENT> source = input_stream.read() <NEW_LINE> if l... | Generate a JSON-to-JSON filter from stdin to stdout
The filter:
* reads a JSON-formatted pandoc document from stdin
* transforms it by walking the tree and performing the actions
* returns a new JSON-formatted pandoc document to stdout
The argument `actions` is a list of functions of the form
`action(key, value, for... | 625941db4e696a04525c971d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.