code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def fallback(self, key): <NEW_LINE> <INDENT> return self._fallback(key)
Key is not found
625941cf1f5feb6acb0c4ca6
def validate(self, data): <NEW_LINE> <INDENT> patient = self.context['patient'] <NEW_LINE> first_visit = Visit.objects.filter( patient=patient, type_visit='first' ) <NEW_LINE> if not first_visit: <NEW_LINE> <INDENT> raise serializers.ValidationError( 'first visit is required to create complement info.' ) <NEW_LINE> <DE...
Check if first visit is already taken by patient.
625941cf23849d37ff7b31e5
def _data_tooltip ( self, row, column, screen_row ): <NEW_LINE> <INDENT> adapter = self._editor.grid_adapter <NEW_LINE> tooltip = adapter.get_tooltip( row, column ) <NEW_LINE> if (tooltip == '') and adapter.get_auto_tooltip( row, column ): <NEW_LINE> <INDENT> tooltip = adapter.get_text( row, column ) <NEW_LINE> <DEDENT...
Returns the tooltip to use.
625941cf0a366e3fb873e971
def Hill_estimator(data): <NEW_LINE> <INDENT> Y = np.sort(data) <NEW_LINE> n = len(Y) <NEW_LINE> Hill_est = np.zeros(n-1) <NEW_LINE> for k in range(0, n-1): <NEW_LINE> <INDENT> summ = 0 <NEW_LINE> for i in range(0,k+1): <NEW_LINE> <INDENT> summ += np.log(Y[n-1-i]) - np.log(Y[n-2-k]) <NEW_LINE> <DEDENT> Hill_est[k] = (1...
Returns the Hill Estimators for some 1D data set.
625941cf090684286d50ee3c
def main_launch(): <NEW_LINE> <INDENT> initlogging() <NEW_LINE> parser = ArgumentParser() <NEW_LINE> parser.add_argument('--build', action = 'store_true', help = 'rebuild native components') <NEW_LINE> args = parser.parse_args() <NEW_LINE> info = ProjectInfo.seekany('.') <NEW_LINE> _, objref = next(iter(info.console_sc...
Run project using a suitable venv from the pool.
625941cfcb5e8a47e48b7c00
def get_preferences_for_record(self, record_id): <NEW_LINE> <INDENT> if record_id not in self.record_session_mat: <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> return self.record_session_mat[record_id]
Retrieves the preferences for the record
625941cfdd821e528d63b2ff
def call_strategy_func( self, strategy: CtaTemplate, func: Callable, params: Any = None ): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if params: <NEW_LINE> <INDENT> func(params) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> func() <NEW_LINE> <DEDENT> <DEDENT> except Exception: <NEW_LINE> <INDENT> strategy.trading = F...
Call function of a strategy and catch any exception raised.
625941cfd6c5a102081441a1
def _init_control_panel(self, gamestate): <NEW_LINE> <INDENT> self.ant_type_selected = None <NEW_LINE> self.ant_type_frames = [] <NEW_LINE> panel_pos = PANEL_POS <NEW_LINE> for name, ant_type in gamestate.ant_types.items(): <NEW_LINE> <INDENT> width = ANT_IMAGE_WIDTH + 2 * PANEL_PADDING[0] <NEW_LINE> height = ANT_IMAGE...
Construct the control panel of available ant types.
625941cf460517430c3942da
def beautify(self): <NEW_LINE> <INDENT> thread = ExecSassCommand( self.get_cmd(), self.get_env(), self.get_text() ) <NEW_LINE> thread.start() <NEW_LINE> self.check_thread(thread)
Runs the sass beautify command.
625941cfcc0a2c11143dcfe7
def generateScheme(self, component: Component) -> Tuple[Component, ...]: <NEW_LINE> <INDENT> for root in self.componentRoot.values(): <NEW_LINE> <INDENT> fragmentBins = Sequential.generateSliceBinaries(component, root) <NEW_LINE> for fragmentBin in fragmentBins: <NEW_LINE> <INDENT> component.binaryDict[fragmentBin] = r...
找出部件在根集中的所有可行组合。 :param component: 待组合的部件 :returns: 最优拆分组合,根用切片二进制数表示。
625941cf7d847024c06be412
def call_view_function(self): <NEW_LINE> <INDENT> parser = self._get_command_parser(self.call_view_function.__doc__) <NEW_LINE> self._add_transaction_args(parser) <NEW_LINE> parser.add_argument('contract_name', type=str) <NEW_LINE> parser.add_argument('function_name', type=str) <NEW_LINE> parser.add_argument('--args', ...
Call a view function on a smart contract
625941cf7d847024c06be413
def add_relation_task(self, task): <NEW_LINE> <INDENT> self.relation_task.append(task)
Record task in broker.
625941cf009cb60464c63507
def in_units(self, unit): <NEW_LINE> <INDENT> cpy = copy.copy(self) <NEW_LINE> if hasattr(cpy.data, '__mul__'): <NEW_LINE> <INDENT> cpy.data = unit_conversion.convert(cpy.units, unit, cpy.data) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> warnings.warn('Data was not converted to new units and ' 'was not copied because...
Returns a full cpy of this property in the units specified. WARNING: This will cpy the data of the original property! :param units: Units to convert to :type units: string :return: Copy of self converted to new units :rtype: Same as self
625941cfb7558d58953c506a
def back_to_cwl_job(self, prefix: Path = None): <NEW_LINE> <INDENT> formatted = {} <NEW_LINE> for k, v in self.cleaned_data.items(): <NEW_LINE> <INDENT> type_ = self.types[k] <NEW_LINE> if type_ in ('Directory', 'File'): <NEW_LINE> <INDENT> formatted[k] = {'class': type_, 'path': v} <NEW_LINE> <DEDENT> elif type_ == 'b...
Prepares the cleaned form data for serialisation to a job file.
625941cf10dbd63aa1bd2cfa
def AROONOSC_talib(self, ndays=10): <NEW_LINE> <INDENT> real = ta.AROONOSC(self.high, self.low, timeperiod=ndays) <NEW_LINE> attr_name = "AROONOSC" + str(ndays) <NEW_LINE> attr_value = real <NEW_LINE> return real
:param ndays: :return:
625941cf38b623060ff0af44
def full(points, t): <NEW_LINE> <INDENT> for i in range(len(points) - 1): <NEW_LINE> <INDENT> points = step(points, t) <NEW_LINE> <DEDENT> return points
Implementation of the full de Casteljau algorithm :param points: list of n-dimensional points represented as lists or tuples :param t: de Casteljau scaling parameter :return: the remaining point after a full run
625941cfcc40096d61595aa7
def delete(self, **kwargs): <NEW_LINE> <INDENT> response = self.api.delete('/audit', params=kwargs) <NEW_LINE> return DeletedResponse(**response)
Delete (some) of the AuditLogs. :param kwargs: Filter fields, 'before' is a required parameter, while 'creator_name' and 'execution_id' are optional. :return: DeletedResponse describing deletion outcome - a number of 'deleted' records.
625941cf99fddb7c1c9de4e7
def performJob(self, job): <NEW_LINE> <INDENT> return JobItem.ultimatelyPerform(self.txnFactory, job)
Perform the given job right now.
625941cf30c21e258bdfa5f4
def __getitem__(self, row): <NEW_LINE> <INDENT> return self.values[row]
accesses the row at the specified index
625941cfa05bb46b383ec978
def test_forward_minimum(): <NEW_LINE> <INDENT> def check_minimum(lh_shape, rh_shape, dtype): <NEW_LINE> <INDENT> tf.reset_default_graph() <NEW_LINE> lh_data = np.random.uniform(size=lh_shape).astype(dtype) <NEW_LINE> rh_data = np.random.uniform(size=rh_shape).astype(dtype) <NEW_LINE> with tf.Graph().as_default(): <NEW...
test Op Minimum
625941cf6fece00bbac2d895
def testCubePlugin(self): <NEW_LINE> <INDENT> def makeCubes(self,length): <NEW_LINE> <INDENT> def _singleCube(pnt): <NEW_LINE> <INDENT> return Solid.makeBox(length,length,length,pnt) <NEW_LINE> <DEDENT> return self.eachpoint(_singleCube,True) <NEW_LINE> <DEDENT> Workplane.makeCubes = makeCubes <NEW_LINE> result = Workp...
Tests a plugin that combines cubes together with a base :return:
625941cf9c8ee82313fbb8cc
def spray_hit(ai_settings, screen, stats, sb, spray, cats, bullets): <NEW_LINE> <INDENT> if stats.sprays_left > 0: <NEW_LINE> <INDENT> stats.sprays_left -= 1 <NEW_LINE> sb.prep_sprays() <NEW_LINE> cats.empty() <NEW_LINE> bullets.empty() <NEW_LINE> create_fleet(ai_settings, screen, spray, cats) <NEW_LINE> spray.center_s...
Обрабатывает столкновение пульвика с котами.
625941cf009cb60464c63508
def test_signup_with_key(self): <NEW_LINE> <INDENT> self.signup_form('key')
test signup with enter.
625941cfbe383301e01b55db
@pytest.mark.parametrize("string, delimiter, expected", [ ("a,b,c,d", ",", ['a', 'b', 'c', 'd']), ("a.b.c.d", ".", ['a', 'b', 'c', 'd']), ("azbzczd", "z", ['a', 'b', 'c', 'd']), ]) <NEW_LINE> def test_delimited_string_to_list_with_different_delimiters(string, delimiter, expected): <NEW_LINE> <INDENT> assert string_util...
Using parametrized function above to test function with different types of delimiters.
625941cfbf627c535bc13325
def create_addon_coupon_with_http_info(self, body, addon_id, **kwargs): <NEW_LINE> <INDENT> all_params = ['body', 'addon_id', '_with'] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_...
Create an addon coupon # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_addon_coupon_with_http_info(body, addon_id, async_req=True) >>> result = thread.get() :param async_req bool :param AddonCoupon body: (r...
625941cf6aa9bd52df036efb
def post(self, request): <NEW_LINE> <INDENT> serializer = employeeSerializer(data=request.data) <NEW_LINE> if serializer.is_valid(): <NEW_LINE> <INDENT> name = serializer.data.get('firstname') <NEW_LINE> message = 'Hello {0}'.format(name) <NEW_LINE> return Response({'message' : message}) <NEW_LINE> <DEDENT> else: <NEW_...
Post new Employees
625941cfbde94217f3682f47
def best_buddies(self, p_i, p_i_side): <NEW_LINE> <INDENT> return self._piece_distance_info[p_i].best_buddies(p_i_side)
Gets the best buddy information (if any) for a specified piece's side Args: p_i (int): Identification number of the piece who best buddy information is to be retrieved p_i_side (PuzzlePieceSide): Side of piece whose best buddy is being retrieved Returns (List[int]): List of best buddy piece id numbers
625941cfb545ff76a8913f6c
def testExternalSystemCreate(self): <NEW_LINE> <INDENT> es1 = ExternalSystem(name='testESNameCreate', url='http://testcreate.com', description="a test system") <NEW_LINE> r = self.es_rh.create(es1)[0] <NEW_LINE> self.assertTrue(r.get('success'))
Try creating an ExternalSystem
625941cf7047854f462a1560
def pytest_sessionstart(self, session): <NEW_LINE> <INDENT> import cov_core <NEW_LINE> cov_source = session.config.getvalue('cov_source') <NEW_LINE> cov_report = session.config.getvalue('cov_report') or ['term'] <NEW_LINE> cov_config = session.config.getvalue('cov_config') <NEW_LINE> session_name = session.__class__.__...
At session start determine our implementation and delegate to it.
625941cf16aa5153ce3625ce
def test_mixed_strand_dna_multi_join(self): <NEW_LINE> <INDENT> s = Seq("AAAAACCCCCTTTTTGGGGG", generic_dna) <NEW_LINE> f1 = SeqFeature(FeatureLocation(5, 10), strand=+1) <NEW_LINE> f2 = SeqFeature(FeatureLocation(12, 15), strand=-1) <NEW_LINE> f3 = SeqFeature(FeatureLocation(BeforePosition(0), 5), strand=+1) <NEW_LINE...
Feature on DNA (multi-join, mixed strand).
625941cfad47b63b2c50a0d6
def _get_pi_revision(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> f = open('/proc/cpuinfo','r') <NEW_LINE> for line in f: <NEW_LINE> <INDENT> if line.startswith('Revision'): <NEW_LINE> <INDENT> if line[11:-1] in self.RPI_REVISION_0: <NEW_LINE> <INDENT> return '0' <NEW_LINE> <DEDENT> elif line[11:-1] in self.RPI_...
Gets the version number of the Raspberry Pi board
625941cf91af0d3eaac9bb70
def get_phrase(context, wordss, span): <NEW_LINE> <INDENT> start, stop = span <NEW_LINE> flat_start = get_flat_idx(wordss, start) <NEW_LINE> flat_stop = get_flat_idx(wordss, stop) <NEW_LINE> words = sum(wordss, []) <NEW_LINE> char_idx = 0 <NEW_LINE> char_start, char_stop = None, None <NEW_LINE> for word_idx, word in en...
Obtain phrase as substring of context given start and stop indices in word level :param context: :param wordss: :param start: [sent_idx, word_idx] :param stop: [sent_idx, word_idx] :return:
625941cf0a50d4780f666fe9
def delete(endpoint, _id=None, get_info=_get_required_info): <NEW_LINE> <INDENT> kwargs = {'_id': _id, 'get_info': get_info} <NEW_LINE> return request('DELETE', endpoint, **kwargs)
Send a DELETE HTTP request to the FarmBot Web App. Args: endpoint (str): FarmBot Web App endpoint. _id (int, optional): ID of a resource to DELETE. Defaults to None.
625941cf16aa5153ce3625cf
def set(omega_m): <NEW_LINE> <INDENT> c._cosmology_set(omega_m)
Set omega_m Args: omega_m: cosmological matter density Omega_m(z=0)
625941cf711fe17d825424c2
def create_speech_rir(audios, rir, lengths_audios, max_len, batch_size): <NEW_LINE> <INDENT> speech_rir = [] <NEW_LINE> for i in range(batch_size): <NEW_LINE> <INDENT> s1 = lengths_audios[i] <NEW_LINE> s2 = tf.convert_to_tensor(tf.shape(rir)) <NEW_LINE> shape = s1 + s2 - 1 <NEW_LINE> sp1 = tf.spectral.rfft(rir, shape) ...
Returns: A tensor of speech with reverberations (Convolve the audio with the rir)
625941cfe76e3b2f99f3a961
@register.assignment_tag(takes_context=True) <NEW_LINE> def get_page_object_by_name(context, name): <NEW_LINE> <INDENT> selected_object = None <NEW_LINE> try: <NEW_LINE> <INDENT> for obj_type in context['page']['content']: <NEW_LINE> <INDENT> for obj in context['page']['content'][obj_type]: <NEW_LINE> <INDENT> if obj.n...
**Arguments** ``name` name for object selection :return selected object
625941cf56b00c62f0f147b0
def analyze(self, historical_data, period_count=14, signal=['rsi'], hot_thresh=None, cold_thresh=None): <NEW_LINE> <INDENT> dataframe = self.convert_to_dataframe(historical_data) <NEW_LINE> rsi_values = abstract.RSI(dataframe, period_count).to_frame() <NEW_LINE> rsi_values.dropna(how='all', inplace=True) <NEW_LINE> rsi...
Performs an RSI analysis on the historical data Args: historical_data (list): A matrix of historical OHCLV data. period_count (int, optional): Defaults to 14. The number of data points to consider for our RSI. signal (list, optional): Defaults to rsi. The indicator line to check hot/cold ag...
625941cf85dfad0860c3afb2
def tsne(X=Math.array([]), no_dims=2, initial_dims=50, perplexity=30.0, print_progress_every=None): <NEW_LINE> <INDENT> if isinstance(no_dims, float): <NEW_LINE> <INDENT> print("Error: array X should have type float.") <NEW_LINE> return -1 <NEW_LINE> <DEDENT> if round(no_dims) != no_dims: <NEW_LINE> <INDENT> print("Err...
Runs t-SNE on the dataset in the NxD array X to reduce its dimensionality to no_dims dimensions. The syntaxis of the function is Y = tsne.tsne(X, no_dims, perplexity), where X is an NxD NumPy array.
625941cf21bff66bcd684aa9
def selection(self, chrom, ): <NEW_LINE> <INDENT> assert len(chrom[0].shape) >= 2, "input chromosome is binary encoded" <NEW_LINE> _fitness = self.fitness(chrom) <NEW_LINE> method = self.sel <NEW_LINE> if method == 'Roulette': <NEW_LINE> <INDENT> _fitness = _fitness - _fitness.min() + 1e-8 <NEW_LINE> sum_fitness = np.s...
Select chromosomes using Roulette or Tournament :param chrom: chromosomes before selection :return: selected chromosomes
625941cf090684286d50ee3d
def psf_convolve(data, psf, psf_rot=False, psf_type='fixed', method='astropy'): <NEW_LINE> <INDENT> if psf_type not in ('fixed', 'obj_var'): <NEW_LINE> <INDENT> raise ValueError('Invalid PSF type. Options are "fixed" or "obj_var"') <NEW_LINE> <DEDENT> if psf_rot and psf_type == 'fixed': <NEW_LINE> <INDENT> psf = rotate...
Convolve data with PSF This method convolves an image with a PSF Parameters ---------- data : np.ndarray Input data array, normally an array of 2D images psf : np.ndarray Input PSF array, normally either a single 2D PSF or an array of 2D PSFs psf_rot: bool Option to rotate PSF by 180 degrees psf_type ...
625941cfd164cc6175782ea5
def _post_validate_register(self, attr, value, templar): <NEW_LINE> <INDENT> return value
Override post validation for the register args field, which is not supposed to be templated
625941cf26068e7796caee37
def __init__(self, pkl): <NEW_LINE> <INDENT> if isinstance(pkl, str) and pkl.endswith(".pkl"): <NEW_LINE> <INDENT> self.func = joblib.load(pkl) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.func = pkl
Two methods of initializing, either with a pkl file or with the _f_dist attribute
625941cf60cbc95b062c669b
def __init__(self, master, loglevel=logging.INFO): <NEW_LINE> <INDENT> self.master = master <NEW_LINE> self.frame = tk.Frame(self.master) <NEW_LINE> logging.basicConfig() <NEW_LINE> self._logger = logging.getLogger(self._loggername) <NEW_LINE> self._logger.setLevel(loglevel) <NEW_LINE> self.init_window() <NEW_LINE> sel...
Base class for auxiliary windows (for DRY code).
625941cf82261d6c526ab5f7
def trim(word): <NEW_LINE> <INDENT> if word not in stop_words: <NEW_LINE> <INDENT> str1 = "" <NEW_LINE> for c in word: <NEW_LINE> <INDENT> if c in stop_punctuation: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> str1 += c <NEW_LINE> <DEDENT> <DEDENT> return str1
Helper Function to handle Punctuation.
625941cfe8904600ed9f2085
def forward(self, x: torch.Tensor, return_full_list=False, clip_grad=False, prop_limit=None): <NEW_LINE> <INDENT> def _clip_grad(v, min, max): <NEW_LINE> <INDENT> v_tmp = v.expand_as(v) <NEW_LINE> v_tmp.register_hook(lambda g: g.clamp(min, max)) <NEW_LINE> return v_tmp <NEW_LINE> <DEDENT> out = [] <NEW_LINE> for i, lay...
Forward pass Args: x: Input. return_full_list: Optional, returns all layer outputs. Returns: torch.Tensor or list of torch.Tensor.
625941cf50485f2cf553cef1
def loadModules(modulesdir: str): <NEW_LINE> <INDENT> logger.debug("Loading modules from " + modulesdir) <NEW_LINE> for i in util.get_immediate_subdirectories(modulesdir): <NEW_LINE> <INDENT> loadModule(os.path.join(modulesdir, i), util.unurl(i)) <NEW_LINE> <DEDENT> for i in os.listdir(modulesdir): <NEW_LINE> <INDENT> ...
Load all modules in the given folder to RAM.
625941cf796e427e537b071e
def ono_parse(word, output='', **keywords): <NEW_LINE> <INDENT> if isinstance(word, text_type): <NEW_LINE> <INDENT> tokens = ipa2tokens(word, **keywords) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> tokens = [x for x in word] <NEW_LINE> <DEDENT> syllabified = syllabify(tokens) <NEW_LINE> prostring = prosodic_string(to...
Carry out a rough onset-nucleus-offset parse of a word in IPA. Notes ----- Method is an approximation and not supposed to do without flaws. It is, however, rather helpful in most instances. It defines a so far simple model in which 7 different contexts for each word are distinguished: * "#": onset cluster in a word's...
625941cf30bbd722463cbf1d
def jsonify(data, status_code=200): <NEW_LINE> <INDENT> res = flask_jsonify(data) <NEW_LINE> res.status_code = status_code <NEW_LINE> return res
Convenience function to serialize a dict/list structure into a Response object and directly append a status code to it. :param data: a dictionary or list object to include in the Response. :param int status_code: (Optional) The intended status code for the Response. 200 by default. :return: Flask Response object ready...
625941cf1d351010ab855c73
def pub_img(): <NEW_LINE> <INDENT> global stamp <NEW_LINE> pipe = rs.pipeline() <NEW_LINE> config = rs.config() <NEW_LINE> width = 640; height = 480; <NEW_LINE> config.enable_stream(rs.stream.depth, width, height, rs.format.z16, 30) <NEW_LINE> config.enable_stream(rs.stream.color, width, height, rs.format.rgb8, 30) <NE...
Callback function of subscribed topic. Here images get converted and features detected
625941cf627d3e7fe0d68fa7
@notimplemented <NEW_LINE> def p_cmdexpr_appendpipe(p): <NEW_LINE> <INDENT> pass
cmdexpr : APPENDPIPE | APPENDPIPE arglist | APPENDPIPE MACRO
625941cf8c3a873295158513
def testDateSearch(self): <NEW_LINE> <INDENT> c = self.principal.make_calendar(name="Yep", cal_id=testcal_id) <NEW_LINE> assert_not_equal(c.url, None) <NEW_LINE> e = c.add_event(ev1) <NEW_LINE> r = c.date_search(datetime(2006,7,13,17,00,00), datetime(2006,7,15,17,00,00)) <NEW_LINE> assert_equal(e.instance.vevent.uid, r...
Verifies that date search works with a non-recurring event Also verifies that it's possible to change a date of a non-recurring event
625941cfcdde0d52a9e5318b
def __init__(self, opener, dir='', dirlogcache=None): <NEW_LINE> <INDENT> cachesize = 4 <NEW_LINE> usetreemanifest = False <NEW_LINE> usemanifestv2 = False <NEW_LINE> opts = getattr(opener, 'options', None) <NEW_LINE> if opts is not None: <NEW_LINE> <INDENT> cachesize = opts.get('manifestcachesize', cachesize) <NEW_LIN...
The 'dir' and 'dirlogcache' arguments are for internal use by manifest.manifest only. External users should create a root manifest log with manifest.manifest(opener) and call dirlog() on it.
625941cf5fdd1c0f98dc038b
def denoise2(pixel): <NEW_LINE> <INDENT> r,g,b = pixel <NEW_LINE> return (0, int(b*20), int(g*20)) <NEW_LINE> pass
take noise out of a pixel
625941cf63d6d428bbe44647
def install_packages(packages): <NEW_LINE> <INDENT> Avalon.warning('If the installation is unsuccessful, you should consider updating the package manager cache', log=False) <NEW_LINE> if len(packages) > 1: <NEW_LINE> <INDENT> packages_string = ' '.join(packages) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> packages_st...
Install a package using system package manager This method is currently using os.system instead of subprocess.run or subprocess.Popen because subprocess doesn't seem to handle some of the TUIs well.
625941cf8e05c05ec3eea4cd
def setUp(self): <NEW_LINE> <INDENT> self.original_get_soup = steam_market.get_soup <NEW_LINE> steam_market.get_soup = get_constant_soup
Replace the get_soup function with our constant one
625941cfd486a94d0b98e29d
def url2domain(url): <NEW_LINE> <INDENT> parsed_uri = urlparse.urlparse(url) <NEW_LINE> domain = '{uri.netloc}'.format(uri=parsed_uri) <NEW_LINE> domain = re.sub("^.+@", "", domain) <NEW_LINE> domain = re.sub(":.+$", "", domain) <NEW_LINE> return domain
extract domain from url
625941cfdc8b845886cb568d
def Rzyx(hx, hy, hz): <NEW_LINE> <INDENT> return np.array( [[ cos(hy)*cos(hz), cos(hz)*sin(hx)*sin(hy) - cos(hx)*sin(hz), sin(hx)*sin(hz) + cos(hx)*cos(hz)*sin(hy)], [ cos(hy)*sin(hz), cos(hx)*cos(hz) + sin(hx)*sin(hy)*sin(hz), cos(hx)*sin(hy)*sin(hz) - cos(hz)*sin(hx)], [ -sin(hy), cos...
From ETH, Flying Inverted Pendulum Rzyx = Rz(hz) * Ry(hy) * Rx(hx) Rzyx = Rz(yaw) * Ry(pitch) * Rx(roll)
625941cf097d151d1a222fb1
def schedule(func, time, channel="default"): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _jobs[channel].stop() <NEW_LINE> <DEDENT> except (AttributeError, KeyError): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> timer = QtCore.QTimer() <NEW_LINE> timer.setSingleShot(True) <NEW_LINE> timer.timeout.connect(func) <NEW_LIN...
Run `func` at a later `time` in a dedicated `channel` Given an arbitrary function, call this function after a given timeout. It will ensure that only one "job" is running within the given channel at any one time and cancel any currently running job if a new job is submitted before the timeout.
625941cfde87d2750b85feeb
def IMDb(accessSystem=None, *arguments, **keywords): <NEW_LINE> <INDENT> if accessSystem is None or accessSystem in ('auto', 'config'): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> cfg_file = ConfigParserWithCase(*arguments, **keywords) <NEW_LINE> kwds = cfg_file.getDict('imdbpy') <NEW_LINE> if 'accessSystem' in kwds: ...
Return an instance of the appropriate class. The accessSystem parameter is used to specify the kind of the preferred access system.
625941cf4d74a7450ccd431b
def freeze_model_instance(obj:object) -> FrozenObj: <NEW_LINE> <INDENT> model_cls = obj.__class__ <NEW_LINE> try: <NEW_LINE> <INDENT> obj = model_cls.objects.get(pk=obj.pk) <NEW_LINE> <DEDENT> except model_cls.DoesNotExist: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> typename = get_typename_for_model_class(mode...
Creates a new frozen object from model instance. The freeze process consists on converting model instances to hashable plain python objects and wrapped into FrozenObj.
625941cfd18da76e2353262e
def baseColor( self ): <NEW_LINE> <INDENT> return self._baseColor
Returns the color to be used for the primary background. :return <QColor>
625941cf45492302aab5e41b
def update(self): <NEW_LINE> <INDENT> old = self.stat <NEW_LINE> new = self.readStat() <NEW_LINE> perc = self.calcPerc(self.index, old, new) <NEW_LINE> self.system = self.calcSystem(self.index, old, new) <NEW_LINE> self.niced = self.calcNiced(self.index, old, new) <NEW_LINE> self.set_completion(perc) <NEW_LINE> self.st...
Calculates cpu percentage
625941cf8e7ae83300e4b124
def test_get_certificate_arn_exact_match(self): <NEW_LINE> <INDENT> self.assertEqual(TEST_CERTIFICATE_ARN_ACM_EXACT, self.disco_acm.get_certificate_arn(TEST_DOMAIN_NAME), 'Exact matching of host domain name to cert domain needs to be fixed.')
exact match between the host and cert work e.g. a.b.c matches a.b.c
625941cfac7a0e7691ed4223
def b_create_glow_texture_properties(b_mat_texslot): <NEW_LINE> <INDENT> b_mat_texslot.use_map_color_diffuse = False <NEW_LINE> b_mat_texslot.texture.use_alpha = False <NEW_LINE> b_mat_texslot.use_map_emit = True
Sets the textureslot settings for using a glow map
625941cf45492302aab5e41c
def make_ready(self, dc, *args, **kwargs) -> None: <NEW_LINE> <INDENT> self.rgb_components = cast(MutableMapping[str, Union[None, Callable, LINEAR_COMP_DICT]], {}) <NEW_LINE> for band, component in self.raw_rgb_components.items(): <NEW_LINE> <INDENT> if not component or callable(component): <NEW_LINE> <INDENT> self.rgb...
Second-phase (db aware) initialisation Mostly sorting out bands, esp flag bands. :param dc: A datacube object
625941cf566aa707497f46bf
def get_double(self, n=1): <NEW_LINE> <INDENT> return self.get_data(n, 'd', self.double_size)
Returns one or more double
625941cf3eb6a72ae02ec637
def test_tensor_stats(): <NEW_LINE> <INDENT> c = tensor_coherence([TM1, TM2]) <NEW_LINE> npt.assert_almost_equal(c,np.ones(c.shape)) <NEW_LINE> d = tensor_dispersion([TM1, TM2]) <NEW_LINE> npt.assert_almost_equal(d,np.zeros(d.shape))
Test tensor_coherence and tensor_dispersion
625941cfcb5e8a47e48b7c01
def check(msg): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> msg = (int(input())) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> print("You Have to enter numbers and only numbers.") <NEW_LINE> continue <NEW_LINE> <DEDENT> return msg
Check if a letter is entered. If it is tell the user that doesn't work then prompt them again.
625941cf29b78933be1e5803
def set_encoding(self, value: str) -> "CommandHelper": <NEW_LINE> <INDENT> self.encoding = value <NEW_LINE> return self
Sets the encoding to use. :param value: The value to set.
625941cf004d5f362079a48b
def convergents(cfrac,mode): <NEW_LINE> <INDENT> if mode == "f": <NEW_LINE> <INDENT> yield from _cfrac_convergents(cfrac) <NEW_LINE> <DEDENT> elif mode == "n": <NEW_LINE> <INDENT> for i in _cfrac_convergents(cfrac): <NEW_LINE> <INDENT> yield i.numerator <NEW_LINE> <DEDENT> <DEDENT> elif mode == "d": <NEW_LINE> <INDENT...
Convergents of cfrac (iterable) given either as fractions, numerators, or denominators
625941cfeab8aa0e5d26dcb0
def runParallel(args, bedIntervals): <NEW_LINE> <INDENT> nameSet = None <NEW_LINE> if args.names is not None: <NEW_LINE> <INDENT> nameSet = set(args.names.split(",")) <NEW_LINE> <DEDENT> numIntervals = 0 <NEW_LINE> for interval in bedIntervals: <NEW_LINE> <INDENT> name = None <NEW_LINE> if len(interval) > 3: <NEW_LINE>...
Quick hack to rerun parallel jobs on different interval subsets.
625941cf435de62698dfdda5
def __init__( self, decaychain: Dict[str, List[Dict[str, Union[float, str, List[Any]]]]], **attrs: Dict[str, Union[bool, int, float, str]], ) -> None: <NEW_LINE> <INDENT> self._chain = decaychain <NEW_LINE> self._graph = self._instantiate_graph(**attrs) <NEW_LINE> self._build_decay_graph()
Default constructor. Parameters ---------- decaychain: dict Input decay chain in dict format, typically created from `decaylanguage.DecFileParser.build_decay_chains` after parsing a .dec decay file, or from building a decay chain representation with `decaylanguage.DecayChain.to_dict`. attrs: optional User ...
625941cf3539df3088e2e4a3
def number_of_sets(self): <NEW_LINE> <INDENT> return Set.objects.filter(category=self, status='published').count()
Returns the number of sets contained in current category.
625941cf167d2b6e31218cee
def add_word_rec(self, word): <NEW_LINE> <INDENT> self.traverse_trie_down(self.root,)
Add a word to the try 1) Goes through each character in the word 2) Initially sets the current node to be the root 3) If the current node does not point to a node with the next character in question, add the node and point to it 4) If the character is the last character in the word, but the current node doesn't hold t...
625941cf56ac1b37e6264326
def command( self, command_id: Union[foundation.Command, int, t.uint8_t], *args, manufacturer: Optional[Union[int, t.uint16_t]] = None, expect_reply: bool = True, tsn: Optional[Union[int, t.uint8_t]] = None, ): <NEW_LINE> <INDENT> _LOGGER.debug( "%s Sending Tuya Cluster Command.. Cluster Command is %x, Arguments are %s...
Override the default Cluster command.
625941cf8e7ae83300e4b125
def recode_yesno_choice_values(df): <NEW_LINE> <INDENT> def recode(row): <NEW_LINE> <INDENT> if ((row['Field Type'] == 'yesno') and (str(row['Choices, Calculations, OR Slider Labels']).upper() == 'NAN')): <NEW_LINE> <INDENT> return '0, No | 1, Yes' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return row['Choices, Calc...
Change unset "Choices, Calculations, OR Slider Labels" with ``yesno`` type to useful choice strings.
625941cf0a366e3fb873e973
def set_num_dice(mqtt_client, num_dice_entry): <NEW_LINE> <INDENT> pass
Calls a method on EV3 called 'set_number_of_dice' passing in an int from the num_dice_entry.
625941cf7c178a314d6ef5b9
def randomize(element_list): <NEW_LINE> <INDENT> element_list = list(element_list) <NEW_LINE> length = len(element_list) <NEW_LINE> for i in range(length): <NEW_LINE> <INDENT> swap_index = __get_swap_index(i, length - 1) <NEW_LINE> __swap(element_list, i, swap_index) <NEW_LINE> <DEDENT> return element_list
Randomize order of the list
625941cf711fe17d825424c3
def test_detect_food_in_text(self): <NEW_LINE> <INDENT> msg = "Response status is not 200" <NEW_LINE> testArgs = {'text': 'I like to eat delicious tacos. Only cheeseburger with cheddar are better than that. But then again, pizza with pepperoni, mushrooms, and tomatoes is so good!'} <NEW_LINE> response = self.api.detect...
Test the 'detect food in text' endpoint (POST)
625941cf5510c4643540f53b
def loss(self, X, y=None): <NEW_LINE> <INDENT> X = X.astype(self.dtype) <NEW_LINE> mode = 'test' if y is None else 'train' <NEW_LINE> if self.use_dropout: <NEW_LINE> <INDENT> self.dropout_param['mode'] = mode <NEW_LINE> <DEDENT> if self.use_batchnorm: <NEW_LINE> <INDENT> for bn_param in self.bn_params: <NEW_LINE> <INDE...
Compute loss and gradient for the fully-connected net. Input / output: Same as TwoLayerNet above.
625941cf76d4e153a657ec89
def getReady(self): <NEW_LINE> <INDENT> return self.transitionRequest(TFCTransitions.configure,sendConfig=True)
send configure command
625941cf7d847024c06be415
@TimeThis <NEW_LINE> def turb_fric_erich(tfric): <NEW_LINE> <INDENT> rd = 287.04 <NEW_LINE> c_p = 1004.64 <NEW_LINE> c_v = c_p - rd <NEW_LINE> s_to_d = 60*60*24 <NEW_LINE> return tfric * s_to_d / c_v
computes not the entropy but enthalpy production through enthalpy
625941cf3317a56b86939db0
def isFullyConnected(self): <NEW_LINE> <INDENT> print("_" * 41) <NEW_LINE> print("Checking if fully connected:") <NEW_LINE> is_fully_connected = True <NEW_LINE> if not self.isConnected(): <NEW_LINE> <INDENT> is_fully_connected = False <NEW_LINE> <DEDENT> if is_fully_connected: <NEW_LINE> <INDENT> for vertex1 in self.ve...
Checks if the graph is fully connected. If there is an edge from every vertex to every other vertex, the graph is fully connected. :return: True if fully connected, False otherwise
625941cf26238365f5f0efc7
def _read(self): <NEW_LINE> <INDENT> return self.device.read(16)
Reads a data buffer and returns it to the caller.
625941cfec188e330fd5a8f6
def expand(x, explored, frontier, key_func, reverse, verbose): <NEW_LINE> <INDENT> new = [Node(newstate, x, cost) for (newstate,cost) in neighbors(x.state)] <NEW_LINE> explored_states = [v.state for v in explored] <NEW_LINE> prune = [m for m in new if m.state in explored_states] <NEW_LINE> new = [m for m in new if not ...
Add x's children to frontier, except for the pruned ones.
625941cf7b180e01f3dc4955
@plugin.route('/live/<channel>/<program>/<language>/<mode>', options = {"program": "None", "language": "en", "mode": "external"}) <NEW_LINE> def live_play(channel, program=None, language="en", mode="external"): <NEW_LINE> <INDENT> play_channel(channel, program, language, mode)
Play <channel>
625941cfaad79263cf390b9a
def merlin_initialized(self, plexus, **kwds): <NEW_LINE> <INDENT> super().merlin_initialized(plexus=plexus, **kwds) <NEW_LINE> abi = self.abi(plexus=plexus) <NEW_LINE> self.setupStage(plexus=plexus, abi=abi) <NEW_LINE> self.setupPrefix(plexus=plexus, abi=abi) <NEW_LINE> return
Hook invoked after the {plexus} is fully initialized
625941cffbf16365ca6f631e
def _sanitize_mod_params(self, other): <NEW_LINE> <INDENT> if other is None: <NEW_LINE> <INDENT> params = (other,) <NEW_LINE> <DEDENT> elif isinstance(other, dict): <NEW_LINE> <INDENT> params = {} <NEW_LINE> if isinstance(self.params, dict): <NEW_LINE> <INDENT> for key, val in self.params.items(): <NEW_LINE> <INDENT> p...
Sanitize the object being modded with this Message. - Add support for modding 'None' so translation supports it - Trim the modded object, which can be a large dictionary, to only those keys that would actually be used in a translation - Snapshot the object being modded, in case the message is translated, it will be use...
625941cf38b623060ff0af46
def runTestsExternally(self, all, marked): <NEW_LINE> <INDENT> c = self.c <NEW_LINE> if c.isChanged(): <NEW_LINE> <INDENT> c.save() <NEW_LINE> <DEDENT> runner = RunTestExternallyHelperClass(c, all, marked) <NEW_LINE> runner.runTests() <NEW_LINE> c.bodyWantsFocusNow()
Run any kind of external unit test.
625941cf66656f66f7cbc304
def __init__(self, model_path=[os.path.join(os.path.dirname(__file__), 'model', 'detector.pb')]): <NEW_LINE> <INDENT> self._graph = tf.Graph() <NEW_LINE> with self._graph.as_default(): <NEW_LINE> <INDENT> self._graph, self._sess = self.init_model(model_path) <NEW_LINE> self.input_image = tf.get_default_graph().get_tens...
Arguments: model_path: a string, path to a pb file.
625941cf046cf37aa974cea0
def InitInspection(self, pos=wx.DefaultPosition, size=wx.Size(850,700), config=None, locals=None, alt=True, cmd=True, shift=False, keyCode=ord('I')): <NEW_LINE> <INDENT> self.Bind(wx.EVT_KEY_DOWN, self._OnKeyPress) <NEW_LINE> self._alt = alt <NEW_LINE> self._cmd = cmd <NEW_LINE> self._shift = shift <NEW_LINE> self._key...
Make the event binding that will activate the InspectionFrame window.
625941cf3346ee7daa2b2ec4
def writeEventsToStream(self): <NEW_LINE> <INDENT> previous_event_tick = 0 <NEW_LINE> for event in self.MIDIEventList: <NEW_LINE> <INDENT> self.MIDIdata += event.serialize(previous_event_tick)
Write the events in MIDIEvents to the MIDI stream. MIDIEventList is presumed to be already sorted in chronological order.
625941cf293b9510aa2c33ee
def replace(old, new, count=-1): <NEW_LINE> <INDENT> inputbox = get_with_cursor() <NEW_LINE> inputbox = inputbox.replace(old, new, count) <NEW_LINE> set_with_cursor(inputbox)
Replaces text in the inputbox while trying to preserve the cursor position.
625941cfa8ecb033257d3225
def try_add(self, cmd): <NEW_LINE> <INDENT> if self.connected: <NEW_LINE> <INDENT> logger.debug('Added to smoothie queue: {}'.format(cmd)) <NEW_LINE> self.smoothieQueue.append(cmd) <NEW_LINE> self.try_step()
Add a command to the smoothieQueue
625941cf009cb60464c6350a
def run_game(self): <NEW_LINE> <INDENT> while not self.game_over() and self.list_of_players: <NEW_LINE> <INDENT> self.run_turn() <NEW_LINE> <DEDENT> return self.scoreboard()
Runs a complete game of Evolution :return: String representation of Player scores
625941cff548e778e58cd6d6
def test_find_loops(self): <NEW_LINE> <INDENT> loops = Secstruc("(((..))).").find_loops() <NEW_LINE> self.assertEqual(loops[0], Secstruc('(..)',[2,3,4,5]))
Should return all loops from a Secstruc.
625941cf6aa9bd52df036efd
def __init__(self, ai_game): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.screen = ai_game.screen <NEW_LINE> self.settings = ai_game.settings <NEW_LINE> self.image = pygame.image.load('images/alien.png') <NEW_LINE> self.rect = self.image.get_rect() <NEW_LINE> self.rect.x = self.rect.width <NEW_LINE> self.rect...
初始化外星人并设置其起始位置。
625941cfbde94217f3682f49
def test_supported_no_secretstorage(self): <NEW_LINE> <INDENT> with ImportKiller('secretstorage'): <NEW_LINE> <INDENT> self.assertEqual(-1, SecretService.Keyring().supported())
SecretService Keyring is not supported if secretstorage can't be imported.
625941cf1b99ca400220ac0a
def create_node(**kwargs): <NEW_LINE> <INDENT> pass
Creates a new node based on provided params. Name is ignored on some providers. To specify provider-specific options, use keyword arguments.
625941cf851cf427c661a667
def search_space(nanos: list, bounds: dict) -> list: <NEW_LINE> <INDENT> max_coords = [] <NEW_LINE> max_value = 0 <NEW_LINE> for x in range(bounds["min"][X], bounds["max"][X] + 1): <NEW_LINE> <INDENT> for y in range(bounds["min"][Y], bounds["max"][Y] + 1): <NEW_LINE> <INDENT> for z in range(bounds["min"][Z], bounds["ma...
Searches through all points contained in the given bounds, identifying those with the highest number of overlapping nanobot signal spheres from the given nanobots. :param nanos: The nanobots :param bounds: The bounds to search, the form: { "min": (X, Y, Z), "max": (X, Y, Z) } :return: A list of coordinates that...
625941cfab23a570cc2502db