code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def make_grid(): <NEW_LINE> <INDENT> import random <NEW_LINE> dice = [[False, 'AAEEGN'], [False, 'ELRTTY'], [False, 'AOOTTW'], [False, 'ABBJOO'], [False, 'EHRTVW'], [False, 'CIMOTU'], [False, 'DISTTY'], [False, 'EIOSST'], [False, 'DELRVY'], [False, 'ACHOPS'], [False, 'HIMNQU'], [False, 'EEINSU'], [False, 'EEGHNW'], [Fa...
make_grid() -> None Makes a 4x4 random grid from the sides of the 16 6-sides dice.
625941ce925a0f43d2549f9e
def create(self, name, masterjudge_id, body='', type_id=0, interactive=False, code=None): <NEW_LINE> <INDENT> resource_path = '/problems' <NEW_LINE> method = 'POST' <NEW_LINE> if code == '': <NEW_LINE> <INDENT> raise SphereEngineException('empty code', 400) <NEW_LINE> <DEDENT> if name == '': <NEW_LINE> <INDENT> raise S...
Create a new problem :param name: problem name :type name: string :param masterjudge_id: masterjudge id :type masterjudge_id: integer :param body: problem body :type body: string :param type_id: problem type id (0-binary, 1-minimize, 2-maximize) (default 0) :type type_id: string :param interactive: interactive problem...
625941ce07f4c71912b115a9
def get_selfstate(state=None): <NEW_LINE> <INDENT> if isinstance(state, SelfState): <NEW_LINE> <INDENT> pxlib.pxget_selfstate(ctypes.byref(state)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> result = SelfState() <NEW_LINE> pxlib.pxget_selfstate(ctypes.byref(result)) <NEW_LINE> return result
get current self attitude and position value. if the argument type is 'SelfState', the attributes of the argument will be overwritten by current parameters and this function return None else, this function returns new "SelfState" instance with current state parameters. NOTE: using SelfState arguments fasten the cod...
625941cecad5886f8bd27100
def cleanup_video(data): <NEW_LINE> <INDENT> data['cap'].release()
Cleanup callback for modes that handle OpenCV video (camera, video) Releases the video capture object referenced in the given data parameter Parameters: data (dict): Script-internal meta data
625941cea05bb46b383ec948
def __getitem__(self, key): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> value = super().__getitem__(key) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> if isinstance(key, str): <NEW_LINE> <INDENT> value = super().__getattribute__('get_from_path')(key, raise_error=True) <NEW_LINE> <DEDENT> elif isinstance(key...
Access dict values by key. Args: key: key to retrieve
625941ce91af0d3eaac9bb40
def queryOne(self): <NEW_LINE> <INDENT> generaloperat.queryOneCommodity()
前台 查看一个商品信息
625941ce66656f66f7cbc2d1
@typemap <NEW_LINE> def element_not(x, name=''): <NEW_LINE> <INDENT> from cntk.cntk_py import element_not <NEW_LINE> x = sanitize_input(x) <NEW_LINE> return element_not(x, name)
Computes the element-wise logic NOT of ``x`` and ``y``. Example: >>> C.element_not([1, 1, 0, 0]).eval() array([ 0., 0., 1., 1.], dtype=float32) Args: x, y: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): the name of the Function instance in the n...
625941ce55399d3f055887db
def __getitem__(self, key): <NEW_LINE> <INDENT> if type(key) == int: <NEW_LINE> <INDENT> return max(0, min(1, self._value & 2**key)) <NEW_LINE> <DEDENT> elif isinstance(key, slice): <NEW_LINE> <INDENT> start = key.start if key.start is not None else 0 <NEW_LINE> stop = key.stop if key.stop is not None else len(self) <N...
Returns the bit at the given index. If a slice is given instead, it will return a new bitfield of the sliced bits.
625941ce3cc13d1c6d3c74a1
def execute(self, fp): <NEW_LINE> <INDENT> FreeCAD.Console.PrintMessage("Recompute Chassis feature\n")
Do something when doing a recomputation, this method is mandatory
625941ce63b5f9789fde720c
def ftau(p): <NEW_LINE> <INDENT> if np.argmin(p > 0) == 0: <NEW_LINE> <INDENT> return maxgen+1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return np.argmin(p > 0)
Finds fixation time, returns generation when shannon index vanishes for the first time.
625941ce99cbb53fe6792d0d
def get_playlist_data(token, playlist_id): <NEW_LINE> <INDENT> ids = [] <NEW_LINE> artists = [] <NEW_LINE> dates_added = [] <NEW_LINE> counts = [] <NEW_LINE> song_counts = {} <NEW_LINE> sp = spotipy.Spotify(auth=token) <NEW_LINE> playlist = sp.user_playlist(sp.current_user()['id'], playlist_id=playlist_id, fields='nam...
Collect all the data from a playlist and convert into a pandas dataframe
625941ce15baa723493c409c
def sort_blur(self): <NEW_LINE> <INDENT> input_dir = self.args.input_dir <NEW_LINE> logger.info("Sorting by blur...") <NEW_LINE> img_list = [[img, self.estimate_blur(img)] for img in tqdm(self.find_images(input_dir), desc="Loading", file=sys.stdout)] <NEW_LINE> logger.info("Sorting...") <NEW_LINE> img_list = sorted(img...
Sort by blur amount
625941ce0a366e3fb873e941
def breed_by_crossover(parent_1, parent_2): <NEW_LINE> <INDENT> chromosome_length = len(parent_1) <NEW_LINE> crossover_point = rn.randint(1,chromosome_length-1) <NEW_LINE> child_1 = np.hstack((parent_1[0:crossover_point], parent_2[crossover_point:])) <NEW_LINE> child_2 = np.hstack((parent_2[0:crossover_point], parent_1...
Combine two parent chromsomes by crossover to produce two children.
625941ce76e4537e8c35179a
def _hil_reserve_cmd(env_dict, pdata_dict, jobdata_dict): <NEW_LINE> <INDENT> t_start_s, t_end_s = _get_hil_reservation_times(env_dict, pdata_dict, jobdata_dict) <NEW_LINE> resname, stderr_data = _create_hil_reservation(HIL_RESERVE, t_start_s, t_end_s, env_dict, pdata_dict, jobdata_dict) <NEW_LINE> log_hil_reservation(...
Runs in Slurm control daemon prolog context Create HIL reserve reservation if it does not already exist. The HIL monitor will reserve the nodes and create the corresponding Slurm HIL release reservation. Reservation start and end times may overlap so long as the MAINT flag is set
625941ce32920d7e50b282f7
def add(a, b): <NEW_LINE> <INDENT> return make_rat([numer(a) * denom(b) + numer(b) * denom(a), denom(a) * denom(b)])
Takes 2 fractions and returns the sum as a fraction.
625941ce7d847024c06be3e3
def where_should_i_swim_v2(M, N, x, y): <NEW_LINE> <INDENT> if M < 0 or N < 0: <NEW_LINE> <INDENT> print("Looks like this is not a pool. Puzzling...") <NEW_LINE> return <NEW_LINE> <DEDENT> if x > M or x < 0 or y > N or y < 0: <NEW_LINE> <INDENT> print("Looks like I'm already out! Hurray") <NEW_LINE> return <NEW_LINE> <...
Source https://pythontutor.ru/lessons/ifelse/problems/jacob_the_swimmer/ Condition Yasha swam in a N × M meter pool and was tired. At that moment, he discovered that he was at a distance of x meters from one of the long sides (not necessarily from the nearest) and y meters from one of the short sides. What is the minim...
625941ce9b70327d1c4e0efc
def load_csv_file(self, csv_file, number_of_robot): <NEW_LINE> <INDENT> df = pd.read_csv(csv_file) <NEW_LINE> count = 0 <NEW_LINE> tmp = [] <NEW_LINE> for _, row in df.iterrows(): <NEW_LINE> <INDENT> if count < number_of_robot: <NEW_LINE> <INDENT> tmp.append(( int((Config.left_top[0] + row['0']) * (100 / self.cell_size...
load csv file data :param csv_file: csv file path :param number_of_robot: number of robot :return:
625941ced7e4931a7ee9e045
def train_epoch(self): <NEW_LINE> <INDENT> raise NotImplementedError
implement the logic of epoch: -loop ever the number of iteration in the config and call teh train step -add any summaries you want using the summary
625941ce8a43f66fc4b5418c
def get_objects(obj, obj_id, session): <NEW_LINE> <INDENT> if obj_id: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> query = session.query(obj).filter_by(id=obj_id).one() <NEW_LINE> <DEDENT> except NoResultFound: <NEW_LINE> <INDENT> msg = "{0} with id {1} does not exist".format(obj.__name__, obj_id) <NEW_LINE> raise falc...
Retrieve objects from database
625941ce85dfad0860c3af82
def can_be_used_for_substitution(self, is_math_type=False) -> (bool, Any): <NEW_LINE> <INDENT> if is_math_type: <NEW_LINE> <INDENT> math_type = self <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> math_type = self.math_type <NEW_LINE> <DEDENT> if math_type.is_equality(is_math_type=True) or math_type.is_iff...
Determines if a proposition can be used as a basis for substituting, i.e. is of the form (∀ ...)* a = b or (∀ ...)* P <=> Q with zero or more universal quantifiers at the beginning. This is a recursive function: in case self is a universal quantifier, self can_be_used_for_substitution iff the body of self c...
625941cef8510a7c17cf9824
def htmPredictionModelControlDisableSPLearningCb(htmPredictionModel): <NEW_LINE> <INDENT> assert isinstance(htmPredictionModel, HTMPredictionModel) <NEW_LINE> htmPredictionModel._getSPRegion().setParameter('learningMode', False) <NEW_LINE> return
Disables learning in the HTMPredictionModel's Spatial Pooler, while retaining the ability to re-enable SP learning in the future. See also: htmPredictionModelControlEnableSPLearningCb. See also: model_callbacks.modelControlFinishLearningCb. htmPredictionModel: pointer to a HTMPredictionModel instance Returns: nothi...
625941ce435de62698dfdd74
def fprop(self, inputs): <NEW_LINE> <INDENT> outputs = inputs <NEW_LINE> return outputs
Forward propagates activations through the layer transformation. For inputs `x` and outputs `y` this corresponds to `y = max(0, x)`.
625941cea79ad161976cc26d
def test_session_record_pipe_io_stdin(self): <NEW_LINE> <INDENT> text_in_stdio = 'print("hello world")\n' <NEW_LINE> text_out = "hello world" <NEW_LINE> p = Popen(['sshpass', '-p', 'Secret123', 'ssh', '-o', 'StrictHostKeyChecking=no', 'tlitestlocaluser2@localhost', 'python3'], stdout=PIPE, stdin=PIPE, stderr=PIPE, enco...
Pipe I/O through stdin
625941ce3d592f4c4ed1d194
def noOccurences(self): <NEW_LINE> <INDENT> currentPos = self.head <NEW_LINE> occurance = 0 <NEW_LINE> if currentPos is not None: <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> occurance += currentPos.occurance <NEW_LINE> if currentPos.next[0] is None: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> currentPos = cur...
complexity O(n)
625941ce44b2445a339321bd
def load_debugtalk_functions(): <NEW_LINE> <INDENT> imported_module = importlib.import_module("debugtalk") <NEW_LINE> return load_module_functions(imported_module)
load project debugtalk.py module functions debugtalk.py should be located in project working directory. Returns: dict: debugtalk module functions mapping { "func1_name": func1, "func2_name": func2 }
625941ce8c3a8732951584e2
def test_flow_transition_range(self): <NEW_LINE> <INDENT> checks = ((1 * u.m, 0 * u.m**2/u.s), (0 * u.m, 1 * u.m**2/u.s)) <NEW_LINE> for i in checks: <NEW_LINE> <INDENT> with self.subTest(i=i): <NEW_LINE> <INDENT> self.assertRaises(ValueError, pc.flow_transition, *i)
flow_transition should not accept inputs <= 0.
625941ce656771135c3eb996
def test_multiple_sampling_rates(self, image_path): <NEW_LINE> <INDENT> lines = [ "TIMESERIES XX_TEST__BHZ_R, 200 samples, 200 sps, " "2008-01-15T00:00:00.000000, SLIST, INTEGER, Counts", "TIMESERIES XX_TEST__BHZ_R, 50 samples, 50 sps, " "2008-01-15T00:00:00.900000, SLIST, INTEGER, Counts", "TIMESERIES XX_TEST__BHZ_R...
Check for multiple sampling rates
625941ce63d6d428bbe44617
def check_all_files_ready(self, context, files=None): <NEW_LINE> <INDENT> if not files: <NEW_LINE> <INDENT> files = data_access.SubmissionDataAccess.retrieve_all_files_for_submission(context.submission_id) <NEW_LINE> <DEDENT> results = {} <NEW_LINE> ready = True <NEW_LINE> for file_to_submit in files: <NEW_LINE> <INDEN...
Checks if all the files in this submission/list of files are ready to for the task in discussion. Returns a dict in which the key is the file id, and the value is a True/False.
625941ced268445f265b4f95
def test_create(self): <NEW_LINE> <INDENT> data = {'rel': [self.anchor.id]} <NEW_LINE> serializer = self.serializer_class(data=data) <NEW_LINE> self.assertEquals(serializer.is_valid(), True) <NEW_LINE> instance = serializer.save() <NEW_LINE> self.assertEquals(len(ManyToManyModel.objects.all()), 2) <NEW_LINE> self.asser...
Create an instance of a model with a ManyToMany relationship.
625941ce7d43ff24873a2dc7
def Evaluate(self, obj): <NEW_LINE> <INDENT> value = resource_property.Get(obj, self._key) <NEW_LINE> if self._transform: <NEW_LINE> <INDENT> value = self._transform.Evaluate(value) <NEW_LINE> <DEDENT> if value and isinstance(value, (list, tuple)): <NEW_LINE> <INDENT> resource_values = value <NEW_LINE> <DEDENT> else: <...
Evaluate a term node. Args: obj: The resource object to evaluate. Returns: The value of the operator applied to the key value and operand.
625941ceab23a570cc2502aa
def simple_drag_drop(): <NEW_LINE> <INDENT> from PyQt5.QtWidgets import (QPushButton, QWidget, QLineEdit, QApplication) <NEW_LINE> class Button(QPushButton): <NEW_LINE> <INDENT> def __init__(self, title, parent): <NEW_LINE> <INDENT> super().__init__(title, parent) <NEW_LINE> self.setAcceptDrops(True) <NEW_LINE> <DEDENT...
简单的拖拽
625941ce5fc7496912cc3aa5
def localcheck(): <NEW_LINE> <INDENT> local("curl -I %s" % (env.site))
Run the check on localhost
625941ce167d2b6e31218cbd
def max_pool_backward_naive(dout, cache): <NEW_LINE> <INDENT> dx = None <NEW_LINE> x, pool_param = cache <NEW_LINE> N, C, H, W = x.shape <NEW_LINE> HH, WW, stride = pool_param['pool_height'], pool_param['pool_width'], pool_param['stride'] <NEW_LINE> H_out = 1 + (H - HH) / stride <NEW_LINE> W_out = 1 + (W - WW) / strid...
A naive implementation of the backward pass for a max pooling layer. Inputs: - dout: Upstream derivatives - cache: A tuple of (x, pool_param) as in the forward pass. Returns: - dx: Gradient with respect to x
625941ceeab8aa0e5d26dc7f
def max(self): <NEW_LINE> <INDENT> assert self._root is not None, "Cannot find maximum of an empty BST" <NEW_LINE> node = self._root <NEW_LINE> while node._right is not None: <NEW_LINE> <INDENT> node = node._right <NEW_LINE> <DEDENT> value = deepcopy(node._value) <NEW_LINE> return value
------------------------------------------------------- Finds the maximum value in BST. (Iterative algorithm) Use: value = bst.max() ------------------------------------------------------- Returns: value - a copy of the maximum value in the BST (?) -------------------------------------------------------
625941ceec188e330fd5a8c6
def insert_debuggers(): <NEW_LINE> <INDENT> addons = (debugger, adebugger) <NEW_LINE> for addon in addons: <NEW_LINE> <INDENT> setattr(Comprende, addon.__name__, addon) <NEW_LINE> Comprende.lazy_generators.add(addon.__name__)
Copies the addons over into the ``Comprende`` class.
625941ce56b00c62f0f14781
def _search_with_article_tag(self): <NEW_LINE> <INDENT> tag = self.soup.article <NEW_LINE> if tag: <NEW_LINE> <INDENT> self.html = '{}'.format(tag) <NEW_LINE> logging.debug(" *** Found it with article tag !!! ***") <NEW_LINE> return True <NEW_LINE> <DEDENT> return False
Using HTML5 <article> tag Only works well with html5lib or lxml
625941cebe8e80087fb20d6a
def __delitem__(self, key): <NEW_LINE> <INDENT> if not self.rv(): <NEW_LINE> <INDENT> raise TypeError('Cannot delete records from non-record-varying ' 'variable.') <NEW_LINE> <DEDENT> hslice = _Hyperslice(self, key) <NEW_LINE> if hslice.dims > 1 and (hslice.counts[1:] != hslice.dimsizes[1:]).any(): <NEW_LINE> <INDENT> ...
Removes a record (or set of records) from the CDF Only whole records can be deleted, so the del call must either specify only one dimension or it must specify all elements of the non-record dimensions. This is *not* a way to resize a variable! Deleting records from the middle of a variable may be very slow in some ci...
625941ce30dc7b7665901a8e
def get_hit_ship_field(self): <NEW_LINE> <INDENT> return self.hit_ship_field
Tells how many field containing ships was hit
625941ceb830903b967e9a32
def test_AttributeError(self): <NEW_LINE> <INDENT> for Input in [self.AllInt, self.AllFloat, self.Mixed, self.IntErr, self.FloatErr, self.MixedErr, self.TotalMixed]: <NEW_LINE> <INDENT> objTest = self.TestClass(Input) <NEW_LINE> for Attr, _ in self.Properties: <NEW_LINE> <INDENT> with self.assertRaises(AttributeError):...
Checks that it is not possible to delete properties or methods, or to assign to read-only properties Tests ID: TEST-T-312 Requirements ID: REQ-AWM-302 Version 1.0.0.0
625941cecc0a2c11143dcfb8
def read_line(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> newline_idx = self.buf.find(b"\n") <NEW_LINE> if newline_idx >= 0: <NEW_LINE> <INDENT> res = self.buf[:newline_idx] <NEW_LINE> self.buf = self.buf[newline_idx + 1:] <NEW_LINE> return res <NEW_LINE> <DEDENT> chunk = self.f.recv(4096) <NEW_LINE> if ...
Consume one line from the stream.
625941ce29b78933be1e57d3
@addToClass(hou.Geometry) <NEW_LINE> def setPointStringAttribValues(self, name, values): <NEW_LINE> <INDENT> attrib = self.findPointAttrib(name) <NEW_LINE> if attrib is None: <NEW_LINE> <INDENT> raise hou.OperationFailed("Invalid attribute name.") <NEW_LINE> <DEDENT> if attrib.dataType() != hou.attribData.String: <NEW_...
Set the string attribute values for all points. Args: name : (string) The name of the point attribute. values : (tuple) A tuple of strings representing the attribute values for each point. Raises: hou.OperationFailed Raise this exception if the attribute name is invalid, th...
625941ce60cbc95b062c666b
def isbusday(self, date): <NEW_LINE> <INDENT> return self.isworkday(date) and not self.isholiday(date)
Check if a given date is a business date, taking into consideration the work days and holidays. Args: date (date, datetime or str): Date to be checked. Returns: bool: True if the date is a business date, False otherwise.
625941cea934411ee37517bb
def __init__(self, rule): <NEW_LINE> <INDENT> if isinstance(rule, str): <NEW_LINE> <INDENT> content = map(lambda x: x.split(), open(rule).readlines()) <NEW_LINE> content = filter(lambda x: len(x) == 2, content) <NEW_LINE> rule = list(map(lambda x: (x[0], float(x[1])), content)) <NEW_LINE> <DEDENT> assert isinstance(rul...
Channel Pruner for VGG :param rule: str, path to the rule file, each line formats 'module_name sparsity' list of tuple, [(module_name(str), sparsity(float))]
625941ce0a50d4780f666fba
def KFoldCVPSO(XData,YData,Splits,SwarmSize,Iterations,Inertia=0.5,Social=0.25,Cognitive=0.25): <NEW_LINE> <INDENT> Swarm=np.random.random((SwarmSize,4)) <NEW_LINE> Velocity=np.random.random((SwarmSize,4)) <NEW_LINE> bestSwarm,bestFitness=EvaluateSwarmFitness(XData,YData,Swarm,Splits) <NEW_LINE> bestGFitness=np.min(bes...
Parameters ---------- XData : array Train Data. YData : array Train labels. Splits : int number of splits for k fold. SwarmSize : int number of particles in the swarm. Iterations : int Iterations for PSO. Inertia : float, optional Inertia Constant. The default is 0.5. Social : float, optional ...
625941ce21a7993f00bc7e17
def GetForwardingPipelineConfig(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!')
Gets the current P4 fowarding-pipeline config.
625941ce0fa83653e46570e3
def create_html_redirect_file( relative_url: str, dest: str, ) -> Optional[str]: <NEW_LINE> <INDENT> redirect_file = os.path.join(dest, 'index.html') <NEW_LINE> return expand_template_file('redirect.html', redirect_file, {'url': relative_url})
Create HTML redirect file. :param relative_url: the relative URL to redirect to :param dest: the destination directory in which to put the file :return: the path of the created file, or None if it failed
625941ce4428ac0f6e5ba91a
def train(self, is_gpu=False, no_aug=False): <NEW_LINE> <INDENT> logger.info( "starting train model in {} mode ...".format("CUDA" if is_gpu else "CPU") ) <NEW_LINE> model = self.get_model() <NEW_LINE> loss_net = self.get_loss() <NEW_LINE> model.train() <NEW_LINE> if is_gpu is True: <NEW_LINE> <INDENT> model = model.cud...
用于训练模型
625941ce66673b3332b921b9
def main(): <NEW_LINE> <INDENT> MIDDLE.run()
Runs game.
625941ce566aa707497f4690
def _version_handshake(self): <NEW_LINE> <INDENT> versions = ['1.1'] <NEW_LINE> self._logger.debug(f'Sending version list: {versions}') <NEW_LINE> self._send_res(WispResponse.OK, versions) <NEW_LINE> req = self._parse_request() <NEW_LINE> if req.cmd != WispRequest.VERSION: <NEW_LINE> <INDENT> self._logger.error('Invali...
Sync function for negociating version, called after client connects
625941ce099cdd3c635f0d82
def _write_proxy_conf(proxyfile): <NEW_LINE> <INDENT> msg = 'Invalid value for proxy file provided!, Supplied value = {0}' .format(proxyfile) <NEW_LINE> log.trace('Salt Proxy Module: write proxy conf') <NEW_LINE> if proxyfile: <NEW_LINE> <INDENT> log.debug('Writing proxy conf file') <NEW_LINE> with salt.utils.fi...
write to file
625941cecdde0d52a9e5315b
def connection(self, *arg, **url): <NEW_LINE> <INDENT> conn = psycopg2.connect(url) <NEW_LINE> return conn
connect to postgres database
625941ce004d5f362079a45a
def Dispose(self): <NEW_LINE> <INDENT> pass
Dispose(self: CompoundStructureLayer)
625941ceac7a0e7691ed41f4
def is_replaceable(self, refobj): <NEW_LINE> <INDENT> return True
Return whether the given reference of the refobject is replaceable or if it should just get deleted and loaded again. Returns True, because Maya can replace references. :param refobj: the refobject to query :type refobj: refobj :returns: True, if replaceable :rtype: bool :raises: NotImplementedError
625941cedd821e528d63b2d1
def initialize_with_configuration(config): <NEW_LINE> <INDENT> global _tcf_enclave_info <NEW_LINE> global _ias <NEW_LINE> global logger <NEW_LINE> enclave._SetLogger(logger) <NEW_LINE> valid_keys = set(['spid', 'ias_url', 'ias_api_key']) <NEW_LINE> found_keys = set(config.keys()) <NEW_LINE> missing_keys = valid_keys.di...
Create and Initialize a SGX enclave with passed config
625941ceeab8aa0e5d26dc80
def dispatch(self): <NEW_LINE> <INDENT> method = self.request.method <NEW_LINE> if method == 'GET': <NEW_LINE> <INDENT> self.csrf_token = make_token() <NEW_LINE> self.values['csrf_token'] = self.csrf_token <NEW_LINE> <DEDENT> if method == 'POST' or method == 'PUT' or method == 'DELETE': <NEW_LINE> <INDENT> if not token...
Make a CSRF token for GET requests and verify it for mutators.
625941ce004d5f362079a45b
def __init__(self, *item: Mapping[K, V] | Iterable[Tuple[K, V]], **kwargs: V) -> None: <NEW_LINE> <INDENT> if len(item) > 1: <NEW_LINE> <INDENT> raise ValueError( f"FrozenDict was called with {len(item)} positional arguments but it expects one." ) <NEW_LINE> <DEDENT> self._data = dict(item[0]) if item else dict() <NEW_...
Creates a `FrozenDict` with arguments accepted by `dict` that also must be hashable.
625941ce498bea3a759b9bd7
def create_plagiarism_checker(code1,code2,language): <NEW_LINE> <INDENT> return checker_class_to_use(code1,code2,language)
:param code1: :param code2: :param language: :return: a plagiarism checker according to the DEFAULT_PLAGIARISM_CHECKER
625941cef8510a7c17cf9825
@receiver(post_authenticate) <NEW_LINE> def verify_bachelor_role(user, claims, adfs_response, *args, **kwargs): <NEW_LINE> <INDENT> token_group_mapping = dict(zip(claims["groupsid"], claims["group"])) <NEW_LINE> update_group_verbose_names(token_group_mapping) <NEW_LINE> if settings.STUDENT_AUTH_GROUP_VERBOSE_NAME in cl...
Remove student account from non-bachelor students
625941ce8a349b6b435e829b
def quit(self, message): <NEW_LINE> <INDENT> self.backend.send_quit(reason=message) <NEW_LINE> self.hasquit = True
Disconnect from IRC and close the bot.
625941ce29b78933be1e57d4
def read_pofile(pofile): <NEW_LINE> <INDENT> header = {} <NEW_LINE> read_header = False <NEW_LINE> for line in open(pofile): <NEW_LINE> <INDENT> line = line[:-1] <NEW_LINE> if line[:5] == 'msgid': <NEW_LINE> <INDENT> if read_header: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> read_header = True <NEW_LINE> continue <N...
Read the header of the pofile and return it as a dictionary
625941ced10714528d5ffe0b
def run(self, context): <NEW_LINE> <INDENT> pass
void Plasma.QueryMatch.run(Plasma.RunnerContext context)
625941ced18da76e235325fe
def send_message(self, messages, reply_chat, reply_msg): <NEW_LINE> <INDENT> list(self.send_messages(messages, reply_chat=reply_chat, reply_msg=reply_msg)) <NEW_LINE> return None
Backwards compatible version of send_messages. :param messages: :param reply_chat: chat id :type reply_chat: int :param reply_msg: message id :type reply_msg: int :return: None
625941cebf627c535bc132f7
def slim_recursion(self, grid, component, *, prefactor=False): <NEW_LINE> <INDENT> D = self._dimension <NEW_LINE> Pi = self.get_parameters(component=component) <NEW_LINE> q, p, Q, P, _ = Pi <NEW_LINE> Qinv = inv(Q) <NEW_LINE> Qbar = conjugate(Q) <NEW_LINE> QQ = dot(Qinv, Qbar) <NEW_LINE> bas = self._basis_shapes[compon...
Evaluate the Hagedorn wavepacket :math:`\Psi` at the given nodes :math:`\gamma`. This routine is a slim version compared to the full basis evaluation. At every moment we store only the data we really need to compute the next step until we hit the highest order basis functions. :param grid: The grid :math:`\Gamma` cont...
625941ce9b70327d1c4e0efd
def score_for_learner(self, learner): <NEW_LINE> <INDENT> evalsheet = uuidToObject(self.evaluationsheet_uid) <NEW_LINE> score_total = 0 <NEW_LINE> activity_count = 0 <NEW_LINE> scales_total = 0 <NEW_LINE> score_percentages = [] <NEW_LINE> contentFilter = {'portal_type': 'upfront.assessment.content.evaluation'} <NEW_LIN...
returns the score of a learner for the a certain evaluationsheet in the specified classlist result is - name, score, percentage, rating code
625941ce7b25080760e39581
def extract_all_files(): <NEW_LINE> <INDENT> print(Fore.MAGENTA + "\nBegin Looking for files in directory") <NEW_LINE> output_directory = PATH_TO_SCRIPT_ + "argos-demo/zprocessed_files/" <NEW_LINE> all_files = [] <NEW_LINE> listdir = os.listdir(output_directory) <NEW_LINE> listdir = sorted(listdir) <NEW_LINE> for filen...
Retrieve file paths pointing to csv
625941ce3c8af77a43ae38c9
def test_set_mf_defaults_csa(self): <NEW_LINE> <INDENT> pipes.switch('mf') <NEW_LINE> self.value_fns.set(param='csa') <NEW_LINE> self.assertEqual(cdp.mol[0].res[0].spin[0].csa, -172 * 1e-6) <NEW_LINE> self.assertEqual(cdp.mol[0].res[1].spin[0].csa, -172 * 1e-6)
Set the model-free CSA parameter to the default value. The functions tested are both pipe_control.value.set() and prompt.value.set().
625941ce1f037a2d8b946326
def generate_keys(self, key_size=KEY_SIZE): <NEW_LINE> <INDENT> success = self.rsa.GenerateKey(KEY_SIZE) <NEW_LINE> if (success != True): <NEW_LINE> <INDENT> print(self.rsa.lastErrorText()) <NEW_LINE> sys.exit() <NEW_LINE> <DEDENT> self.publicKey = self.rsa.exportPublicKey() <NEW_LINE> self.privateKey = self.rsa.export...
Generate a public and private key pair of a certain key size
625941ce63f4b57ef0001241
def requireParams(self, required, provided=None): <NEW_LINE> <INDENT> if isinstance(required, str): <NEW_LINE> <INDENT> required = (required,) <NEW_LINE> <DEDENT> for param in required: <NEW_LINE> <INDENT> if provided is None or param not in provided: <NEW_LINE> <INDENT> raise Exception('Parameter "%s" is required.' % ...
Raises an Exception if the required parameter(s) does not appear in the passed parameters. :param required: An iterable of required params, or if just one is required, you can simply pass it as a string. :type required: list, tuple, or str :param provided: The list of provided parameters. :type provided: dict
625941ce5fcc89381b1e17e7
def transforms_wordtokenizer( data, output_data=None, model=None, column=None, char_array_term_separators=None, **params): <NEW_LINE> <INDENT> entrypoint_name = 'Transforms.WordTokenizer' <NEW_LINE> inputs = {} <NEW_LINE> outputs = {} <NEW_LINE> if column is not None: <NEW_LINE> <INDENT> inputs['Column'] = try_set( obj...
**Description** The input to this transform is text, and the output is a vector of text containing the words (tokens) in the original text. The separator is space, but can be specified as any other character (or multiple characters) if needed. :param column: New column definition(s) (inputs). :param da...
625941ce462c4b4f79d1d7f9
def play_sound(self, sound): <NEW_LINE> <INDENT> if sound not in self._sounds: <NEW_LINE> <INDENT> if os.path.isfile(sound): <NEW_LINE> <INDENT> src = sound <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> src = resource_filename(__name__, 'data/sounds/%s.ogg' % sound) <NEW_LINE> <DEDENT> media_src = Phonon.MediaSource(sr...
Play a sound using phonon.
625941ce0a50d4780f666fbb
def get_user(self): <NEW_LINE> <INDENT> return USER_CLASSES[self.object_type].objects.get(pk=self.object_id)
Return the user instance that is defined by the favorite.
625941ce24f1403a92600c8e
def add_tests(suite): <NEW_LINE> <INDENT> suite.addTest(BaseThreadTest('test_noerror'))
Add tests to the unittest suite
625941cee64d504609d74968
def randomized_svd(M, n_components, n_oversamples=10, n_iterations=0, transpose='auto', random_state=0): <NEW_LINE> <INDENT> random_state = check_random_state(random_state) <NEW_LINE> n_random = n_components + n_oversamples <NEW_LINE> n_samples, n_features = M.shape <NEW_LINE> if transpose == 'auto' and n_samples > n_f...
Computes a truncated randomized SVD Parameters ---------- M: ndarray or sparse matrix Matrix to decompose n_components: int Number of singular values and vectors to extract. n_oversamples: int (default is 10) Additional number of random vectors to sample the range of M so as to ensure proper conditio...
625941cefff4ab517eb2f564
def dumps(self, obj, salt=None): <NEW_LINE> <INDENT> payload = want_bytes(self.dump_payload(obj)) <NEW_LINE> rv = self.make_signer(salt).sign(payload) <NEW_LINE> if self.is_text_serializer: <NEW_LINE> <INDENT> rv = rv.decode("utf-8") <NEW_LINE> <DEDENT> return rv
Returns a signed string serialized with the internal serializer. The return value can be either a byte or unicode string depending on the format of the internal serializer.
625941ce21bff66bcd684a7b
def __get_backup_source_paths(self): <NEW_LINE> <INDENT> home_path = self.get_home_path() <NEW_LINE> source_paths_file_location = self.get_value('config_list_path') <NEW_LINE> source_paths = list() <NEW_LINE> with open(source_paths_file_location, 'r') as source_paths_file: <NEW_LINE> <INDENT> for source_path in source_...
Get the list of configuration source paths from where we have to backup/copy configurations
625941cefff4ab517eb2f565
def isAnagram(self, s, t): <NEW_LINE> <INDENT> lower_alpha = [chr(i) for i in range(97,123)] <NEW_LINE> s_array = [] <NEW_LINE> t_array = [] <NEW_LINE> for i in range(26): <NEW_LINE> <INDENT> s_array.append(s.count(lower_alpha[i])) <NEW_LINE> t_array.append(t.count(lower_alpha[i])) <NEW_LINE> <DEDENT> if s_array == t_a...
:type s: str :type t: str :rtype: bool
625941ce2eb69b55b151c9d8
def __init__(self, channel): <NEW_LINE> <INDENT> self.GetSharedSet = channel.unary_unary( '/google.ads.googleads.v2.services.SharedSetService/GetSharedSet', request_serializer=google_dot_ads_dot_googleads__v2_dot_proto_dot_services_dot_shared__set__service__pb2.GetSharedSetRequest.SerializeToString, response_deserializ...
Constructor. Args: channel: A grpc.Channel.
625941ced7e4931a7ee9e046
def export_crawler_tasks(request): <NEW_LINE> <INDENT> source = request.GET.get("source") <NEW_LINE> crawler_tasks = CrawlerTasks.objects.filter(source=source) <NEW_LINE> filename, tmp_file = process_export_excel(source, crawler_tasks) <NEW_LINE> excel_data = tmp_file.getStream() <NEW_LINE> tmp_file.close() <NEW_LINE> ...
按照任务ID,导出数据采集的结果 导出结果包括: 简历列表(名称、ID),简历第一次添加时更新时间、后续所有的更新时间
625941ce96565a6dacc8f7f4
def get_artifact(self, path): <NEW_LINE> <INDENT> content = None <NEW_LINE> artifact_list = self.assign_artifact_links(path) <NEW_LINE> if not artifact_list: <NEW_LINE> <INDENT> with self.container.create_bucket_storage() as storage: <NEW_LINE> <INDENT> content = storage.get_artifact(path) <NEW_LINE> content.request_id...
Gets artifact or artifact list information. Args: path(string): path or name of artifact. Returns: shelf.cloud.StreamIterator|None
625941ce15fb5d323cde0c39
def get_science(conn, group, heroes, hero_id, check): <NEW_LINE> <INDENT> if check == 1: <NEW_LINE> <INDENT> new_group = dict() <NEW_LINE> g_gold = group.get('g_gold') <NEW_LINE> used_gold = 50 * len(hero_id) <NEW_LINE> if g_gold < used_gold: <NEW_LINE> <INDENT> if group.get('g_status') == 1: <NEW_LINE> <INDENT> print(...
势力科技操作 :param conn: :param group: :param heroes: :param hero_id: :param check: :return: group
625941ce99fddb7c1c9de4b9
def update_results_display(self, max_a=-1.0): <NEW_LINE> <INDENT> self.outer_time_line_edit.setText(str(self.qr_polytraj.outer_opt_time)) <NEW_LINE> comp_time = 0.0 <NEW_LINE> for key in self.qr_polytraj.quad_traj.keys(): <NEW_LINE> <INDENT> comp_time += self.qr_polytraj.quad_traj[key].opt_time <NEW_LINE> <DEDENT> self...
Set text for comp time and iterations to display in the GUI
625941ced99f1b3c44c676b7
def __next__(self): <NEW_LINE> <INDENT> if len(self.container) > 0: <NEW_LINE> <INDENT> return self.container.pop() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise StopIteration
Selects, removes, and returns a path on the frontier if there is any. If there nothing to return this should raise a StopIteration exception.
625941ce4428ac0f6e5ba91b
def myPow2(x, n): <NEW_LINE> <INDENT> if n == 0: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> elif n > 0: <NEW_LINE> <INDENT> return power(x, n) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 1.0 / power(x, -1 * n)
这种方式在理论上可行,实际上在本地python环境中会出现递归深度超出限制的情况,可是在leetcode中运行通过 :param x: :param n: :return:
625941ce3cc13d1c6d3c74a3
@pytest.mark.ckan_config('ckan.plugins', 'dcor_schemas') <NEW_LINE> @pytest.mark.usefixtures('clean_db', 'with_plugins', 'with_request_context') <NEW_LINE> def test_ipermissionlabels_user_group_see_privates(create_with_upload): <NEW_LINE> <INDENT> user_a = factories.User() <NEW_LINE> user_b = factories.User() <NEW_LINE...
Allow a user A to see user B's private dataset if the private dataset is in a group that user A is a member of.
625941ce97e22403b379d0c2
def join_before_transaction(callable_, *args, **kwargs): <NEW_LINE> <INDENT> return _join_to_transaction('before', callable_, *args, **kwargs)
Call ``callable_(*args, **kwargs)`` before the current transaction commits. Setup:: >>> from mock import Mock >>> from pyramid_weblayer import tx >>> _original = tx._join_to_transaction >>> tx._join_to_transaction = Mock() >>> tx._join_to_transaction.return_value = None Test:: >>> join_befor...
625941ced8ef3951e3243666
def check_X_recessive(variant, family): <NEW_LINE> <INDENT> for individual in family.individuals: <NEW_LINE> <INDENT> individual_genotype = variant['Genotypes'].get(individual, genotype.Genotype()) <NEW_LINE> if not family.individuals[individual].affected: <NEW_LINE> <INDENT> if individual_genotype.homo_alt: <NEW_LINE>...
Check if the variant follows the x linked heterozygous pattern of inheritance in this family.
625941ce0a366e3fb873e943
def get_size (self): <NEW_LINE> <INDENT> return len (self.__param_list)
Returns the number of elements.
625941ce26238365f5f0ef97
def expmers(self, fworrev, size): <NEW_LINE> <INDENT> temp = unique_mers(self.exposedsequence, size) <NEW_LINE> if fworrev == 'rev': <NEW_LINE> <INDENT> return reverse_complement(temp, 'DNA') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return temp
collects all of the unique mers of a given size in either forward or reverse orientation that are exposed
625941cef7d966606f6aa12d
def _sigmoid_function_with_activations(self, data): <NEW_LINE> <INDENT> output = data <NEW_LINE> activations = [] <NEW_LINE> for i in range(0, len(self.theta)): <NEW_LINE> <INDENT> activations += [output] <NEW_LINE> output = self.sigmoid_base(np.array(output).dot(np.array(self.theta[i]).T)) <NEW_LINE> if i != len(self....
:return: in difference to logistic_regression sigmoid function returns activations functions for each layer as well as the predicted values from output layer
625941ce1f5feb6acb0c4c79
def put_to_scratch_buffer(output): <NEW_LINE> <INDENT> scratch = scratch_buffer() <NEW_LINE> for line in output.split("\n"): <NEW_LINE> <INDENT> scratch.append(line) <NEW_LINE> <DEDENT> return scratch
Create a new scratch buffer and output the `output` string to it.
625941cef8510a7c17cf9826
def _update_compilations_setting(self, widget, state): <NEW_LINE> <INDENT> Lp().settings.set_value("show-compilations", GLib.Variant("b", state))
Update compilations setting @param widget as Gtk.Switch @param state as bool
625941ceb7558d58953c503d
def query_to_sql(query): <NEW_LINE> <INDENT> from psycopg2.extensions import adapt as sqlescape <NEW_LINE> statement = query.statement.compile(dialect=query.session.bind.dialect) <NEW_LINE> dialect = query.session.bind.dialect <NEW_LINE> enc = dialect.encoding <NEW_LINE> params = {} <NEW_LINE> for k, v in statement.par...
Convert a sqlalchemy query to raw SQL. https://stackoverflow.com/questions/4617291/how-do-i-get-a-raw-compiled-sql-query-from-a-sqlalchemy-expression
625941ce85dfad0860c3af84
def __div__(self, other): <NEW_LINE> <INDENT> if np.isscalar(other): <NEW_LINE> <INDENT> name = '{:s} / {}'.format(self.name, other) <NEW_LINE> return Distribution(self._x, self._pdf / other, name=name) <NEW_LINE> <DEDENT> elif isinstance(other, Distribution): <NEW_LINE> <INDENT> x0 = self._x <NEW_LINE> pdf0 = self._pd...
multiply distribution
625941ce187af65679ca5248
def coordinateListToWKTPolygon(coordinates): <NEW_LINE> <INDENT> nodes = [] <NEW_LINE> for i in range(0, len(coordinates)): <NEW_LINE> <INDENT> nodes.append(coordinates[i]) <NEW_LINE> <DEDENT> nodes.append(coordinates[0]) <NEW_LINE> return 'Polygon((' + (', '.join(nodes)) + '))'
doStringPolygon.
625941ce63b5f9789fde720f
def compare(lhs, rhs): <NEW_LINE> <INDENT> if lhs == None: <NEW_LINE> <INDENT> if rhs == None: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> if rhs == None: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <IN...
Implements cmp() for Python 2 and 3 alike
625941ce4a966d76dd551139
def ResourceArgsParser(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description=__doc__) <NEW_LINE> input_opts = parser.add_argument_group('Input options') <NEW_LINE> output_opts = parser.add_argument_group('Output options') <NEW_LINE> build_utils.AddDepfileOption(output_opts) <NEW_LINE> input_opts.add_argum...
Create an argparse.ArgumentParser instance with common argument groups. Returns: A tuple of (parser, in_group, out_group) corresponding to the parser instance, and the input and output argument groups for it, respectively.
625941ce3317a56b86939d81
def bin_lst(bin_start,bin_end,lst_tally): <NEW_LINE> <INDENT> bin_hrs=np.zeros(len(bin_start)) <NEW_LINE> for i in range(0,len(bin_start)): <NEW_LINE> <INDENT> for j in range(0,len(lst_tally)): <NEW_LINE> <INDENT> if bin_start[i] <= lst_tally[j][0] <= bin_end[i] and bin_start[i] <= lst_tally[j][1] <= bin_end[i]: <NEW_L...
Bins LST blocks for histogram creation.
625941ce44b2445a339321bf
def test_new_post_button(self): <NEW_LINE> <INDENT> self.assertIsNotNone(self.page.new_post_button) <NEW_LINE> self.page.click_new_post_button() <NEW_LINE> self.assertIsNotNone(self.page.new_post_form)
Scenario: I can create new posts from the Discussion home page. Given that I am on the Discussion home page When I click on the 'New Post' button Then I should be shown the new post form
625941ce21bff66bcd684a7c
def parse(self,response): <NEW_LINE> <INDENT> page_list = response.xpath('//ul[@class="pagination"]/li/a/@href') <NEW_LINE> last_num = page_list[-2].extract() <NEW_LINE> num = int(last_num.rsplit("?",1)[0].rsplit("/",1)[1]) <NEW_LINE> pRange = range(1,num+1) <NEW_LINE> for page in pRange: <NEW_LINE> <INDENT> page_url =...
获取页面链接 :param response: :return:
625941cee64d504609d74969
def check_group(ctx, param, value): <NEW_LINE> <INDENT> group = ctx.obj.api.relay_groups(value) <NEW_LINE> if len(group) == 1: <NEW_LINE> <INDENT> return group[0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise click.BadParameter( "The relay group '{}' does not exist".format(value))
Verify that a single relay group exists and return it.
625941cec432627299f04d6f