code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def initialize_network(self): <NEW_LINE> <INDENT> if self.threeD: <NEW_LINE> <INDENT> conv_op = nn.Conv3d <NEW_LINE> dropout_op = nn.Dropout3d <NEW_LINE> norm_op = nn.InstanceNorm3d <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> conv_op = nn.Conv2d <NEW_LINE> dropout_op = nn.Dropout2d <NEW_LINE> norm_op = nn.InstanceNor...
- momentum 0.99 - SGD instead of Adam - self.lr_scheduler = None because we do poly_lr - deep supervision = True - i am sure I forgot something here Known issue: forgot to set neg_slope=0 in InitWeights_He; should not make a difference though :return:
625941c56aa9bd52df036db7
def handlingDb(self,sqlls = ()): <NEW_LINE> <INDENT> if self.dbName is not None: <NEW_LINE> <INDENT> operDict = { "delete" : self.dbManager.deleteData, "add": self.dbManager.insertData, "update": self.dbManager.updateData } <NEW_LINE> for sqlSign in sqlls: <NEW_LINE> <INDENT> sqlOperType = self.sqldict[sqlSign][0...
:param sqlls: :return:
625941c5287bf620b61d3a79
def testMailingListFilter1to2(self): <NEW_LINE> <INDENT> f = self.store.findUnique(MailingListFilteringPowerup) <NEW_LINE> self.assertEquals(f.messageSource, self.store.findUnique(MessageSource))
Ensure that MailingListFilteringPowerup gets upgraded and that its 'messageSource' attribute refers to this store's MessageSource.
625941c5956e5f7376d70e82
def p_tf_format_json_arg(self, p): <NEW_LINE> <INDENT> pass
tf_format_json_arg : OPT__SCOPE value_pairs_scope | OPT__EXCLUDE ARG | OPT__KEY name_value_name | OPT__REKEY ARG | OPT__PAIR name_value_pair | OPT__SHIFT ARG | OPT__ADD_PREFIX ARG | OPT__REPLACE_PREFIX ARG | OPT__REPLACE ARG | OPT | ARG
625941c50fa83653e4656fd0
def generate_edges(self): <NEW_LINE> <INDENT> edges = [] <NEW_LINE> for vertex in self._graph_dict: <NEW_LINE> <INDENT> for neighbour_edges in self._graph_dict[vertex]: <NEW_LINE> <INDENT> if isinstance(neighbour_edges, Edge): <NEW_LINE> <INDENT> neighbour_edges = [neighbour_edges] <NEW_LINE> <DEDENT> for neighbour_edg...
A static method generating the edges of the graph "graph". Edges are represented as sets with one (a loop back to the vertex) or two vertices
625941c5851cf427c661a525
def numberOfPaths (X, Y): <NEW_LINE> <INDENT> def recur (x, y): <NEW_LINE> <INDENT> if x==X or y==Y: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return recur (x+1, y) + recur (x, y+1) <NEW_LINE> <DEDENT> <DEDENT> recur (0,0)
Path from 0,0 to x,y either going right or down by unit distance
625941c59f2886367277a8a3
def create(self, vol_opts): <NEW_LINE> <INDENT> volume_info = self.query_aws_volume_info() <NEW_LINE> if volume_info: <NEW_LINE> <INDENT> self.resource_id = volume_info.get("VolumeId", None) <NEW_LINE> logger.info("Found existing volume: %s", self) <NEW_LINE> return self.resource_id <NEW_LINE> <DEDENT> self.populate_at...
Creates the EBS volume on AWS if it doesn't exist. The ax_volume_id is used for uniquely identifying the volume. :returns AWS created resource_id. None if volume creation failed.
625941c5b545ff76a8913e2b
def stripe_horizontally_reverse(x_coordinate_list, y_coordinate_list): <NEW_LINE> <INDENT> start_time = time.time() <NEW_LINE> time.clock() <NEW_LINE> seconds_elapsed = 0 <NEW_LINE> while seconds_elapsed < 15: <NEW_LINE> <INDENT> seconds_elapsed = time.time() - start_time <NEW_LINE> unicornhat.clear() <NEW_LINE> for y_...
Lights up the LEDs based on the x and y coordinates that were sent to it. Parameters: x_coordidate_list: a list of the numbers 0 - 7 y_coordidate_list: a list of the numbers 0 - 3 Programs that use this function: - Horizontal Striper 9 - Horizontal Striper 10 - Horizontal Striper 11 - Horizont...
625941c5377c676e912721bd
def boxes(self): <NEW_LINE> <INDENT> return [ [ dict(id='assigned_inbox_tasks', content=self.assigned_tasks(), href='assigned_inbox_tasks', label=_(u'label_assigned_inbox_tasks', default='Assigned tasks')), dict(id='issued_inbox_tasks', href='issued_inbox_tasks', content=self.issued_tasks(), label=_(u'label_issued_inbo...
Defines the boxes wich are Displayed at the Overview tab
625941c507d97122c417889d
def countPrimes(self, n): <NEW_LINE> <INDENT> if n <= 2: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> li = [0 for i in range(0,n)] <NEW_LINE> li[0] = 1 <NEW_LINE> li[1] = 1 <NEW_LINE> cont = 0 <NEW_LINE> for i in range(2,n): <NEW_LINE> <INDENT> if li[i] == 0: <NEW_LINE> <INDENT> cont += 1 <NEW_LINE> for j in range(...
:type n: int :rtype: int
625941c5b7558d58953c4f2b
def GetProfiles(self, instanceID, raw="true", autoHandleToken=None): <NEW_LINE> <INDENT> return self.__callMethod("GetProfiles", {"instanceID": instanceID, "raw": raw}, autoHandleToken=autoHandleToken)
Get list of archiving and exporting profiles. :param instanceID: Unique ID of MailStore instance in which this command is invoked. :type instanceID: str :param raw: Currently only 'true' is supported. :type raw: bool
625941c5046cf37aa974cd5d
def event_query( query_, view_kwargs, event_id='event_id', event_identifier='event_identifier', permission='is_coorganizer_endpoint_related_to_event', ): <NEW_LINE> <INDENT> if view_kwargs.get(event_id): <NEW_LINE> <INDENT> event = safe_query_kwargs(Event, view_kwargs, event_id) <NEW_LINE> if event.state != 'published'...
Queries the event according to 'event_id' and 'event_identifier' and joins for the query For draft events, if the user is not logged in or does not have required permissions, a 404 is raised :param event_id: String representing event_id in the view_kwargs :param event_identifier: String representing event_identifier in...
625941c58da39b475bd64f87
def get_test_batch(self): <NEW_LINE> <INDENT> x_input_a, x_input_b, y_input_a, y_input_b = self.get_multi_batch("test") <NEW_LINE> return x_input_a, x_input_b, y_input_a, y_input_b
Provides a test batch :return: Returns a tuple of two data batches (i.e. x_i and x_j) to be used for evaluation
625941c5b57a9660fec33897
def calc_word_value(word): <NEW_LINE> <INDENT> return sum([ LETTER_SCORES[letter] for letter in word.upper()])
given a word calculate its value using LETTER_SCORES
625941c524f1403a92600b7c
def wait_for_rpc_connection(self): <NEW_LINE> <INDENT> poll_per_s = 4 <NEW_LINE> for _ in range(poll_per_s * self.rpc_timeout): <NEW_LINE> <INDENT> if self.process.poll() is not None: <NEW_LINE> <INDENT> raise FailedToStartError(self._node_msg( 'betchipd exited with status {} during initialization'.format(self.process....
Sets up an RPC connection to the betchipd process. Returns False if unable to connect.
625941c55fdd1c0f98dc0247
def interpVariance(x, xp, fpUnc, leftVar=None, rightVar=None, period=None): <NEW_LINE> <INDENT> x = np.asarray(x) <NEW_LINE> xp = np.asarray(xp) <NEW_LINE> fpUnc = np.asarray(fpUnc) <NEW_LINE> yVar = np.zeros(x.shape) <NEW_LINE> indices = np.searchsorted(xp, x, side='left') <NEW_LINE> for i, index in enumerate(indices)...
Propagate uncertainty for linear interpolation. Parameters ---------- x : numpy.ndarray, list The x-coordinates at which to evaluate the interpolated values. xp : numpy.ndarray, list The 1D x-coordinates of the data points, must be increasing order fpUnc : numpy.ndarray, list The uncertainty in ...
625941c5097d151d1a222e6f
def block(self, flag): <NEW_LINE> <INDENT> self.s.setblocking(flag)
Sets The Blocking Value.
625941c5097d151d1a222e70
def _UploadFiles(upload_dir, files): <NEW_LINE> <INDENT> if files: <NEW_LINE> <INDENT> google_storage_upload_dir = os.path.join(_RENDER_TEST_BUCKET, upload_dir) <NEW_LINE> cmd = [os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'gsutil.py'), '-m', 'cp'] <NEW_LINE> cmd.extend(files) <NEW_LINE> cmd.append(google_storage_u...
Upload files to the render tests GS bucket.
625941c5009cb60464c633c7
def emit(self, message, ignore = []): <NEW_LINE> <INDENT> if hasattr(self, 'invisible') and self.invisible == True: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> holder = self.location <NEW_LINE> if not holder: <NEW_LINE> <INDENT> holder = self <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> if holder not in ignore and h...
Write a message to be seen by creatures holding this Thing or in the same room, skipping creatures in the list <ignore>.
625941c5d164cc6175782d62
def which(program): <NEW_LINE> <INDENT> head, _ = op.split(program) <NEW_LINE> if head: <NEW_LINE> <INDENT> if is_exe(program): <NEW_LINE> <INDENT> return program <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> for path in environ["PATH"].split(pathsep): <NEW_LINE> <INDENT> exe_file = op.join(path, program) <NEW...
Check program is exists.
625941c556ac1b37e62641e6
def __init__(self, params=None): <NEW_LINE> <INDENT> super(FPA, self).__init__() <NEW_LINE> self.beta = 1.5 <NEW_LINE> self.eta = 0.2 <NEW_LINE> self.p = 0.8 <NEW_LINE> self.build(params) <NEW_LINE> logger.info('Class overrided.')
Initialization method. Args: params (dict): Contains key-value parameters to the meta-heuristics.
625941c582261d6c526ab4b2
def es_calc(airtemp): <NEW_LINE> <INDENT> airtemp = pd.to_numeric(airtemp, errors="coerce") <NEW_LINE> mask = airtemp > 0 <NEW_LINE> es = pd.Series(0.0, index=airtemp.index) <NEW_LINE> es[mask] = 6.1121 * np.exp( ( (18.678 - (airtemp[mask] / 234.5)) * (airtemp[mask] / (257.14 + airtemp[mask])) ).astype(float) ) <NEW_LI...
Function to calculate saturated vapour pressure from temperature. Uses the Arden-Buck equations. Parameters: - airtemp : (data-type) measured air temperature [Celsius]. Returns: - es : (data-type) saturated vapour pressure [kPa]. References ---------- https://en.wikipedia.org/wiki/Arden_Buck_equation Buck,...
625941c5e76e3b2f99f3a823
def readExtracts(options, map_component2input_id): <NEW_LINE> <INDENT> if not options.filename_extract_regions: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if options.use_input_id: <NEW_LINE> <INDENT> map_id2component = IOTools.getInvertedDictionary( map_component2input_id) <NEW_LINE> <DEDENT> else: <NEW_LINE> ...
read extract information from filename supplied in the options.
625941c563b5f9789fde70fa
def set_value(self, host_role, value_role, value_value): <NEW_LINE> <INDENT> blocks = self.mango_tree.xpath("//INSTANCE[@dmrole='" + host_role + "']") <NEW_LINE> value_block = None <NEW_LINE> found = False <NEW_LINE> for block in blocks: <NEW_LINE> <INDENT> if "dmref" in block.attrib.keys(): <NEW_LINE> <INDENT> block =...
Set the @value attributes of all ATTRIBUTEs having value_role as role and hosted by an INSTANCE having host_role as role :param host_role: Role of the host INSTANCE of the ATTRIBUTE which @value must be set :type host_role: String :param value_role: Role of the ATTRIBUTE which @value must be set :type value_value: Str...
625941c516aa5153ce36248d
def initialize_modules(): <NEW_LINE> <INDENT> from gi.repository import Gdk <NEW_LINE> Gdk.init([]) <NEW_LINE> from gi.repository import GtkClutter <NEW_LINE> GtkClutter.init([]) <NEW_LINE> import gi <NEW_LINE> if not gi.version_info >= (3, 11): <NEW_LINE> <INDENT> from gi.repository import GObject <NEW_LINE> GObject.t...
Initialize the modules. This has to be done in a specific order otherwise the app crashes on some systems.
625941c5796e427e537b05d9
def getYa(self, t): <NEW_LINE> <INDENT> return self.getY(t)+.5*self.L*np.sin(self.w*t)
Baton Y position at t
625941c5b830903b967e9921
def _find_from_nearly(self, nearly): <NEW_LINE> <INDENT> possibles = [ w for w in self.wires if len(w - nearly) == 1 and len(w) == len(nearly) + 1 ] <NEW_LINE> assert len(possibles) == 1 <NEW_LINE> found_number = possibles[0] <NEW_LINE> extra_letter = found_number - nearly <NEW_LINE> return found_number, extra_letter
Find a scrambled wire which has one extra bit as compared to ``nearly``. Also return the extra letter.
625941c5090684286d50ecf9
@commands('setchanneltimeformat', 'setctf') <NEW_LINE> @example('.setctf %Y-%m-%dT%T%z') <NEW_LINE> def update_channel_format(bot, trigger): <NEW_LINE> <INDENT> if bot.privileges[trigger.sender][trigger.nick] < OP: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> tformat = trigger.group(2) <NEW_LINE> if not tformat: <NEW...
Sets your preferred format for time. Uses the standard strftime format. You can use http://strftime.net or your favorite search engine to learn more.
625941c5379a373c97cfab59
def get(command): <NEW_LINE> <INDENT> url = path.format(path, host=host, command=command) <NEW_LINE> req = requests.get(url) <NEW_LINE> return req.json()
Return JSON block from the console API
625941c510dbd63aa1bd2bb9
def setup(app): <NEW_LINE> <INDENT> from functools import partial <NEW_LINE> from sphinx.ext import autodoc <NEW_LINE> from ui_tests.third_party.utils import get_unwrapped_func <NEW_LINE> orig_getargspec = autodoc.getargspec <NEW_LINE> def patched_getargspec(func): <NEW_LINE> <INDENT> if type(func) is not partial: <NEW...
Customize function args retrieving to get args under decorator.
625941c59b70327d1c4e0de9
def make_vcard(name, displayname, email=None, phone=None, fax=None, videophone=None, memo=None, nickname=None, birthday=None, url=None, pobox=None, street=None, city=None, region=None, zipcode=None, country=None, org=None, lat=None, lng=None, source=None, rev=None, title=None, photo_uri=None): <NEW_LINE> <INDENT> retur...
Creates a QR code which encodes a `vCard <https://en.wikipedia.org/wiki/VCard>`_ version 3.0. Only a subset of available `vCard 3.0 properties <https://tools.ietf.org/html/rfc2426>` is supported. :param str name: The name. If it contains a semicolon, , the first part is treated as lastname and the second part...
625941c5cc0a2c11143dcea5
def lengthOfLastWord(self, s): <NEW_LINE> <INDENT> length = 0 <NEW_LINE> need_clear = True <NEW_LINE> for i in range(0, len(s)): <NEW_LINE> <INDENT> if s[i] != ' ' : <NEW_LINE> <INDENT> if need_clear : <NEW_LINE> <INDENT> length = 1 <NEW_LINE> need_clear = False <NEW_LINE> <DEDENT> else : <NEW_LINE> <INDENT> length += ...
:type s: str :rtype: int
625941c545492302aab5e2d7
def test_add__team_duplicate(self): <NEW_LINE> <INDENT> dup_url = 'http://www.youtube.com/watch?v=WqJineyEszo' <NEW_LINE> team2 = TeamMemberFactory.create( user = self.manager_user).team <NEW_LINE> self.videos_tab.log_in(self.manager_user.username, 'password') <NEW_LINE> self.videos_tab.open_videos_tab(team2.slug) <NEW...
Duplicate videos are not added again.
625941c599fddb7c1c9de3a7
def _HandleMockAction(self, message): <NEW_LINE> <INDENT> responses = getattr(self, message.name)(message.payload) <NEW_LINE> ret = [] <NEW_LINE> for i, r in enumerate(responses): <NEW_LINE> <INDENT> ret.append( rdf_flows.GrrMessage( session_id=message.session_id, request_id=message.request_id, task_id=message.Get("tas...
Handles the action in case it's a mock.
625941c5711fe17d82542383
def initConfigInfo(deviceId: str, guid: str): <NEW_LINE> <INDENT> cur_dir = os.path.dirname(__file__) <NEW_LINE> if os.path.exists(os.path.join(os.path.dirname(cur_dir), "ConfigInfo.ini")): <NEW_LINE> <INDENT> conf_file = os.path.join(os.path.dirname(cur_dir), "ConfigInfo.ini") <NEW_LINE> <DEDENT> else: <NEW_LINE> <IND...
根目录下的配置文件优先级 > 本文件同级中的配置文件
625941c53cc13d1c6d3c7390
def largestPalindrome(self, n): <NEW_LINE> <INDENT> ans = [9, 987, 123, 597, 677, 1218, 877, 475] <NEW_LINE> return ans[n - 1]
:type n: int :rtype: int
625941c5c4546d3d9de72a48
def insert_at_end(self, data): <NEW_LINE> <INDENT> node = Node() <NEW_LINE> node.set_data(data) <NEW_LINE> node.set_next(None) <NEW_LINE> if self.length == 0: <NEW_LINE> <INDENT> self.set_head(node) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> current = self.head <NEW_LINE> while current.has_next: <NEW_LINE> <INDENT> ...
Method for inserting a new node at the end of the linked list :param data: value to be inserted :return: None
625941c563f4b57ef0001132
def move_player(self, up, down, left, right): <NEW_LINE> <INDENT> x, y = self.main_player._get_velocity() <NEW_LINE> if up: <NEW_LINE> <INDENT> y -= 50 <NEW_LINE> <DEDENT> if down: <NEW_LINE> <INDENT> y += 50 <NEW_LINE> <DEDENT> if left: <NEW_LINE> <INDENT> x -= 50 <NEW_LINE> <DEDENT> if right: <NEW_LINE> <INDENT> x +=...
:param jump: bool :param left: bool :param right: bool :return:
625941c576e4537e8c351686
def get_atomtypes_from_formula(formula): <NEW_LINE> <INDENT> from ase.symbols import string2symbols <NEW_LINE> symbols = string2symbols(formula.split('_')[0]) <NEW_LINE> atomtypes = [symbols[0]] <NEW_LINE> for s in symbols[1:]: <NEW_LINE> <INDENT> if s != atomtypes[-1]: <NEW_LINE> <INDENT> atomtypes.append(s) <NEW_LINE...
Return atom types from chemical formula (optionally prepended with and underscore).
625941c529b78933be1e56c3
def get_latest_chart_data(self, symbol): <NEW_LINE> <INDENT> if symbol in self.last_market_data: <NEW_LINE> <INDENT> return self.last_market_data[symbol] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None
returns something like this: {'active_id': 102, 'symbol': 'GBPCAD', 'bid': 1.7419499999999999, 'ask': 1.74222, 'value': 1.742085, 'volume': 0, 'time': 1512058717, 'closed': False, 'show_value': 1.742085, 'buy': 1.74222, 'sell': 1.7419499999999999}
625941c57d847024c06be2cf
def main(): <NEW_LINE> <INDENT> salary = [] <NEW_LINE> number_of_months = int(input("How many months? ")) <NEW_LINE> report_income(number_of_months, salary) <NEW_LINE> print_report(number_of_months, salary)
Display income report for incomes over a given number of months.
625941c5de87d2750b85fda7
def save(self): <NEW_LINE> <INDENT> updated_plan = {} <NEW_LINE> for attr, value in self._polarion_record.__dict__.items(): <NEW_LINE> <INDENT> for key in value: <NEW_LINE> <INDENT> current_value = getattr(self, key) <NEW_LINE> prev_value = getattr(self._original_polarion, key) <NEW_LINE> if current_value != prev_value...
Update the plan in polarion
625941c5507cdc57c6306ced
def to_dtype(x, dtype): <NEW_LINE> <INDENT> if np.issubdtype(dtype, np.integer): <NEW_LINE> <INDENT> return quantize(x, dtype=dtype) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return x.astype(dtype)
Convert an array to a target dtype. Quantize if integrable. Parameters ---------- x : np.ndarray The input data dtype : np.dtype or type specification The target dtype Returns ------- x_dtype : np.ndarray, dtype=dtype The converted data. If dtype is integrable, `x_dtype` will be quantized. See Als...
625941c5460517430c39419e
def test_disable_registration_for_anonymous(self): <NEW_LINE> <INDENT> self.failIf('Add portal member' in [r['name'] for r in self.portal.permissionsOfRole('Anonymous') if r['selected']])
Test if anonymous visitors are prevented to register to the site.
625941c5004d5f362079a349
def process_python_function(self): <NEW_LINE> <INDENT> exec(self.python_text) <NEW_LINE> self.func = locals()[self.function_name] <NEW_LINE> return self.func
Evaluates the python text to generate a function in scope
625941c58e71fb1e9831d7bf
def override_config(self, options): <NEW_LINE> <INDENT> for k, v in options.items(): <NEW_LINE> <INDENT> if k not in self.config: <NEW_LINE> <INDENT> raise KeyError("'{}' is not a valid option for '{}'".format(k, self.__class__.__name__)) <NEW_LINE> <DEDENT> self.validate_options(k, v) <NEW_LINE> self.config[k] = v
Override the default configuration.
625941c5009cb60464c633c8
def New(*args, **kargs): <NEW_LINE> <INDENT> obj = itkFFTShiftImageFilterIUL3IUL3.__New_orig__() <NEW_LINE> import itkTemplate <NEW_LINE> itkTemplate.New(obj, *args, **kargs) <NEW_LINE> return obj
New() -> itkFFTShiftImageFilterIUL3IUL3 Create a new object of the class itkFFTShiftImageFilterIUL3IUL3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named paramete...
625941c5cc0a2c11143dcea6
def get_bulk_data(self, market_interface_id, symbol, start_time, end_time, frequency): <NEW_LINE> <INDENT> pass
Get data in bulk for a certain symbol during a certain time period. The market interface will send it in one, big response. Useful for getting historical data during setup. :param market_interface_id: :param symbol: :param start_time: :param end_time: :param frequency: :return:
625941c566656f66f7cbc1c0
def rmdir(self, path): <NEW_LINE> <INDENT> VixVM_DeleteDirectoryInGuest(self._vm, path)
rmdir(path) -> remove a directory in VM
625941c5a8370b77170528b6
def is_not_in_business_hours(self, day): <NEW_LINE> <INDENT> if self.hours is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if self.hours[0] < self.hours[1]: <NEW_LINE> <INDENT> return day.time() < self.hours[0] or day.time() > self.hours[1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return day.time() <...
Returns if the datetime is not in business hours. >>> policy = Policy(hours=(time(8, 30), time(20, 30))) >>> policy.is_not_in_business_hours(datetime(2011, 7, 1, 8, 0, 0)) True >>> policy.is_not_in_business_hours(datetime(2011, 7, 1, 15, 0, 0)) False
625941c5236d856c2ad447ee
def put(self, url, *args, **kwargs): <NEW_LINE> <INDENT> return self._session.put(self.url + url, *args, **kwargs)
This is a proxy HTTP PUT method on a requests.session object. Supplied URL should be a relative URL (e.g. /accounts, not api.recurly.com/accounts). Returns a raw response object.
625941c630bbd722463cbdda
def test_array_dtype(self): <NEW_LINE> <INDENT> dt1 = np.dtype('f4', (2,)) <NEW_LINE> dt2 = np.dtype('f4', [2]) <NEW_LINE> dt3 = np.dtype('f4', 2) <NEW_LINE> dt4 = np.dtype('f4', 2.1) <NEW_LINE> ht1 = h5t.py_create(dt1) <NEW_LINE> ht2 = h5t.py_create(dt2) <NEW_LINE> ht3 = h5t.py_create(dt3) <NEW_LINE> ht4 = h5t.py_crea...
(Types) Array dtypes using non-tuple shapes
625941c50fa83653e4656fd1
def visit_Yield(self, node): <NEW_LINE> <INDENT> self.add_return_yield(node, "yield") <NEW_LINE> if node.value: <NEW_LINE> <INDENT> self.visit(node.value)
Visit Yield. Create special variable
625941c5d53ae8145f87a287
def generatelist(self): <NEW_LINE> <INDENT> blas, formula = BlasFormula.explain(self.formula) <NEW_LINE> formula_obj = formula_factory(formula, self.year) <NEW_LINE> formula_obj.generatelist() <NEW_LINE> if len(formula_obj.dates_list) != 1: <NEW_LINE> <INDENT> raise FormulaException('Дата не должны быть списком') <NEW_...
создание списка дат
625941c660cbc95b062c6558
@validator <NEW_LINE> def workbook_contains_workflow(config, clients, deployment, workbook, workflow_name): <NEW_LINE> <INDENT> wf_name = config.get("args", {}).get(workflow_name) <NEW_LINE> if wf_name: <NEW_LINE> <INDENT> wb_path = config.get("args", {}).get(workbook) <NEW_LINE> wb_path = os.path.expanduser(wb_path) <...
Validate that workflow exist in workbook when workflow is passed :param workbook: parameter containing the workbook definition :param workflow_name: parameter containing the workflow name
625941c68e7ae83300e4afe1
def __addMethodsAPI(self, className): <NEW_LINE> <INDENT> _class = self.module.classes[className] <NEW_LINE> methods = _class.methods.keys() <NEW_LINE> methods.sort() <NEW_LINE> if '__init__' in methods: <NEW_LINE> <INDENT> methods.remove('__init__') <NEW_LINE> if _class.isPublic(): <NEW_LINE> <INDENT> id = Editor.Clas...
Private method to generate the api section for class methods. @param classname Name of the class containing the method. (string)
625941c621a7993f00bc7d03
def process(input_str: str) -> str: <NEW_LINE> <INDENT> pattern_rm_blank_within_cn = re.compile(r"([\u4e00-\u9fa5]+)\s+([\u4e00-\u9fa5]+)") <NEW_LINE> pattern_rm_multi_blank = re.compile(r"\s+", re.S) <NEW_LINE> str1 = input_str.strip() <NEW_LINE> str1 = re.sub(pattern_rm_multi_blank, " ", str1) <NEW_LINE> while re.sea...
[summary] Args: input_str ([str]): [be processed string] Returns: [str]: [remove blank string] Desc.: use re
625941c676d4e153a657eb46
def check_game_over(supply_piles): <NEW_LINE> <INDENT> num_empty_piles = len([i for i in supply_piles.values() if i == 0]) <NEW_LINE> if num_empty_piles >= 3 or supply_piles['Province'] == 0: <NEW_LINE> <INDENT> game_over = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> game_over = False <NEW_LINE> <DEDENT> return ...
Check for game over.
625941c65fcc89381b1e16d3
def __init__(self, zone): <NEW_LINE> <INDENT> self._zone = zone
Initialize the sensor device.
625941c6462c4b4f79d1d6e6
def _run_apid_test(apid): <NEW_LINE> <INDENT> dir_path = os.path.dirname(os.path.realpath(__file__)) <NEW_LINE> apid_dir = os.path.join(dir_path, 'data', 'hs', 'apid{:03d}'.format(apid)) <NEW_LINE> defs_file_path = os.path.join(apid_dir, 'defs.csv') <NEW_LINE> truth_file_path = glob.glob(os.path.join(apid_dir, '*.cvt.c...
Driver for running an APID test. Each apidXXX directory under `data/hs` contains: defs.csv -- packet definition with conversions. xxxx.tlm -- binary CCSDS file xxxx.cvt.csv -- CSV holding contents of what CCSDS file should decode to after conversions.
625941c6ec188e330fd5a7b7
def score_with(self, name, target, metric_function, metric_name): <NEW_LINE> <INDENT> X, y = self.tensorize(target) <NEW_LINE> self.clfs[name].metric(X, y, metric_function, metric_name) <NEW_LINE> return self
Score data with clf named name using metric
625941c6f9cc0f698b140612
def set_parameters_0(self, **kwargs): <NEW_LINE> <INDENT> return self.api.set_parameters_0(bt_locator=self, **kwargs)
:param async_req: bool :param Properties body: :param str fields: :return: Properties
625941c663d6d428bbe44505
def get_odd_magic_square(degree: int): <NEW_LINE> <INDENT> if degree < 3: <NEW_LINE> <INDENT> raise ValueError('invalid degree') <NEW_LINE> <DEDENT> if degree % 2 == 0: <NEW_LINE> <INDENT> raise ValueError('invalid degree') <NEW_LINE> <DEDENT> nums = list(range(1, 1 + degree * degree)) <NEW_LINE> magic_square = _new_em...
奇数阶幻方 :param degree: :return:
625941c6d10714528d5ffcf7
def format_datetime(epoch): <NEW_LINE> <INDENT> return strftime("%a %b %d %Y %I:%M:%S%p", localtime(epoch))
Define standard datetime string
625941c638b623060ff0ae03
def addmap( self, data: ArrayLike, name: str | None = None, step: Sequence[float] | None = None, origin: Sequence[float] | None = None, cell_angles=None, rotation_axis: Sequence[float] | None = None, rotation_angle: float | None = None, symmetries=None, astype: numpy.dtype = None, subsample: int = 16, chunks: bool = Tr...
Create HDF5 group and datasets according to CMAP format. The order of axes is XYZ for 'step', 'origin', 'cell_angles', and 'rotation_axis'. Data 'shape' and 'chunks' sizes are in ZYX order. Parameters ---------- data : array_like Map data to store. Must be three dimensional. name : str, optional Name of map. ...
625941c685dfad0860c3ae70
def set_status_working(self): <NEW_LINE> <INDENT> self._status = SpiderStatus.WORKING
改变状态为繁忙 :return: None
625941c6e64d504609d74855
def stabilized_content(self): <NEW_LINE> <INDENT> if not self.is_9999(): <NEW_LINE> <INDENT> raise KeyError('source for stabilizing must be unstable') <NEW_LINE> <DEDENT> keywords_stable = 'KEYWORDS="*"' <NEW_LINE> keywords_unstable = 'KEYWORDS="~*"' <NEW_LINE> content = self.read() <NEW_LINE> count = content.count(key...
Copy and modify unstable contents to be stable.
625941c6a219f33f34628981
def enquote(x) -> str: <NEW_LINE> <INDENT> return '"' + str(x) + '"'
Wraps an object in double quotes. Convenience function to resolve deeply nested single and double quote conflicts in python strings. Args: x: Any object Returns: A string, the object as a string wrapped in double quotes.
625941c616aa5153ce36248e
def draw_single_bbox(self, bbox, color=None): <NEW_LINE> <INDENT> if color is None: <NEW_LINE> <INDENT> color = np.random.rand(3) * 255 <NEW_LINE> <DEDENT> cv2.rectangle(self.img, (int(bbox[0]), int(bbox[1])), (int(bbox[2]), int(bbox[3])), color, 2)
img: a numpy array bbox: a list or 1d array or tensor with size 4, in x1y1x2y2 format
625941c65fcc89381b1e16d4
def get_months(mlist): <NEW_LINE> <INDENT> date_first = cache.get_or_set( "MailingList:%s:first_date" % mlist.name, lambda: mlist.emails.order_by("date" ).values_list("date", flat=True).first(), None) <NEW_LINE> if not date_first: <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> archives = {} <NEW_LINE> now = datetime...
Return a dictionnary of years, months for which there are potentially archives available for a given list (based on the oldest post on the list). :arg list_name, name of the mailing list in which this email should be searched.
625941c6cb5e8a47e48b7ac2
def is_bad_char(x): <NEW_LINE> <INDENT> return x in [':', ';', '<', '>', '"', '\\', '/', '|', '?', '!', '*']
Function that checks if a character cannot exist inside a file name Args: x: Char inside the file name Returns: True/ False if x contains a character that cannot be in a file name
625941c6435de62698dfdc62
@tasklets.tasklet <NEW_LINE> def put(entity, options): <NEW_LINE> <INDENT> context = context_module.get_context() <NEW_LINE> use_global_cache = context._use_global_cache(entity.key, options) <NEW_LINE> use_datastore = context._use_datastore(entity.key, options) <NEW_LINE> if not (use_global_cache or use_datastore): <NE...
Store an entity in datastore. The entity can be a new entity to be saved for the first time or an existing entity that has been updated. Args: entity_pb (datastore.Entity): The entity to be stored. options (_options.Options): Options for this request. Returns: tasklets.Future: Result will be completed da...
625941c65fc7496912cc3994
@app.route('/') <NEW_LINE> @app.route('/index') <NEW_LINE> @app.route('/index.html') <NEW_LINE> def index(): <NEW_LINE> <INDENT> user = users.get_current_user() <NEW_LINE> if user: <NEW_LINE> <INDENT> return template('index', name=g_name, user = user.nickname(), log_in_out = users.create_logout_url('/'), opt = 'Выход')...
Handler for index page
625941c61d351010ab855b32
def __call__(self,game): <NEW_LINE> <INDENT> scoring = self.scoring if self.scoring else ( lambda g: g.scoring() ) <NEW_LINE> first = self.win_score <NEW_LINE> next = (lambda lowerbound, upperbound, bestValue: bestValue) <NEW_LINE> self.alpha = mtd(game, first, next, self.depth, scoring, self.tt) <NEW_LINE> return game...
Returns the AI's best move given the current state of the game.
625941c64e4d5625662d43ef
def connect(self): <NEW_LINE> <INDENT> dbroot = self.dbroot <NEW_LINE> kwargs = dict(host=dbroot.host, database=dbroot.dbname, user=dbroot.user, password=dbroot.password, port=dbroot.port) <NEW_LINE> kwargs = dict( [(k, v) for k, v in list(kwargs.items()) if v != None]) <NEW_LINE> conn = DictConnectionWrapper(**kwargs)...
Return a new connection object: provides cursors accessible by col number or col name @return: a new connection object
625941c6cc40096d61595967
def addMSecLL(self, *args): <NEW_LINE> <INDENT> return _AriaPy.ArTime_addMSecLL(self, *args)
addMSecLL(self, long long ms) -> bool
625941c6507cdc57c6306cee
def test_gen_detection_uuid(): <NEW_LINE> <INDENT> t_uuid = "SomeDataElementChecksumUUID" <NEW_LINE> t_bbox = AxisAlignedBoundingBox([2.6, 82], [98, 83.7]) <NEW_LINE> t_labels = ('l1', 'l2', 42) <NEW_LINE> n = 100 <NEW_LINE> initial_uuid = ObjectDetector._gen_detection_uuid(t_uuid, t_bbox, t_labels) <NEW_LINE> for i in...
Test that, for the same input data, we consistently get the same UUID for some number of repetitions.
625941c6d58c6744b4257c76
def reputation(self): <NEW_LINE> <INDENT> return math.floor(math.log(self.reputation_points))
Видимые игроку очки дурной славы. Рассчитываются по хитрой формуле.
625941c67b25080760e39470
def y(self): <NEW_LINE> <INDENT> return float()
float KPlotPoint.y()
625941c692d797404e3041a0
def click_rate_plan_grid_inline_action_button(self, name): <NEW_LINE> <INDENT> is_clicked = None <NEW_LINE> try: <NEW_LINE> <INDENT> self.logger.info('Start: click rate plan grid inline action button') <NEW_LINE> self._carrier_page.click_rate_plan_grid_inline_action_button(name) <NEW_LINE> is_clicked = True <NEW_LINE> ...
Returning click rate plan grid inline action button Implementing logging for click rate plan grid inline action button functionality :return: True/False
625941c6498bea3a759b9ac6
def test_used_email(self): <NEW_LINE> <INDENT> data = json.dumps({ "username" : "sameemail", "email" : "userkkk@gmail.com", "password" : "secret12345", "confirm_password" : "secret12345", "admin" : True}) <NEW_LINE> response1 = self.app.post( '/api/v3/users', data=data, content_type='application/json', headers=self.adm...
Tests successfully creating a new user
625941c68a43f66fc4b5407d
def getAnalysesNum(self): <NEW_LINE> <INDENT> verified = 0 <NEW_LINE> total = 0 <NEW_LINE> for analysis in self.getAnalyses(): <NEW_LINE> <INDENT> review_state = analysis.review_state <NEW_LINE> if review_state in ['verified' ,'published']: <NEW_LINE> <INDENT> verified += 1 <NEW_LINE> <DEDENT> if review_state not in 'r...
Return the amount of analyses verified/total in the current AR
625941c6a4f1c619b28b0052
@register.filter(name='substract') <NEW_LINE> def substract(arg1, arg2): <NEW_LINE> <INDENT> return arg1-arg2
substract arg2 from arg1
625941c6a934411ee37516aa
def rec(t, n, b): <NEW_LINE> <INDENT> if b < 1 or b > n or t+b < n: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> elif t + b == n: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> elif t == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> elif b == n: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> else: <NEW_LI...
b is current board space
625941c6cdde0d52a9e53048
def lagrangian_optimizer_fmeasure( train_set, epsilon, learning_rate, learning_rate_constraint, loops): <NEW_LINE> <INDENT> x_train, y_train, z_train = train_set <NEW_LINE> dimension = x_train.shape[-1] <NEW_LINE> tf.reset_default_graph() <NEW_LINE> features_tensor = tf.constant(x_train.astype("float32"), name="feature...
Implements surrogate-based Lagrangian optimizer (Algorithm 3). Specifically solves: max F-measure s.t. F-measure(group1) >= F-measure(group0) - epsilon. Args: train_set: (features, labels, groups) epsilon: float, constraint slack. learning_rate: float, learning rate for model parameters. learning_rate_const...
625941c6956e5f7376d70e84
def spellit(self, irc, msg, args, text): <NEW_LINE> <INDENT> d = {} <NEW_LINE> if self.registryValue('spellit.replaceLetters'): <NEW_LINE> <INDENT> d.update(self._spellLetters) <NEW_LINE> <DEDENT> if self.registryValue('spellit.replaceNumbers'): <NEW_LINE> <INDENT> d.update(self._spellNumbers) <NEW_LINE> <DEDENT> if se...
<text> Returns <text>, phonetically spelled out.
625941c68c0ade5d55d3e9d0
def process_template(self): <NEW_LINE> <INDENT> out_base = self.options.out_file <NEW_LINE> for index in range(len(self.template_data['ride_list'])): <NEW_LINE> <INDENT> self.template_data['route_index'] = index <NEW_LINE> self.options.out_file = "%s_%s.xml" % (out_base, index) <NEW_LINE> TemplateProcessor.process_temp...
Generate a template file for each ride in the rideset.
625941c6c432627299f04c5b
def disableUser(self, args={}): <NEW_LINE> <INDENT> if not 'id' in args: <NEW_LINE> <INDENT> raise RuntimeError("Missing required argument 'id'") <NEW_LINE> <DEDENT> return self.request('disableUser', args)
Disables a user account args - A dictionary. The following are options for keys: id - Disables user by user ID.
625941c6851cf427c661a526
def keys(self): <NEW_LINE> <INDENT> return self.groups.keys()
Return keys in group.
625941c630dc7b766590197e
def test_cauchy_predict_is_intervals_bbvi(): <NEW_LINE> <INDENT> model = pf.GAS(data=data, ar=1, sc=1, family=pf.Cauchy()) <NEW_LINE> x = model.fit('BBVI', iterations=100) <NEW_LINE> predictions = model.predict_is(h=10, intervals=True) <NEW_LINE> assert(np.all(predictions['99% Prediction Interval'].values > predictions...
Tests prediction intervals are ordered correctly
625941c68da39b475bd64f89
def f(s: str) -> bool: <NEW_LINE> <INDENT> return bool(re.compile("ab?c").match(s))
post: implies(_, len(s) <= 3)
625941c6377c676e912721bf
def read_date(self): <NEW_LINE> <INDENT> return self.send_command_async("read date")
" Supposedly reads the date and time set on the device. The return value is of the form 'YY MM DD hh mm' with two digit values of year, month, day of month, hour and minute respectively. I also noticed that the clock didn't seem to run on the device until after calling 'set date' for the first time. Before that it w...
625941c6442bda511e8be430
def load_profile_image(account): <NEW_LINE> <INDENT> if account.provider == 'google': <NEW_LINE> <INDENT> url = account.extra_data['picture'] <NEW_LINE> if not url or GOOGLE_BLANKMAN_URLPART in url: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> <DEDENT> if account.provider == 'facebook': <NEW_LINE> <INDENT> url = FB_A...
Load social media profile image.
625941c6b7558d58953c4f2d
def main(): <NEW_LINE> <INDENT> store = file.Storage('token.json') <NEW_LINE> creds = store.get() <NEW_LINE> if not creds or creds.invalid: <NEW_LINE> <INDENT> flow = client.flow_from_clientsecrets('credentials.json', SCOPES) <NEW_LINE> creds = tools.run_flow(flow, store) <NEW_LINE> <DEDENT> service = build('calendar',...
Shows basic usage of the Google Calendar API. Prints the start and name of the next 10 events on the user's calendar.
625941c6ec188e330fd5a7b8
def isna(self) -> 'Series': <NEW_LINE> <INDENT> values = _isna(self.values) <NEW_LINE> values.flags.writeable = False <NEW_LINE> return self.__class__(values, index=self._index)
Return a same-indexed, Boolean Series indicating which values are NaN or None.
625941c624f1403a92600b7e
def test_meta_schedule_rpc_single_run(): <NEW_LINE> <INDENT> mod = MatmulModule <NEW_LINE> builder = LocalBuilder() <NEW_LINE> (builder_result,) = builder.build([BuilderInput(mod, Target("llvm"))]) <NEW_LINE> assert builder_result.artifact_path is not None <NEW_LINE> assert builder_result.error_msg is None <NEW_LINE> r...
Test meta schedule rpc runner for a single run
625941c65fdd1c0f98dc0249
def to_string(self, identifier = True, decimals=6, spacing=4): <NEW_LINE> <INDENT> return self.__str__(identifier=identifier, spacing=spacing, decimals=decimals)
Parameters ---------- identifier: bool whether to print the identifier decimals: int number of decimal digits desired spacing: int number of spaces desired
625941c6442bda511e8be431
def save( self ): <NEW_LINE> <INDENT> widget = self.uiConfigSTACK.currentWidget() <NEW_LINE> if ( widget ): <NEW_LINE> <INDENT> widget.save()
Saves the current widget's settings.
625941c6377c676e912721c0
def itkMaskedRankImageFilterIUS2IUL2IUS2SE2_cast(*args): <NEW_LINE> <INDENT> return _itkMaskedRankImageFilterPython.itkMaskedRankImageFilterIUS2IUL2IUS2SE2_cast(*args)
itkMaskedRankImageFilterIUS2IUL2IUS2SE2_cast(itkLightObject obj) -> itkMaskedRankImageFilterIUS2IUL2IUS2SE2
625941c6097d151d1a222e72
def load_list(path, dtype=None): <NEW_LINE> <INDENT> with open(path, encoding='utf-8') as f: <NEW_LINE> <INDENT> docs = [doc.strip() for doc in f] <NEW_LINE> <DEDENT> return docs
This function used to create carblog data with raw scraped data.
625941c6d18da76e235324eb