code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def test_log_interp_vv(self): <NEW_LINE> <INDENT> rr,pp = funct_log_mesh(256, 0.01, 20.0) <NEW_LINE> lgi = log_interp_c(rr) <NEW_LINE> gcs = np.array([1.2030, 3.2030, 0.7, 10.0]) <NEW_LINE> ff = np.array([[np.exp(-gc*r**2) for r in rr] for gc in gcs]) <NEW_LINE> rvecs = np.linspace(0.05, 25.0, 200) <NEW_LINE> fr2yy = l... | Test the interpolation facility for an array arguments from the class log_interp_c | 625941d07d847024c06be425 |
def test_from_bytes(self): <NEW_LINE> <INDENT> self.assertEqual( bytes(TryteString.from_bytes(b'Hello, IOTA!')), b'RBTC9D9DCDQAEASBYBCCKBFA', ) | Converting a sequence of bytes into a TryteString. | 625941d04c3428357757c490 |
def get_logger(): <NEW_LINE> <INDENT> l = logging.getLogger("bliss") <NEW_LINE> return l | Return the Bliss logging handler.
| 625941d0e5267d203edcde05 |
def test_api_rejects_invalid_search_parameter_format(self): <NEW_LINE> <INDENT> res = self.client().get("/bucketlists/v1.0/?q=(*&*^^%&dkj", headers={"Authorization": self.token} ) <NEW_LINE> self.assertEqual(res.status_code, 400) <NEW_LINE> self.assertIn('"error": "Invalid search term format"', str(res.data)) | Test api rejects invalid search parameter | 625941d0cb5e8a47e48b7c12 |
@app.route('/rest/publish/<client_type>/<client_name>/<path>', methods=['GET']) <NEW_LINE> @timeit <NEW_LINE> def publish_get(client_type, client_name, path): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data = "{0}, {1}, {2}".format(client_type, client_name, path) <NEW_LINE> path = path.replace("..", "") <NEW_LINE> ro... | @api {get} /butler/publish View content published by some clients
@apiName getPublish
@apiGroup Publish
@apiVersion 0.5.0
@apiParam client_type The client type (plugin, ...)
@apiParam client_name The client name (yi, ...)
@apiExample Example usage with wget
$ wget -qO- http://192.168.1.10:40406/rest/publish/plugi... | 625941d07047854f462a1571 |
def load_template_from_xml_file_path(file_path): <NEW_LINE> <INDENT> assert isfile(file_path) and access(file_path, R_OK), SystemError("File {0} invalid or unreadable".format(file_path)) <NEW_LINE> with io.open(file_path, "r", encoding='utf8') as template_file: <NEW_LINE> <INDENT> return load_template_from_xml_f... | Loads a TemplateEntity from an xml file for a
given path
Args:
file_path (str): path to the xml file
Returns:
TemplateEntity | 625941d0a79ad161976cc2ae |
@with_session <NEW_LINE> def create_all(session): <NEW_LINE> <INDENT> Base.metadata.create_all(session.get_bind()) | create all tables
:param sqlalchemy.orm.session.Session session: session object injected via
:py:func:`fpesa.postgres.with_session` decorator. | 625941d066656f66f7cbc314 |
def get_team(name, profile="github"): <NEW_LINE> <INDENT> return list_teams(profile).get(name) | Returns the team details if a team with the given name exists, or None
otherwise.
name
The team name for which to obtain information.
profile
The name of the profile configuration to use. Defaults to ``github``.
CLI Example:
.. code-block:: bash
salt myminion github.get_team 'team_name' | 625941d038b623060ff0af56 |
def content_types(request): <NEW_LINE> <INDENT> get_portal().check_permission(request.user, "manage_portal") <NEW_LINE> ctr = ContentTypeRegistration.objects.filter()[0] <NEW_LINE> url = reverse("lfc_content_type", kwargs={"id": ctr.id}) <NEW_LINE> return HttpResponseRedirect(url) | Redirects to the first content type.
| 625941d0fff4ab517eb2f5a5 |
def nitems_read(self, which_input): <NEW_LINE> <INDENT> return _wirlab_swig.CSI_to_File_sptr_nitems_read(self, which_input) | nitems_read(CSI_to_File_sptr self, unsigned int which_input) -> uint64_t | 625941d08e71fb1e9831d911 |
def get(self, key): <NEW_LINE> <INDENT> if key in self.queue: <NEW_LINE> <INDENT> self.queue.remove(key) <NEW_LINE> self.queue.append(key) <NEW_LINE> return self.dict[key] <NEW_LINE> <DEDENT> return -1 | :type key: int
:rtype: int | 625941d0adb09d7d5db6c8f8 |
def ping(self, message, args, lang): <NEW_LINE> <INDENT> self._telegram_api.send_text_message(message.chat_id, self._tr(lang, 'pong'), reply_to=message.message_id) | Answers to `/ping` message
Args:
message(:class:`telegram.Message`): received message
args(list): message arguments
lang(str|NoneType): user language | 625941d06aa9bd52df036f0d |
def getIgnoreString(): <NEW_LINE> <INDENT> return 'unix_' | Return a string that will mark files tha should be ignored
Filenames that include the ignore string will not be collected during
the source files or header files collection process | 625941d007d97122c41789f5 |
def check_dependencies(): <NEW_LINE> <INDENT> if not HAS_VIRTUALENV: <NEW_LINE> <INDENT> print('not found.') <NEW_LINE> if HAS_EASY_INSTALL: <NEW_LINE> <INDENT> print('Installing virtualenv via easy_install...'), <NEW_LINE> if not (run_command(['which', 'easy_install']) and run_command(['easy_install', 'virtualenv'])):... | Make sure virtualenv is in the path. | 625941d067a9b606de4a8022 |
def _RLFindRoots(nump, denp, kvect): <NEW_LINE> <INDENT> roots = [] <NEW_LINE> for k in np.array(kvect, ndmin=1): <NEW_LINE> <INDENT> curpoly = denp + k * nump <NEW_LINE> curroots = curpoly.r <NEW_LINE> if len(curroots) < denp.order: <NEW_LINE> <INDENT> curroots = np.insert(curroots, len(curroots), np.inf) <NEW_LINE> <... | Find the roots for the root locus. | 625941d04d74a7450ccd432c |
def hrm_use_certificates(default): <NEW_LINE> <INDENT> root_org = current.auth.root_org_name() <NEW_LINE> if root_org == IRCS: <NEW_LINE> <INDENT> if current.request.controller == "vol": <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> elif root_org... | Whether to use Certificates | 625941d0f9cc0f698b140764 |
def is_complete(self) -> bool: <NEW_LINE> <INDENT> return all(self.downloaded_blocks) | Return True if all the Blocks in this piece exist | 625941d0f7d966606f6aa16d |
def do_and_form(expressions, env): <NEW_LINE> <INDENT> if expressions == nil: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> while expressions.rest != nil: <NEW_LINE> <INDENT> evaluated = scheme_eval(expressions.first, env) <NEW_LINE> if evaluated == False and evaluated is not 0: <NEW_LINE> <INDENT> return evaluat... | Evaluate a (short-circuited) and form. | 625941d04f6381625f114ba4 |
def purple_mime_document_new(): <NEW_LINE> <INDENT> return _purple.purple_mime_document_new() | purple_mime_document_new() -> PurpleMimeDocument | 625941d0a934411ee37517fc |
def encode_binding_request(self, zigbee_id): <NEW_LINE> <INDENT> zigbee_id = self._build_where_field(zigbee_id) <NEW_LINE> return [{"tx": "*25*33*%s#9##" % zigbee_id}, {"rx": OWN_ACK}, {"rx": "*25*36*%s#9##" % zigbee_id}] | Encode binding request for a given zigbee ID | 625941d0bf627c535bc13338 |
def OnUpdateProgress(self, event): <NEW_LINE> <INDENT> self.GetProgressBar().UpdateProgress(event.layer, event.map) <NEW_LINE> event.Skip() | Update progress bar info | 625941d0d58c6744b4257dc9 |
def _set_internal_model(self, model): <NEW_LINE> <INDENT> self.internal_model = self._check_internal_model(model) | Assigns model (a Future or list of futures containins a single-GPU
model) to be an internal model.
This function standardizes upon the way we set the internal model
so that it could either be futures, a single future, or a class local
to the client.
In order for `get_combined model()` to provide a consistent output,
... | 625941d0283ffb24f3c55a69 |
def find_one(self, *args, **kwargs): <NEW_LINE> <INDENT> args, kwargs = self._integrate_filt(*args, **kwargs) <NEW_LINE> return self.mgc.find_one(*args, **kwargs) | Filtered version of pymongo collection find_one. | 625941d02eb69b55b151ca19 |
def test_query_retain_timestamp(self): <NEW_LINE> <INDENT> old_timestamp = make_aware(datetime.datetime.now()) <NEW_LINE> Query.objects.create(query = None, queriedAt = old_timestamp) <NEW_LINE> response = self.client.get(self.getNews_url) <NEW_LINE> new_timestamp = Query.objects.get(query = None).queriedAt <NEW_LINE> ... | Tests if query doesn't get update if a request is made before REFRESH_HOURS since the query was updated
| 625941d0fbf16365ca6f632f |
def load(self, file: str): <NEW_LINE> <INDENT> file = os.path.join(constants.OLD_DIR, file + ".pkl") <NEW_LINE> with open(file, "rb") as data: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> load = pickle.load(data) <NEW_LINE> <DEDENT> except ModuleNotFoundError: <NEW_LINE> <INDENT> sys.modules['objects'] = sys.modules[__... | Método que carga una cotización vieja en un objeto de la clase Cotizacion
Parameters
----------
file: str
nombre del archivo de la cotización a cargar
Returns
-------
Cotizacion: objeto de la clase cotización con la información del archivo que entra por parametro | 625941d05f7d997b87174c01 |
def _forward(self, x): <NEW_LINE> <INDENT> assert isinstance(x, list) <NEW_LINE> return x[::-1] | :param x: List of tensors
:return: Reversed list of tensors | 625941d097e22403b379d103 |
def close(self) -> bool: <NEW_LINE> <INDENT> self.absolute_move(axis='A', position=0) <NEW_LINE> self.absolute_move(axis='B', position=0) <NEW_LINE> self.__ser.close() | Release the instrument and device driver
and terminate the connection. | 625941d067a9b606de4a8023 |
def srs_double(f): <NEW_LINE> <INDENT> return double_output(f, [c_void_p, POINTER(c_int)], errcheck=True) | Create a function prototype for the OSR routines that take
the OSRSpatialReference object and return a double value. | 625941d03539df3088e2e4b4 |
def remote_origin_url(self, cwd): <NEW_LINE> <INDENT> args = [self.git_binary, "config", "--get", "remote.origin.url"] <NEW_LINE> output = self.ctx.cmd_and_log(args, cwd=cwd) <NEW_LINE> return output.strip() | Runs 'git config --get remote.origin.url' in the directory cwd and
returns the value
:param cwd: The current working directory as a string | 625941d0187af65679ca5288 |
def deleted(self, operator, deleted): <NEW_LINE> <INDENT> self._tql.add_filter('deleted', operator, deleted, TQL.Type.BOOLEAN) | Filter Workflow Events based on **deleted** keyword.
Args:
operator (enum): The operator enum for the filter.
deleted (bool): The deletion status of the event. | 625941d024f1403a92600cce |
def main(): <NEW_LINE> <INDENT> settings = load_settings() <NEW_LINE> fp = DirectoryProcessor.DirectoryProcessor() <NEW_LINE> fp.paths.append(settings["gamePath"]) <NEW_LINE> fp.fileExt = ".SOB" <NEW_LINE> fp.processFunction = convert_SOB <NEW_LINE> fp.run(mode=settings["runMode"]) | Main function that converts test data files | 625941d099fddb7c1c9de4fa |
def qos_map_dscp_cos_mark_dscp_in_values(self, **kwargs): <NEW_LINE> <INDENT> config = ET.Element("config") <NEW_LINE> qos = ET.SubElement(config, "qos", xmlns="urn:brocade.com:mgmt:brocade-qos") <NEW_LINE> map = ET.SubElement(qos, "map") <NEW_LINE> dscp_cos = ET.SubElement(map, "dscp-cos") <NEW_LINE> dscp_cos_map_name... | Auto Generated Code
| 625941d0a17c0f6771cbe1b9 |
def _is_whitelisted(self, conn, hostname): <NEW_LINE> <INDENT> if not self.whitelist_enabled: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if not self.known_dns: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> elif (conn.get("src") in self.known_dns or conn.get("dst") in self.known_dns): <NEW_LINE> <INDENT> pass <... | Checks if whitelisting conditions are met | 625941d0a219f33f34628ad2 |
def normalize(self): <NEW_LINE> <INDENT> return (self.r / 255.0, self.g / 255.0, self.b / 255.0, self.a / 255.0) | Returns the RGBA values in a normalized form with the range
[0;1] as tuple. | 625941d08c3a873295158524 |
def elbow_plot(data, maxK=80, step=2): <NEW_LINE> <INDENT> sse = {} <NEW_LINE> for k in range(1, maxK): <NEW_LINE> <INDENT> if k % step == 0: <NEW_LINE> <INDENT> print("k: ", k) <NEW_LINE> kmeans = MiniBatchKMeans(n_clusters=k, init='k-means++', max_no_improvement=10, random_state=0).fit(data) <NEW_LINE> sse[k / step] ... | Returns Elbow Method Plot (Number of clusters K vs Sum of Squares Errors SSE)
:param data: input data
:param maxK: maximum number of clusters
:param step: k value in k means increments with step size | 625941d04527f215b584c5bf |
def test_exercise_delete_comment_authorized(self): <NEW_LINE> <INDENT> self.user_login() <NEW_LINE> self.exercise_delete_comment(fail=False) | Tests the exercise comments | 625941d09c8ee82313fbb8df |
def test_rnai_by_cell_line_depmap_id_get(self): <NEW_LINE> <INDENT> response = self.client.open( '/depmap/rnai/by_cell_line/{depmap_id}'.format(depmap_id='depmap_id_example'), method='GET') <NEW_LINE> self.assert200(response, 'Response body is : ' + response.data.decode('utf-8')) | Test case for rnai_by_cell_line_depmap_id_get
Retrieve rnai values by cell line | 625941d0d486a94d0b98e2af |
def get_model_with_info(self) -> Tuple[List[TableInfo], Dict]: <NEW_LINE> <INDENT> return (self.get_model(), {}) | Tries to get all tables that are available for the connector and gives back some infos about what happenned | 625941d05e10d32532c5f090 |
def __init__( self, *, certificate_policy: Optional["CertificatePolicy"] = None, certificate_attributes: Optional["CertificateAttributes"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): <NEW_LINE> <INDENT> super(CertificateCreateParameters, self).__init__(**kwargs) <NEW_LINE> self.certificate_policy = certi... | :keyword certificate_policy: The management policy for the certificate.
:paramtype certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy
:keyword certificate_attributes: The attributes of the certificate (optional).
:paramtype certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttr... | 625941d0627d3e7fe0d68fba |
@Action.add_action('security_detail') <NEW_LINE> def action_security_detail(action_object, step_desc, value, loc): <NEW_LINE> <INDENT> securitydetail = action_object.find_element(('xpath', '//h5[text()="功能模式"]/following-sibling::p')).text <NEW_LINE> if value == u"路由保护模式": <NEW_LINE> <INDENT> if securitydetail == u"智能保护... | 功能模式切换
:param action_object:
:param step_desc:
:param value: 路由保护模式/智能保护模式
:param loc:
:return: | 625941d0be7bc26dc91cd768 |
def transform_points(self, points): <NEW_LINE> <INDENT> if self.transform_matrix.shape[1] == 4: <NEW_LINE> <INDENT> points_new = self.apply_3Dsim(points.t(), self.transform_matrix).t() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> points_new = torch.matmul(self.transform_matrix, points) <NEW_LINE> <DEDENT> return point... | transformation for point coordinates.
Input:
- points type: torch.Tensor (3, H*W)
Return:
- points_new type: torch.Tensor (3, H*W) | 625941d03eb6a72ae02ec649 |
def reluconvbn(data, num_filter, init, norm, name, prefix): <NEW_LINE> <INDENT> data = mx.sym.Activation(data, name=name + '_relu', act_type='relu') <NEW_LINE> weight = mx.sym.var(name=prefix + name + "_weight", init=init) <NEW_LINE> bias = mx.sym.var(name=prefix + name + "_bias") <NEW_LINE> data = mx.sym.Convolution(d... | :param data: data
:param num_filter: number of convolution filter
:param init: init method of conv weight
:param norm: normalizer
:param name: name
:return: relu-3x3conv-bn | 625941d0de87d2750b85fefc |
def p_declaration(p): <NEW_LINE> <INDENT> pass | declaration : type assignment SEMICOLON
| assignment SEMICOLON
| function_call SEMICOLON
| array_usage SEMICOLON
| type array_usage SEMICOLON | 625941d0bde94217f3682f5a |
def timesince(when, now=time.time): <NEW_LINE> <INDENT> delta = now() - when <NEW_LINE> result = [] <NEW_LINE> break_next = False <NEW_LINE> for unit, seconds, break_immediately in [ ('year', 365*24*60*60, False), ('month', 30*24*60*60, False), ('week', 7*24*60*60, False), ('day', 24*60*60, True), ('hour', 60*60, False... | Returns the difference between `when` and `now` in human readable form. | 625941d045492302aab5e42d |
def __init__(self, parent=None): <NEW_LINE> <INDENT> from ..ui.array_editor import Ui_Form <NEW_LINE> super().__init__(parent) <NEW_LINE> self._ui = Ui_Form() <NEW_LINE> self._ui.setupUi(self) <NEW_LINE> self._model = ArrayModel(self) <NEW_LINE> self._model.dataChanged.connect(self._update_plot) <NEW_LINE> self._model.... | Args:
parent (QWidget, optional): parent widget | 625941d0a934411ee37517fd |
def __init__(self, task, results): <NEW_LINE> <INDENT> self.task = task <NEW_LINE> self.results = results <NEW_LINE> self.analysis_path = os.path.join(CUCKOO_ROOT, "storage", "analyses", str(task["id"])) <NEW_LINE> self.cfg = Config("reporting") <NEW_LINE> self.task["options"] = parse_options(self.task["options"]) | @param analysis_path: analysis folder path. | 625941d0507cdc57c6306e45 |
def parse_coordinates(infile, alpha_only): <NEW_LINE> <INDENT> handle = open(infile, 'r') <NEW_LINE> coord_dict = OrderedDict() <NEW_LINE> for line in handle: <NEW_LINE> <INDENT> if line.startswith('ATOM'): <NEW_LINE> <INDENT> atom_line = parse_pdb_line(line) <NEW_LINE> if alpha_only: <NEW_LINE> <INDENT> if atom_line[2... | This function will parse a pdb file using the PDB_coordinates class.
If the "alpha_only" argument is set to True the function only reads alpha carbons ("CA").
If it is set to False it will read all atoms. | 625941d08e05c05ec3eea4df |
def set_fitness(self, uid, fitness): <NEW_LINE> <INDENT> chromo = self.get_chromosome(uid) <NEW_LINE> chromo.fitness = fitness <NEW_LINE> self.set_chromosome(chromo.uid, chromo) | Sets the fitness of a specific chromosome. | 625941d0462c4b4f79d1d83a |
def get_mean_baseline(ema_decay=0.99, name=None): <NEW_LINE> <INDENT> def mean_baseline(_, loss): <NEW_LINE> <INDENT> with vs.variable_scope(name, default_name="MeanBaseline"): <NEW_LINE> <INDENT> reduced_loss = math_ops.reduce_mean(loss) <NEW_LINE> ema = training.ExponentialMovingAverage(decay=ema_decay, zero_debias=T... | ExponentialMovingAverage baseline.
Args:
ema_decay: decay rate for the ExponentialMovingAverage.
name: name for variable scope of the ExponentialMovingAverage.
Returns:
Callable baseline function that takes the `StochasticTensor` (unused) and
the downstream `loss`, and returns an EMA of the loss. | 625941d0925a0f43d2549fe1 |
def fabric_enable(self): <NEW_LINE> <INDENT> self._fabric_enable_disable(1) | Enable the core fabric | 625941d0cdde0d52a9e5319e |
def test_execute(self): <NEW_LINE> <INDENT> world = World(MagicMock()) <NEW_LINE> thing = world.create('thing')['id'] <NEW_LINE> box = world.create('box') <NEW_LINE> AddLock(thing, box['id']).execute(world) <NEW_LINE> BreakLock(thing, box['id']).execute(world) <NEW_LINE> self.assertEqual(box['locks'], 0) <NEW_LINE> Bre... | Breaking a lock will reduce the number of locks on a thing. It can't
be reduced below 0, though. | 625941d07b180e01f3dc4966 |
def bmesh_join(list_of_bmeshes, normal_update=False): <NEW_LINE> <INDENT> bm = bmesh.new() <NEW_LINE> add_vert = bm.verts.new <NEW_LINE> add_face = bm.faces.new <NEW_LINE> add_edge = bm.edges.new <NEW_LINE> for bm_to_add in list_of_bmeshes: <NEW_LINE> <INDENT> offset = len(bm.verts) <NEW_LINE> for v in bm_to_add.verts:... | takes as input a list of bm references and outputs a single merged bmesh
allows an additional 'normal_update=True' (default False) to force normal calculations | 625941d0e5267d203edcde06 |
def resumeTask(self): <NEW_LINE> <INDENT> pass | pausing a refocus is forbidden | 625941d094891a1f4081bc14 |
def __init__(self, name): <NEW_LINE> <INDENT> raise NotImplementedError | Creates a named pipe handler | 625941d04c3428357757c491 |
def recv(self): <NEW_LINE> <INDENT> return libmalamute.mlm_client_recv(self._p) | Receive message from server; caller destroys message when done | 625941d00c0af96317bb8352 |
def test_ws_classify_links(self): <NEW_LINE> <INDENT> links = [ 'http://www.facebook.com/matthew.panzarino', 'http://twitter.com/Panzer', 'https://www.linkedin.com/in/matthewpanzarino', '/author/matthew-panzarino/feed/', 'http://th.linkedin.com/in/jmarussell' ] <NEW_LINE> results = self.scraper.classify_links(links) <N... | Tests link cleaning. | 625941d0ac7a0e7691ed4235 |
def derwin(self, nlines, ncols, begin_y, begein_x): <NEW_LINE> <INDENT> return self.win.derwin(nlines, ncols, begin_y, begein_x) | # TODO: FInish this
:param nlines:
:param ncols:
:param begin_y:
:param begein_x:
:return: | 625941d0a17c0f6771cbe1ba |
def match_immediate_char_in_syntax(self, syntax, imm_char): <NEW_LINE> <INDENT> if imm_char == 'i': <NEW_LINE> <INDENT> imm_chars = ['u', 's', 'm', 'r'] <NEW_LINE> <DEDENT> elif imm_char == 'I': <NEW_LINE> <INDENT> imm_chars = ['U', 'S', 'M', 'R'] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise UnexpectedException(... | Find an immediate operand in the syntax with a specified field char.
Args:
syntax (str): Instruction syntax.
imm_char (str): Field char (str of len 1) used in the instruction encoding to
represent a field that holds the value for an immediate operand.
Returns:
Optional[ImmediateTemplate]: if found... | 625941d073bcbd0ca4b2c1e0 |
def start(self, url): <NEW_LINE> <INDENT> self.url = "" <NEW_LINE> self.urlCombo.addItem(self.__normalizeUrl(url)) | Public slot to start the svn info command.
@param url the repository URL to browser (string) | 625941d0462c4b4f79d1d83b |
def main(args): <NEW_LINE> <INDENT> if args.search: <NEW_LINE> <INDENT> result = search(args.search) <NEW_LINE> print(result) <NEW_LINE> <DEDENT> if args.geocode: <NEW_LINE> <INDENT> result = geocode(args.geocode) <NEW_LINE> print(result) <NEW_LINE> <DEDENT> if args.reverse: <NEW_LINE> <INDENT> result = reverse_geocode... | CLI implementation | 625941d0b5575c28eb68e16b |
def _set_option(self, instance): <NEW_LINE> <INDENT> iIndex=self.GetSelectedIndex(instance) <NEW_LINE> if iIndex<=len(self.aSubOptions): <NEW_LINE> <INDENT> self.aSubOption=self.aSubOptions[iIndex] <NEW_LINE> if len(self.aSubOption) > 0: <NEW_LINE> <INDENT> self.uOption=instance.text <NEW_LINE> self._create_subpopup(in... | called when the first option is selected | 625941d0a8370b7717052a09 |
def test_equivalent_potential_temperature_masked(): <NEW_LINE> <INDENT> p = 1000 * units.mbar <NEW_LINE> t = units.Quantity(np.ma.array([293., 294., 295.]), units.kelvin) <NEW_LINE> td = units.Quantity( np.ma.array([280., 281., 282.], mask=[False, True, False]), units.kelvin ) <NEW_LINE> ept = equivalent_potential_temp... | Test equivalent potential temperature calculation with masked arrays. | 625941d0e76e3b2f99f3a974 |
def getTemperature(self) -> float: <NEW_LINE> <INDENT> r = self.getSysfsTempValue(self.cpu_sensor_input_filepath) <NEW_LINE> self.logger.debug(f"CPU temperature: {r} °C") <NEW_LINE> return r | See HotDevice.getTemperature. | 625941d08a349b6b435e82de |
def setPoint(self, point, index, space="'preTransform'"): <NEW_LINE> <INDENT> pass | Set the specified vertex of the current edge to the given value.
Parameters:
point : 'Point'
The new value for the edge
index : 'int'
The vertex index of the current edge we wish to set (0 or 1)
space : 'Space.Space'
The coordinate system for this operation
values: 'transform', 'preTransform', 'object... | 625941d00383005118ecf74c |
def place(cube, position, direction, length, piece_number): <NEW_LINE> <INDENT> for _ in range(length): <NEW_LINE> <INDENT> position += direction <NEW_LINE> assert cube[position] == empty <NEW_LINE> cube[position] = piece_number <NEW_LINE> piece_number += 1 <NEW_LINE> <DEDENT> return position | Place a segment in the cube | 625941d085dfad0860c3afc5 |
def _dup_names(self, one, two): <NEW_LINE> <INDENT> dups = set(one) & set(two) <NEW_LINE> if len(dups) != 0: <NEW_LINE> <INDENT> print("duplicate names:") <NEW_LINE> for x in dups: <NEW_LINE> <INDENT> print(x) <NEW_LINE> <DEDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False | Determine if two sets of names have duplicates.
Arguments:
one (set): First set
two (set): Second set | 625941d056ac1b37e6264338 |
def get_tile(self, tile_name: str) -> ElevationTile: <NEW_LINE> <INDENT> tile = None <NEW_LINE> if tile_name in self.tile_dict: <NEW_LINE> <INDENT> tile = self.tile_dict[tile_name] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> file_name = os.path.join(self.cache_dir, tile_name + ".zip") <NEW_LINE> if not os.path.exists... | Retrieves the tile, either from the web or any of the caches.
:param tile_name: Elevation tile name.
:return: Elevation tile | 625941d0ac7a0e7691ed4236 |
def accept_prior_ratio(X, y, l, current_BMARS, proposed_BMARS, mode='change'): <NEW_LINE> <INDENT> if mode == 'change': <NEW_LINE> <INDENT> return 1.0 <NEW_LINE> <DEDENT> poisson_obj = poisson(l) <NEW_LINE> try: <NEW_LINE> <INDENT> s = X.columns <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> s = list(range(X.shape[1])... | l is lambda which is needed for p(k)
we get a double scalar error - which might indicate that
we exceed float/long precision with either very large or very small values
This is probably due to N**(???) | 625941d066656f66f7cbc316 |
def _mergeGraph(A, B): <NEW_LINE> <INDENT> for key, val in B.nodes.items(): <NEW_LINE> <INDENT> if A.has_node(key): <NEW_LINE> <INDENT> A.nodes[key]['count'] += val['count'] <NEW_LINE> for i in range(len(val['pos'])): <NEW_LINE> <INDENT> if val['pos'][i] not in A.nodes[key]['pos']: <NEW_LINE> <INDENT> A.nodes[key]['pos... | Return the merged graph of A and B. | 625941d0fb3f5b602dac37fe |
def build_event(event, username=None, ip_address=None, properties={}): <NEW_LINE> <INDENT> event_dict = {'event' : event, 'properties': properties} <NEW_LINE> if username: <NEW_LINE> <INDENT> event_dict['properties']['distinct_id'] = username <NEW_LINE> <DEDENT> if ip_address: <NEW_LINE> <INDENT> event_dict['properties... | Returns a JSON encoded object to pass to the mixevent queue
event = string
username = username if one is provided
ip = ip if one is provided.
You need to provide one or the other (actually the event will probably
be tracked anyway but you should identify who triggered it).
properties a dictionary of properties e.g. {'a... | 625941d08e71fb1e9831d913 |
def test_budget_argument_is_None(self): <NEW_LINE> <INDENT> from stalker import Invoice <NEW_LINE> with pytest.raises(TypeError) as cm: <NEW_LINE> <INDENT> Invoice( budget=None, client=self.test_client, amount=1500, unit='TRY' ) <NEW_LINE> <DEDENT> assert str(cm.value) == 'Invoice.budget should be a Budget i... | testing if a TypeError will be raised when the budget argument is
None | 625941d0293b9510aa2c3400 |
@shared_task <NEW_LINE> def dispatch_crawl_entries(): <NEW_LINE> <INDENT> missed_entries = RSSEntry.objects.filter( Q(raw_html__isnull=True) & ( Q(**{"headers__Content-Type__isnull": True}) | Q(**{"headers__Content-Type__icontains": "text/html"}) ) ) <NEW_LINE> session = requests.Session() <NEW_LINE> for rss_entry in m... | Iterate through valid RSSEntries that don't have html and retry query | 625941d0b7558d58953c507e |
def tearDown(self): <NEW_LINE> <INDENT> with self.app.app_context(): <NEW_LINE> <INDENT> db.session.remove() <NEW_LINE> db.drop_all() <NEW_LINE> db.create_all() | teardown all initialized variables. | 625941d06aa9bd52df036f0f |
def __init__(self, alias_name, alias_value, session, command_table, parser, shadow_proxy_command=None): <NEW_LINE> <INDENT> super(ServiceAliasCommand, self).__init__(alias_name, alias_value) <NEW_LINE> self._session = session <NEW_LINE> self._command_table = command_table <NEW_LINE> self._parser = parser <NEW_LINE> sel... | Command for a `toplevel` subcommand alias
:type alias_name: string
:param alias_name: The name of the alias
:type alias_value: string
:param alias_value: The parsed value of the alias. This can be
retrieved from `AliasLoader.get_aliases()[alias_name]`
:type session: botocore.session.Session
:param session: The b... | 625941d023e79379d52ee6ce |
def _pathogenIndex(self, genomeAccessions, result, singular, plural): <NEW_LINE> <INDENT> append = result.append <NEW_LINE> if len(genomeAccessions) == 1: <NEW_LINE> <INDENT> title = singular.title() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> title = '%s (%d)' % (plural.title(), len(genomeAccessions)) <NEW_LINE> <DE... | Create a linked table of contents by pathogen. | 625941d0adb09d7d5db6c8fa |
def __init__(self, vsrl_annot_file): <NEW_LINE> <INDENT> self.vcoco_data = self._load_vcoco(vsrl_annot_file) <NEW_LINE> self._init_vcoco() | Input:
vslr_annot_file: path to the vcoco annotations
coco_annot_file: path to the coco annotations
split_file: image ids for split | 625941d076d4e153a657ec9c |
def copy_txt_from_selected_license(self, license_path, license_name): <NEW_LINE> <INDENT> self.license_source_filename = "data/licenses/{license_name}.txt".format( license_name=license_name, ) <NEW_LINE> with open(self.license_source_filename, "r") as license_source_file: <NEW_LINE> <INDENT> self.license_content = lice... | Copies the license template file, with user customization, to the project structure. | 625941d092d797404e3042f5 |
def date(): <NEW_LINE> <INDENT> t = datetime.datetime.now() <NEW_LINE> return t.strftime("%Y-%m-%d %H:%M:%S.") + str(t.microsecond) | date
print current date and time | 625941d016aa5153ce3625e2 |
def test_help(parser, payload, caplog): <NEW_LINE> <INDENT> with raises(NoExitParserError) as exc: <NEW_LINE> <INDENT> parser.parse_args(['character', 'ability', '--help']) <NEW_LINE> <DEDENT> print(exc.value.text_output) <NEW_LINE> assert exc.value.text_output.startswith('*usage*: /modron character') | Make sure the help printing works | 625941d0ab23a570cc2502ed |
def initialize(self, run_spec): <NEW_LINE> <INDENT> self.setInputCreator(run_spec.inputCreator) <NEW_LINE> self.setOutputRenderer(run_spec.outputRenderer) <NEW_LINE> self.setManualAnnotations(run_spec.manualAnnotations) <NEW_LINE> self.setDefaultAnnotations(run_spec.defaultAnnotations) <NEW_LINE> self._datasources = ru... | Given a RunSpecification instance, initialize self properly. Do not start annotation.
| 625941d0851cf427c661a679 |
def addPseudoTab(self, window: Type[Database]): <NEW_LINE> <INDENT> index = self.tw.tabBar().addTab(f'&{window.title}') <NEW_LINE> self.tw.setTabToolTip(index, f'{window.tooltip} (opens in a new window)') <NEW_LINE> self.tw.setTabEnabled(index, False) <NEW_LINE> self.tw.tabBarClicked.connect(lambda i: window().exec() i... | Add a "pseudo" tab to the central tab widget. Clicking on such a tab should open a new window rather than
displaying something in the tab widget. Returns the shortcut created for the new tab. | 625941d0091ae356686670c8 |
def New(*args, **kargs): <NEW_LINE> <INDENT> obj = itkLabelStatisticsOpeningImageFilterIUL3IUL3.__New_orig__() <NEW_LINE> import itkTemplate <NEW_LINE> itkTemplate.New(obj, *args, **kargs) <NEW_LINE> return obj | New() -> itkLabelStatisticsOpeningImageFilterIUL3IUL3
Create a new object of the class itkLabelStatisticsOpeningImageFilterIUL3IUL3 and set the input and the parameters if some
named or non-named arguments are passed to that method.
New() tries to assign all the non named parameters to the input of the new objects - ... | 625941d00a50d4780f666ffd |
def test_create(self): <NEW_LINE> <INDENT> client = ClientFactory.create() <NEW_LINE> self.assertEqual(Client.objects.count(), 1) | Test the creation of a Client model using a factory | 625941d0b545ff76a8913f80 |
def make_training_examples(self, num_examples, images, targets, bbox_gt_scales): <NEW_LINE> <INDENT> for i in range(num_examples): <NEW_LINE> <INDENT> image_rand_focus, target_pad, bbox_gt_scaled = self.make_training_example_BBShift() <NEW_LINE> images.append(image_rand_focus) <NEW_LINE> targets.append(target_pad) <NEW... | TODO: Docstring for make_training_examples.
:returns: TODO | 625941d0c4546d3d9de72b9f |
def set_labels(self, labels): <NEW_LINE> <INDENT> self.labels = labels | Set the contact labels
Parameters
----------
labels : list of string
labels for each contact pair | 625941d09b70327d1c4e0f40 |
def test_file_load_correct_data(self): <NEW_LINE> <INDENT> with self.tf as tf: <NEW_LINE> <INDENT> old_data = self.tf.data <NEW_LINE> tf.save(self.no_file) <NEW_LINE> <DEDENT> self.tf.data = [] <NEW_LINE> self.tf.load(self.no_file) <NEW_LINE> self.assertEqual(self.tf.data, old_data) | Assert that the data loaded is correct | 625941d0d164cc6175782eb9 |
def mark_cleanup_started(self): <NEW_LINE> <INDENT> self.cleanup_time = time.time() <NEW_LINE> self.save() | Saves the current time, indicating cleanup is beginning.
This will be called for you. | 625941d08a43f66fc4b541d0 |
def plot(data, filenames, game, destination, num_interplt): <NEW_LINE> <INDENT> if isinstance(filenames, str): <NEW_LINE> <INDENT> plt.plot(data[:,0], data[:,1], label=filenames) <NEW_LINE> ax = plt.gca() <NEW_LINE> ax.xaxis.get_major_formatter().set_powerlimits((0,1)) <NEW_LINE> plt.xlabel('# of steps') <NEW_LINE> plt... | This function is used for plotting different agent performance under the same
environment.
Input:
- data: a 2d array(when path is file) or 3d array(when path is folder) of
cumulative rewards, training log files
- filenames: an 1d array of string, agent trained under different environments
Output: results will... | 625941d030c21e258bdfa609 |
def scale_standardize11(self, x,update=False): <NEW_LINE> <INDENT> if update: <NEW_LINE> <INDENT> delta = x - self.scalermean <NEW_LINE> self.scalermean = self.scalermean + delta/self.n <NEW_LINE> self.scalerM2 = self.scalerM2 + delta*(x - self.scalermean) <NEW_LINE> <DEDENT> if (self.n < 2): <NEW_LINE> <INDENT> return... | Online standardization of values to mean 0 and variance 1.
Variance is computed online using the algorithm from Knuth/Welford:
http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Incremental_algorithm | 625941d0dc8b845886cb56a0 |
def Rebuild( self ): <NEW_LINE> <INDENT> self.np.node().removeAllGeoms() <NEW_LINE> coneGeom = p3d.geometry.Cone( self._radius, self._height, self._numSegs, self._degrees, self._axis, self._origin ) <NEW_LINE> self.np.node().addGeomsFrom( coneGeom ) | Rebulid the cone and update geoms. | 625941d05f7d997b87174c03 |
def _execute_command(self, cmd): <NEW_LINE> <INDENT> LOG.info("Executing: %s", cmd) <NEW_LINE> status, stdout, stderr = self.client.execute(cmd) <NEW_LINE> if status: <NEW_LINE> <INDENT> raise RuntimeError("Failed executing command: ", cmd, stderr) <NEW_LINE> <DEDENT> return stdout | Execute a command on server. | 625941d0f548e778e58cd6e9 |
def __ne__(self, other): <NEW_LINE> <INDENT> return not (self == other) | Inequality operator.
INPUT:
- ``other`` -- another instance of :class:`ContinuousMap` to compare
with
OUTPUT:
- True if ``self`` is different from ``other``, or False otherwise
TESTS::
sage: M = Manifold(3, 'M', structure='topological')
sage: X.<x,y,z> = M.chart()
sage: N = Manifold(2, 'N', structu... | 625941d097e22403b379d105 |
def testResendPhoto(self): <NEW_LINE> <INDENT> print('Testing sendPhoto - Resend') <NEW_LINE> message = self._bot.sendPhoto(photo=str('AgAD_v___6-nMRs1PC0HuqtHTCQ9qx0AFAI'), chat_id=12173560) <NEW_LINE> self.assertEqual('AgAD_v___6-nMRs1PC0HuqtHTCQ9qx0AFAI', message.photo[2].file_id) | Test the telegram.Bot sendPhoto method | 625941d07b25080760e395c4 |
def c_support_code_apply(self, node, name): <NEW_LINE> <INDENT> raise utils.MethodNotDefined("c_support_code_apply", type(self), self.__class__.__name__) | Optional: return utility code for use by an `Op` that will be
inserted at global scope, that can be specialized for the
support of a particular `Apply` node.
Parameters
----------
node: an Apply instance in the graph being compiled
name: str
A string or number that serves to uniquely identify this node.
Symbol... | 625941d050485f2cf553cf05 |
def condition_8(houselist): <NEW_LINE> <INDENT> for i in range(5): <NEW_LINE> <INDENT> if houselist[i].color == 'yellow' and houselist[i].cigar == 'dunhill': <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False | The man who lives in the yellow house smokes Dunhill | 625941d09b70327d1c4e0f41 |
def _ProjectForFile(self, file_path): <NEW_LINE> <INDENT> project_root = file_path <NEW_LINE> while project_root: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.projects[project_root] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> project_root = os.path.dirname(project_root)... | Tries to find the project that contains the given file. | 625941d021bff66bcd684abd |
def test_mutated(self): <NEW_LINE> <INDENT> generator = TabooGenerator() <NEW_LINE> generator('<h3 id="V1_mutated">변형</h3>') <NEW_LINE> self.assertEqual(generator.state, _State.MUTATE) <NEW_LINE> generator('<p>변형 범주의 카드는 아래와 같이 문구가 추가되거나 바뀝니다.</p>') <NEW_LINE> generator('<ul>') <NEW_LINE> self.assertEqual( generator(' ... | test mutated parsing | 625941d099fddb7c1c9de4fc |
def setHighlight(self, newValue): <NEW_LINE> <INDENT> if self.highlight != newValue: <NEW_LINE> <INDENT> self.highlight = newValue <NEW_LINE> if not self.isSelected(): <NEW_LINE> <INDENT> self.update() | Changes the highlight status of the group | 625941d0b830903b967e9a76 |
def booth_ticket_operation_failed(operation, reason, site_ip, ticket_name): <NEW_LINE> <INDENT> return ReportItem.error( report_codes.BOOTH_TICKET_OPERATION_FAILED, info={ "operation": operation, "reason": reason, "site_ip": site_ip, "ticket_name": ticket_name, } ) | Pcs uses external booth tools for some ticket_name operations. For example
grand and revoke. But the external command failed.
string operatin determine what was intended perform with ticket_name
string reason is taken from external booth command
string site_ip specifiy what site had to run the command
string ticket... | 625941d08c3a873295158526 |
def loadObs(filename='obs_h.dat', folder=None, varlist=None, lpandas=False): <NEW_LINE> <INDENT> filepath = os.path.join(folder,filename) <NEW_LINE> if lpandas: <NEW_LINE> <INDENT> vardata = pd.read_csv(filepath) <NEW_LINE> vardata[vardata > 10000.] = np.NaN <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> with open(filep... | function to load observation/innovation data from EnKF output | 625941d023e79379d52ee6cf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.