code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def setText(self): <NEW_LINE> <INDENT> w.OpenClipboard() <NEW_LINE> w.EmptyClipboard() <NEW_LINE> w.SetClipboardData(win32con.CF_UNICODETEXT,self.msg) <NEW_LINE> w.CloseClipboard()
设置剪贴板文本
625941f4627d3e7fe0d69472
def walk_tree(args, queue): <NEW_LINE> <INDENT> for root, folders, files in os.walk(args.source_folder, True): <NEW_LINE> <INDENT> rel_path = os.path.relpath(root, args.source_folder) <NEW_LINE> if rel_path == '.': <NEW_LINE> <INDENT> rel_path = "" <NEW_LINE> <DEDENT> for f in files: <NEW_LINE> <INDENT> if any((fnmatch...
Walk the source tree and look for files to process
625941f471ff763f4b549cb7
def v2_playbook_on_stats(self, stats): <NEW_LINE> <INDENT> hosts = sorted(stats.processed.keys()) <NEW_LINE> summary = {} <NEW_LINE> for h in hosts: <NEW_LINE> <INDENT> s = stats.summarize(h) <NEW_LINE> summary[h] = s <NEW_LINE> <DEDENT> output = { 'plays': self.results, 'stats': summary, } <NEW_LINE> try: <NEW_LINE> <...
Display info about playbook statistics
625941f467a9b606de4a84d6
def read_current(self): <NEW_LINE> <INDENT> current = libminerhal.ffi.new("float *") <NEW_LINE> ret = libminerhal.lib.pv3012_read_current(byref(self._pol), current) <NEW_LINE> self._assert_ret(ret) <NEW_LINE> return current[0]
Read output current. Returns: float: Output current (Amperes) Raises: PV3012IOError: if an input/output error occurs
625941f44f6381625f11505a
def test_log_delete(self): <NEW_LINE> <INDENT> field_id = self.datefield.id <NEW_LINE> field_name = self.datefield.name <NEW_LINE> log_count_init = LoggerHistory.objects.count() <NEW_LINE> self.datefield.delete() <NEW_LINE> log = LoggerHistory.objects.last() <NEW_LINE> log_count = LoggerHistory.objects.count() <NEW_LIN...
Test when date field gets deleted.
625941f49c8ee82313fbbd97
def __init__(self, parent): <NEW_LINE> <INDENT> Gtk.Bin.__init__(self) <NEW_LINE> MtpSync.__init__(self) <NEW_LINE> self.__parent = parent <NEW_LINE> self.__stop = False <NEW_LINE> self._uri = None <NEW_LINE> builder = Gtk.Builder() <NEW_LINE> builder.add_from_resource("/org/gnome/Lollypop/DeviceManagerWidget.ui") <NEW...
Init widget @param device as Device @param parent as Gtk.Widget
625941f4cc40096d61595f6d
def mercedes(word): <NEW_LINE> <INDENT> if word in ['mercedes-benz', 'mercedesb', 'mecedes']: <NEW_LINE> <INDENT> word = 'mercedes' <NEW_LINE> <DEDENT> return word
Corregir tots els mercedes
625941f44d74a7450ccd47e5
def insertsort(self, array : list) -> list: <NEW_LINE> <INDENT> A = array <NEW_LINE> n = len(A) <NEW_LINE> for j in range(1, n): <NEW_LINE> <INDENT> key = A[j] <NEW_LINE> i = j - 1 <NEW_LINE> while(i >= 0 and A[i] > key): <NEW_LINE> <INDENT> A[i + 1] = A[i] <NEW_LINE> i = i - 1 <NEW_LINE> <DEDENT> A[i + 1] = key <NEW_L...
Summary === 插入排序的升序排列,时间复杂度`O(n^2)` Parameter === `array` : a list like Return === `sortedarray` : 排序好的数组 Example === ```python >>> import sort >>> array = [1, 3, 5, 2, 4, 6] >>> sort.insertsort(array) >>> [1, 2, 3, 4, 5, 6] ```
625941f4566aa707497f4b7f
def test_slavenotrunningerror(self): <NEW_LINE> <INDENT> self.assertTrue(errors.SlaveNotRunningError())
Function: test_slavenotrunningerror Description: Test with no arguments. Arguments:
625941f4925a0f43d254a49d
def test_csvdb_first_rapl_missing(self, hwpc_csvdb): <NEW_LINE> <INDENT> hwpc_csvdb.add_files(FIRST_RAPL_MISSING) <NEW_LINE> hwpc_csvdb.connect() <NEW_LINE> group_name = [path.split('/')[-1][:-4] for path in FIRST_RAPL_MISSING] <NEW_LINE> csvdb_iter = hwpc_csvdb.iter(False) <NEW_LINE> for i in range(2): <NEW_LINE> <IND...
Create two reports, one without rapl, second is full, then return None
625941f463b5f9789fde7706
def pc_output_buffers_full_avg(self, *args): <NEW_LINE> <INDENT> return _spacegrant_swig.G3RUH_descramble_sptr_pc_output_buffers_full_avg(self, *args)
pc_output_buffers_full_avg(G3RUH_descramble_sptr self, int which) -> float pc_output_buffers_full_avg(G3RUH_descramble_sptr self) -> pmt_vector_float
625941f4435de62698dfe26d
def p_optalias_as(t): <NEW_LINE> <INDENT> t[0] = t[2] <NEW_LINE> repGrammar.append(t.slice)
optAlias : R_AS idOrString
625941f47b180e01f3dc4e0f
def swap(array, index_one, index_two): <NEW_LINE> <INDENT> temp = array[index_one] <NEW_LINE> array[index_one] = array[index_two] <NEW_LINE> array[index_two] = temp
Swap to indexes in a given array.
625941f4bf627c535bc137f0
def remove(self): <NEW_LINE> <INDENT> self.log("removing file") <NEW_LINE> self.remove_cached() <NEW_LINE> self.log("removing file from S3") <NEW_LINE> retv = True <NEW_LINE> try: <NEW_LINE> <INDENT> k = Key(self.mgr.bucket, self.path) <NEW_LINE> k.delete() <NEW_LINE> <DEDENT> except (S3ResponseError, ValueError) as er...
Remove a file locally and from S3.
625941f416aa5153ce362a99
def isRectangleCover(self, rectangles): <NEW_LINE> <INDENT> if len(rectangles) == 0 or len(rectangles[0]) == 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> left, right, top, bottom = float("inf"), float("-inf"), float("-inf"), float("inf") <NEW_LINE> area = 0 <NEW_LINE> pointSet = set() <NEW_LINE> for rect in ...
:type rectangles: List[List[int]] :rtype: bool
625941f4c4546d3d9de7305a
def _add_node_to_graph(self, node): <NEW_LINE> <INDENT> label_template = "i={node_index}\\nv={value}" <NEW_LINE> node_index = 0 <NEW_LINE> value = node.data <NEW_LINE> label = label_template.format(node_index=node_index, value=value) <NEW_LINE> self._add_vertex(name=node_index, label=label) <NEW_LINE> while node.next i...
Recutsivly add node to the graph.
625941f4a8370b7717052ebd
def resolved(self): <NEW_LINE> <INDENT> if len(self._required_types) == len(self._resolved_types): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> local_scope = self.get_local_scope() <NEW_LINE> result = False <NEW_LINE> for name, type_ref in self._required_types.items(): <NEW_LINE> <INDENT> if name in self._resolv...
If all types are resolved it can be evaluated.
625941f4e5267d203edce2b5
def symlink_list(saltenv='base', outputter='nested'): <NEW_LINE> <INDENT> fileserver = salt.fileserver.Fileserver(__opts__) <NEW_LINE> load = {'saltenv': saltenv} <NEW_LINE> output = fileserver.symlink_list(load=load) <NEW_LINE> if outputter: <NEW_LINE> <INDENT> return {'outputter': outputter, 'data': output} <NEW_LINE...
Return a list of symlinked files and dirs CLI Example: .. code-block:: bash salt-run fileserver.symlink_list salt-run fileserver.symlink_list saltenv=prod
625941f4004d5f362079a94e
def test_scenario1(self): <NEW_LINE> <INDENT> show_doc(self.test_scenario1) <NEW_LINE> headers = ["data", "source_wait", "dataset_wait", "model_wait", "rate", "source_conf"] <NEW_LINE> examples = [ ['data/iris.csv', '10', '10', '10', '0.8', '{"category": 12}']] <NEW_LINE> for example in examples: <NEW_LINE> <INDENT> ex...
Scenario: Successfully creating a split dataset: Given I create a data source with "<params>" uploading a "<data>" file And I wait until the source is ready less than <source_wait> secs And I create a dataset And I wait until the dataset is ready less than <dataset_wait> secs And I create a dataset ...
625941f450485f2cf553d3bc
def prepare_csv_column_list_for_bid_prediction(): <NEW_LINE> <INDENT> CONFIG = config.get_config() <NEW_LINE> set_label_column(CONFIG['PREDICT_BID_LABELS'])
Prepare feature columns selection
625941f4cc0a2c11143dd4b2
def draw_block_graphviz(block, highlights=None, path="./temp.dot"): <NEW_LINE> <INDENT> graph = GraphPreviewGenerator("some graph") <NEW_LINE> protostr = block.desc.serialize_to_string() <NEW_LINE> desc = framework_pb2.BlockDesc.FromString(str(protostr)) <NEW_LINE> def need_highlight(name): <NEW_LINE> <INDENT> if highl...
Generate a debug graph for block. Args: block(Block): a block.
625941f4ff9c53063f47c810
def read_augmented_h5(filename=""): <NEW_LINE> <INDENT> if filename == "": <NEW_LINE> <INDENT> filename = input("Please enter filename with .h5 at the end") <NEW_LINE> <DEDENT> h5_path = join(dirname(dirname(dirname(abspath(__file__)))), "data", filename) <NEW_LINE> data = pd.HDFStore(h5_path) <NEW_LINE> return data["t...
Args: filename (default empty, but will be prompted to enter name) Returns the augmented data from the stored .HDF5 file. Similar to augmented_all() with the difference that the data is not generated but read instead. train_set, test_set = read_augmented_h5().
625941f46fece00bbac2dd67
def test_0010_user_status(self): <NEW_LINE> <INDENT> with Transaction().start(DB_NAME, USER, CONTEXT): <NEW_LINE> <INDENT> self.setup_defaults() <NEW_LINE> app = self.get_app() <NEW_LINE> with app.test_client() as c: <NEW_LINE> <INDENT> self.login(c, 'email@example.com', 'password') <NEW_LINE> SaleLine = POOL.get('sale...
Test that `_user_status()` returns dictionary with correct params.
625941f47c178a314d6efa8b
def get_first(l, predicate=None, default=None): <NEW_LINE> <INDENT> if l: <NEW_LINE> <INDENT> if predicate: <NEW_LINE> <INDENT> return next(ifilter(predicate, l), default) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return l[0] <NEW_LINE> <DEDENT> <DEDENT> return default
gets first item in list optionally matching precdicate :param l: list :param default: value to return if not found :param predicate: function to match value if you want to fitler :return: first item in the list optionaly matching the predicate
625941f48a349b6b435e8793
def check_edges(self): <NEW_LINE> <INDENT> screen_rect = self.screen.get_rect() <NEW_LINE> if self.rect.right >= screen_rect.right: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif self.rect.left <= 0: <NEW_LINE> <INDENT> return True
return True, when the alien at the edge of screen
625941f44a966d76dd551637
def test_find_invalid(self): <NEW_LINE> <INDENT> options = MockOptions() <NEW_LINE> options.names.invalid = ['Aaron', 'Gilbert', 'fillerator', ] <NEW_LINE> names = Names(options) <NEW_LINE> lines = [ [ 'This has no invalid names.', [], ], [ 'His name was Aaron but he went buy Jerry.', ['Aaron'], ], [ '"Hush Aaron," gil...
Check a line of text for invalid names.
625941f41f037a2d8b94681c
def test_extras_after_wheel(script, data): <NEW_LINE> <INDENT> simple = script.site_packages / 'simple' <NEW_LINE> no_extra = script.pip( 'install', '--no-index', '-f', data.find_links, 'requires_simple_extra', expect_stderr=True, ) <NEW_LINE> no_extra.did_not_create(simple) <NEW_LINE> extra = script.pip( 'install', '-...
Test installing a package with extras after installing from a wheel.
625941f492d797404e3047ae
def test_create_plain_text_comment(self): <NEW_LINE> <INDENT> comment = Comment.objects.create( author=AuthorProfileSerializer(self.author).data, comment=COMMENT_CONTENT, post=self.post, contentType=Comment.CT_PLAIN ) <NEW_LINE> self.assertTrue(comment.contentType, Comment.CT_PLAIN)
Test Comment Object can choose plain text for content
625941f41f5feb6acb0c5169
def three_consonant_rule(compound): <NEW_LINE> <INDENT> combinations = [] <NEW_LINE> suffix = compound[-1] <NEW_LINE> for index in range(len(compound) - 1): <NEW_LINE> <INDENT> current_prefix = compound[index] <NEW_LINE> current_suffix = compound[index + 1] <NEW_LINE> if current_prefix[-1].lower() in "bdfgjlmnprstv" an...
Expand each stem if its last letter equals the first letter of the following stem. ("glas", "skål") --> ("glas", "skål"), ("glass", "skål")
625941f43346ee7daa2b3392
def get_default_conda_env(): <NEW_LINE> <INDENT> import pyspark <NEW_LINE> pyspark_version = re.sub(r"(\.?)dev.*", "", pyspark.__version__) <NEW_LINE> return _mlflow_conda_env( additional_conda_deps=[ "pyspark={}".format(pyspark_version), ], additional_pip_deps=None, additional_conda_channels=None)
:return: The default Conda environment for MLflow Models produced by calls to :func:`save_model()` and :func:`log_model()`. This Conda environment contains the current version of PySpark that is installed on the caller's system. ``dev`` versions of PySpark are replaced with stable versions in...
625941f43346ee7daa2b3393
def build_hud(self, img): <NEW_LINE> <INDENT> if img is None: <NEW_LINE> <INDENT> im = np.copy(self.im) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> im = np.copy(img) <NEW_LINE> <DEDENT> line_list = self.draw_dict.get("lines") <NEW_LINE> if not line_list: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <...
Function builds a "HUD" image that is good for streaming. Modules will have to append their values to the list of items they want printed. At the moment, it is assumed that the image to be written two is a three channel color image. Args: img - an image that the hud will be printed over. Currently not modified.
625941f48c0ade5d55d3efe1
def init_keys(self, app_uin, app_password): <NEW_LINE> <INDENT> self.key_recv = derive_key(''.join(map(str, (app_uin, self.uin, app_password, self.password)))) <NEW_LINE> self.key_send = derive_key(''.join(map(str, (self.uin, app_uin, self.password, app_password))))
Init both encrypt end decrypt keys for device
625941f496565a6dacc8fcea
def GetBoundaryCondition(self): <NEW_LINE> <INDENT> return _itkNeighborhoodOperatorImageFilterPython.itkNeighborhoodOperatorImageFilterIF2IF2_GetBoundaryCondition(self)
GetBoundaryCondition(self) -> itkImageBoundaryConditionIF2
625941f48da39b475bd6559d
def split_by_punc(s): <NEW_LINE> <INDENT> iters = list(_punc_pattern.finditer(s)) <NEW_LINE> if iters: <NEW_LINE> <INDENT> ls = [s[i.span()[0]: i.span()[1]] for i in iters] <NEW_LINE> ls.append(s[iters[-1].span()[1]:]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ls = [s] <NEW_LINE> <DEDENT> return ls
将一个字符串按照Unicode标准中的标点符号进行分割
625941f4d4950a0f3b08c966
def ReverseMotorR(self, tm=0.0, speed=50): <NEW_LINE> <INDENT> if tm == 0.0: <NEW_LINE> <INDENT> self.__signals((self.__input3,self.__input4), (GPIO.HIGH, GPIO.LOW), 1, speed) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.__signals((self.__input3,self.__input4), (GPIO.HIGH, GPIO.LOW), 1, speed) <NEW_LINE> sleep(tm...
Mover el motor derecho hacia atrás. :param tm: Tiempo que durará el movimiento ejecutado. :type tm: float :param speed: Velocidad del movimiento. :type speed: int
625941f4d4950a0f3b08c967
def query_local_nodes(self, include_controls=False): <NEW_LINE> <INDENT> from supriya.tools import responsetools <NEW_LINE> query_tree_group = responsetools.QueryTreeGroup.from_group( self.root_node, include_controls=include_controls, ) <NEW_LINE> return query_tree_group
Queries all node proxies in Python. :: >>> from supriya import servertools >>> server = servertools.Server() >>> server.boot() <Server: udp://127.0.0.1:57751, 8i8o> :: >>> group_a = servertools.Group().allocate() >>> group_b = servertools.Group().allocate() >>> group_c = servertools.Grou...
625941f423e79379d52eeb7c
def mae(self, train=False, valid=False, xval=False): <NEW_LINE> <INDENT> tm = ModelBase._get_metrics(self, train, valid, xval) <NEW_LINE> m = {} <NEW_LINE> for k, v in viewitems(tm): m[k] = None if v is None else v.mae() <NEW_LINE> return list(m.values())[0] if len(m) == 1 else m
Get the MAE. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are "train", "valid", and "xval". Parameters ---------- train : bool, default=True If train is True, then return the MAE value for the training ...
625941f4009cb60464c639cd
def kp_play_note_once(inputnote): <NEW_LINE> <INDENT> print('{0} pressed; Will play: {1}.'.format(inputnote, keyboard_data[inputnote])) <NEW_LINE> if not is_under_pi: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> os.system('echo {0}={1} >> /dev/pi-blaster'.format(keyboard_data[inputnote]['gpio'], keyboard_data[inputno...
Play a note once a time.
625941f41d351010ab85613b
@tf_export(v1=["nn.conv2d_transpose"]) <NEW_LINE> def conv2d_transpose( value=None, filter=None, output_shape=None, strides=None, padding="SAME", data_format="NHWC", name=None, input=None, filters=None): <NEW_LINE> <INDENT> value = deprecated_argument_lookup("input", input, "value", value) <NEW_LINE> filter = deprecate...
The transpose of `conv2d`. This operation is sometimes called "deconvolution" after [Deconvolutional Networks](http://www.matthewzeiler.com/pubs/cvpr2010/cvpr2010.pdf), but is actually the transpose (gradient) of `conv2d` rather than an actual deconvolution. Args: value: A 4-D `Tensor` of type `float` and shape ...
625941f4293b9510aa2c38b0
def create_waiter_with_client(waiter_name, waiter_model, client): <NEW_LINE> <INDENT> single_waiter_config = waiter_model.get_waiter(waiter_name) <NEW_LINE> operation_name = xform_name(single_waiter_config.operation) <NEW_LINE> operation_method = NormalizedOperationMethod( getattr(client, operation_name)) <NEW_LINE> @a...
:type waiter_name: str :param waiter_name: The name of the waiter. The name should match the name (including the casing) of the key name in the waiter model file (typically this is CamelCasing). :type waiter_model: botocore.waiter.WaiterModel :param waiter_model: The model for the waiter configuration. :type...
625941f494891a1f4081c0cd
def setUp(self) -> None: <NEW_LINE> <INDENT> self.short_file = "2021-06-02_LowBaseline_HPSOs.csv" <NEW_LINE> self.mid_file = "2021-06-02_MidBaseline_HPSOs.csv" <NEW_LINE> self.long_file = "2021-06-02_HighBaseline_HPSOs.csv" <NEW_LINE> self.short = {"Bmax": 4062.6} <NEW_LINE> self.mid = {"Bmax": 32500} <NEW_LINE> self.l...
Use the parametric model to generic the reports that produce the system sizing we use for our Notes ------ This particular test requires you to have the parametric model available on your machine. We have also edited the `reports` directory to produce the data output for each pipeline component. The following code has...
625941f473bcbd0ca4b2c696
def set_value(self, value): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> self.has_value = True
Set the main value of this object
625941f4d18da76e23532aff
def get_currency_field(self, model): <NEW_LINE> <INDENT> return self.currency_field or ( 'currency_id' if 'currency_id' in model._fields else 'x_currency_id' if 'x_currency_id' in model._fields else None )
Return the name of the currency field.
625941f44f88993c3716c681
def test_create_healthmonitor_with_mandatory_params(self): <NEW_LINE> <INDENT> resource = 'health_monitor' <NEW_LINE> cmd = healthmonitor.CreateHealthMonitor(test_cli20.MyApp(sys.stdout), None) <NEW_LINE> admin_state_up = False <NEW_LINE> delay = '60' <NEW_LINE> max_retries = '2' <NEW_LINE> timeout = '10' <NEW_LINE> ty...
lb-healthmonitor-create with mandatory params only.
625941f4e76e3b2f99f3ae22
def run(self): <NEW_LINE> <INDENT> logging.info(f'Starting up api at http://{settings.FLASK_SERVER_NAME}/api') <NEW_LINE> self.app.run() <NEW_LINE> self.app.t.join()
Set up and run the back-end api for the frond-end that serves webpages and static files :param start_time: :param stop_time: :return:
625941f4d58c6744b425827e
def __apply_single_override(self, dest, name, value): <NEW_LINE> <INDENT> self.log.debug("Applying %s=%s", name, value) <NEW_LINE> parts = [(int(x) if is_int(x) else x) for x in name.split(".")] <NEW_LINE> pointer = dest <NEW_LINE> for index, part in enumerate(parts[:-1]): <NEW_LINE> <INDENT> self.__ensure_list_capacit...
Apply single override :type name: str :type value: str
625941f44e4d5625662d49ef
def get_distinct_purchase_uid(*args, **kwargs): <NEW_LINE> <INDENT> field = 'uid' <NEW_LINE> return map(lambda x: getattr(x, field), db_instance.get_distinct_field(Purchase, field, *args, **kwargs))
获取用户 :param args: :param kwargs: :return: List
625941f44428ac0f6e5bae19
def test_create_info(self): <NEW_LINE> <INDENT> net = models.Network() <NEW_LINE> self.db.add(net) <NEW_LINE> node = models.Node(network=net) <NEW_LINE> info = models.Info(origin=node, contents="foo") <NEW_LINE> self.add(node, info) <NEW_LINE> assert isinstance(info.id, int) <NEW_LINE> assert info.type == "info" <NEW_L...
Try creating an info
625941f457b8e32f52483ac0
def next_batch(self, batch_size, shuffle=True): <NEW_LINE> <INDENT> start_index = self._index_in_epoch <NEW_LINE> if self._epoch_completed == 0 and start_index == 0 and shuffle: <NEW_LINE> <INDENT> np.random.shuffle(self._indices) <NEW_LINE> <DEDENT> if start_index + batch_size > self._num_examples: <NEW_LINE> <INDENT>...
Return the next 'batch_size' examples from this dataset. :param batch_size : int, size of a single batch. :param shuffle : bool, whether to shuffle the whole set while sampling a batch. :return: batch_images : np.ndarray, shape: (N,H,W,C)
625941f4f8510a7c17cf9d22
def stop(self): <NEW_LINE> <INDENT> return _blocks_swig1.vector_source_f_sptr_stop(self)
stop(vector_source_f_sptr self) -> bool
625941f430c21e258bdfaac6
def test_abandon_two_environments_at_once(self): <NEW_LINE> <INDENT> self.add_app_to_env(self.deployingapp_id) <NEW_LINE> self.add_app_to_env(self.deployingapp_id) <NEW_LINE> self.navigate_to('Applications') <NEW_LINE> self.go_to_submenu('Environments') <NEW_LINE> self.driver.find_element_by_css_selector( "label[for=ui...
Test check ability to abandon multiple environments Scenario: 1. Add two apps to different environments 2. Navigate to environment list 3. Check created environments 4. Deploy created environments at once 5. Abandon environments before they are deployed
625941f4ab23a570cc2507a9
def _get_request_audit_info(context): <NEW_LINE> <INDENT> user_id = None <NEW_LINE> project_id = None <NEW_LINE> domain_id = None <NEW_LINE> if context: <NEW_LINE> <INDENT> user_id = context.user_id <NEW_LINE> project_id = context.project_id <NEW_LINE> domain_id = context.domain_id <NEW_LINE> <DEDENT> initiator = resou...
Collect audit information about the request used for CADF. :param context: Request context :returns: Auditing data about the request :rtype: :class:'pycadf.Resource'
625941f48e05c05ec3eea99b
def build_business(): <NEW_LINE> <INDENT> generate( 'templates', 'menus/business.html', 'menus/business.html', sections=sections, page_info='business', year=datetime.datetime.now().year) <NEW_LINE> print('menus/business built')
builds business using py page -> None
625941f4adb09d7d5db6cdad
def startServices(self): <NEW_LINE> <INDENT> enable_vts_agent = getattr(self, "enable_vts_agent", True) <NEW_LINE> enable_sl4a = getattr(self, "enable_sl4a", False) <NEW_LINE> try: <NEW_LINE> <INDENT> self.startAdbLogcat() <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> self.log.exception("Failed to start adb logcat!")...
Starts long running services on the android device. 1. Start adb logcat capture. 2. Start VtsAgent and create HalMirror unless disabled in config. 3. If enabled in config, start sl4a service and create sl4a clients.
625941f45166f23b2e1a577a
def test_start(self): <NEW_LINE> <INDENT> action = NavigateAction(15, 16) <NEW_LINE> action.start(self.robot) <NEW_LINE> self.assertEqual(action.x_start, 1) <NEW_LINE> self.assertEqual(action.y_start, 1)
Checks if starting positions are set from robot.
625941f4167d2b6e312191b5
def set_attr(self, key, value): <NEW_LINE> <INDENT> assert(self.pk) <NEW_LINE> if hasattr(self, key): <NEW_LINE> <INDENT> setattr(self, key, value) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> prop, created = self.properties.get_or_create( key=key, defaults={ 'edge': self}) <NEW_LINE> prop.save_value(value)
Method: set_attr Use this method to set a edge's attribute. It looks in the edge object and its related properties for an attribute with the given name and changes it. If non exist, a new property is added saving this attribute. Parameters: {string} key - The name of the attribute. {attr} value - The new valu...
625941f456b00c62f0f14c7f
def test_upload_bad_image_fails(self): <NEW_LINE> <INDENT> url = image_upload_url(self.recipe.id) <NEW_LINE> res = self.client.post(url, {'image': 'notimage'}, format='multipart') <NEW_LINE> self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
test uploading invalid image
625941f40fa83653e46575d8
def test_update_job_with_filename(self): <NEW_LINE> <INDENT> start_value = "start value %s" % datetime.datetime.now() <NEW_LINE> self._set_user_var(self.test_email, self.test_var_key, start_value) <NEW_LINE> f = tempfile.NamedTemporaryFile(delete=False) <NEW_LINE> try: <NEW_LINE> <INDENT> updated_value = "updated value...
Test that the update_job() function actually updates from a filename
625941f4fbf16365ca6f67f3
def _init_module(self, module, init_data=None): <NEW_LINE> <INDENT> mod = module(init_data) <NEW_LINE> mod.setup_internals(self, init_data) <NEW_LINE> return mod
Initialisiert das Modul module
625941f42eb69b55b151ceda
def isValidSerialization(self, preorder): <NEW_LINE> <INDENT> stack = [] <NEW_LINE> top = -1 <NEW_LINE> preorder = preorder.split(',') <NEW_LINE> for s in preorder: <NEW_LINE> <INDENT> stack.append(s) <NEW_LINE> top += 1 <NEW_LINE> while(self.endsWithTwoHashes(stack,top)): <NEW_LINE> <INDENT> h = stack.pop() <NEW_LINE>...
:type preorder: str :rtype: bool
625941f473bcbd0ca4b2c697
def spacegroup_magnetic(msg_number): <NEW_LINE> <INDENT> msg_number = np.asarray(msg_number, dtype=str).reshape(-1) <NEW_LINE> msg_file = os.path.join(datadir, 'SpaceGroupsMagnetic.json') <NEW_LINE> with open(msg_file, 'r') as fp: <NEW_LINE> <INDENT> msg_dict = json.load(fp) <NEW_LINE> <DEDENT> if None in msg_number: <...
Return dict of magnetic spacegroup, given magnetic spacegroup number :param msg_number: magnetic space group number e.g. 61.433 :return: dict with keys: 'parent number': sg, 'space group number': number, 'space group name': label, 'setting': setting, 'type name': type_name, 'related group': rel_...
625941f424f1403a92601182
def load_venue_matrix(self, venue_matrix): <NEW_LINE> <INDENT> if isinstance(venue_matrix, basestring): <NEW_LINE> <INDENT> start = time.time() <NEW_LINE> logger.info("Loading venue matrix...") <NEW_LINE> self.venue_matrix = scipy.io.mmread(venue_matrix) <NEW_LINE> self.venue_matrix = self.venue_matrix.tocsr() <NEW_LIN...
load venue matrix (scipy sparse matrix) from a file or a matrix Also computes row and column normalized matrices :venue_matrix: (matrix or str) If string, will be interpreted as the filename for the venue matrix. Otherwise, the matrix
625941f4711fe17d8254297e
@bind("toggle") <NEW_LINE> def cmd_toggle(args: List[str]): <NEW_LINE> <INDENT> if len(args) != 1: <NEW_LINE> <INDENT> raise ValueError("edit takes exactly one argument.") <NEW_LINE> <DEDENT> uuid = uuid_from_arg0(args[0]) <NEW_LINE> print("Set to: {}".format(MODEL.toggle_todo(uuid)))
Toggle an item.
625941f42ae34c7f2600d751
def __init__( self, source_entity, name, meter_type, meter_offset, net_consumption, tariff=None, tariff_entity=None, ): <NEW_LINE> <INDENT> self._sensor_source_id = source_entity <NEW_LINE> self._state = 0 <NEW_LINE> self._last_period = 0 <NEW_LINE> self._last_reset = dt_util.utcnow() <NEW_LINE> self._collecting = None...
Initialize the Utility Meter sensor.
625941f4c432627299f0526c
def setUp(self): <NEW_LINE> <INDENT> self.results = [] <NEW_LINE> self.log.info("Check if CONFIG_RCU_TORTURE_TEST is enabled\n") <NEW_LINE> ret = linux_modules.check_kernel_config('CONFIG_RCU_TORTURE_TEST') <NEW_LINE> if ret == 0: <NEW_LINE> <INDENT> self.cancel("CONFIG_RCU_TORTURE_TEST is not set in .config !!\n") <NE...
Verifies if CONFIG_RCU_TORTURE_TEST is enabled
625941f401c39578d7e7545d
def get_base_class(manager, model): <NEW_LINE> <INDENT> return ( option(model, 'base_classes') or (get_declarative_base(model), ) )
Returns all base classes for history model.
625941f4187af65679ca5742
def api_handler(client, hdfs_path, data=None, strict=True, **params): <NEW_LINE> <INDENT> url = '%s%s%s' % ( client.url.rstrip('/'), self.webhdfs_prefix, quote(client.resolve(hdfs_path), '/= '), ) <NEW_LINE> params['op'] = operation <NEW_LINE> if client._proxy is not None: <NEW_LINE> <INDENT> params['doas'] = client._p...
Wrapper function.
625941f4796e427e537b0bed
def flush(self): <NEW_LINE> <INDENT> self.stream.flush()
flush output
625941f43617ad0b5ed68518
def copy(self, other): <NEW_LINE> <INDENT> self.left = other.left <NEW_LINE> self.right = other.right <NEW_LINE> Operator.copy(self, other)
deep copy
625941f41d351010ab85613c
def take_snapshot(self, name): <NEW_LINE> <INDENT> snapshot = {} <NEW_LINE> for field, value in self.items(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> snapshot[field] = copy.deepcopy(value) <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> log.warning('Unable to take `%s` snapshot for field `%s` in `%s`' % ...
Takes a snapshot of the entry under *name*. Snapshots can be accessed via :attr:`.snapshots`. :param string name: Snapshot name
625941f45166f23b2e1a577b
def send_status_nn_trainning(msg, chat_id, token, history, parameters): <NEW_LINE> <INDENT> bot = telegram.Bot(token = token) <NEW_LINE> bot.sendMessage(chat_id, text = msg) <NEW_LINE> bot.sendMessage(chat_id, text = 'Summary: \n validation_split='+str(parameters[0])+ ',\n batch_size = '+str(parameters[1])+',\n epochs ...
Send complete summary for your NN training (time could be added in your file en then printed) Use telegram api to send any message to a conversation. Primarly used to send updates about long scripts Parameters ---------- msg: str message you want to send chat_id: str chat identification number. learn how...
625941f4ad47b63b2c50a5a1
def decode_create_source_route_req(data): <NEW_LINE> <INDENT> print_standard_header("Create source route request", data, 3) <NEW_LINE> print(pad_text("Route Command Options") + get_hex(data[15])) <NEW_LINE> address_num = data[16] <NEW_LINE> print(pad_text("Number of addresses") + get_hex(address_num)) <NEW_LINE> length...
The Xbee is sending a source route request (frame ID 0x21). Args: data (list): The packet data as a collection of integers.
625941f463f4b57ef0001728
def getPSFImage(self, i): <NEW_LINE> <INDENT> from .image import Image <NEW_LINE> if i >= len(self.psf_file_name): <NEW_LINE> <INDENT> raise GalSimIndexError('index out of range (0..%d)'%(len(self.psf_file_name)-1),i) <NEW_LINE> <DEDENT> f = self._getFile(self.psf_file_name[i]) <NEW_LINE> with self.psf_lock: <NEW_LINE>...
Returns the PSF at index ``i`` as an `Image` object.
625941f415fb5d323cde113b
def _compute_is_class_correctly_detected_in_image( self, detected_boxes, detected_scores, groundtruth_boxes, detected_masks=None, groundtruth_masks=None): <NEW_LINE> <INDENT> if detected_boxes.size > 0: <NEW_LINE> <INDENT> if groundtruth_boxes.size > 0: <NEW_LINE> <INDENT> max_score_id = np.argmax(detected_scores) <NEW...
Compute CorLoc score for a single class. Args: detected_boxes: A numpy array of shape [N, 4] representing detected box coordinates detected_scores: A 1-d numpy array of length N representing classification score groundtruth_boxes: A numpy array of shape [M, 4] representing ground truth box coor...
625941f4167d2b6e312191b6
def __eq__(self, other: Any) -> bool: <NEW_LINE> <INDENT> return all( getattr(self, a, None) == getattr(other, a, None) for a in ["name", "cname", "axis", "pos"] )
compare 2 col items
625941f45e10d32532c5f546
def test_added_ACAO_False_origin(self): <NEW_LINE> <INDENT> self.cp = Proxy('localhost', allow_from=False) <NEW_LINE> env = get_default_environ() <NEW_LINE> env['ORIGIN'] = "my.domain" <NEW_LINE> self.cp(env, self.simulate_start_response) <NEW_LINE> self.assertNotIn(("Access-Control-Allow-Origin", "my.domain"), self.re...
Tests that the ACAO header is not added if allow_from is False.
625941f47d43ff24873a32c7
def get_participation_id(self): <NEW_LINE> <INDENT> return self._participation_id
Auslesen des Fremdschlüssels zu Participation.
625941f45fcc89381b1e1ce6
def match(self, char): <NEW_LINE> <INDENT> match_location = [] <NEW_LINE> for i in range(len(self.word)): <NEW_LINE> <INDENT> if self.word[i] == char: <NEW_LINE> <INDENT> match_location.append(i) <NEW_LINE> <DEDENT> <DEDENT> return match_location
Return a list of the indices of char in the secret word.
625941f482261d6c526abacb
def get_delete_url(self, next): <NEW_LINE> <INDENT> prefix = self.__class__.get_url_name_prefix() <NEW_LINE> try: <NEW_LINE> <INDENT> return reverse("%s_aggregate_delete" % prefix, kwargs={'agg_id': self.id})+"?next=%s" % next <NEW_LINE> <DEDENT> except NoReverseMatch: <NEW_LINE> <INDENT> return reverse("aggregate_dele...
Get the URL to use when deleting the project from the Aggregate List. This function will first check if there is a URL defined as <app_label>_aggregate_delete and return that if it exists, attaching "?next=<C{next}>" to the end of the URL. @param next: URL to redirect to after deleting object. @return: URL to go to w...
625941f41b99ca400220b0d6
def loadProjectionData(self): <NEW_LINE> <INDENT> projections = [] <NEW_LINE> hitter_data = self.__loadHitterData() <NEW_LINE> pitcher_data = self.__loadPitcherData() <NEW_LINE> self.__mergeArrays(hitter_data, pitcher_data, projections) <NEW_LINE> self.projections = projections <NEW_LINE> return projections
Returns an ordered list of mlb players based on how many projected points they are expected to have
625941f4d486a94d0b98e768
@njit <NEW_LINE> def _log_add_exp(x, y): <NEW_LINE> <INDENT> larger = max(x, y) <NEW_LINE> smaller = min(x, y) <NEW_LINE> return larger + np.log1p(np.exp(smaller - larger))
Numerically stable log-add-exp.
625941f4f548e778e58cdba2
def assign_bins(self, observation): <NEW_LINE> <INDENT> state_discrete = numpy.zeros(len(self._list_of_observations)) <NEW_LINE> for i in range(len(self._list_of_observations)): <NEW_LINE> <INDENT> state_discrete[i] = numpy.digitize(observation[i], self._bins[i]) <NEW_LINE> <DEDENT> return state_discrete
Will make observations discrete by placing each value into its corresponding bin :param observation: :return:
625941f476e4537e8c351c9a
def sendpacket(self, sensor_value_tuple): <NEW_LINE> <INDENT> value_to_send = int(self.convert(sensor_value_tuple)) <NEW_LINE> self.pub.publish(value_to_send)
Method to send converted value to listeners
625941f4a4f1c619b28b064b
def get_attribute_meta(self, node, name): <NEW_LINE> <INDENT> return self._send({'name': 'getAttributeMeta', 'args': [node, name]})
Returns the definition object of an attribute from the META rules of the node. :param node: the node in question. :type node: dict :param name: the name of the attribute. :type name: str :returns: The function returns the definition object, where type is always defined. :rtype: dict :raises CoreIllegalArgumentError: I...
625941f49c8ee82313fbbd99
def _blackbody_hz(nu, temperature): <NEW_LINE> <INDENT> I = (2*_h*nu**3 / _c**2 * (exp(_h*nu/(_k_B*temperature)) - 1)**-1) <NEW_LINE> return I
Compute the Planck function given nu in Hz and temperature in K with output in cgs
625941f499fddb7c1c9de9af
@numba.jit(nopython=True) <NEW_LINE> def burn_all(fires, active, L, E, A, R, F, n=-1): <NEW_LINE> <INDENT> while n and (active[0] != active[1]): <NEW_LINE> <INDENT> burn_next_active_pixel(fires, active, L, E, A, R, F) <NEW_LINE> if n: n -= 1 <NEW_LINE> else: break <NEW_LINE> <DEDENT> return abs(n)
Burn until there are no more active fires.
625941f44e696a04525c9a70
def judgeCircle(self, moves): <NEW_LINE> <INDENT> u=moves.count('U') <NEW_LINE> d=moves.count('D') <NEW_LINE> l=moves.count('L') <NEW_LINE> r=moves.count('R') <NEW_LINE> if u==d and l==r: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
:type moves: str :rtype: bool
625941f4379a373c97cfb169
def prepend_to_name(self,to_prepend): <NEW_LINE> <INDENT> front = '' <NEW_LINE> enum_name = self.enum_name <NEW_LINE> if self.alias_name is not None: <NEW_LINE> <INDENT> last_index_of = enum_name.rfind('.') <NEW_LINE> if last_index_of != -1: <NEW_LINE> <INDENT> front = enum_name[0:last_index_of+1] <NEW_LINE> enum_name ...
Frequently use struct_name during emitting. If struct is aliased though, then do not always want to prepend in front of struct name. This is because alias as form a.b.c.d; actually want to prepend in front of d.
625941f4d486a94d0b98e769
def get_gps_data(get_latency=False): <NEW_LINE> <INDENT> if app_config_access.installed_sensors.pimoroni_pa1010d: <NEW_LINE> <INDENT> if get_latency: <NEW_LINE> <INDENT> return sensors_direct.pimoroni_pa1010d_a.sensor_latency <NEW_LINE> <DEDENT> gps_data = sensors_direct.pimoroni_pa1010d_a.all_gps_data() <NEW_LINE> <DE...
Returns GPS Data in a dictionary. latitude, longitude, altitude, timestamp, number of satellites, gps quality, mode fix type, speed over ground, pdop, hdop, vdop
625941f4ec188e330fd5adb3
def __init__(self, **options): <NEW_LINE> <INDENT> self.options = Config(options, ['x', '0'], ['y', '0'], ['font', 'pygame.font.Font(None, 32)'], ['color', '(0,0,0)'], ['restricted', '\'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&\\\'()*+,-./:;<=>?@[\]^_`{|}~\''], ['maxlength', '-1'], ['prompt',...
Options: x, y, font, color, restricted, maxlength, prompt
625941f491f36d47f21acb1c
def list(self, limit=None, page_size=None): <NEW_LINE> <INDENT> return list(self.stream( limit=limit, page_size=page_size, ))
Lists TaskChannelInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. :param int limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :pa...
625941f48c3a8732951589e5
def search_meta_file_name(filename="GSE33000_GSE22845_GSE12417",list_meta_files=["GSE12417_GSE22845","GSE33000"], ask=False): <NEW_LINE> <INDENT> import numpy as np <NEW_LINE> query_list = filename.split("_") <NEW_LINE> filename_to_return = None <NEW_LINE> for existing_file in list_meta_files: <NEW_LINE> <INDENT> list_...
:param filename: :param list_meta_files: :param ask: :return: filename="GSE33000_GSE22845_GSE12417" list_meta_files=["GSE12417","GSE22845","GSE33000","GSE22845_GSE12417","GSE12417_GSE22845_GSE33000"] ask=False result = search_meta_file_name(filename="GSE33000_GSE22845_GSE12417",list_meta_files=list_meta_files) result ...
625941f445492302aab5e8ec
def exec_compute_shader(self, shader_obj, shader_inputs, exec_size, workgroup_size=(16, 16, 1)): <NEW_LINE> <INDENT> ntx = int(math.ceil(exec_size[0] / workgroup_size[0])) <NEW_LINE> nty = int(math.ceil(exec_size[1] / workgroup_size[1])) <NEW_LINE> ntz = int(math.ceil(exec_size[2] / workgroup_size[2])) <NEW_LINE> nodep...
Executes a compute shader. The shader object should be a shader loaded with Shader.load_compute, the shader inputs should be a dict where the keys are the names of the shader inputs and the values are the inputs. The workgroup_size has to match the size defined in the compute shader
625941f4711fe17d8254297f
def run_Tmap(n, Tlim=(15, 18), fb=False): <NEW_LINE> <INDENT> temp_XsMask(n, Tlim=Tlim, fourband=fb) <NEW_LINE> plt.show()
Shows T image masked with XsMASK and scaled with Tlim. SPIRE-only by default, but fb=True will switch to four band T & chi squared.
625941f4baa26c4b54cb173b
def test_ok(self): <NEW_LINE> <INDENT> test = self.app.put(urlparse.urljoin(SERVER_API, 'users/' + self.username), data={'activation_code': self.activation_code}) <NEW_LINE> self.assertIn(self.username, server.userdata.keys()) <NEW_LINE> self.assertTrue(os.path.exists(self.user_dirpath)) <NEW_LINE> self.assertNotIn(sel...
Right activation code --> success.
625941f46fece00bbac2dd68
def post_render_hook(self): <NEW_LINE> <INDENT> logger.debug("post_render hook")
a hook after render()
625941f46e29344779a62c33
def log_debug(self, class_name, method_name, message, exception=None): <NEW_LINE> <INDENT> self.write_log_file( 'debug', class_name, method_name, message, exception)
Logging a debug message with exception
625941f4b5575c28eb68e628
def keyPressEvent( self , evt ) : <NEW_LINE> <INDENT> if evt.key() == Qt.Key_Escape and globals.debug_settings.value("Debug/AllowEscapeToClose",type=bool) : <NEW_LINE> <INDENT> self.close()
Handle key-presses.
625941f444b2445a339326b3
def decode_parameters(self, Ds_MerchantParameters): <NEW_LINE> <INDENT> Ds_MerchantParameters_decoded = base64.standard_b64decode(Ds_MerchantParameters) <NEW_LINE> return json.loads(Ds_MerchantParameters_decoded.decode())
Given the Ds_MerchantParameters from Redsys, decode it and eval the json file :param Ds_MerchantParameters: Encoded json structure returned from Redsys :return merchant_parameters: Json structure with all parameters
625941f4ec188e330fd5adb4
def make_asyncio(self): <NEW_LINE> <INDENT> return self.create_server( host=self._host, port=self._port, debug=self._debug, return_asyncio_server=True )
Make an awaitable starting function Returns ------- awaitable starting function
625941f432920d7e50b287f8