code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _get_max_depth(average_coverage, params, data): <NEW_LINE> <INDENT> if dd.get_coverage_interval(data) == "genome": <NEW_LINE> <INDENT> avg_cov = min(30.0, average_coverage) <NEW_LINE> return avg_cov * params["high_multiplier"]
Calculate maximum depth based on a rough multiplier of average coverage.
625941d238b623060ff0af9d
def ensure_limited_fields(self, record, fields): <NEW_LINE> <INDENT> for field in record: <NEW_LINE> <INDENT> if not field in fields: <NEW_LINE> <INDENT> raise ValueError('%s not allowed in this record.' % field)
Ensure a record has a only the specified fields. @param record: The (soon to be saved) database record to check. @type record: dict @param fields: The only fields that may be present. @type fields: list of str @raise ValueError: Raised if a field in the record is not in the fields list.
625941d2377c676e91272358
def load_suites(suite_path, rule): <NEW_LINE> <INDENT> suites = unittest.TestSuite() <NEW_LINE> discover = unittest.defaultTestLoader.discover(start_dir=suite_path, pattern=rule, top_level_dir=None ) <NEW_LINE> suites.addTests(discover) <NEW_LINE> return suites
加载制定目录下的所有测试用例 :param suite_path: 用例所在的路径 :param rule: 用例文件的规则 :return: 返回所有用例
625941d24c3428357757c4d7
def wr_png(self, fout_png="components.png", prt=sys.stdout, **kwargs): <NEW_LINE> <INDENT> import pydot <NEW_LINE> label = get_png_label(self.ID, kwargs) <NEW_LINE> G = pydot.Dot(label=label, graph_type='digraph') <NEW_LINE> nodes = [pydot.Node(str(idx)) for idx in range(len(self.ID))] <NEW_LINE> for node in nodes: <NE...
Make a png showing a diagram of the connected components.
625941d2bf627c535bc1337e
def test_ban_se_staging(self): <NEW_LINE> <INDENT> self.push_delegation() <NEW_LINE> pre_job_id = insert_job('testvo', 'srm://source', 'srm://destination', 'STAGING', user_dn='/DC=cern/CN=someone') <NEW_LINE> self.app.post( url="/ban/se", params={'storage': 'srm://source', 'status': 'wait', 'allow_submit': True}, statu...
Ban a storage with transfers queued as STAGING, submit a new STAGING, unban. Final state must be STAGING
625941d2b7558d58953c50c2
def add_to_spine(self, id, index=-1): <NEW_LINE> <INDENT> spine = self.opf.xpath('//opf:spine', namespaces={'opf':OPF_NS})[0] <NEW_LINE> itemref = spine.makeelement('{%s}itemref'%OPF_NS, nsmap={'opf':OPF_NS}, idref=id) <NEW_LINE> if index >= 0: <NEW_LINE> <INDENT> spine.insert(index, itemref) <NEW_LINE> <DEDENT> else: ...
Given an id, add it to the spine, optionally at the specified position
625941d29c8ee82313fbb925
def decompose(self): <NEW_LINE> <INDENT> yield self
Return an iterable of the underlying license symbols for this symbol.
625941d2d7e4931a7ee9e0ce
def check(self, action_dict): <NEW_LINE> <INDENT> if self.__outcomes is None or len(self.__outcomes) == 0: <NEW_LINE> <INDENT> return [("stochastic_action.no_outcome", ())] <NEW_LINE> <DEDENT> if self.selection_strategy is None: <NEW_LINE> <INDENT> return [("stochastic_action.no_selection_strategy", ())] <NEW_LINE> <DE...
Checks if the outcome selection configuration and the outcomes are configured properly. :return: a list of problems :param dict[str, Action] action_dict: the world's action registry. :rtype: list[(str, tuple)]
625941d2d58c6744b4257e0e
def form_valid(self, form): <NEW_LINE> <INDENT> comment = form.instance <NEW_LINE> if self.request.user != comment.user: <NEW_LINE> <INDENT> raise AjaxBadRequest <NEW_LINE> <DEDENT> form.save() <NEW_LINE> return JsonResponse( {'modified': comment.modified.strftime('%d %b %Y, %H:%M')})
Make sure current user is owner of the comment. Save form and return success page with comment's last-modified datetime.
625941d2d4950a0f3b08c4fd
def go_to_cancel(driver): <NEW_LINE> <INDENT> actions = ActionChains(driver) <NEW_LINE> go_to_loan_manage(driver) <NEW_LINE> el = driver.find_element_by_xpath("//a[text()='作废']") <NEW_LINE> actions.move_to_element(el).click().perform()
作废
625941d201c39578d7e74feb
@require_role(role='super') <NEW_LINE> def cluster_add(request): <NEW_LINE> <INDENT> user_role = {'SU': u'超级管理员', 'GA': u'组管理员', 'CU': u'普通用户'} <NEW_LINE> header_title, path1, path2 = '集群管理', '自动化发布', '集群管理' <NEW_LINE> usergroup_all = UserGroup.objects.all() <NEW_LINE> if request.method == 'POST': <NEW_LINE> <INDENT> u...
编辑项目
625941d2097d151d1a223009
def get_column(self, column): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> column = int(column) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> raise ValueError('Column identifier should be a number') <NEW_LINE> <DEDENT> for w in sorted(filter(lambda x: x.endswith('%02d' % column), self._wells)): <NEW_LINE> <...
Get all the wells of a given column. A column is identified with a number (e.g. '6')
625941d29f2886367277aa3c
def setMaxGain(self, gain_max): <NEW_LINE> <INDENT> if self.group == "E": <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> gain_max = self.comms.setMaxGain(self.channel, self.group, gain_max, unitCode=self.unit.device_id) <NEW_LINE> return gain_max
Set Max Gain for Channel
625941d28e05c05ec3eea525
def pack(self): <NEW_LINE> <INDENT> buffer = bytearray() <NEW_LINE> buffer.extend(LMCPObject.LMCPObject.pack(self)) <NEW_LINE> buffer.extend(struct.pack(">H", len(self.VehicleID) )) <NEW_LINE> for x in self.VehicleID: <NEW_LINE> <INDENT> buffer.extend(struct.pack(">q", x )) <NEW_LINE> <DEDENT> return buffer
Packs the object data and returns a string that contains all of the serialized members.
625941d223e79379d52ee712
def test_default_connections(self): <NEW_LINE> <INDENT> pass
Test case for default_connections defaultConnectionsHandler returns the list of default hardcoded bootstrap addresses.\n They are not necessarily connected to. # noqa: E501
625941d23317a56b86939e06
def reset(self, random_rotate=True): <NEW_LINE> <INDENT> print('Resetting environment') <NEW_LINE> if random_rotate and not self.natural_language: <NEW_LINE> <INDENT> random_degrees = random.randint(-180, 180) <NEW_LINE> if abs(random_degrees) < 35: <NEW_LINE> <INDENT> if random_degrees < 0: <NEW_LINE> <INDENT> random_...
Rotate/put cozmo back to some random or specific position
625941d292d797404e30433a
def test_new(self): <NEW_LINE> <INDENT> new_obj = State(name="California") <NEW_LINE> self.assertEqual(new_obj.name, "California")
Test DB new
625941d207d97122c4178a3d
def avg_std(self, functionValue, functionWeight=lambda v: 1): <NEW_LINE> <INDENT> avg = 0. <NEW_LINE> std = 0. <NEW_LINE> n = 0. <NEW_LINE> for i, row in enumerate(self.values): <NEW_LINE> <INDENT> v = self._interpret_row(row) <NEW_LINE> x = float(functionValue(v)) <NEW_LINE> w = functionWeight(v) <NEW_LINE> avg += x *...
returns the average and standard deviation
625941d20fa83653e465716a
def __getitem__(self, key): <NEW_LINE> <INDENT> view = self._storage <NEW_LINE> if self.is_view: <NEW_LINE> <INDENT> view = self._view <NEW_LINE> <DEDENT> if key not in view: <NEW_LINE> <INDENT> raise KeyError(key) <NEW_LINE> <DEDENT> refkey = None <NEW_LINE> value = self._storage[key] <NEW_LINE> if isinstance(value, d...
Implement class abstract method __getitem__ If the storage class defines a data 'view' on the parent, check if the key is in the view. Resolve data references defined using the self._data_pointer_key. .. note:: a self._data_pointer_key data pointer can point to a key that is not part of a data 'view'. :par...
625941d2d10714528d5ffe94
def __eq__(self, other): <NEW_LINE> <INDENT> if isinstance(other, Sequence): <NEW_LINE> <INDENT> return self.string == other.string.lower()
Overrides the default implementation
625941d210dbd63aa1bd2d53
def pkg_name(file: str) -> str: <NEW_LINE> <INDENT> return __import__(file).__package__
Returns name of the package to which the `file` belongs.
625941d294891a1f4081bc59
def create_volume(self, volume): <NEW_LINE> <INDENT> self._ensure_shares_mounted() <NEW_LINE> volume['provider_location'] = self._find_share(volume['size']) <NEW_LINE> LOG.info(_LI('casted to %s') % volume['provider_location']) <NEW_LINE> self._do_create_volume(volume) <NEW_LINE> return {'provider_location': volume['pr...
Creates a volume. :param volume: volume reference :returns: provider_location update dict for database
625941d250812a4eaa59c4d0
def testDetailsAlternateEdits(self): <NEW_LINE> <INDENT> win = self.app.open_details_window("test alternate devs title") <NEW_LINE> self._select_hw(win, "Serial 1", "char-tab") <NEW_LINE> win.find("config-remove").click() <NEW_LINE> self.app.click_alert_button("Are you sure", "Yes") <NEW_LINE> self.app.click_alert_butt...
Some specific handling via test-alternate-devs
625941d2dc8b845886cb56e5
def alpha_update(self, alphas, gammas, uq, sc): <NEW_LINE> <INDENT> alpha2 = self.init_alphas(1) <NEW_LINE> rank = 1 <NEW_LINE> click = 0 <NEW_LINE> for document in uq: <NEW_LINE> <INDENT> for query in uq[document]: <NEW_LINE> <INDENT> counter = 2 <NEW_LINE> for session in uq[document][query]: <NEW_LINE> <INDENT> count...
:param alphas - library where key = document, value = query : a_uq :param gammas - list of 10 parameters :param uq - library with key = document url, value = Query id: list of sessions :param sc - library where key = Session ID, value = (clicked rank, url) :return - update by iterating though all query vs. document ses...
625941d24a966d76dd5511c0
def registerPlayer(name): <NEW_LINE> <INDENT> db = connect() <NEW_LINE> add_player = db.cursor() <NEW_LINE> add_player.execute("INSERT into player (playername) values (%s)", (name,)) <NEW_LINE> db.commit() <NEW_LINE> db.close()
Adds a player to the tournament database. The database assigns a unique serial id number for the player. (This should be handled by your SQL database schema, not in your Python code.) Args: name: the player's full name (need not be unique).
625941d2de87d2750b85ff43
def make_2x2_array(a, b, c, d, dtype=complex): <NEW_LINE> <INDENT> ac =np.concatenate((a[:,:,np.newaxis],c[:,:,np.newaxis]),axis=-1) <NEW_LINE> bd =np.concatenate((b[:,:,np.newaxis],d[:,:,np.newaxis]),axis=-1) <NEW_LINE> abcd =np.concatenate((ac[:,:,:,np.newaxis],bd[:,:,:,np.newaxis]),axis=-1) <NEW_LINE> return abcd
Makes a 2x2 numpy array of [[a,b],[c,d]] Same as "numpy.array([[a,b],[c,d]], dtype=float)", but ten times faster
625941d2009cb60464c63561
def myredix(list_to_sort): <NEW_LINE> <INDENT> number_digits = int(np.max(np.log10(np.array(list_to_sort)))) +1 <NEW_LINE> for n in range(number_digits): <NEW_LINE> <INDENT> bucket = [[] for i in range(10)] <NEW_LINE> for it in list_to_sort: <NEW_LINE> <INDENT> bucket[get_dig_num(it, n)].append(it) <NEW_LINE> <DEDENT> ...
:params:[in],list_to_sort,list :params:[out],sorted_list
625941d230dc7b7665901b15
def ariaHostedPage(self, sessionId, flowId): <NEW_LINE> <INDENT> sel = self.selenium <NEW_LINE> sel.open(r"file://///hq-fs01/dept/Dev/QA/Web/KungFuPandaWorld/Web_Services/DB/Web%20Services%20Test.html") <NEW_LINE> sel.select("wsUrl", "label=" + str(self.toolBox.webHost)) <NEW_LINE> sel.click("//input[@value='set enviro...
Entering credit card information through selenium
625941d2e76e3b2f99f3a9b9
def set_pos(self, start, end): <NEW_LINE> <INDENT> return self.conn.transaction([], [ operation.OperationSetParent( node=self.id, pos_start=start, pos_end=end, ) ])
Changes the position of this object. Returns an awaitable of None.
625941d25fdd1c0f98dc03e4
def test_normal_name(self): <NEW_LINE> <INDENT> test_urls = [ ('normal-view', [], {}, '/normal/'), ('normal-view', [37, 42], {}, '/normal/37/42/'), ('normal-view', [], {'arg1': 42, 'arg2': 37}, '/normal/42/37/'), ('special-view', [], {}, '/+%5C$*/'), ] <NEW_LINE> for name, args, kwargs, expected in test_urls: <NEW_LINE...
Normal lookups work as expected.
625941d230dc7b7665901b16
def show_chassis_hardware(self, mode, resource, **constraints): <NEW_LINE> <INDENT> if 'resource' not in self.resources_modules: <NEW_LINE> <INDENT> self.resources_modules[resource] = [] <NEW_LINE> resp_json = cli(self.handles[resource], command='show chassis hardware | display json') <NEW_LINE> resp_json = re.sub(r".*...
callback function for targets
625941d22ae34c7f2600d2e1
def killAll(self): <NEW_LINE> <INDENT> self._is_killed = True <NEW_LINE> for p in self._processes: <NEW_LINE> <INDENT> p.kill()
Kill all of the processes.
625941d2cc0a2c11143dd040
def setAgeSequenceNumber(self,seqNumber): <NEW_LINE> <INDENT> pass
Sets the unique sequence number
625941d2cb5e8a47e48b7c59
def current_positions_orga(self): <NEW_LINE> <INDENT> res = '' <NEW_LINE> positions = self.current_positions() <NEW_LINE> for pos in positions: <NEW_LINE> <INDENT> res += str(pos.office.organization) <NEW_LINE> res += ' ' <NEW_LINE> <DEDENT> return res
return current positions
625941d2627d3e7fe0d69000
def abcd_normalize(A=None, B=None, C=None, D=None): <NEW_LINE> <INDENT> A, B, C, D = map(_none_to_empty, (A, B, C, D)) <NEW_LINE> A, B, C, D = map(atleast_2d, (A, B, C, D)) <NEW_LINE> if ((len(A.shape) > 2) or (len(B.shape) > 2) or (len(C.shape) > 2) or (len(D.shape) > 2)): <NEW_LINE> <INDENT> raise ValueError("...
Check state-space matrices and ensure they are rank-2.
625941d2099cdd3c635f0e0b
def pickle_dump(data, filename): <NEW_LINE> <INDENT> with open(filename, 'wb') as f: <NEW_LINE> <INDENT> pickle.dump(data, f, protocol=pickle.HIGHEST_PROTOCOL)
Parameters ---------- data : any object filename : string Returns ------- None
625941d24e4d5625662d4586
def recent_builds(slavename, limit=20): <NEW_LINE> <INDENT> return json_get("%s/recent/%s?format=json&numbuilds=%i" % (buildapi_url, slavename, limit))
Return at most 'limit' most recent builds for the given build slave.
625941d23d592f4c4ed1d21b
def p_stmt_body(p): <NEW_LINE> <INDENT> p[0] = p[1]
stmt_body : beats_stmt | bput_stmt | call_stmt | circle_stmt | clear_stmt | clg_stmt | cls_stmt | close_stmt | colour_stmt | data_stmt | def_stmt | dim_stmt | draw_stmt | ellipse_stmt | end_stmt | end_fn_stmt | endproc_stmt | envelope_stmt | error_stmt | fill_stmt | gcol_stmt | goto_stmt | on_goto_stmt | gosub_stmt | i...
625941d2004d5f362079a4e3
def extract_entities(self, message): <NEW_LINE> <INDENT> if self.ent_tagger is not None: <NEW_LINE> <INDENT> result = self.ent_tagger.evaluate_line( self.session, input_from_line(message.text, self.char_to_id, self.seg), self.id_to_tag) <NEW_LINE> return result.get("entities", []) <NEW_LINE> <DEDENT> else: <NEW_LINE> <...
Take a sentence and return entities in json format
625941d273bcbd0ca4b2c226
def input_signature(self): <NEW_LINE> <INDENT> return _blocks_swig3.max_ff_sptr_input_signature(self)
input_signature(max_ff_sptr self) -> io_signature_sptr
625941d24f88993c3716c216
def select_rand_str(candidates): <NEW_LINE> <INDENT> return candidates[random.randrange(0, len(candidates))]
select a random string from a list :candidates: list of string candidates :returns: str
625941d23d592f4c4ed1d21c
def _makeD2hh(self,up=False): <NEW_LINE> <INDENT> tag = '' <NEW_LINE> if up: tag = 'UP' <NEW_LINE> min,max = self._massWindow('D0') <NEW_LINE> decays = [['pi+','pi-'],['K+','pi-'],['K+','K-']] <NEW_LINE> sels = [ ] <NEW_LINE> for dec in decays : <NEW_LINE> <INDENT> name = makeSelName('D',dec) <NEW_LINE> sel = makeSel...
Makes D->hh
625941d26fb2d068a760f24f
def id_cycles(self, tube, receiver): <NEW_LINE> <INDENT> tm = np.mod(tube.times, receiver.period) <NEW_LINE> inds = list(np.where(tm == 0)[0]) <NEW_LINE> if len(inds) != (receiver.days + 1): <NEW_LINE> <INDENT> raise ValueError("Tube times not compatible with the receiver" " number of days and cycle period!") <NEW_LINE...
Helper to separate out individual cycles by index Parameters: tube single tube with results receiver receiver, for metadata
625941d28a349b6b435e8324
def getStatistic(): <NEW_LINE> <INDENT> pass
call it analysisdata vs analysisrender...?
625941d23539df3088e2e4fb
def dragPixmap(self, item, items): <NEW_LINE> <INDENT> rect = self.visualRect(self.indexFromItem(item)) <NEW_LINE> pixmap = QtGui.QPixmap() <NEW_LINE> pixmap = pixmap.grabWidget(self, rect) <NEW_LINE> if len(items) > 1: <NEW_LINE> <INDENT> cWidth = 35 <NEW_LINE> cPadding = 5 <NEW_LINE> cText = str(len(items)) <NEW_LINE...
Show the drag pixmap for the given item. :type item: combinedwidgetitem.CombinedWidgetItem :type items: list[combinedwidgetitem.CombinedWidgetItem] :rtype: QtGui.QPixmap
625941d260cbc95b062c66f4
def _run(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self._on_thread_start is not None: <NEW_LINE> <INDENT> self._on_thread_start() <NEW_LINE> <DEDENT> while True: <NEW_LINE> <INDENT> self._requests_pending.wait() <NEW_LINE> if self._requests: <NEW_LINE> <INDENT> request = self._requests.popleft() <NEW_LINE>...
The background thread for interacting with the BMP.
625941d24428ac0f6e5ba9a3
def __init__(self, schedulerNames=[], sourceStamp=None, updateSourceStamp=None, alwaysUseLatest=False, waitForFinish=False, set_properties={}, copy_properties=[], **kwargs): <NEW_LINE> <INDENT> assert schedulerNames, "You must specify a scheduler to trigger" <NEW_LINE> if sourceStamp and (updateSourceStamp is not None)...
Trigger the given schedulers when this step is executed. @param schedulerNames: A list of scheduler names that should be triggered. Schedulers can be specified using WithProperties, if desired. @param sourceStamp: A dict containing the source stamp to use for the ...
625941d22eb69b55b151ca61
def get_doc(mod): <NEW_LINE> <INDENT> tt.reset(mod) <NEW_LINE> doc = _decode_from_xml_metafor_cim_v1(mod.DOC_FILE, mod.DOC_TYPE, mod.DOC_PROJECT, mod.DOC_INSTITUTE) <NEW_LINE> pyesdoc.parse(doc) <NEW_LINE> assert_doc(mod, doc) <NEW_LINE> return doc
Returns a test document.
625941d291af0d3eaac9bbca
@bpcandidate.route('/', methods=['GET']) <NEW_LINE> @token_auth <NEW_LINE> def candidates_all(): <NEW_LINE> <INDENT> return jsonify(candidate.get_candidates())
function to retrieve all candidates
625941d24527f215b584c606
def __init__(self, channel): <NEW_LINE> <INDENT> self.findLabels = channel.unary_unary( '/ai.verta.monitoring.LabelService/findLabels', request_serializer=monitoring_dot_Labels__pb2.FindSampleLabelsRequest.SerializeToString, response_deserializer=monitoring_dot_Labels__pb2.FindSampleLabelsRequest.Response.FromString, )...
Constructor. Args: channel: A grpc.Channel.
625941d25f7d997b87174c49
def _pack_middle(self): <NEW_LINE> <INDENT> middle = widgetset.HBox() <NEW_LINE> self._pack_left(middle) <NEW_LINE> self._pack_right(middle) <NEW_LINE> self.vbox.pack_start(middle)
Pack the columnated portion of the panel.
625941d28a43f66fc4b54215
def backtracking(loss_function, t=1, alpha=0.5, beta=0.5, max_iter=50): <NEW_LINE> <INDENT> b = loss_function.get_current_point() <NEW_LINE> grad_b = loss_function.get_current_grad() <NEW_LINE> norm_grad_b = norm(grad_b) <NEW_LINE> found_t = False <NEW_LINE> i = 0 <NEW_LINE> while (found_t is False and i < max_iter): <...
Function that performs backtracking line-search to find an appropriate learning rate given the current position. This code was partly taken from Corinne Jones from the University of Washington. Args: loss_function: object that inherits from LossFunction(). Maintains state of current location, objective, and gradi...
625941d297e22403b379d14a
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'WeatherApp.settings') <NEW_LINE> try: <NEW_LINE> <INDENT> from django.core.management import execute_from_command_line <NEW_LINE> <DEDENT> except ImportError as exc: <NEW_LINE> <INDENT> raise ImportError( "Couldn't import Django. Are you s...
Run administrative tasks.
625941d2a79ad161976cc2f6
def get(self): <NEW_LINE> <INDENT> p = subprocess.Popen( 'LANG=ja_JP.UTF-8 /bin/ls -l /', shell=True, stdout=subprocess.PIPE) <NEW_LINE> self.write('<pre>%s</pre>' % _Escape(p.stdout.read())) <NEW_LINE> p.wait()
Handles GET requests. This handles http GET requests and sends the files in your root directory in the simple http format as follows: <pre> ... </pre>
625941d215fb5d323cde0cc1
def _onRightButtonDown(self, evt): <NEW_LINE> <INDENT> if self.callback_right_click_down: <NEW_LINE> <INDENT> self.callback_right_click_down(evt)
Overrides the right-click event handler
625941d2b7558d58953c50c3
def test_extract_multiple_tarballs_with_subfolders_flattens_all(testing_metadata): <NEW_LINE> <INDENT> testing_metadata.meta['source'] = [ {'folder': 'f1', 'url': os.path.join(thisdir, 'archives', 'subfolder.tar.bz2')}, {'folder': 'f1', 'url': os.path.join(thisdir, 'archives', 'subfolder2.tar.bz2')}] <NEW_LINE> source....
Ensure that tarballs that contain only a single folder get their contents hoisted up one level
625941d27d43ff24873a2e51
def __init__(self, id: str=None, name: str=None, type: str=None, synonyms: List[str]=None, definition: str=None): <NEW_LINE> <INDENT> self.swagger_types = { 'id': str, 'name': str, 'type': str, 'synonyms': List[str], 'definition': str } <NEW_LINE> self.attribute_map = { 'id': 'id', 'name': 'name', 'type': 'type', 'syno...
BeaconConcept - a model defined in Swagger :param id: The id of this BeaconConcept. # noqa: E501 :type id: str :param name: The name of this BeaconConcept. # noqa: E501 :type name: str :param type: The type of this BeaconConcept. # noqa: E501 :type type: str :param synonyms: The synonyms of this BeaconConcept. # n...
625941d2596a897236089c70
@pagination <NEW_LINE> @pipe_processor <NEW_LINE> def processor1(upper_level_page, response, logger, page=0): <NEW_LINE> <INDENT> if page < 9: <NEW_LINE> <INDENT> response.page = page + 1 <NEW_LINE> <DEDENT> logger.info('process page %s', page) <NEW_LINE> response.message.total_page = upper_level_page * 10 + (page or 0...
:param upper_level_page: page index received from previous processor :param response: response handler :type response: pypipes.infrastructure.response.IResponseHandler :param page: page index, emited by @pagination contextmanager :type logger: logging.LogAdapter
625941d2ff9c53063f47c3a4
def main(): <NEW_LINE> <INDENT> print("CAUTION!!! Don't delete stations that only exist for ASOS 1 Min") <NEW_LINE> pgconn = get_dbconn("mesosite") <NEW_LINE> cursor = pgconn.cursor() <NEW_LINE> cursor.execute( "SELECT id, network from stations where network ~* 'ASOS' " "and archive_begin is null and archive_end is nul...
Go Main Go.
625941d231939e2706e4d019
def setRunType(self, program_run_type): <NEW_LINE> <INDENT> with self.link._lock: <NEW_LINE> <INDENT> self.link._check_connection() <NEW_LINE> command = 'S_ProgRunType' <NEW_LINE> self.link._send_line(command) <NEW_LINE> self.link._send_item(self) <NEW_LINE> self.link._send_int(program_run_type) <NEW_LINE> self.link._c...
Set the Run Type of a program to specify if a program made using the GUI will be run in simulation mode or on the real robot ("Run on robot" option). :param int program_run_type: Use "PROGRAM_RUN_ON_SIMULATOR" to set the program to run on the simulator only or "PROGRAM_RUN_ON_ROBOT" to force the program to run on the ...
625941d2bde94217f3682fa1
def get_tags_by_thing(self, orm): <NEW_LINE> <INDENT> tags = (orm.EventSourceTag.objects .filter(thing__type__in=["part", "subject"]) .order_by("thing")) <NEW_LINE> return [ (key, list(group)) for (key, group) in itertools.groupby(tags, key=lambda tag: tag.thing) ]
Gets a list of EventSourceTags which are attached directly to a part/subject instead of a module. The return value is a list of tuples of the format: (Thing, [EventSourceTag])
625941d2b5575c28eb68e1b1
def to_csv_dir(self, destination, overwrite=False): <NEW_LINE> <INDENT> if os.path.exists(destination) and os.listdir(destination): <NEW_LINE> <INDENT> if not overwrite: <NEW_LINE> <INDENT> raise UserWarning( "The path is not empty. Might overwrite existing data. " "Pass 'overwrite=True' to ignore" ) <NEW_LINE> <DEDENT...
Save the DataFramePackage to csv files. Warns if overwrite is False and the destination is not empty. If overwrite is True, all existing contents in destination will be deleted. Parameters ---------- destination : str Path to store data to overwrite : bool Decides if any existing files will be overwritten.
625941d266673b3332b92242
def __init__( self, claimset, description=None, figures=None, title=None, classifications=None, number=None ): <NEW_LINE> <INDENT> self.description = description <NEW_LINE> self.claimset = claimset <NEW_LINE> self.figures = figures <NEW_LINE> self.title = title <NEW_LINE> self.classifications = classifications <NEW_LIN...
description, claimset and figures are objects as below.
625941d2e8904600ed9f20de
def do_sai(self, arg): <NEW_LINE> <INDENT> if (getattr(self, "file", None)): <NEW_LINE> <INDENT> self.file.close() <NEW_LINE> <DEDENT> exit()
Exits the memory simulator interactive shell
625941d271ff763f4b54983d
def get_finished_matches(tournament): <NEW_LINE> <INDENT> finished_matches = [] <NEW_LINE> for match in hltv.get_results(): <NEW_LINE> <INDENT> if tournament.lower() in str(match['event']).lower(): <NEW_LINE> <INDENT> finished_matches.append(match) <NEW_LINE> <DEDENT> <DEDENT> return finished_matches
get all the matches in the specified tournament
625941d229b78933be1e585b
def generate_url(url, port): <NEW_LINE> <INDENT> return "http://" + url + ":" + str(port) + "/update_sensors"
generate the url to use in order to dispatch a new sensor sample to the server
625941d2566aa707497f4718
@utils.arg('--marker', metavar='<marker>', default=None, help='The last cluster UUID of the previous page; ' 'displays list of clusters after "marker".') <NEW_LINE> @utils.arg('--limit', metavar='<limit>', type=int, help='Maximum number of clusters to return.') <NEW_LINE> @utils.arg('--sort-key', metavar='<sort-key>', ...
Print a list of available clusters.
625941d291f36d47f21ac6a4
def p_dictmaker(self, args): <NEW_LINE> <INDENT> pass
dictmaker ::= bare_dictmaker opt_comma bare_dictmaker ::= bare_dictmaker , test : test bare_dictmaker ::= test : test
625941d221a7993f00bc7ea2
def paste(self, lodgeit_url): <NEW_LINE> <INDENT> srv = XmlRpcServerProxy('%sxmlrpc/' % lodgeit_url) <NEW_LINE> return srv.pastes.newPaste('pytb', self.plaintext, '', '', '', True)
Create a paste and return the paste id.
625941d2b57a9660fec33a35
def test_check_already_exists_and_not_expired(self): <NEW_LINE> <INDENT> result1 = self.a.checkToken(self.authToken, self.token_not_expired, self.tenantId) <NEW_LINE> result2 = self.a.checkToken(self.authToken, self.token_not_expired, self.tenantId) <NEW_LINE> self.assertEqual(result1, self.token_not_expired) <NEW_LINE...
Test if I do not get any Exception while checking if a real user token is valid for two times. This test checks the token stored in memory during the second time. This time the token is not expired.
625941d2627d3e7fe0d69001
def __init__(self, mapper, tolerant_exec=True): <NEW_LINE> <INDENT> self._mapper = mapper.copy() <NEW_LINE> self._tolerant_exec = tolerant_exec
Value Map Args: mapper: dict<key: expr> map method used. $key is the column to execute map $expr. $expr can be a dict<val, mapped val>, a const, or a callable, which input is the value to map, and output is the mapped value. e.g. { "gender": {"gentle man": "male", "lady": "femal...
625941d2a934411ee3751844
def export_orderpoints(self): <NEW_LINE> <INDENT> m = self.env["stock.warehouse.orderpoint"] <NEW_LINE> recs = m.search([]) <NEW_LINE> fields = [ "warehouse_id", "product_id", "product_min_qty", "product_max_qty", "product_uom", "qty_multiple", ] <NEW_LINE> if recs: <NEW_LINE> <INDENT> yield "<!-- order points -->\n" <...
Defining order points for frePPLe, based on the stock.warehouse.orderpoint model. Mapping: stock.warehouse.orderpoint.product.name ' @ ' stock.warehouse.orderpoint.location_id.name -> buffer.name stock.warehouse.orderpoint.location_id.name -> buffer.location stock.warehouse.orderpoint.product.name -> buffer.item conve...
625941d266656f66f7cbc35c
def HKDF(master, key_len, salt, hashmod, num_keys=1, context=None): <NEW_LINE> <INDENT> output_len = key_len * num_keys <NEW_LINE> if output_len > (255 * hashmod.digest_size): <NEW_LINE> <INDENT> raise ValueError("Too much secret data to derive") <NEW_LINE> <DEDENT> if not salt: <NEW_LINE> <INDENT> salt = bchr(0) * has...
Derive one or more keys from a master secret using the HMAC-based KDF defined in RFC5869_. This KDF is not suitable for deriving keys from a password or for key stretching. Use `PBKDF2` instead. HKDF is a key derivation method approved by NIST in `SP 800 56C`__. :Parameters: master : byte string The unguessable...
625941d245492302aab5e475
def p_line_jumps(p): <NEW_LINE> <INDENT> data = opcodes[p[1]] << 8 | p[2][0] <NEW_LINE> g.put(data, 16) <NEW_LINE> g.mapper.append((g.pos, p[2][1], p.lineno(1), find_column(p.lexpos(1)))) <NEW_LINE> g.put(0, 16)
line : JUMP address | JEQ address | JNEQ address | SJL address | SJGEQ address | SJLEQ address | SJG address | UJL address | UJGEQ address | UJLEQ address | UJG address
625941d24e696a04525c95fc
def on_eval(self, record_id, args, extra_args=None): <NEW_LINE> <INDENT> logger.debug("In MPIWorker.on_eval") <NEW_LINE> self._eval_thread = Thread(target=self._eval_wrap, args=(record_id, args, extra_args)) <NEW_LINE> self._eval_thread.daemon = self.daemonize <NEW_LINE> self._eval_killed = False <NEW_LINE> self._eval_...
Handle eval request.
625941d273bcbd0ca4b2c227
def test_get_folder_ds_summary(self): <NEW_LINE> <INDENT> m = self.mox <NEW_LINE> m.StubOutWithMock(self._driver.__class__, 'volumeops') <NEW_LINE> self._driver.volumeops = self._volumeops <NEW_LINE> size = 1 <NEW_LINE> resource_pool = FakeMor('ResourcePool', 'my_rp') <NEW_LINE> datacenter = FakeMor('Datacenter', 'my_d...
Test _get_folder_ds_summary.
625941d23539df3088e2e4fc
def concatenation(a, *args): <NEW_LINE> <INDENT> a = toFSA(a) <NEW_LINE> for b in args: <NEW_LINE> <INDENT> b = toFSA(b).sorted(a.nextAvailableState()) <NEW_LINE> states0, alpha0, transitions0, initial0, finals0 = a.tuple() <NEW_LINE> states1, alpha1, transitions1, initial1, finals1 = b.tuple() <NEW_LINE> a = a.create(...
Returns an FSA that accepts the language consisting of the concatenation of strings recognized by the arguments.
625941d231939e2706e4d01a
def get_question(questions, answered): <NEW_LINE> <INDENT> weights = answered.get_weights(questions) <NEW_LINE> return weighted_choice(weights, questions)
Get a random question weighted by previous answers. partof: #SPC-quiz-get
625941d2cdde0d52a9e531e5
def test_get_average_gross_value_per_movie(self): <NEW_LINE> <INDENT> hub_actors = get_hub_actors(self.actors, 10) <NEW_LINE> hub_actors = {actor_name: self.actors[actor_name] for actor_name in hub_actors} <NEW_LINE> self.assertAlmostEqual(get_average_gross_value_per_movie(hub_actors), 3204062.753093549) <NEW_LINE> sel...
Tests the functionality of the get_average_gross_value_per_movie function. :return: self
625941d2f7d966606f6aa1b6
def create_state_transition_model(time_step, num_dimensions): <NEW_LINE> <INDENT> F = np.eye(2 * num_dimensions) <NEW_LINE> for index in range(num_dimensions): <NEW_LINE> <INDENT> F[index, index + 2] = time_step <NEW_LINE> <DEDENT> return F
takes a time step value and a number of dimensions and returns a state_transition model of the form pos1, pos2, ..., posn, vel1, vel2, ..., veln. This is opposed to a model of the form pos1, vel1, pos2, vel2...
625941d282261d6c526ab651
def do_vbox_create(self, data): <NEW_LINE> <INDENT> dev_type, name = data <NEW_LINE> if self.__vbox_create(dev_type, name) == 0: <NEW_LINE> <INDENT> self.send_reply(self.HSC_INFO_OK, 1, "VBox '{}' created".format(name)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.send_reply(self.HSC_ERR_CREATE, 1, "Unable to cre...
Handles the vbox create command.
625941d25510c4643540f593
def init_values(self,grid): <NEW_LINE> <INDENT> chars = [c for c in grid if c in self.digits() or c in '0.'] <NEW_LINE> return dict(zip(self.cells, chars))
Convert grid which is a string with '0' or '.' for empties into a dictionary which specifies the assigned value for that square at the beginning.
625941d263b5f9789fde7297
def is_raining(self, channel=None): <NEW_LINE> <INDENT> return bool(self.getBinaryData("RAINING", channel))
Return True if motion is detected
625941d23346ee7daa2b2f1d
def get_relation_kwargs(field_name, relation_info): <NEW_LINE> <INDENT> model_field, related_model, to_many, has_through_model = relation_info <NEW_LINE> kwargs = { 'queryset': related_model._default_manager, 'view_name': get_detail_view_name(related_model) } <NEW_LINE> if to_many: <NEW_LINE> <INDENT> kwargs['many'] = ...
Creates a default instance of a flat relational field.
625941d22c8b7c6e89b35971
def generate_seq2( model : Model, seed, vocab_size, size, temperature=1.0): <NEW_LINE> <INDENT> ls = seed.shape[0] <NEW_LINE> tokens = np.concatenate([seed, np.zeros(size - ls)]) <NEW_LINE> toh = reader.to_categorical(tokens[None, :], vocab_size) <NEW_LINE> for i in range(ls, size-1): <NEW_LINE> <INDENT> probs = model....
:param model: The complete RNN language model :param seed: The first few wordas of the sequence to start generating from :param size: The total size of the sequence to generate - Should be greater than seed length. :param vocab_size: Number of tokens in the vocabulary. :param temperature: This controls how much we foll...
625941d2aad79263cf390bf3
def __str__(self): <NEW_LINE> <INDENT> return ShortLink.OBJECT_STR_FORMAT.format(self._counter, self.token, self.url, self._creation_date, self._clicks, self._title, self._host, self._disabled)
String representation of a shortLink object
625941d296565a6dacc8f87c
def route_yours(query, format='geojson'): <NEW_LINE> <INDENT> service = 'http://www.yournavigation.org/api/1.0/gosmore.php' <NEW_LINE> instructions = 1 <NEW_LINE> m = query.mode <NEW_LINE> mode = {'car': 'motorcar', 'pedestrian': 'foot'}.get(m, m) <NEW_LINE> uri = '%s?format=%s&instructions=%d&flat=%f&flon=%f&tlat=%f&t...
Base URL http://www.yournavigation.org/api/1.0/gosmore.php Parameters Available parameters are described below. Only the location parameters are required. All other parameters are optional, they will use the default value when omitted. flat = latitude of the starting location. flon = longitude of the starting location...
625941d24c3428357757c4d8
def test_sychronized_activity(self): <NEW_LINE> <INDENT> self.expected_number_of_items = 2 <NEW_LINE> self.list_based_test_load = [0.3, 0.4, ] <NEW_LINE> @synchronized([self.test_lock]) <NEW_LINE> def test_thread_activity(): <NEW_LINE> <INDENT> thread_sleep = ThreadSleep() <NEW_LINE> if self.expected_number_of_items !=...
1. using list-based queue check work state, number of items = counter. Raise exception if state is inconsitent 2. make inconsistent thread condition, pop one item off 3. sleep a randon interval 4. fix inconsistent state.
625941d2cad5886f8bd2718a
def test_fetch_url(self): <NEW_LINE> <INDENT> resp = self.client['maintainer'].get(self.url_fetch_url) <NEW_LINE> self.assertContains( resp, '"status": 404, "message": "URL not set for this resource."', status_code=200 ) <NEW_LINE> source_url = os.path.join( settings.TX_ROOT, 'resources/tests/lib/pofile/tests.pot' ) <N...
Test fetch url
625941d2596a897236089c71
def remove_duplicates(self): <NEW_LINE> <INDENT> super().__init__(set(self))
Remove duplicates from database.
625941d244b2445a33932246
def setUp( self ): <NEW_LINE> <INDENT> self._lab = ClusterLab(profile=profile) <NEW_LINE> tf = NamedTemporaryFile() <NEW_LINE> tf.close() <NEW_LINE> self._fn = tf.name
Create a lab in which to perform tests and a tempfile for HDF5 tests.
625941d29c8ee82313fbb927
def main(): <NEW_LINE> <INDENT> util.append_argument('-nointro') <NEW_LINE> util.set_environment('PROTON_NO_ESYNC', '1')
Disable ESYNC, disable intro's
625941d24a966d76dd5511c1
def __init__(self, color, width, height): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.image = pygame.Surface([width, height], pygame.SRCALPHA, 32) <NEW_LINE> pygame.draw.ellipse(self.image, color, [0, 0, width, height]) <NEW_LINE> self.rect = self.image.get_rect()
Constructor. Pass in the color of the block, and its x and y position.
625941d27c178a314d6ef612
def __init__(self): <NEW_LINE> <INDENT> pass
AxisScale - a model defined in OpenAPI.
625941d25fc7496912cc3b2f
def loads(string): <NEW_LINE> <INDENT> return load(StringIO(string))
Loads an SB object from a string.
625941d2d18da76e23532689
def drawAxes(self, painter, bounds, datarange, outerbounds=None): <NEW_LINE> <INDENT> pass
Plot axes.
625941d2a4f1c619b28b01e8
def flag(self, name, value): <NEW_LINE> <INDENT> if value is not None: <NEW_LINE> <INDENT> self.flags[name.strip()] = value
Set a flag and its value.
625941d24e696a04525c95fd
def interrupted(self): <NEW_LINE> <INDENT> if not self.killed: <NEW_LINE> <INDENT> self._kill() <NEW_LINE> self.failures.append('Interrupted')
Kills the process and registers an keyboard interrupt error.
625941d2d4950a0f3b08c4ff
def isl_map_to_pyfn(rel, fnname, s=None): <NEW_LINE> <INDENT> ast = isl_map_to_ast(rel) <NEW_LINE> py = isl2py_fn(ast, fnname) <NEW_LINE> if s is None: <NEW_LINE> <INDENT> s = (_nin, _nout) = tuple( rel.space.dim(x) for x in (isl.dim_type.in_, isl.dim_type.out) ) <NEW_LINE> <DEDENT> StructureTupleYields(s).visit(py) <N...
Transform an isl map to a python function
625941d223e79379d52ee714
def _reply_version(self, reply_v5, reply_v4): <NEW_LINE> <INDENT> if self.socks.version == V_SOCKS5: <NEW_LINE> <INDENT> return reply_v5 <NEW_LINE> <DEDENT> return reply_v4
Return reply_v5 if SOCKS version is 5 and reply_v4 if the SOCKS version is 4.
625941d2d58c6744b4257e11