code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def bytes(self): <NEW_LINE> <INDENT> return self.__bytes__()
get the *bitstream* representation as a bytes str.
625941ef99cbb53fe679314a
def svn_utf_cstring_to_utf8(*args): <NEW_LINE> <INDENT> return _core.svn_utf_cstring_to_utf8(*args)
svn_utf_cstring_to_utf8(char const * src, apr_pool_t pool) -> svn_error_t
625941efdc8b845886cb5a9c
def _articles_from_xml(self, xml_file): <NEW_LINE> <INDENT> with open(xml_file, 'rb') as file: <NEW_LINE> <INDENT> xml = file.readlines() <NEW_LINE> <DEDENT> return self._article_tuples(xml)
Returns a list of `Article` tuples from the XML source, which can be either a file or a network server responding to HTTP 'get'.
625941efbe7bc26dc91cdb5b
def change_fleet_direction(ai_game): <NEW_LINE> <INDENT> for alien in ai_game.aliens.sprites(): <NEW_LINE> <INDENT> alien.rect.y += ai_game.settings.fleet_drop_speed <NEW_LINE> <DEDENT> ai_game.settings.fleet_direction *= -1
Drop the fleet and change it's direction
625941ef21bff66bcd684eb3
def __init__(self, *fanins): <NEW_LINE> <INDENT> ASTNode.__init__(self, ASTNode.NAND_GATE) <NEW_LINE> assert len(fanins) >= 2 <NEW_LINE> self.fanins = tuple(fanins[:])
Construct a nand gate.
625941efff9c53063f47c756
def test_post_with_FILE_executed_file(self): <NEW_LINE> <INDENT> self.client.login(username=self.lawyer.username, password=self.password) <NEW_LINE> with open(self.FILE_TO_TEST_UPLOAD_WITH) as file_being_posted: <NEW_LINE> <INDENT> data = { 'executed_file': file_being_posted, } <NEW_LINE> self.assertEqual(self.item.rev...
ensure we can upload an actual file to the endpoint
625941efd6c5a102081445b5
def get_atom1(self): <NEW_LINE> <INDENT> return self._atom1
Get the ``[atom1]`` atom. Returns ------- :class:`.Atom` The ``[atom1]`` atom.
625941ef091ae356686674bb
def __init__(self, window, edit = False): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._window = window <NEW_LINE> self._repeatDelayEditor = repeatDelayEditor = RepeatDelayEditor( _("R_epeat the mouse movement"), _("When selected, the mouse movement will be repeated " "as long as the control is in ...
Construct the widget for the given action.
625941ef8da39b475bd654e1
def switch(self, otherActor): <NEW_LINE> <INDENT> new = otherActor.getPos() <NEW_LINE> old = self.getPos() <NEW_LINE> self.move(new[0],new[1]) <NEW_LINE> otherActor.move(old[0],old[1]) <NEW_LINE> return otherActor
"switch(otherActor to be switch places)
625941ef099cdd3c635f11be
def test_note2midi_wrong_data_type(self): <NEW_LINE> <INDENT> self.assertRaises(TypeError, note2midi, 123)
fails when passed a non-string value
625941ef01c39578d7e753a1
def process_config(json_file): <NEW_LINE> <INDENT> config, _ = get_config_from_json(json_file) <NEW_LINE> exp_dir = os.path.join(ROOT_DIR, "experiments") <NEW_LINE> mkdir_if_not_exist(exp_dir) <NEW_LINE> config.tb_dir = os.path.join(exp_dir, config.exp_name, "logs/") <NEW_LINE> config.cp_dir = os.path.join(exp_dir, con...
解析Json文件 :param json_file: 配置文件 :return: 配置类
625941ef379a373c97cfb0ac
def __init__(self): <NEW_LINE> <INDENT> self._nums = list()
Initialize your data structure here.
625941efd164cc61757832b5
def saveContent(contentPerDictionaryKey,filename, destinationURL='/media/gaurav/Elements/Thesis/data/mappedData/'): <NEW_LINE> <INDENT> with open(destinationURL+filename,'a') as fout: <NEW_LINE> <INDENT> for line in contentPerDictionaryKey: <NEW_LINE> <INDENT> for values in line: <NEW_LINE> <INDENT> fout.write('|'.join...
if not cf.filepathExist(destinationURL+filename): 'create a file at give URL' cf.createFile(filename,destinationURL) 'append in this file'
625941efb830903b967e9e6b
def merge_numbering_schemes(self): <NEW_LINE> <INDENT> numbering_schemes = {} <NEW_LINE> for prot in self.aln_pos.proteins + self.aln_neg.proteins: <NEW_LINE> <INDENT> if prot.protein.residue_numbering_scheme.slug not in numbering_schemes: <NEW_LINE> <INDENT> rnsn = prot.protein.residue_numbering_scheme.name <NEW_LINE>...
Extract all of the numbering schemes used for a set of proteins. Arguments: proteins {selection} -- A set of proteins to analyze
625941ef76e4537e8c351bdd
def distanceGradient(source, mask=None): <NEW_LINE> <INDENT> gradient = ndimage.distance_transform_edt(1 - source) <NEW_LINE> if mask is not None: <NEW_LINE> <INDENT> gradient = maskArray(gradient, mask) <NEW_LINE> <DEDENT> rescaledArray = linearRescale01(gradient) <NEW_LINE> return(rescaledArray)
Create a distance gradient neutral landscape model with values ranging 0-1. Parameters ---------- source : array 2D array binary array that defines the source elements from which distance will be measured. The dimensions of source also specify the output dimensions of the distance gradient. mask : array, ...
625941ef435de62698dfe1b3
def give_money_to(self, other_person, amount_to_give): <NEW_LINE> <INDENT> self.money = self.money - amount_to_give <NEW_LINE> other_person.money = other_person.money + amount_to_give <NEW_LINE> self.numofmoneygive = amount_to_give
What comes in: -- self -- Another Person. -- A non-negative integer that is no more than the amount of money that this Person currently has. What goes out: Nothing (i.e., None) Side effects: -- Decreases this Person's money by the given amount_to_give. -- Increases the other Person's money by t...
625941ef94891a1f4081c012
def sum(self, n: int) -> float: <NEW_LINE> <INDENT> if not isinstance(n, int): <NEW_LINE> <INDENT> raise TypeError("n argument must be integer") <NEW_LINE> <DEDENT> elif n <= 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> return ((2 * self.first_element) + (n - 1) * self.diff) * (n / 2)
Return sum of the first n elements
625941ef91f36d47f21aca5f
def __setitem__(self, elem): <NEW_LINE> <INDENT> raise TypeError('object is immutable')
Replacing an object in this dictionary is not a supported operation. If the dictionary supports add new elements, look for a create_* method on the class.
625941ef283ffb24f3c55e61
def possible_qualnames(cls): <NEW_LINE> <INDENT> for subclass in cls.mro()[:-1]: <NEW_LINE> <INDENT> path = subclass.__module__ <NEW_LINE> name = subclass.__qualname__ <NEW_LINE> while path: <NEW_LINE> <INDENT> value = "%s.%s" % (path, name) <NEW_LINE> yield value <NEW_LINE> path, _, _ = path.rpartition(".")
Iterator over possible qualified names for class.
625941efcc0a2c11143dd3f7
def non_linear_min(): <NEW_LINE> <INDENT> P = matrix(np.array([[3.,2.,1.],[2.,4.,2.],[1.,2.,3.]])) <NEW_LINE> q = matrix([3.,0.,1.]) <NEW_LINE> sol=solvers.qp(P, q) <NEW_LINE> return np.ravel(sol['x']), sol['primal objective']
Find the minimizer and minimum of g(x,y,z) = (3/2)x^2 + 2xy + xz + 2y^2 + 2yz + (3/2)z^2 + 3x + z Returns (in order): The optimizer x (ndarray) The optimal value (sol['primal objective'])
625941ef31939e2706e4d3c8
def nextGreatestLetter(self, letters, target): <NEW_LINE> <INDENT> letters.sort() <NEW_LINE> for i in range(len(letters)): <NEW_LINE> <INDENT> if letters[i] > target: <NEW_LINE> <INDENT> return letters[i] <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> return letters[0]
:type letters: List[str] :type target: str :rtype: str
625941ef462c4b4f79d1dc35
def __init__(self, id: int=None, name: str=None, ride_with_gp_surl: str=None, tags: List[Rider]=None): <NEW_LINE> <INDENT> self.swagger_types = { 'id': int, 'name': str, 'ride_with_gp_surl': str, 'tags': List[Rider] } <NEW_LINE> self.attribute_map = { 'id': 'id', 'name': 'name', 'ride_with_gp_surl': 'rideWithGPSurl', '...
Event - a model defined in Swagger :param id: The id of this Event. # noqa: E501 :type id: int :param name: The name of this Event. # noqa: E501 :type name: str :param ride_with_gp_surl: The ride_with_gp_surl of this Event. # noqa: E501 :type ride_with_gp_surl: str :param tags: The tags of this Event. # noqa: E501...
625941efa219f33f34628ec8
def count_gender(data_list): <NEW_LINE> <INDENT> male = 0 <NEW_LINE> female = 0 <NEW_LINE> for item in range(len(data_list)): <NEW_LINE> <INDENT> if data_list[item][-2]=="Male": <NEW_LINE> <INDENT> male += 1 <NEW_LINE> <DEDENT> elif data_list[item][-2]=="Female": <NEW_LINE> <INDENT> female += 1 <NEW_LINE> <DEDENT> <DED...
Counts the gender of a given list Args: param1: List with the values Returns: List with the male and female countings
625941ef7047854f462a1969
def test_get_capabilities(self): <NEW_LINE> <INDENT> capabilities = { AgentCapabilityType.AGENT_COMMAND: self._common_agent_commands(ResourceAgentState.COMMAND), AgentCapabilityType.AGENT_PARAMETER: self._common_agent_parameters(), AgentCapabilityType.RESOURCE_COMMAND: [ProtocolEvent.ACQUIRE_SAMPLE, ProtocolEvent.ACQUI...
Verify that the correct capabilities are returned from get_capabilities at various driver/agent states.
625941ef99cbb53fe679314b
def GetItemAt(self,dwIndex:'Any') -> 'Any': <NEW_LINE> <INDENT> pass
Retrieves an item by index Args: dwIndex(Any):Zero-based index of item to retrieve Returns: Any
625941ef1f5feb6acb0c50af
def manacher(array): <NEW_LINE> <INDENT> inited_array = '$#' + '#'.join(array) + '#@' <NEW_LINE> count = len(inited_array) <NEW_LINE> max_len = -1 <NEW_LINE> farest = 0 <NEW_LINE> tmp_max_point = -1 <NEW_LINE> ass_list = [0 for i in range(count)] <NEW_LINE> for i in range(count): <NEW_LINE> <INDENT> ass_list[i] = min(a...
求一个字符串中的最长回文子串
625941ef23849d37ff7b35f1
def canMeasureWater(self, x, y, z): <NEW_LINE> <INDENT> if z==0: return True <NEW_LINE> if x==0: return y==z <NEW_LINE> if y==0: return x==z <NEW_LINE> g = fractions.gcd(x,y) <NEW_LINE> if g==1: return True if x+y>=z else False <NEW_LINE> else: return True if z%g==0 and x+y>=z else False
:type x: int :type y: int :type z: int :rtype: bool
625941effb3f5b602dac3bff
def as_slice(self): <NEW_LINE> <INDENT> result = [None] * self.ndims <NEW_LINE> for dim, dimension_array in enumerate(self): <NEW_LINE> <INDENT> if isinstance(dimension_array, np.ndarray): <NEW_LINE> <INDENT> where_true = np.where(dimension_array)[0] <NEW_LINE> if len(where_true) == 0: <NEW_LINE> <INDENT> result = None...
Turns a _ColumnIndexManager into a tuple which can be used in an indexing operation. If no index is possible, None will be returned.
625941efbf627c535bc13735
def transform(self, transcls, fromsys, tosys, priority=1): <NEW_LINE> <INDENT> def deco(func): <NEW_LINE> <INDENT> transcls(func, fromsys, tosys, priority=priority, register_graph=self) <NEW_LINE> return func <NEW_LINE> <DEDENT> return deco
A function decorator for defining transformations. .. note:: If decorating a static method of a class, ``@staticmethod`` should be added *above* this decorator. Parameters ---------- transcls : class The class of the transformation object to create. fromsys : class The coordinate frame class to start...
625941ef460517430c3946dc
def transform_streamlines(streamlines, mat): <NEW_LINE> <INDENT> return [apply_affine(mat, s) for s in streamlines]
Apply affine transformation to streamlines Parameters ---------- streamlines : list List of 2D ndarrays of shape[-1]==3 Returns ------- new_streamlines : list List of the transformed 2D ndarrays of shape[-1]==3
625941ef097d151d1a2233bd
def rechercher_personne_delegue(recherche: str): <NEW_LINE> <INDENT> if recherche: <NEW_LINE> <INDENT> return recherche_delegue(recherche)
recherche une liste de personnes à partir du noù :param recherche: la recherche de personnes :return: la liste des noms touvés
625941eff548e778e58cdae6
def batch_names_list(images_path, batch_size=64): <NEW_LINE> <INDENT> names = [] <NEW_LINE> lst = os.listdir(images_path) <NEW_LINE> for begin in range(0, len(lst), batch_size): <NEW_LINE> <INDENT> end = min(begin + batch_size, len(lst)) <NEW_LINE> names.append(lst[begin:end]) <NEW_LINE> <DEDENT> return names
对列表按照batch_size进行分组 :param images_path: 待分组文件列表 :param batch_size: 分组大小
625941efdd821e528d63b70b
@api.route('/lessons/<int:lesson_id>/biddings', methods=['POST']) <NEW_LINE> @success_response <NEW_LINE> def add_lesson_bidding(lesson_id): <NEW_LINE> <INDENT> user_data = auth_service.check_permission() <NEW_LINE> lesson_bidding_request = LessonBiddingRequest(request_json=request.get_json()) <NEW_LINE> lesson_bidding...
:param lesson_id: :return: :error NO_SUCH_ELEMENT EXPIRED_LESSON_BIDDING INVALID_ARGUMENT ELEMENT_ALREADY_EXISTS
625941ef71ff763f4b549bfc
def random_vectors_c(R,Hdim): <NEW_LINE> <INDENT> v=np.empty([R,Hdim],np.complex_) <NEW_LINE> for i in range(R): <NEW_LINE> <INDENT> v[i]=np.sqrt(3.)*np.random.rand(Hdim)*np.exp(2*np.pi*1j*np.random.rand(Hdim)) <NEW_LINE> <DEDENT> return v
R : # of vectors N : Dimension of each vectors
625941effb3f5b602dac3c00
def OCR(data, results, action, override={}): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = action['params'] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> params = {} <NEW_LINE> <DEDENT> for k,v in override.items(): <NEW_LINE> <INDENT> params[k] = v <NEW_LINE> <DEDENT> channel = params.get('channel', ...
Use pyOCR which for OCR
625941ef07d97122c4178dff
def add_comment(self, comment): <NEW_LINE> <INDENT> payload = {'comment': comment} <NEW_LINE> response = self.node.user.client.trans.update(self.node.user.id, self.node.id, self.id, payload) <NEW_LINE> if 'trans' in response: <NEW_LINE> <INDENT> return self.from_response(self.node, response['trans']) <NEW_LINE> <DEDENT...
Add a comment to the transaction's recent_status. Args: comment (str): text of the comment Returns: Transaction: a new instance representing the same record updated
625941ef7047854f462a196a
def _extract_additional_model_settings(self): <NEW_LINE> <INDENT> self.model_settings["process_documents_chronologically"] = self.config_section.getboolean( "process_documents_chronologically", True) <NEW_LINE> self.model_settings["target"] = self.config_section["target"].replace(' ', '').split(",") <NEW_LINE> self.mod...
Override method from Analyzer
625941ef3346ee7daa2b32d7
def ld_factor(self): <NEW_LINE> <INDENT> return self.size()/self.cap
Determines the current load factor.
625941ef187af65679ca5686
@task <NEW_LINE> def migrate(): <NEW_LINE> <INDENT> manage('makemigrations') <NEW_LINE> manage('migrate')
Make migrations and migrate
625941ef925a0f43d254a3e3
def detect(self, frame, num_of_objects=1): <NEW_LINE> <INDENT> hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) <NEW_LINE> draw = frame.copy() <NEW_LINE> min_h = cv2.getTrackbarPos(Detector.__min_h_slider_name, Detector.__slider_window_name) <NEW_LINE> min_s = cv2.getTrackbarPos(Detector.__min_s_slider_name, Detector.__sli...
Find the ball :param frame: Frame :return: Position, Drawn image, threshold
625941efff9c53063f47c757
def __call__(self, mu=0, temperature=0): <NEW_LINE> <INDENT> e = self.energies <NEW_LINE> e_rescaled = (e - self._b) / self._a <NEW_LINE> distribution_array = fermi_distribution(e, mu, temperature) <NEW_LINE> integrand = np.divide(distribution_array, (1 - e_rescaled ** 2) ** 2) <NEW_LINE> integrand = np.multiply(integr...
Returns the linear response :math:`χ_{α β}(µ, T)` Parameters ---------- mu : float Chemical potential defined in the same units of energy as the Hamiltonian. temperature : float Temperature in units of energy, the same as defined in the Hamiltonian.
625941ef0a50d4780f6673fe
def on_pattern_dest_edit_clicked(self, widget): <NEW_LINE> <INDENT> pe = pattern_editor.PyrenamerPatternEditor( self, config_dir, self.glade_file) <NEW_LINE> pe.create_window('main_dest')
Open the pattern edit window in reponse to a user click
625941ef9c8ee82313fbbcde
def integrity_check(self): <NEW_LINE> <INDENT> for entity in self.valid_entities: <NEW_LINE> <INDENT> schema = gdcdictionary.schema[entity.node.label] <NEW_LINE> node = entity.node <NEW_LINE> for keys in schema["uniqueKeys"]: <NEW_LINE> <INDENT> props = {} <NEW_LINE> if keys == ["id"]: <NEW_LINE> <INDENT> continue <NEW...
Perform integrity check for all the valid entities
625941ef7b25080760e399bc
def clear(self): <NEW_LINE> <INDENT> self._reset_reader()
Clear everything and reset as an empty Reader instance.
625941ef16aa5153ce3629e0
def _set_flags(self, flags): <NEW_LINE> <INDENT> ifreq = struct.pack('16sh', self.name, flags) <NEW_LINE> fcntl.ioctl(sockfd, SIOCSIFFLAGS, ifreq)
Sets flags for this interface using ioctl.
625941efbe383301e01b59e1
def _calculateMIC(self): <NEW_LINE> <INDENT> rootKeys = self._msg.rootKeys <NEW_LINE> key = rootKeys.nwkKey <NEW_LINE> msg = [self._msg[0]] + list(self.raw) <NEW_LINE> cmac = aes128_cmac(key, msg) <NEW_LINE> return cmac[:4]
Calculates the MIC like specified in chapter 6.2.2 of the LoRaWAN Specification 1.1
625941ef627d3e7fe0d693b8
def _getitem_via_pathlist(external_dict,path_list,**kwargs): <NEW_LINE> <INDENT> if('s2n' in kwargs): <NEW_LINE> <INDENT> s2n = kwargs['s2n'] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> s2n = 0 <NEW_LINE> <DEDENT> if('n2s' in kwargs): <NEW_LINE> <INDENT> n2s = kwargs['n2s'] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDEN...
y = {'c': {'b': 200}} _getitem_via_pathlist(y,['c','b'])
625941ef956e5f7376d713d2
def test_failureValueFromFoundFailure(self): <NEW_LINE> <INDENT> exception = ValueError() <NEW_LINE> f1 = failure.Failure(exception) <NEW_LINE> try: <NEW_LINE> <INDENT> f1.trap(OverflowError) <NEW_LINE> <DEDENT> except BaseException: <NEW_LINE> <INDENT> f2 = failure.Failure() <NEW_LINE> <DEDENT> self.assertIs(f2.value,...
A L{failure.Failure} constructed without a C{exc_value} argument, will search for an "original" C{Failure}, and if found, its value will be used as the value for the new C{Failure}.
625941ef21bff66bcd684eb4
def ontology_from_candidate_skills(candidate_skills: CandidateSkillYielder, skill_extractor_name: str='unknown') -> CompetencyOntology: <NEW_LINE> <INDENT> ontology = CompetencyOntology( name=f'candidate_skill_{skill_extractor_name}', competency_name=f'candidate_skill_{skill_extractor_name}', competency_description=f'C...
Create an ontology from a list of candidate skills Simply associate each candidate skill with its ONET occupation. Args: candidate_skills (iterable of algorithms.skill_extractors.base.CandidateSkill objects) Returns: (skills_ml.ontologies.base.CompetencyOntology)
625941ef57b8e32f52483a06
def __getattribute__(self, attr): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return super(Locks, self).__getattribute__(attr) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> return locks.Fail()
If the lock is defined, return it. If it's not defined, return a failing lock. This might be inconvenient behavior in some situations, but it beats having to handle an AttributeError every time we check a lock.
625941ef0a366e3fb873ed86
def generate_experiment_info(config): <NEW_LINE> <INDENT> common = config['common'] <NEW_LINE> algorithm = config['algorithm'] <NEW_LINE> if type(algorithm['cost']) == list: <NEW_LINE> <INDENT> algorithm_cost_type = algorithm['cost'][0]['type'].__name__ <NEW_LINE> if (algorithm_cost_type) == 'CostSum': <NEW_LINE> <INDE...
Generate experiment info, to be displayed by GPS Trainig GUI. Assumes config is the config created in hyperparams.py
625941efcdde0d52a9e5359f
def set_column(self, index, value): <NEW_LINE> <INDENT> for row_index, item in enumerate(value): <NEW_LINE> <INDENT> self.cells[row_index][index] = item <NEW_LINE> <DEDENT> self.column_updated(index)
Set the grid's column at given index
625941ef596a89723608a020
@pytest.fixture(params=['tests', 'scripts', 'simcityweb', 'integration_tests', 'setup.py']) <NEW_LINE> def flake8_filenames(request): <NEW_LINE> <INDENT> if os.path.isdir(request.param): <NEW_LINE> <INDENT> paths = [] <NEW_LINE> for path, dirs, filenames in os.walk(request.param): <NEW_LINE> <INDENT> paths += [os.path....
Yield filenames for flake8 to run over recursively, given files and directories.
625941ef099cdd3c635f11bf
def corrupt(self, data_bytes, drop_error_prob=0.000002, random_error_prob=0.0000002, swap_error_prob=0.000002): <NEW_LINE> <INDENT> if self.debug: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> random_errors = uniform(0, 1) <NEW_LINE> swap = uniform(0, 1) <NEW_LINE> drop = uniform(0, 1) <NEW_LINE> corrupted = deepcopy(da...
Corrupt data in the channel with random errors, swaps, and drops. :param swap_error_prob: swap frame error probability :param random_error_prob: random bit error probability :param drop_error_prob: drop frame error probability :param data_bytes: byte array (frame) to corrupt :return: corrupted byte array
625941ef56ac1b37e626472b
def add_connection_distribution(self, cd): <NEW_LINE> <INDENT> if not cd.signature in self.keys(): <NEW_LINE> <INDENT> self[cd.signature] = cd
Try and add a ConnectionDistribution object, if signature not already used.
625941ef56ac1b37e626472c
def _GetWindowMin(self, window): <NEW_LINE> <INDENT> size = window.GetEffectiveMinSize() <NEW_LINE> if self._orient == wx.HORIZONTAL: <NEW_LINE> <INDENT> res = size.GetWidth() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> res = size.GetHeight() <NEW_LINE> <DEDENT> return res
Overriden parent class method which properly computes the window min size.
625941ef63d6d428bbe44a58
def get_local_path(self): <NEW_LINE> <INDENT> if not self.p4.is_supported(): <NEW_LINE> <INDENT> logging.debug('Unable to execute "p4 help": skipping Perforce') <NEW_LINE> return None <NEW_LINE> <DEDENT> if self._p4_info is None: <NEW_LINE> <INDENT> self._p4_info = self.p4.info() <NEW_LINE> <DEDENT> client_root = self....
Return the local path to the working tree. Returns: unicode: The filesystem path of the repository on the client system.
625941ef50812a4eaa59c883
def sentence_to_conll(ostream, sentence): <NEW_LINE> <INDENT> writer = csv.writer(ostream, delimiter='\t') <NEW_LINE> for token in sentence["tokens"]: <NEW_LINE> <INDENT> row = [token["word"], token["lemma"], token["pos"]] <NEW_LINE> if "_tag" in token: <NEW_LINE> <INDENT> row.append(token["_tag"]) <NEW_LINE> <DEDENT> ...
Output sentence to conll format
625941ef627d3e7fe0d693b9
def generate_calendar(self): <NEW_LINE> <INDENT> if len(self.teams) % 2 != 0: <NEW_LINE> <INDENT> self.teams += [""] <NEW_LINE> <DEDENT> random.shuffle(self.teams) <NEW_LINE> first_basket = self.teams[:len(self.teams) // 2] <NEW_LINE> second_basket = self.teams[len(self.teams) // 2:] <NEW_LINE> second_basket.reverse() ...
this method generates calendar of matches
625941ef8a349b6b435e86da
def get_logger(): <NEW_LINE> <INDENT> return logging.getLogger();
Get loggin object :Return: loggin object
625941ef07d97122c4178e00
def test_sendSmsTextMode(self): <NEW_LINE> <INDENT> self.initModem(None) <NEW_LINE> self.modem.smsTextMode = True <NEW_LINE> self.assertTrue(self.modem.smsTextMode) <NEW_LINE> for number, message, index, smsTime, smsc, pdu, tpdu_length, ref, mem in self.tests: <NEW_LINE> <INDENT> self.modem._smsRef = ref <NEW_LINE> def...
Tests sending SMS messages in text mode
625941ef4e4d5625662d4937
def ping(self, data): <NEW_LINE> <INDENT> self._write_child(data)
Write to remote end of SSH connection. See FOLLOW_ON_PIO for details. :param data: Bytes to be written.
625941efa934411ee3751bfc
def __truediv__(self, other): <NEW_LINE> <INDENT> other = Bruch(other) <NEW_LINE> return self * ~other
Multiply self to not other :param other: int or a fraction :return: float
625941efd58c6744b42581c5
def connect_usb(self, _vendor_id=0x04B4, _product_id=0xE177): <NEW_LINE> <INDENT> device = usb.core.find(idVendor=_vendor_id, idProduct=_product_id) <NEW_LINE> if device is None: <NEW_LINE> <INDENT> logging.info("Device not found") <NEW_LINE> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> logging.info("USB d...
Use the pyUSB module to find and set the configuration of a USB device This method uses the pyUSB module, see the tutorial example at: https://github.com/walac/pyusb/blob/master/docs/tutorial.rst for more details :param _vendor_id: the USB vendor id, used to identify the proper device connected to sthe computer :par...
625941ef4527f215b584c9b9
def s_pT(self,p,T): <NEW_LINE> <INDENT> value = 0. <NEW_LINE> for i in range(len(list(self.fluidDict.keys()))): <NEW_LINE> <INDENT> p_c = self.fluidDict[i].weight*p; <NEW_LINE> value += self.fluidDict[i].fluid.s_pT(p_c,T)*self.fluidDict[i].weight <NEW_LINE> <DEDENT> return value
return entropy as a function of pressure and enthalpy
625941ef6aa9bd52df03730f
def mine(self): <NEW_LINE> <INDENT> if not self.unconfirmed_transactions: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> last_block = self.last_block <NEW_LINE> new_block = Block(index=last_block.index + 1, transactions=self.unconfirmed_transactions, timestamp=time.time(), previous_hash=last_block.hash) <NEW_LINE...
This function serves as an interface to add the pending transactions to the blockchain by adding them to the block and figuring out Proof Of Work.
625941ef2c8b7c6e89b35d23
def _askbot_ext_assert_can_vote_comment(self, comment): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.assert_can_vote_action(comment.action) <NEW_LINE> <DEDENT> except exceptions.PermissionDenied as e: <NEW_LINE> <INDENT> raise exceptions.VoteOnUnauthorizedCommentException() <NEW_LINE> <DEDENT> return True
Check permission. If invalid --> raise exception
625941ef507cdc57c6307250
def default_facets_view ( self ): <NEW_LINE> <INDENT> return View( Item( 'tools', style = 'custom', show_label = False, id = 'tools', editor = NotebookEditor( features = [ DebugFeature, DragDropFeature, OptionsFeature, SaveStateFeature ], dock_style = 'tab', page_name = '.name', template = 'template...
Returns the View to use with this perspective.
625941ef091ae356686674bc
def __init__(self): <NEW_LINE> <INDENT> self.ResourceSet = None <NEW_LINE> self.TotalCount = None <NEW_LINE> self.RequestId = None
:param ResourceSet: 资源详细信息集合 :type ResourceSet: list of ResourceItem :param TotalCount: 总数量 :type TotalCount: int :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
625941ef50485f2cf553d303
def doppler_radio(rest): <NEW_LINE> <INDENT> ckms = _si.c.to('km/s').value <NEW_LINE> def to_vel_freq(x): <NEW_LINE> <INDENT> restfreq = rest.to(si.Hz, equivalencies=spectral()).value <NEW_LINE> return (restfreq-x) / (restfreq) * ckms <NEW_LINE> <DEDENT> def from_vel_freq(x): <NEW_LINE> <INDENT> restfreq = rest.to(si.H...
Return the equivalency pairs for the radio convention for velocity. The radio convention for the relation between velocity and frequency is: :math:`V = c \frac{f_0 - f}{f_0} ; f(V) = f_0 ( 1 - V/c )` Parameters ---------- rest : Quantity Any quantity supported by the standard spectral equivalencies (wavele...
625941ef8c0ade5d55d3ef27
def absent(name, user='root', minute='*', hour='*', daymonth='*', month='*', dayweek='*'): <NEW_LINE> <INDENT> name = ' '.join(name.strip().split()) <NEW_LINE> ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''} <NEW_LINE> if __opts__['test']: <NEW_LINE> <INDENT> status = _check_cron(name, user, minute, ...
Verifies that the specified cron job is absent for the specified user, only the name is matched when removing a cron job. name The command that should be absent in the user crontab. user The name of the user who's crontab needs to be modified, defaults to the root user minute The information to be se...
625941ef236d856c2ad44d4a
def get_n_splits(self, X=None, y=None, groups=None): <NEW_LINE> <INDENT> return self.n_splits
Returns the number of splitting iterations in the cross-validator Parameters ---------- X : object Always ignored, exists for compatibility. y : object Always ignored, exists for compatibility. groups : object Always ignored, exists for compatibility. Returns ------- n_splits : int Returns the number ...
625941ef4428ac0f6e5bad5f
def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, **kw): <NEW_LINE> <INDENT> if (skipkeys is False and ensure_ascii is True and check_circular is True and allow_nan is True and cls is None and indent is None ...
Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` ...
625941efb5575c28eb68e56d
@nose_raises(Err) <NEW_LINE> def test_lconf_section_splitlines_expect_failure1(): <NEW_LINE> <INDENT> print('::: TEST: test_lconf_section_splitlines_expect_failure1()') <NEW_LINE> path_to_lconf_file = path_join(SCRIPT_PATH, 'example_to_validate_with_err5.lconf') <NEW_LINE> with open(path_to_lconf_file, 'r') as file_: <...
Tests: test_lconf_section_splitlines_expect_failure1
625941efe64d504609d74da7
def __updateOtherSites( self, job, stagingSite, stagedLFNsPerSE, optInfo ): <NEW_LINE> <INDENT> updated = False <NEW_LINE> for site, siteDict in optInfo['SiteCandidates'].items(): <NEW_LINE> <INDENT> if stagingSite == site: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> closeSEs = getSEsForSite( site ) <NEW_LINE> if ...
Update Optimizer Info for other sites for which the SE on which we have staged Files are declared local
625941efdc8b845886cb5a9e
def empirical_info_gain_of_eigens(data_set, eigens): <NEW_LINE> <INDENT> def empirical_info_gain_closure(eigen_values): <NEW_LINE> <INDENT> cond_entropy = empirical_cond_entropy(data_set, eigen_values) <NEW_LINE> info_gain = entropy - cond_entropy <NEW_LINE> return info_gain <NEW_LINE> <DEDENT> entropy = empirical_entr...
Calculate information gain of all eigens respectively This function iterate each eigen in eigens, and calculate information gain for each eigen :param data_set: data set belonging to one node of decision tree :param eigens: dictionary of eigen name and eigen values :return: list of tuple. Each tuple is like (eigen A, i...
625941ef2eb69b55b151ce1f
def getSelectedAnimLayers(): <NEW_LINE> <INDENT> layers = list() <NEW_LINE> for each in mc.ls(type='animLayer'): <NEW_LINE> <INDENT> if mc.animLayer(each, query=True, selected=True): <NEW_LINE> <INDENT> layers.append(each) <NEW_LINE> <DEDENT> <DEDENT> return layers
Return the names of the layers which are selected
625941ef92d797404e3046f4
def test_email_change_unauthorized(self): <NEW_LINE> <INDENT> response = self.client.post( reverse("email_change_api"), data=self.serializer_data ) <NEW_LINE> self.assertEqual(response.status_code, 401)
A ``POST`` from an unauthorized user should return ``401``.
625941ef91af0d3eaac9bf85
@raises(AssertionError) <NEW_LINE> def test_tuple_inside_class_withoutschema(): <NEW_LINE> <INDENT> @dataclass <NEW_LINE> class MyClass: <NEW_LINE> <INDENT> f: object <NEW_LINE> <DEDENT> e = MyClass((1, 2)) <NEW_LINE> assert_object_roundtrip(e, works_without_schema=True)
tuple inside needs a schema hint
625941efd18da76e23532a45
def on_mnu_preferences_activate(self, widget, data=None): <NEW_LINE> <INDENT> if self.preferences_dialog is not None: <NEW_LINE> <INDENT> logger.debug('show existing preferences_dialog') <NEW_LINE> self.preferences_dialog.present() <NEW_LINE> <DEDENT> elif self.PreferencesDialog is not None: <NEW_LINE> <INDENT> logger....
Display the preferences window for remarkable.
625941ef4f6381625f114fa3
def get_week_start_day_id(delta=0): <NEW_LINE> <INDENT> date = datetime.now() + timedelta(weeks=delta) <NEW_LINE> week_begin = (date - timedelta(days=date.weekday())).strftime('%Y%m%d') <NEW_LINE> return int(week_begin)
一周的开始日期
625941ef099cdd3c635f11c0
def _get_ses_connection(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> connection = get_boto_ses_connection() <NEW_LINE> return connection <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> raise Exception("Could not connect to Amazon SES service")
Convenience method for returning a SES connection, and handling any errors that may appear. :rtype: boto.ses.SESConnection
625941ef090684286d50f256
def test_start_fails_on_missing_config_for_configdrive(self): <NEW_LINE> <INDENT> missing_parameters_error = ("Parameters missing to make a " "connection with radosgw") <NEW_LINE> CONF.set_override('configdrive_use_object_store', True, group='deploy') <NEW_LINE> CONF.set_override('object_store_endpoint_type', 'radosgw'...
Check to fail conductor on missing config options
625941ef4a966d76dd55157d
def update_project(project, opr): <NEW_LINE> <INDENT> if not project and not opr: <NEW_LINE> <INDENT> project.update(opr) <NEW_LINE> db = Mysql() <NEW_LINE> r = project_dao.update_project(project, db) <NEW_LINE> db.dispose() <NEW_LINE> <DEDENT> return r or 0
更新项目
625941ef5510c4643540f93e
@twarc2.group() <NEW_LINE> @click.pass_obj <NEW_LINE> def compliance_job(T): <NEW_LINE> <INDENT> pass
Create, retrieve and list batch compliance jobs for Tweets and Users.
625941ef090684286d50f257
def tranform_from_body_to_world_frame(pos, coords): <NEW_LINE> <INDENT> coords_hom = to_homogenuous(coords) <NEW_LINE> r_to_w_matrix = np.identity(pos.shape[0]) <NEW_LINE> r_to_w_matrix[0, -1] = pos[0] <NEW_LINE> r_to_w_matrix[1, -1] = pos[1] <NEW_LINE> c, s = math.cos(pos[-1]), math.sin(pos[-1]) <NEW_LINE> r_to_w_matr...
Transform coordinates from the body to the world frame, specified by pos. :param pos: The position of the robot. 1 x 2 array :param coords: The coordinates to be transformed; n x 2 array :return: The coordinates in the world frame. 2 x n array
625941efd164cc61757832b7
def fit(self, x, y, *, event=1, woe_min=-20, woe_max=20): <NEW_LINE> <INDENT> woe_dict = {} <NEW_LINE> iv = 0 <NEW_LINE> pos_dic = self._posibility(x=x, tag=y, event=event) <NEW_LINE> for l, (rate_event, rate_non_event) in pos_dic.items(): <NEW_LINE> <INDENT> if rate_event == 0: <NEW_LINE> <INDENT> woe1 = woe_min <NEW_...
训练对单独一项自变量(列,特征)的woe值. Parameters: x (Sequence): - 离散特征序列 y (Sequence): - 用于训练的标签序列 event (any): - True指代的触发事件 woe_min (munber): - woe的最小值,默认值为-20 woe_max (munber): - woe的最大值,默认值为20
625941ef009cb60464c63915
def list_policies(self): <NEW_LINE> <INDENT> api_path = '/v1/sys/policy' <NEW_LINE> response = self._adapter.get( url=api_path, ) <NEW_LINE> return response.json()
List all configured policies. Supported methods: GET: /sys/policy. Produces: 200 application/json :return: The JSON response of the request. :rtype: dict
625941efcc0a2c11143dd3f9
def __init__(self, operation, gate_agent, status_class, status_path): <NEW_LINE> <INDENT> self.__gate_agent = gate_agent <NEW_LINE> operation.bind_agent(gate_agent) <NEW_LINE> self.__status_class = status_class <NEW_LINE> self.__status_path = status_path <NEW_LINE> super(GcsPubsubTriggerOperationStatus, self).__init__(...
Constructs a GcsPubsubTriggerOperationStatus object. Args: operation [BaseGcsPubsubTriggerOperation]: The GCS operation this is for.
625941ef462c4b4f79d1dc37
def bbands(price, period, deviation = 2): <NEW_LINE> <INDENT> return bbands_calc(price, period, deviation)
.. Bollinger Bands Parameters ---------- price : `ndarray` Array of type float64 or float32 containing the prices. period : `int` Number of periods to be used. deviation : `int`, optional Number of standard deviations from the mean. Defaults to 20. Returns ------- upper : `ndarray` Upper bollinger...
625941ef15baa723493c44e2
def ip_to_licenseid(self, ip, all_licenses=1): <NEW_LINE> <INDENT> data = { 'ip': ip, 'all': all_licenses } <NEW_LINE> return self.__query('XMLlookup.cgi', data)
Get IP address's license https://documentation.cpanel.net/display/SDK/Manage2+API+Functions+-+Look+Up+License+ID
625941efb7558d58953c5470
def read_and_decode(): <NEW_LINE> <INDENT> file_queue = tf.train.string_input_producer([FLAGS.captchares_dir]) <NEW_LINE> reader = tf.TFRecordReader() <NEW_LINE> key, value = reader.read(file_queue) <NEW_LINE> features = tf.parse_single_example(value, features={ 'image': tf.FixedLenFeature([], tf.string), 'label': tf.F...
#读取数据api :return: image_batch, label_batch
625941ef82261d6c526aba10
def connect(self): <NEW_LINE> <INDENT> conn = self._new_conn() <NEW_LINE> if getattr(self, '_tunnel_host', None): <NEW_LINE> <INDENT> self.sock = conn <NEW_LINE> self._tunnel() <NEW_LINE> self.auto_open = 0 <NEW_LINE> <DEDENT> RECENT_DATE = datetime.date(2014, 1, 1) <NEW_LINE> is_time_off = datetime.date.today() < RECE...
Override the Connect Method to fix the Certificate Verification.
625941efe76e3b2f99f3ad6a
def widget(self): <NEW_LINE> <INDENT> return QWidget
QCompleter.widget() -> QWidget
625941ef73bcbd0ca4b2c5dd
def get_deadline_metadata(self): <NEW_LINE> <INDENT> return
Gets the metadata for the assessment deadline. :return: metadata for the end time :rtype: ``osid.Metadata`` *compliance: mandatory -- This method must be implemented.*
625941ef07f4c71912b119ed
def test_template_coordinate_system(gly): <NEW_LINE> <INDENT> assert gly.coordinate_system == "Cartesian"
Test the gly template coordinate system.
625941ef460517430c3946de
def wind_direction(self, unit_out=units.degree): <NEW_LINE> <INDENT> if unit_out not in self.__accepted_direction_unit__: <NEW_LINE> <INDENT> raise OptionConversionException("Invalid direction unit %s." % unit_out) <NEW_LINE> <DEDENT> hour = datetime.datetime.utcnow().hour <NEW_LINE> reference_direction = 180 * math.si...
Returns the wind direction in the chosen unit in the range between 0 to 360 degrees. :param unit: Unit in which the instrument should return the angle. :return: the angle.
625941effff4ab517eb2f9a8
def test_ap_track_taxonomy_5g(dev, apdev): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _test_ap_track_taxonomy_5g(dev, apdev) <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> subprocess.call(['iw', 'reg', 'set', '00']) <NEW_LINE> dev[0].flush_scan_cache()
AP tracking STA taxonomy (5 GHz)
625941ef1d351010ab856083
def parse_domains_detected(feature): <NEW_LINE> <INDENT> domains = [] <NEW_LINE> if not feature.sec_met: <NEW_LINE> <INDENT> return domains <NEW_LINE> <DEDENT> for domain in feature.sec_met.domains: <NEW_LINE> <INDENT> dom = {} <NEW_LINE> dom['name'] = domain.name <NEW_LINE> dom['evalue'] = domain.evalue <NEW_LINE> dom...
Parse detected domains.
625941ef8a43f66fc4b545c7
def _write_xml(write, node, encoding, namespaces, pipeline, xhtml=False): <NEW_LINE> <INDENT> if encoding is None: <NEW_LINE> <INDENT> encoding = 'utf-8' <NEW_LINE> <DEDENT> tag = node.tag <NEW_LINE> if tag is Comment: <NEW_LINE> <INDENT> write(_COMMENT_START + _escape_cdata(node.text, encoding) + _COMMENT_END) <NEW_LI...
Write XML to a file
625941ef4d74a7450ccd472d