code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def test_delete_1_five_times(self): <NEW_LINE> <INDENT> lis = self.list <NEW_LINE> lis.delete(1, 5) <NEW_LINE> now = lis.head <NEW_LINE> i = 0 <NEW_LINE> answer = (23, 'abc', (1, 2), 0, 100) <NEW_LINE> while now is not None: <NEW_LINE> <INDENT> self.assertEqual((now.elem), answer[i]) <NEW_LINE> now = now.next_item <NEW...
there can be problems if program will try to find 1 five items so check that there are no bugs and all the elem in new list
625941c94c3428357757c3b1
@commandWrap <NEW_LINE> def UVAutomaticProjection(*args, **kwargs): <NEW_LINE> <INDENT> return cmds.UVAutomaticProjection(*args, **kwargs)
:rtype: list|str|DagNode|AttrObject|ArrayAttrObject|Components1Base
625941c9b7558d58953c4f9f
def pack_sqr(self): <NEW_LINE> <INDENT> global CONST_ZETA <NEW_LINE> i = np.arange(1, self.nx + 1) <NEW_LINE> xi = i*self.throat + (2.0*i -1.0)*self.radius <NEW_LINE> j = np.arange(1, self.ny + 1) <NEW_LINE> yj = j*self.throat + (2.0*j -1.0)*self.radius <NEW_LINE> circles = np.zeros(self.ngrains, dtype={'nam...
Generates the coordinates of the grain centers for the square packing
625941c96aa9bd52df036e2d
def inactivate(self, pos): <NEW_LINE> <INDENT> self.active_set.discard(pos)
Inactivate cell at po.
625941c9090684286d50ed6e
def find_links(self, ID, submitter, cursor, row_count=3, date_mode=False): <NEW_LINE> <INDENT> if date_mode: <NEW_LINE> <INDENT> qry, inputs = self.find_link_qry(ID, submitter, date_mode=date_mode) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> qry, inputs = self.find_link_qry(ID, submitter) <NEW_LINE> <DEDENT> cursor.e...
Get 3 owner, repo, number, link-type tuples linking to the same ID INPUT ID : int; repo_id being linked to. submitter : string; name of linker. cursor : MySQLCursor object; linked to database with filtered_links_dated table r...
625941c9796e427e537b064f
def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._commands['put'] = self.set <NEW_LINE> self.fonts = {} <NEW_LINE> self.chars = collections.defaultdict(list) <NEW_LINE> self.vf_char = collections.namedtuple('vf_char', 'char_code tex_name') <NEW_LINE> self._default_font = None
Initializes the _commands dictionary and several state variables. Calls OpcodeCommandsMachine's __init__ to build _commands, which maps VF and DVI commands to functions, assigns the command 'put' to the function 'set' because the differences between the commands don't matter in this context (they both typeset characte...
625941c9498bea3a759b9b38
def get(self): <NEW_LINE> <INDENT> if self.request.get('iframed') == 'true': <NEW_LINE> <INDENT> self.values['iframed'] = True <NEW_LINE> <DEDENT> if self.request.get('interactive') == 'true': <NEW_LINE> <INDENT> self.values['interactive'] = True <NEW_LINE> <DEDENT> if 'parent_index' in self.request.GET.keys(): <NEW_LI...
Returns the widget repository page.
625941c9d6c5a102081440d4
def _set_volume_runtime_properties(volume): <NEW_LINE> <INDENT> if volume: <NEW_LINE> <INDENT> if volume.availability_zone: <NEW_LINE> <INDENT> ctx.instance.runtime_properties[OPENSTACK_AZ_PROPERTY] = volume.availability_zone <NEW_LINE> <DEDENT> is_bootable = True if volume.is_bootable else False <NEW_LI...
Set volume configuration as runtime properties so that it can be used when attach volume as bootable to server, so this configuration will be required when create a relationship between server and volume :param volume: Volume instance of openstack.volume.v2.volume.Volume
625941c9a8370b7717052929
def test_set_package_entry(self): <NEW_LINE> <INDENT> pkg = ( Package() .set('foo', DATA_DIR / 'foo.txt', {'user_meta': 'blah'}) .set('bar', DATA_DIR / 'foo.txt', {'user_meta': 'blah'}) ) <NEW_LINE> pkg['foo'].meta['target'] = 'unicode' <NEW_LINE> pkg['bar'].meta['target'] = 'unicode' <NEW_LINE> test_file = Path('bar.t...
Set the physical key for a PackageEntry
625941c91d351010ab855ba5
def init(self, force_deploy: bool = False): <NEW_LINE> <INDENT> _force_deploy = self.provider_conf.force_deploy <NEW_LINE> self.provider_conf.force_deploy = _force_deploy or force_deploy <NEW_LINE> self.networks = [] <NEW_LINE> self.hosts = [] <NEW_LINE> self.launch() <NEW_LINE> return self._to_enoslib()
Take ownership over some Grid'5000 resources (compute and networks). The function does the heavy lifting of transforming your abstract resource configuration into concrete resources. From a high level perspective it works as follow: - First it transforms the configuration of resources into an actual OAR resource s...
625941c956b00c62f0f146e2
@db_session <NEW_LINE> def get_lesson(id: int): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> lesson = Lesson[id] <NEW_LINE> if lesson: <NEW_LINE> <INDENT> schema = LessonSchema() <NEW_LINE> return schema.dump(lesson).data <NEW_LINE> <DEDENT> <DEDENT> except ObjectNotFound: <NEW_LINE> <INDENT> abort(404)
Returns a lesson, given its ID
625941c98a43f66fc4b540ef
def set_position(self, angle): <NEW_LINE> <INDENT> duty = self.mapvalue(angle, 0, 180, self.low, self.high) <NEW_LINE> print("Lock:\tDuty:" + str(duty)) <NEW_LINE> self.pwm.ChangeDutyCycle(duty)
Set the position of the servo
625941c966673b3332b9211a
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, BadgePublicationTimePolicy): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.to_dict() == other.to_dict()
Returns true if both objects are equal
625941c9d53ae8145f87a2fb
def test_add_course_undefined(self): <NEW_LINE> <INDENT> test_school = School("Computing and Academic Studies") <NEW_LINE> invalid_course = None <NEW_LINE> self.assertRaisesRegex(ValueError, "Course must be defined.", test_school.add_course, invalid_course)
020B - Invalid Add Course Parameters
625941c9435de62698dfdcd6
def test_reading_writing_alignments_pfam4(self): <NEW_LINE> <INDENT> path = "Stockholm/pfam4.seed.txt" <NEW_LINE> with open(path, encoding="UTF-8") as stream: <NEW_LINE> <INDENT> alignments = stockholm.AlignmentIterator(stream) <NEW_LINE> alignment = next(alignments) <NEW_LINE> self.assertRaises(StopIteration, next, al...
Test parsing Pfam record 3Beta_HSD.
625941c95f7d997b87174b21
def SetPageText(self, page, text): <NEW_LINE> <INDENT> self._pagesInfoVec[page].SetCaption(text) <NEW_LINE> return True
Sets the tab caption of the page.
625941c9379a373c97cfabce
def qryAccount(self): <NEW_LINE> <INDENT> self.api.qryAccount()
查询账户资金
625941c921a7993f00bc7d78
def delete_subnet(network_client, rg_name, vnet_name, subnet_name): <NEW_LINE> <INDENT> logger.debug('deleting subnet {} on virtual network {}'.format( subnet_name, vnet_name)) <NEW_LINE> return network_client.subnets.delete( resource_group_name=rg_name, virtual_network_name=vnet_name, subnet_name=subnet_name, )
Delete a subnet :param azure.mgmt.network.NetworkManagementClient network_client: network client :param str rg_name: resource group name :param str vnet_name: virtual network name :param str subnet_name: subnet name :rtype: msrestazure.azure_operation.AzureOperationPoller :return: async op poller
625941c930dc7b76659019f1
def _auto_merge(self, using, texts): <NEW_LINE> <INDENT> l0, h0, l1, h1, l2, h2 = self._merge_blocks(using) <NEW_LINE> if h0-l0 == h2-l2 and texts[0][l0:h0] == texts[2][l2:h2]: <NEW_LINE> <INDENT> if l1 != h1 and l0 == h0: <NEW_LINE> <INDENT> tag = "delete" <NEW_LINE> <DEDENT> elif l1 != h1: <NEW_LINE> <INDENT> tag = "...
Automatically merge two sequences of change blocks
625941c91b99ca400220ab3b
def test_hsl_is_default(self): <NEW_LINE> <INDENT> self.actionable.is_default = True <NEW_LINE> self.expected_hsl['is_default'] = 1 <NEW_LINE> self.assertDictEqual(self.actionable.to_hsl(), self.expected_hsl)
verify that is_default is updated in the hsl
625941c94428ac0f6e5ba87c
def columnCount(self, parent=None, *args, **kwargs): <NEW_LINE> <INDENT> pass
columnCount(self, parent: QModelIndex = QModelIndex()) -> int
625941c90a366e3fb873e8a3
def websocket_handler(self, handler): <NEW_LINE> <INDENT> self.java_obj.websocketHandler(ServerWebSocketHandler(handler)) <NEW_LINE> return self
Set the websocket handler for the server. As websocket requests arrive on the server a new ServerWebSocket instance will be created and passed to the handler. Keyword arguments: @param handler: the function used to handle the request. @return self
625941c9f548e778e58cd607
def FinishConnection(self, request): <NEW_LINE> <INDENT> self.Signal("finish", request)
Called by pyramid on termination for each connection with request as parameter. Event: - finish(request)
625941c98a43f66fc4b540f0
def __init__(self, layer, n_layers): <NEW_LINE> <INDENT> super(BasicEncoder, self).__init__() <NEW_LINE> self.n_layers = n_layers <NEW_LINE> self.norm = LayerNorm(layer.n_features) <NEW_LINE> self.layers = clones(layer, n_layers) <NEW_LINE> return
layer: nn.Moudle subclass the layer module (self-attention, etc.) n_layers: int number of layers
625941c938b623060ff0ae78
def EtaMin(self): <NEW_LINE> <INDENT> return _stomp.GeometricBound_EtaMin(self)
EtaMin(self) -> double
625941c91f037a2d8b946288
def __init__(self, species, qty, country_code ): <NEW_LINE> <INDENT> self.species = species <NEW_LINE> self.qty = qty <NEW_LINE> self.country_code = country_code <NEW_LINE> self.shipped = False
Initialize melon order attributes
625941c930c21e258bdfa527
def testEditPostInvalidData(self): <NEW_LINE> <INDENT> postA = models.Post(title="Example post A", body="Just a test") <NEW_LINE> postB = models.Post(title="Example post B", body="Still a test") <NEW_LINE> session.add_all([postA, postB]) <NEW_LINE> session.commit() <NEW_LINE> data = { "title": "Example Post", "body": 3...
Editing a post with an invalid body
625941c90fa83653e4657046
def get_user_by_account(account): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = UserInfo.objects.filter(Q(username=account) | Q(email=account) | Q(phone=account)).first() <NEW_LINE> <DEDENT> except UserInfo.DoesNotExist: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return user
根据条件获取用户
625941c93c8af77a43ae382a
def _add_pkg_simple_list_lens(data, pkg, indent=''): <NEW_LINE> <INDENT> na = len(pkg.name) + 1 + len(pkg.arch) + len(indent) <NEW_LINE> ver = len(pkg.evr) <NEW_LINE> rid = len(pkg.reponame) <NEW_LINE> for (d, v) in (('na', na), ('ver', ver), ('rid', rid)): <NEW_LINE> <INDENT> data[d].setdefault(v, 0) <NEW_LINE> data[d...
Get the length of each pkg's column. Add that to data. This "knows" about simpleList and printVer.
625941c91f5feb6acb0c4bdc
def test_long_dna_fasta(self): <NEW_LINE> <INDENT> expected = "%s\n%s" % (self.match.get_fasta_header(), self.match.long_dna) <NEW_LINE> self.assertMultiLineEqual(self.match.long_dna_fasta(), expected)
Test FeatureMatch long DNA FASTA output
625941c98c0ade5d55d3ea44
def get_src_stocksnap(html): <NEW_LINE> <INDENT> soup = BeautifulSoup(html, 'html.parser') <NEW_LINE> img = soup.find('div', class_='img-col') <NEW_LINE> img = img.find('img')['src'] <NEW_LINE> return img
Getting a link from the site: https://stocksnap.io
625941c9287bf620b61d3aee
def get_chat_name_with_id(self, chat_open_id:str) -> str: <NEW_LINE> <INDENT> return self.__get_chat_name_with_id(chat_open_id)
根据群聊open_id获取对应的群聊名,获取失败时返回None :param chat_open_id: 群聊open_id
625941c94a966d76dd551099
def done_data(self, items): <NEW_LINE> <INDENT> if not isinstance(items, (list, tuple)): <NEW_LINE> <INDENT> items = list(items) <NEW_LINE> <DEDENT> if items: <NEW_LINE> <INDENT> pipe = get_connection().pipeline(True) <NEW_LINE> pipe.hdel(self.mkey, *items) <NEW_LINE> pipe.zrem(self.vkey, *items) <NEW_LINE> return pipe...
Call when you are done with data that has a visibility timeout > 0.
625941c9956e5f7376d70ef8
def get_column(self, name): <NEW_LINE> <INDENT> if name == 'time': <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> if not self.is_variable(name): <NEW_LINE> <INDENT> raise VariableNotTimeVarying("Variable " + name + " is not time-varying.") <NEW_LINE> <DEDENT> varInd = self.get_variable_index(name) <NEW_LINE> dataInd...
Returns the column number in the data matrix where the values of the variable are stored. Parameters:: name -- Name of the variable/parameter/constant. Returns:: The column number.
625941c9fbf16365ca6f624d
def legendre_pol(a,b): <NEW_LINE> <INDENT> return( integrate(a*b, (x, -1, 1) ) )
ルジャンドルの多項式
625941c963f4b57ef00011a5
def GetKernel(self): <NEW_LINE> <INDENT> return _itkGrayscaleMorphologicalClosingImageFilterPython.itkGrayscaleMorphologicalClosingImageFilterID3ID3SE3_GetKernel(self)
GetKernel(self) -> itkFlatStructuringElement3
625941c92c8b7c6e89b3584b
def labels_update(self): <NEW_LINE> <INDENT> for i in range(3): <NEW_LINE> <INDENT> modelnum = self.mapping[i] <NEW_LINE> self.all_models[modelnum].representative_topics_enumlabels.append(self.comboBoxes[i].currentText()) <NEW_LINE> self.all_models[modelnum].representative_topics_textlabels.append(self.headings[i]) <NE...
Update stored label-based feedback for the topic as given by the user
625941c94c3428357757c3b2
def evaluate(data): <NEW_LINE> <INDENT> X, Y, Z = 1e-10, 1e-10, 1e-10 <NEW_LINE> f = codecs.open('/models/allField_train_test_architecture_origin/dev_pred.json', 'w', encoding='utf-8') <NEW_LINE> pbar = tqdm() <NEW_LINE> for d in data: <NEW_LINE> <INDENT> R = set([SPO(spo) for spo in extract_spoes(d['text'])]) <NEW_LIN...
评估函数,计算f1、precision、recall
625941c93617ad0b5ed67f82
def all_pairs(frags, plec_weight, plisrs_iter, plisrs_dedup): <NEW_LINE> <INDENT> allPairs = list(it.combinations(frags, 2)) <NEW_LINE> pair_all = [] <NEW_LINE> for j in range(len(allPairs)): <NEW_LINE> <INDENT> pair1 = allPairs[j][0] <NEW_LINE> pair2 = allPairs[j][1] <NEW_LINE> pair_all.append([pair1, pair2, -1]) <NEW...
Enumerate all pairs. Args: frags (list of list): [chrom,start,end] for each fragment in a GEM Returns: pair_all (list of pair): all pairs of frags in format [pair1, pair2]
625941c9090684286d50ed6f
def get_post(self, tweet_id): <NEW_LINE> <INDENT> url = Twitter.BASE_URL + 'statuses/retweets/{id}.json'.format(id=tweet_id) <NEW_LINE> d = self.get(url) <NEW_LINE> return d.json()[0]
Returns a single post
625941c9b57a9660fec3390d
def define(): <NEW_LINE> <INDENT> flags.DEFINE_integer('batch_size', 32, 'Batch size.') <NEW_LINE> flags.DEFINE_integer('crop_width', None, 'Width of the central crop for images.') <NEW_LINE> flags.DEFINE_integer('crop_height', None, 'Height of the central crop for images.') <NEW_LINE> flags.DEFINE_string('train_log_di...
Define common flags.
625941c9cad5886f8bd27064
def checkends(s): <NEW_LINE> <INDENT> return s[0] == s[-1]
This function takes in a string s and returns True if the first character in s is the same as the last character in s. It returns False otherwise Args: s (str): a string to be checked Returns: bool: True is first char == last char
625941c9a8ecb033257d3158
def __init__(self, power, move, attack_range, capacity): <NEW_LINE> <INDENT> self.max_power = power <NEW_LINE> self.power = power <NEW_LINE> self.movement = move <NEW_LINE> self.range = attack_range <NEW_LINE> self.capacity = capacity
Constructor
625941c98c0ade5d55d3ea45
def fit(self, X, y, num_trees = 1000, feature_ratio = 0.1, sample_ratio = 0.1, impurity = "Gini"): <NEW_LINE> <INDENT> self.num_trees = num_trees <NEW_LINE> self.num_observations = X.shape[0] <NEW_LINE> self.num_features = X.shape[1] <NEW_LINE> self.impurity = impurity <NEW_LINE> self.sample_data_size = np.round((self....
Fit data to RandomForestClassifier object
625941c9f9cc0f698b140687
def turn_brightness(grid, action, row0, col0, row1, col1): <NEW_LINE> <INDENT> for row in range(row0, row1 + 1): <NEW_LINE> <INDENT> for col in range(col0, col1 + 1): <NEW_LINE> <INDENT> if action == "turn_on": <NEW_LINE> <INDENT> grid[row][col] += 1 <NEW_LINE> <DEDENT> elif action == "turn_off": <NEW_LINE> <INDENT> if...
Actualiza la matriz de brillo según las instrucciones y coordenadas
625941c9fb3f5b602dac371d
def fatal(self, message, *args, **kwargs) -> None: <NEW_LINE> <INDENT> self.logger.fatal(message, *args, **kwargs) <NEW_LINE> self._publish_log_if_necessary(message, logging.FATAL)
Called for a fatal log :param message: the log message
625941c93346ee7daa2b2df5
def xaccTransGetRateForCommodity(*args): <NEW_LINE> <INDENT> return _gnucash_core_c.xaccTransGetRateForCommodity(*args)
xaccTransGetRateForCommodity(Transaction trans, gnc_commodity split_com, Split split_to_exclude, gnc_numeric rate) -> gboolean
625941c9442bda511e8be4a4
def listActiveWorkflowInstances(DomainName: str, ServiceName: str, UserName: str = None, Password: str = None, SecurityDomain: str = "Native", ResilienceTimeout: int = None ) -> namedtuple("ListActiveWorkflowInstancesResult", ['retcode', "stdout", "stderr"]): <NEW_LINE> <INDENT> envs = os.environ <NEW_LINE> options = [...
:param DomainName: :param ServiceName: :param UserName: :param Password: :param SecurityDomain: default is Native :param ResilienceTimeout: :return: namedtuple("CmdResult",['retcode', "stdout", "stderr"]) if stdout is existing, then it will return namedtuple('activeWorkflowInst', ['Workflow_Instance_State', 'Workflow_I...
625941c907d97122c4178914
def on_reconnection(new_channel): <NEW_LINE> <INDENT> self.set_transport_socket_timeout() <NEW_LINE> self._set_current_channel(new_channel) <NEW_LINE> for consumer in self._consumers: <NEW_LINE> <INDENT> consumer.declare(self) <NEW_LINE> <DEDENT> LOG.info(_LI('[%(connection_id)s] Reconnected to AMQP server on ' '%(host...
Callback invoked when the kombu reconnects and creates a new channel, we use it the reconfigure our consumers.
625941c915baa723493c3fff
def set_format(self, dtfmt): <NEW_LINE> <INDENT> if not isinstance(dtfmt, str): <NEW_LINE> <INDENT> raise TypeError("Invalid date/time format: %s (%s)" % (dtfmt, type(dtfmt))) <NEW_LINE> <DEDENT> import pyparsing as pp <NEW_LINE> self.ParseException = pp.ParseException <NEW_LINE> from .s3utils import s3_str <NEW_LINE> ...
Update the date/time format for this parser, and generate the corresponding pyparsing grammar Args: dtfmt: the date/time format
625941c9a17c0f6771cbe0db
def error(self, message, line): <NEW_LINE> <INDENT> extra = { 'line': line, } <NEW_LINE> self.logger.error(message, extra=extra)
Parameters ---------- message : str line : int
625941c926068e7796caed68
def get_epa_species_list(self, composition_space, constraints, random): <NEW_LINE> <INDENT> reduced_formula = composition_space.endpoints[0].reduced_composition <NEW_LINE> num_atoms_in_formula = reduced_formula.num_atoms <NEW_LINE> max_num_formulas = int(constraints.max_num_atoms/num_atoms_in_formula) <NEW_LINE> min_nu...
Returns a list containing the species in the random organism. Precondition: the composition space contains only one endpoint (it's a fixed-composition search) Args: composition_space: the CompositionSpace of the search constraints: the Constraints of the search random: a copy of Python's built in PR...
625941c9be7bc26dc91cd68c
def test_neighborhood_retrieval(self): <NEW_LINE> <INDENT> neighbors_1 = self.space.get_neighbors((-20, -20), 1) <NEW_LINE> assert len(neighbors_1) == 2 <NEW_LINE> neighbors_2 = self.space.get_neighbors((40, -10), 10) <NEW_LINE> assert len(neighbors_2) == 0 <NEW_LINE> neighbors_3 = self.space.get_neighbors((-30, -30), ...
Test neighborhood retrieval
625941c94f6381625f114ac6
def get_destination_coords(path_to_tile): <NEW_LINE> <INDENT> x: int = 0 <NEW_LINE> y: complex = 0 + 0j <NEW_LINE> optimized_directions = optimize_directions(path_to_tile) <NEW_LINE> for direction in optimized_directions: <NEW_LINE> <INDENT> if direction == "ne": <NEW_LINE> <INDENT> y += 1 + 1j <NEW_LINE> <DEDENT> elif...
Generate a coordinates for the tile at the end of the given path.
625941c9a79ad161976cc1d0
def obtener_lot_data_usuario(self, owner_id,lote_id, fecha_inicial): <NEW_LINE> <INDENT> if owner_id.isnumeric(): <NEW_LINE> <INDENT> owner_id = int(owner_id) <NEW_LINE> <DEDENT> lot_data = [data for data in self.__db.lot_data.find({"timestamp": {"$gt": fecha_inicial}, "owner_id": owner_id,"lot_number":lote_id})] <NEW_...
Permite obtener los datos de un lote de un usuario de la bd coffee_leaf_rust_diagnosis desde cierta fecha. :param owner_id: La identificación del usuario en la base de datos coffee_leaf_rust_diagnosis. Es importante resaltar, que esta identificación en coffee_rescuer_db es el campo username y se trata como un string. :...
625941c9dd821e528d63b234
def to_timestamp(obj: datetime) -> int: <NEW_LINE> <INDENT> return int(obj.timestamp())
毫秒值
625941c90383005118ecf66d
def pwmControl(pp = 'Y1', tim = 8, ch=1, f= 50000): <NEW_LINE> <INDENT> p = Pin(pp) <NEW_LINE> tim = Timer(tim, freq=f) <NEW_LINE> return tim.channel(ch, Timer.PWM, pin=p)
returns an object that can set a duty cycle percentage, eg. >> c = pwmControl() >> c.pulse_width_percent(50)
625941c96fece00bbac2d7c8
def __init__(self, dist_type: str, a: float, b: float): <NEW_LINE> <INDENT> self.dist_type = dist_type <NEW_LINE> self.a = a <NEW_LINE> self.b = b
Defines the distribution :param dist_type: One of the distribution types used in __call__. :param a: The first parameter for the distribution type. For example, if dist_type="uniform", a is the lowest value and b in the highest, and if dist_type="normal", a is the mean and b is the std. :param b: The second parameter f...
625941c9b830903b967e9996
def buyout_booking(bookingId): <NEW_LINE> <INDENT> sql_select_booking = 'select * from "Booking_Info" where "Id" = %s and "Status" = 0' <NEW_LINE> sql_update_booking_status = 'update "Booking_Info" ' 'set "Status" = 1 where "Id" = %s ' <NEW_LINE> try: <NEW_LINE> <INDENT> with get_db_conne...
buyout_booking # noqa: E501 :param bookingId: :type bookingId: int :rtype: bool
625941c9d164cc6175782dd8
def __init__(self, ui): <NEW_LINE> <INDENT> super(COTRemoveFile, self).__init__(ui) <NEW_LINE> self.file_path = None <NEW_LINE> self.file_id = None
Instantiate this command with the given UI. Args: ui (UI): User interface instance.
625941c997e22403b379d025
def testReadOptions11(self): <NEW_LINE> <INDENT> self.ReadOptionsTest(1.1, "options11a.txt")
csnContextTests: test read from options v1.1.
625941c945492302aab5e34e
def getQuery(self,resource): <NEW_LINE> <INDENT> X = numpy.array(resource.get('X')) <NEW_LINE> q,score = utilsMDS.getRandomQuery(X) <NEW_LINE> index_center = q[2] <NEW_LINE> index_left = q[0] <NEW_LINE> index_right = q[1] <NEW_LINE> return index_center,index_left,index_right
A request to ask which triplet to ask next Expected input: (next.database.DatabaseClient) resource : database client, can cell resource.set(key,value), value=resource.get(key) Expected output: (int) index_center : index of arm must be in {0,1,2,...,n-1} (int) index_left : index of arm must be in {0,1,2,...,n-...
625941c930dc7b76659019f2
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, ProtectionGroupSnapshotGetResponse): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941c966656f66f7cbc236
def plot_with_control(self, control=None, output_path=None, show_kl_divergence=True, show_legend=True, file_type=None, output_pdf=None): <NEW_LINE> <INDENT> if control is None: <NEW_LINE> <INDENT> logger.error("You need to plot with a control.") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> logger.info("Plotting with s...
Given all of the data and an output path, saves a PDF of the comparison with some statistics as well. :param control: The control ExperimentalCondition object :param output_path: output filepath - if not specified, doesn't save :param show_kl_divergence: flag for displaying calculated kl_divergence :param show_legend...
625941c9e5267d203edcdd29
@session_wrapper <NEW_LINE> def get_dbchange(filename, session=None): <NEW_LINE> <INDENT> q = session.query(DBChange).filter_by(changesname=filename) <NEW_LINE> try: <NEW_LINE> <INDENT> return q.one() <NEW_LINE> <DEDENT> except NoResultFound: <NEW_LINE> <INDENT> return None
returns DBChange object for given C{filename}. @type filename: string @param filename: the name of the file @type session: Session @param session: Optional SQLA session object (a temporary one will be generated if not supplied) @rtype: DBChange @return: DBChange object for the given filename (C{None} if not present...
625941c976e4537e8c3516fd
def __init__(self, substances: Dict[str, float] = {}, equations: List[ESCEquation] = []): <NEW_LINE> <INDENT> self._substances_index: Dict[str, int] = {} <NEW_LINE> self._substances_name: List[str] = [] <NEW_LINE> self._substances_amount: List[float] = [] <NEW_LINE> self._substances_state: List[ESCState] = [] <NEW_LINE...
化学反应体系。 substances: Dict[str, float] 各物质的初始量,未在此处指定者视为0。 equations: List[ESCEquation] 体系中存在的化学方程式。
625941c94f88993c3716c0f3
def test_frame_sortedk_negative_k(self): <NEW_LINE> <INDENT> with self.assertRaisesRegexp(Exception, "k should be greater than zero"): <NEW_LINE> <INDENT> self.frame.sorted_k(-1, [("weight", False)])
Test sortedk with a negative k value
625941c9e1aae11d1e749d42
def create_waf(self, name, WAFtype): <NEW_LINE> <INDENT> params = {'name' : name, 'type' : WAFtype} <NEW_LINE> return super().request('POST', '/wafs/new', params)
Creates a WAF with the given name and type :param name: Name for the WAF :param WAFtype: Type of WAF you are creating
625941c999cbb53fe6792c72
def test_testmoduleOnNonexistentFile(self): <NEW_LINE> <INDENT> buffy = StringIO.StringIO() <NEW_LINE> stderr, sys.stderr = sys.stderr, buffy <NEW_LINE> filename = 'test_thisbetternoteverexist.py' <NEW_LINE> try: <NEW_LINE> <INDENT> self.config.opt_testmodule(filename) <NEW_LINE> self.failUnlessEqual(0, len(self.config...
Check that --testmodule displays a meaningful error message when passed a non-existent filename.
625941c98e71fb1e9831d835
def status(): <NEW_LINE> <INDENT> changed, new, deleted = get_status() <NEW_LINE> if changed: <NEW_LINE> <INDENT> print("changed files:") <NEW_LINE> for path in changed: <NEW_LINE> <INDENT> print("\t", path) <NEW_LINE> <DEDENT> <DEDENT> if new: <NEW_LINE> <INDENT> print("new files:") <NEW_LINE> for path in new: <NEW_LI...
Show status of working copy.
625941c960cbc95b062c65ce
def list_nodes(kwargs=None, call=None): <NEW_LINE> <INDENT> if call == 'action': <NEW_LINE> <INDENT> raise SaltCloudSystemExit( 'The list_nodes function must be called ' 'with -f or --function.' ) <NEW_LINE> <DEDENT> ret = {} <NEW_LINE> vm_properties = [ "name", "guest.ipAddress", "config.guestFullName", "config.hardwa...
Return a list of all VMs and templates that are on the specified provider, with basic fields CLI Example: .. code-block:: bash salt-cloud -f list_nodes my-vmware-config To return a list of all VMs and templates present on ALL configured providers, with basic fields: CLI Example: .. code-block:: bash salt...
625941c929b78933be1e5738
def getMinimumDifference(self, root): <NEW_LINE> <INDENT> stack = [root] <NEW_LINE> queue = [] <NEW_LINE> while stack and stack[0]: <NEW_LINE> <INDENT> top = stack[-1] <NEW_LINE> if top.left: <NEW_LINE> <INDENT> stack.append(top.left) <NEW_LINE> top.left = None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> queue.append...
:type root: TreeNode :rtype: int
625941c95510c4643540f471
def gen_tasks(self): <NEW_LINE> <INDENT> kw = { "default_lang": self.site.config["DEFAULT_LANG"], "listings_folder": self.site.config["LISTINGS_FOLDER"], "output_folder": self.site.config["OUTPUT_FOLDER"], } <NEW_LINE> ignored_extensions = (".pyc",) <NEW_LINE> def render_listing(in_name, out_name): <NEW_LINE> <INDENT> ...
Render pretty code listings.
625941c9eab8aa0e5d26dbe3
def __init__(self, *args, **kwds): <NEW_LINE> <INDENT> if args or kwds: <NEW_LINE> <INDENT> super(Angular, self).__init__(*args, **kwds) <NEW_LINE> if self.roll is None: <NEW_LINE> <INDENT> self.roll = 0. <NEW_LINE> <DEDENT> if self.pitch is None: <NEW_LINE> <INDENT> self.pitch = 0. <NEW_LINE> <DEDENT> if self.yaw is N...
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: roll,pitch,yaw :param args: compl...
625941c9796e427e537b0651
def get_tokens(self): <NEW_LINE> <INDENT> for srctoken in self._parse_tokens(): <NEW_LINE> <INDENT> if(self.ignore_token(srctoken) == False): <NEW_LINE> <INDENT> yield srctoken
iteratore over the tokens
625941c9de87d2750b85fe1e
def check_year(self, year): <NEW_LINE> <INDENT> start = datetime.date(year, 1, 1) <NEW_LINE> end = datetime.date(year, 12, 31) <NEW_LINE> for instance in self.session.query(ModelCalculated). options(joinedload(ModelCalculated.services)). filter(text("target_date BETWEEN :year_start AND :ye...
Checks whether the base schedule has been calculated for this year
625941c9dc8b845886cb55c0
def test_login_required(self): <NEW_LINE> <INDENT> response = self.client.get(TAGS_URL) <NEW_LINE> self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
Test that login is required for retrieving tags.
625941c9498bea3a759b9b3a
def rand_normal(self,sd): <NEW_LINE> <INDENT> for i in range(len(self.rand)): <NEW_LINE> <INDENT> self.rand[i]=np.random.normal(self.feld[i],sd)
create a random change of the data vector using a normal distribution with the standard deviation sd
625941c9293b9510aa2c3322
def forward_encoder(self, src): <NEW_LINE> <INDENT> mask = get_mask(src,src, self.constants.PADDING_IDX, self.constants.DEVICE) <NEW_LINE> enc = self.EmbeddingSrc(src) <NEW_LINE> enc = self.Encoder(enc,mask) <NEW_LINE> return enc
Arg: src: tensor(nb_texts, nb_tokens) Output: tensor(nb_texts, nb_tokens, d_model)
625941c9d18da76e23532561
def create_alien(ai_settings, screen, aliens, alien_number, row_number): <NEW_LINE> <INDENT> alien = Alien(ai_settings, screen) <NEW_LINE> alien_width = alien.rect.width <NEW_LINE> alien.x = alien_width + 2 * alien_width * alien_number <NEW_LINE> alien.rect.x = alien.x <NEW_LINE> alien.rect.y = alien.rect.height + 2 * ...
创造一个外星人,把他放在行里
625941c9d99f1b3c44c6761b
def test_check_result(mocker: MockerFixture) -> None: <NEW_LINE> <INDENT> entry_points = [FakeEntryPoint("dummy", FakeAdapter)] <NEW_LINE> mocker.patch( "shillelagh.backends.apsw.db.iter_entry_points", return_value=entry_points, ) <NEW_LINE> connection = connect(":memory:", ["dummy"], isolation_level="IMMEDIATE") <NEW_...
Test exception raised when fetching results before query.
625941c9167d2b6e31218c21
def p_postfix(p): <NEW_LINE> <INDENT> result = p[1] <NEW_LINE> if isinstance(result, nodes.IdNode): <NEW_LINE> <INDENT> result = nodes.ReferenceNode(id=result, production=p) <NEW_LINE> <DEDENT> for s in p[2]: <NEW_LINE> <INDENT> if s[0] == '.': <NEW_LINE> <INDENT> result = nodes.DotNode(first=result, second=s[1], produ...
postfix : atom atomsuffix_list
625941c9099cdd3c635f0ce6
def _encode_key(self, key): <NEW_LINE> <INDENT> if isinstance(key, str) or isinstance(key, unicode): <NEW_LINE> <INDENT> key = key.encode(self._keyencoding) <NEW_LINE> <DEDENT> elif not isinstance(key, bytes): <NEW_LINE> <INDENT> raise TypeError("key must be bytes or str") <NEW_LINE> <DEDENT> return codecs.encode(key, ...
Encode key using *hex_codec* for constructing a cache filename. Keys are implicitly converted to :class:`bytes` if passed as :class:`str`.
625941c956b00c62f0f146e5
def getTranslationSourcePackage(self): <NEW_LINE> <INDENT> raise NotImplementedError
Return the sourcepackage or None.
625941c9377c676e91272234
def user_model(self, user, include_servers=False, include_state=False): <NEW_LINE> <INDENT> if isinstance(user, orm.User): <NEW_LINE> <INDENT> user = self.users[user.id] <NEW_LINE> <DEDENT> model = { 'kind': 'user', 'name': user.name, 'admin': user.admin, 'groups': [ g.name for g in user.groups ], 'server': user.url if...
Get the JSON model for a User object
625941c9d53ae8145f87a2fd
def mplKeyPress(self, event): <NEW_LINE> <INDENT> if event.key in self.close_keys: <NEW_LINE> <INDENT> self.Close() <NEW_LINE> <DEDENT> return
Process keyboard input in matplotlib plot window. This implements a standard close-window shortcut key.
625941c94a966d76dd55109a
def evaluate(self, ts): <NEW_LINE> <INDENT> ts = np.asarray(ts) <NEW_LINE> phases = PI2 * self.freq * ts + self.offset <NEW_LINE> ys = self.amp * np.exp(1j * phases) <NEW_LINE> return ys
Evaluates the signal at the given times. ts: float array of times returns: float wave array
625941c93c8af77a43ae382b
def business_exists(yelp_id, conn): <NEW_LINE> <INDENT> return conn.execute(Business.select().where(Business.c.yelp_id == yelp_id)) .first() is not None
Return True if the business exists.
625941c985dfad0860c3aee6
def list_roles(self, model_name, role_name_prefix): <NEW_LINE> <INDENT> LOGGER.info('Listing roles, model_name = %s,' ' role_name_prefix = %s', model_name, role_name_prefix) <NEW_LINE> model_manager = self.config.model_manager <NEW_LINE> scoped_session, data_access = model_manager.get(model_name) <NEW_LINE> with scoped...
Lists the role in the model matching the prefix. Args: model_name (str): Model to operate on. role_name_prefix (str): prefix of the role_name Returns: list: list of role_names that match the query
625941c960cbc95b062c65cf
def test_only_edit_users_can_edit(self): <NEW_LINE> <INDENT> with self.settings(SPACES_AUTH_ANY_USER_CAN_EDIT=False): <NEW_LINE> <INDENT> merge_settings() <NEW_LINE> self.client.login(username="basic", password="password") <NEW_LINE> self.failing_edit_tests() <NEW_LINE> self.client.login(username="editor", password="pa...
Only user's with edit permissions can edit documents when SPACES_AUTH_ANY_USER_CAN_EDIT is False.
625941c971ff763f4b549716
def test_empty_template_safe(self): <NEW_LINE> <INDENT> exc = InvalidInput("Message", x={'message': "too large", "value": 4}) <NEW_LINE> self.assertEquals([], [x for x in exc['y']])
Undefined vars on the exception are treated as empty vars
625941c99b70327d1c4e0e60
def example_two(): <NEW_LINE> <INDENT> rate = 0.05 <NEW_LINE> seconds = 5 <NEW_LINE> cost = rate * seconds / 60 <NEW_LINE> print(cost) <NEW_LINE> print('Rounded to: ', round(cost, 2))
>>> 0.004166666666666667 Rounded to: 0.0
625941c96e29344779a6269e
def delete_destination(self, destination_number): <NEW_LINE> <INDENT> del self._outputs[destination_number-1]
Delete one destination path from this entry. :param destination_number: The number of the index of the destination in this entry, starting at 1.
625941c9167d2b6e31218c22
def remove_readonly(func: Callable[[Path], None], path: Path, _: Any) -> None: <NEW_LINE> <INDENT> os.chmod(path, stat.S_IWRITE) <NEW_LINE> func(path)
Clear the readonly bit and reattempt the removal.
625941c95f7d997b87174b23
def close(self, cancel_pending_enqueues=False, name=None): <NEW_LINE> <INDENT> if name is None: <NEW_LINE> <INDENT> name = "%s_Close" % self._name <NEW_LINE> <DEDENT> if self._queue_ref.dtype == _dtypes.resource: <NEW_LINE> <INDENT> return gen_data_flow_ops._queue_close_v2( self._queue_ref, cancel_pending_enqueues=canc...
Closes this queue. This operation signals that no more elements will be enqueued in the given queue. Subsequent `enqueue` and `enqueue_many` operations will fail. Subsequent `dequeue` and `dequeue_many` operations will continue to succeed if sufficient elements remain in the queue. Subsequently dequeue and dequeue_man...
625941c921a7993f00bc7d7a
def call_function_get_frame(func, *args, **kwargs): <NEW_LINE> <INDENT> frame = [None] <NEW_LINE> trace = sys.gettrace() <NEW_LINE> def snatch_locals(_frame, name, arg): <NEW_LINE> <INDENT> if frame[0] is None and name == 'call': <NEW_LINE> <INDENT> frame[0] = _frame <NEW_LINE> sys.settrace(trace) <NEW_LINE> <DEDENT> r...
Calls the function *func* with the specified arguments and keyword arguments and snatches its local frame before it actually executes.
625941c930dc7b76659019f3
def main_page_cookie(self): <NEW_LINE> <INDENT> return self._cookies
Returns: dict: a cookie in form of a dict which will be used to make requests for the next page. Raises: PageError: when called on a page which is not the main page
625941c90a366e3fb873e8a5
def __init__(self, src, tgt, map_src=None, map_tgt=None, k=10, gpu_device=-1): <NEW_LINE> <INDENT> if map_src is None: <NEW_LINE> <INDENT> self.src = to_numpy( normalize(Variable(torch.Tensor(src))), gpu_device >= 0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.src = to_numpy( normalize(map_src(Variable(src))), g...
inputs: :param src (np.ndarray) : the source np.ndarray object :param tgt (np.ndarray) : the target np.ndarray object :param map_src (linear layer) : the Linear Layer for mapping the source (if applicable) :param map_tgt (linear layer) : the Linear Layer for mapping the target (if applicable) :param...
625941c9293b9510aa2c3323
@model.over("multipart_id", "^597__") <NEW_LINE> def multipart_id(self, key, value): <NEW_LINE> <INDENT> val_a = clean_val("a", value, str) <NEW_LINE> _migration = self["_migration"] <NEW_LINE> _migration["multipart_id"] = val_a.upper() <NEW_LINE> raise IgnoreKey("multipart_id")
Volume serial id.
625941c9a934411ee3751720
def find_solver(self, url): <NEW_LINE> <INDENT> raise NotImplementedError
Given a URL for a puzzle, returns the essential 'solver' URL. This is implemented in subclasses, and in instances where there is no separate 'landing page' URL for a puzzle, it may be a very transparent pass-through.
625941c91f037a2d8b94628a