code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def iqd_phasor(up, iqd, uqd, ax=0): <NEW_LINE> <INDENT> uxdq = (uqd[1]/np.sqrt(2), (uqd[0]/np.sqrt(2)-up)) <NEW_LINE> __phasor_plot(ax, up, (iqd[1]/np.sqrt(2), iqd[0]/np.sqrt(2)), uxdq)
creates a phasor plot up: internal voltage iqd: current uqd: terminal voltage
625941c9dc8b845886cb55cd
def test_topic_detail_view_invalid_slug(self): <NEW_LINE> <INDENT> utils.login(self) <NEW_LINE> category = utils.create_category() <NEW_LINE> topic = utils.create_topic(category=category) <NEW_LINE> response = self.client.get(reverse('spirit:topic:detail', kwargs={'pk': topic.pk, 'slug': 'bar'})) <NEW_LINE> self.assert...
invalid slug
625941c9379a373c97cfabdd
def load_data(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open('data.json', 'r') as f: <NEW_LINE> <INDENT> content = f.read() <NEW_LINE> return json.loads(content) <NEW_LINE> <DEDENT> <DEDENT> except: <NEW_LINE> <INDENT> return {}
Loads the data from the data.json file returns: The parsed content of the data.json file as dict
625941c92c8b7c6e89b3585a
def get_random_num_in_range(self, range_of_data: list) -> float: <NEW_LINE> <INDENT> number = random.uniform(range_of_data[0], range_of_data[1]) <NEW_LINE> return round(number, 3)
get random float number in given range, for 3 decimal places
625941c921bff66bcd6849ec
def main(): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> user = 'id' <NEW_LINE> pasw = 'pass' <NEW_LINE> data = '' <NEW_LINE> print('开始登陆bilibili') <NEW_LINE> login(user, pasw, data)
主函数
625941c999cbb53fe6792c7f
def __create_table_bruteforce2(meta): <NEW_LINE> <INDENT> logger.debug("creating table %s", table_bruteforce2.name) <NEW_LINE> table = sql.Table(table_bruteforce2.name, meta, sql.Column("id", sql.Integer, primary_key=True, autoincrement=True), sql.Column('created', sql.DateTime, default=sql.func.now()), sql.Column('ser...
Create bruteforce result table.
625941c930bbd722463cbe5e
def __init__(self, members, label=None): <NEW_LINE> <INDENT> super(SimUnion, self).__init__(label) <NEW_LINE> self.members = members
:param members: The members of the struct, as a mapping name -> type
625941c90383005118ecf67c
def test_relcal_sts2_vs_unknown(self): <NEW_LINE> <INDENT> st1 = read(os.path.join(self.path, 'ref_STS2')) <NEW_LINE> st2 = read(os.path.join(self.path, 'ref_unknown')) <NEW_LINE> calfile = os.path.join(self.path, 'STS2_simp.cal') <NEW_LINE> freq, amp, phase = relcalstack(st1, st2, calfile, 20, smooth=10, save_data=Fal...
Test relative calibration of unknown instrument vs STS2 in the same time range. Window length is set to 20 s, smoothing rate to 10.
625941c971ff763f4b549723
def save(self, modinst, nocommit=False): <NEW_LINE> <INDENT> logging.debug("saving %s", str(modinst)) <NEW_LINE> modinst.save() <NEW_LINE> logging.debug("done saving %s", str(modinst))
save an object
625941c99f2886367277a926
def verify_header(self): <NEW_LINE> <INDENT> code = int(self.c.getinfo(pycurl.RESPONSE_CODE)) <NEW_LINE> if code in BAD_STATUS_CODES: <NEW_LINE> <INDENT> response = self.decode_response(self.get_response()) if self.decode else self.get_response() <NEW_LINE> header = to_str(self.response_header, encoding="iso-8859-1") i...
raise an exceptions on bad headers.
625941c96fece00bbac2d7d7
def sock(kind='array', name='', default=None): <NEW_LINE> <INDENT> kind = socket_types.get(kind) <NEW_LINE> v = vars() <NEW_LINE> return namedtuple('Sock', v.keys())(**v)
converts a function call, with given parameters to a namedtuple All defaults and rewrites should happen in this function, to keep it out of the working code in prototyper.py
625941c9d268445f265b4f07
def frequencyOutput(letterCount): <NEW_LINE> <INDENT> for var in range(0,26): <NEW_LINE> <INDENT> print("{}: {}".format(chr(var+65), letterCount[var]))
Outputs every letter in the alpahbet and the number of times each one occured Parameter: letterCount -- this is the alphabet array that was initalized in the main
625941c93317a56b86939cf3
def lerpBackgroundColor(r, g, b, duration): <NEW_LINE> <INDENT> def lerpColor(state): <NEW_LINE> <INDENT> dt = globalClock.getDt() <NEW_LINE> state.time += dt <NEW_LINE> sf = state.time / state.duration <NEW_LINE> if sf >= 1.0: <NEW_LINE> <INDENT> base.setBackgroundColor(state.ec[0], state.ec[1], state.ec[2]) <NEW_LINE...
Function to lerp background color to a new value
625941c96aa9bd52df036e3d
def configuration_invoice_number_put(self, data, headers=None, query_params=None, content_type="application/json"): <NEW_LINE> <INDENT> if query_params is None: <NEW_LINE> <INDENT> query_params = {} <NEW_LINE> <DEDENT> uri = self.client.base_url + "/configuration/invoice-number" <NEW_LINE> return self.client.put(uri, d...
It is method for PUT /configuration/invoice-number
625941c9be8e80087fb20cdd
def isNonTrans(self, corename): <NEW_LINE> <INDENT> if not self.NonTrans is []: <NEW_LINE> <INDENT> if self.NonTrans.isitem(corename): <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> <DEDENT> return 0
Check if filename belongs to non translatable list
625941c9de87d2750b85fe2b
def parse_hash_mappings(f): <NEW_LINE> <INDENT> return json.loads(f.read())
Get a dictionary mapping old hash keys to new ones. It is a precondition that there are no duplicate old_hash entries. Args: f (file): The tutorial hash mappings file to read from. Returns: A dictionary mapping old hash keys to new ones.
625941c9462c4b4f79d1d76a
def relation(self, ex, operator): <NEW_LINE> <INDENT> raise NotImplementedError("relation")
The input to this method is a symbolic expression which corresponds to a relation. TESTS:: sage: from sage.symbolic.expression_conversions import Converter sage: import operator sage: Converter().relation(x==3, operator.eq) Traceback (most recent call last): ... NotImplementedError: relation ...
625941c96fb2d068a760f136
def systemd_status(address, sock, status, completed=False): <NEW_LINE> <INDENT> if completed: <NEW_LINE> <INDENT> message = b"READY=1" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> message = ("STATUS={0}".format(status)).encode('utf8') <NEW_LINE> <DEDENT> if not (address and sock and message): <NEW_LINE> <INDENT> retur...
Helper function to update the service status.
625941c9956e5f7376d70f07
def Query(self): <NEW_LINE> <INDENT> if self.name is not None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> sb = ScriptBuilder() <NEW_LINE> sb.EmitAppCallWithOperation(self.ScriptHash, 'name') <NEW_LINE> sb.EmitAppCallWithOperation(self.ScriptHash, 'symbol') <NEW_LINE> sb.EmitAppCallWithOperation(self.ScriptHash, 'de...
Query the smart contract for its token information (name, symbol, decimals). Args: wallet (neo.Wallets.Wallet): a wallet instance. Returns: None: if the NEP5Token instance `Name` is already set. True: if all information was retrieved. False: if information retrieval failed.
625941c9b7558d58953c4faf
def _play_wav(self, is_blocking=False, event=None, **kwargs): <NEW_LINE> <INDENT> logger.debug("Playing wavfile") <NEW_LINE> events.write(event) <NEW_LINE> self.stream.start() <NEW_LINE> if is_blocking: <NEW_LINE> <INDENT> self.wait_until_done()
Play the data that is currently in the buffer Parameters ---------- is_blocking: bool Whether or not to play the sound in blocking mode event: dict a dictionary of event information to emit just before playback
625941c98a349b6b435e820c
def to_hex(self): <NEW_LINE> <INDENT> return f"#{self.red:02x}{self.green:02x}{self.blue:02x}"
Return a 24-bit hexadecimal RGB representation of this color. The returned string is suitable for use in HTML/CSS, as a color parameter in matplotlib, and perhaps other situations. Examples -------- >>> bc = BranchColor(12, 200, 100) >>> bc.to_hex() '#0cc864'
625941c9ad47b63b2c50a019
def draw_board(self) -> None: <NEW_LINE> <INDENT> anchor = self.board_size / 2 <NEW_LINE> increments = list( anchor - i * self.grid_line_spacing for i in range(1, self.grid_size) ) <NEW_LINE> for i in increments: <NEW_LINE> <INDENT> self.draw_line(i, anchor, 270, self.board_size) <NEW_LINE> self.draw_line(anchor, i, 18...
Draws the game board centered on the point (0,0).
625941c98e71fb1e9831d843
def clean_download_cache(self, args): <NEW_LINE> <INDENT> ctx = self.ctx <NEW_LINE> if hasattr(args, 'recipes') and args.recipes: <NEW_LINE> <INDENT> for package in args.recipes: <NEW_LINE> <INDENT> remove_path = join(ctx.packages_path, package) <NEW_LINE> if exists(remove_path): <NEW_LINE> <INDENT> shutil.rmtree(remov...
Deletes a download cache for recipes passed as arguments. If no argument is passed, it'll delete *all* downloaded caches. :: p4a clean_download_cache kivy,pyjnius This does *not* delete the build caches or final distributions.
625941c992d797404e304223
def test_graphics3(): <NEW_LINE> <INDENT> from aggdraw import Draw, Pen <NEW_LINE> from PIL import Image <NEW_LINE> main = Image.new('RGB', (480, 1024), 'white') <NEW_LINE> d = Draw(main) <NEW_LINE> p = Pen((90,) * 3, 0.5)
See issue #22.
625941c9d6c5a102081440e4
def download_data(directory: str, url: str=BASE_URL, files: tuple=FILE_LIST) -> None: <NEW_LINE> <INDENT> if not os.path.exists(directory): <NEW_LINE> <INDENT> raise IOError("This path doesn't exist!") <NEW_LINE> <DEDENT> if not os.path.isdir(directory): <NEW_LINE> <INDENT> raise IOError("This is not a directory!") <NE...
Download the specified list files from the imdb database Args: directory: The directory to save the files in. Must exist url: The url to download from. Default is berlin mirror files: A tuple of filenames to download (e.g. genres, ratings, ...)
625941c9a79ad161976cc1df
def multiprocess_generate_random_mouse_ext_data(x): <NEW_LINE> <INDENT> random_geno_pheno_hash = {} <NEW_LINE> phenotypes = [] <NEW_LINE> with open('inter/ontologies/mp_hash.txt', 'rb') as handle: <NEW_LINE> <INDENT> phenotype_hash = pickle.load(handle) <NEW_LINE> <DEDENT> for i in phenotype_hash: <NEW_LINE> <INDENT> i...
This function creates random data sets for the determination of the FDR cutoff for the significant genotype/disease comparisons of the phenolog extension. It takes as input the real species-specific pheontype hash and the genotype-phenotype hash for mouse. It creates a random genotype-phenotype hash using the real geno...
625941c930bbd722463cbe5f
def GetLambda(self): <NEW_LINE> <INDENT> return _itkBinaryStatisticsOpeningImageFilterPython.itkBinaryStatisticsOpeningImageFilterIUL2IF2_GetLambda(self)
GetLambda(self) -> double
625941c9a8370b7717052939
def totalNQueens(self, n): <NEW_LINE> <INDENT> self.col = [False] * n <NEW_LINE> self.diag = [False] * (n *2) <NEW_LINE> self.anti_diag = [False] * (n*2) <NEW_LINE> self.result = 0 <NEW_LINE> self.dfs(0, n, []) <NEW_LINE> return self.result
:type n: int :rtype: int
625941c9cdde0d52a9e530cc
def monthList(): <NEW_LINE> <INDENT> if not Post.objects.count(): return [] <NEW_LINE> year, month = time.localtime()[:2] <NEW_LINE> first = Post.objects.order_by("pub_date")[0] <NEW_LINE> fyear = first.pub_date.year <NEW_LINE> fmonth = first.pub_date.month <NEW_LINE> months = [] <NEW_LINE> for y in range(year, fyear-1...
Make a list of months to show archive links.
625941c996565a6dacc8f765
def __init__(self, sql_connection, sqlite_fk=False, mysql_traditional_mode=False, autocommit=True, expire_on_commit=False, **kwargs): <NEW_LINE> <INDENT> super(EngineFacade, self).__init__() <NEW_LINE> self._engine = create_engine( sql_connection=sql_connection, sqlite_fk=sqlite_fk, mysql_traditional_mode=mysql_traditi...
Initialize engine and sessionmaker instances. :param sqlite_fk: enable foreign keys in SQLite :type sqlite_fk: bool :param mysql_traditional_mode: enable traditional mode in MySQL :type mysql_traditional_mode: bool :param autocommit: use autocommit mode for created Session instances :type autocommit: bool :param ex...
625941c9167d2b6e31218c2f
def either(left, right, monad): <NEW_LINE> <INDENT> if is_left(monad): <NEW_LINE> <INDENT> return monad.bind(left) <NEW_LINE> <DEDENT> if is_right(monad): <NEW_LINE> <INDENT> return monad.bind(right) <NEW_LINE> <DEDENT> raise ValueError("monad in either must either be left or right")
Takes a function left, a function right and a value and binds according to the value (into left if it is a Left, into right if it is a Right). Otherwise throws a ValueError. Complexity: O(1) or complexity of the given function params: left: the function that should be executed on Left right: the function that ...
625941c971ff763f4b549724
def __ne__(self, other): <NEW_LINE> <INDENT> return not (self == other)
Test for unequality EXAMPLES:: sage: from sage.doctest.util import Timer sage: Timer() == Timer() True sage: t = Timer().start() sage: loads(dumps(t)) != t False
625941c9099cdd3c635f0cf5
def __init__(self): <NEW_LINE> <INDENT> self.Resource = None <NEW_LINE> self.RequestId = None
:param Resource: Resource IP list :type Resource: list of ResourceIp :param RequestId: The unique request ID, which is returned for each request. RequestId is required for locating a problem. :type RequestId: str
625941ca85dfad0860c3aef5
def get_overlap(self, labels: Optional[Iterable[Label]] = None) -> "Timeline": <NEW_LINE> <INDENT> if labels: <NEW_LINE> <INDENT> annotation = self.subset(labels) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> annotation = self <NEW_LINE> <DEDENT> overlaps_tl = Timeline(uri=annotation.uri) <NEW_LINE> for (s1, t1), (s2, ...
Get overlapping parts of the annotation. A simple illustration: annotation A |------| |------| |----| B |--| |-----| |----------| C |--------------| |------| annotation.get_overlap() |------| |-----| |--------| annotation.get_overlap(for_labels=["A", "B"]) ...
625941ca2eb69b55b151c948
def _solve_as_rational(f, symbol, domain): <NEW_LINE> <INDENT> f = together(f, deep=True) <NEW_LINE> g, h = fraction(f) <NEW_LINE> if not h.has(symbol): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return _solve_as_poly(g, symbol, domain) <NEW_LINE> <DEDENT> except NotImplementedError: <NEW_LINE> <INDENT> return Condit...
solve rational functions
625941ca0a366e3fb873e8b3
def on_press(key): <NEW_LINE> <INDENT> global fly, controller_offset_x, controller_offset_y, controller_offset_z, controller_select <NEW_LINE> if key == keyboard.Key.esc: <NEW_LINE> <INDENT> fly = False <NEW_LINE> <DEDENT> if hasattr(key, 'char'): <NEW_LINE> <INDENT> if key.char == "a": <NEW_LINE> <INDENT> controller_o...
React to keyboard.
625941ca29b78933be1e5747
def center(self, height=None): <NEW_LINE> <INDENT> if height: <NEW_LINE> <INDENT> size = height / 3.0 / self.grid.orientation.b3 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> size = SIZE <NEW_LINE> <DEDENT> x = (self.grid.orientation.f0 * self.q + self.grid.orientation.f1 * self.r) * size <NEW_LINE> y = (self.grid.ori...
Return the coordinate "pixel" of the hex.
625941ca435de62698dfdce6
def generate_data(total_amt_of_data: int, num_of_classifications: int, data_type: DataType, arguments: typing.Dict = None) -> np.ndarray: <NEW_LINE> <INDENT> if data_type is DataType.CIRCLE: <NEW_LINE> <INDENT> return _generate_circles(total_amt_of_data, num_of_classifications) <NEW_LINE> <DEDENT> elif data_type is Dat...
Generates a list of random data of 2 dimensions that is customizable by the parameters provided. :param total_amt_of_data: The total amount of data points to generate. :param num_of_classifications: The number of classifications the data can have. :param data_type: Determines how the data is to be generated, based off...
625941caa934411ee375172e
def get_all_bonn_budget_files(fPath, pattern='PlandatenErgebnisplan', end='csv'): <NEW_LINE> <INDENT> rlt = [] <NEW_LINE> for f in os.listdir(fPath): <NEW_LINE> <INDENT> if f.startswith(pattern) and f.endswith(end): <NEW_LINE> <INDENT> rlt.append(os.path.abspath(os.path.join(fPath, f))) <NEW_LINE> <DEDENT> <DEDENT> ret...
get all Bonn budget datasets :param fPath: search path :param end: file name end with this string :return: a list of csv filenames with absolute file name
625941cafb3f5b602dac372c
def _build_layers(self, inputs, num_outputs, options): <NEW_LINE> <INDENT> hiddens = options.get("fcnet_hiddens", constants['FCNET_HIDDENS']) <NEW_LINE> activation = get_activation_fn(options.get("fcnet_activation", constants['FCNET_ACTIVATION'])) <NEW_LINE> with tf.name_scope("fc_net"): <NEW_LINE> <INDENT> i = 1 <NEW_...
Define the layers of a custom model. Arguments: input_dict (dict): Dictionary of input tensors, including "obs", "prev_action", "prev_reward". num_outputs (int): Output tensor must be of size [BATCH_SIZE, num_outputs]. options (dict): Model options.
625941ca851cf427c661a5a9
def retrieve_param(self, identifier, params): <NEW_LINE> <INDENT> identified_param = params.get(identifier) <NEW_LINE> if not identified_param: <NEW_LINE> <INDENT> raise cherrypy.HTTPError(400, 'ERROR_INCORRECT_OR_MISSING_PARAM') <NEW_LINE> <DEDENT> return identified_param
Retrieve the specified parameter.
625941cae64d504609d748da
def _conectMetadataDB( ) -> pymongo.MongoClient: <NEW_LINE> <INDENT> _usernameSchemaDB = "root" <NEW_LINE> _passwordSchemaDB = "mongopass" <NEW_LINE> logging.debug('*** Conectando [SCHEMA_DB] -> mongodb://%s:*******@%s/admin?retryWrites=true',_usernameSchemaDB,_mongoServerSchemaDB) <NEW_LINE> return pymongo.MongoClient...
Conecta e retorna a conexão com o servidor mongoDB a ser usado para gravar os Metadados dos Schemas
625941ca5fcc89381b1e1758
def test_exponential_bbvi_mini_batch(): <NEW_LINE> <INDENT> model = pf.GAS(data=exponentialdata, ar=1, sc=1, family=pf.Exponential()) <NEW_LINE> x = model.fit('BBVI',iterations=200, mini_batch=32, map_start=False) <NEW_LINE> assert(len(model.latent_variables.z_list) == 3) <NEW_LINE> lvs = np.array([i.value for i in mod...
Tests an ARIMA model estimated with BBVI and that the length of the latent variable list is correct, and that the estimated latent variables are not nan
625941caff9c53063f47c28e
def _shake_shake_layer(layer_input, output_filters, num_blocks, stride, weight_decay, tag=""): <NEW_LINE> <INDENT> for block_num in range(num_blocks): <NEW_LINE> <INDENT> curr_stride = stride if (block_num == 0) else 1 <NEW_LINE> layer_input = _shake_shake_block( layer_input, output_filters, curr_stride, weight_decay, ...
Builds many sub layers into one full layer. Args: layer_input: Keras layer. Input layer. output_filters: Defines the number of output filters of the layer. num_blocks: Defines the number of Shake-Shake blocks this layer will have. stride: Defines the stride of the Shake-Shake layer's blocks. tag: Defines the...
625941ca1f5feb6acb0c4beb
def onpageshow(self, emitter): <NEW_LINE> <INDENT> super(timeCorrelatedMeasurements, self).onload(emitter) <NEW_LINE> self.__circle1.style["fill"] = "#ff7837" <NEW_LINE> self.__circle2.style["fill"] = "#ff7837"
WebPage event that occurs on webpage loaded
625941ca8a43f66fc4b54100
def __init__(self, bootstrap_server_is=None, host=None, port=None, security_host=None, security_port=None, server_id=None, client_hold_off_time=None, server_public_key=None, bootstrap_server_account_timeout=None): <NEW_LINE> <INDENT> self._bootstrap_server_is = None <NEW_LINE> self._host = None <NEW_LINE> self._port = ...
ServerSecurityConfig - a model defined in Swagger
625941ca3617ad0b5ed67f92
def observe(self, observation, gameState): <NEW_LINE> <INDENT> noisyDistance = observation <NEW_LINE> emissionModel = busters.getObservationDistribution(noisyDistance) <NEW_LINE> pacmanPosition = gameState.getPacmanPosition() <NEW_LINE> "*** YOUR CODE HERE ***" <NEW_LINE> print(noisyDistance, emissionModel, pacmanPosit...
Updates beliefs based on the distance observation and Pacman's position. The noisyDistance is the estimated Manhattan distance to the ghost you are tracking. The emissionModel below stores the probability of the noisyDistance for any true distance you supply. That is, it stores P(noisyDistance | TrueDistance). self....
625941cad18da76e23532570
def test_get(self): <NEW_LINE> <INDENT> self.assertEqual(200, self.resp.status_code)
GET /eventos/ must return status code 200
625941ca23849d37ff7b312a
def __init__(self, env, n_frames): <NEW_LINE> <INDENT> assert env.observation_space.dtype == np.uint8 <NEW_LINE> gym.Wrapper.__init__(self, env) <NEW_LINE> self.n_frames = n_frames <NEW_LINE> self.frames = deque([], maxlen=n_frames) <NEW_LINE> shp = env.observation_space.shape <NEW_LINE> self.observation_space = spaces...
Stack n_frames last frames. Returns lazy array, which is much more memory efficient. See Also -------- stable_baselines.common.atari_wrappers.LazyFrames :param env: (Gym Environment) the environment :param n_frames: (int) the number of frames to stack
625941ca31939e2706e4cf06
def __eq__(self, other: 'ObjectListResult') -> bool: <NEW_LINE> <INDENT> if not isinstance(other, self.__class__): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Return `true` when self and other are equal, false otherwise.
625941ca5fcc89381b1e1759
def queue_flush(): <NEW_LINE> <INDENT> global QUEUES <NEW_LINE> if QUEUES: <NEW_LINE> <INDENT> from rest_search.tasks import patch_index <NEW_LINE> args = {} <NEW_LINE> for doc_type, pks in QUEUES.items(): <NEW_LINE> <INDENT> args[doc_type] = list(pks) <NEW_LINE> <DEDENT> patch_index.delay(args) <NEW_LINE> QUEUES.clear...
Triggers a celery task for the queued updates, if any.
625941ca92d797404e304224
def split_family(infile): <NEW_LINE> <INDENT> family = defaultdict(list) <NEW_LINE> for seq in SeqIO.parse(infile, 'fasta'): <NEW_LINE> <INDENT> fam = seq.id.split('.')[-1] <NEW_LINE> family[fam].append(seq) <NEW_LINE> <DEDENT> for fam in family: <NEW_LINE> <INDENT> SeqIO.write(family[fam], '%s.tmp' % fam, 'fasta')
Writes sequences in a family into a new file.
625941caa8ecb033257d3168
def countDigitOne(self, n): <NEW_LINE> <INDENT> if n <= 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> elif n<10: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> nums = map(lambda x:int(x[1])*pow(10,x[0]),enumerate(list(str(n))[::-1]))[::-1] <NEW_LINE> nums = [0]+map(lambda x:sum(nums[:x...
:type n: int :rtype: int
625941ca8c0ade5d55d3ea55
def accept_string(self, string, pprint=False): <NEW_LINE> <INDENT> self.string = string + '_' <NEW_LINE> self.initialize() <NEW_LINE> if pprint: <NEW_LINE> <INDENT> print(tm) <NEW_LINE> <DEDENT> while tm.current_state not in tm.final_states: <NEW_LINE> <INDENT> symbol_read = self.string[self.pointer_input] <NEW_LINE> f...
analize the string :param string: strign that consist of alphabet :return: boolean
625941ca45492302aab5e35d
def thread_appliance_queue_processing(self): <NEW_LINE> <INDENT> debug_messenger("APPLIANCE QUEUE WORKER STARTED") <NEW_LINE> num_threads = 2 <NEW_LINE> for i in range(num_threads): <NEW_LINE> <INDENT> worker = Thread(target=self.process_appliance_queue) <NEW_LINE> worker.setDaemon(True) <NEW_LINE> try: <NEW_LINE> <IND...
Begins the Thread for processing the outgoing Appliance Readings :return:
625941caf9cc0f698b140697
def destroy(self): <NEW_LINE> <INDENT> if self.pq[0] == ffi.NULL: <NEW_LINE> <INDENT> raise ShareException('destroy', ShareError.text[lib.SH_ERR_ARG]) <NEW_LINE> <DEDENT> status = lib.shr_q_destroy(self.pq) <NEW_LINE> if status: <NEW_LINE> <INDENT> raise ShareException(ShareError.text[status]) <NEW_LINE> <DEDENT> if se...
destroy queue
625941cafff4ab517eb2f4d7
def a_star_planning(sx, sy, gx, gy, ox, oy, reso, rr): <NEW_LINE> <INDENT> nstart = Node(round(sx / reso), round(sy / reso), 0.0, -1) <NEW_LINE> ngoal = Node(round(gx / reso), round(gy / reso), 0.0, -1) <NEW_LINE> ox = [iox / reso for iox in ox] <NEW_LINE> oy = [ioy / reso for ioy in oy] <NEW_LINE> obmap, minx, miny, m...
gx: goal x position [m] gx: goal x position [m] ox: x position list of Obstacles [m] oy: y position list of Obstacles [m] reso: grid resolution [m] rr: robot radius[m]
625941ca6e29344779a626ad
def tearDown(self): <NEW_LINE> <INDENT> if os.path.exists(self.temp_path): <NEW_LINE> <INDENT> shutil.rmtree(self.temp_path)
Remove the temporary test data
625941cacc0a2c11143dcf2b
def update(self, parent_rect, delta): <NEW_LINE> <INDENT> if parent_rect != self.parent_rect or self.is_dirty(): <NEW_LINE> <INDENT> self.resize_to_parent(parent_rect) <NEW_LINE> self.parent_rect = parent_rect <NEW_LINE> self.resize() <NEW_LINE> <DEDENT> for child in self.children: <NEW_LINE> <INDENT> child.update(self...
Updates the UI component and its children.
625941ca3317a56b86939cf4
def stop(self): <NEW_LINE> <INDENT> return _gnuradio_core_gengen.gr_vector_insert_b_sptr_stop(self)
stop(self) -> bool
625941ca0c0af96317bb8283
def _execute_post(self, url, data=None, headers=None, json_data=None): <NEW_LINE> <INDENT> return requests.post( url=url, data=json_data, )
Execute post request to achieve the ICC external enrollment.
625941ca4f88993c3716c102
def get_rhyme_str(self, rhyme_tuple): <NEW_LINE> <INDENT> ret = '' <NEW_LINE> rl, wpos1, wpos2 = rhyme_tuple <NEW_LINE> if wpos1 is None or wpos2 is None: <NEW_LINE> <INDENT> return '' <NEW_LINE> <DEDENT> p2 = self.vow_idxs[self.word_ends[wpos2]] <NEW_LINE> p2_orig = p2 <NEW_LINE> while not ph.is_space(self.text[p2]): ...
Construct a string of a given rhyme tuple.
625941ca5166f23b2e1a51f4
def set_header(self, header, value): <NEW_LINE> <INDENT> if self.__headers is not None: <NEW_LINE> <INDENT> self.__headers[header] = value <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.__headers = {header: value}
Set a given header header: header name (string) value: header value (usually, string)
625941caa17c0f6771cbe0eb
def handle_update(self): <NEW_LINE> <INDENT> self.message = self.root.ids.user_input.text
Handle changes to the text input by updating the model from the view.
625941cabe7bc26dc91cd69c
def object_attributes_to_str(self): <NEW_LINE> <INDENT> obj_columns = "" <NEW_LINE> for attribute in self.__dict__.keys(): <NEW_LINE> <INDENT> if type(self.__dict__[attribute]) is not list: <NEW_LINE> <INDENT> obj_columns += attribute + "," <NEW_LINE> <DEDENT> <DEDENT> return obj_columns[:-1:]
returns a string containing all the attributes class
625941ca24f1403a92600c02
@login_required(login_url=settings.LOGIN_URL) <NEW_LINE> @cache_control(no_cache=True, must_revalidate=True, no_store=True) <NEW_LINE> @access_admin_only <NEW_LINE> @require_http_methods(['POST']) <NEW_LINE> def edit_area(request): <NEW_LINE> <INDENT> area = uApi.get_area(request.POST.get('area')) <NEW_LINE> form = Are...
Update the name of area
625941ca4d74a7450ccd425f
def tab_aware(location, code): <NEW_LINE> <INDENT> return ''.join(' ' if c != '\t' else '\t' for c in code[:location])
if tabs in beginning of code, add tabs for them, otherwise spaces
625941ca97e22403b379d034
def login(self, user, password): <NEW_LINE> <INDENT> uri = self.build_uri('api/dataset/user/login') <NEW_LINE> data = { 'username': user, 'password': password } <NEW_LINE> login = self.post(uri, data=data) <NEW_LINE> if login.status_code == 200: <NEW_LINE> <INDENT> login = login.json() <NEW_LINE> self.cookies = { login...
Authenticates against the dkan site. This method should not be called from user code. It authenticates against the DKAN site in two steps. 1) it posts the user and password to api/dataset/user/login and retrieves a cookie 2) it sets the acquired cookie and posts against services/sessions/token to retrieve a token that...
625941ca21bff66bcd6849ef
def normalize(self): <NEW_LINE> <INDENT> norm = self.probability(*self.domain) <NEW_LINE> if norm != 1: <NEW_LINE> <INDENT> w = Dummy('w', real=True) <NEW_LINE> return self.__class__(self.pdf(w)/norm, (w, self.domain[0], self.domain[1])) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self
Normalize the probability distribution function so that integrate(self.pdf(x), (x, a, b)) == 1 Example usage: >>> from sympy import Symbol, exp, oo >>> from sympy.statistics.distributions import PDF >>> from sympy.abc import x >>> a = Symbol('a', positive=True) >>> exponential = PDF(exp(-x/a), (x...
625941cab545ff76a8913eb1
def has_live_view(view): <NEW_LINE> <INDENT> return view.id() in LIVE_VIEWS
Returns bool value to indicate if the view has associated LiveView.
625941ca66656f66f7cbc245
def arrangeCoins(self, n): <NEW_LINE> <INDENT> level = 1 <NEW_LINE> while n >= level: <NEW_LINE> <INDENT> n -= level <NEW_LINE> level += 1 <NEW_LINE> <DEDENT> return level - 1
:type n: int :rtype: int
625941cae1aae11d1e749d51
def test_accept_email_invite(self, client): <NEW_LINE> <INDENT> profile = factories.ProfileFactory.create(school_staff=True) <NEW_LINE> response = client.get(self.url(client, profile)) <NEW_LINE> form = response.forms['set-password-form'] <NEW_LINE> new_password = 'sekrit123' <NEW_LINE> form['new_password1'] = new_pass...
Accepting email invite sets is_active True.
625941ca55399d3f0558874f
def add_validation_leaf_error_to_result(self, valres, scan_db): <NEW_LINE> <INDENT> err = self.get_validation_leaf_error(valres) <NEW_LINE> if err is None or not isinstance(err, ValidationOsslException): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> scan_db.err_valid_ossl_code = err.error_code <NEW_LINE> scan_db.err_v...
Adds leaf validation error produced by OSSL certificate validator to the scan results :param valres: :type valres: ValidationResult :param scan_db: :type scan_db: DbHandshakeScanJob :return:
625941ca50812a4eaa59c3bd
def record_transfer(self, transfer_type: "string", _amount: "float", _balance: "float"): <NEW_LINE> <INDENT> transfer = dict() <NEW_LINE> transfer['transfer_type'] = transfer_type <NEW_LINE> transfer['amount'] = _amount <NEW_LINE> transfer['balance'] = _balance <NEW_LINE> transfer['timestamp'] = "11/12/2020" <NEW_LINE>...
Records a transfer as a deposit or withdrawal and final balance. Args: transfer_type (string): Type of transfer "Deposit" or "Withdrawal" _amount (float): The amount of the transaction in dollars _balance (float): A dict with the details of the transaction including a timestamp Returns: (dict): The de...
625941ca460517430c394221
def newline(self): <NEW_LINE> <INDENT> self.cursor.add_line(1) <NEW_LINE> self._send(constants.CURSOR_LINEFEED) <NEW_LINE> return self.cursor
Moves the cursor to the next line. If the cursor is already in the second line, the line scrolls up.
625941cabe8e80087fb20cde
def get_content_values(self, content, out, df=pd.DataFrame(), opposite=False): <NEW_LINE> <INDENT> if df.empty: <NEW_LINE> <INDENT> df = self.data <NEW_LINE> <DEDENT> if out not in ['Count','Duration']: <NEW_LINE> <INDENT> raise SipperError('method get_content_values() can only ' + 'use out = "Count" or out = "Duration...
Get the drink count or duration for an assigned content, rather than the left or right bottle. Parameters ---------- content : str content name out : str ("Count" or "Duration") Specify drink count or drink duration. df : pandas.DataFrame, optional DataFrame to compute content for. By default, this will be...
625941ca50485f2cf553ce35
def __cmp__(self, other): <NEW_LINE> <INDENT> if self is other: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> if not isinstance(other, PermutationGroup_generic): <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> c = PermutationGroup_generic.__cmp__(self, other) <NEW_LINE> if c: <NEW_LINE> <INDENT> return c <NEW_LINE...
Compare ``self`` and ``other``. First, ``self`` and ``other`` are compared as permutation groups, see :method:`PermutationGroup_generic.__cmp__`. Second, if both are equal, the ambient groups are compared, where (if necessary) ``other`` is considered a subgroup of itself. EXAMPLES:: sage: G=SymmetricGroup(6) ...
625941ca67a9b606de4a7f55
def _start_position(self, seg, direction): <NEW_LINE> <INDENT> start = seg.x0 if self.axis=='x' else seg.y0 <NEW_LINE> start = start if direction=='+' else start - (seg.metadata.traces * self.step) <NEW_LINE> x0 = self.distance_datum <NEW_LINE> distance = round(start - x0, 6) <NEW_LINE> traces = round(distance / self.s...
Set the start position of a segment.
625941ca627d3e7fe0d68eea
def copy_variable_to_graph(org_instance, to_graph, scope=''): <NEW_LINE> <INDENT> if not isinstance(org_instance, Variable): <NEW_LINE> <INDENT> raise TypeError(str(org_instance) + ' is not a Variable') <NEW_LINE> <DEDENT> if scope != '': <NEW_LINE> <INDENT> new_name = (scope + '/' + org_instance.name[:org_instance.nam...
Given a `Variable` instance from one `Graph`, initializes and returns a copy of it from another `Graph`, under the specified scope (default `""`). Args: org_instance: A `Variable` from some `Graph`. to_graph: The `Graph` to copy the `Variable` to. scope: A scope for the new `Variable` (default `""`). Returns: ...
625941cabaa26c4b54cb11bb
def _count_covertypes_within_window(self, lct, cover_type_list, footprint): <NEW_LINE> <INDENT> m = zeros(shape=lct.shape, dtype=int32) <NEW_LINE> for cover_type in cover_type_list: <NEW_LINE> <INDENT> m += maximum_filter(equal(lct, cover_type), footprint=footprint) <NEW_LINE> <DEDENT> return m
Return integer array indicating the number of different covertypes of interest that are within the moving window (footprint)
625941cab830903b967e99a7
def _format_eval_result(value: list, show_stdv: bool = True) -> str: <NEW_LINE> <INDENT> if len(value) == 4: <NEW_LINE> <INDENT> return f"{value[0]}'s {value[1]}: {value[2]:g}" <NEW_LINE> <DEDENT> elif len(value) == 5: <NEW_LINE> <INDENT> if show_stdv: <NEW_LINE> <INDENT> return f"{value[0]}'s {value[1]}: {value[2]:g} ...
Format metric string.
625941cad486a94d0b98e1e0
def __init__(self, executable_path="chromedriver", port=0): <NEW_LINE> <INDENT> self.service = Service(executable_path, port=port) <NEW_LINE> self.service.start() <NEW_LINE> RemoteWebDriver.__init__(self, command_executor=self.service.service_url, desired_capabilities=DesiredCapabilities.CHROME)
Creates a new instance of the chrome driver. Starts the service and then creates Attributes: executable_path : path to the executable. If the default is used it assumes the executable is in the $PATH port : port you would like the service to run, if left as 0, a free port will be found
625941cab7558d58953c4fb1
def _update_ueb_model_pkg_run_job_id(self, ueb_model_pkg_dataset_id, run_job_id): <NEW_LINE> <INDENT> data_dict = {'package_run_job_id': run_job_id} <NEW_LINE> update_msg = 'system auto updated model package dataset' <NEW_LINE> background_task = False <NEW_LINE> updated_package = None <NEW_LINE> try: <NEW_LINE> <INDENT...
Updates a ueb model package dataset's package_run_job_id custom field ueb_model_pkg_dataset_id: id of the model package dataset to be updated param run_job_id: ueb run job id returned from app server responsible for running ueb @rtype: updated model package dataset dictionary if successful otherwise None
625941ca7b25080760e394f5
def add_new_album(): <NEW_LINE> <INDENT> if user_choice == '1': <NEW_LINE> <INDENT> add_artist = str(input('Artist: ')) <NEW_LINE> add_album = str(input('Album: ')) <NEW_LINE> add_year = str(input('Year: ')) <NEW_LINE> add_genre = str(input('Genre: ')) <NEW_LINE> add_length = str(input('Length: ')) <NEW_LINE> new_album...
Dodanie nowego albumu do pliku csv
625941caec188e330fd5a83b
def new_flash_cache_drives(self, system_id, **kwargs): <NEW_LINE> <INDENT> all_params = ['system_id', 'body'] <NEW_LINE> all_params.append('callback') <NEW_LINE> params = locals() <NEW_LINE> for key, val in iteritems(params['kwargs']): <NEW_LINE> <INDENT> if key not in all_params: <NEW_LINE> <INDENT> raise TypeError( "...
Add drives to an existing FlashCache Mode: Both Embedded and Proxy. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> threa...
625941ca627d3e7fe0d68eeb
def want_dnssec(self, wanted=True): <NEW_LINE> <INDENT> if wanted: <NEW_LINE> <INDENT> self.ednsflags |= thirdparty.dns.flags.DO <NEW_LINE> <DEDENT> elif self.opt: <NEW_LINE> <INDENT> self.ednsflags &= ~thirdparty.dns.flags.DO
Enable or disable 'DNSSEC desired' flag in thirdparty.requests. *wanted*, a ``bool``. If ``True``, then DNSSEC data is desired in the response, EDNS is enabled if required, and then the DO bit is set. If ``False``, the DO bit is cleared if EDNS is enabled.
625941ca460517430c394222
def camera(src): <NEW_LINE> <INDENT> return bool(Is.object(src) and src.type in {'CAMERA'})
src is a camera object
625941ca66673b3332b9212c
def _provider_keys(provider_name, provider): <NEW_LINE> <INDENT> if _jwt_keys.get(provider_name, None) is None: <NEW_LINE> <INDENT> _jwt_keys[provider_name] = _get_keys(provider['keys']) <NEW_LINE> <DEDENT> return _jwt_keys[provider_name]
Returns the signing keys of the provider
625941ca07f4c71912b1151d
def bitwiseComplement(self, N: int) -> int: <NEW_LINE> <INDENT> pass
:type N: int :rtype: int
625941ca8e71fb1e9831d845
def get_leading_ws(s): <NEW_LINE> <INDENT> i = 0 ; n = len(s) <NEW_LINE> while i < n and s[i] in (' ','\t'): <NEW_LINE> <INDENT> i += 1 <NEW_LINE> <DEDENT> return s[0:i]
Returns the leading whitespace of 's'.
625941cad6c5a102081440e6
def __str__(self) -> str: <NEW_LINE> <INDENT> return json.dumps(self.to_dict(), indent=2)
Return a `str` version of this DialogNodeOutputOptionsElementValue object.
625941ca009cb60464c6344d
@C.typemap <NEW_LINE> def gaussian_mdn_coeff(x, nmix: int, ndim: int): <NEW_LINE> <INDENT> if len(x.shape) != 1: <NEW_LINE> <INDENT> raise ValueError("Must be a 1d tensor, but input has shape {0}".format(x.shape)) <NEW_LINE> <DEDENT> alpha = C.softmax(C.slice(x, 0, 0, nmix), name='alpha') <NEW_LINE> sigma = C.exp(C.sli...
Extracts the coefficients for gaussian mixture density network. Assumes independence between gaussian dimensions. Example: ndim, nmix = 1, 3 a = C.input_variable(ndim) prediction = Dense((ndim + 2) * nmix)(a) coeffs = C.combine(gaussian_mdn_coeff(prediction_tensor, nmix=nmix, ndim=ndim)).eval({a: x}) ...
625941ca293b9510aa2c3332
def twoSum(self, nums, target): <NEW_LINE> <INDENT> dic = {} <NEW_LINE> for i in range(0, len(nums)): <NEW_LINE> <INDENT> dic[nums[i]] = i <NEW_LINE> <DEDENT> print(dic) <NEW_LINE> for j in range(0, len(nums)): <NEW_LINE> <INDENT> pair = target - nums[j] <NEW_LINE> if((dic.get(pair,"DNE") != "DNE") and (j != dic[pair])...
:type nums: List[int] :type target: int :rtype: List[int]
625941ca097d151d1a222ef5
def __call__(self, p0, T0): <NEW_LINE> <INDENT> ln_p0, ln_T0 = np.log([p0, T0]) <NEW_LINE> p_air = np.logspace(np.log10(p0), np.log10(self.ptop), 101) <NEW_LINE> ln_p_air = np.log(p_air) <NEW_LINE> ln_T = odeint(self.slope, ln_T0, ln_p_air, full_output=True) <NEW_LINE> T = np.exp(ln_T[0].ravel()) <NEW_LINE> p_c = self....
Call to the resulting function
625941ca004d5f362079a3cf
def get_auto_login_user_data(self, items: list = ['*']): <NEW_LINE> <INDENT> result = self.get_data( table='users', items=items, condition='auto_login=1' ) <NEW_LINE> return result
Gets the data of the users who specified the auto login
625941ca30c21e258bdfa538
def __init__(self, results=None): <NEW_LINE> <INDENT> self._results = None <NEW_LINE> self.discriminator = None <NEW_LINE> if results is not None: <NEW_LINE> <INDENT> self.results = results
IpamsvcListAddressResponse - a model defined in Swagger
625941caadb09d7d5db6c82b
def is_contradiction(t): <NEW_LINE> <INDENT> return bool(tn.norm(t) <= 1e-6)
Checks if a formula is never satisfied. :param t: a :math:`2^N` tensor :return: True if `t` is a contradiction; False otherwise
625941ca63d6d428bbe4458b
def _init_ownership(self, initial_owners): <NEW_LINE> <INDENT> list(initial_owners)[0].purchase_home(purchasers=initial_owners, home=self)
Set the initial owners of this dwelling place.
625941ca94891a1f4081bb44
def load_model_specs(fname_yaml_conf): <NEW_LINE> <INDENT> with open(fname_yaml_conf, 'rb') as yaml_file: <NEW_LINE> <INDENT> model_specs = yaml.load(yaml_file) <NEW_LINE> metrics = model_specs.pop('metrics') <NEW_LINE> <DEDENT> params_list = list(product(*model_specs.values())) <NEW_LINE> model_spec_list = [] <NEW_LIN...
Loads yaml file and converts it into list of model specification dicts
625941ca4a966d76dd5510aa
def check_item(self, item_worker, item_redis, cont_type, deal=None, picture=None, text=None): <NEW_LINE> <INDENT> self.check_item_redis(item_redis, cont_type, deal, picture, text) <NEW_LINE> self.check_item_worker(item_worker, cont_type, deal, picture, text)
Проверяем элементы с заданными данными, данными от воркера и данными из redis. :param item_worker: данные элемента от воркера :param item_redis: данные элемента из redis :param cont_type: тип контентаб type(string) :param deal: информация по сделке :param picture: информация о изображении сообщения :param text: информ...
625941ca3c8af77a43ae383b