code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def maxSubArray(self, nums): <NEW_LINE> <INDENT> if len(nums) == 1: <NEW_LINE> <INDENT> return nums[0] <NEW_LINE> <DEDENT> self.L = len(nums) <NEW_LINE> self.largestSum = [0 for __ in range(self.L)] <NEW_LINE> self.largestSum[0] = nums[0] <NEW_LINE> for i in range(1,self.L): <NEW_LINE> <INDENT> self.largestSum[i] = max...
:type nums: List[int] :rtype: int
625941eb5166f23b2e1a5646
def __alinement_diag_moins(self, stones, last_stone) -> bool: <NEW_LINE> <INDENT> if self.cylinder: <NEW_LINE> <INDENT> _fun = lambda x: ((x[0]-x[1])%self.nbc == (last_stone[0]-last_stone[1])%self.nbc) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> _fun = lambda x: x[0]-x[1] == last_stone[0]-last_stone[1] <NEW_LINE> <DE...
return True iff there is a win along diagonal
625941eb4428ac0f6e5bace4
def GetBuddyValue(self): <NEW_LINE> <INDENT> return self.GetBuddyClass().GetField(self.buddyField)
Get the buddy value using the GetField method of the buddy class.
625941eb097d151d1a223344
def present(name, type, url, access=None, user=None, password=None, database=None, basic_auth=None, basic_auth_user=None, basic_auth_password=None, tls_auth=None, json_data=None, is_default=None, with_credentials=None, type_logo_url=None, orgname=None, profile='grafana'): <NEW_LINE> <INDENT> if isinstance(profile, stri...
Ensure that a data source is present. name Name of the data source. type Type of the datasource ('graphite', 'influxdb' etc.). access Use proxy or direct. Default: proxy url The URL to the data source API. user Optional - user to authenticate with the data source. password Optional - passw...
625941eb596a897236089fa7
def get_storage_locations(self, image_id): <NEW_LINE> <INDENT> return self.vgbdtg.getStorageLocations(id=image_id)
Get available locations for public image storage. :param int image_id: The ID of the image
625941eb4f6381625f114f28
def checkAccess(self, data, check, mutator): <NEW_LINE> <INDENT> check.isLoggedIn() <NEW_LINE> check.hasProfile()
See soc.views.base.RequestHandler.checkAccess for specification.
625941eb7d43ff24873a3191
def rotate(a, b, q): <NEW_LINE> <INDENT> bxa = b ^ a <NEW_LINE> au = a.unit() <NEW_LINE> m1 = a.magnitude() <NEW_LINE> m2 = b.magnitude() <NEW_LINE> if bxa.magnitude() == 0: <NEW_LINE> <INDENT> return au * linear(m1, m2, q) <NEW_LINE> <DEDENT> axis = bxa.unit() <NEW_LINE> theta = math.acos((a * b) / (m1 * m2)) <NEW_LIN...
Linear rotation about an axis between vectors.
625941ebdc8b845886cb5a24
def test_longitude(self): <NEW_LINE> <INDENT> self.assertEqual(str(type(self.new_inst.longitude)), "<class 'float'>")
test to verify if value passed to longitude is a float number
625941ebcc40096d61595e3b
def click_chain( self, selectors_list, by=By.CSS_SELECTOR, timeout=None, spacing=0 ): <NEW_LINE> <INDENT> self.__check_scope() <NEW_LINE> if not timeout: <NEW_LINE> <INDENT> timeout = settings.SMALL_TIMEOUT <NEW_LINE> <DEDENT> if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT: <NEW_LINE> <INDENT> timeout...
This method clicks on a list of elements in succession. @Params selectors_list - The list of selectors to click on. by - The type of selector to search by (Default: CSS_Selector). timeout - How long to wait for the selector to be visible. spacing - The amount of time to wait between clicks (in seconds).
625941eb9c8ee82313fbbc64
def update_user(body, instance=None): <NEW_LINE> <INDENT> if not isinstance(body, QueryDict) or not isinstance(body, dict): <NEW_LINE> <INDENT> return failure_response(status_code=400, detail='Form bodies must be of dict type.') <NEW_LINE> <DEDENT> form = UserForm(body, instance=instance) <NEW_LINE> if form.is_valid():...
Make sure you use the same salt when you store the password as when you're checking it :param body: :param instance: :return:
625941eb7c178a314d6ef955
def ask(self, n: int, tell_pending: bool = True) -> Tuple[List[float], List[float]]: <NEW_LINE> <INDENT> points, loss_improvements = self._ask_points_without_adding(n) <NEW_LINE> if tell_pending: <NEW_LINE> <INDENT> for p in points: <NEW_LINE> <INDENT> self.tell_pending(p) <NEW_LINE> <DEDENT> <DEDENT> return points, lo...
Return 'n' points that are expected to maximally reduce the loss.
625941eb76e4537e8c351b64
def _response_replace(self, message): <NEW_LINE> <INDENT> return re.sub(self._replacer_regex('RESPONSE'), self._json_replacer, message)
Replace a JSON Path from the prior request with a value.
625941eb15fb5d323cde1004
def get_privilege(self, username): <NEW_LINE> <INDENT> return int(self.login_session_data.loc[self.login_session_data['username'] == username, 'isAdmin'].iloc[0])
Get privileges of user. Return : int 1 if user is admin , else 0.
625941eb23e79379d52eea4b
def search_file(filename): <NEW_LINE> <INDENT> hit_counts = {"filename": filename, "*TOTAL*": 0} <NEW_LINE> with open(filename, "r", encoding="utf-8", errors="replace") as file_handle: <NEW_LINE> <INDENT> file_content = file_handle.read().lower() <NEW_LINE> <DEDENT> for searchfor in SETTINGS["words"]: <NEW_LINE> <INDEN...
Searches a file for the words specified in SETTINGS["words"]. Case-insensitive search. Returns a dict with keys for each of the search words (values are # hits), as well as a "*TOTAL*" key that is the total number of matches found.
625941ebd268445f265b535c
def sub_sites( self, start: int, end: int ) -> Optional[str]: <NEW_LINE> <INDENT> if self.site_array is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> assert start <= end, "{} {}".format( start, end ) <NEW_LINE> assert 0 < start <= len( self.site_array ), "{} {} {}".format( start, end, len( self.site_array )...
Retrieves a portion of this gene's sequence. Indices are 1 based and inclusive. :param start: Start index :param end: End index :return: Substring, or `None` if no site array is available.
625941eb004d5f362079a81d
def parse(self, maxNumberPages = 100000): <NEW_LINE> <INDENT> self.db.createDatabase() <NEW_LINE> title = None <NEW_LINE> isCategoryPage = False <NEW_LINE> isValid = True <NEW_LINE> for event, elem in etree.iterparse(self.DUMP_PATH, events=('start', 'end')): <NEW_LINE> <INDENT> tname = self.strip_tag_name(elem.tag) <NE...
rief The function parse the DUMP file and save the relative information. Each time the database is re-created. \details The function call the function createDatabase. Parsing the DUMP file, are skipped all the pages which have: 'redirect' tag, number of template different from 14 (category) or 0 (page), no text, no ...
625941eb45492302aab5e7b6
def get_laplacian(edge_index, edge_weight: Optional[torch.Tensor] = None, normalization: Optional[str] = None, dtype: Optional[int] = None, num_nodes: Optional[int] = None): <NEW_LINE> <INDENT> if normalization is not None: <NEW_LINE> <INDENT> assert normalization in ['sym', 'rw'] <NEW_LINE> <DEDENT> edge_index, edge_w...
Computes the graph Laplacian of the graph given by :obj:`edge_index` and optional :obj:`edge_weight`. Args: edge_index (LongTensor): The edge indices. edge_weight (Tensor, optional): One-dimensional edge weights. (default: :obj:`None`) normalization (str, optional): The normalization scheme for the...
625941eb7b180e01f3dc4ce0
def test_get_available_name_max_length_exist(self): <NEW_LINE> <INDENT> object = 'images/test.png' <NEW_LINE> name = self.backend.get_available_name(object, 32) <NEW_LINE> self.assertNotEqual(name, object)
Available name with max_length for existing object
625941eb63f4b57ef00015f8
def _test_repeated_structured_properties_class(self, structured_cls): <NEW_LINE> <INDENT> class Inner(ndb.Model): <NEW_LINE> <INDENT> a = ndb.IntegerProperty() <NEW_LINE> <DEDENT> class Outter(ndb.Model, serializable.SerializableModelMixin): <NEW_LINE> <INDENT> inner = structured_cls(Inner, repeated=True) <NEW_LINE> <D...
Common testing for StructuredProperty and LocalStructuredProperty.
625941eb5e10d32532c5f412
def plot_residual_vs_residual(self): <NEW_LINE> <INDENT> r = self.get_residuals() <NEW_LINE> r2 = deepcopy(r) <NEW_LINE> random.shuffle(r2) <NEW_LINE> plt.plot(r2, r, linewidth=0.0, marker='.')
Plots the residuals vs a randomly shuffled copy of the residuals.
625941ebbf627c535bc136bd
def get_user(name: str) -> Any: <NEW_LINE> <INDENT> user = None <NEW_LINE> try: <NEW_LINE> <INDENT> user = auth.get_user(name) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> if user is None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = auth.get_user_by_email(name) <NEW_LINE> <DEDENT> ex...
Get a user by user ID or by email. Args: name (str): A user ID, email, or phone number. Returns: (UserRecord): A Firebase user object.
625941eb91af0d3eaac9bf0b
def __init__(self, api): <NEW_LINE> <INDENT> self.api = api
:param api:
625941eb851cf427c661a9f8
def __init__(self, k: int): <NEW_LINE> <INDENT> self.capacity = k <NEW_LINE> self.queue = [0] * k <NEW_LINE> self.count = 0 <NEW_LINE> self.headIdx = 0 <NEW_LINE> self.queueLock = Lock()
tailIndex = (headIndex + count - 1 ) % capacity :param k: size of queue
625941eb21bff66bcd684e3b
def price(self): <NEW_LINE> <INDENT> return self.prices[len(self.spots)]
A city's cost is a function of the number of owners
625941eb97e22403b379d489
def _get_state(self): <NEW_LINE> <INDENT> return self.__state
Getter method for state, mapped from YANG variable /system/aaa/server_groups/server_group/servers/server/radius/state (container) YANG Description: Operational state data for RADIUS servers
625941eb6fece00bbac2dc32
def down(self): <NEW_LINE> <INDENT> self._logger.info("Move wings down") <NEW_LINE> self.set_position("DOWN")
Move wings down
625941ebdd821e528d63b693
def projectGetDefaultRequest(self): <NEW_LINE> <INDENT> cmdstring="project-get-default" <NEW_LINE> fields = [] <NEW_LINE> fields.append(Input('cmd', cmdstring)) <NEW_LINE> fields.append(Input('version', "1")) <NEW_LINE> response= self.postRequest(ServerRequest.prepareRequest(fields, [])) <NEW_LINE> return response
Get the default project project name
625941eb71ff763f4b549b82
def __call__(self, *args, **kwargs): <NEW_LINE> <INDENT> return self.gen_os(*args, **kwargs)
The mapping instance call eq to gen_os().
625941eba8370b7717052d8b
def reset_codee_body_and_exit(self): <NEW_LINE> <INDENT> self.stop_arms() <NEW_LINE> self.set_right_arm(-90) <NEW_LINE> self.set_left_arm(-90) <NEW_LINE> self.stop_look_around() <NEW_LINE> self.set_head(0) <NEW_LINE> self.stop_wheels() <NEW_LINE> self.display_clear() <NEW_LINE> self.exit()
This method will reset Codees limbs to default position stop head, wheel movements and clear the display then disconnect codee
625941eb67a9b606de4a83a4
def wait_for_query_to_complete(self, queryExecutionId): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> response = self.athena.get_query_execution(QueryExecutionId=queryExecutionId) <NEW_LINE> state = response['QueryExecution']['Status']['State'] <NEW_LINE> if state == 'SUCCEEDED': <NEW_LINE> <INDENT> return True <...
Returns when the query completes successfully, or raises an exception if it fails or is canceled. Waits until the query finishes running.
625941eb6aa9bd52df037295
def new_url(**kwargs): <NEW_LINE> <INDENT> url_base = "/axapi/v3/interface/trunk/{trunk_ifnum}/ipv6/router/ripng" <NEW_LINE> f_dict = {} <NEW_LINE> f_dict["trunk_ifnum"] = kwargs["trunk_ifnum"] <NEW_LINE> return url_base.format(**f_dict)
Return the URL for creating a resource
625941ebc432627299f05137
def reset(self, stage=1, all_stages=False, mechanical=False, wait_for_finish=False): <NEW_LINE> <INDENT> if self.controller.is_SHOT(): <NEW_LINE> <INDENT> self.__reset_shot(stage, all_stages, mechanical, wait_for_finish) <NEW_LINE> <DEDENT> elif self.controller.is_HIT(): <NEW_LINE> <INDENT> raise NotImplemented()
Reset or initialize the position of stages. Parameters ---------- stage : int, optional Target stage number. If all_stage is set to True, this value is ignored. all_stages : bool, optional If True, all stages are reset simultaneously. In case mechanical is False, all stage parameters must be set. mechanical : ...
625941eb3cc13d1c6d3c7865
def handle_headers(self): <NEW_LINE> <INDENT> logging.debug( "Request: %s %s %s", self.request.method, self.request.url, str(self.request.protocol)) <NEW_LINE> logging.debug( "Got Response: %i %s", self.status, self.reason) <NEW_LINE> logging.debug("Response headers: %s", repr(self.headers)) <NEW_LINE> super(ClientResp...
Hook for response header processing. This method is called when a set of response headers has been received from the server, before the associated data is received! After this call, recv will be called zero or more times until handle_message or handle_disconnect is called indicating the end of the response. Override...
625941eb7d43ff24873a3192
def group_forces(forces): <NEW_LINE> <INDENT> force_levels = [] <NEW_LINE> for force in forces: <NEW_LINE> <INDENT> if force > self.high_force: <NEW_LINE> <INDENT> force_levels.append('1HIGH') <NEW_LINE> <DEDENT> elif force > self.medium_force: <NEW_LINE> <INDENT> force_levels.append('2MEDIUM') <NEW_LINE> <DEDENT> elif...
helper function to group forces in LOW, MEDIUM , HIGH
625941eb379a373c97cfb035
def create_environment_variables(variables): <NEW_LINE> <INDENT> if variables is None: <NEW_LINE> <INDENT> return "" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return "\n".join("export {}={}".format(k,v) for k,v in variables.items())
Create bash env variables from dict
625941ebe5267d203edce184
def set_AccessTokenSecret(self, value): <NEW_LINE> <INDENT> super(DeleteFavoriteFoodInputSet, self)._set_input('AccessTokenSecret', value)
Set the value of the AccessTokenSecret input for this Choreo. ((required, string) Deprecated (retained for backward compatibility only).)
625941eb56ac1b37e62646b3
def flush(self): <NEW_LINE> <INDENT> register_thread() <NEW_LINE> h5f.flush(self.fid)
Tell the HDF5 library to flush its buffers.
625941eb656771135c3ebd63
def mkdir_p(path): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.makedirs(path) <NEW_LINE> <DEDENT> except OSError as e: <NEW_LINE> <INDENT> if e.errno != EEXIST or not os.path.isdir(path): <NEW_LINE> <INDENT> raise
Run the equivalent of "mkdir -p"
625941ebd53ae8145f87a754
def test_parse_evtx_logon(self): <NEW_LINE> <INDENT> string_list = [] <NEW_LINE> string_parsed = {} <NEW_LINE> attributes = login.parse_evtx_logon_event(string_list, string_parsed) <NEW_LINE> self.assertEqual(len(attributes), 0) <NEW_LINE> string_list = [ 'S-1-5', '1', '2', '0x0034', 'S-1-5-5-4-54', 'secret_santa', '6'...
Test EVTX logon parsing.
625941eb442bda511e8be8ff
def gettitle(self): <NEW_LINE> <INDENT> parent = (self.soup).find("h2", {"class": "title"}) <NEW_LINE> self.title = parent.find("a").get_text().strip()
Sets title for Episode object.
625941eb187af65679ca560e
@utils.add_cmd <NEW_LINE> def claim(irc, source, args): <NEW_LINE> <INDENT> irc.checkAuthenticated(source) <NEW_LINE> try: <NEW_LINE> <INDENT> channel = irc.toLower(args[0]) <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> irc.reply("Error: Not enough arguments. Needs 1-2: channel, list of networks (optional)...
<channel> [<comma separated list of networks>] Sets the CLAIM for a channel to a case-sensitive list of networks. If no list of networks is given, shows which networks have claim over the channel. A single hyphen (-) can also be given as a list of networks to remove claim from the channel entirely. CLAIM is a way of ...
625941eb7cff6e4e81117e73
def dumpMeteoStatus(self): <NEW_LINE> <INDENT> Domoticz.Log( "##########################################\n" "{} ({}) :\nHeute:\t{}-{}\n\rMorgen:\t{}-{}\nneed update?:\t{}" .format( self.location, self.pubDate, self.todayLevel, self.todayDetail, self.tomorrowLevel, self.tomorrowDetail, self.needUpdate ) )
just print current status to log
625941ebd6c5a1020814453d
def minMeetingRooms(self, intervals): <NEW_LINE> <INDENT> if not intervals: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> tmp = [] <NEW_LINE> for interval in intervals: <NEW_LINE> <INDENT> tmp.append([interval.start, interval.end]) <NEW_LINE> <DEDENT> tmp.sort() <NEW_LINE> heap = [] <NEW_LINE> for index, interval in...
:type intervals: List[Interval] :rtype: int
625941ebfb3f5b602dac3b86
def apply_to_array(self, coords): <NEW_LINE> <INDENT> coords = self.__magnify_array__(coords) <NEW_LINE> coords = self.__translate_array__(coords) <NEW_LINE> return coords
apply transformation to numpy array
625941eb0fa83653e46574a6
def convert_time(timeobj, tzfrom, tzto): <NEW_LINE> <INDENT> timez_from = pytz.timezone(tzfrom) <NEW_LINE> timez_to = pytz.timezone(tzto) <NEW_LINE> timeobj_from = timez_from.localize(timeobj) <NEW_LINE> timeobj_to = timeobj_from.astimezone(timez_to) <NEW_LINE> return timeobj_to
Convert a given datetime object from a specified timezone to the other specified. :arg timeobj: a datetime object to convert :arg tzfrom: the timezone from which to convert :arg tzto: the timezone to which to convert
625941eb5f7d997b87174f8a
def main(): <NEW_LINE> <INDENT> pass
plot P2
625941ebfff4ab517eb2f92d
def test_enable_extension_registers_static_bundles(self): <NEW_LINE> <INDENT> class TestExtensionWithBundles(Extension): <NEW_LINE> <INDENT> css_bundles = { 'default': { 'source_filenames': ['test.css'], } } <NEW_LINE> js_bundles = { 'default': { 'source_filenames': ['test.js'], } } <NEW_LINE> <DEDENT> pipeline_setting...
Testing ExtensionManager.enable_extension registers static bundles
625941eb1b99ca400220afa2
def wrap(x, mi, ma): <NEW_LINE> <INDENT> return x - num.floor((x-mi)/(ma-mi)) * (ma-mi)
Wrapping continuous data to fundamental phase values. .. math:: x_{\mathrm{wrapped}} = x_{\mathrm{cont},i} - \frac{ x_{\mathrm{cont},i} - r_{\mathrm{min}} } { r_{\mathrm{max}} - r_{\mathrm{min}}} \cdot ( r_{\mathrm{max}} - r_{\mathrm{min}}),\ \quad x_{\mathrm{wrapped}...
625941eb56b00c62f0f14b4b
def findUnsortedSubarray(self, nums): <NEW_LINE> <INDENT> snums = sorted(nums) <NEW_LINE> s, e = 0, len(nums) - 1 <NEW_LINE> while s < len(nums) - 1: <NEW_LINE> <INDENT> if nums[s] != snums[s]: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> s += 1 <NEW_LINE> <DEDENT> if s == len(nums) - 1: <NEW_LINE> <INDENT> return 0 <...
:type nums: List[int] :rtype: int
625941eb3d592f4c4ed1d54e
def run(module=None, verbosity=0, stream=None, **kwargs): <NEW_LINE> <INDENT> suite = unittest.TestSuite() <NEW_LINE> if module is None: <NEW_LINE> <INDENT> suite.addTests(get_tests()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> suite.addTests(module.get_tests()) <NEW_LINE> <DEDENT> if stream is None: <NEW_LINE> <IND...
Execute self-tests. This raises SelfTestError if any test is unsuccessful. You may optionally pass in a sub-module of SelfTest if you only want to perform some of the tests. For example, the following would test only the hash modules: CryptoPlus.SelfTest.run(CryptoPlus.SelfTest.Hash)
625941eb4c3428357757c813
def _get_man2num_phones(self, mac2id): <NEW_LINE> <INDENT> phones2oui = {} <NEW_LINE> for mac, uid in mac2id.items(): <NEW_LINE> <INDENT> phones2oui[uid] = get_oui(mac) <NEW_LINE> <DEDENT> num_phones = {} <NEW_LINE> for mac, mac_man in phones2oui.items(): <NEW_LINE> <INDENT> if mac_man not in num_phones: <NEW_LINE> <IN...
Return num of phones per manufacturer.
625941eb3346ee7daa2b325e
def dtypeFromExt(self, filename): <NEW_LINE> <INDENT> (filename, ext) = os.path.splitext(filename) <NEW_LINE> return ext[1:]
returns the dtype to pass to numpy.memmap based on filename
625941ebd164cc617578323d
@app.route('/ssdbadmin/queue/get/') <NEW_LINE> def queueGet(): <NEW_LINE> <INDENT> queue_name = request.args.get('name') <NEW_LINE> index = request.args.get('index') <NEW_LINE> item = SSDBClient(request).queueGet(queue_name, index) <NEW_LINE> return render_template('queue/queueGet.html', name=queue_name, item=item, ind...
show an item info from queue :return:
625941eb01c39578d7e7532a
def to_element(self, include_namespaces=False): <NEW_LINE> <INDENT> elt_attrib = {} <NEW_LINE> if include_namespaces: <NEW_LINE> <INDENT> elt_attrib.update( { "xmlns": "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/", "xmlns:dc": "http://purl.org/dc/elements/1.1/", "xmlns:upnp": "urn:schemas-upnp-org:metadata-1-0/upnp/",...
Return an ElementTree Element representing this instance. Args: include_namespaces (bool, optional): If True, include xml namespace attributes on the root element Return: ~xml.etree.ElementTree.Element: an Element.
625941eb44b2445a33932581
def url(self, instance): <NEW_LINE> <INDENT> return instance.field.url
урл до файла :param instance: :return:
625941eb3317a56b8693a13a
def __get_build_id(self, manifest_sha: str): <NEW_LINE> <INDENT> with open(os.path.join(self.dbdir, 'manifests', 'content_sha.db.txt'), 'a+', encoding='utf-8') as fp: <NEW_LINE> <INDENT> for line in fp: <NEW_LINE> <INDENT> (sha1, tag) = line.strip().split() <NEW_LINE> if sha1 == manifest_sha: <NEW_LINE> <INDENT> return...
Return a build ID unique to this manifest. If a matching manifest already exists in the database, its build ID will be used.
625941ebfff4ab517eb2f92e
def text(self, text, timeout=None): <NEW_LINE> <INDENT> image = Image.new(self.device.mode, self.device.size) <NEW_LINE> draw = ImageDraw.Draw(image) <NEW_LINE> draw.text((5, 35), text, fill='white', align='center', font=self.font) <NEW_LINE> self.draw(image, frame=False) <NEW_LINE> if timeout: <NEW_LINE> <INDENT> iolo...
Draws a text with an optional timeout in miliseconds. After that, the last frame is restored.
625941eb293b9510aa2c377f
def test_option_admit_immediately_true(self): <NEW_LINE> <INDENT> e = self.event <NEW_LINE> e.refresh_from_db() <NEW_LINE> e.admit_immediately = False <NEW_LINE> e.slots = 3 <NEW_LINE> e.save() <NEW_LINE> self.crew.refresh_from_db() <NEW_LINE> self.crew.admit_immediately = True <NEW_LINE> self.crew.save() <NEW_LINE> re...
Check that admit_immediately=True on a selected option has precedence over the event
625941eb66656f66f7cbc69b
def test_create_user(self) -> None: <NEW_LINE> <INDENT> user: User = User.objects.create_user( email="mail@mail.com", password="password", first_name="firstname", last_name="lastname", date_of_birth=datetime.date(1997, 4, 10), ) <NEW_LINE> user_created: QuerySet = User.objects.first() <NEW_LINE> self.assertEqual(user, ...
Test the correct user creation.
625941eb92d797404e30467b
def folders(self, recurse=True, restriction=None, page_start=None, page_limit=None, order=None): <NEW_LINE> <INDENT> columns = [ PR_ENTRYID, PR_PARENT_ENTRYID, PR_DISPLAY_NAME_W, PR_LAST_MODIFICATION_TIME, PR_CONTENT_UNREAD, ] <NEW_LINE> flags = MAPI_UNICODE | self.content_flag <NEW_LINE> if recurse: <NEW_LINE> <INDENT...
Return all :class:`sub-folders <Folder>` in folder :param recurse: include all sub-folders :param restriction: apply :class:`restriction <Restriction>` :param page_start: skip this many items from the start :param page_limit: return up to this many items
625941eb2ae34c7f2600d61f
def get_item_uncached(self, id): <NEW_LINE> <INDENT> result = self.conn.execute('EXECUTE get_item(%(id)s)', locals()) <NEW_LINE> row = self.conn.fetchone() <NEW_LINE> return self.create_item_from_row(row)
Look up the item in the database and return an object of class File, Directory, Drive, or Revision for it.
625941eb91af0d3eaac9bf0c
def add(self, **kwargs): <NEW_LINE> <INDENT> self._data.append(kwargs)
Adds the given keyword arguments as a single cell to the database.
625941eb3346ee7daa2b325f
def catalog_item(request, pk): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> listing = Listing.objects.get(pk=pk) <NEW_LINE> <DEDENT> except Listing.DoesNotExist: <NEW_LINE> <INDENT> return JsonResponse({"error": f"Listing with pk {pk} not found."}, status=404) <NEW_LINE> <DEDENT> location_id = listing.location.id <NEW_...
Render page displaying listing item
625941ebad47b63b2c50a46d
@register("mlp2x16") <NEW_LINE> def mlp2x16(num_layers=2, num_hidden=16, activation=tf.nn.relu, layer_norm=False): <NEW_LINE> <INDENT> def network_fn(X): <NEW_LINE> <INDENT> h = tf.layers.flatten(X) <NEW_LINE> for i in range(num_layers): <NEW_LINE> <INDENT> h = activation(fc(h, 'mlp_fc{}'.format(i), nh=num_hidden, init...
Simple fully connected layer policy. Separate stacks of fully-connected layers are used for policy and value function estimation. More customized fully-connected policies can be obtained by using PolicyWithV class directly. Parameters: ---------- num_layers: int number of fully-connected layers (default...
625941eb8a43f66fc4b5454e
def setUp(self): <NEW_LINE> <INDENT> self.username = 'username' <NEW_LINE> self.password = 'testpassword' <NEW_LINE> self.user = get_user_model().objects.create_user( first_name='Mohamed', last_name='Aboel-fotouh', username=self.username, password=self.password,) <NEW_LINE> self.company = customers_models.CustomerCompa...
Initiate every test
625941ebbe383301e01b596a
def ten_thousands(n): <NEW_LINE> <INDENT> return doubleDigit(n[0:2]) + ' thousand ' + hundreds(n[2:5])
handles the numbers 10000-99999
625941ebf548e778e58cda6f
def test_soa_perms(self): <NEW_LINE> <INDENT> self.setup_request() <NEW_LINE> perm_table = { 'cyder_admin': ['all'], 'admin': [ACTION_VIEW], 'user': [ACTION_VIEW], 'guest': [ACTION_VIEW], } <NEW_LINE> domain = Domain(id=None, name='foo') <NEW_LINE> domain.save() <NEW_LINE> obj = SOA(root_domain=domain) <NEW_LINE> obj.p...
Test SOA perms
625941eba8ecb033257d35ba
def test_unpatch_patch(self): <NEW_LINE> <INDENT> unpatch() <NEW_LINE> self.assertIsNone(Pin.get_from(molten)) <NEW_LINE> molten_client() <NEW_LINE> spans = self.tracer.writer.pop() <NEW_LINE> self.assertEqual(len(spans), 0) <NEW_LINE> patch() <NEW_LINE> Pin.override(molten, tracer=self.tracer) <NEW_LINE> self.assertTr...
Tests unpatch-patch cycle
625941eb10dbd63aa1bd3091
def list_mutes(self, **params): <NEW_LINE> <INDENT> return self.get('mutes/users/list', params=params)
Returns a collection of user objects that the authenticating user is muting. Docs: https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-list
625941eb6e29344779a62aff
def rgb2lab(rgb): <NEW_LINE> <INDENT> rgb = rgb / 255. <NEW_LINE> r, g, b = tf.unstack(rgb, 3, axis=3) <NEW_LINE> def scale0(x): <NEW_LINE> <INDENT> return tf.where(x > 0.04045, ((x + 0.055) / 1.055) ** 2.4, x / 12.92) <NEW_LINE> <DEDENT> r = scale0(r) <NEW_LINE> g = scale0(g) <NEW_LINE> b = scale0(b) <NEW_LINE> x = (r...
rgb in [0, 255] L in [0, 100] A in [-86.185, 98,254] ~ [-100, 100] B in [-107.863, 94.482] ~ [-100, 100]
625941eb4428ac0f6e5bace5
def apj_list(basedir): <NEW_LINE> <INDENT> boards = [] <NEW_LINE> for root, subdirs, files in os.walk(basedir): <NEW_LINE> <INDENT> for f in files: <NEW_LINE> <INDENT> if not fnmatch.fnmatch(f, "*.apj"): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> fname = os.path.join(root, f) <NEW_LINE> board = os.path.basename(r...
list of APJInfo for one directory
625941eba219f33f34628e51
def finish(self): <NEW_LINE> <INDENT> pass
void QSqlQuery.finish()
625941eb26238365f5f0f364
@remote_compatible <NEW_LINE> def test_scan_tsf(dev, apdev): <NEW_LINE> <INDENT> hostapd.add_ap(apdev[0], {"ssid": "test-scan", 'beacon_int': "100"}) <NEW_LINE> bssid = apdev[0]['bssid'] <NEW_LINE> tsf = [] <NEW_LINE> for passive in [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1]: <NEW_LINE> <INDENT> check_scan(dev[0], "freq=2412...
Scan and TSF updates from Beacon/Probe Response frames
625941eb5fc7496912cc3e6c
def all_repos(self): <NEW_LINE> <INDENT> repos = [] <NEW_LINE> for repo_name in self.parser.sections(): <NEW_LINE> <INDENT> repo = self._parser_to_repo(repo_name) <NEW_LINE> repos.append(repo) <NEW_LINE> <DEDENT> return repos
Returns a list of all repos in the store. @return: list of repo instances; empty list if there are none @rtype: list of L{Repo}
625941eb9b70327d1c4e12c6
@testing.requires_testing_data <NEW_LINE> @pytest.mark.parametrize('fname_dip_, fname_bdip_', [ (fname_dip, fname_bdip), (fname_dip_xfit, fname_bdip_xfit), ]) <NEW_LINE> def test_bdip(fname_dip_, fname_bdip_, tmp_path): <NEW_LINE> <INDENT> with pytest.warns(None): <NEW_LINE> <INDENT> dip = read_dipole(fname_dip_) <NEW_...
Test bdip I/O.
625941eb66673b3332b92580
def test_parse_args_temp_folder_website(self): <NEW_LINE> <INDENT> with self.assertRaises(SystemExit) as cm1, self.assertLogs(level='CRITICAL') as cm2: <NEW_LINE> <INDENT> parser = target.parse_args(['--temp-folder', '--website']) <NEW_LINE> <DEDENT> the_exception = cm1.exception <NEW_LINE> self.assertEqual(the_excepti...
Test running the script with invalid arguments combination: --temp-folder with --website instead of --aprender
625941ebe64d504609d74d2f
def decorrelate(self, columns: Optional[Union[List[str], str]] = None, threshold: Optional[float] = 0.95) -> None: <NEW_LINE> <INDENT> if not columns: <NEW_LINE> <INDENT> columns = list(self.datatypes.keys()) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> corr_matrix = self.data[columns].corr().abs() <NEW_LINE> <DEDENT> ...
Drops all but one column from highly correlated groups of columns. The threshold is based upon the .corr() method in pandas. 'columns' can include any datatype accepted by .corr(). If 'columns' is None, all columns in the DataFrame are tested. Args: data (amicus.base.Dataset): instance storing a pandas DataFrame....
625941eb8e05c05ec3eea868
def readTemp2(self): <NEW_LINE> <INDENT> val = self.analogRead(self.tempInPin2) <NEW_LINE> voltage = float(val) * (3300.0/1024.0) <NEW_LINE> degC = (voltage - 500.0)/10.0 <NEW_LINE> degK = degC + 273.15 <NEW_LINE> led_level = int(2.0 * (degK - 300.0)) <NEW_LINE> self.analogWrite(self.ledPin,led_level) <NEW_LINE> return...
Reads temperature in K from second temperature sensor
625941eb6aa9bd52df037296
def drawTable(self, ec='none'): <NEW_LINE> <INDENT> return None
Each table must implement this function should make a figure and axes in self and should draw the table as a collection of matplotlib patches edge colour is for the patches, when animating it can be left as none but must be 'k' for generatePreview
625941eb15baa723493c4468
def Run(self, device_id, sdk, derived_data_dir, startup_timeout_sec, destination_timeout_sec=None, os_version=None, result_bundle_path=None): <NEW_LINE> <INDENT> xcode_version = xcode_info_util.GetXcodeVersionNumber() <NEW_LINE> if (xcode_version >= 1100 and sdk == ios_constants.SDK.IPHONESIMULATOR and os_version and v...
Runs the test with generated xctestrun file in the specific device. Args: device_id: ID of the device. sdk: shared.ios_constants.SDK, sdk of the device. derived_data_dir: path of derived data directory of this test session. startup_timeout_sec: seconds until the xcodebuild command is deemed stuck. destinatio...
625941eb097d151d1a223346
def configure_allowed_vlans_for_vlan_profile(self, mgr, name, vlan_id): <NEW_LINE> <INDENT> confstr = template.CONFIGURE_ALLOWED_VLANS_FOR_VLAN_PROFILE.format( name=name, vlan_id=vlan_id) <NEW_LINE> mgr.edit_config(target='running', config=confstr)
Configures allowed VLANs for VLAN sub-profile.
625941eb090684286d50f1dc
def class_gradient( self, x: np.ndarray, label: Optional[Union[int, List[int]]] = None, training_mode: bool = False, **kwargs ) -> np.ndarray: <NEW_LINE> <INDENT> if not ( label is None or (isinstance(label, (int, np.integer)) and label in range(self.nb_classes)) or ( isinstance(label, np.ndarray) and len(label.shape) ...
Compute per-class derivatives w.r.t. `x`. :param x: Sample input with shape as expected by the model. :param label: Index of a specific per-class derivative. If an integer is provided, the gradient of that class output is computed for all samples. If multiple values are provided, the first dimension shou...
625941ebe76e3b2f99f3acf2
def get_o_to_d(self, pos_d): <NEW_LINE> <INDENT> abs_pos_d = abs(pos_d) <NEW_LINE> if self.d0_cen == 1: <NEW_LINE> <INDENT> if pos_d <= 0: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> vec = self.d_o[abs_pos_d] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> logger.error('pos_d key not defined ' + str(pos_d)) <...
returns the vector from origin pos_o to pos_d If it is symmetrical along axis_d, pos_d == 0 will be at the middle Then, pos_d > 0 will be the points on the positive side of axis_d and pos_d < 0 will be the points on the negative side of axis_d d0_cen = 1 : _____:_____ | : | self.d_o[1] is th...
625941eb293b9510aa2c3780
def getReallocationStatsDataFrame(stats_dict_list): <NEW_LINE> <INDENT> df_list = [] <NEW_LINE> for item in zip(stats_dict_list, ['Q1/Q2', 'Q2/Q3', 'Q3/Q4']): <NEW_LINE> <INDENT> stats_dict = item[0] <NEW_LINE> group_label = item[1] <NEW_LINE> grouping_list = [group_label] * 4 <NEW_LINE> lowerupper_list = ['lower'] * 2...
Create the dataframe to show the splits at the upper/lower boundaries
625941eb07d97122c4178d86
def setUp(self): <NEW_LINE> <INDENT> self.super() <NEW_LINE> self.env.config.set('trac', 'permission_policies', 'AgiloPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy') <NEW_LINE> self.teh.grant_permission(name_team_member, Role.TEAM_MEMBER) <NEW_LINE> self.teh.grant_permission(name_product_owner, Role.PRODUCT_O...
Creates the environment and a couple of tickets
625941eb50812a4eaa59c80c
def get_psd(self, metarow): <NEW_LINE> <INDENT> m = metarow <NEW_LINE> name = m.sample_name <NEW_LINE> dt = pd.to_datetime(m.date) <NEW_LINE> mean = self.mean(name, date=dt) <NEW_LINE> for i in m.keys(): <NEW_LINE> <INDENT> setattr(mean, i, getattr(m, i)) <NEW_LINE> <DEDENT> return(mean)
Get a mean PSD object from metadata, and add metadata as attributes.
625941ebbf627c535bc136be
def _extract_keys(self, msgtuple): <NEW_LINE> <INDENT> OpenPGP_HEADER = 'OpenPGP' <NEW_LINE> doc, data = msgtuple <NEW_LINE> msg = self._parser.parsestr(data) <NEW_LINE> _, fromAddress = parseaddr(msg['from']) <NEW_LINE> header = msg.get(OpenPGP_HEADER, None) <NEW_LINE> if header is not None: <NEW_LINE> <INDENT> self._...
Retrieve attached keys to the mesage and parse message headers for an *OpenPGP* header as described on the `IETF draft <http://tools.ietf.org/html/draft-josefsson-openpgp-mailnews-header-06>` only urls with https and the same hostname than the email are supported for security reasons. :param msgtuple: a tuple consisti...
625941ebd4950a0f3b08c837
def FlickerInducedBlindness(): <NEW_LINE> <INDENT> resetview('black') <NEW_LINE> n,freq,d = 4,2.,0.17 <NEW_LINE> sl = 1/2/freq <NEW_LINE> centre = shape('plus').scale(0.4) <NEW_LINE> centre.setProp(7) <NEW_LINE> draw(centre) <NEW_LINE> points = Formex([[0,-5,0]]).rosette(n,360./n) <NEW_LINE> points.setProp(6) <NEW_LINE...
Flicker Induced Blindness
625941ebcc40096d61595e3d
def get_dvr_event_registration_checkin_warning(self): <NEW_LINE> <INDENT> return self.dvr.get("event_registration_checkin_warning", False)
Warn during event registration when the person is currently not checked-in
625941eb91f36d47f21ac9e7
def push(self, _ = None, value = None): <NEW_LINE> <INDENT> assert value == None <NEW_LINE> if self.shouldPull(): <NEW_LINE> <INDENT> old_val = self.value <NEW_LINE> self.value = self.upstream() <NEW_LINE> if not self.value is old_val: <NEW_LINE> <INDENT> for sub in self.subscribers: <NEW_LINE> <INDENT> sub.push(self,s...
2nd argument is not used. Only pull a new value from upstream if it's fresh. By default always pull. If the value pulled is fresh push it to all subscribers
625941ebd268445f265b535e
def resolution(data_type, scaling_factor): <NEW_LINE> <INDENT> data_type = np.dtype(data_type) <NEW_LINE> if np.issubdtype(data_type, np.integer): <NEW_LINE> <INDENT> return 1/float(scaling_factor) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise ValueError("Float data types not supported")
Computes resolution for data type given scaling factor Parameters ---------- data_type : dtype Numpy data type (or string) scaling_factor : float Scaling factor applied to data
625941eb23e79379d52eea4d
def get_xml_template_data(structfile, metadata, default=_sentinel): <NEW_LINE> <INDENT> return _get_template_data("get_xml_template_data", [structfile, metadata], default=default)
Get all template variables for an XML template
625941eb167d2b6e31219084
def __call__(self, lengths): <NEW_LINE> <INDENT> mcomp = self._func() <NEW_LINE> var, count, max_value, module, cca = self._state[mcomp] <NEW_LINE> value = self._sets[mcomp][count % module] <NEW_LINE> count = count + 1 <NEW_LINE> max_value = max(value, max_value) <NEW_LINE> cgc = mcomp.congruence_class(value) <NEW_LINE...
:param lengths:
625941eb3d592f4c4ed1d54f
def compiler_version(self): <NEW_LINE> <INDENT> VC = 'vc14' <NEW_LINE> version = self.version_label() <NEW_LINE> if version >= '72': <NEW_LINE> <INDENT> VC = 'vc15' <NEW_LINE> <DEDENT> return VC
Return the appropriate compiler version based on PHP version.
625941ebd8ef3951e3243a2d
def test_get_cmd_tcp(cmd_checks): <NEW_LINE> <INDENT> tcp_full = h.get_cmd(cmd_checks["tcp_full"]) <NEW_LINE> assert tcp_full == cmd_checks["tcp_full"]["expected_cmd"]
Test the "get_cmd" function on TCP-based checks.
625941eb711fe17d8254284f
def test02_CityAndHomeModule(self): <NEW_LINE> <INDENT> self.clickId('ll_dingwei') <NEW_LINE> self.assertEqual('北京', self.textId('tv1'), '城市列表中"热门城市"错误') <NEW_LINE> self.assertEqual('上海', self.textId('tv2'), '城市列表中"热门城市"错误') <NEW_LINE> self.assertEqual('广州', self.textId('tv3'), '城市列表中"热门城市"错误') <NEW_LINE> self.assertEq...
城市和首页模块
625941eb73bcbd0ca4b2c565
def convertInt(intValue, signed=False): <NEW_LINE> <INDENT> strValue = str(intValue) <NEW_LINE> if len(strValue) > 1: <NEW_LINE> <INDENT> return strValue <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if strValue == "0" or not signed: <NEW_LINE> <INDENT> return " " + strValue <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT...
Convert an integer into a string, with option for including a preceding +/- sign.
625941eb377c676e91272696
def diff(self, n: int, axis: int = 0) -> list[Block]: <NEW_LINE> <INDENT> values = self.values <NEW_LINE> new_values = values - values.shift(n, axis=axis) <NEW_LINE> return [self.make_block(new_values)]
1st discrete difference. Parameters ---------- n : int Number of periods to diff. axis : int, default 0 Axis to diff upon. Returns ------- A list with a new Block. Notes ----- The arguments here are mimicking shift so they are called correctly by apply.
625941eb0c0af96317bb86d7
def fea_g(self,h,t): <NEW_LINE> <INDENT> dig = self.fea_digit(h,t) <NEW_LINE> all_dig = self.fea_all_digit(h,t) <NEW_LINE> mp = self.fea_map(h,t) <NEW_LINE> g = { self.fea_Tag(h[2],t,h[3],len(h[2])):1, self.fea_Trigram(h[0],h[1],t):1 } <NEW_LINE> if mp !='': <NEW_LINE> <INDENT> g[mp]=1 <NEW_LINE> <DEDENT> if dig != ''...
returns a vector of features for a given history
625941ebb830903b967e9df5
def noteNameRhythmicSearch(thisStreamOrIterator, searchList): <NEW_LINE> <INDENT> def noteNameRhythmAlgorithm(streamEl, searchEl): <NEW_LINE> <INDENT> if 'Wildcard' in searchEl.classes: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if not hasattr(searchEl, 'name'): <NEW_LINE> <INDENT> return False <NEW_LINE> <DED...
>>> thisStream = converter.parse('tinynotation: 3/4 c4 d8 e c d e f c D E c c4 d# e') >>> searchList = [note.Note('C'), note.Note('D'), note.Note('E')] >>> for n in searchList: ... n.duration.type = 'eighth' >>> thisStreamIter = thisStream.recurse().notes >>> search.noteNameRhythmicSearch(thisStreamIter, searchLis...
625941eb3617ad0b5ed683e6