code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def _nest_vars_in_rec(var_items, rec_items, input_order, items_by_key, parallel): <NEW_LINE> <INDENT> num_items = var_items <NEW_LINE> var_items = list(var_items)[0] <NEW_LINE> if rec_items: <NEW_LINE> <INDENT> rec_items = list(rec_items)[0] <NEW_LINE> if ((rec_items == 1 and var_items > 1) or parallel.startswith("batc... | Nest multiple variable inputs into a single record or list of batch records.
Custom CWL implementations extract and merge these. | 625941ec21a7993f00bc8211 |
def getProcessList(self, sortedby='auto'): <NEW_LINE> <INDENT> if (self.process == {}) or ('limits' not in globals()): <NEW_LINE> <INDENT> return self.process <NEW_LINE> <DEDENT> sortedReverse = True <NEW_LINE> if sortedby == 'auto': <NEW_LINE> <INDENT> if psutil_get_cpu_percent_tag: <NEW_LINE> <INDENT> sortedby = 'cpu... | Return the sorted process list | 625941ece1aae11d1e74a1d4 |
def flow_step (self, kNq, rkc, rke, rkf, geo, NX, setting): <NEW_LINE> <INDENT> for ii in range(0,NX): <NEW_LINE> <INDENT> rkc[kNq][ii] = self.momentum_RHS_no_friction ( rke, rkf, geo, ii, setting ) <NEW_LINE> <DEDENT> return rkc | The RHS of momentum for an RK step looped over the domain | 625941ec046cf37aa974d25a |
def create_or_update( self, tag_name, custom_headers=None, raw=False, **operation_config): <NEW_LINE> <INDENT> url = '/subscriptions/{subscriptionId}/tagNames/{tagName}' <NEW_LINE> path_format_arguments = { 'tagName': self._serialize.url("tag_name", tag_name, 'str'), 'subscriptionId': self._serialize.url("self.config.s... | Creates a tag in the subscription.
The tag name can have a maximum of 512 characters and is case
insensitive. Tag names created by Azure have prefixes of microsoft,
azure, or windows. You cannot create tags with one of these prefixes.
:param tag_name: The name of the tag to create.
:type tag_name: str
:param dict cus... | 625941ec3eb6a72ae02eca03 |
def __init__(self, client, model, doc_type, pk, name): <NEW_LINE> <INDENT> self._client = client <NEW_LINE> self.model = model <NEW_LINE> self.doc_type = getattr( model, "__msearch_index__", doc_type, ) <NEW_LINE> self.pk = getattr( model, "__msearch_primary_key__", pk, ) <NEW_LINE> self.searchable = set( getattr( mode... | global index name do nothing, must create different index name | 625941ecaad79263cf390f61 |
def function_recording(conn): <NEW_LINE> <INDENT> recordinst = Recording() <NEW_LINE> while True: <NEW_LINE> <INDENT> y = recordinst.record() <NEW_LINE> conn.put(y) | Function that keeps the recording instance going and puts
the blocks (of hoplength) in the multiprocessing queue.
Input: multiprocessing Queue | 625941ec4f88993c3716c57a |
def find_info_by_to_using_get(self, to_id, to_type, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.find_info_by_to_using_get_with_http_info(to_id, to_type, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self... | Get List of Relation Infos (findInfoByTo) # noqa: E501
Returns list of relation info objects for the specified entity by the 'to' direction. If the user has the authority of 'System Administrator', the server checks that the entity is owned by the sysadmin. If the user has the authority of 'Tenant Administrator', t... | 625941ec8c3a8732951588d9 |
def set_solvent(self, solvent_type): <NEW_LINE> <INDENT> if solvent_type == "": <NEW_LINE> <INDENT> self._solvation = "" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._solvation = "scrf=(solvent=" + solvent_type + ")" | Set the header of the input Gaussian 09 .com file.
E.g:
com.set_solvent("water")
This inserts the keyword "scrf=(solvent=water)". | 625941ec0a366e3fb873ed37 |
def generate_huffman(r_node): <NEW_LINE> <INDENT> if r_node.l_type == 0 and r_node.r_type == 0: <NEW_LINE> <INDENT> return HuffmanNode(None, HuffmanNode(r_node.l_data), HuffmanNode(r_node.r_data)) <NEW_LINE> <DEDENT> elif r_node.l_type == 0 and r_node.r_type == 1: <NEW_LINE> <INDENT> huff_node = HuffmanNode(None, Huffm... | Return a HuffmanNode from a ReadNode.
@param ReadNode r_node: a ReadNode to convert
@rtype: HuffmanNode
>>> huff = generate_huffman(ReadNode(0, 5, 0, 7))
>>> huff == HuffmanNode(None, HuffmanNode(5), HuffmanNode(7))
True
>>> huff = generate_huffman(ReadNode(1, 1, 1, 0))
>>> huff == HuffmanNode(None, HuffmanNode(), Hu... | 625941ecac7a0e7691ed45da |
def test_bind_hebrew(self): <NEW_LINE> <INDENT> output = hbcal("hbcal -id -od --dafbind hebrew -fphonetics") <NEW_LINE> self.assertEqual(1, len(output)) <NEW_LINE> self.assertEqual('Bava Basra 134', output[0]) | Test --dafbind parameter with Hebrew calendar. | 625941ec23e79379d52eea75 |
def addScriptWindow(self): <NEW_LINE> <INDENT> subWin = QMdiSubWindow() <NEW_LINE> child = CodeEditor(self) <NEW_LINE> subWin.setWidget(child) <NEW_LINE> child.setObjectName('script:' + str(uuid.uuid1())) <NEW_LINE> self.mdiArea.setWindowIcon(QIcon('content/images/python_logo.svg')) <NEW_LINE> self.mdiArea.addSubWindow... | Opens a template in the Python script editor
:return: None | 625941ec711fe17d82542878 |
@click.command() <NEW_LINE> @click.argument('config_file') <NEW_LINE> def test_email(config_file): <NEW_LINE> <INDENT> set_config(config_file) <NEW_LINE> set_debug_level() <NEW_LINE> send_test_email() | Simple routine for sending a test email. | 625941ec63f4b57ef0001622 |
def ReadAll(conn): <NEW_LINE> <INDENT> data = STRINGIO() <NEW_LINE> while True: <NEW_LINE> <INDENT> ready, _, _ = select.select([conn], [], [], READ_TIMEOUT_IN_SEC) <NEW_LINE> if not ready: <NEW_LINE> <INDENT> raise Exception('read time out') <NEW_LINE> <DEDENT> snippet = conn.recv(16) <NEW_LINE> if not snippet: <NEW_L... | Read all data in connection assuming it is http request.
Args:
conn: socket instance to read.
Returns:
data read from conn. | 625941ecfbf16365ca6f66e7 |
def rotate(self,factor): <NEW_LINE> <INDENT> dt = numpy.deg2rad(factor) <NEW_LINE> rot = numpy.mat([[numpy.cos(dt),-numpy.sin(dt)],[numpy.sin(dt),numpy.cos(dt)]]) <NEW_LINE> xo,yo = self.get_centroid() <NEW_LINE> def rotate_point(x,y): <NEW_LINE> <INDENT> new_pos = rot*(numpy.array((x-xo,y-yo)).reshape((2,1))) <NEW_LIN... | rotate counter clockwise (factor > 0) or clockwise (factor < 0) | 625941ec76d4e153a657f04b |
def get_forms(self): <NEW_LINE> <INDENT> url = f"{BASE_URL}/forms/v2/forms" <NEW_LINE> replication_key = list(self.replication_keys['forms'])[0] <NEW_LINE> records = [] <NEW_LINE> response = self.get(url) <NEW_LINE> records.extend([record for record in response if record[replication_key] >= self.start_date]) <NEW_LINE>... | Get all forms. | 625941ec63b5f9789fde75fe |
@ckan.logic.side_effect_free <NEW_LINE> def basket_element_list(context, data_dict): <NEW_LINE> <INDENT> tk.check_access('basket_owner_only', context, data_dict) <NEW_LINE> model = context['model'] <NEW_LINE> id = _get_or_bust(data_dict, 'id') <NEW_LINE> q = model.Session.query(BasketAssociation, model.Package) ... | List all elements in basket
:param id: The id of the basket
:type id: string
:returns: | 625941ec24f1403a9260107a |
def update(self, scene_info): <NEW_LINE> <INDENT> global ball_destination_1P <NEW_LINE> global ball_destination_2P <NEW_LINE> import pickle <NEW_LINE> import numpy as np <NEW_LINE> filename = "C:\\Users\\bigse\\MLGame\\games\\pingpong\\SVM_example_2P.sav" <NEW_LINE> model = pickle.load(open(filename,'rb')) <NEW_LINE> h... | Generate the command according to the received scene information | 625941eccdde0d52a9e5354f |
def unprecondition(self, x_c): <NEW_LINE> <INDENT> return self._a_times(x_c) | Multiply by the preconditioner to convert
:math:`x_c` in the preconditioned domain to :math:`x` in the
original domain. | 625941ecd53ae8145f87a77d |
def kbrl_norm_kernel(self, s, a, j): <NEW_LINE> <INDENT> normalizer = 0 <NEW_LINE> for i in range(self.n(a)): <NEW_LINE> <INDENT> normalizer += self.kbrl_kernel(s, self.s(a, i)) <NEW_LINE> <DEDENT> return self.kbrl_kernel(s, self.s(a, j)) / normalizer | Return the value of the normalized KBRL kernel for state s and the jth
initial state for action a. | 625941ec6e29344779a62b28 |
def move(src, dst): <NEW_LINE> <INDENT> print("Moving file '%s' to directory '%s' ..." % (src, dst)), <NEW_LINE> shutil.move(src, dst) <NEW_LINE> done() | Moves file whose path is SRC to directory whose path is DST. Both SRC and
DST must exist. | 625941ecd99f1b3c44c67a9d |
def show_author_link(): <NEW_LINE> <INDENT> site = getSite() <NEW_LINE> if IS_PLONE_5: <NEW_LINE> <INDENT> registry = getUtility(IRegistry) <NEW_LINE> if registry['plone.allow_anon_views_about']: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> site_props = getToolByName(site, 'por... | Checks if the user is anonymous and allowAnonymousViewAbout is true.
| 625941ec460517430c39468f |
def testNoDeadlockFromQueue(self): <NEW_LINE> <INDENT> config = config_pb2.ConfigProto( inter_op_parallelism_threads=1, intra_op_parallelism_threads=1) <NEW_LINE> with self.session(config=config) as sess: <NEW_LINE> <INDENT> thread_data_t = collections.namedtuple("thread_data_t", ["thread", "queue", "output"]) <NEW_LIN... | Tests that reading does not block main execution threads. | 625941ecd10714528d600201 |
def populate_from_array(currentNode, numbers, arraySize): <NEW_LINE> <INDENT> index = arraySize/2 <NEW_LINE> value = numbers[index] <NEW_LINE> assert( currentNode != None ) <NEW_LINE> currentNode.Notedata = numbers[index] <NEW_LINE> currentNode.NodeleftLink = None <NEW_LINE> currentNode.NoderightLink = None <NEW_LINE> ... | precondition: arraySize accurately states the number of items in numbers,
numbers refers to an allocated space for storing numbers,
thisNode points to an existing node (and not some random point in memory)
postcondition: thisNode will point to a tree that has as its children
and leaves the balanced binary s... | 625941ecb57a9660fec33da4 |
def kl(self, prob0, prob1): <NEW_LINE> <INDENT> if len(prob0.size()) == 3: <NEW_LINE> <INDENT> prob0 = prob0.view(-1, 2 * self.d) <NEW_LINE> prob1 = prob1.view(-1, 2 * self.d) <NEW_LINE> <DEDENT> mean0 = prob0[:, :self.d] <NEW_LINE> std0 = prob0[:, self.d:] <NEW_LINE> mean1 = prob1[:, :self.d] <NEW_LINE> std1 = prob1[:... | Method computes KL Divergence of between two probability distributions
Note: this is D_KL(prob0 || prob1), not D_KL(prob1 || prob0) | 625941ec71ff763f4b549bad |
def execute(fd): <NEW_LINE> <INDENT> pid = os.getpid() <NEW_LINE> path = "/proc/{}/fd/{}".format(pid, fd) <NEW_LINE> argv = [path] <NEW_LINE> env = {} <NEW_LINE> os.execve(path, argv, env) | execve requires the path to the file descriptor | 625941ec6fece00bbac2dc5d |
def get_test_system(course_id=SlashSeparatedCourseKey('org', 'course', 'run')): <NEW_LINE> <INDENT> user = Mock(name='get_test_system.user', is_staff=False) <NEW_LINE> descriptor_system = get_test_descriptor_system() <NEW_LINE> def get_module(descriptor): <NEW_LINE> <INDENT> module_system = get_test_system() <NEW_LINE>... | Construct a test ModuleSystem instance.
By default, the render_template() method simply returns the repr of the
context it is passed. You can override this behavior by monkey patching::
system = get_test_system()
system.render_template = my_render_func
where `my_render_func` is a function of the form my_ren... | 625941ec566aa707497f4a7a |
def parse_fcn(self, pos): <NEW_LINE> <INDENT> self.fcn = pb.bit_get(self.packet, pos, self.R.fcn_size, ret_type=int) <NEW_LINE> return self.R.fcn_size | parse fcn in the frame.
assuming that fcn_size is not zero. | 625941ec5510c4643540f8ef |
def select_calfiles(self, caltype=None, disperser=None, ifsfilt=None, apodizer=None, lyotmask=None, itime=None, readoutmode=None, datestr=None, return_mask=False, return_indices=False, return_objects=False): <NEW_LINE> <INDENT> mask = np.ones(len(self.table), dtype=bool) <NEW_LINE> if caltype is not None: mask = mask &... | Return a list of one or more calibration files that match some chosen query criteria
Provide one or more selection criteria when calling. These will be combined with logical AND such that only
files matchings all critera are returned.
Parameters
-----------
various parameters for the different criteria
return_mask :... | 625941ecf9cc0f698b140b0f |
def test_good_user_creation(self): <NEW_LINE> <INDENT> data = json.dumps({ "username" : "mark", "email" : "mark@gmail.com", "password" : "secret12345", "confirm_password" : "secret12345"}) <NEW_LINE> response = self.app.post( '/api/v3/users', data=data, content_type='application/json', headers=self.admin_header) <NEW_L... | Tests successfully creating a new user | 625941ec4d74a7450ccd46dd |
def modify_security_group( name, region, rules, rules_egress, group_id=None, test=False, aws_key=None, aws_secret=None, ec2conn=None, group=None): <NEW_LINE> <INDENT> rules = rules or [] <NEW_LINE> rules_egress = rules_egress or [] <NEW_LINE> if ec2conn is None: <NEW_LINE> <INDENT> ec2conn = __salt__['aws_util.ec2conn'... | Modify the rules of a security group
Most parameters are described in :meth:`.manage_security_group` | 625941ec3617ad0b5ed6840f |
def _asSql(self, connection): <NEW_LINE> <INDENT> if ((self._fields and len(self._fields) > 1) or (not self._fields and len(self.modal._meta.fields) > 1)): <NEW_LINE> <INDENT> raise TypeError('Cannot use a multi-field %s as a filter value.' % self.__class__.__name__) <NEW_LINE> <DEDENT> obj = self._clone() <NEW_LINE> i... | For ValuesQuerySet (and subclasses like ValuesListQuerySet), they can
only be used as nested queries if they're already set up to select only
a single field (in which case, that is the field column that is
returned). This differs from QuerySet.asSql(), where the column to
select is set up by Theory. | 625941ec30dc7b7665901e79 |
def get_similarities(self): <NEW_LINE> <INDENT> self.similar = imdb.get_title_similarities(self.ID) | Gets similarity data | 625941ec0a50d4780f6673af |
def generateSupercell(uc, supersize=[2,2,2]): <NEW_LINE> <INDENT> from AbInitio.AbiPhon.PhonCalc import PhonCalc <NEW_LINE> pc = PhonCalc(uc, name='', supersize=supersize, abiCalc=None) <NEW_LINE> pc.genSupercell() <NEW_LINE> supercell = pc._supercell <NEW_LINE> return supercell | generate a supercell from the primitive unitcell,
and a number of repetitions along each cell-vector ('supersize'). | 625941ecd99f1b3c44c67a9e |
def test_normalised_primary_matrix(self): <NEW_LINE> <INDENT> np.testing.assert_almost_equal( normalised_primary_matrix( np.array([0.73470, 0.26530, 0.00000, 1.00000, 0.00010, -0.07700]), np.array([0.32168, 0.33767])), np.array( [[9.52552396e-01, 0.00000000e+00, 9.36786317e-05], [3.43966450e-01, 7.28166097e-01, -7.2132... | Tests
:func:`colour.models.rgb.derivation.normalised_primary_matrix`
definition. | 625941ec004d5f362079a848 |
def plusOne(self, digits): <NEW_LINE> <INDENT> index = len(digits) - 1 <NEW_LINE> c = 0 <NEW_LINE> digits[index] += 1 <NEW_LINE> if digits[index] < 10: <NEW_LINE> <INDENT> return digits <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> while index >= 0: <NEW_LINE> <INDENT> if digits[index] + c >= 10: <NEW_LINE> <INDENT> di... | :type digits: List[int]
:rtype: List[int] | 625941ecec188e330fd5acad |
def subsets(self, nums): <NEW_LINE> <INDENT> res = list() <NEW_LINE> for i in range(len(nums)+1): <NEW_LINE> <INDENT> cs = combinations(nums, i) <NEW_LINE> for combination in cs: <NEW_LINE> <INDENT> res.append(list(combination)) <NEW_LINE> <DEDENT> <DEDENT> return res | :type nums: List[int]
:rtype: List[List[int]] | 625941ecad47b63b2c50a498 |
def diff_roessler(value_array, a, c): <NEW_LINE> <INDENT> b=a <NEW_LINE> diff_array = np.zeros(3) <NEW_LINE> diff_array[0] = -value_array[1] - value_array[2] <NEW_LINE> diff_array[1] = value_array[0] + a * value_array[1] <NEW_LINE> diff_array[2] = b + value_array[2] * (value_array[0] - c) <NEW_LINE> return diff_array | The Roessler attractor differential equation
:param value_array: 3d array containing the x,y, and z component values.
:param a: Constant attractor parameter
:param c: Constant attractor parameter
:return: 3d array of the Roessler system evaluated at `value_array` | 625941eca05bb46b383ecd35 |
@command <NEW_LINE> @requires_network <NEW_LINE> def annex_pull(collection_path, file_path_rel): <NEW_LINE> <INDENT> collection = DDRCollection(collection_path) <NEW_LINE> file_path_abs = os.path.join(collection.path, file_path_rel) <NEW_LINE> logging.debug(' collection.path {}'.format(collection.path)) <NEW_LINE> l... | git-annex copy a file from workbench.
Example file_paths:
ddr-densho-1-1/files/video1.mov
ddr-densho-42-17/files/image35.jpg
ddr-one-35-248/files/newspaper.pdf
@param collection_path: Absolute path to collection repo.
@param file_path_rel: Path to file relative to collection root.
@return: message ('o... | 625941ec16aa5153ce362991 |
def set_trunk_provisioning_status_in_grid(self, status): <NEW_LINE> <INDENT> is_set = None <NEW_LINE> try: <NEW_LINE> <INDENT> self.logger.info('Start: set trunk provisioning status in grid') <NEW_LINE> self._carrier_page.set_trunk_provisioning_status_in_grid(status) <NEW_LINE> is_set = True <NEW_LINE> <DEDENT> except ... | Returning set trunk provisioning status in grid
Implementing set trunk provisioning status in grid functionality
:param status:
:return: True/False | 625941ec377c676e912726c0 |
def open_file_xjob(file_xjob): <NEW_LINE> <INDENT> with open(file_xjob) as f: <NEW_LINE> <INDENT> lines = f.readlines() <NEW_LINE> clean_lines = (line.strip() for line in lines) <NEW_LINE> cleaned2 = [elmt.strip('<CellValue>').strip('</') for elmt in clean_lines if elmt.startswith('<CellValue>')] <NEW_LINE> <DEDENT> ve... | Opens *.xjob file after checking typed filename (if it exists).
Firstable, lines in *.xjob file are cleaned. Each value typed in
"SamplePosition", "RawFile", "SampleID", "ExperimentFile", "Sample_holder",
"User", "Group", "Price" and "Comment" are copied/pasted
in 'cleaned2' list.
Finally, 'verif_characters()' is lau... | 625941ecb5575c28eb68e51e |
def is_valid_file(argparser, arg): <NEW_LINE> <INDENT> if arg is None or "debug" in arg: <NEW_LINE> <INDENT> return arg <NEW_LINE> <DEDENT> fpath = os.path.abspath(arg) <NEW_LINE> if not os.path.exists(fpath): <NEW_LINE> <INDENT> argparser.error("Could not find the file %s." % arg) <NEW_LINE> <DEDENT> else: <NEW_LINE> ... | ref: https://stackoverflow.com/questions/11540854/file-as-command-line-argument-for-argparse-error-message-if-argument-is-not-va | 625941ec8e71fb1e9831dcc0 |
def __str__(self): <NEW_LINE> <INDENT> return "<PendingEnterpriseCustomerUser {ID}>: {enterprise_name} - {user_email}".format( ID=self.id, enterprise_name=self.enterprise_customer.name, user_email=self.user_email, ) | Return human-readable string representation. | 625941ec5e10d32532c5f43e |
def parite2(bits): <NEW_LINE> <INDENT> somme_bits = sum( bits ) <NEW_LINE> if somme_bits % 2 : <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 0 | Fonction qui renvoie la valeur du bit de parite d'un un mot binaire donne sous forme
d'une liste de 0 et de 1 nommee bits | 625941ec94891a1f4081bfc5 |
def get_years(self): <NEW_LINE> <INDENT> con = sqlite3.connect(self.db) <NEW_LINE> cur = con.cursor() <NEW_LINE> years = cur.execute("select distinct year from yeardata").fetchall() <NEW_LINE> for year in years: <NEW_LINE> <INDENT> print((year[0])) <NEW_LINE> <DEDENT> return [a[0] for a in years] | Gets all years stored in the database
:return: | 625941ec26068e7796caf200 |
def inject_listener(cls): <NEW_LINE> <INDENT> cls.methods.append( MethodDeclaration( name=Identifier("enterNode"), arguments=[ Argument( name=Identifier("listener"), type=TypeReference(Identifier("ASTListener")) ) ], returns=[], body=Block([ "listener->enter{}(this);".format(cls.name), ]), modifiers=[ Modifier.ABSTRACT... | :type cls: ust.ClassDeclaration | 625941ec5510c4643540f8f0 |
def register(self, evt, handler): <NEW_LINE> <INDENT> if not (evt and handler): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if not issubclass(handler, Event): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> self.handlers[evt] = handler <NEW_LINE> return handler | Register the mapping of event name and the handler | 625941ec167d2b6e312190ae |
def _parse_vmin_vmax(self, field, vmin, vmax): <NEW_LINE> <INDENT> field_dict = self.fields[field] <NEW_LINE> if vmin is None: <NEW_LINE> <INDENT> if 'valid_min' in field_dict: <NEW_LINE> <INDENT> vmin = field_dict['valid_min'] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> vmin = -6 <NEW_LINE> <DEDENT> <DEDENT> if vmax... | Parse and return vmin and vmax parameters. | 625941ec8a43f66fc4b54579 |
def rank(mat, atol=1E-13, rtol=0.0): <NEW_LINE> <INDENT> mat = np.atleast_2d(mat) <NEW_LINE> s = sl.svd(mat, compute_uv=False) <NEW_LINE> tol = max(atol, rtol * s[0]) <NEW_LINE> rank = int((s >= tol).sum()) <NEW_LINE> return rank | Estimate the rank (i.e. the dimension of the nullspace) of a matrix.
The algorithm used by this function is based on the singular value
decomposition of `mat`.
Taken from: http://wiki.scipy.org/Cookbook/RankNullspace
Parameters
----------
mat : ndarray
mat should be at most 2-D. mat 1-D array with length n will... | 625941ec656771135c3ebd8e |
def test_command_line_interface(self): <NEW_LINE> <INDENT> runner = CliRunner() <NEW_LINE> result = runner.invoke(cli.main) <NEW_LINE> assert result.exit_code == 0 <NEW_LINE> assert 'sdf.cli.main' in result.output <NEW_LINE> help_result = runner.invoke(cli.main, ['--help']) <NEW_LINE> assert help_result.exit_code == 0 ... | Test the CLI. | 625941ec1f037a2d8b946716 |
def inorderSuccessor(self, root, p): <NEW_LINE> <INDENT> if root is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> def dfs(root, p, found_p): <NEW_LINE> <INDENT> node = None <NEW_LINE> if root.left: <NEW_LINE> <INDENT> node, found_p = dfs(root.left, p, found_p) <NEW_LINE> <DEDENT> if node: <NEW_LINE> <INDENT... | :type root: TreeNode
:type p: TreeNode
:rtype: TreeNode | 625941ec21bff66bcd684e67 |
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'yandex_afisha.settings') <NEW_LINE> try: <NEW_LINE> <INDENT> from django.core.management import execute_from_command_line <NEW_LINE> <DEDENT> except ImportError as exc: <NEW_LINE> <INDENT> raise ImportError( "Couldn't import Django. Are yo... | Run administrative tasks. | 625941ec63f4b57ef0001623 |
def save(self): <NEW_LINE> <INDENT> fp = open(self.fileName, 'w') <NEW_LINE> try: <NEW_LINE> <INDENT> self.write(fp) <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> fp.close() | Save configuration to config file. | 625941ece8904600ed9f244f |
def findb(self): <NEW_LINE> <INDENT> B=[] <NEW_LINE> for i in range(len(self.tv)): <NEW_LINE> <INDENT> vl=self.vl[i] <NEW_LINE> if self.tv[i]>self.tstop: <NEW_LINE> <INDENT> t=self.tstop <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> t=self.tv[i] <NEW_LINE> <DEDENT> E=self.xi*self.Q*t <NEW_LINE> U=E/vl <NEW_LINE> B.appe... | Compute magnetic field strength in the lobes
Updated attributes:
B -- The magnetic field strength as a function of time | 625941ec4a966d76dd55152e |
@command(args_types=(str, ), optional=1) <NEW_LINE> def help(command=None): <NEW_LINE> <INDENT> message = StringIO() <NEW_LINE> if command: <NEW_LINE> <INDENT> cmd = REGISTERED_COMMANDS.get(command) <NEW_LINE> if not cmd: <NEW_LINE> <INDENT> raise REPLException( "Can't show help for unknown command: '{}'".format(comman... | Display help about commands or list available commands.
:param command: The name of the command to get it's specific help message.
:type command: str
If nor argument is provided, the short help message will be printed for all
available commands. If the provided command name is not found, an exception
will be raised. | 625941ec0a50d4780f6673b0 |
def test_detect_network_delay(self): <NEW_LINE> <INDENT> servers, entries, clock_skew, db = self.db_setup() <NEW_LINE> assign_address(1, "Erica", False, servers) <NEW_LINE> assign_address(2, "Alison", False, servers) <NEW_LINE> entries.insert(self.generate_doc( "status", "Erica", "STARTUP2", 5, "Alison", datetime.now()... | Test the case where there are time differences
too small to be considered clock skew | 625941ecbe7bc26dc91cdb0f |
def stopInternalModification(self): <NEW_LINE> <INDENT> self.__internalModification = False | Stop emitting C{userModification} signal when associated
L{QLineEdit<qt.QLineEdit>} is modified.
@see: L{startInternalModification} | 625941eca79ad161976cc65f |
def test_set_config_replace(self): <NEW_LINE> <INDENT> basedir = self.mktemp() <NEW_LINE> new_config = config_from_string(basedir, "", "", ValidConfiguration.everything()) <NEW_LINE> new_config.set_config("foo", "bar", "value1") <NEW_LINE> new_config.set_config("foo", "bar", "value2") <NEW_LINE> self.assertEqual( new_c... | ``_Config.set_config`` can be called with a section and item that already
exists to change an existing value to a new one. | 625941ec96565a6dacc8fbe3 |
def close(self): <NEW_LINE> <INDENT> if isinstance(self.handle, UE9TCPHandle) or isinstance(self.handle, LJSocketHandle): <NEW_LINE> <INDENT> self.handle.close() <NEW_LINE> <DEDENT> elif _os_name == 'posix': <NEW_LINE> <INDENT> staticLib.LJUSB_CloseDevice(self.handle) <NEW_LINE> <DEDENT> elif self.devType == 0x501: <NE... | close()
This function is not specifically supported in the LabJackUD driver
for Windows and so simply calls the UD function Close. For Mac and unix
drivers, this function MUST be performed when finished with a device.
The reason for this close is because there can not be more than one program
with a given device open... | 625941ec97e22403b379d4b5 |
def _sliding_chunks_matmul_attn_probs_value( attn_probs: torch.Tensor, value: torch.Tensor, window_overlap: int ): <NEW_LINE> <INDENT> batch_size, seq_len, num_heads, head_dim = value.size() <NEW_LINE> assert seq_len % (window_overlap * 2) == 0 <NEW_LINE> assert attn_probs.size()[:3] == value.size()[:3] <NEW_LINE> asse... | Same as _sliding_chunks_query_key_matmul but for attn_probs and value tensors.
Returned tensor will be of the same shape as `attn_probs` | 625941ec30dc7b7665901e7a |
def redunCheckZ3(s, newCond): <NEW_LINE> <INDENT> res = '' <NEW_LINE> s.push() <NEW_LINE> s.add(newCond) <NEW_LINE> r1 = (s.check()==sat) <NEW_LINE> s.pop() <NEW_LINE> s.push() <NEW_LINE> s.add(Not(newCond)) <NEW_LINE> r2 = (s.check()==sat) <NEW_LINE> s.pop() <NEW_LINE> if r1 == True and r2 == True: <NEW_LINE> <INDENT>... | Description: pass through a set of constrains s,
check the redundecny of new constraint newCond
:type z3.z3.Solver: s
:type z3.z3.BoolRef: newCond
:rtype: string | 625941ec6fb2d068a760f5bf |
def choose_best_feature_to_split(data_set): <NEW_LINE> <INDENT> data_size = len(data_set) <NEW_LINE> feature_size = len(data_set[0]) - 1 <NEW_LINE> base_entropy = cal_shannon_entropy(data_set) <NEW_LINE> biggest_entropy_difference = 0.0 <NEW_LINE> best_feature = -1 <NEW_LINE> for i in range(feature_size): <NEW_LINE> <I... | 选择最好的数据集划分方式
:param data_set: 待划分数据集
:return: | 625941ecd486a94d0b98e660 |
def getDiscoveryRunResult(self, runid, result="Success", offset=None, results_id=None, format=None, limit = 100, delete = False): <NEW_LINE> <INDENT> self.params['offset'] = offset <NEW_LINE> self.params['results_id'] = results_id <NEW_LINE> self.params['format'] = format <NEW_LINE> self.params['limit'] = limit <NEW_LI... | Get a summary of the results from scanning all endpoints in the run that had a specific type of result. | 625941ec5fcc89381b1e1bdd |
def getSource(self): <NEW_LINE> <INDENT> return _libsedml.SedModel_getSource(self) | getSource(SedModel self) -> string | 625941ec4e4d5625662d48ea |
def process(self, batch, device, train): <NEW_LINE> <INDENT> batch = list(batch) <NEW_LINE> if self.sequential: <NEW_LINE> <INDENT> if self.fix_length is not None: <NEW_LINE> <INDENT> raise ValueError("cannot use fix_length with Matchbox") <NEW_LINE> <DEDENT> batch = [([] if self.init_token is None else [self.init_toke... | Process a list of examples to create a matchbox.MaskedBatch.
Args:
batch (list(object)): A list of examples comprising a batch.
Returns:
matchbox.MaskedBatch: Processed batch given the input and custom
postprocessing Pipeline. | 625941ec3d592f4c4ed1d579 |
def check_removed_name(self, n): <NEW_LINE> <INDENT> res = {'result': None, 'message': None, 'secondary': [], 'warnings': []} <NEW_LINE> name = n <NEW_LINE> if name.find('.') == -1: <NEW_LINE> <INDENT> name = name + self.config.default_domain <NEW_LINE> <DEDENT> is_ip = False <NEW_LINE> if self.ip_regex.match(name): <N... | Test a removed name
@param n name that should be removed | 625941eca17c0f6771cbe569 |
def get_blocks_with_txs(self) -> List[str]: <NEW_LINE> <INDENT> r = self.request.get("block") <NEW_LINE> result = cast(List[str], r) <NEW_LINE> return result | List all block heights which contain any wallet transactions.
Returns an array of block heights | 625941ec24f1403a9260107b |
def defineDataServer(undefine=bool, server="string", device="string"): <NEW_LINE> <INDENT> pass | defineDataServer is undoable, NOT queryable, and NOT editable.
Connects to the specified data servername, creating a named device which then can be attached to device handlers.
When the device is defined, it queries queries the server for data axis information. The "CapChannels" present are represented a... | 625941ecbe7bc26dc91cdb10 |
def __init__(self, height, width, fx, fy=None, cx=None, cy=None, pose=tfx.identity_tf()): <NEW_LINE> <INDENT> self.height_ = height <NEW_LINE> self.width_ = width <NEW_LINE> self.fx_ = fx <NEW_LINE> self.pose_ = pose <NEW_LINE> if fy is None: <NEW_LINE> <INDENT> self.fy_ = fx <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDEN... | Init camera parameters
Params:
height: (int or float) height of image
width: (int of flaot) width of image
fx: (float) x focal length of camera in pixels
fy: (float) y focal length of camera in pixels
cx: (float) optical center of camera in pixels along x axis
cy: (float) optical center of camera in ... | 625941ec4c3428357757c83e |
def create_ec2_role(self, role, bound_ami_id=None, bound_account_id=None, bound_iam_role_arn=None, bound_iam_instance_profile_arn=None, role_tag=None, max_ttl=None, policies=None, allow_instance_migration=False, disallow_reauthentication=False, period="", **kwargs): <NEW_LINE> <INDENT> params = { 'role': role, 'disallo... | POST /auth/aws/role/<role> | 625941eca934411ee3751baf |
def get_host_ip() -> str: <NEW_LINE> <INDENT> import socket <NEW_LINE> try: <NEW_LINE> <INDENT> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) <NEW_LINE> s.connect(("8.8.8.8", 80)) <NEW_LINE> ip = s.getsockname()[0] <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> ip = "UNKNOWN" <NEW_LINE> <DEDENT> finally: <NEW_L... | Get host ip.
Returns:
str: The obtained ip. UNKNOWN if failed. | 625941ec956e5f7376d71385 |
def redoN(self, nRedo=1): <NEW_LINE> <INDENT> changed = 0 <NEW_LINE> while self.redoBuffer and nRedo > 0: <NEW_LINE> <INDENT> code = self.redoBuffer.pop() <NEW_LINE> self.append(code, isUndoable=1) <NEW_LINE> nRedo = nRedo - 1 <NEW_LINE> changed = 1 <NEW_LINE> <DEDENT> return changed | Redo last nRedo edits and replot. Returns true if plot changed. | 625941ec2ae34c7f2600d64a |
def getUsersFromGithubOrg(self, org): <NEW_LINE> <INDENT> self.logger.info("get users from github org:%s" % org) <NEW_LINE> org = self.api.get_organization(org) <NEW_LINE> members_pagedlist = org.get_members() <NEW_LINE> members = fetchall_from_paginated_list(members_pagedlist) <NEW_LINE> for user in members: <NEW_LINE... | populates user models from github organization.
@param org str: organization name. | 625941ec8da39b475bd65494 |
def save_to_string(self, *args): <NEW_LINE> <INDENT> return _pypl.plSerializer_save_to_string(self, *args) | save_to_string(plSerializer self, plPythonSerializer::ArchiveType format=XML_ARCHIVE) -> PyObject
save_to_string(plSerializer self) -> PyObject * | 625941eccb5e8a47e48b7fbc |
def test_1_pattern_count(self): <NEW_LINE> <INDENT> DNA = 'GCGCG' <NEW_LINE> PATTERN = 'GCG' <NEW_LINE> with self.assertRaises(ValueError): <NEW_LINE> <INDENT> dna.pattern_count(DNA, PATTERN, -1) <NEW_LINE> <DEDENT> with self.assertRaises(ValueError): <NEW_LINE> <INDENT> dna.pattern_count(DNA, PATTERN, 10) <NEW_LINE> <... | Tests for pattern_count method...
| 625941ec8c3a8732951588db |
def is_empty(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return not bool(self._session_key) and not self._session_cache <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> return True | Returns True when there is no session_key and the session is empty | 625941ec627d3e7fe0d6936b |
def name_address(self): <NEW_LINE> <INDENT> retval = make_address( name=self.full_name, street=self.street, city=self.city, state=self.state_name, zip=self.zipcode, wrap=2) <NEW_LINE> return retval | (Street, City, State, ZIP code) | 625941ec31939e2706e4d37c |
def replace_parameters2(node_chain_spec, parameter_setting): <NEW_LINE> <INDENT> node_chain_spec = yaml.load(string.Template( node_chain_spec).safe_substitute(**parameter_setting)) <NEW_LINE> return eval_in_list(node_chain_spec) | Replace parameters and evaulate python statements | 625941ec1d351010ab856034 |
def main(path_file, path_store): <NEW_LINE> <INDENT> graph_name = __extract_name__(path_file) <NEW_LINE> path_store = os.path.join(path_store, graph_name + '.gv') <NEW_LINE> input_stream = FileStream(path_file) <NEW_LINE> lexer = GlobalGraphLexer(input_stream) <NEW_LINE> stream = CommonTokenStream(lexer) <NEW_LINE> try... | Aim of this function is to take a string of the GlobalGraph grammar
and translate it in a dot (graph description language) file. | 625941ec097d151d1a223371 |
def apply_patch(content, patches, reverse=False, fuzz=2): <NEW_LINE> <INDENT> if not isinstance(patches, collections.Sequence): <NEW_LINE> <INDENT> patches = [patches] <NEW_LINE> <DEDENT> contentfile = tempfile.NamedTemporaryFile(delete=False) <NEW_LINE> try: <NEW_LINE> <INDENT> contentfile.write(content) <NEW_LINE> co... | Apply a patch with optional fuzz - uses the commandline 'patch' utility. | 625941ec5fdd1c0f98dc074f |
def segment_update(self, id, seg_id, opts): <NEW_LINE> <INDENT> _params = {'id': id, 'seg_id': seg_id, 'opts': opts} <NEW_LINE> return self.master.call('lists/segment-update', _params) | Update an existing segment. The list and type can not be changed.
Args:
id (string): the list id to connect to. Get by calling lists/list()
seg_id (int): the segment to updated. Get by calling lists/segments()
opts (struct): various options to update::
opts.name (string): a unique name per list for the... | 625941ec23e79379d52eea77 |
def test_xmlrpclib_failure_without_patch(self): <NEW_LINE> <INDENT> self.assertTrue(self.db_admin.create_group('foo')) <NEW_LINE> self.assertRaises(xmlrpclib.ResponseError, self.db_admin.server.removeGroup, 'foo') | Test that without the XMLRpcLibPatch, we get a failure when
xmlrpclib tries to parse a response that contains Apache's
extended types. | 625941ec23849d37ff7b35a5 |
def ROC(self): <NEW_LINE> <INDENT> roc_auc = metrics.roc_auc_score(self.test_target, self.test_predprob) <NEW_LINE> fpr, tpr, _ = metrics.roc_curve(self.test_target, self.test_predprob) <NEW_LINE> plt.figure(figsize=(6, 5.5)) <NEW_LINE> plt.plot(fpr, tpr, label='Classifier (area = %.3f)'%roc_auc) <NEW_LINE> plt.plot([0... | A report on Receiver Operating Charactoristic(ROC) curve.
Reports ROC curve and gives roc auc score. | 625941ec91f36d47f21aca12 |
def get_id(self): <NEW_LINE> <INDENT> return int(self.__id_num) | | get the student's ID number
:return: int of the ID | 625941ec63b5f9789fde7600 |
def handle(self, regen): <NEW_LINE> <INDENT> if self.process.poll() == None and not self.stop: <NEW_LINE> <INDENT> if os.path.isfile(self.file): <NEW_LINE> <INDENT> fpg = open(self.file, "r") <NEW_LINE> d = fpg.read() <NEW_LINE> if d != self.previous and d.strip() != '': <NEW_LINE> <INDENT> self.manage_pulse(d.split("\... | Handle metaboflux process | 625941ec32920d7e50b286ef |
def execute_command(self, cmd, working_dir='~'): <NEW_LINE> <INDENT> ssh = self.create_ssh_client() <NEW_LINE> stdin, stdout, stderr = ssh.exec_command('cd {} && {}'.format(working_dir, cmd)) <NEW_LINE> return stdin, stdout, stderr, ssh | Creates a paramiko SSHClient and invokes execution of a terminal command.
:param str cmd: Command to execute in the VM resource
:param str working_dir: Working-directory used to execute the command
:return: a tuple of the form (stdin, stdout, stderr, client) | 625941ec63f4b57ef0001624 |
def log_csv(self, timestamp=None, zone_1_moisture=None, zone_1_temp=None, zone_2_moisture=None, zone_2_temp=None, zone_3_moisture=None, zone_3_temp=None, zone_4_moisture=None, zone_4_temp=None, ambient_light=None, ambient_temp=None, cpu_temp=None, messg=" "): <NEW_LINE> <INDENT> if timestamp is None: <NEW_LINE> <INDENT... | Log values to a CSV file
:param timestamp: Timestamp
:type timestamp: float
:param zone_1_moisture:
:type zone_1_moisture: float
:param zone_1_temp:
:type zone_1_temp: float
:param zone_2_moisture:
:type zone_2_moisture: float
:param zone_2_temp:
:type zone_2_temp: float
:param zone_3_moisture:
:type zone_3_moisture: ... | 625941eccdde0d52a9e53551 |
def get_metrics(self): <NEW_LINE> <INDENT> if self._metricsMap is None: <NEW_LINE> <INDENT> q = "MATCH ()-[e]-() RETURN keys(e) AS keys LIMIT 1;" <NEW_LINE> properties = self._graph.data(q)[0]['keys'] <NEW_LINE> self._metricsMap = {p[7:]:p for p in properties if p.startswith("metric_")} <NEW_LINE> <DEDENT> return self.... | Return edge weight metrics used in the graph.
Returns:
list of str: edge metric names. | 625941ec5e10d32532c5f43f |
def create_interface(self): <NEW_LINE> <INDENT> self._attr_inn_parent_tm = libAttr.addAttr(self.grp_rig, longName='innParentTm', dt='matrix') | Define the input and output of the module.
The goal is to a a kind of component approach. | 625941ec7b25080760e39970 |
def config(key=None): <NEW_LINE> <INDENT> if key is None: <NEW_LINE> <INDENT> return Configureable.conf <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return Configureable.conf[key] | Gets the main configuration for the whole PyOpenWorm library.
:return: the instance of the Configure class currently operating. | 625941ec7b180e01f3dc4d0c |
def join_channel(self, channel): <NEW_LINE> <INDENT> super().join_channel(channel) <NEW_LINE> self.get_streamtimes(channel) <NEW_LINE> schedule.every(30).seconds.do(self.get_streamtimes, channel) | Joins a channel. | 625941ecd10714528d600203 |
def load_data(self) -> None: <NEW_LINE> <INDENT> filename = self.filename + '.csv' <NEW_LINE> path = self.file_path(filename) <NEW_LINE> if not self.file_exists(filename): <NEW_LINE> <INDENT> raise FileNotFoundError(f'Unable to load from {path}') <NEW_LINE> <DEDENT> df = pd.read_csv(path) <NEW_LINE> self.nu_vals = df['... | Load the peak density data from file | 625941ec1b99ca400220afce |
def remove(self): <NEW_LINE> <INDENT> if self.active(): <NEW_LINE> <INDENT> current_app.logger.warning("Cannot remove {name}, still active!".format(name=self.get_name())) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ns.remove_node_force(self.get_nid()) <NEW_LINE> <DEDENT> return | Remove the person node if no longer active. The person object is no longer valid.
:return: | 625941ec3539df3088e2e866 |
def get_start_index(sheet)-> int: <NEW_LINE> <INDENT> for i in range(1, sheet.max_row): <NEW_LINE> <INDENT> value = sheet['A%i' % i].value <NEW_LINE> if value and 'Part No' in value: <NEW_LINE> <INDENT> return i <NEW_LINE> <DEDENT> <DEDENT> return 0 | gets index for title row
:param sheet: sheet excel with data
:return: index of table head row | 625941ecdc8b845886cb5a51 |
def _update_justification(self, justification): <NEW_LINE> <INDENT> states = {"left": 2, "center": 0, "right": 1} <NEW_LINE> self.justify_tb.state = states[justification] <NEW_LINE> self.justify_tb.toggle(None) <NEW_LINE> self.justify_tb.Refresh() | Updates horizontal text justification button
Parameters
----------
justification: String in ["left", "center", "right"]
Switches button to untoggled if False and toggled if True | 625941ec91af0d3eaac9bf38 |
def raise_on_not_init(self): <NEW_LINE> <INDENT> if self.rx <= 0: <NEW_LINE> <INDENT> raise Exception("Connection is not initialized") | Checks if there is an error code and raises with an error message.
# Raises:
Exception: Raises with an error message of API return if Reindexer instance is not initialized yet. | 625941ec57b8e32f524839b9 |
def detect_frame_framework(frame): <NEW_LINE> <INDENT> package = frame.f_globals.get("__package__", None) or "" <NEW_LINE> if package == "py._test": <NEW_LINE> <INDENT> return "py.test" <NEW_LINE> <DEDENT> elif package == "nose": <NEW_LINE> <INDENT> return "nose" <NEW_LINE> <DEDENT> return None | tries to detect whether the given frame is part of a running test framework | 625941ec3cc13d1c6d3c7892 |
def __init__(self, directory=None, archive_format='tar', formats='csv', dry_run=False, source=None, remote_store=None, **kwargs): <NEW_LINE> <INDENT> Destination.__init__(self, backend='file', conf=kwargs.get('conf', None)) <NEW_LINE> self.date = arrow.now().strftime('%F_%T') <NEW_LINE> self.directory = str(directory).... | Initiator
:param str directory: the directory where store the files
:param str archive_format: which format to use to compress file
default is tar, format available are formats available with
shutil.make_archive
:param list formats: list of formats in which data will be written.
The format should be implemented as a su... | 625941ec44b2445a339325ac |
def keypress(self, char): <NEW_LINE> <INDENT> ret = 0 <NEW_LINE> if self._too_small: <NEW_LINE> <INDENT> if char in (curses.KEY_EXIT, 27, ord('q')): <NEW_LINE> <INDENT> return -1, '', '', False, False, False <NEW_LINE> <DEDENT> return 0, '', '', False, False, False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if char ... | Returns:
-1: Cancel
0: go on
1: Operation succeeded
2: display line editor help | 625941ece64d504609d74d5a |
def get_user_by_account(account): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if re.match(r'^1[3-9]\d{9}$', account): <NEW_LINE> <INDENT> user = User.objects.get(mobile=account) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> user = User.objects.get(username=account) <NEW_LINE> <DEDENT> <DEDENT> except Exception as e: <... | 判断account 是否为手机号码,返回user对象 | 625941ec6fb2d068a760f5c0 |
def handle_input(self, queue): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> msg, data = queue.recv_msg() <NEW_LINE> <DEDENT> except IOError as e: <NEW_LINE> <INDENT> self.logger.error(str(e)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if msg in ('HOME', 'SEARCH', 'DELPKG', 'DELVER'): <NEW_LINE> <INDENT> self.output.... | Handle incoming write requests with buffering and de-dupe.
Some incoming requests (currently "HOME", "SEARCH", "DELPKG", and
"DELVER") are passed directly through to :class:`TheScribe` as these
are either sufficiently rare ("HOME", "SEARCH") that no benefit is
gained by buffering them or sufficiently urgent ("DELPKG",... | 625941ec3346ee7daa2b328b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.