code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def update_attributes(self, username, hostname, user_attrs): <NEW_LINE> <INDENT> LOG.debug("Changing user attributes on Instance %s.", self.id) <NEW_LINE> self._cast("update_attributes", username=username, hostname=hostname, user_attrs=user_attrs)
Update user attributes.
625941e1379a373c97cfaef2
def shareMatchCameras(self): <NEW_LINE> <INDENT> matchinters = ["onecammatch", "multiview"] <NEW_LINE> try: <NEW_LINE> <INDENT> for inter in matchinters: <NEW_LINE> <INDENT> self.cameras[inter] = self.cameras["match"] <NEW_LINE> <DEDENT> <DEDENT> except KeyError: <NEW_LINE> <INDENT> print("'match' key does not exist. W...
Copies match interface cameras to two specific interfaces which won't be used in competition
625941e17d847024c06be66b
def get_articles_total(): <NEW_LINE> <INDENT> articles = (p for p in pages if 'published' in p.meta) <NEW_LINE> length = sum(1 for _ in articles) <NEW_LINE> return length
Get the total number of articles :return: total number of articles
625941e130bbd722463cc173
def stepETAUpdate(build, step, ETA, expectations): <NEW_LINE> <INDENT> pass
This is a periodic update on the progress this Step has made towards completion. It gets an ETA (in seconds from the present) of when the step ought to be complete, and a list of expectation tuples (as returned by IBuildStepStatus.getExpectations) with more detailed information.
625941e17cff6e4e81117d31
def preorderCheck(preOrderList): <NEW_LINE> <INDENT> newList = [] <NEW_LINE> preDict = {} <NEW_LINE> for root in preOrderList: <NEW_LINE> <INDENT> if not root in newList: <NEW_LINE> <INDENT> newList.append(root) <NEW_LINE> <DEDENT> <DEDENT> for x in range(len(newList)): <NEW_LINE> <INDENT> currentRoot = newList[x][0] <...
This takes a list from preorderDTLsort and removes the duplicate tuples
625941e1956e5f7376d71217
def extend(self, *args, **kwargs): <NEW_LINE> <INDENT> return _cmf_core.connection_list_extend(self, *args, **kwargs)
extend(connection_list self, connection_list connections) void extend(const connection_list &connections)
625941e1167d2b6e31218f40
def test_points(self): <NEW_LINE> <INDENT> nptest.assert_array_almost_equal(self.points, util.meshgrid_ndim(self.interior_and_layer1))
Test that the points are correct.
625941e197e22403b379d347
def __str__(self): <NEW_LINE> <INDENT> return '{0:.3f}'.format(self.elapsed)
Reports time in seconds up to three decimal places
625941e107f4c71912b11830
def matched_attribute(self, match, host): <NEW_LINE> <INDENT> if self.attribute_match is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> groupid = int(self.attribute_match) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDE...
Return the matched attribute
625941e13617ad0b5ed682a2
def request(self, url, method, params={}): <NEW_LINE> <INDENT> postdata = self.set_authorization(params) <NEW_LINE> if method == 'get': <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> res = requests.get(url, headers=self.headers, params=postdata) <NEW_LINE> requests_data = json.loads(res.text) <NEW_LINE> return requests_d...
url:访问的api method:可选'get','post','delete' params: 传递的参数(不需要填写access_id与tonce两个参数) return: 访问成功返回一个json列表,失败返回空字典 该方法在Trade_API与Account_API中可直接调用,无须再次调用前面的方法
625941e1b5575c28eb68e3af
def load(target, toplevel=True): <NEW_LINE> <INDENT> logging.debug('Loading Target: %s', target) <NEW_LINE> basename = os.path.basename(target) <NEW_LINE> if os.path.isfile(target): <NEW_LINE> <INDENT> if toplevel: <NEW_LINE> <INDENT> return _load_file(target) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return {os.pa...
Load a directory or file containing artifacts. The `target` can be a directory or file, and can contain plain yaml, or canonicalized artifact data. If a directory is specified, it will be walked recursively and all files will be loaded into the return data structure. Args: target (str): The directory or file to ...
625941e1e76e3b2f99f3abb1
def apply_creation_date(self, file_stats: os.stat_result) -> bool: <NEW_LINE> <INDENT> creation_time = file_stats[ST_CTIME] <NEW_LINE> expected_creation_time = self._get_timestamp_from_datestring(self._filter_creation_date.value) <NEW_LINE> if self._filter_creation_date.cmp_func(creation_time, expected_creation_time): ...
Apply creation date option :param file_stats: :return:
625941e1dd821e528d63b552
def audioVolumeLinear(data, maximum_start, maximum_end): <NEW_LINE> <INDENT> if (maximum_start < 0) or (maximum_start > 1) or (maximum_end < 0) or (maximum_end > 1): <NEW_LINE> <INDENT> raise ValueError('The maximum should be between 0 and 1.') <NEW_LINE> <DEDENT> maximum = np.linspace(maximum_start, maximum_end, num=l...
Set the maximum volume of the audio linearly regarding the time. :param np.ndarray data: The audio's data point. One channel, which means the length of the shape should be one. :param float maximum_start: The maximum volume at the beginning. :param float maximum_end: The maximum volume in the end. :return: Transf...
625941e1baa26c4b54cb14c8
def upper_first_char(x): <NEW_LINE> <INDENT> return x[0].upper() + x[1:]
Capitalize first letter in string. :param x: text in :return: text out
625941e1f9cc0f698b1409a4
def generate_build_system(source_dir: pathlib.Path, build_dir: pathlib.Path, profile: str) -> None: <NEW_LINE> <INDENT> _check_ninja_found() <NEW_LINE> _cmake_wrapper("-S", str(source_dir), "-B", str(build_dir), "-GNinja", f"-DCMAKE_BUILD_TYPE={profile}")
Configure a project using CMake. Args: source_dir: Path to the CMake source tree. build_dir: Path to the CMake build tree. profile: The Mbed build profile (develop, debug or release).
625941e163f4b57ef00014ba
def _get_coefficients(linear_model, model): <NEW_LINE> <INDENT> pp = model.find('PPMatrix') <NEW_LINE> params = model.find('ParamMatrix') <NEW_LINE> def coefficient_for_parameter(p): <NEW_LINE> <INDENT> if not p: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> pcells = params.findall(f"PCell[@parameterName='{p}']") <N...
Obtain the coefficients for the GLM regression. Raises an exception when we notice non linear parameter configurations. Parameters ---------- linear_model : PMMLGeneralizedLinearRegressor, PMMLGeneralizedLinearClassifier The PMML class representing the classifier. Should contain at least target_field, fields ...
625941e14a966d76dd5513be
def device_get_config(self, filters={}): <NEW_LINE> <INDENT> return {}
Retrieve entire device current configuration
625941e110dbd63aa1bd2f4e
def init_(iline, vline, vnc, path, pos): <NEW_LINE> <INDENT> iline.set_data([], []) <NEW_LINE> vline.set_data([], []) <NEW_LINE> vnc.set_data([], []) <NEW_LINE> path.set_data([], []) <NEW_LINE> pos.set_data([], []) <NEW_LINE> return iline, vline, vnc, path, pos
Animation function to initialize all animated lines
625941e1435de62698dfdff9
def cc_bin(**kwargs): <NEW_LINE> <INDENT> Rules.AddRule(kwargs, 'cc_bin')
Processes the cc_bin rule. Receives all the arguments as a dict.
625941e1851cf427c661a8b8
def _single_frame(self): <NEW_LINE> <INDENT> pass
Calculate data from a single frame of trajectory Don't worry about normalising, just deal with a single frame.
625941e1293b9510aa2c363e
def __init__(self, iface): <NEW_LINE> <INDENT> self.iface = iface <NEW_LINE> self.plugin_dir = os.path.dirname(__file__) <NEW_LINE> locale = QSettings().value('locale/userLocale')[0:2] <NEW_LINE> locale_path = os.path.join( self.plugin_dir, 'i18n', 'WKTLayer_{}.qm'.format(locale)) <NEW_LINE> if os.path.exists(locale_pa...
Constructor. :param iface: An interface instance that will be passed to this class which provides the hook by which you can manipulate the QGIS application at run time. :type iface: QgsInterface
625941e107d97122c4178c3f
def kthSmallest(self, root, k): <NEW_LINE> <INDENT> def inOrder(root, kList): <NEW_LINE> <INDENT> if root: <NEW_LINE> <INDENT> inOrder(root.left, kList) <NEW_LINE> kList.append(root.val) <NEW_LINE> inOrder(root.right, kList) <NEW_LINE> <DEDENT> return kList <NEW_LINE> <DEDENT> kthList = inOrder(root,[]) <NEW_LINE> retu...
:type root: TreeNode :type k: int :rtype: int
625941e1d4950a0f3b08c6f6
def colors(): <NEW_LINE> <INDENT> return ['red', 'blue', 'green', 'yellow', 'orange', 'purple', 'brown', 'black', 'pink']
Returns a list of colors.
625941e1cc40096d61595cfb
def debug_func(func): <NEW_LINE> <INDENT> @functools.wraps(func) <NEW_LINE> def wrapped(*args, **wargs): <NEW_LINE> <INDENT> res = func(*args, **wargs) <NEW_LINE> print(func.__name__, res) <NEW_LINE> return res <NEW_LINE> <DEDENT> return wrapped
Annotation for debugging a function
625941e13eb6a72ae02ec892
def save_to_json_file(my_obj, filename): <NEW_LINE> <INDENT> with open(filename, 'w', encoding='utf-8') as f: <NEW_LINE> <INDENT> json.dump(my_obj, f)
writes an Object to a text file, using a JSON representation
625941e11f037a2d8b9465a9
def setup_ui(self): <NEW_LINE> <INDENT> self.createFormGroupBox() <NEW_LINE> buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) <NEW_LINE> buttonBox.accepted.connect(self.check_input) <NEW_LINE> buttonBox.rejected.connect(self.reject) <NEW_LINE> mainLayout = QVBoxLayout() <NEW_LINE> mainLayout....
Sets up the User interface and calls make_connections
625941e1090684286d50f097
def get_csv_file_upload_schema(request): <NEW_LINE> <INDENT> schema = CsvFileUploadSchema().clone() <NEW_LINE> if not request.user.is_admin(): <NEW_LINE> <INDENT> del schema['association'] <NEW_LINE> <DEDENT> return schema
Return an import csv file upload schema regarding the current user's rights
625941e18a43f66fc4b5440d
def test_init(self): <NEW_LINE> <INDENT> assert self.api.username <NEW_LINE> assert self.api._base_url <NEW_LINE> assert not self.api.apis.get(API_AUTH) <NEW_LINE> assert not self.api._session_id
Test init.
625941e1d58c6744b425800a
def test_secure_wrapper(): <NEW_LINE> <INDENT> conf = SMSShell.config.MyConfigParser() <NEW_LINE> assert conf.load('./config.conf')[1] <NEW_LINE> assert conf.isLoaded() <NEW_LINE> metrics = SMSShell.metrics.none.MetricsHelper() <NEW_LINE> shell = SMSShell.shell.Shell(conf, metrics) <NEW_LINE> sw = shell.getSecureShell(...
Test to use secure shell wrapper
625941e19c8ee82313fbbb22
def convert_to_word_list(response_list): <NEW_LINE> <INDENT> responses = " ".join(response_list) <NEW_LINE> responses = responses.lower() <NEW_LINE> for c in string.punctuation: <NEW_LINE> <INDENT> responses = responses.replace(c,"") <NEW_LINE> <DEDENT> word_list = responses.split() <NEW_LINE> freq_dict = {} <NEW_LINE>...
Start with the list of responses where each element is a response and return a list where each element is a nested list containing the frequency of a word accross all responses as the first element, and the word as the second
625941e18e71fb1e9831db54
def validate(self, action, projects): <NEW_LINE> <INDENT> logging.info('Validation of GitHub issue {0}'.format(self.attributes['number'])) <NEW_LINE> with open(__JSON_SCHEMA_PATHS__[action]) as f: <NEW_LINE> <INDENT> schema = simplejson.load(f) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> validate(self.attributes, sche...
Validates GitHub issue template against predefined JSON schema :param str action: The issue action/command :param list projects: The projects options from esg.ini :raises Error: If the template has an invalid JSON schema :raises Error: If the project option does not exist in esg.ini :raises Error: If the landing page ...
625941e1d53ae8145f87a615
def test_delete_review(self): <NEW_LINE> <INDENT> response = self.app.delete("/reviews/1") <NEW_LINE> self.assertEqual(response.status, "204 NO CONTENT") <NEW_LINE> self.assertIsNone(Review.query.get(1))
Delete a doctor by id and verify it's no longer in the database
625941e129b78933be1e5a54
def sanitize_id(self, id="", allow_line_num=True, direction=0): <NEW_LINE> <INDENT> id = id.strip() <NEW_LINE> if len(id) == 0: <NEW_LINE> <INDENT> if allow_line_num: <NEW_LINE> <INDENT> id = "unknown_{}_{}".format(self.file_num, self.line_num) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> id = "unknown_{}".format(self...
Sanitize @param id to add dummy id if empty and make unique if set in args, @return id. @param allow_line_num boolean makes dummy id unique to line (otherwise just unique to file), and should be set False only for agency and stop id (which become common to the whole file). @param direction int 0 unless route_id inbound...
625941e145492302aab5e673
def p_program(p): <NEW_LINE> <INDENT> p[0] = p[1]
program : program_unit_list
625941e145492302aab5e674
def conv3d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1): <NEW_LINE> <INDENT> if input is not None and input.dim() != 5: <NEW_LINE> <INDENT> raise ValueError("Expected 5D tensor as input, got {}D tensor instead.".format(input.dim())) <NEW_LINE> <DEDENT> f = ConvNd(_triple(stride), _triple(padding...
Applies a 3D convolution over an input image composed of several input planes. See :class:`~torch.nn.Conv3d` for details and output shape. Args: input: input tensor of shape (minibatch x in_channels x iT x iH x iW) weight: filters tensor of shape (out_channels, in_channels, kT, kH, kW) bias: optional bias...
625941e1091ae35668667304
def users(self, disk: str) -> List[DiskUser]: <NEW_LINE> <INDENT> result = self.compute.resource.disks().get( disk=disk, project=self.compute.project, zone=self.compute.zone, fields='users').execute() <NEW_LINE> if 'users' not in result: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> users = result['users'] <NEW_LIN...
:param disk: name of the disk :return: list of attached users
625941e13d592f4c4ed1d410
def get_xml(uri): <NEW_LINE> <INDENT> r = requests.get(uri) <NEW_LINE> return r.text
Make a GET request to the issue API endpoint. Get a boatload of XML back.
625941e17c178a314d6ef812
def pop_block(self): <NEW_LINE> <INDENT> return self.block_stack.pop()
pop block :return:
625941e1ff9c53063f47c59e
def print_label_tree(self): <NEW_LINE> <INDENT> print(json.dumps(self.label_tree, indent=2))
Print a JSON representation of your label hierarchy.
625941e194891a1f4081be57
def __str__(self): <NEW_LINE> <INDENT> ranks = [card.rank for card in self.cards] <NEW_LINE> hand = '] ['.join(ranks) <NEW_LINE> return (f"[{hand}]")
Returns a description of the hand
625941e107d97122c4178c40
def rangecall(self, variables): <NEW_LINE> <INDENT> if not variables: <NEW_LINE> <INDENT> raise ExecutionError("ArgumentError", "Not enough arguments to range") <NEW_LINE> <DEDENT> elif len(variables) == 1: <NEW_LINE> <INDENT> return rangematrix(0, variables[0]) <NEW_LINE> <DEDENT> elif len(variables) == 2: <NEW_LINE> ...
Constructs A Range.
625941e1379a373c97cfaef3
def __decoupe_time__(self, spike_time, basetime: ndarray): <NEW_LINE> <INDENT> longueur = basetime.size <NEW_LINE> bin = list(range(0, longueur, 512000)) <NEW_LINE> base_index = list(range(0, longueur)) <NEW_LINE> if bin[-1] < longueur: <NEW_LINE> <INDENT> bin.append(longueur - bin[-1] + bin[-1]) <NEW_LINE> <DEDENT> ve...
entrer la base temporel issu de signal_segment pour chaque segment :param spike_time: :param signal: :return:
625941e1377c676e91272554
def armour_info(self) -> SequenceProxy[ArmourInfo]: <NEW_LINE> <INDENT> collection: Final[str] = 'profile_armor_map' <NEW_LINE> query = Query(collection, service_id=self._client.service_id) <NEW_LINE> query.add_term(field=self.id_field, value=self.id) <NEW_LINE> query.limit(20) <NEW_LINE> join = query.create_join(Armou...
Return the armour info of the profile. This returns a :class:`auraxium.SequenceProxy`.
625941e15166f23b2e1a5505
def connect(self, event, callable): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.disconnect(event) <NEW_LINE> <DEDENT> except AddonWindowError: <NEW_LINE> <INDENT> if type(event) == int: <NEW_LINE> <INDENT> self.actions_connected.append([event, callable]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.controls...
Connect an event to a function. :param event: event to be connected. :param callable: callable object the event is connected to. An event can be an inctance of a Control object or an integer key action code. Several basic key action codes are provided by PyXBMCt. ``xbmcgui`` module provides more action codes. You ca...
625941e1b5575c28eb68e3b0
def make_octal_permissions_mode(user=(False, False, False), group=(False, False, False), other=(False, False, False)): <NEW_LINE> <INDENT> mode = '' <NEW_LINE> for name in (user, group, other): <NEW_LINE> <INDENT> read, write, execute = name <NEW_LINE> if execute and not all(i for i in (read, write)): <NEW_LINE> <INDEN...
Create a permissions bit in absolute notation (octal). The user, group and other parameters are tuples representing Read, Write and Execute values. All are set disallowed (set to false) by default and can be individually permitted. :param user: User permissions :param group: Group permissions :param other: Other perm...
625941e123e79379d52ee90c
def assemble(statements, symtable): <NEW_LINE> <INDENT> machine_instructions = [] <NEW_LINE> location_counter = None <NEW_LINE> for statement in statements: <NEW_LINE> <INDENT> if statement.statement_type == 'DIRECTIVE' and statement.directive_type == 'ORIG': <NEW_LINE> <INDENT> location_counter = statement.address <NE...
Turns the statements into binary machine instructions.
625941e144b2445a33932440
def test_updates_to_none(self): <NEW_LINE> <INDENT> m = TestMapModel.create(int_map={1: uuid4()}) <NEW_LINE> m.int_map = None <NEW_LINE> m.save() <NEW_LINE> m2 = TestMapModel.get(partition=m.partition) <NEW_LINE> assert m2.int_map == set()
Tests that setting the field to None works as expected
625941e1ec188e330fd5ab45
def ColAnalysisMn(fprimac,fy,Es,ety,Pu,b,h,d,As,nlayers,transtype): <NEW_LINE> <INDENT> beta1 = beta1conc(fprimac) <NEW_LINE> cmin = 0.001 <NEW_LINE> cmax = h/beta1 <NEW_LINE> citer = cmin <NEW_LINE> while citer < cmax: <NEW_LINE> <INDENT> Mn = MnCol(fprimac,fy,Es,b,h,d,As,nlayers,citer) <NEW_LINE> Pn = PnCol(fprimac,f...
Parameters ---------- fprimac : [kPa] TYPE DESCRIPTION. fy : [kPa] TYPE DESCRIPTION. Es : [kPa] TYPE DESCRIPTION. ety : TYPE DESCRIPTION. Pu : [kN] TYPE DESCRIPTION. b : TYPE DESCRIPTION. h : TYPE DESCRIPTION. d : TYPE DESCRIPTION. As : TYPE DESCRIPTION. nlayers : TYPE DESCRIPTIO...
625941e191f36d47f21ac8a3
def get_columns_with_zero_std_deviation(self,data): <NEW_LINE> <INDENT> self.logger_object.log(self.file_object, 'Entered the get_columns_with_zero_std_deviation method of the Preprocessor class') <NEW_LINE> self.columns=data.columns <NEW_LINE> self.data_n = data.describe() <NEW_LINE> self.col_to_drop=[] <NEW_LINE> try...
Method Name: get_columns_with_zero_std_deviation Description: This method finds out the columns which have a standard deviation of zero. Output: List of the columns with standard deviation of zero On Failure: Raise Exception Written By: iNeuron Intelligence Version: 1.0 Revisions: None
625941e176e4537e8c351a22
def run(self) -> None: <NEW_LINE> <INDENT> self.__running = True <NEW_LINE> while self.__running: <NEW_LINE> <INDENT> if self.__offset > len(self.__sequence) - 1: <NEW_LINE> <INDENT> self.__offset = 0 <NEW_LINE> <DEDENT> sys.stdout.write("\b" + self.__sequence[self.__offset]) <NEW_LINE> sys.stdout.flush() <NEW_LINE> ti...
Run roller. :return: None
625941e1d58c6744b425800b
def delete(self, request): <NEW_LINE> <INDENT> user = request.user.pk <NEW_LINE> qs = self.get_queryset() <NEW_LINE> count = len(qs) <NEW_LINE> qs.delete() <NEW_LINE> return Response("Removed %d elements from printing queue" % count, status=status.HTTP_200_OK)
Clear queue
625941e15fdd1c0f98dc05e1
def to_string(stream: bool = False) -> str: <NEW_LINE> <INDENT> formatter = FeaturesPrettyFormatter() <NEW_LINE> file_ = formatter.get_stream_file(stream) <NEW_LINE> headline = formatter.format_headline() <NEW_LINE> print(headline, file=file_) <NEW_LINE> for feature, description in FEATURES.items(): <NEW_LINE> <INDENT>...
Gather all features in a printable string :param stream: If True print to stdout else print to 'formatter.output' variable :returns: Formatted string if stream is False else an empty string
625941e110dbd63aa1bd2f4f
def create_workflow(self, data): <NEW_LINE> <INDENT> endpoint = "/workflows" <NEW_LINE> return self._client._post(self.BASE_URL + endpoint, json=data)
Create a new workflow in a portal. Workflows are an essential component of the HubSpot marketing product, allowing marketing automation that relies on triggering relevant and timely actions, based on a user's context.
625941e14428ac0f6e5baba1
def calc_dice_metric(svs_1, svs_2, fname= None): <NEW_LINE> <INDENT> import nibabel as nb <NEW_LINE> import numpy <NEW_LINE> import os <NEW_LINE> vox_1_data = nb.load(svs_1).get_data() <NEW_LINE> vox_2_data = nb.load(svs_2).get_data() <NEW_LINE> vox_1_bool= numpy.atleast_1d(vox_1_data.astype(numpy.bool)) <NEW_LINE> vox...
Method to compute the Sorensen-Dice coefficient between two binary nifti images.
625941e171ff763f4b549a3f
def __init__(self, mdp, discount = 0.9, iterations = 100): <NEW_LINE> <INDENT> self.mdp = mdp <NEW_LINE> self.discount = discount <NEW_LINE> self.iterations = iterations <NEW_LINE> self.values = util.Counter() <NEW_LINE> "*** YOUR CODE HERE ***" <NEW_LINE> states = self.mdp.getStates(); <NEW_LINE> k = 0 <NEW_LINE> whil...
Your value iteration agent should take an mdp on construction, run the indicated number of iterations and then act according to the resulting policy. Some useful mdp methods you will use: mdp.getStates() mdp.getPossibleActions(state) mdp.getTransitionStatesAndProbs(state, action) mdp.getReward(state, a...
625941e1796e427e537b0975
def test_user_edit_illegal_parameter(self): <NEW_LINE> <INDENT> self.assertGreaterEqual(len(self.ad_writer.scripts), 0) <NEW_LINE> illegal_parameters["Set-ADUser"].append("Displayname") <NEW_LINE> settings_transformer = dict_modifier({}) <NEW_LINE> self._setup_adwriter(settings_transformer) <NEW_LINE> num_expected_scri...
Test user edit ps_script code with illegal parameter The common code is not tested. This test simply ensures that the illegal parameter is dropped.
625941e115baa723493c4325
def update_with_info(self, userinfo): <NEW_LINE> <INDENT> self.nickname = userinfo["nickname"] <NEW_LINE> self.sex = str(userinfo["sex"]) <NEW_LINE> self.city = str(userinfo["city"]) <NEW_LINE> self.headimgurl = str(userinfo["headimgurl"]) <NEW_LINE> self.country = str(userinfo["country"]) <NEW_LINE> if userinfo.get("s...
Update user with userinfo :param userinfo: u'province': u'四川', u'city': u'成都', u'subscribe_time': 1440990725, u'headimgurl': u'http://wx.qlogo.cn/mmopen/PiajxSqBRaEKtvkVVGSNKSNtSaqDBMgBK4TgqPfKCld5N084TygMJCoQkfvc1oJfhicHwhX2KwC2YpYtNN1kvPpA/0', u'language': u'zh_CN', u'openid': u'oRCuowSlN4UDip...
625941e1287bf620b61d3e0e
def to_category_fit(values): <NEW_LINE> <INDENT> codebook = {} <NEW_LINE> count = 0 <NEW_LINE> for i in values: <NEW_LINE> <INDENT> if i not in codebook.keys(): <NEW_LINE> <INDENT> count += 1 <NEW_LINE> codebook[i] = count <NEW_LINE> <DEDENT> <DEDENT> return codebook
This function takes a group of values as input and returns a dictionary, whose keys are original values
625941e194891a1f4081be58
def update_all_q_values(self): <NEW_LINE> <INDENT> self.q_values_old[:] = self.q_values[:] <NEW_LINE> for k in reversed(range(self.num_used - 1)): <NEW_LINE> <INDENT> action = self.actions[k] <NEW_LINE> reward = self.rewards[k] <NEW_LINE> end_episode = self.end_episode[k] <NEW_LINE> if end_episode: <NEW_LINE> <INDENT> ...
Update all Q-values in the replay-memory. When states and Q-values are added to the replay-memory, the Q-values have been estimated by the Neural Network. But we now have more data available that we can use to improve the estimated Q-values, because we now know which actions were taken and the observed rewards. We swe...
625941e131939e2706e4d211
def createPasswordList(): <NEW_LINE> <INDENT> global rawList <NEW_LINE> global pwList <NEW_LINE> global maxLen <NEW_LINE> global minLen <NEW_LINE> titleList=[] <NEW_LINE> swapcaseList=[] <NEW_LINE> for st in rawList: <NEW_LINE> <INDENT> swapcaseList.append(st.swapcase()) <NEW_LINE> titleList.append(st.title()) <NEW_LIN...
创建密码列表
625941e19b70327d1c4e1183
def test_detail_staff_user(self): <NEW_LINE> <INDENT> user = self.template_users['staff_user'] <NEW_LINE> self.client.login(email=user['email'], password=user['password']) <NEW_LINE> for obj in self.objects: <NEW_LINE> <INDENT> url = reverse(self.detail_url, args=(obj.id,)) <NEW_LINE> response = self.client.get(url) <N...
Staff user should be able to view EVERY object
625941e18c0ade5d55d3ed6b
def elementsToModel(rootelement, modeltag=modelTag): <NEW_LINE> <INDENT> if not rootelement.tag == modeltag: <NEW_LINE> <INDENT> raise XMLHelpersException.InvalidTagError(rootelement.tag, modeltag) <NEW_LINE> <DEDENT> class_module = rootelement.attrib.get(XMLHelpersUtility.XMLUTIL_attribute_module) <NEW_LINE> if class_...
From a root element create a list of data :param rootelement: the reference to the root element :param datatag: the tag which contains the data elements :return:
625941e13617ad0b5ed682a3
def write(value): <NEW_LINE> <INDENT> pass
Document me
625941e192d797404e304538
def h_levelsum(self): <NEW_LINE> <INDENT> level_sum = 0 <NEW_LINE> for g in self.problem.goal: <NEW_LINE> <INDENT> g_node = PgNode_s(g, is_pos=True) <NEW_LINE> for i, s in enumerate(self.s_levels): <NEW_LINE> <INDENT> if g_node in s: <NEW_LINE> <INDENT> level_sum += i <NEW_LINE> break <NEW_LINE> <DEDENT> <DEDENT> <DEDE...
The sum of the level costs of the individual goals (admissible if goals independent) :return: int
625941e1f9cc0f698b1409a5
def jobspec_create(self, args): <NEW_LINE> <INDENT> jobspec = self.init_jobspec(args) <NEW_LINE> jobspec.cwd = os.getcwd() <NEW_LINE> jobspec.environment = get_filtered_environment(args.env) <NEW_LINE> if args.dependency is not None: <NEW_LINE> <INDENT> jobspec.setattr( "system.dependencies", dependency_array_create(ar...
Create a jobspec from args and return it to caller
625941e15fdd1c0f98dc05e2
def bundled_asserts(self, expected_cmt, expected_output): <NEW_LINE> <INDENT> expected_output = self.prefix + expected_output <NEW_LINE> self.mock_save_to_wiki_or_local.assert_called_once_with( self.mock_report_page, expected_cmt, expected_output, minorEdit=False ) <NEW_LINE> self.mock_instruction_header.assert_called_...
The full battery of asserts to do for each test.
625941e1004d5f362079a6de
def get_walkable_tiles(self, tile_map): <NEW_LINE> <INDENT> neighbours = tile_map.get_neighbours(self.tile_index) <NEW_LINE> current_tile = tile_map[self.tile_index] <NEW_LINE> if self.dead or current_tile.is_type("house"): <NEW_LINE> <INDENT> return [tile for tile in neighbours if ((not tile.is_type("wall")) and not t...
Ghost cannot move to a tile they're already on or to the house/door if they"re outside.
625941e197e22403b379d348
def test_query_users_by_location(self): <NEW_LINE> <INDENT> CommonTestCases.user_token_assert_in( self, filter_user_by_location, "Location id does not exist" )
Test for query users with invalid location id
625941e1925a0f43d254a227
def _initialize_hit_location_data(self, positions): <NEW_LINE> <INDENT> hit_chart = OrderedDict() <NEW_LINE> for pos in positions.keys(): <NEW_LINE> <INDENT> hits = OrderedDict() <NEW_LINE> for hit in self.HITS: <NEW_LINE> <INDENT> hits[hit] = 0 <NEW_LINE> <DEDENT> hit_chart[positions[pos]] = hits <NEW_LINE> <DEDENT> r...
Initialize Hit Location Data :param positions: Position{'number': 'name'} :return: OrderedDict
625941e1236d856c2ad44b8c
def test_all(self): <NEW_LINE> <INDENT> tester.test('PNEUMONIA/person1946_bacteria_4874.jpeg') <NEW_LINE> tester.test('NORMAL/NORMAL2-IM-1427-0001.jpeg') <NEW_LINE> tester.test('PNEUMONIA/person1946_bacteria_4875.jpeg') <NEW_LINE> tester.test('NORMAL/NORMAL2-IM-1430-0001.jpeg') <NEW_LINE> tester.test('PNEUMONIA/person1...
Runs test (above) for all images in val. Alternates infected and healthy examples
625941e138b623060ff0b19a
@when('tls_client.ca.saved', 'kubernetes-master.available', 'kubernetes-e2e.installed', 'e2e.auth.bootstrapped') <NEW_LINE> @when_not('kubeconfig.ready') <NEW_LINE> def prepare_kubeconfig_certificates(master): <NEW_LINE> <INDENT> creds = db.get('credentials') <NEW_LINE> data_changed('kube-control.creds', creds) <NEW_LI...
Prepare the data to feed to create the kubeconfig file.
625941e1ad47b63b2c50a32b
@register("uppercase-word") <NEW_LINE> def uppercase_word(event: E) -> None: <NEW_LINE> <INDENT> buff = event.current_buffer <NEW_LINE> for i in range(event.arg): <NEW_LINE> <INDENT> pos = buff.document.find_next_word_ending() <NEW_LINE> words = buff.document.text_after_cursor[:pos] <NEW_LINE> buff.insert_text(words.up...
Uppercase the current (or following) word.
625941e1c432627299f04ff6
def trim_occluded_throats(self): <NEW_LINE> <INDENT> occluded_ts = list(self.throats()[self["throat.area"]==0]) <NEW_LINE> if len(occluded_ts) > 0: <NEW_LINE> <INDENT> self.trim(throats=occluded_ts) <NEW_LINE> <DEDENT> "Also get rid of isolated pores" <NEW_LINE> isolated_ps = self.check_network_health()['isolated_pores...
After the offsetting routine throats with zero area have been fully occluded. Remove these from the network and also remove pores that are isolated
625941e1be8e80087fb20fea
def __init__(self, argument): <NEW_LINE> <INDENT> super().__init__(argument) <NEW_LINE> self._namespace = "http://www.knora.org/ontology/language" <NEW_LINE> self._name = "translatedInValue"
:param argument:
625941e1dc8b845886cb58e4
def test_api_cannot_reset_password_confirm_not_match(self): <NEW_LINE> <INDENT> result=self.client().post(UserTestCase.user_register, data=self.user) <NEW_LINE> self.assertEqual(result.status_code,200) <NEW_LINE> res=self.client().post(UserTestCase.user_reset, data={"email":"collinsnjau39@gmail.com","password":"987654"...
this will test if user can reset password if password and confirm are not same
625941e10a366e3fb873ebca
def _handle_single_key(self, e): <NEW_LINE> <INDENT> txt = e.text() <NEW_LINE> key = e.key() <NEW_LINE> self._debug_log("Got key: 0x{:x} / text: '{}'".format(key, txt)) <NEW_LINE> if key == Qt.Key_Escape: <NEW_LINE> <INDENT> self._debug_log("Escape pressed, discarding '{}'.".format( self._keystring)) <NEW_LINE> self._k...
Handle a new keypress with a single key (no modifiers). Separate the keypress into count/command, then check if it matches any possible command, and either run the command, ignore it, or display an error. Args: e: the KeyPressEvent from Qt. Return: A self.Match member.
625941e1f548e778e58cd92c
def json_rep(self): <NEW_LINE> <INDENT> d = {} <NEW_LINE> d["rel"] = self.rel <NEW_LINE> d["pip1"] = self.pip1 <NEW_LINE> d["beta1"] = self.beta1 <NEW_LINE> d["pip2"] = self.pip2 <NEW_LINE> d["beta2"] = self.beta2 <NEW_LINE> d["causal_variant_id"] = self.causal_variant_id <NEW_LINE> d["position"] = self.variant.positio...
Returns the json representation of the object. :return: json
625941e14d74a7450ccd4571
def rmse(sim, ref): <NEW_LINE> <INDENT> return np.sqrt(((sim - ref) ** 2).mean())
Calculate the root mean squared error between simulation and reference Parameters ---------- sim: np.ndarray The simluated data ref: np.ndarray The reference data
625941e1b7558d58953c52ba
def __init__(self, loop, url): <NEW_LINE> <INDENT> self._url = url <NEW_LINE> self._events = [] <NEW_LINE> self._version = None <NEW_LINE> self._miner = None <NEW_LINE> self._username = None
Create an instance of SplunkLoggerBackend. Args: loop (asyncio.BaseEventLoop): Event loop. url (str): HTTP logging endpoint URL. Returns: SplunkLoggerBackend: Instance of SplunkLoggerBackend.
625941e126238365f5f0f220
def serving_input_receiver_fn(): <NEW_LINE> <INDENT> inputs = {} <NEW_LINE> for k in features: <NEW_LINE> <INDENT> inputs.update({k: tf.placeholder(shape=[None, 1], dtype=tf.float32)}) <NEW_LINE> <DEDENT> return tf.estimator.export.ServingInputReceiver(inputs, inputs)
Build the serving inputs.
625941e13cc13d1c6d3c7726
def get_attributes(self): <NEW_LINE> <INDENT> return self.attributes
Get dict of all attributes.
625941e1be383301e01b582c
def test_gmm_segment(self): <NEW_LINE> <INDENT> image_file = 'images/party_spock.png' <NEW_LINE> image_matrix = image_to_matrix(image_file) <NEW_LINE> num_components = 3 <NEW_LINE> gmm = GaussianMixtureModel(image_matrix, num_components) <NEW_LINE> gmm.initialize_training() <NEW_LINE> gmm.train_model() <NEW_LINE> segme...
Apply the trained GMM to unsegmented image and generate a segmented image. returns: segmented_matrix = numpy.ndarray[numpy.ndarray[float]]
625941e126238365f5f0f221
def get_param(param_name, parser=str, required=False, default=None): <NEW_LINE> <INDENT> if required and default is not None: <NEW_LINE> <INDENT> raise ValueError("A required parameter cannot have a default value.") <NEW_LINE> <DEDENT> def decorator(func): <NEW_LINE> <INDENT> @functools.wraps(func) <NEW_LINE> def wrapp...
Decorator used on route handler to pass a get parameter to the function. Parameters: param_name: name of the parameter, used in the request. parser: eventual function parsing the parameter value. required: boolean indicating if the request should be drop if the parameter is missing. default: de...
625941e1293b9510aa2c363f
def _list_all(root_pkg, prog): <NEW_LINE> <INDENT> res = [] <NEW_LINE> pykern_cli = _import(root_pkg) <NEW_LINE> path = os.path.dirname(pykern_cli.__file__) <NEW_LINE> for _, n, ispkg in pkgutil.iter_modules([path]): <NEW_LINE> <INDENT> if not ispkg: <NEW_LINE> <INDENT> res.append(n.replace('_', '-')) <NEW_LINE> <DEDEN...
Prints a list of importable modules and exits. Searches ``<root_pkg>.pykern_cli` for submodules, and prints their names. Args: root_pkg (str): top level package prog (str): argv[0], name of program invoked Returns: int: 0 if ok. 1 if error.
625941e1a8370b7717052c4b
def wordBreak(self, s, wordDict): <NEW_LINE> <INDENT> solution = [] <NEW_LINE> currentList = "" <NEW_LINE> self.searchHelper(solution, currentList, s, wordDict) <NEW_LINE> return map(lambda x : x.strip(), solution)
:type s: str :type wordDict: Set[str] :rtype: List[str]
625941e1ab23a570cc250533
def writeInt(self, p_int): <NEW_LINE> <INDENT> pass
QDataStream.writeInt(int)
625941e163b5f9789fde7494
def make_labelframe(self, parent, txt, clr, *args): <NEW_LINE> <INDENT> lf = tk.LabelFrame(parent, text = txt, bg = BG, fg = clr, font = ('Vardana',18,'bold')) <NEW_LINE> lf.grid(row = args[0], column = args[1], padx = 5, pady = 5, sticky = tk.EW) <NEW_LINE> return lf
625941e1bf627c535bc1357d
def handle(self): <NEW_LINE> <INDENT> if self.server.direction == "pull": <NEW_LINE> <INDENT> self.handle_pull() <NEW_LINE> <DEDENT> elif self.server.direction == "push": <NEW_LINE> <INDENT> self.handle_push()
Handle request
625941e14e4d5625662d4781
def should_burn(ident): <NEW_LINE> <INDENT> if not exists(ident): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> id_ = row_id(ident) <NEW_LINE> burn = int(red.get(schema.url_burn(id_))) <NEW_LINE> return bool(burn)
Find out whether or not the given URL is a burn after reading URL. :param ident: an identifier for the URL we want info about.
625941e173bcbd0ca4b2c423
def __createkey__(self): <NEW_LINE> <INDENT> return str(self.currentCol) + "," + str(self.currentRow)
Constructs a key for a coordinate using currentCol and currentRow values.
625941e192d797404e304539
def annotateEvent(self, event, session_num): <NEW_LINE> <INDENT> current_attr = event.source.get('session_id') <NEW_LINE> if current_attr is None: <NEW_LINE> <INDENT> event.add_attributes({'session_id': {self.session_type: session_num}}) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> current_attr[self.session_type] = se...
Annotate an event with a session ID. Store IDs as dictionary entries corresponding to the type of session. Args: event: The event to annotate. session_num: The session ID.
625941e1e76e3b2f99f3abb3
def choose_init(module): <NEW_LINE> <INDENT> return 'sysvinit'
Select a init system Returns the name of a init system (upstart, sysvinit ...).
625941e1a4f1c619b28b03de
def fromBin(a): <NEW_LINE> <INDENT> r = 0 <NEW_LINE> try: <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> r = r * 2 <NEW_LINE> r = r + a.pop() <NEW_LINE> <DEDENT> <DEDENT> except IndexError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> return r / 2
List of binary values to integer.
625941e130dc7b7665901d10
def orderByAvail(n): <NEW_LINE> <INDENT> resList = [] <NEW_LINE> for v in n.getConnections(): <NEW_LINE> <INDENT> if v.getColor() == 'white': <NEW_LINE> <INDENT> c = 0 <NEW_LINE> for w in v.getConnections(): <NEW_LINE> <INDENT> if w.getColor() == 'white': <NEW_LINE> <INDENT> c = c + 1 <NEW_LINE> <DEDENT> <DEDENT> resLi...
Warnsdorff's algorithm It is a kind of heuristic algorithm.
625941e13d592f4c4ed1d411
def split(header): <NEW_LINE> <INDENT> match = headerValue.match(header) <NEW_LINE> if not match: <NEW_LINE> <INDENT> return (None, None) <NEW_LINE> <DEDENT> return match.group(1).lower(), header[match.end():]
Splits value part and parameters part, e.g. split("MULTIPART/MIXED;boundary=hal_9000") becomes: ["multipart/mixed", "boundary=hal_9000"]
625941e107f4c71912b11832
def len_recurring_cycle(n): <NEW_LINE> <INDENT> i = 0 <NEW_LINE> while 10**i // n <= 0: <NEW_LINE> <INDENT> i += 1 <NEW_LINE> <DEDENT> dec = '0' * (i - 1) <NEW_LINE> tmp = 10**i <NEW_LINE> cache = {} <NEW_LINE> while True: <NEW_LINE> <INDENT> if tmp == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> elif tmp in cac...
Return the length of recurring cycle of 1/n. Use long division to calculate the length of the recurring part of the decimal representation of the unit fraction 1/n. Returns 0 if 1/n is non recurring/
625941e1f9cc0f698b1409a6
def kvec(K): <NEW_LINE> <INDENT> return K + 1 - np.arange(1, K+1)
Obtain descending vector of [K, K-1, ... 1] Returns -------- kvec : 1D array, size K
625941e199cbb53fe6792f93
def deprecated_check(self, flags): <NEW_LINE> <INDENT> for flag in flags: <NEW_LINE> <INDENT> if self.is_deprecated(flag): <NEW_LINE> <INDENT> warnings.warn('*** {}'.format(self.deprecated_message(flag)), DeprecationWarning, stacklevel=9999)
Emit a warning message if one of these flags is marked as deprecated. :param flags: list of string flags to check. e.g. [ '--foo', '--no-bar', ... ]
625941e1d4950a0f3b08c6f7
def consume(): <NEW_LINE> <INDENT> host_port = [("128.142.242.99", int(61614))] <NEW_LINE> key_file = "certificates/client/key.pem" <NEW_LINE> cert_file = "certificates/client/cert.pem" <NEW_LINE> ca_certs = "certificates/testca/cacert.pem" <NEW_LINE> conn = stomp.Connection(host_and_ports=host_port, use_ssl=True) <NEW...
Returns: Queue:
625941e11f5feb6acb0c4ef8
def __init__(self, modelConfig, inferenceArgs, metricSpecs, sourceSpec, sinkSpec=None): <NEW_LINE> <INDENT> self.model = ModelFactory.create(modelConfig) <NEW_LINE> self.model.enableInference(inferenceArgs) <NEW_LINE> self.metricsManager = MetricsManager(metricSpecs, self.model.getFieldInfo(), self.model.getInferenceTy...
Initialization. Args: modelConfig: The model config dict. metricSpecs: A sequence of MetricSpec instances. sourceSpec: Path to the source CSV file. sinkSpec: Path to the sink CSV file.
625941e13c8af77a43ae3b51