code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def ref_next_iteration(data, name=None): <NEW_LINE> <INDENT> return _op_def_lib.apply_op("RefNextIteration", data=data, name=name)
Makes its input available to the next iteration. Args: data: A mutable `Tensor`. The tensor to be made available to the next iteration. name: A name for the operation (optional). Returns: A mutable `Tensor`. Has the same type as `data`. The same tensor as `data`.
625941cc01c39578d7e74f1f
def setCanBusSpeed(self,canSpeed,index=None): <NEW_LINE> <INDENT> if index == None: <NEW_LINE> <INDENT> index = self.Index <NEW_LINE> <DEDENT> UpdateOptionDict(self.Options,{'canSpeed1':canSpeed},self.logger) <NEW_LINE> return self._CanSetSpeed(index, canSpeed)
High Level Function to Set the CAN Bus Speed - basically get rid of the index for now @param index: Struct commonly used by the Tiny Can API @param canSpeed: Can Bitrate to be set @return: Error Code (0 = No Error) @todo: handle custom bitrates here too later @author: Patrick Menschel (menschel.p@posteo.de)
625941cc711fe17d8254244f
def createOpenvzContainer(self, node, post_data): <NEW_LINE> <INDENT> return self.post('nodes/%s/openvz' % (node), data=post_data)
Create or restore a container. Returns JSON Requires a dictionary or list of tuples formatted [('postname1','data'),('postname2','data')]
625941cc4f88993c3716c14a
def test_show_ipsec_site_connection(self): <NEW_LINE> <INDENT> self.assertTrue(neutron.show_ipsec_site_connection ('SALT', profile='openstack1'))
Test if it fetches information of a specific IPsecSiteConnection
625941cc5fcc89381b1e17a2
def read_audio_file(path, desired_fs): <NEW_LINE> <INDENT> extension = environment.file_extension(path).lower() <NEW_LINE> if extension != '.wav': <NEW_LINE> <INDENT> raise NotImplementedError("read_audio_file() currently only supports .wav files, not %s" % extension) <NEW_LINE> <DEDENT> return np.array(MonoLoader(file...
Reads in an audio file and returns an essentia (numpy float64) array of the data. :param path: path to the audio file :param desired_fs: desired sampling frequency of the returned signal :return: audio data and its sampling rate
625941cc4e696a04525c952f
def _approx_cross_validation_create_sub_graph_pipeline(self, data_dico, X): <NEW_LINE> <INDENT> dones_nodes = set() <NEW_LINE> for k, v in data_dico.items(): <NEW_LINE> <INDENT> if v is not None: <NEW_LINE> <INDENT> dones_nodes.add(k) <NEW_LINE> <DEDENT> <DEDENT> newG = nx.DiGraph() <NEW_LINE> new_models = {} <NEW_LINE...
this sub-method create the new graph-pipeline that should be fully cross-validated, it also create the new data on which to cv Returns ------- new_graph_pipeline new_data
625941ccf548e778e58cd661
@route('/modeling/getMoleculeAPIDefinition/<moleculeID>', method='GET') <NEW_LINE> def getMoleculeAPIDefinition(moleculeID): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> availableAPIProperties = {} <NEW_LINE> propertyEntityList = rmlEngine.api.getLinkCounterpartsByMetaMemeType(moleculeID, "Agent.MoleculeNodeMM::Agent.T...
Get the full list of properties that a data molecule can be queried about.
625941ccb7558d58953c4ff8
def exp_n_x(n, x): <NEW_LINE> <INDENT> if n == 0: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return (x**n)/factorial(n) + exp_n_x(n-1, x)
this function gives a the sum of the exp powered by x series
625941cc099cdd3c635f0d3e
def update_week(self, path): <NEW_LINE> <INDENT> config = ConfigParser.ConfigParser() <NEW_LINE> config.read(path) <NEW_LINE> dt = datetime.datetime.today() <NEW_LINE> config.set('General', 'Weeknumber', dt.strftime('%U')) <NEW_LINE> with open(path, 'wb') as config_file: <NEW_LINE> <INDENT> config.write(config_file)
read, update, delete config :param path: :return:
625941ccff9c53063f47c2d7
def run_serial(): <NEW_LINE> <INDENT> tic = time.perf_counter() <NEW_LINE> params = np.random.random(512) * 10 <NEW_LINE> results_a = [] <NEW_LINE> results_b = [] <NEW_LINE> for p in params: <NEW_LINE> <INDENT> a, b = calc_result(p) <NEW_LINE> results_a.append(a) <NEW_LINE> results_b.append(b) <NEW_LINE> <DEDENT> toc =...
Non-parallel example (no Dask). Compare results and elapsed time to the Dask example.
625941ccd99f1b3c44c67672
def nextGreaterElement(self, nums1, nums2): <NEW_LINE> <INDENT> nums2set = {} <NEW_LINE> for i, num in enumerate(nums2): <NEW_LINE> <INDENT> nums2set[num] = i <NEW_LINE> <DEDENT> sol = [] <NEW_LINE> for num in nums1: <NEW_LINE> <INDENT> sol.append(-1) <NEW_LINE> for j in range(nums2set[num], len(nums2)): <NEW_LINE> <IN...
:type nums1: List[int] :type nums2: List[int] :rtype: List[int]
625941cc711fe17d82542450
def twitterreq(self, url, method, parameters): <NEW_LINE> <INDENT> req = oauth.Request.from_consumer_and_token(oauth_consumer, token=oauth_token, http_method=http_method, http_url=url, parameters=parameters) <NEW_LINE> req.sign_request(signature_method_hmac_sha1, oauth_consumer, oauth_token) <NEW_LINE> headers = req.to...
" Construct, sign, and open a twitter request using the hard-coded credentials above.
625941cc460517430c394269
def LoadData(self): <NEW_LINE> <INDENT> self.InsertColumn(0, _('Mapset')) <NEW_LINE> self.InsertColumn(1, _('Owner')) <NEW_LINE> gisenv = grass.gisenv() <NEW_LINE> locationPath = os.path.join(gisenv['GISDBASE'], gisenv['LOCATION_NAME']) <NEW_LINE> for mapset in self.parent.all_mapsets_ordered: <NEW_LINE> <INDENT> index...
Load data into list
625941cc090684286d50edc9
def ex_replace_route_table_association(self, subnet_association, route_table): <NEW_LINE> <INDENT> if isinstance(subnet_association, EC2SubnetAssociation): <NEW_LINE> <INDENT> subnet_association_id = subnet_association.id <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> subnet_association_id = subnet_association <NEW_LINE...
Changes the route table associated with a given subnet in a VPC. Note: This method can be used to change which table is the main route table in the VPC (Specify the main route table's association ID and the route table to be the new main route table). :param subnet_association: The subnet association...
625941cc26238365f5f0ef52
def receive_commands(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.socket.recv(10) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> print('Could not start communication with server: %s\n' % str(e)) <NEW_LINE> return <NEW_LINE> <DEDENT> cwd = str.encode(str(os.getcwd()) + '> ') <NEW_LINE> self.s...
Receive commands from remote server and run on local machine
625941cc3346ee7daa2b2e4f
def recent(df, behavior1, behavior2, date, days=1): <NEW_LINE> <INDENT> prev_date = (dt.datetime.strptime(date, '%Y-%m-%d') - dt.timedelta(days)).strftime('%Y-%m-%d') <NEW_LINE> items_users1 = df[(df.date == prev_date) & (df.behavior_type == behavior1)].groupby(['item_id', 'user_id']).size() <NEW_LINE> items_users2 = d...
隔天行为转化的条件概率(转化率)。所用算式:intersection(behavior1, behavior2) / behavior1 。 :param df: 数据集 :param date: 给定的日期 :param behavior1: 给定日期前一天行为 :param behavior2: 给定日期的行为 :param days: 相隔天数 :return: 转化率的系列 :rtype: pd.Series
625941cc0fa83653e465709f
def _parse_gauout(gauout_name, energy_patt): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open(gauout_name, 'r') as gauout: <NEW_LINE> <INDENT> lines = gauout.readlines() <NEW_LINE> <DEDENT> <DEDENT> except IOError: <NEW_LINE> <INDENT> raise <NEW_LINE> <DEDENT> compiled_energy_patt = re.compile(energy_patt) <NEW_L...
Parses the given Gaussian output file The results will be put in a named tuple. All units are *not* converted. And tensor properties like coordinates and forces will be in numpy arrays. :param str gauout_name: The name of the Gaussian output file to parse. :param str energy_patt: The energy pattern to grab the energy...
625941ccbf627c535bc132b3
def resize_img(image, h, w, width, height): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> top, bottom = (0, 0) <NEW_LINE> temp_h = int(h * width / w) <NEW_LINE> new_img_temp = cv2.resize(image, (width, temp_h)) <NEW_LINE> dh = height - temp_h <NEW_LINE> if dh > 0: <NEW_LINE> <INDENT> top = dh // 2 <NEW_LINE> bottom = dh...
调整图像尺寸为width,height,高度不足补黑,高度过大则裁剪
625941cc99fddb7c1c9de475
@since(2.3) <NEW_LINE> def pandas_udf(f=None, returnType=StringType()): <NEW_LINE> <INDENT> wrapped_udf = _create_udf(f, returnType=returnType, vectorized=True) <NEW_LINE> return wrapped_udf
Creates a :class:`Column` expression representing a user defined function (UDF) that accepts `Pandas.Series` as input arguments and outputs a `Pandas.Series` of the same length. :param f: python function if used as a standalone function :param returnType: a :class:`pyspark.sql.types.DataType` object >>> from pyspark....
625941ccbe8e80087fb20d27
def _getFinalHash(self, startHash, startCol): <NEW_LINE> <INDENT> hashV = startHash <NEW_LINE> for col in range(startCol, self.columns-1): <NEW_LINE> <INDENT> pwd = self.reduce(hashV, col) <NEW_LINE> hashV = self.hashWord(pwd) <NEW_LINE> <DEDENT> return hashV
Returns the hash at the end of a chain, starting from a hash and at a given column. startHash: Hash to start with. startCol: Column to start from. Returns the hash at the end of a chain.
625941cc6fece00bbac2d822
def __init__(self, *args): <NEW_LINE> <INDENT> this = _lldb.new_SBTypeMember(*args) <NEW_LINE> try: <NEW_LINE> <INDENT> self.this.append(this) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> self.this = this
__init__(lldb::SBTypeMember self) -> SBTypeMember __init__(lldb::SBTypeMember self, SBTypeMember rhs) -> SBTypeMember
625941cc4527f215b584c53b
def test(a, b, c, d, e=3., f=None, g=None, *args, **kwargs): <NEW_LINE> <INDENT> pass
:param bool b: :type c: int :param AnySchema g: self test. :rtype: bool
625941cc73bcbd0ca4b2c15a
def keypool_show(self, keypool, tenant, uid, secret): <NEW_LINE> <INDENT> if (not common.is_uri(tenant)): <NEW_LINE> <INDENT> from tenant import Tenant <NEW_LINE> tenant_obj = Tenant(self.__ipAddr, self.__port) <NEW_LINE> namespace = tenant_obj.namespace_get(tenant) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> if(apity...
show keypool parameters: keypool: label of the keypool tenant: tenant name uid: user id secret: secret key Returns: JSON payload response
625941ccf8510a7c17cf97e1
def tile_images(img_nhwc): <NEW_LINE> <INDENT> img_nhwc = np.asarray(img_nhwc) <NEW_LINE> N, h, w, c = img_nhwc.shape <NEW_LINE> H = int(np.ceil(np.sqrt(N))) <NEW_LINE> W = int(np.ceil(float(N)/H)) <NEW_LINE> img_nhwc = np.array(list(img_nhwc) + [img_nhwc[0]*0 for _ in range(N, H*W)]) <NEW_LINE> img_HWhwc = img_nhwc.re...
Tile N images into one big PxQ image (P,Q) are chosen to be as close as possible, and if N is square, then P=Q. input: img_nhwc, list or array of images, ndim=4 once turned into array n = batch index, h = height, w = width, c = channel returns: bigim_HWc, ndarray with ndim=3
625941cca8370b7717052984
def insert_to_alphabet(self, arg2): <NEW_LINE> <INDENT> return _libhfst.HfstTransducer_insert_to_alphabet(self, arg2)
Explicitly insert *symbol* to the alphabet of the transducer. Parameters ---------- * `symbol` : The symbol (string) to be inserted. note: Usually this function is not needed since new symbols are added to the alphabet by default.
625941cce8904600ed9f2011
def find_videos_by_reference_ids(self, reference_ids, fields=None, video_fields=None, custom_fields=None, media_delivery=None, output=None): <NEW_LINE> <INDENT> params = validate_params(**locals()) <NEW_LINE> return self._read_api('find_videos_by_reference_ids', params, cls=VideoItemCollection)
Returns a VideoItemCollection of Videos.
625941ccff9c53063f47c2d8
def middleNode(self, head): <NEW_LINE> <INDENT> if(head.next is None): <NEW_LINE> <INDENT> return head <NEW_LINE> <DEDENT> cur1= head <NEW_LINE> cur2=head <NEW_LINE> while(cur2 is not None and cur2.next is not None): <NEW_LINE> <INDENT> cur1=cur1.next <NEW_LINE> cur2=cur2.next.next <NEW_LINE> <DEDENT> return cur1
:type head: ListNode :rtype: ListNode
625941ccbe383301e01b556a
def test_closed_open_reject(self): <NEW_LINE> <INDENT> closed_open_reject = RangeFilter(Type.CLOSED_OPEN_REJECT, self.lower_bound, self.upper_bound) <NEW_LINE> out_range_value = closed_open_reject.filter(self.upper_bound) <NEW_LINE> in_range_value = closed_open_reject.filter(self.lower_bound) <NEW_LINE> self.assertEqua...
If CLOSED_OPEN_REJECT filter applied value will be discarded if: lower_bound <= value < upper_bound
625941cc925a0f43d2549f5b
def health_check(self, context): <NEW_LINE> <INDENT> logger = get_logger_with_thread_id(context) <NEW_LINE> api = get_api(context) <NEW_LINE> logger.info("CONTEXT: {}".format(context)) <NEW_LINE> logger.info("SHELL_NAME: {}".format(self.SHELL_NAME)) <NEW_LINE> logger.info("SUPPORTED_OS: {}".format(self.SUPPORTED_OS)) <...
Checks if the device is up and connectable :param ResourceCommandContext context: ResourceCommandContext object with all Resource Attributes inside :return: Success or fail message :rtype: str
625941cc16aa5153ce36255c
def bill(self, year=None, month=None): <NEW_LINE> <INDENT> endpoint = '/'.join((self.server_url, '_api', 'v2', 'bill')) <NEW_LINE> return self._usage_endpoint(endpoint, year, month)
Retrieves Cloudant billing data, optionally for a given year and month. :param int year: Year to query against, for example 2014. Optional parameter. Defaults to None. If used, it must be accompanied by ``month``. :param int month: Month to query against that must be an integer between 1 and 12. Optiona...
625941cc091ae35668667043
def alloc_io(o, iostr, do_open = True, chunksize = 10240, enable_oob = False): <NEW_LINE> <INDENT> gensios_enabled.check_iostr_gensios(iostr) <NEW_LINE> h = HandleData(o, iostr, chunksize = chunksize) <NEW_LINE> if enable_oob: <NEW_LINE> <INDENT> h.io.control(0, gensio.GENSIO_CONTROL_SET, gensio.GENSIO_CONTROL_ENABLE_O...
Allocate an io instance with a HandlerData handler If do_open is True (default), open it, too.
625941cc56b00c62f0f1473d
def retrieve_untracked_files(self): <NEW_LINE> <INDENT> return self.c.retrieve_untracked_files()
retrieve s list of currently un-tracked files in the repo.
625941cc6aa9bd52df036e89
def version(request): <NEW_LINE> <INDENT> version_json = import_string(version_callback)(settings.BASE_DIR) <NEW_LINE> if version_json is None: <NEW_LINE> <INDENT> return HttpResponseNotFound('version.json not found') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return JsonResponse(version_json)
Returns the contents of version.json or a 404.
625941cc4d74a7450ccd42a8
def evaluate_for_platform(self, **kwargs): <NEW_LINE> <INDENT> return False
Determine if the children of this node are active, by evaluating the statement. Return False by default.
625941cc5e10d32532c5f00b
def count_bits_1_bin(val): <NEW_LINE> <INDENT> nbits = bin(val).count('1') <NEW_LINE> return nbits
Count the number of bits present in one integer.
625941cc63b5f9789fde71ca
def parse_records(urls, admissionIDs): <NEW_LINE> <INDENT> admissionsURL, comorbidsURL, patientsURL = urls[0], urls[1], urls[2] <NEW_LINE> admissionsResponse = requests.get(admissionsURL) <NEW_LINE> comorbidsResponse = requests.get(comorbidsURL) <NEW_LINE> patientsResponse = requests.get(patientsURL ) <NEW_LINE> admiss...
Input: a list of strings, and an array of integers Output: a pandas DataFrame Description: parse_records is a custom parser procedure will query mongoDB and extract the data fields for each admissionID that we want to be able to show in the visualization application. The final output is a pandas dataframe where each ro...
625941cc7047854f462a14ee
def SetInput1(self, *args): <NEW_LINE> <INDENT> return _itkComposeRGBImageFilterPython.itkComposeRGBImageFilterIUS2IRGBUS2_Superclass_SetInput1(self, *args)
SetInput1(self, itkImageUS2 image1)
625941cc21bff66bcd684a38
def _set_attr_opt(self, name: str, opt: int, value: OptValT) -> None: <NEW_LINE> <INDENT> if name in ContextOption.__members__: <NEW_LINE> <INDENT> return self.set(opt, value) <NEW_LINE> <DEDENT> elif name in SocketOption.__members__: <NEW_LINE> <INDENT> self.sockopts[opt] = value <NEW_LINE> <DEDENT> else: <NEW_LINE> <...
set default sockopts as attributes
625941cc0a50d4780f666f77
def setdict(self, newdict): <NEW_LINE> <INDENT> self._dict = newdict
Set the dictionary of values for a UTX line :param newdict: a new dictionary with UTX line elements :type newdict: Dict
625941cc4428ac0f6e5ba8d7
def cle(d,value): <NEW_LINE> <INDENT> for cle, valeur in d.items(): <NEW_LINE> <INDENT> if valeur== value: <NEW_LINE> <INDENT> return cle
fonction qui retourne la clé du dictionnaire d dont la valeur dans le dictionnaire est celle passée en argument. On sait ici qu' elle existe et qu'il n'y en a qu'une grâce au codage de Huffman
625941cc283ffb24f3c559e6
def all(user,permissionsAccepter): <NEW_LINE> <INDENT> user.getRegistry().log("Updating...") <NEW_LINE> for _,repository in user.getRegistry().getRepositories().items(): <NEW_LINE> <INDENT> repository.updateSources() <NEW_LINE> <DEDENT> subuserNames = list(user.getRegistry().getSubusers().keys()) <NEW_LINE> subuserName...
This command updates(if needed) all of the installed subuser images.
625941cc31939e2706e4cf4f
def go_to_line(self, line, word=''): <NEW_LINE> <INDENT> block = self.document().findBlockByNumber(line-1) <NEW_LINE> self.setTextCursor(QTextCursor(block)) <NEW_LINE> if self.isVisible(): <NEW_LINE> <INDENT> self.centerCursor() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.focus_in.connect(self.center_cursor_on_n...
Go to line number *line* and eventually highlight it
625941cc8e71fb1e9831d88e
def add(self, word): <NEW_LINE> <INDENT> current_node = self.root <NEW_LINE> for char in word: <NEW_LINE> <INDENT> current_node = current_node.children[char] <NEW_LINE> <DEDENT> current_node.is_word = True
Add `word` to trie
625941cc9b70327d1c4e0eb9
def get_input_voltage(self, channel): <NEW_LINE> <INDENT> return self.sdk.SBC_GetInputVoltage(self._serial, self._ch(channel))
Gets the analogue input voltage reading. Parameters ---------- channel : :class:`int` The channel number (1 to n). Returns ------- :class:`int` The input voltage 0-32768 corresponding to 0-5V.
625941ccc4546d3d9de72b18
def _reverse(self): <NEW_LINE> <INDENT> for p in self.patches: <NEW_LINE> <INDENT> for h in p.hunks: <NEW_LINE> <INDENT> h.start_src, h.start_tgt = h.start_tgt, h.start_src <NEW_LINE> h.lines_src, h.lines_tgt = h.lines_tgt, h.lines_src <NEW_LINE> for i, line in enumerate(h.text): <NEW_LINE> <INDENT> if line[0] == '+': ...
reverse patch direction (this doesn't touch file_names)
625941cccc40096d61595a35
@click.command(name='datadict-translator') <NEW_LINE> @click.argument('datadicts', type=_PathToDataDictsParamType()) <NEW_LINE> def generate_code(datadicts): <NEW_LINE> <INDENT> PATH_FOR_GENERATED_CODE.mkdir(exist_ok=True) <NEW_LINE> for original, generated in FILE_MAPPING.items(): <NEW_LINE> <INDENT> original = datadi...
Generates PyTUS2000 source code.  Parameters: datadicts: The folder containing all data dictionaries to be translated. Must be in plain text; rtf will fail.
625941cc596a897236089ba5
@celery.task(ignore_result=True) <NEW_LINE> def merge_data(results, ticker, price, granularity, task_id=None): <NEW_LINE> <INDENT> dfs = [] <NEW_LINE> for result in results: <NEW_LINE> <INDENT> if not isinstance(result[0], str): <NEW_LINE> <INDENT> dfs.append(deepcopy(result[0])) <NEW_LINE> <DEDENT> AsyncResult(result[...
Append dataframes into list to be concatenated, de-duplicated and bulk inserted into the database.
625941ccf548e778e58cd662
def function(self, fun, *args, **kwargs): <NEW_LINE> <INDENT> func = self.sminion.functions[fun] <NEW_LINE> args, kwargs = salt.minion.parse_args_and_kwargs(func, args, kwargs) <NEW_LINE> return func(*args, **kwargs)
Call a single salt function
625941cc2eb69b55b151c993
def _validate_unique(self, items): <NEW_LINE> <INDENT> key_val_set = set() <NEW_LINE> for id, item in items.items(): <NEW_LINE> <INDENT> keys = self.UNIQUE_KEY_SETS <NEW_LINE> t = tuple(item[key] for key in keys) <NEW_LINE> if t in key_val_set: <NEW_LINE> <INDENT> self._add_validation_msg(id, 'unique', ('Key combinatio...
Check all items to make sure they are 'unique'. The uniqueness criteria is decided according to the UNIQUE_KEY_SETS. Returns (True, []) if unique, and otherwise False wit h if not.
625941cc4e696a04525c9530
def max_score_column(self, scores): <NEW_LINE> <INDENT> champ = max(scores) <NEW_LINE> matches = [] <NEW_LINE> for elem in range(len(scores)): <NEW_LINE> <INDENT> if scores[elem] == champ: <NEW_LINE> <INDENT> matches += [elem] <NEW_LINE> <DEDENT> <DEDENT> if self.tiebreak == "LEFT": <NEW_LINE> <INDENT> return matches[0...
Takes a list scores containing a score for each column of the board and returns the index of the column with the maximum score
625941cc85dfad0860c3af40
@pytest.mark.parametrize( "desc, kwargs, exp_exc_types, exp_warn_types, condition", TESTCASES_SPLIT_STR_W_ESC) <NEW_LINE> @simplified_test_function <NEW_LINE> def test_split_str_w_esc(testcase, input_str, delimiter, exp_rtn): <NEW_LINE> <INDENT> act_result = list(split_str_w_esc(input_str, delimiter)) <NEW_LINE> assert...
Test function for _common.split_str_w_esc()
625941cc8da39b475bd65059
def test_selected_entity_glob(self): <NEW_LINE> <INDENT> code, out, _ = run_vhdeps('dump', 's*', '-i', DIR + '/simple/filtering') <NEW_LINE> self.assertEqual(code, 0) <NEW_LINE> self.assertEqual(out, '\n'.join([ 'top work 2008 ' + DIR + '/simple/filtering/simulation.sim.vhd', ]) + '\n')
Test toplevel entity selection with fnmatch globs
625941cc32920d7e50b282b5
def test_update_spec_changelog(self): <NEW_LINE> <INDENT> repo = self.init_test_repo('gbp-test') <NEW_LINE> eq_(mock_ch([]), 0) <NEW_LINE> eq_(repo.status(), {' M': ['gbp-test.spec']})
Test updating changelog in spec
625941cc01c39578d7e74f20
def refresh(path, file_pattern): <NEW_LINE> <INDENT> if not os.path.exists(path): <NEW_LINE> <INDENT> logger.debug('Creating folder ' + path) <NEW_LINE> os.mkdir(path) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> logger.debug('Folder ' + path + ' already exists') <NEW_LINE> files2delete = glob.glob(os.path.join(path, ...
Clean and create the folder if this does not exist. :param path: the path containing the files to remove :param file_pattern: the string pattern of the files to remove
625941cc2eb69b55b151c994
def go_bankrupt(self): <NEW_LINE> <INDENT> self.number_of_houses = 0 <NEW_LINE> self.number_of_hotel = 0 <NEW_LINE> for card in self.property: <NEW_LINE> <INDENT> card.owner = None <NEW_LINE> <DEDENT> self.property = [] <NEW_LINE> self.countries = {} <NEW_LINE> self.in_prison = False <NEW_LINE> self.prison_counter = 0 ...
This function is used to free all the cells when player is bankrupt :return: void -> (only change objects)
625941cc9f2886367277a972
def find_ahi_2d(self): <NEW_LINE> <INDENT> plane_pressure_field = np.abs(self.plane_sampling_field.pressure_field) <NEW_LINE> peak_pressure = np.max(plane_pressure_field) <NEW_LINE> haptic_threshold = 2 * np.power(float(10), -5) * np.power(10, 146/20) <NEW_LINE> ret ,thresh_haptic = cv.threshold(plane_pressure_field, ...
DESCRIPTION HERE
625941cc656771135c3eb954
def query(self, limit=4): <NEW_LINE> <INDENT> tupIdxDemand = self.idxDemandModel.findManyAs('index_demand as i_d', { 'fields': ['d.id as demand_id', 'd.title', 'form', 'money', 'time_begin', 'time_end', 'view_count'], 'join': 'demand as d on (i_d.demand_id = d.id)', 'order': 'sort asc', 'limit': ['0', str(limit)] }) <N...
:func: 首页广告需求数据
625941cc5fc7496912cc3a63
def differential_comoving_volume(self, z): <NEW_LINE> <INDENT> dh = self._hubble_distance <NEW_LINE> dm = self.comoving_transverse_distance(z) <NEW_LINE> return dh * (dm ** 2.0) / u.Quantity(self.efunc(z), u.steradian)
Differential comoving volume at redshift z. Useful for calculating the effective comoving volume. For example, allows for integration over a comoving volume that has a sensitivity function that changes with redshift. The total comoving volume is given by integrating differential_comoving_volume to redshift z and multi...
625941cc7b180e01f3dc48e3
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'startup_project_backend.settings') <NEW_LINE> try: <NEW_LINE> <INDENT> from django.core.management import execute_from_command_line <NEW_LINE> <DEDENT> except ImportError as exc: <NEW_LINE> <INDENT> raise ImportError( "Couldn't import Djan...
Run administrative tasks.
625941ccd4950a0f3b08c434
def delete(self): <NEW_LINE> <INDENT> if not self.get("_rev"): <NEW_LINE> <INDENT> raise CloudantException( "Attempting to delete a doc with no _rev. Try running " ".fetch first!" ) <NEW_LINE> <DEDENT> del_resp = self.r_session.delete( self.document_url, params={"rev": self["_rev"]}, ) <NEW_LINE> del_resp.raise_for_sta...
Removes the document from the remote database and clears the content of the locally cached Document object with the exception of the ``_id`` field. In order to successfully remove a document from the remote database, a ``_rev`` value must exist in the locally cached Document object.
625941cc009cb60464c63497
def test_log_dir_for_instance_relative_to_provided_storage_dir(self): <NEW_LINE> <INDENT> config = self.makeFile(content="[foo]") <NEW_LINE> settings = read_config( "carbon-foo", FakeOptions(config=config, instance="x", pidfile=None, logdir=None), ROOT_DIR="foo", STORAGE_DIR="bar") <NEW_LINE> self.assertEqual(join("bar...
Providing a different 'STORAGE_DIR' in defaults overrides the default of being relative to 'ROOT_DIR'. In the case of an instance, the instance name is appended to the directory.
625941cc07d97122c4178970
def file_iter(fname, sep=None): <NEW_LINE> <INDENT> for line in open(fname): <NEW_LINE> <INDENT> if line and line[0] != '#': <NEW_LINE> <INDENT> yield line.split(sep)
This generator iterates over a file and yields its lines splitted via the C{sep} parameter. Skips empty lines and lines starting with the C{#} character. >>> lines = [ line for line in file_iter(__file__) ] >>> len(lines) != 0 True
625941cc377c676e9127228e
def __del__(self): <NEW_LINE> <INDENT> self._shutil.rmtree(self.path)
delete temporary directory when done with it
625941ccd58c6744b4257d45
def _export_with_html(self): <NEW_LINE> <INDENT> self.export_success = False <NEW_LINE> try: <NEW_LINE> <INDENT> tstamp = time.strftime(self.timestamp_format, self._timestamp) <NEW_LINE> substitutions = {} <NEW_LINE> for (basename, ext), entry in self._files.items(): <NEW_LINE> <INDENT> (_, info) = entry <NEW_LINE> htm...
Computes substitions before using nbconvert with preprocessors
625941cc56ac1b37e62642b5
def save(self, fail_silently: bool = False) -> None: <NEW_LINE> <INDENT> send_mail(fail_silently=fail_silently, **self.get_message_dict())
Build and send the email message.
625941cc2c8b7c6e89b358a6
def fit(self, X, y=None): <NEW_LINE> <INDENT> self._fit(X) <NEW_LINE> return self
Build a model of data X. Parameters ---------- X : array [n_samples, n_features] The data to be modelled. y : Ignored Returns ------- self : object Returns the instance itself.
625941ccb5575c28eb68e0e5
def get_cpus(container_name): <NEW_LINE> <INDENT> file_name = cpus_path(container_name) <NEW_LINE> if os.path.exists(file_name): <NEW_LINE> <INDENT> return rangelist_to_set(utils.read_one_line(file_name)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return set()
Get the set of cpus in a container.
625941cccc40096d61595a36
def test_getall(self): <NEW_LINE> <INDENT> disabled_service = 'disabled' <NEW_LINE> enabled_service = 'enabled' <NEW_LINE> service_list = self.__services({disabled_service: [], enabled_service: ['default']}) <NEW_LINE> mock = MagicMock(return_value=service_list) <NEW_LINE> with patch.dict(gentoo_service.__mods__, {'cmd...
Test for Return all available boot services
625941cc31939e2706e4cf50
def get(self, *args): <NEW_LINE> <INDENT> lat, lon = validate_latitude_longitude() <NEW_LINE> storage = get_storage() <NEW_LINE> zones = storage.find_climate_zones(lat, lon) <NEW_LINE> return jsonify(ZoneListSchema(many=True).dump(zones))
--- summary: Find zones description: Find all zones that the given point falls within tags: - Climate Zones parameters: - latitude - longitude responses: 200: description: Sucessfully retrieved zones. content: application/json: schema: type: array items: $ref: '#/...
625941cc8a349b6b435e8258
def get_previous_months(key_date, limit=5, include_current=True, desc=True) -> List[Tuple['date', 'date']]: <NEW_LINE> <INDENT> month_list = [] <NEW_LINE> if include_current: <NEW_LINE> <INDENT> month_list = [get_current_month_range(key_date)] <NEW_LINE> <DEDENT> for i in range(limit): <NEW_LINE> <INDENT> last_month_st...
获取之前月份范围 :param key_date: 判断基准日期 :param limit: 返回之前`limit`个月 :param include_current: 返回值是否包含本月 :param desc: 是否降序排列, 越靠近的排在前面
625941cc004d5f362079a418
def get_next_issue(issues, issue): <NEW_LINE> <INDENT> if len(issues) >= 2: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if issues.index(issue) == 0: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return issues[issues.index(issue) - 1] <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> return None <NEW_LIN...
A lista de números é ordenada pelos números mais recentes para o mais antigos, portanto para retornarmos os números mais novos, devemos caminhar pelo índice do valor maior para o menor, isso justifica no preview subtrai 1 ao índice. param: issues é a lista de issue (deve ser ordenado do número mais recente para o mais...
625941cc4e4d5625662d44bd
def update_0_8_to_0_9(self): <NEW_LINE> <INDENT> print('Updating sort from version 0.8 to 0.9') <NEW_LINE> s = self.sort <NEW_LINE> try: <NEW_LINE> <INDENT> s.filtmeth <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> s.filtmeth = None <NEW_LINE> <DEDENT> s.__version__ = '0.9' <NEW_LINE> print('Done updati...
Update sort 0.8 to 0.9: - add sort.filtmeth attrib, init to None
625941cc5fcc89381b1e17a4
def get_dispatchable_seconds(self): <NEW_LINE> <INDENT> n = datetime.datetime.utcnow() <NEW_LINE> s = self.get_next_recording_start(n) <NEW_LINE> if s is None: <NEW_LINE> <INDENT> return 7 * 24 * 60 * 60 <NEW_LINE> <DEDENT> dd = s - n <NEW_LINE> d = dd.days * 24 * 60 * 60 + dd.seconds <NEW_LINE> r = self._config["akane...
次の録画開始時間までに処理可能な録画済みの動画の長さを返す
625941cc6e29344779a626f7
def scan_csc(self, inst, entry, regs, last_regs, idx, maybe_call=False): <NEW_LINE> <INDENT> if self.paused: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if inst.has_exception and entry.exception != 0 and not maybe_call: <NEW_LINE> <INDENT> if not entry.is_store: <NEW_LINE> <INDENT> return False <NEW_LINE> <DED...
Record the locations where a capability node is stored. This is later used if the capability is loaded again with a clc. The locations where a capability is stored are also saved in the graph. It may happen that a previously unseen register is stored, the value of the register is now known to be valid because it is sto...
625941cc0a366e3fb873e8ff
def mms(seq): <NEW_LINE> <INDENT> maxscore, l, r = 0, 1, 0 <NEW_LINE> rmaxscore, rstart = 0, 1 <NEW_LINE> for i, val in enumerate(seq): <NEW_LINE> <INDENT> if rmaxscore + val > val: <NEW_LINE> <INDENT> rmaxscore += val <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rmaxscore, rstart = val, i <NEW_LINE> <DEDENT> if rmaxs...
Solver for the maximum sub sequence problem. @param seq The sequence to solve the maximum sub sequence for. @return Indices (start, stop) where the sequence is maximus.
625941ccbf627c535bc132b4
def setup_node_nf_type(self): <NEW_LINE> <INDENT> global bess_module_list <NEW_LINE> global p4_module_list, p4_14_module_list <NEW_LINE> bess_node, p4_node = 0, 0 <NEW_LINE> if self.nf_class in bess_module_list: <NEW_LINE> <INDENT> bess_node = 1 <NEW_LINE> <DEDENT> if (self.nf_class in p4_module_list) or (self.nf_class...
This function decides the possible placement choices of this NF: -1, if the module is invalid; 0, if the module is a P4 module; 1, if the module is a BESS module; 2, if the module can be either a P4 module or a BESS module;
625941cc63b5f9789fde71cb
def generate_random_stack(self): <NEW_LINE> <INDENT> for l in range(self.max_models): <NEW_LINE> <INDENT> self.add_model()
creates a random set of models
625941cce5267d203edcdd83
def get_branches_for_service(soa_dir, service): <NEW_LINE> <INDENT> valid_branches = set([]) <NEW_LINE> working_dir = os.path.join(soa_dir, service) <NEW_LINE> for fname in os.listdir(working_dir): <NEW_LINE> <INDENT> if fname.startswith('marathon-') or fname.startswith('chronos-'): <NEW_LINE> <INDENT> valid_branches =...
Get all branches defined in marathon/chronos configuration files for a soa service. :param soa_dir: The SOA configuration directory to read from :param service: The service name to get branches for :returns: A list of branches defined in instances for the service
625941ccf548e778e58cd663
def process_request(request): <NEW_LINE> <INDENT> print("Processing request for "+request['customerEmail']+'.') <NEW_LINE> p = subprocess.call(['/bin/sh',os.path.join(os.getcwd(),'sleeper.sh')],stdout=subprocess.PIPE, stderr=subprocess.STDOUT) <NEW_LINE> return(True)
This requests a row from the table. Usage: process_request(df[row_number])
625941cc24f1403a92600c4c
def show_last_command(command): <NEW_LINE> <INDENT> if command == "start": <NEW_LINE> <INDENT> print("car is already started") <NEW_LINE> <DEDENT> if command == "stop": <NEW_LINE> <INDENT> print("car is already stoped")
To use when the same command was trigger
625941cc187af65679ca5204
def param_cache_update(self): <NEW_LINE> <INDENT> status = self._api.rr_param_cache_update(self._servo) <NEW_LINE> ServoError.handle(status)
The function is always used in combination with the param_cache_setup_entry function. It retrieves from the servo the array of parameters set up using the param_cache_setup_entry function and saves the array to the program cache. You can subsequently read the parameters from the program cache with the read_cached_param...
625941ccff9c53063f47c2d9
def setSortType(self, sort_type): <NEW_LINE> <INDENT> self.header['sort'] = sort_type
Set sort type.
625941cc38b623060ff0aed3
@opcode <NEW_LINE> def UMULL2(cpu_context, instruction): <NEW_LINE> <INDENT> logger.debug("%s instruction not currently implemented.", instruction.mnem)
Unsigned multiply long (vector form)
625941ccbaa26c4b54cb1205
def write(self, fileNameOrDevice, pages, pagesPerRow, speedDialSize): <NEW_LINE> <INDENT> if isinstance(fileNameOrDevice, QIODevice): <NEW_LINE> <INDENT> f = fileNameOrDevice <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> f = QFile(fileNameOrDevice) <NEW_LINE> if not f.open(QFile.WriteOnly): <NEW_LINE> <INDENT> return F...
Public method to write a speed dial data file. @param fileNameOrDevice name of the file to write (string) or device to write to (QIODevice) @param pages list of speed dial pages (list of Page) @param pagesPerRow number of pages per row (integer) @param speedDialSize size of the speed dial pages (integer) @return f...
625941ccd4950a0f3b08c435
def returnTradableBalances(self): <NEW_LINE> <INDENT> return self.__call__('returnTradableBalances')
Returns your current tradable balances for each currency in each market for which margin trading is enabled. Please note that these balances may vary continually with market conditions.
625941cc26238365f5f0ef53
def parse_if_list(if_list_elem, indent, formatted, debug): <NEW_LINE> <INDENT> if not formatted: <NEW_LINE> <INDENT> indent = 0 <NEW_LINE> <DEDENT> if debug: <NEW_LINE> <INDENT> spaces = "".ljust(indent) <NEW_LINE> print(f"{spaces}--if-list--") <NEW_LINE> print(objectify.dump(if_list_elem)) <NEW_LINE> <DEDENT> ifname =...
parse an if-list
625941cc711fe17d82542452
def delete(self, paths): <NEW_LINE> <INDENT> if isgenerator(paths): <NEW_LINE> <INDENT> paths = list(paths) <NEW_LINE> <DEDENT> pathsAndOperations = [(path, Operation.DELETE_NAMESPACE) for path in paths] <NEW_LINE> deniedOperations = checkPermissions(self._user, pathsAndOperations) <NEW_LINE> if deniedOperations: <NEW_...
See L{NamespaceAPI.delete}. @raise PermissionDeniedError: Raised if the user is not authorized to delete a given L{Namespace}.
625941ccd99f1b3c44c67674
def wait_for_any_log(nodes, pattern, timeout, filename='system.log'): <NEW_LINE> <INDENT> for _ in range(timeout): <NEW_LINE> <INDENT> for node in nodes: <NEW_LINE> <INDENT> found = node.grep_log(pattern, filename=filename) <NEW_LINE> if found: <NEW_LINE> <INDENT> return node <NEW_LINE> <DEDENT> <DEDENT> time.sleep(1) ...
Look for a pattern in the system.log of any in a given list of nodes. @param nodes The list of nodes whose logs to scan @param pattern The target pattern @param timeout How long to wait for the pattern. Note that strictly speaking, timeout is not really a timeout, but a maximum number of...
625941cc3eb6a72ae02ec5c2
def lySequentialMusicFromStream(self, streamIn, beforeMatter=None): <NEW_LINE> <INDENT> musicList = [] <NEW_LINE> lpMusicList = lyo.LyMusicList(contents=musicList) <NEW_LINE> lpSequentialMusic = lyo.LySequentialMusic(musicList=lpMusicList, beforeMatter=beforeMatter) <NEW_LINE> self.newContext(lpMusicList) <NEW_LINE> se...
returns a LySequentialMusic object from a stream >>> c = converter.parse('tinynotation: 3/4 C4 D E F2.') >>> lpc = lily.translate.LilypondConverter() >>> lySequentialMusicOut = lpc.lySequentialMusicFromStream(c) >>> lySequentialMusicOut <music21.lily.lilyObjects.LySequentialMusic object at 0x...> >>> print(lySequentia...
625941cc0a366e3fb873e900
def simps_2d(xd,yd,fd): <NEW_LINE> <INDENT> if np.iscomplexobj(fd): <NEW_LINE> <INDENT> return simps_2d(xd, yd, fd.real) + 1j*simps_2d(xd, yd, fd.imag) <NEW_LINE> <DEDENT> xData = np.zeros(len(xd)) <NEW_LINE> for i,x in enumerate(xd): <NEW_LINE> <INDENT> xData[i] = simps(fd[i,:], yd) <NEW_LINE> <DEDENT> return simps(xD...
1d simpsons rule extended to 2d
625941ccd58c6744b4257d46
def merge(line): <NEW_LINE> <INDENT> line_length = len(line) <NEW_LINE> merge_line_result = [] <NEW_LINE> zero_list_holder = [] <NEW_LINE> for count in line: <NEW_LINE> <INDENT> if count != 0: <NEW_LINE> <INDENT> merge_line_result.append(count) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> zero_list_holder.append(count...
Helper function that merges a single row or column in 2048
625941cc1d351010ab855c01
def prevent_core_dump(): <NEW_LINE> <INDENT> core_resource = resource.RLIMIT_CORE <NEW_LINE> try: <NEW_LINE> <INDENT> resource.getrlimit(core_resource) <NEW_LINE> <DEDENT> except ValueError as exc: <NEW_LINE> <INDENT> raise DaemonOSEnvironmentError('System does not support RLIMIT_CORE resource limit ({!s})'.format(exc)...
Prevent this process from generating a core dump. Sets the soft and hard limits for core dump size to zero. On Unix, this prevents the process from creating core dump altogether.
625941cce5267d203edcdd84
def _model_params2table(self, fit_model, star_group_size): <NEW_LINE> <INDENT> param_tab = Table() <NEW_LINE> for param_tab_name in self._pars_to_output.keys(): <NEW_LINE> <INDENT> param_tab.add_column(Column(name=param_tab_name, data=np.empty(star_group_size))) <NEW_LINE> <DEDENT> if star_group_size > 1: <NEW_LINE> <I...
Place fitted parameters into an astropy table. Parameters ---------- fit_model : `astropy.modeling.Fittable2DModel` instance PSF or PRF model to fit the data. Could be one of the models in this package like `~photutils.psf.sandbox.DiscretePRF`, `~photutils.psf.IntegratedGaussianPRF`, or any other suita...
625941cc07d97122c4178971
def all_longOnly_strategy(data, columns=['Open', 'Close']): <NEW_LINE> <INDENT> daily = (data[columns[1]][1:] - data[columns[0]][1:]) / data[columns[0]][1:] <NEW_LINE> cumsum_PL = daily.cumsum() <NEW_LINE> return daily, cumsum_PL
Calculate cumulative daily profit-and-loss (P&L) using all long-only strategy.
625941cc94891a1f4081bb8f
def oxford_read_all_temperatures(self): <NEW_LINE> <INDENT> temperature_table='' <NEW_LINE> for idx,label in enumerate(self.oxford_temperature_labels): <NEW_LINE> <INDENT> if not label=='NOT USED': <NEW_LINE> <INDENT> chan=idx+1 <NEW_LINE> val=self.oxford_read_temperature(chan) <NEW_LINE> if val is None: <NEW_LINE> <IN...
read all the temperatures from the dilution fridge
625941cc82261d6c526ab585
def manage_create_prev(self, maxx=0, maxy=0, ratio=0, REQUEST=None): <NEW_LINE> <INDENT> maxx, maxy = self._formatDimensions(maxx, maxy) <NEW_LINE> if maxx!=0 and maxy!=0: <NEW_LINE> <INDENT> self._register() <NEW_LINE> try: <NEW_LINE> <INDENT> new_fn = self._get_ufn(self.prev_filename, content_type='image/jpeg') <NEW_...
Create a preview Image
625941ccf8510a7c17cf97e2
def test_records(): <NEW_LINE> <INDENT> app_auth = test_app_admin_token_passwd() <NEW_LINE> six.print_("now let's records module testing") <NEW_LINE> success, result = export_chat_message(app_auth) <NEW_LINE> six.print_(result) <NEW_LINE> return success, result
测试ease_records模块.
625941cce1aae11d1e749d9d
def add_host(self, host, use_regex = None): <NEW_LINE> <INDENT> self.host[host] = use_regex
Add host to VHost host dict.
625941ccab23a570cc250268
def productFromFilename(self, fname): <NEW_LINE> <INDENT> fname = os.path.basename(fname) <NEW_LINE> if fname.endswith(self.extension): <NEW_LINE> <INDENT> fname = fname[:-1*len(self.extension)] <NEW_LINE> <DEDENT> out = fname.split('-', 1) <NEW_LINE> if len(out) < 2: <NEW_LINE> <INDENT> out.append(None) <NEW_LINE> <DE...
return a tuple-pair containing the product name and version that the file with the given manifest filename describes. It assumes the filename is of the form, "product-version.manifest". The trailing ".manifest" extension is optional. The version (the second element) will be None if the name does not encode a vers...
625941cc07f4c71912b11568
def get_native(self): <NEW_LINE> <INDENT> return self._obj
Get native object from the low level API :return: :class:`pcbnew.PAD`
625941ccf8510a7c17cf97e3