code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def modify_project_settings(self, result: argparse.Namespace, project_settings: dict) -> dict: <NEW_LINE> <INDENT> project_settings['klass'] = PHPWebsiteProject <NEW_LINE> return project_settings
Return the modified project settings if match with subcommand. Parameters ---------- result : ~argparse.Namespace object returns when called ``parser.parse_args()`` project_settings : dict dictionnary contains all the project settings to generate the correct project Returns ------- project_settings : dict ...
625941d432920d7e50b283d1
def myr2sec(time): <NEW_LINE> <INDENT> return yr2sec(time) * 1.0e6
Converts time from million years to seconds.
625941d415baa723493c4176
def __getitem__(self, key): <NEW_LINE> <INDENT> if type(key) is not int: <NEW_LINE> <INDENT> key = self.listName()[key] <NEW_LINE> <DEDENT> return ForemanObjects.__getitem__(self, key)
Function __getitem__ Get an hostgroup @param key: The hostgroup name or ID @return RETURN: The ItemHostsGroup object of an host
625941d48e05c05ec3eea576
def knnCluster(train, num_clusters=5, columns=None, verbose=0): <NEW_LINE> <INDENT> if columns is None: <NEW_LINE> <INDENT> columns = ['Valence_Mean', 'Arousal_Mean'] <NEW_LINE> <DEDENT> print('columns:%s' % columns) <NEW_LINE> print('-' * 40) <NEW_LINE> filter_xy = train[columns].values <NEW_LINE> random_seed = 1 <NEW...
Kmeans 聚类 :param train: 训练集 :param num_clusters: 聚类个数 :param columns: 指定使用哪一列聚类 :param verbose: 0,1,2 :return:
625941d4baa26c4b54cb131e
def read_process(file_name): <NEW_LINE> <INDENT> processos = [] <NEW_LINE> for i in open(file_name, 'r').read().splitlines(): <NEW_LINE> <INDENT> aux = i.split() <NEW_LINE> pross = [int(aux[0]), int(aux[1]), int(aux[2]), int(aux[3]), []] <NEW_LINE> if len(aux) > 4: <NEW_LINE> <INDENT> pross[4] = [int(i) for i in aux[4:...
Read a file with fake process descriptions. Each line represents (id, d, p, a, ios) where: id: identifier (unique) d: CPU usage phase duration p: priority a: arrived time ios: IO event queue
625941d4a79ad161976cc345
def setNameLevel(self, newNameLevel): <NEW_LINE> <INDENT> self.nameLevel = newNameLevel
This method modifies the current name of the corresponding Level by a new one provided. Keyword arguments: newNameLevel -- This is a new string value that will replace the current Name of the corresponding Level(i.e. "Really Hard").
625941d4f8510a7c17cf98fc
def deepnn(x_images): <NEW_LINE> <INDENT> keep_prob = tf.placeholder(tf.float32) <NEW_LINE> x_images = standarization(x_images) <NEW_LINE> x_images = tf.cond(keep_prob < 1.0, lambda: image_processing(x_images), lambda: x_images) <NEW_LINE> with tf.name_scope('fc1'): <NEW_LINE> <INDENT> h_fc1 = tf.contrib.layers.fully_c...
deepnn builds the graph for a deep net for classifying digits. Args: x: an input tensor with the dimensions (N_examples, 784), where 784 is the number of pixels in a standard MNIST image. Returns: A tuple (y, keep_prob). y is a tensor of shape (N_examples, 10), with values equal to the logits of classifying the...
625941d463f4b57ef0001315
def __init__(self, name, supported_mode_groups, fixed_parameters, gamma_location): <NEW_LINE> <INDENT> if gamma_location not in ('arm', 'base', None): <NEW_LINE> <INDENT> raise RuntimeError( "Gamma must be on either 'arm' or 'base' or None") <NEW_LINE> <DEDENT> self.name = name <NEW_LINE> self.supported_mode_groups = s...
Set geometry name (String), list of supported mode groups (list of strings), list of axis names (list of strings). Define the parameters e.g. alpha and gamma for a four circle (dictionary). Define wether the gamma angle is on the 'arm' or the 'base'; used only by AngleCalculator to interpret the gamma parameter in fixe...
625941d4d268445f265b506e
def _identify_layer(self, layer_item): <NEW_LINE> <INDENT> if isinstance(layer_item, NeuronNetworkLayer): <NEW_LINE> <INDENT> return [(index, layer_item) for index, _ in self.layers.items() if _ == layer_item][0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return (layer_item, self.layers[layer_item])
Receives either a layer index, or a layer and returns layer_index,layer
625941d473bcbd0ca4b2c276
@pytest.fixture(scope="session") <NEW_LINE> def ponydb(request): <NEW_LINE> <INDENT> db_path = request.config.getini("PONY_DB") <NEW_LINE> db = importlib.import_module(db_path).db <NEW_LINE> return db
return db : test Database instance
625941d42ae34c7f2600d331
def _parse_extra(self, content): <NEW_LINE> <INDENT> if not content: <NEW_LINE> <INDENT> return content <NEW_LINE> <DEDENT> lines = [] <NEW_LINE> while content: <NEW_LINE> <INDENT> line = content.pop(0) <NEW_LINE> parts = _multispace_regex.split(line.strip()) <NEW_LINE> if len(parts) < 2: <NEW_LINE> <INDENT> lines.appe...
Parse a generic section of text and look for TLisp extras e.g. space separated tables
625941d407f4c71912b11684
def _run(self, **kwargs): <NEW_LINE> <INDENT> pass
This function ... :param kwargs: :return:
625941d4627d3e7fe0d69051
def parse_all(self): <NEW_LINE> <INDENT> while self.current_line < len(self.input_lines): <NEW_LINE> <INDENT> self.parse_line() <NEW_LINE> self.current_line += 1
Parse all lines
625941d43617ad0b5ed680f6
def msg_body(imap_client): <NEW_LINE> <INDENT> raw = raw_msgs(imap_client) <NEW_LINE> for UID in raw: <NEW_LINE> <INDENT> message = pyzmail.PyzMessage.factory(raw[UID][b'BODY[]']) <NEW_LINE> sender = message.get_address("from") <NEW_LINE> if len(sender) > 1: <NEW_LINE> <INDENT> sender = sender[1] <NEW_LINE> <DEDENT> el...
Processes raw message bodies into HTML. Returns the sender and the HTML body.
625941d44d74a7450ccd43c4
def test_get_amount_and_total_back_from_api(self): <NEW_LINE> <INDENT> client = TestClient() <NEW_LINE> now = datetime.datetime.now(pytz.utc) <NEW_LINE> self.make_participant("test_tippee1", claimed_time=now) <NEW_LINE> self.make_participant("test_tippee2", claimed_time=now) <NEW_LINE> self.make_participant("test_tippe...
Test that we get correct amounts and totals back on POSTs to tip.json
625941d4d99f1b3c44c6778c
def test_post_to_edit_review(self): <NEW_LINE> <INDENT> user = User.objects.create_user(username='username', email='myemail@test.com', password='password') <NEW_LINE> self.client.login(username='username', password='password') <NEW_LINE> item = Product(name="Product", available_stock="100", content="product content", p...
test post to edit review
625941d48c0ade5d55d3ebbc
def get_eos(self, eos_index): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> eos = self._eos_cache[eos_index] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> fname = self._eos_files[eos_index] <NEW_LINE> eos = LambdaFromTOVFile(mass_param=self._mass_param, lambda_param=self._lambda_param...
Gets the EOS for the given index. If the index is not in range returns None.
625941d40383005118ecf7e2
def test_create_player_form(self): <NEW_LINE> <INDENT> deckr.views.game_runner.add_player.return_value = 1 <NEW_LINE> form_data = {'nickname': "Player 1"} <NEW_LINE> response = self.client.post(reverse('deckr.game_room_staging_area', args=(self.game_room.pk,)), form_data) <NEW_LINE> player = list(Player.objects.all())[...
Check form validations and player creation
625941d450812a4eaa59c521
def add_endpoint_method(url, method, args, arg_defaults, func_desc): <NEW_LINE> <INDENT> tab = len(args) < 3 and ', ' or (',\n' + ' ' * (32 + len(method))) <NEW_LINE> tab2 = tab + ' ' <NEW_LINE> method = method.lower() <NEW_LINE> ret = '\n def %s(%s' % (method, 'self') <NEW_LINE> if url == 'pnp/game/board':...
This will add the get, put, post, delete function for the endpoint method :param url: str of the url of the endpoint :param method: str of get, put, post, or delete :param args: list of str of arg :param arg_defaults: dict of arg default values :param func_desc: str of the function description...
625941d467a9b606de4a80b9
def move_computer_first( self, message: Dict[str, str], bot_handler: Any, last_fen: str ) -> None: <NEW_LINE> <INDENT> last_board = self.validate_board(message, bot_handler, last_fen) <NEW_LINE> computer_move = calculate_computer_move( last_board, self.engine ) <NEW_LINE> new_board_after_computer_move = copy.copy(last_...
Preforms a move for the computer without having the user go first in a game with the computer. Replies to the bot handler. Like `move_computer`, but doesn't have the user move first. This is usually only useful at the beginning of a game. Parameters: - message: The Zulip Bots message object. - bot_handler: T...
625941d47d43ff24873a2ea1
def number_of_factors(number: int) -> int: <NEW_LINE> <INDENT> return len(factors(number))
Returns the number of factors of a number. The factors of a number are all numbers that divide it evenly, including itself. This is equivilent to len(factors(number)). Args: number (int): The number to compute the number of factors for. Returns: int: The number of factors. Raises: TypeError: number is ...
625941d4498bea3a759b9caf
def SendBuy(operationId, price, amount, cost): <NEW_LINE> <INDENT> global __tradeOperations <NEW_LINE> for x in range(2): <NEW_LINE> <INDENT> orderSended = False <NEW_LINE> try: <NEW_LINE> <INDENT> orderData = __DEBUG_ConstructTradeResult() <NEW_LINE> status = orderData['status'] <NEW_LINE> orderId = orderData['data'] ...
直接在主线程中下买单,最多尝试2次 买入下单 operationId: 操作Id price: 买入价格 amount: 买入数量 cost: 买入总花费
625941d4d58c6744b4257e5f
def FFMPEG_get_Length_Video(input_video_absolute_path): <NEW_LINE> <INDENT> cmd = 'ffprobe -i "{}" -show_entries format=duration -v quiet -of csv="p=0"'.format(input_video_absolute_path) <NEW_LINE> output = subprocess.check_output( cmd, shell=True, stderr=subprocess.STDOUT ) <NEW_LINE> return float(output)
Execute a FFMPEG in Windows console and gets video duration Parameters ---------- arg1 : input_video_absolute_path absolute path to video source Returns ------- duration of video specified in absolute path 'input_video_absolute_path'
625941d4009cb60464c635b1
def p_map_type(p): <NEW_LINE> <INDENT> if p[3] == 'bytes': <NEW_LINE> <INDENT> raise ProtoGrammarError( 'grammar error at line {}: key type cannot be bytes'.format(p.lineno)) <NEW_LINE> <DEDENT> p[0] = (FieldType.MAP, p[1], p[3], p[5])
map_type : MAP '<' base_type ',' base_type '>' | MAP '<' base_type ',' ref_type '>'
625941d463b5f9789fde72e6
def test07b_noauto(self): <NEW_LINE> <INDENT> if common.verbose: <NEW_LINE> <INDENT> print('\n', '-=' * 30) <NEW_LINE> print("Running %s.test07b_noauto..." % self.__class__.__name__) <NEW_LINE> <DEDENT> table = self.table <NEW_LINE> table.flush_rows_to_index() <NEW_LINE> res = [row.nrow for row in table.where('(var2 ==...
Checking indexing queries (modify in iterator, no-auto mode)
625941d4adb09d7d5db6c98f
def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.train_iterations = 0 <NEW_LINE> self.train_exp_counter = 0 <NEW_LINE> self.train_exp_epochs = 0 <NEW_LINE> self.train_exp_iterations = 0 <NEW_LINE> self.train_epoch_iterations = 0 <NEW_LINE> self.total_iterations = 0
Init.
625941d431939e2706e4d069
def costGuard(self, cost, character): <NEW_LINE> <INDENT> for (resourceType, amount) in cost.items(): <NEW_LINE> <INDENT> availableAmount = self.resources.get(resourceType) <NEW_LINE> if availableAmount is None: <NEW_LINE> <INDENT> character.addMessage("need resource %s" % (resourceType,)) <NEW_LINE> return False <NEW_...
check and remove required ressources Parameters: cost: the ressources needed character: the character tyig to do something
625941d43539df3088e2e54b
def interface(): <NEW_LINE> <INDENT> window = Tk() <NEW_LINE> Button(window, text="START", command=startTime).grid(row=0) <NEW_LINE> Button(window, text="STOP", command=stopTime).grid(row=0, column=1) <NEW_LINE> Button(window, text="Bereken calorieën", command=window.destroy).grid(row=1) <NEW_LINE> window.mainloop()
This function is used to call the interface for the weightlifting
625941d4cb5e8a47e48b7ca9
def getFibonacciIterative(n: int) -> int: <NEW_LINE> <INDENT> a = 0 <NEW_LINE> b = 1 <NEW_LINE> for i in range(n): <NEW_LINE> <INDENT> a, b = b, a + b <NEW_LINE> <DEDENT> return a
Calculate the fibonacci number at position n iteratively
625941d4cc0a2c11143dd091
def default_data(): <NEW_LINE> <INDENT> set_vec = [0.000_1, 0, 0] <NEW_LINE> run_prog(set_vec)
creates/resets default data
625941d4435de62698dfde4d
def main(): <NEW_LINE> <INDENT> search(graph, costs, parents) <NEW_LINE> print("Path: ", " -> ".join(path(parents)))
Search shortest path from start to end.
625941d43346ee7daa2b2f6d
def security_boards(q="", lang="ru", start=0): <NEW_LINE> <INDENT> name = "boards" <NEW_LINE> url = "https://iss.moex.com/iss/securities/{0}.json?lang={1}&start={2}" <NEW_LINE> df = request_df(url.format(q, lang, start), name) <NEW_LINE> return df
/iss/securities/[security] - https://iss.moex.com/iss/reference/13 (boards)
625941d407d97122c4178a8f
def get_target_config(self, ctx, configuration): <NEW_LINE> <INDENT> tgt = deepcopy(TARGET_MAP[self.target]) <NEW_LINE> defaults = deepcopy(_CONFIGS_OPTIONS['default']) <NEW_LINE> eclipse_config = deepcopy(defaults['generic']) <NEW_LINE> if configuration in defaults: <NEW_LINE> <INDENT> eclipse_config.update(defaults[c...
Retrieve info from cdt_definitions.json
625941d4435de62698dfde4e
def mkdir_recursive(dirname): <NEW_LINE> <INDENT> parent = os.path.dirname(dirname) <NEW_LINE> if parent != "": <NEW_LINE> <INDENT> if not os.path.exists(parent): <NEW_LINE> <INDENT> mkdir_recursive(parent) <NEW_LINE> <DEDENT> if not os.path.exists(dirname): <NEW_LINE> <INDENT> os.mkdir(dirname) <NEW_LINE> <DEDENT> <DE...
makes all the directories along a given path, if they do not exist
625941d456b00c62f0f1485b
def flush(self): <NEW_LINE> <INDENT> self._check_open() <NEW_LINE> self._node_manager.flush_nodes() <NEW_LINE> self._flush_file(0)
Flush all the alive leaves in the object tree.
625941d4e5267d203edcde9c
def ci(python="python", codecov="codecov", coverage_file="coverage.xml"): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> from pip._internal import main <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> from pip import main <NEW_LINE> <DEDENT> main(["install"] + DEPENDENCIES + REQUIREMENTS + ["-U"]) <NEW_LINE> d...
Run the most common CI tasks
625941d4be383301e01b5685
def test_unicode(self): <NEW_LINE> <INDENT> t = SimpleTemplate('start {{var}} end').render(var=u'äöü') <NEW_LINE> self.assertEqual(u'start äöü end', ''.join(t))
Templates: Unicode variables
625941d499fddb7c1c9de592
def docker_container_create(ssh, image_name, container_name, container_port, container_username, container_password): <NEW_LINE> <INDENT> ssh.runcmd( f'sh /tmp/docker/mk_container.sh ' f'-i {image_name} ' f'-c {container_name} ' f'-o {container_port} ' f'-u {container_username} ' f'-p {container_password}' ) <NEW_LINE>...
Create docker container. :param ssh: ssh access to docker server :param image_name: docker image name :param container_name: docker container name :param container_port: docker container port :param container_username: docker container username :param container_password: docker container password
625941d424f1403a92600d66
def test_toValueUncertainty(self): <NEW_LINE> <INDENT> v = value.ValueUncertainty(math.pi, 0.00456) <NEW_LINE> self.assertEqual(v.value, 3.142, 'Values do not match %s' % v.label) <NEW_LINE> self.assertEqual(v.uncertainty, 0.005, 'Uncertainties do not match %s' % v.label) <NEW_LINE> v = value.ValueUncertainty(100.0*mat...
test_toValueUncertainty doc...
625941d4b57a9660fec33a87
def start_new_block(self, i, lines, new_state, prev_state, stack): <NEW_LINE> <INDENT> trace = False and g.unitTesting <NEW_LINE> trace_stack = False <NEW_LINE> line = lines[i] <NEW_LINE> target = stack[-1] <NEW_LINE> h = self.gen_ref(line, target.p, target) <NEW_LINE> if self.headline: h = self.headline <NEW_LINE> if ...
Create a child node and update the stack.
625941d4283ffb24f3c55b01
def _heartbeat(self): <NEW_LINE> <INDENT> if self.__initialized: <NEW_LINE> <INDENT> self._updateLogs() <NEW_LINE> super(BaseClanDungeonChannelManager, self)._heartbeat()
Update logs in heartbeat
625941d48e7ae83300e4b1ce
def _delete(delete_url, database=False): <NEW_LINE> <INDENT> params = {} <NEW_LINE> if not database: <NEW_LINE> <INDENT> last_rev = _get(delete_url)['_rev'] <NEW_LINE> params = {'rev': last_rev} <NEW_LINE> <DEDENT> return _parse_json(_unsafe_io_with_server(requests.delete, [200,204], delete_url, params=params))
Deletes the object on delete_url. If you're deleting a database, specify the database parameter to True
625941d4187af65679ca5320
def plusOne(self, digits): <NEW_LINE> <INDENT> num = reduce(lambda x, y: x * 10 + y, digits) + 1 <NEW_LINE> return [int(i) for i in str(num)]
:type digits: List[int] :rtype: List[int]
625941d46fb2d068a760f2a0
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, CreatePhoneNumberParams): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941d426068e7796caeee3
def resources_corpus_export_get(self, corpus_id, **kwargs): <NEW_LINE> <INDENT> if corpus_id is None: <NEW_LINE> <INDENT> raise ValueError("Missing the required parameter `corpus_id` when calling `resources_corpus_export_get`") <NEW_LINE> <DEDENT> all_params = ['corpus_id', 'format', 'callback'] <NEW_LINE> params = loc...
Export corpus Download a corpus in an expected format. :param str corpus_id: Corpus identifier (required) :param str format: The expected corpus format :param str callback: Javascript callback function name for JSONP Support :return: File
625941d4fff4ab517eb2f63e
def run(self) -> None: <NEW_LINE> <INDENT> self.clean_text() <NEW_LINE> self.logger.info(f'Cleaned text | {self.text}')
Executes text cleaning process.
625941d466673b3332b92293
def testNoTrailingWhitespace(self): <NEW_LINE> <INDENT> self._testReject('DIST foo \n') <NEW_LINE> self._testReject('# Comment \n') <NEW_LINE> self._testReject(' \n')
Reject manifests w/lines w/trailing spaces.
625941d46fece00bbac2d942
def list_filenames(): <NEW_LINE> <INDENT> filenames = [name.split(".")[0] for name in os.listdir(".") if name.endswith(".txt")] <NEW_LINE> return filenames
Open the working directory. Store the names of all text files in a list. Do not store '.txt'.
625941d47d847024c06be4bf
def ObjectLink(self, link_id=0): <NEW_LINE> <INDENT> with self.link._lock: <NEW_LINE> <INDENT> self.link._check_connection() <NEW_LINE> command = 'G_LinkObjId' <NEW_LINE> self.link._send_line(command) <NEW_LINE> self.link._send_item(self) <NEW_LINE> self.link._send_int(link_id) <NEW_LINE> item = self.link._rec_item() <...
Returns an item pointer (:class:`.Item`) to a robot link. This is useful to show/hide certain robot links or alter their geometry. :param int link_id: link index (0 for the robot base, 1 for the first link, ...)
625941d4b57a9660fec33a88
def _normalize_headers(self, headers): <NEW_LINE> <INDENT> return headers
Do not normalize headers since roxy is just a proxy.
625941d491af0d3eaac9bc1c
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, DraftProspectAmateurTeam): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941d4cad5886f8bd271da
def onclick(self, event): <NEW_LINE> <INDENT> if event.xdata is None or event.ydata is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if str(event.key) == 'alt+z' or str(event.key) == 'z': <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if event.key is not None: <NEW_LINE> <INDENT> self.coordinates.append([]) <NEW...
Append onclick event
625941d4090684286d50eee8
def do_cv(self, line): <NEW_LINE> <INDENT> self.do_clockvar(line)
read clock variables
625941d466656f66f7cbc3ad
def create_multicast_listener_socket(self): <NEW_LINE> <INDENT> mcast = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) <NEW_LINE> mcast.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) <NEW_LINE> mreq = struct.pack('4sl', inet_aton(mcast_addr[0]), INADDR_ANY) <NEW_LINE> mcast.setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP, mreq) <NEW_LINE>...
Copy paste function creating a multicast UDP socket Receives multicast messages :return: the multicast socket
625941d4a219f33f34628b69
def test_normalize_xmlrpc_address_missing_protocol(self): <NEW_LINE> <INDENT> input_val = 'google.com:1234' <NEW_LINE> expected_val = 'http://google.com:1234' <NEW_LINE> actual_val = normalize_xmlrpc_address(input_val, 1471) <NEW_LINE> self.assertEqual(expected_val, actual_val)
Test that normalize_xmlrpc_address() correctly normalizes when given an input without the protocol
625941d4fbf16365ca6f63c7
def expand_type(typ: Type, env: Mapping[TypeVarId, Type]) -> Type: <NEW_LINE> <INDENT> return typ.accept(ExpandTypeVisitor(env))
Substitute any type variable references in a type given by a type environment.
625941d44e696a04525c964d
def QuickCreateEncoderLayerSizes(nocols, ratio=0.57, depth=5): <NEW_LINE> <INDENT> out=[nocols] <NEW_LINE> for i in range(depth-1): <NEW_LINE> <INDENT> out.append(round(out[i]*ratio)) <NEW_LINE> <DEDENT> return out
If a layer size isnt specified this creates a simple one where the previous layer is multiplied by the ratio
625941d4f548e778e58cd780
def test_fail_get_tag_with_at_sign(self): <NEW_LINE> <INDENT> parser = common.get_romaine_parser() <NEW_LINE> result = parser.simple.get_tag(' @tag@ten') <NEW_LINE> self.assertIsNone(result)
Confirm that we get no tag when tag contains @.
625941d4091ae3566866715d
def delete_dataset_content(datasetName=None, versionId=None): <NEW_LINE> <INDENT> pass
Deletes the content of the specified data set. See also: AWS API Documentation Exceptions :example: response = client.delete_dataset_content( datasetName='string', versionId='string' ) :type datasetName: string :param datasetName: [REQUIRED] The name of th...
625941d4baa26c4b54cb131f
def test_timer_repr(): <NEW_LINE> <INDENT> t = Timer() <NEW_LINE> assert t.__repr__() == "<Timer 'no name'>"
Test for Timer class.
625941d4009cb60464c635b2
def change_priority(arr, item_index): <NEW_LINE> <INDENT> arr[item_index] = -arr[item_index]
Method to change priority of the item, all items are > 0, so this operation changes item value to negative
625941d4851cf427c661a70f
def get_tree_size(path): <NEW_LINE> <INDENT> total = 0 <NEW_LINE> for entry in scandir(path): <NEW_LINE> <INDENT> if not ('.DS_Store' in entry.path or 'lost+found' in entry.path): <NEW_LINE> <INDENT> if entry.is_dir(follow_symlinks=False): <NEW_LINE> <INDENT> total += get_tree_size(entry.path) <NEW_LINE> <DEDENT> else:...
Return total size of files in given path and subdirs.
625941d4004d5f362079a534
def allowsMove(self, r, c): <NEW_LINE> <INDENT> loseMove = False <NEW_LINE> if r == self.height - 1 and c == 0: <NEW_LINE> <INDENT> loseMove = True <NEW_LINE> <DEDENT> if c in range(self.width) and r in range(self.height) and not self.off[r][c] and not loseMove: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else:...
Return: True if the calling object allows a move into column and row c. False if c is not a legal column/ row or if it has already been Chomped, or it is the losing square. Arguments: c a column number, r a row number
625941d4656771135c3eba72
def minFlipsMonoIncr(self, S): <NEW_LINE> <INDENT> m, n = 0, 0 <NEW_LINE> for s in S: <NEW_LINE> <INDENT> m += int(s) <NEW_LINE> n = min(m, n + 1 - int(s)) <NEW_LINE> <DEDENT> return n
:type S: str :rtype: int
625941d48e05c05ec3eea578
def read(self, output_tile, **kwargs): <NEW_LINE> <INDENT> import geobuf <NEW_LINE> path = self.get_path(output_tile) <NEW_LINE> try: <NEW_LINE> <INDENT> with fs_from_path(path).open(path, "rb") as src: <NEW_LINE> <INDENT> return geobuf.decode(src.read()).get("features", []) <NEW_LINE> <DEDENT> <DEDENT> except FileNotF...
Read existing process output. Parameters ---------- output_tile : ``BufferedTile`` must be member of output ``TilePyramid`` Returns ------- process output : list
625941d48e7ae83300e4b1cf
def read_timedhosts(): <NEW_LINE> <INDENT> global timedhosts <NEW_LINE> try: <NEW_LINE> <INDENT> hostfile = file(hostfilepath) <NEW_LINE> for line in hostfile.readlines(): <NEW_LINE> <INDENT> host, time = line.split() <NEW_LINE> timedhosts[host] = float(time) <NEW_LINE> <DEDENT> hostfile.close() <NEW_LINE> <DEDENT> exc...
This function reads the time and hostname from the plugin's cache file and store them in C{timedhosts}. There are no parameteres for this function. It uses global variables to communicate with other functions. This function is referred by: - L{postreposetup_hook()} @param timedhosts : A list of time intervals to...
625941d47d847024c06be4c0
def getImplementationDirectory(repositoryPath): <NEW_LINE> <INDENT> return uniIo.joinPath(repositoryPath, ImpConstants.modellingPackageName, ImpConstants.implementationPackageName)
Get implementation directory from the repositoryPath
625941d4cad5886f8bd271db
def post(self): <NEW_LINE> <INDENT> move = self.request.get('text') <NEW_LINE> play_rock_paper_scissors(move, self)
Receives a POST request
625941d44c3428357757c529
def getStrValue(self, constName): <NEW_LINE> <INDENT> if constName in self.data: <NEW_LINE> <INDENT> return self.data[constName].strVal <NEW_LINE> <DEDENT> return ""
:rtype: str
625941d4baa26c4b54cb1320
def _to_eul_ang(self,type,units='deg'): <NEW_LINE> <INDENT> C = self.DCM <NEW_LINE> if type == 321: <NEW_LINE> <INDENT> ang1 = np.arctan2(C[0,1],C[0,0]) <NEW_LINE> ang2 = -np.arcsin(C[0,2]) <NEW_LINE> ang3 = np.arctan2(C[1,2],C[2,2]) <NEW_LINE> <DEDENT> elif type == 313: <NEW_LINE> <INDENT> ang1 = np.arctan2(C[2,0],-C[...
Conversion to Euler Angles. There's no easy way to do this, so it's always just done from the DCM. Which is fine, it's still quick. Arguments: type: (int) currently must be 321 or 313 since those are common. Will expand units: (str) optional, units to output the angles
625941d4f8510a7c17cf98fe
def build_intendedfor(sid, ses, bids_suffix): <NEW_LINE> <INDENT> bids_name = os.path.basename(bids_suffix) <NEW_LINE> bids_type = os.path.dirname(bids_suffix) <NEW_LINE> if bids_type == '': <NEW_LINE> <INDENT> bids_type = 'func' <NEW_LINE> <DEDENT> if ses: <NEW_LINE> <INDENT> ifstr = os.path.join('ses-' + ses, bids_ty...
Build the IntendedFor entry for a fieldmap sidecar :param: sid, str, Subject ID :param: ses, str, Session number :param: bids_suffix :return: ifstr, str
625941d4b830903b967e9b0c
def sleep(sec): <NEW_LINE> <INDENT> pass
Hold an execution for given time sec - time in seconds (as float) to wait
625941d463d6d428bbe446f1
def existing_url(module): <NEW_LINE> <INDENT> url_base = "/axapi/v3/sctp/global" <NEW_LINE> f_dict = {} <NEW_LINE> return url_base.format(**f_dict)
Return the URL for an existing resource
625941d4be8e80087fb20e43
def stop_site(name): <NEW_LINE> <INDENT> sites = list_sites() <NEW_LINE> if name not in sites: <NEW_LINE> <INDENT> _LOG.warning('Site not exist!') <NEW_LINE> return False <NEW_LINE> <DEDENT> pscmd = [] <NEW_LINE> pscmd.append(r"Stop-WebSite '{0}'".format(name)) <NEW_LINE> command = ''.join(pscmd) <NEW_LINE> return _srv...
Stop IIS WebSite CLI Example: .. code-block:: bash salt '*' xjoker_win_iis.stop_site name='MyTestPool'
625941d416aa5153ce362679
def __getitem__(self, index): <NEW_LINE> <INDENT> if self.__len__() == 0: <NEW_LINE> <INDENT> raise (RuntimeError( "List qidxs is empty. Run ``dataset.create_epoch_tuples(net)`` method to create subset for train/val!")) <NEW_LINE> <DEDENT> output=self.loader(self.images[index]) <NEW_LINE> if self.imsize is not None: <N...
Args: index (int): Index Returns: images tuple (q,p,n1,...,nN): Loaded train/val tuple at index of self.qidxs
625941d456ac1b37e62643cf
def test_edit_poll_view(self): <NEW_LINE> <INDENT> p = Poll.objects.get(id=1) <NEW_LINE> response = self.client.get(reverse('molnet-polls-edit-poll', kwargs={'slug': p.slug})) <NEW_LINE> self.failUnlessEqual(response.status_code, 200)
Make sure the edit poll view renders when logged in as the user who created the poll.
625941d4236d856c2ad449dd
def test_retrieve_tags(self): <NEW_LINE> <INDENT> Tag.objects.create(user=self.user, name='Vegan') <NEW_LINE> Tag.objects.create(user=self.user, name='Dessert') <NEW_LINE> res = self.client.get(TAGS_URL) <NEW_LINE> tags = Tag.objects.all().order_by('-name') <NEW_LINE> serializer = TagSerializer(tags, many=True) <NEW_LI...
Test retrieve tags
625941d4187af65679ca5321
def find_animal_by_name(self, name: str) -> None: <NEW_LINE> <INDENT> for animal in self.animals: <NEW_LINE> <INDENT> if name in animal.name: <NEW_LINE> <INDENT> return animal <NEW_LINE> <DEDENT> <DEDENT> return None
Söker efter djur baserat på djurets namn
625941d4e1aae11d1e749eba
def _add_doptprm_object(self, doptprm, comment=''): <NEW_LINE> <INDENT> self.doptprm = doptprm
adds a DOPTPRM
625941d430bbd722463cbfc9
def get_custom_objects(): <NEW_LINE> <INDENT> custom_objects = get_encoder_custom_objects() <NEW_LINE> custom_objects['PositionEmbedding'] = PositionEmbedding <NEW_LINE> custom_objects['TokenEmbedding'] = TokenEmbedding <NEW_LINE> custom_objects['EmbeddingSimilarity'] = EmbeddingSimilarity <NEW_LINE> custom_objects['Ta...
Get all custom objects for loading saved models.
625941d44e4d5625662d45d8
def test_polygon_split_2(self): <NEW_LINE> <INDENT> poly = Polygon(self.s1ver) <NEW_LINE> polys = poly.split(Point(0.0, 0.5), math.pi) <NEW_LINE> self.assertEqual(2, len(polys))
Second test of the split method
625941d41f5feb6acb0c4d50
def convolutionLorentzBatch2(image, filt, gamma, s=1): <NEW_LINE> <INDENT> (n_f, n_c_f, f, _) = filt.shape <NEW_LINE> batch_size, n_c, in_dim, _ = image.shape <NEW_LINE> out_dim = int((in_dim - f)/s)+1 <NEW_LINE> assert n_c == n_c_f, "Dimensions of filter must match dimensions of input image" <NEW_LINE> out = np.zeros(...
Confolves `filt` over `image` using stride `s`
625941d45e10d32532c5f129
def _quantifier(self, regex): <NEW_LINE> <INDENT> lower_bound = self._int() <NEW_LINE> repeated = [regex] * lower_bound <NEW_LINE> if self._peek() != '}': <NEW_LINE> <INDENT> self._eat(',') <NEW_LINE> if self._peek() == '}': <NEW_LINE> <INDENT> repeated.append(adt.ZeroOrMore(regex)) <NEW_LINE> <DEDENT> else: <NEW_LINE>...
<quantifier> ::= <int> [ ',' [ <int> ] ]
625941d43617ad0b5ed680f8
def get_commit_symkey_name(commit): <NEW_LINE> <INDENT> cmd = 'git rev-parse %s^{tree}' % commit <NEW_LINE> stat, output = get_status_text_output(cmd) <NEW_LINE> if not stat: raise ShellCmdErrorException(cmd) <NEW_LINE> tree = output[0] <NEW_LINE> return symkey_tag_prefix + tree
Return the tag name of the key of a cipher commit
625941d424f1403a92600d67
def mixed_mixed_fidelity(rho, sigma): <NEW_LINE> <INDENT> x = np.matrix(sqrtm(rho)) <NEW_LINE> return np.trace(sqrtm(x * sigma * x)).real ** 2
Quantum state fidelity between mixed states as defined by paul kwiat
625941d4a934411ee3751896
def _handle_stderr(self, buf, eof, error): <NEW_LINE> <INDENT> buf = _decode(buf) <NEW_LINE> if logger.getEffectiveLevel() <= IODEBUG: <NEW_LINE> <INDENT> _debugio_handler.read(self, STDERR, buf, eof, error) <NEW_LINE> <DEDENT> if self.default_stderr_handler: <NEW_LINE> <INDENT> self.stderr += buf <NEW_LINE> <DEDENT> i...
Handle stderr activity. :param buf: available stream output :param eof: True if end of file on stream :param error: True if error on stream
625941d482261d6c526ab6a3
def ijk2idx(coords): <NEW_LINE> <INDENT> P = Params.instance <NEW_LINE> idx = 0 <NEW_LINE> for d in range(len(P.dims_size)): <NEW_LINE> <INDENT> idx = idx*P.dims_size[d] + coords[d] <NEW_LINE> <DEDENT> return idx
Given the spatial coordinates of a point (i,j,k) and given the size of the domain (Nx, Ny, Nz), return a single scalar value representative of the point.
625941d430dc7b7665901b67
def setup(i): <NEW_LINE> <INDENT> import os <NEW_LINE> ck=i['ck_kernel'] <NEW_LINE> s='' <NEW_LINE> iv=i.get('interactive','') <NEW_LINE> cus=i.get('customize',{}) <NEW_LINE> fp=cus.get('full_path','') <NEW_LINE> hosd=i['host_os_dict'] <NEW_LINE> tosd=i['target_os_dict'] <NEW_LINE> winh=hosd.get('windows_base','') <NEW...
Input: { cfg - meta of this soft entry self_cfg - meta of module soft ck_kernel - import CK kernel module (to reuse functions) host_os_uoa - host OS UOA host_os_uid - host OS UID host_os_dict - host OS meta ...
625941d4d8ef3951e3243740
def get_list_base_url(self, coll_id, type_id, list_id): <NEW_LINE> <INDENT> if list_id is None: <NEW_LINE> <INDENT> if type_id is None: <NEW_LINE> <INDENT> list_url = self.view_uri( "AnnalistEntityDefaultListAll", coll_id=coll_id ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> list_url = self.view_uri( "AnnalistEntityD...
Return base URL for specified list, which is one of: .../coll_id/d/ .../coll_id/d/type_id/ .../coll_id/l/list_id/ .../coll_id/l/list_id/type_id/
625941d44c3428357757c52a
def vmrayAnalysisDetails(details, analysis_id): <NEW_LINE> <INDENT> if details: <NEW_LINE> <INDENT> r = {'results': []} <NEW_LINE> types = ["text"] <NEW_LINE> comment = "" <NEW_LINE> if "execution_successful" in details: <NEW_LINE> <INDENT> values = "Analysis %s : execution_successful : %s " % (analysis_id, str(details...
General information about the analysis information
625941d47b180e01f3dc49fd
def setDevelProject(apiurl, prj, pac, dprj, dpkg=None): <NEW_LINE> <INDENT> path = (quote_plus(prj),) + (quote_plus(pac),) <NEW_LINE> data = meta_exists(metatype='pkg', path_args=path, template_args=None, create_new=False) <NEW_LINE> if data and show_project_meta(apiurl, dprj) != None: <NEW_LINE> <INDENT> root = ET.fro...
set the <devel project="..."> element to package metadata
625941d4d99f1b3c44c6778e
def permPalidrome(string): <NEW_LINE> <INDENT> newString = [i for i in string.lower() if i.isalnum() == True] <NEW_LINE> countLetters = Counter(newString) <NEW_LINE> odd = False <NEW_LINE> if len(countLetters) == 1: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> for i in countLetters: <NEW_LINE> <INDENT> if countL...
Given a string, write a function to check if it is a permutation of a palin- drome. A palindrome is a word or phrase that is the same forwards and backwards. A permutation is a rea rrangement of letters. The palindrome does not need to be limited to just dictionary words. Cracking the coding interview 1.4 pg. 91 par...
625941d423849d37ff7b3291
def create_training_tensors(self, batch): <NEW_LINE> <INDENT> labels = [row[self.column] for row in batch] <NEW_LINE> return torch.tensor(self.labels.lookup_all(labels), dtype=torch.long)
Numberize labels.
625941d4cb5e8a47e48b7caa
def preload_packs(self, preload=False): <NEW_LINE> <INDENT> loader = self.preload if preload else self._reload_pack <NEW_LINE> map(loader, self._pkeys)
Produce `frame`, `slide` data pack
625941d467a9b606de4a80bb
def jump(self, jump=None): <NEW_LINE> <INDENT> if jump is not None: <NEW_LINE> <INDENT> self.__header[1] = pack('<h', jump) <NEW_LINE> <DEDENT> return unpack('<h', self.__header[1])[0]
Sets and returns the relative block to jump to. 'jump' should be between -32768 and 32767 inclusive, however it is recommended that you do not use 0 otherwise it may cause an infinite loop. A negative value means jump backwards, whilst a positive value means forwards. If 'jump' is 'None' the current value is returned...
625941d450812a4eaa59c523
def complete(self): <NEW_LINE> <INDENT> for each in self.nodes(): <NEW_LINE> <INDENT> for other in self.nodes(): <NEW_LINE> <INDENT> if each != other and not self.has_edge((each, other)): <NEW_LINE> <INDENT> self.add_edge((each, other))
Make the graph a complete graph.
625941d48a349b6b435e8376
def expire(self, name, sec): <NEW_LINE> <INDENT> return self.rds.expire(name, sec)
设置 `key` 为 name 的字段过期时间为 sec 秒 sec 可以为 Python 的 timedelta 对象
625941d463f4b57ef0001318
def __init__(self, url=None, db_name=None): <NEW_LINE> <INDENT> if url is None: <NEW_LINE> <INDENT> url = 'mongodb://localhost:27017' <NEW_LINE> <DEDENT> if db_name is None: <NEW_LINE> <INDENT> db_name = 'TEST_DB' <NEW_LINE> <DEDENT> super(MongoExtractor, self).__init__(url) <NEW_LINE> self.db = self[db_name]
Connect to the database. Parameters ---------- url : str (default: mongodb://localhost:27017) db_name : str (default: TEST_DB)
625941d4009cb60464c635b3
def _plot_ngrams_df_heatmap(processed_ngrams_df, heatmap_width=800, heatmap_height=300): <NEW_LINE> <INDENT> processed_ngrams_df = processed_ngrams_df.dropna(how='any') <NEW_LINE> selector = alt.selection_multi(fields=['pattern']) <NEW_LINE> patterns_bar = create_bar_chart('pattern', 'count(pattern)', 'pattern', proces...
Plot a heatmap for crim-intervals getNgram's processed output. :param ngrams_df: processed crim-intervals getNgram's output. :param selected_pattern: list of specific patterns the users want (optional) :param voices: list of specific voices the users want (optional) :param heatmap_width: the width of the final heatmap ...
625941d45166f23b2e1a535b
def test_ap_bss_load_fail(dev, apdev): <NEW_LINE> <INDENT> hapd = hostapd.add_ap(apdev[0], {"ssid": "open", "bss_load_update_period": "1"}) <NEW_LINE> with fail_test(hapd, 1, "wpa_driver_nl80211_get_survey"): <NEW_LINE> <INDENT> wait_fail_trigger(hapd, "GET_FAIL")
BSS Load update failing to get survey data
625941d47047854f462a160a