code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _(s): <NEW_LINE> <INDENT> translations = { 'fritzbox unreachable': 30408, 'could not connect to fritzbox': 30415, 'fritzbox phonebookaccess failed': 30412, 'resume': 30413, 'continue in %d sec': 30414, 'connection successful': 30416, 'result': 30417, 'restart to use new settings': 30418, 'loaded %d phone book entri...
@param s: not localized String @type s: string
625941ebb7558d58953c53fc
def subtract_2D_cross_disp_background(img, fit): <NEW_LINE> <INDENT> two_D_background = np.rot90(np.rot90(np.rot90(np.tile(fit, (1024, 1))))) <NEW_LINE> return img - two_D_background
Create a 2D image from the 1D fit to the background in the cross dispersion direction and subtract it from the image
625941eb2c8b7c6e89b35caf
def get(self, hla_genotype_input): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> hla_genotypes = [ geno.strip() for geno in list(set(hla_genotype_input.split(","))) ] <NEW_LINE> results = [] <NEW_LINE> mapper = LeaderMapper() <NEW_LINE> for hla_genotype in hla_genotypes: <NEW_LINE> <INDENT> results.append(mapper.get_lea...
returns leader-peptide allotype(s) of HLA-B allele(s)
625941eb01c39578d7e7532e
def build_argument_tree(items): <NEW_LINE> <INDENT> if type(items) not in [dict, list, tuple, set, OrderedDict]: <NEW_LINE> <INDENT> return {str(items): None} <NEW_LINE> <DEDENT> if items is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if len(items) == 0: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT>...
Given a dictionary of lists, builds a tree structure representing all possible combinations of the values from these lists. Arguments: items: Dictionary of lists, looking like this: { "foo": [1, 2, 3, 4, 5, 6], "bar": ["hello", "there", "world"], "baz": ["test1", "test...
625941ebb545ff76a8914308
def ClientToScreenXY(self, x, y): <NEW_LINE> <INDENT> return self._mainWin.ClientToScreen(x, y)
Converts to screen coordinates from coordinates relative to this window. :param `x`: an integer specifying the `x` client coordinate; :param `y`: an integer specifying the `y` client coordinate. :return: the coordinates relative to the screen. :note: Overridden from :class:`wx.Control`.
625941eb63d6d428bbe449e3
def cudnn_lstm(inputs, input_h, input_c, kernel, recurrent_kernel, bias, time_major): <NEW_LINE> <INDENT> if not time_major: <NEW_LINE> <INDENT> inputs = array_ops.transpose(inputs, perm=(1, 0, 2)) <NEW_LINE> <DEDENT> input_h = array_ops.expand_dims(input_h, axis=0) <NEW_LINE> input_c = array_ops.expand_dims(input_c, a...
LSTM with CuDNN implementation which is only available for GPU.
625941ebcc0a2c11143dd384
def pixy_value_update(blocks): <NEW_LINE> <INDENT> if len(blocks) > 0: <NEW_LINE> <INDENT> pan_error = X_CENTER - blocks[0]["x"] <NEW_LINE> tilt_error = blocks[0]["y"] - Y_CENTER <NEW_LINE> pan_loop.update(pan_error) <NEW_LINE> tilt_loop.update(tilt_error) <NEW_LINE> loop = asyncio.get_event_loop() <NEW_LINE> if loop.i...
Prints the Pixy blocks data.
625941ebf7d966606f6aa4fd
def cleanHouseData(housedata) : <NEW_LINE> <INDENT> housedata.dropna(inplace = True) <NEW_LINE> bindata = housedata[['CHAS']] <NEW_LINE> outdata = housedata[['MEDV']] <NEW_LINE> housedata.drop(['CHAS', 'MEDV'], axis=1, inplace=True) <NEW_LINE> stddata = (housedata - housedata.mean())/housedata.std(ddof=1) <NEW_LINE> re...
Removes rows of missing values/NAN, performs standardization on each value and returns preprocessed data
625941eb29b78933be1e5b98
def ISI(data, cols=[0,1], threshold=20, sampleThr=3): <NEW_LINE> <INDENT> (spb, spm, spe) = findSpikes(data, cols, threshold, sampleThr) <NEW_LINE> if len(spm) < 2: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return np.diff(data[spm,cols[0]])
Function calculates ISI from given data and return in the form of an array of ISI for the given pair. The ISI is calculated for the peak of the spikes. Threshold value according to (Naundorf et al. 2006).
625941eb10dbd63aa1bd3094
def prepare_environment(installed_test_dir, phoronix_cache_dir, nfs_server, nfs_src, nfs_dest): <NEW_LINE> <INDENT> if not os.path.exists(installed_test_dir): <NEW_LINE> <INDENT> os.makedirs(installed_test_dir) <NEW_LINE> <DEDENT> do_mountnfs(nfs_server, nfs_src, nfs_dest) <NEW_LINE> print("INFO: Prepare Phoronix cache...
Copy phoronix cache files from NFS server to target device.
625941ebec188e330fd5ac87
def check_empirical_weight(self, verbose_lvl=0, filename=None): <NEW_LINE> <INDENT> return self._check_empirical_distribution_weight(self._cipher, verbose_lvl, filename, rk_dict_diffs=None)
Check the exact weight of the model matches one weight of the empirical weight distribution. If the exact weight doesn't match, the exception `ExactWeightError` is raised. If ``filename`` is not ``None``, the output will be printed to the given file rather than the to stdout. The argument ``verbose_lvl`` can also ta...
625941eb38b623060ff0b2e0
def __repr__(self): <NEW_LINE> <INDENT> return "<RssHtmlFilter %s>" % self.url
Representation with recursion level and state.
625941ebf548e778e58cda72
def selectJob( self, resourceDescription, credDict ): <NEW_LINE> <INDENT> startTime = time.time() <NEW_LINE> resourceDict = self._getResourceDict( resourceDescription, credDict ) <NEW_LINE> negativeCond = self.limiter.getNegativeCondForSite( resourceDict['Site'] ) <NEW_LINE> result = self.tqDB.matchAndGetJob( resourceD...
Main job selection function to find the highest priority job matching the resource capacity
625941ebe64d504609d74d32
def createChildManipulator(self, childWidget, recursive = True, skipAutoWidgets = False): <NEW_LINE> <INDENT> ret = Manipulator(self, childWidget, recursive, skipAutoWidgets) <NEW_LINE> ret.updateFromWidget() <NEW_LINE> return ret
Creates a child manipulator suitable for a child widget of manipulated widget recursive - recurse into children? skipAutoWidgets - if true, auto widgets will be skipped over This is there to allow overriding (if user subclasses the Manipulator, child manipulators are likely to be also subclassed
625941eb10dbd63aa1bd3095
def read(context): <NEW_LINE> <INDENT> pass
Read stored data from object Returns a dictionary @param uuid: object UID @param key: (optional) dictionary item key
625941eb6e29344779a62b03
def enterswitch( self ): <NEW_LINE> <INDENT> self._eyestate = self.switch
Attempt to pick a different face to watch.
625941eb23849d37ff7b357e
def calc_mae_metric(self, preds, y): <NEW_LINE> <INDENT> return sum(sum(abs(preds - y))) / (y.shape[0])
@param preds: предсказания модели @param y: истиные значения @return mae: значение MAE
625941ebbaa26c4b54cb160d
@click.group() <NEW_LINE> def cli(): <NEW_LINE> <INDENT> pass
Get the temperature from your connected w1 therm sensors  Available sensors types are: - DS18S20 - DS1822 - DS18B20 - DS28EA00 - DS1825/MAX31850K
625941ebe64d504609d74d33
def test_invalid_inputs(self): <NEW_LINE> <INDENT> calculate_score(self.train_y, self.basemodels_preds) <NEW_LINE> self.assertRaises(ValueError, es.fit, self.validation_x, self.validation_y)
checks if valueError is raised when input is invalid
625941eb4a966d76dd551507
def breed_next_generation(self, fitness_results, n_genomes): <NEW_LINE> <INDENT> if n_genomes < 0: <NEW_LINE> <INDENT> raise ValueError("Number of bred genomes per generation cannot be negative") <NEW_LINE> <DEDENT> selector = Selector(self.selection_strategy) <NEW_LINE> crosser = Crosser(self.genome_params) <NEW_LINE>...
Generates a given number of genomes by breeding, through crossover and mutation, existing genomes :param fitness_results: a sorted list of tuples containing a fitness score in the first position and a genome in the second (returned by :func:`~holland.evolution.Evaluator.evaluate_fitness`) :type fitness_results: list ...
625941eb3317a56b8693a13f
@receiver(post_save, sender=NumSolvedCollectionAchievementDefinition) <NEW_LINE> def refresh_collection_achievements(sender, **kwargs): <NEW_LINE> <INDENT> logger.debug('Signal post_save for %s %s', str(sender), str(kwargs['instance'])) <NEW_LINE> kwargs['instance'].refresh()
Delete and check new and old NumSolvedCollectionAchievementDefinition achievements
625941eb8e05c05ec3eea86c
def gd_back(x_start, loss_func, alpha=0.5, beta=0.5, s=1): <NEW_LINE> <INDENT> x = x_start <NEW_LINE> while True: <NEW_LINE> <INDENT> x.requires_grad = True <NEW_LINE> loss = loss_func(x) <NEW_LINE> loss.backward() <NEW_LINE> with torch.no_grad(): <NEW_LINE> <INDENT> eta = s <NEW_LINE> while True: <NEW_LINE> <INDENT> g...
Compute minimum using gradient descent with backtracking
625941eb15baa723493c446c
def __init__(self, data_group=None, id=None, last_point=None, name=None, units=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration = Configuration() <NEW_LINE> <DEDENT> self.local_vars_configuration = local_vars_configuration <NEW_L...
AssetDataInput - a model defined in OpenAPI
625941eba17c0f6771cbe542
def set_attributes(self, lb_id, kvpairs): <NEW_LINE> <INDENT> supported_keys = ["status"] <NEW_LINE> badKeys = [] <NEW_LINE> for k in kvpairs: <NEW_LINE> <INDENT> if k not in supported_keys: <NEW_LINE> <INDENT> badKeys.append(k) <NEW_LINE> <DEDENT> <DEDENT> if len(badKeys) > 0: <NEW_LINE> <INDENT> raise BadKeysError("A...
Sets zero or more attributes on the load balancer object. Currently supported attributes include: status.
625941eb07d97122c4178d8a
def setConfig(self, ap, aplist=None, wif=0, link=None, ssid=None): <NEW_LINE> <INDENT> if ap.params['ssid'][wif] != '' or ssid: <NEW_LINE> <INDENT> if 'encrypt' in ap.params and 'config' not in ap.params: <NEW_LINE> <INDENT> if ap.params['encrypt'][wif] == 'wpa': <NEW_LINE> <INDENT> ap.auth_algs = 1 <NEW_LINE> if 'ieee...
Configure AP :param ap: ap node :param aplist: list of aps :param wif: wif id :param link: if wmediumd
625941ebff9c53063f47c6e4
def player_chances_are_over(count): <NEW_LINE> <INDENT> if count < 1: <NEW_LINE> <INDENT> print( back.DEEP_PINK_3A + style.BOLD + "\n☠ Você perdeu. Suas chances acabaram. 💀💀💀" + style.RESET ) <NEW_LINE> play_again_or_exit() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print(back.PURPLE_1B + style.BOLD + f"💣Você te...
Função para verificar se o jogador ainda possui chances. Caso não tenha mais chances o jogo é encerrado. E o jogador é perguntado se deseja jogar novamente.
625941eb50812a4eaa59c80f
def spawn_ball(direction): <NEW_LINE> <INDENT> global ball_pos, ball_vel <NEW_LINE> ball_pos = [HALF_WIDTH, HALF_HEIGHT] <NEW_LINE> vert_vel = random.randrange(-2, -1) <NEW_LINE> hor_vel = random.randrange(1, 6) <NEW_LINE> if direction == LEFT: <NEW_LINE> <INDENT> hor_vel = - hor_vel <NEW_LINE> <DEDENT> ball_vel = [hor...
initialize ball_pos and ball_vel for new bal in middle of table if direction is RIGHT, the ball's velocity is upper right, else upper left
625941eb4f6381625f114f2f
def test_signature_move(self): <NEW_LINE> <INDENT> sig = self._get_signature(self._authors[0], self._publications[1]) <NEW_LINE> sig_len_before = self.db.session.query(self.Signature).count() <NEW_LINE> sig.move(self._authors[1]) <NEW_LINE> sig_len_after = self.db.session.query(self.Signature).count() <NEW_LINE> self.a...
No attribution should be altered. Only the author and the curator should be modified.
625941ebcc40096d61595e41
def get_filename(self, v): <NEW_LINE> <INDENT> return(join(self.zettelkasten, f'{v}.{EXT_NOTE}'))
Create a filename based on Note ID.
625941eba79ad161976cc639
def ersatz_prior_draw(): <NEW_LINE> <INDENT> amp = np.exp(np.log(1.) + 0.3 * np.random.normal()) <NEW_LINE> period = np.exp(np.log(180.) + 0.5 * np.random.normal()) <NEW_LINE> phase = 2. * np.pi * np.random.uniform() <NEW_LINE> return amp, period, phase
Draw an exoplanet from a crazy, hard-set prior.
625941eb956e5f7376d7135f
def run(args=None): <NEW_LINE> <INDENT> parser = OptionParser(description='Control and run the openrave python examples with a pyqt gui.', usage='openrave.py --example qtexampleselector [options]') <NEW_LINE> (options, leftargs) = parser.parse_args(args=args) <NEW_LINE> main(None,options)
Command-line execution of the example. :param args: arguments for script to parse, if not specified will use sys.argv
625941ebbf627c535bc136c2
def save_histogram(plot, index): <NEW_LINE> <INDENT> result = save_plot_base(plot, index) <NEW_LINE> props = plot.properties <NEW_LINE> result['type'] = 'histogram' <NEW_LINE> result['xAxis'] = dict(columnName=props['component'].label, bins=props['nbins'], range=[props['xmin'], props['xmax']]) <NEW_LINE> return result
Convert a single histogram to a D3PO plot :param plot: Glue histogram :type plot: :class:`~glue.viewers.histogram.qt.HistogramWidget` :param index: 1D index of plot on the page :type index: int :rtype: json-serializable dict
625941ebcad5886f8bd274cc
def cumsum(elts, init=0, fn=lambda x: x): <NEW_LINE> <INDENT> sums = [] <NEW_LINE> s = init <NEW_LINE> for i, e in enumerate(elts): <NEW_LINE> <INDENT> sums.append(s) <NEW_LINE> s += fn(e) <NEW_LINE> <DEDENT> return sums
Return cumulative sum of result of fn on each element in elts.
625941eb91f36d47f21ac9eb
def charge(self): <NEW_LINE> <INDENT> self._mode.put(0) <NEW_LINE> while not self.stopped: <NEW_LINE> <INDENT> time.sleep(0.1) <NEW_LINE> <DEDENT> self._mode.put(1) <NEW_LINE> while not self.standby: <NEW_LINE> <INDENT> time.sleep(0.1) <NEW_LINE> <DEDENT> self._mode.put(2) <NEW_LINE> while not self.ready: <NEW_LINE> <I...
Charge the PFN racks based on current settings.
625941eb099cdd3c635f114c
def __init__(self): <NEW_LINE> <INDENT> self.InstanceIds = None
:param InstanceIds: Array of instance IDs in the format of cdb-c1nl9rpv. It is the same as the instance ID displayed on the TencentDB Console page. :type InstanceIds: list of str
625941ebf9cc0f698b140aea
def publish_release(self, source, target, deis_registry=False, creds=None): <NEW_LINE> <INDENT> src_name, src_tag = docker.utils.parse_repository_tag(source) <NEW_LINE> name, tag = docker.utils.parse_repository_tag(target) <NEW_LINE> repo, name = auth.split_repo_name(name) <NEW_LINE> if deis_registry: <NEW_LINE> <INDEN...
Update a source Docker image with environment config and publish it to deis-registry.
625941eb15baa723493c446d
def load_public_key(key): <NEW_LINE> <INDENT> return serialization.load_pem_public_key( force_bytes(key), backend=default_backend() )
This assumes PEM for now.
625941eb498bea3a759b9fa1
def make_appointment_range(request): <NEW_LINE> <INDENT> return render(request, 'fw/cati/set_appointment_range.html')
Инструкция по установке договоренности в нипо интервьюером
625941eb167d2b6e31219088
def DescribeIncrementalMigration(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("DescribeIncrementalMigration", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.Des...
本接口(DescribeIncrementalMigration)用于查询增量备份导入任务。 :param request: Request instance for DescribeIncrementalMigration. :type request: :class:`tencentcloud.sqlserver.v20180328.models.DescribeIncrementalMigrationRequest` :rtype: :class:`tencentcloud.sqlserver.v20180328.models.DescribeIncrementalMigrationResponse`
625941eb07f4c71912b11978
def getTags(doc) : <NEW_LINE> <INDENT> tag_dict = defaultdict(list) <NEW_LINE> if doc is None : return tag_dict <NEW_LINE> for child in doc.getchildren() : <NEW_LINE> <INDENT> tag_dict[child.tag].append(child.text) <NEW_LINE> <DEDENT> return tag_dict
Convert XML Documentation (generated using parseDocstring) back to JSON (ie Python Dictionary)
625941eb8a349b6b435e8666
def __init__(self, _configuration=None, **kwargs): <NEW_LINE> <INDENT> if _configuration is None: <NEW_LINE> <INDENT> _configuration = Configuration() <NEW_LINE> <DEDENT> self._configuration = _configuration <NEW_LINE> self._error_details = None <NEW_LINE> self._group = None <NEW_LINE> self._shared = None <NEW_LINE> se...
MemberGroupSharedItem - a model defined in Swagger
625941eb009cb60464c638a1
def get_success_url(self, request, instance): <NEW_LINE> <INDENT> return self.success_url
Returns the redirect URL for successful form submissions. Default implementation is to return the contents of FormPluginBase.success_url, but this method can be overridden as required for more elaborate circumstances.
625941eb73bcbd0ca4b2c569
def noncentral_f(random_state, dfnum, dfden, nonc, size=None, chunk_size=None, gpu=None, dtype=None): <NEW_LINE> <INDENT> if dtype is None: <NEW_LINE> <INDENT> dtype = np.random.RandomState().noncentral_f( handle_array(dfnum), handle_array(dfden), handle_array(nonc), size=(0,)).dtype <NEW_LINE> <DEDENT> size = random_s...
Draw samples from the noncentral F distribution. Samples are drawn from an F distribution with specified parameters, `dfnum` (degrees of freedom in numerator) and `dfden` (degrees of freedom in denominator), where both parameters > 1. `nonc` is the non-centrality parameter. Parameters ---------- dfnum : float or arra...
625941eb377c676e9127269a
def make_inference_inj_plots(workflow, inference_files, output_dir, parameters, name="inference_recovery", analysis_seg=None, tags=None): <NEW_LINE> <INDENT> tags = [] if tags is None else tags <NEW_LINE> analysis_seg = (workflow.analysis_time if analysis_seg is None else analysis_seg) <NEW_LINE> output_files = FileLis...
Sets up the recovered versus injected parameter plot in the workflow. Parameters ---------- workflow: pycbc.workflow.Workflow The core workflow instance we are populating inference_files: pycbc.workflow.FileList The files with posterior samples. output_dir: str The directory to store result plots and files...
625941eb4a966d76dd551508
@pytest.mark.usefixtures('setup_pxe_servers_vm_prov') <NEW_LINE> def test_pxe_provision_from_template(provider, provisioning, vm_name, smtp_test, setup_provider, request): <NEW_LINE> <INDENT> pxe_template, host, datastore, pxe_server, pxe_image, pxe_kickstart, pxe_root_password, pxe_image_type, pxe_vlan = map(pr...
Tests provisioning via PXE Metadata: test_flag: pxe, provision suite: infra_provisioning
625941eb21bff66bcd684e41
def get_one_frame(self): <NEW_LINE> <INDENT> return self._read_and_queue()
Get one frame from the webcam buffer. The frame is not guaranteed to be the most recent frame available! Returns: The frame as a JPEG byte string.
625941ebdd821e528d63b698
def info_from_instance(context, instance, network_info, system_metadata, **kw): <NEW_LINE> <INDENT> def null_safe_str(s): <NEW_LINE> <INDENT> return str(s) if s else '' <NEW_LINE> <DEDENT> def null_safe_int(s): <NEW_LINE> <INDENT> return int(s) if s else '' <NEW_LINE> <DEDENT> def null_safe_isotime(s): <NEW_LINE> <INDE...
Get detailed instance information for an instance which is common to all notifications. :param:instance: nova.objects.Instance :param:network_info: network_info provided if not None :param:system_metadata: system_metadata DB entries for the instance, if not None .. note:: Currently unused here in trunk, but need...
625941eb187af65679ca5613
def _load_vega(self): <NEW_LINE> <INDENT> if self._vega is None or self._vega_throughput is None: <NEW_LINE> <INDENT> filename = os.path.join(os.path.dirname(__file__), 'vega.sed') <NEW_LINE> self._vega = Spectrum.load(filename) <NEW_LINE> tmp = Spectrum.load(self._filter_filename) <NEW_LINE> self._vega_throughput = tm...
Load VEGA spectrum.
625941eb16aa5153ce36296c
def get_master_rdf(outfiles, dr=0.05, bead_type="all"): <NEW_LINE> <INDENT> Nfiles = len(outfiles) <NEW_LINE> rdf_mat = [] <NEW_LINE> for outfile in outfiles: <NEW_LINE> <INDENT> r, rdf_i = get_one_rdf(outfile, dr, bead_type) <NEW_LINE> rdf_mat.append(rdf_i) <NEW_LINE> print(outfile, "done.") <NEW_LINE> <DEDENT> rdf_ma...
Construct an rdf from all the available xyz files
625941eb6aa9bd52df03729b
def transform_params(self, params, method='logit'): <NEW_LINE> <INDENT> transitions, ar_params, stddevs, means = self.separate_params(params) <NEW_LINE> stddevs = np.exp(-stddevs) <NEW_LINE> return self.fuse_params(transitions, ar_params, stddevs, means)
Transforms a set of unconstrained parameters to a set of contrained parameters. Optimization methods (e.g scipy.optimize) work on sets of unconstrained parameters, but the model requires e.g. that probability values lie in the range [0, 1]. This function takes the unconstrained parameters from the optimizer and transf...
625941eb26068e7796caf1db
def dwithin(self, geometry_expr1, geometry_expr2, distance, units, match_action=None): <NEW_LINE> <INDENT> if match_action is None: <NEW_LINE> <INDENT> return self._java_ref.dwithin(geometry_expr1, geometry_expr2, distance * 1.0, units) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._java_ref.dwithin(geometr...
Constructs a filter that passes when a given geometry is within the specified distance of the second geometry. Args: geometry_expr1 (Expression): An expression which represents a geometry. geometry_expr2 (Expression): An expression which represents a geometry. distance (float): The distance to use. uni...
625941ebadb09d7d5db6cc80
def send(self, message): <NEW_LINE> <INDENT> twilio_format = "+{}".format <NEW_LINE> params = dict( From=twilio_format(message.src), To=twilio_format(message.dst), Parameters=json.dumps(message.provider_params), ) <NEW_LINE> try: <NEW_LINE> <INDENT> response = requests.post( url=EXECUTIONS_URL.format(self.account_sid),...
Send a message :type message: smsframework.data.OutgoingMessage.OutgoingMessage :rtype: OutgoingMessage
625941ebd268445f265b5363
def install_remote(client): <NEW_LINE> <INDENT> LOG.info("Installing (or updating) ohai-solo on device %s at %s:%d", client.host, client.host, client.port) <NEW_LINE> if client.is_windows(): <NEW_LINE> <INDENT> powershell_command = ('[scriptblock]::Create((New-Object -TypeName ' 'System.Net.WebClient).DownloadString("h...
Install ohai-solo on remote system.
625941eb24f1403a92601056
def test_init(self): <NEW_LINE> <INDENT> app = Flask(__name__) <NEW_LINE> app.config['FOCA'] = Config( db=MongoConfig(**MONGO_CONFIG), endpoints=ENDPOINT_CONFIG, ) <NEW_LINE> data = deepcopy(MOCK_VERSION_NO_ID) <NEW_LINE> with app.app_context(): <NEW_LINE> <INDENT> tool = RegisterToolVersion(data=data, id=MOCK_ID) <NEW...
Test for constructing class.
625941eb046cf37aa974d236
def select_vocation_type(self, types): <NEW_LINE> <INDENT> self.select_widget(types, *self.vocation_type_loc)
选择行业类别
625941eb287bf620b61d3f54
def transform(self, X): <NEW_LINE> <INDENT> return list(map(self._transform, X))
Apply the transformation described in _transform to each element of X
625941eb85dfad0860c3b350
def load_portals(self): <NEW_LINE> <INDENT> vert_count = 0 <NEW_LINE> for index, portal in enumerate(self.mopt.Infos): <NEW_LINE> <INDENT> portal_name = self.display_name + "_Portal_" + str(index).zfill(3) <NEW_LINE> verts = [] <NEW_LINE> face = [] <NEW_LINE> faces = [] <NEW_LINE> for j in range(portal.nVertices): <NEW...
Load WoW WMO portal planes
625941ebff9c53063f47c6e5
def test_existing_unassigned_variables_are_respected(): <NEW_LINE> <INDENT> set_dotenv("UNASSIGNED_EXTSTING=assigned") <NEW_LINE> tamplate = get_tempfile("UNASSIGNED_EXTSTING") <NEW_LINE> dotenver.parse_files([tamplate.name]) <NEW_LINE> expected = "UNASSIGNED_EXTSTING=assigned\n" <NEW_LINE> assert DOTENV_FILE.read() ==...
Test that existing values for unassigned variables are respected.
625941eb1d351010ab85600f
def deserialize(self, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> end = 0 <NEW_LINE> start = end <NEW_LINE> end += 4 <NEW_LINE> (length,) = _struct_I.unpack(str[start:end]) <NEW_LINE> start = end <NEW_LINE> end += length <NEW_LINE> if python3: <NEW_LINE> <INDENT> self.type = str[start:end].decode('utf-8') <NEW_L...
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
625941eb4e696a04525c9941
def parse_balance(soup): <NEW_LINE> <INDENT> balance = OFXBalance() <NEW_LINE> balance.balance = decimal.Decimal(soup.find("BALAMT").contents[0]) <NEW_LINE> balance.as_of_date = parse_datetime(soup, "DTASOF") <NEW_LINE> return balance
Parses an OFX Balance object from the soup. Parameters: ----------- soup : bs4.BeautifulSoup object The XML to parse. Returns: -------- balance : OFXBalance object The parsed balance object.
625941eb3c8af77a43ae3c9a
def rightSide(Ustar, dx, dy, nx, ny, ng, ilo, ihix, ihiy): <NEW_LINE> <INDENT> u = Ustar[0].copy() <NEW_LINE> v = Ustar[1].copy() <NEW_LINE> fillBC(u, ilo, ihix, ihiy) <NEW_LINE> fillBC(v, ilo, ihix, ihiy) <NEW_LINE> DUij = numpy.zeros((nx + 2 * ng, ny + 2 * ng), dtype=numpy.float64) <NEW_LINE> for i in range(ilo, ihix...
takes the vector and gives the divergent of it, for out problem, this is the right side of the poisson equation
625941eb76d4e153a657f027
def send_not_busy_signal(sender): <NEW_LINE> <INDENT> dispatcher.send( signal=NOT_BUSY_SIGNAL, sender=sender, message='')
Send an busy signal to the listeners. .. versionadded:: 3.3 :param sender: The sender. :type sender: object
625941eb0fa83653e46574ac
def test_has_cd4_4(self): <NEW_LINE> <INDENT> self.data['has_cd4'] = NO <NEW_LINE> self.data['cd4_result'] = 600 <NEW_LINE> form = MaternalLabDelClinicForm(data=self.data) <NEW_LINE> self.assertIn('You indicated that a CD4 count was NOT performed, yet provided a CD4 ' 'result. Please correct.', form.errors.get('__all__...
If has CD4 is indicated as no, then CD4 count result should be NOT provided.
625941ebdc8b845886cb5a2b
def getBondAngle(self, a1, a2, a3, degrees=True): <NEW_LINE> <INDENT> v1 = self.atomCoords[a2] - self.atomCoords[a1] <NEW_LINE> v1 = v1.normalise() <NEW_LINE> v2 = self.atomCoords[a3] - self.atomCoords[a2] <NEW_LINE> v2 = v2.normalise() <NEW_LINE> dotp = v1.dotProduct(v2) <NEW_LINE> ang = math.pi - math.acos(dotp) <NEW...
Return the bond angle a1-a2-a3. The angle is defined by the vectors a1-a2 and a2-a3. Atoms are numbered from zero. degrees - if true, return angle in degrees, else radians.
625941eb3cc13d1c6d3c786c
def print_poly(coeffs): <NEW_LINE> <INDENT> res = "f(X) = " <NEW_LINE> for i, c in enumerate(coeffs): <NEW_LINE> <INDENT> if i == 0: <NEW_LINE> <INDENT> res += "%.4e" % c <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> res += " + %.4ex^%s" % (c, i) <NEW_LINE> <DEDENT> <DEDENT> print(res)
Print a readable polynomial corresponding to the given coefficients
625941eb8c3a8732951588b5
def setProperty(self, newProp, objectID=0): <NEW_LINE> <INDENT> key = (newProp.getPropertyID(), newProp.getObjectID(), newProp.getTime()) <NEW_LINE> self.properties.set_value(key, newProp)
Register given property in the application :param Property property: Setting property :param int objectID: Identifies object/submesh on which property is evaluated (optional, default 0)
625941eb7cff6e4e81117e7a
def importorskip( modname: str, minversion: Optional[str] = None, reason: Optional[str] = None ) -> Any: <NEW_LINE> <INDENT> import warnings <NEW_LINE> __tracebackhide__ = True <NEW_LINE> compile(modname, "", "eval") <NEW_LINE> with warnings.catch_warnings(): <NEW_LINE> <INDENT> warnings.simplefilter("ignore") <NEW_LIN...
Imports and returns the requested module ``modname``, or skip the current test if the module cannot be imported. :param str modname: the name of the module to import :param str minversion: if given, the imported module's ``__version__`` attribute must be at least this minimal version, otherwise the test is sti...
625941ebe1aae11d1e74a1b1
def configure(self): <NEW_LINE> <INDENT> self.db.bind('sqlite', self.filename, create_db=True) <NEW_LINE> self.db.generate_mapping(create_tables=True)
Configure database
625941eb01c39578d7e7532f
def game_loop(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> self.get_players() <NEW_LINE> self.deal_cards(2) <NEW_LINE> for i in range(0, len(self.players)): <NEW_LINE> <INDENT> self.player_loop(i) <NEW_LINE> <DEDENT> for i in range(0, len(self.players)): <NEW_LINE> <INDENT> print(self.players[i].name, sel...
Main Game Loop, gets players, deals cards, goes through player loop for each player until game end :return: a fun way to pass the time on your computer terminal
625941eb1b99ca400220afa8
def backup_certificate( self, vault_base_url, certificate_name, **kwargs ): <NEW_LINE> <INDENT> cls = kwargs.pop('cls', None) <NEW_LINE> error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } <NEW_LINE> error_map.update(kwargs.pop('error_map', {})) <NEW_LINE> api_version = ...
Backs up the specified certificate. Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate will be downloaded. This operation requires the certificates/backup permission. :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type...
625941eb283ffb24f3c55df0
def action_select(self): <NEW_LINE> <INDENT> delta = datetime.datetime.now() - self.time_button_click_delay <NEW_LINE> if delta.seconds <= 0.5: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.time_button_click_delay = datetime.datetime.now() <NEW_LINE> selection = self.listbox_selector.curselection() <NEW_LINE> if ...
Bound to the select button. Selects the correct steam user and runs the second window.
625941eb046cf37aa974d237
def test_4_smartSyncShuffle(self): <NEW_LINE> <INDENT> cfg.logger.info("Running test_smartSyncShuffle") <NEW_LINE> shuffle(self.plPath) <NEW_LINE> smartSync(self.plPath) <NEW_LINE> with shelve.open(f"{self.plPath}/{cfg.metaDataName}", 'c',writeback=True) as metaData: <NEW_LINE> <INDENT> passed = metaDataMatches(metaDat...
Simulates remote reordering by shuffling local
625941ebaad79263cf390f3d
def set_Offset(self, value): <NEW_LINE> <INDENT> super(ReadListensInputSet, self)._set_input('Offset', value)
Set the value of the Offset input for this Choreo. ((optional, integer) Used to page through results. Returns results starting from the specified number.)
625941eb627d3e7fe0d69346
@register_jitable <NEW_LINE> def _ascii_title(data, res): <NEW_LINE> <INDENT> previous_is_cased = False <NEW_LINE> for idx in range(len(data)): <NEW_LINE> <INDENT> code_point = _get_code_point(data, idx) <NEW_LINE> if _Py_ISLOWER(code_point): <NEW_LINE> <INDENT> if not previous_is_cased: <NEW_LINE> <INDENT> code_point ...
Does .title() on an ASCII string
625941eb796e427e537b0abf
def targettedResource(self): <NEW_LINE> <INDENT> return QUrl()
static QUrl Nepomuk.Vocabulary.NUAO.targettedResource()
625941eb3617ad0b5ed683eb
def step_thresould(epoch, epochs_drop=10.0): <NEW_LINE> <INDENT> return
:return:
625941ebfbf16365ca6f66c3
def moveDataPush(self, curState, surround, action, nextState, reward, move, finished): <NEW_LINE> <INDENT> self.memory.append(self.transitions(curState, surround, action, nextState, reward, move, finished))
Save a transition
625941ebd7e4931a7ee9e414
def get_possible_states(self, state): <NEW_LINE> <INDENT> index = state.get_free_spot() <NEW_LINE> row, col = self.get_mat_position(index) <NEW_LINE> possible_states = [] <NEW_LINE> original = state.state_arr <NEW_LINE> size = self.size <NEW_LINE> blank = '0' <NEW_LINE> if row != size-1: <NEW_LINE> <INDENT> up_arr = li...
returns all possible states from a given states creates the states list in this order (if exists): up,down,left,right
625941eb63d6d428bbe449e5
def add_start(self, start): <NEW_LINE> <INDENT> self.points.append(start) <NEW_LINE> self.start = start <NEW_LINE> c = Circle(start, 10) <NEW_LINE> c.setFill('green') <NEW_LINE> self.extras.append(c) <NEW_LINE> text = Text(Point(start.x+15, start.y+25), 'Start') <NEW_LINE> text.setSize(20) <NEW_LINE> text.setTextColor(...
Add and display the starting location
625941eb3d592f4c4ed1d554
def creation(loggers, db): <NEW_LINE> <INDENT> loggers.info("Object Created") <NEW_LINE> for i in range(len(files)): <NEW_LINE> <INDENT> if table_name == files[i]: <NEW_LINE> <INDENT> loggers = file_logs.logs_handler(log_files[i], files[i]) <NEW_LINE> obj = create_insert.CreateInsert(loggers, db) <NEW_LINE> option = ob...
:param loggers: log object :param db: db connection
625941eb287bf620b61d3f55
def read(self, buf, n): <NEW_LINE> <INDENT> idx = 0 <NEW_LINE> while True: <NEW_LINE> <INDENT> buf4 = [""] * 4 <NEW_LINE> curr = min(read4(buf4), n-idx) <NEW_LINE> for i in xrange(curr): <NEW_LINE> <INDENT> buf[idx] = buf4[i] <NEW_LINE> idx += 1 <NEW_LINE> <DEDENT> if curr == 0: <NEW_LINE> <INDENT> break <NEW_LINE> <DE...
:type buf: Destination buffer (List[str]) :type n: Maximum number of characters to read (int) :rtype: The number of characters read (int)
625941eb435de62698dfe141
def nunique(self, r=None): <NEW_LINE> <INDENT> ns = tuple(len(c) for c in self.counts(r=1)) <NEW_LINE> if r: <NEW_LINE> <INDENT> p, _ = self.shape <NEW_LINE> return (numpy.prod([ns[i] for i in idx]) for idx in combinations(range(p), r=r)) <NEW_LINE> <DEDENT> return numpy.prod(ns)
The product of the number of unique elements observed in the data for each variable. If r is not None, return a generator for all combinations of r-sized sets of variables.
625941ebfff4ab517eb2f934
def rotate_left_cubies(cubies, id_array, rotations): <NEW_LINE> <INDENT> rotate_cube_right_cubies(cubies, id_array, rotations) <NEW_LINE> rotate_front_cubies(cubies, id_array, rotations) <NEW_LINE> rotate_cube_left_cubies(cubies, id_array, rotations) <NEW_LINE> del rotations[-3:] <NEW_LINE> rotations.append("L")
Rotates the left side of the cube clockwise.
625941eb91af0d3eaac9bf12
def __update__(self): <NEW_LINE> <INDENT> self.reset() <NEW_LINE> if self.initok: <NEW_LINE> <INDENT> for chip in sensors.iter_detected_chips(): <NEW_LINE> <INDENT> for feature in chip: <NEW_LINE> <INDENT> sensors_current = {} <NEW_LINE> if feature.name.startswith(b'temp'): <NEW_LINE> <INDENT> sensors_current['label'] ...
Update the stats.
625941eb66656f66f7cbc6a1
def test_conversion_to_rgb_zero_div(self): <NEW_LINE> <INDENT> lchab = LCHabColor(0.0, 0.0, 0.0) <NEW_LINE> rgb = convert_color(lchab, sRGBColor) <NEW_LINE> self.assertColorMatch(rgb, sRGBColor(0.0, 0.0, 0.0))
The formula I grabbed for LCHuv to XYZ had a zero division error in it if the L coord was 0. Also check against LCHab in case.
625941eb8a349b6b435e8667
def _overall_fitness(self, fitness_contributions): <NEW_LINE> <INDENT> return np.prod([fitness_contributions[site]**self._site_weights[site] for site in xrange(len(self._site_weights))])
Eq5 SellaArdell06, uses the fitness contribution of each site and the accompanying weights of each site to get an overall fitness of the code.
625941ebec188e330fd5ac89
def make_possible_words(alphabet, word_length): <NEW_LINE> <INDENT> return [''.join(letters) for letters in itertools.product(alphabet, repeat = word_length)]
returns list of all possible word_length words for a given alphabet
625941eb4527f215b584c947
def _uptime_calculation(seconds_uptime: float, last_value: str | None) -> str: <NEW_LINE> <INDENT> delta_uptime = utcnow() - datetime.timedelta(seconds=seconds_uptime) <NEW_LINE> if ( not last_value or abs( (delta_uptime - datetime.datetime.fromisoformat(last_value)).total_seconds() ) > UPTIME_DEVIATION ): <NEW_LINE> <...
Calculate uptime with deviation.
625941eb96565a6dacc8fbbe
def __getitem__(self, idx): <NEW_LINE> <INDENT> assert(isinstance(idx, int)) <NEW_LINE> if self._normalize_idx(idx) >= self.length: <NEW_LINE> <INDENT> raise IndexError <NEW_LINE> <DEDENT> node = self.head <NEW_LINE> for i in range(abs(idx) + 1): <NEW_LINE> <INDENT> if idx < 0: <NEW_LINE> <INDENT> node = node.prior <NE...
Implements `x = self[idx]`
625941eb10dbd63aa1bd3097
def find_input_device(self, search_term): <NEW_LINE> <INDENT> all_devices = [evdev.InputDevice(path) for path in evdev.list_devices()] <NEW_LINE> likely_devices = [] <NEW_LINE> for device in all_devices: <NEW_LINE> <INDENT> if search_term in device.name.lower(): <NEW_LINE> <INDENT> likely_devices.append(device) <NEW_LI...
Return the input device if there is only one that matches the search term.
625941eb460517430c39466c
def share(self, addr, role='reader', expirationTime=None, is_group=False): <NEW_LINE> <INDENT> return self.client.add_permission(self.id, addr, role=role, is_group=False)
create/update permission for user/group/domain/anyone :param addr: email for user/group, domain address for domains or 'anyone' :param role: permission to be applied ('owner','writer','commenter','reader') :param expirationTime: (Not Implimented) time until this permission should last (datetime) :param is_group: boole...
625941ebe64d504609d74d34
def start(self): <NEW_LINE> <INDENT> if self._request_queue_worker_thread.is_alive(): <NEW_LINE> <INDENT> raise RuntimeError('Error: build request handler loop was asked to start when its already running.') <NEW_LINE> <DEDENT> self._request_queue_worker_thread.start()
Start the infinite loop that will accept unprepared builds and put them through build preparation.
625941ebcb5e8a47e48b7f97
def bad_class_test(self,rule,opts=''): <NEW_LINE> <INDENT> return bool(badregex_regex_filters_re.search(rule)) or (bool(opts) and bool(thrdp_im_pup_os_option_re.search(opts)) and not bool(not3dimppupos_option_exception_re.search(opts)))
Bad rule of interest if a match for the bad regex's or specific rule options, e.g. non-domain specific popups or images.
625941eb6e29344779a62b05
def get_snapped_datetime(start, period): <NEW_LINE> <INDENT> if period == "1hour": <NEW_LINE> <INDENT> floored = datetime.datetime(year=start.year, month=start.month, day=start.day) <NEW_LINE> times = list(rrule(HOURLY, interval=1, dtstart=floored, count=25)) <NEW_LINE> <DEDENT> elif period == "6hour": <NEW_LINE> <INDE...
Given a datetime, snap it to the specified window Args: start (datetime): timestamp period (str): one of VALID_AGGREGATION_PERIODS Returns: datetime: snapped datetime Example: >>> import datetime >>> from dateutil.parser import parse >>> three_am = parse('2018-07-02T03:41:00') >>> three_...
625941eb8a43f66fc4b54554
def checkPossibility(self, nums): <NEW_LINE> <INDENT> n = len(nums) <NEW_LINE> cnt = 0 <NEW_LINE> for i in range(1, n): <NEW_LINE> <INDENT> if nums[i-1] > nums[i]: <NEW_LINE> <INDENT> if i-2 < 0 or nums[i-2] <= nums[i]: <NEW_LINE> <INDENT> nums[i-1] = nums[i] <NEW_LINE> <DEDENT> elif nums[i-2] > nums[i]: <NEW_LINE> <IN...
:type nums: List[int] :rtype: bool
625941eb2eb69b55b151cdab
def calcColumnsRowsFromTileSize(imWidth, imHeight,tileWidth,tileHeight, overlap): <NEW_LINE> <INDENT> numColumns = int(ceil( (imWidth - overlap)/(tileWidth - overlap) )) <NEW_LINE> numRows = int(ceil( (imHeight - overlap)/(tileHeight - overlap) )) <NEW_LINE> return (numColumns,numRows)
Returns the number of columns and rows of overlapping tiles of the given size required
625941eb596a897236089fae
def predict_row(self, xi: pd.Series): <NEW_LINE> <INDENT> if self.is_leaf: return self.val <NEW_LINE> tree = self.l_split if xi[self.var] <= self.split else self.r_split <NEW_LINE> return tree.predict_row(xi)
Makes a prediction on a single row xi
625941ebe64d504609d74d35
def p_typeof_data(p): <NEW_LINE> <INDENT> p[0] = Tuplee("iterate", [p[1]], [], p.lexer.lineno)
typeof_data : integer | float | string
625941eb236d856c2ad44cd6
def set_service_singleton(self, name, instance): <NEW_LINE> <INDENT> with self._service_lock: <NEW_LINE> <INDENT> self._service_instances[name] = instance
Manually set the instance.
625941eb82261d6c526ab99c
def img_summary(experience, summary_writer, train_step): <NEW_LINE> <INDENT> obs = experience['experience'].observation['pixels'] <NEW_LINE> if experience['augmented_obs']: <NEW_LINE> <INDENT> aug_obs = experience['augmented_obs'][0]['pixels'] <NEW_LINE> aug_next_obs = experience['augmented_next_obs'][0]['pixels'] <NEW...
Generates image summaries for the augmented images.
625941eb7047854f462a18f9