code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def pickle_inv_enumeration(inv_enum, pickle_filename="inv_enum.pickle"): <NEW_LINE> <INDENT> with open(pickle_filename, 'wb') as output_file: <NEW_LINE> <INDENT> pickle.dump(inv_enum, output_file)
Pickle the inverse enumeration of states, needed to import the exported stationary calculation.
625941ee8c3a87329515890c
def get_stream_link(self, signal, stream=None, ref=None): <NEW_LINE> <INDENT> stream = stream or "baseline" <NEW_LINE> ref = ref or "value_start" <NEW_LINE> h5_addr = ( f"/entry/instrument/bluesky/streams/{stream}/{signal}/{ref}" ) <NEW_LINE> if h5_addr not in self.root: <NEW_LINE> <INDENT> raise KeyError(f"HDF5 addres...
return the h5 object for ``signal`` DEFAULTS ``stream`` : ``baseline`` ``key`` : ``value_start``
625941eeb830903b967e9e50
def execute(self, sql: str, args_data: Tuple) -> int: <NEW_LINE> <INDENT> count = None <NEW_LINE> try: <NEW_LINE> <INDENT> with self.conn.cursor() as cursor: <NEW_LINE> <INDENT> count = cursor.execute(sql, args_data) <NEW_LINE> <DEDENT> <DEDENT> except pymysql.Error as e: <NEW_LINE> <INDENT> self.conn.rollback() <NEW_L...
执行单条记录,更新、插入或者删除 Args: sql: 插入的SQL语句 args_data: 批量插入的数据,为一个包含元祖的列表 Returns: INSERT INTO traffic_100 (IMEI,lbs_dict_id,app_key) VALUES(%s,%s,%s) ('868403022323171', None, 'EB23B21E6E1D930E850E7267E3F00095')
625941ee293b9510aa2c37db
def add( self, obj ): <NEW_LINE> <INDENT> if self.size > int(self.load_limit * self.__copacity): <NEW_LINE> <INDENT> self.rehash(0) <NEW_LINE> <DEDENT> index = self.getLocation(self.getHash(obj)) <NEW_LINE> self.insertAt(index, obj)
Insert a new object into the hash table and remember when it was added relative to other calls to this method. However, if the object is added multiple times, the hash table is left unchanged, including the fact that this object's location in the insertion order does not change. Double the size of the table if its load...
625941ee8a349b6b435e86be
def create_app(self): <NEW_LINE> <INDENT> raise NotImplementedError
Returns your WSGI application for testing.
625941ee293b9510aa2c37dc
def freeProxy03(): <NEW_LINE> <INDENT> target_urls = ["http://www.kxdaili.com/dailiip.html", "http://www.kxdaili.com/dailiip/2/1.html"] <NEW_LINE> for url in target_urls: <NEW_LINE> <INDENT> tree = requests.get(url, timeout=10).tree <NEW_LINE> for tr in tree.xpath("//table[@class='active']//tr")[1:]: <NEW_LINE> <INDENT...
开心代理
625941ee15fb5d323cde1063
def parse_args(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser( usage='%(prog)s [OPTIONS]', description='Minesweeper game. GUI version {}'.format(__version__), epilog='Author: {} <{}>'.format(__author__, __email__)) <NEW_LINE> parser.add_argument( '-c', '--config', type=str, metavar='FILENAME', default='setting...
Разбор аргуметов запуска
625941ee21bff66bcd684e99
def scoreList(myletters): <NEW_LINE> <INDENT> dictionarywords = Dictionary <NEW_LINE> mychangingletters = myletters <NEW_LINE> return scoreListBrain(myletters,dictionarywords,mychangingletters)
scoreList in itself is really a gateway function. Because we are required to only have one input (our available letters), this function is used to set up a supplementary function which will do the work for this function's output. This function, when called itself, will return the results of the supplementary function w...
625941ee50812a4eaa59c867
def compute_inertia_ellipsoid(points): <NEW_LINE> <INDENT> npoints = points.shape[0] <NEW_LINE> center = np.mean(points, axis=0) <NEW_LINE> points = points - center <NEW_LINE> covariance = np.cov(points.T) / npoints <NEW_LINE> _, s, V = np.linalg.svd(covariance) <NEW_LINE> radii = 2 * np.sqrt(s * npoints).T <NEW_LINE> ...
Compute inertia ellipsoid for `points`. Please note, that order of Ellipsoid.axes might not correspond to the order of image axes! Arguments: points {numpy.array} -- an array of points (x, y, z) Returns: [analysis.Ellipsoid] -- inertia ellipsoid
625941eefbf16365ca6f671b
def is_normal(self, other=None): <NEW_LINE> <INDENT> if other is None: <NEW_LINE> <INDENT> other = self.ambient_group() <NEW_LINE> <DEDENT> return PermutationGroup_generic.is_normal(self, other)
Return ``True`` if this group is a normal subgroup of ``other``. If ``other`` is not specified, then it is assumed to be the ambient group. EXAMPLES:: sage: S = SymmetricGroup(['a','b','c']) sage: H = S.subgroup([('a', 'b', 'c')]); H Subgroup generated by [('a','b','c')] of (Symmetric group of order 3! as a...
625941ee956e5f7376d713b7
def max_pool2d_grad(out_grad, data, pool_size=(1, 1), strides=(1, 1), padding=(0, 0), layout="NCHW", ceil_mode=False): <NEW_LINE> <INDENT> return _make.max_pool2d_grad(out_grad, data, pool_size, strides, padding, layout, ceil_mode)
Gradient of 2D maximum pooling operator. This operator takes out_grad and data as input and calculates gradient of max_pool2d. Parameters ---------- out_grad : tvm.relay.Expr The output gradient data : tvm.relay.Expr The input data to the operator. strides : tuple of int, optional The strides of pooling...
625941ee3eb6a72ae02eca37
def test_enabled_rules(): <NEW_LINE> <INDENT> word = r"נֹחַ" <NEW_LINE> parts = ["nun", "holam", "het", "patah-genuvah"] <NEW_LINE> enabled, disabled = ["vowel-patah-genuvah"], ["vowel-holam-haser-default"] <NEW_LINE> assert parts == Parser(enabled=enabled, disabled=disabled).parse(word).flat()
only enabled rules run
625941ee30bbd722463cc314
def set_transition_beat(self, p_self): <NEW_LINE> <INDENT> if p_self is None: <NEW_LINE> <INDENT> self.beat_transition = None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.beat_transition = transition_loop(2, p_self)
Set the beat-tracking transition matrix according to self-loop probabilities. Parameters ---------- p_self : None, float in (0, 1), or np.ndarray [shape=(2,)] Optional self-loop probability(ies), used for Viterbi decoding
625941ee0a366e3fb873ed6b
def __init__(self, name, yml, project, color='', config_path=None): <NEW_LINE> <INDENT> if not re.match(regex_container_name, name): <NEW_LINE> <INDENT> raise ValueError('Invalid value for container name: %s' % name) <NEW_LINE> <DEDENT> self.yml = yml <NEW_LINE> self.project = project <NEW_LINE> self.color = color <NEW...
Init instance with custom property values and init base class :param name: Name of the container :param project: Project instance of this container :param color: ASCII color escape sequence for log messages :param config_path: Path to the container's config file
625941eed10714528d600235
def uint32(x): <NEW_LINE> <INDENT> return x & 0xffffffff
python does not have 32 bit integer so we need this hack to produce uint32 after bit operations
625941ee07f4c71912b119d0
def popitem(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.maps[0].popitem() <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise KeyError('No keys found in the first mapping.')
Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.
625941eede87d2750b8602e4
def update_interaction_customization_args(self, customization_args): <NEW_LINE> <INDENT> self.interaction.customization_args = customization_args
Update the customization_args of InteractionInstance domain object. Args: customization_args. dict. The new customization_args to set.
625941eea934411ee3751be0
def add_new_transaction(self, transaction: blockchain.Transaction.Transaction): <NEW_LINE> <INDENT> self.unconfirmed_transactions.append(transaction)
Add new transaction to be checked :param transaction: created transaction
625941eedc8b845886cb5a82
def min_fun_2(x, vvals, yvals): <NEW_LINE> <INDENT> res = 0. <NEW_LINE> x^(1 - mu) * (1 - np.exp(-he + ht + v)) <NEW_LINE> for i in range(len(vvals)): <NEW_LINE> <INDENT> res += pow(2 * x[0] * np.exp(-yvals[i]) - (scipy.special.expi(x[1]) - scipy.special.expi(x[1]* vvals[i]**2) ) * np.exp(-x[1]) , 2) <NEW_LINE> <DEDENT...
minimises equation 7 using Q4 minimisation given in equation 10 of Gritsevich 2007 - 'Validity of the photometric formula for estimating the mass of a fireball projectile'
625941ee7d847024c06be80c
def getSCEnvVar(self, sc, rep, name): <NEW_LINE> <INDENT> return self.getSCEnvVars(sc, rep)[name]
Get a named environmental variable from the given system/repo
625941ee30bbd722463cc315
def test_transform(testcase: DataDrivenTestCase) -> None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> src = '\n'.join(testcase.input) <NEW_LINE> options = Options() <NEW_LINE> options.use_builtins_fixtures = True <NEW_LINE> options.semantic_analysis_only = True <NEW_LINE> options.show_traceback = True <NEW_LINE> optio...
Perform an identity transform test case.
625941ee3346ee7daa2b32bc
def make_command(self, complete=False, created_at=None, errored=True, message='test'): <NEW_LINE> <INDENT> command = Command.objects.create(message=message, complete=complete, errored=errored) <NEW_LINE> if created_at is not None: <NEW_LINE> <INDENT> command.created_at = created_at <NEW_LINE> command.save() <NEW_LINE> ...
:param complete: Bool True when the command has completed :param created_at: DateTime of the creation time :param errored: Bool True if the command errored :param message: str Message associated with the command :return: Command The command created.
625941eeaad79263cf390f95
def bytes2integer(data, signed=False): <NEW_LINE> <INDENT> number = 0 <NEW_LINE> for b in iterateints(data): <NEW_LINE> <INDENT> number = (number << 8) | b <NEW_LINE> <DEDENT> if signed and byte2int(bytes2bits(data[0:1])[0:1]): <NEW_LINE> <INDENT> bias = 1 << len(data)*8 <NEW_LINE> return number - bias <NEW_LINE> <DEDE...
Converts a byte-string into an integer. This is reverse to `integer2bytes`. Examples: >>> bytes2integer(b'\x00\x00\x00\x13') 19
625941ee1f037a2d8b946748
@ensure_csrf_cookie <NEW_LINE> def contact(request): <NEW_LINE> <INDENT> if request.user.is_authenticated: <NEW_LINE> <INDENT> customer = request.user.customer <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> customer = guestUser(request) <NEW_LINE> <DEDENT> order, created = Order.objects.get_or_create(customer=customer, ...
this function handles the contact view
625941ee9f2886367277add4
def cleanup(self, snippet): <NEW_LINE> <INDENT> is_not_stopword = lambda token: token not in self._stopwords <NEW_LINE> results = [] <NEW_LINE> tokens = self.strip_punctuations(snippet.lower()).split() <NEW_LINE> for token in tokens: <NEW_LINE> <INDENT> if is_not_stopword(token): <NEW_LINE> <INDENT> results.append(toke...
clenup is used to get rid of all words that are stoplist, it also does lower case transformation
625941ee85dfad0860c3b3a8
@responses.activate <NEW_LINE> def test_http_error_retrieving(): <NEW_LINE> <INDENT> mock_url = "http://somerealurl.com/" <NEW_LINE> mock_file_path = "/here.pdf" <NEW_LINE> responses.add(responses.GET, mock_url, status=400) <NEW_LINE> with pytest.raises(requests.HTTPError): <NEW_LINE> <INDENT> retriever.get_document(mo...
Tests re raising of status code 400 when calling keywords endpoint
625941ee91af0d3eaac9bf69
def is_collector(self): <NEW_LINE> <INDENT> return self in set([CommandType.collect_steps, CommandType.collect_tests, CommandType.collect_bazel_targets])
Returns whether this CommandType is a collection command
625941ee236d856c2ad44d2e
def exit_status(status): <NEW_LINE> <INDENT> exit_if_error(status) <NEW_LINE> exit(0)
Exit code based on the status
625941ee50485f2cf553d2e7
def unregister(ob): <NEW_LINE> <INDENT> pass
Remove the object from the indexes. IntIdMissingError is raised if ob is not registered previously.
625941ee71ff763f4b549be1
def copy_file(self, src_path, target_path, metadata): <NEW_LINE> <INDENT> self._items.append({"source_path": src_path, "target_path": target_path, "metadata": metadata, "action": "copy"})
Called by the folder creation classes when a file is to be copied.
625941ee26238365f5f0f3c1
def setTriggerService(self, triggerService): <NEW_LINE> <INDENT> self.TriggerService = triggerService
Legt den TriggerService fest. Es handelt sich um eine DependencyInjection. :param triggerService: Der Triggerservice mit dem der Portservice zusammenarbeiten soll. :type triggerService: TriggerService
625941ee0fa83653e4657503
def __init__(self, name, age, sex, kids): <NEW_LINE> <INDENT> super().__init__(name, age, sex) <NEW_LINE> self.kids = kids
super方法根据查找顺序(MRO)取查找符合的类调用, python2中经典类(class XXX:)为深度优先,新式类(class XXX(object):)为广度优先 python3中为广度优先
625941ee3617ad0b5ed68442
def keypress_handler(self, widget, event, tree_select): <NEW_LINE> <INDENT> if event.keyval == Gdk.KEY_Return: <NEW_LINE> <INDENT> self.activate_handler(event, tree_select) <NEW_LINE> <DEDENT> if event.keyval == Gdk.KEY_Delete: <NEW_LINE> <INDENT> self.delete_handler(event, tree_select) <NEW_LINE> <DEDENT> if event.key...
Handle selection_widget keypress events.
625941eebaa26c4b54cb1666
def var(self): <NEW_LINE> <INDENT> return self.varw/self.ww
Calculate the variance
625941ee99fddb7c1c9de8da
def enemies_at_move_points(self, unit: Soldier): <NEW_LINE> <INDENT> pass
{unit: mvpts}
625941eee64d504609d74d8b
def confirm_path(self, path_dir=""): <NEW_LINE> <INDENT> if not path_dir: <NEW_LINE> <INDENT> logger.debug("No installation path provided. Requesting one.") <NEW_LINE> UI.display(InputText("Choose installation path:", self.confirm_path, self.install_path)) <NEW_LINE> return <NEW_LINE> <DEDENT> logger.debug("Installatio...
Confirm path dir
625941ee0383005118ecfb2c
def is_service_name_available(self, service_name, service_type): <NEW_LINE> <INDENT> path = "portals/self/isServiceNameAvailable" <NEW_LINE> postdata = { "f": "pjson", "name" : service_name, "type" : service_type } <NEW_LINE> res = self._portal.con.post(path, postdata) <NEW_LINE> return res['available']
For a desired service name, determines if that service name is available for use or not. ================ ====================================================================== **Argument** **Description** ---------------- ---------------------------------------------------------------------- service_name ...
625941ee656771135c3ebdc1
@home.route("/login/", methods=["GET", "POST"]) <NEW_LINE> def login(): <NEW_LINE> <INDENT> if "user_id" in session: <NEW_LINE> <INDENT> return redirect(url_for("home.index")) <NEW_LINE> <DEDENT> form = LoginForm() <NEW_LINE> if form.validate_on_submit(): <NEW_LINE> <INDENT> data = form.data <NEW_LINE> if session.get('...
登录
625941ee9f2886367277add5
def hz_to_octave(self): <NEW_LINE> <INDENT> return self._compute_unary_op(self, UnaryOperator.HZ_TO_OCTAVE)
Converts ugen graph from Hertz to octave number. .. container:: example :: >>> ugen_graph = supriya.ugens.WhiteNoise.ar() >>> result = ugen_graph.hz_to_octave() :: >>> supriya.graph(result) # doctest: +SKIP :: >>> print(result) synthdef: name: e4f...
625941ee76d4e153a657f07f
def get_queryset(self, parameters={}): <NEW_LINE> <INDENT> return self.serializer.get_queryset(self.base_queryset, parameters)
Get a queryset by executing the operations to the base queryset registered in the DjangoQuerysetSerialization instance. Parameters (__customizable_kwarg='$param1','$other-param') inserted when this was being created are replaced with the actual values passed in through the argument `parameters`.
625941eebd1bec0571d90b7b
def scheduler_from_config(config, time_zone): <NEW_LINE> <INDENT> if isinstance(config, schedule_parse.ConfigConstantScheduler): <NEW_LINE> <INDENT> return ConstantScheduler() <NEW_LINE> <DEDENT> if isinstance(config, schedule_parse.ConfigIntervalScheduler): <NEW_LINE> <INDENT> return IntervalScheduler(config.timedelta...
A factory for creating a scheduler from a configuration object.
625941ee6e29344779a62b5c
def createTrajectories(self, hwynet, storefile, inkey, outkey): <NEW_LINE> <INDENT> store = pd.HDFStore(storefile) <NEW_LINE> dates = store.select_column(inkey, 'date').unique() <NEW_LINE> dates.sort_values() <NEW_LINE> print ('Retrieved a total of %i days to process' % len(dates)) <NEW_LINE> rowsWritten = 0 <NEW_LINE>...
Takes the sequence of points, and converts each into a trajectory object. storefile - HDF datastore with GPS points in it.
625941ee442bda511e8be95c
def get_bundle_socket_path(bundle_path, bundle_hash): <NEW_LINE> <INDENT> bundle_socket_hash = hashlib.sha1((bundle_path + bundle_hash).encode('utf-8')) <NEW_LINE> path = os.path.join(tempfile.gettempdir(), bundle_socket_hash.hexdigest() + BUNDLE_SOCKET_SUFFIX) <NEW_LINE> assert len(path) < 108 <NEW_LINE> return path
Returns the path to the bundle socket for the specified bundle hash
625941eecc0a2c11143dd3dd
def __init__(self): <NEW_LINE> <INDENT> self._state = None
初始化,状态值为空.
625941ee82261d6c526ab9f3
@cache('step') <NEW_LINE> def green_roof_runoff_total(): <NEW_LINE> <INDENT> return integ_green_roof_runoff_total()
Real Name: Green Roof Runoff Total Original Eqn: INTEG ( Green Roof Runoff Daily, 0) Units: m3 Limits: (None, None) Type: component
625941eeb830903b967e9e51
def confirm(self, msg, _timeout=-1): <NEW_LINE> <INDENT> return self.msg_box("confirm", _timeout=_timeout, msg=msg)
Send a confirm prompt to the GUI Arguments: msg (string): The message to display to the user. _timeout (int): The optional amount of time for which the prompt should be displayed to the user before a timeout occurs. Defaults to -1 which indicates there is no timeout limit.
625941ee796e427e537b0b17
def test_startup_file(self): <NEW_LINE> <INDENT> self._reserve_ports(1) <NEW_LINE> self.tool.run("--single --port %i --nojournal --dir %s" % (self.port, self.data_dir)) <NEW_LINE> startup_file = os.path.join(self.data_dir, '.mlaunch_startup') <NEW_LINE> assert os.path.isfile(startup_file) <NEW_LINE> file_args = self.to...
mlaunch: create .mlaunch_startup file in data path Also tests utf-8 to byte conversion and json import.
625941eedc8b845886cb5a83
def heuristic_2(puzz): <NEW_LINE> <INDENT> distance = 0 <NEW_LINE> m = eval(puzz) <NEW_LINE> for i in range(4): <NEW_LINE> <INDENT> for j in range(4): <NEW_LINE> <INDENT> if m[i][j] == 0: continue <NEW_LINE> distance += abs(i - (m[i][j]/4)) + abs(j - (m[i][j]%4)) <NEW_LINE> <DEDENT> <DEDENT> return distance
Manhattan
625941ee7c178a314d6ef9b4
def _init_light(self, payload: dict): <NEW_LINE> <INDENT> super()._init_light(payload)
This mixin is higher in inheritance chain than LightMixin so we're intercepting MLLight instantiation
625941eebe8e80087fb21186
def check(result): <NEW_LINE> <INDENT> self.assertEqual('No shared\n', out.getvalue())
check the output
625941ee090684286d50f23b
def __str__(self): <NEW_LINE> <INDENT> return "{}, {} Typing, Reflection={}, First appeared in {}".format(self.name, self.typing, self.reflection, self.year)
Default string return
625941ee9c8ee82313fbbcc3
def check_events(ai_setting, screen, aliens, ship, bullets, game_status, play_button,scoreboard): <NEW_LINE> <INDENT> for event in pygame.event.get(): <NEW_LINE> <INDENT> if event.type == pygame.QUIT: <NEW_LINE> <INDENT> sys.exit() <NEW_LINE> <DEDENT> elif event.type == pygame.KEYDOWN: <NEW_LINE> <INDENT> check_keydown...
响应按键和鼠标事件
625941eedd821e528d63b6f1
def _encode_value(self, value): <NEW_LINE> <INDENT> return codecs.encode(value, encoding='utf-8')
encode a given value :return: Bytes
625941ee97e22403b379d4e8
def render(self, node): <NEW_LINE> <INDENT> args = [self._convert_argument(arg) for arg in node.arguments] <NEW_LINE> render_method_name = self._RENDER_METHOD_NAMES[node.type] <NEW_LINE> render_method = getattr(self, render_method_name) <NEW_LINE> return render_method(*args)
Converts a given XPath :class:`Expression` into a corresponding string query. Args: node (Expression): An XPath :class:`Expression` to convert. Returns: str: A valid XPath query corresponding to the given :class:`Expression`.
625941eecb5e8a47e48b7fed
def test_short(self): <NEW_LINE> <INDENT> actual = self.run_jp2dump(['', '-s', self.jp2file]) <NEW_LINE> self.assertEqual(actual, fixtures.NEMO_DUMP_SHORT)
Verify dumping with -s, short option.
625941eeab23a570cc2506d3
def testsimplemusicxmltosequence(self): <NEW_LINE> <INDENT> self.checkmusicxmltosequence(self.flute_scale_filename) <NEW_LINE> self.checkFMajorScale(self.flute_scale_filename, 'Flute')
Test the simple flute scale MusicXML file.
625941ee711fe17d825428ab
def get_models(model_args: Dict) -> Dict: <NEW_LINE> <INDENT> model_map = {} <NEW_LINE> for name, kwargs in model_args.items(): <NEW_LINE> <INDENT> model_class = globals()[name] <NEW_LINE> model = model_class(**kwargs) <NEW_LINE> model_map[name] = model <NEW_LINE> <DEDENT> return model_map
Retrieve a list of models based on names and init kwargs :param model_args: dict of { <model_class_name>: <kwargs dict> } :return: map of initialized model indexed by its class name
625941ee0383005118ecfb2d
def addMass(self, nucName, mass, density=None, lumpedFissionProducts=None): <NEW_LINE> <INDENT> if density is None: <NEW_LINE> <INDENT> density = self.p.targetDensity <NEW_LINE> <DEDENT> if mass != 0: <NEW_LINE> <INDENT> if "FP" not in nucName: <NEW_LINE> <INDENT> self.add(makeMassAdditionComponent(nucName, mass, densi...
Adds mass to batch. Parameters ---------- nucName : str nuclide name -- e.g. 'U235' mass : float mass in grams of the nuclide to be added density : float density in grams per cc of the nuclide lumpedFissionProducts : LumpedFissionProductCollection the LumpedFissionProductCollection
625941eebf627c535bc1371b
def p_args_list_or_empty(self, p): <NEW_LINE> <INDENT> if len(p) == 2: <NEW_LINE> <INDENT> p[0] = p[1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p[0] = None
args_list_or_empty : args_list |
625941eecb5e8a47e48b7fee
def sflow_enable(self, **kwargs): <NEW_LINE> <INDENT> config = ET.Element("config") <NEW_LINE> sflow = ET.SubElement(config, "sflow", xmlns="urn:brocade.com:mgmt:brocade-sflow") <NEW_LINE> enable = ET.SubElement(sflow, "enable") <NEW_LINE> callback = kwargs.pop('callback', self._callback) <NEW_LINE> return callback(con...
Auto Generated Code
625941ee26068e7796caf233
def message_ports_in(self): <NEW_LINE> <INDENT> return _InBlock_swig.vamsi_src_c_sptr_message_ports_in(self)
message_ports_in(vamsi_src_c_sptr self) -> swig_int_ptr
625941eea219f33f34628eae
def gather_files(bld, rootpath, patterns): <NEW_LINE> <INDENT> if hasattr(rootpath, 'abspath'): <NEW_LINE> <INDENT> rootpath = rootpath.abspath() <NEW_LINE> <DEDENT> bldpath = bld.bldnode.abspath() <NEW_LINE> toppath = bld.srcnode.abspath() <NEW_LINE> all_file_paths = [] <NEW_LINE> for pattern in patterns: <NEW_LINE> <...
Assemble files from rootpath matching patterns for copying or archiving as a tree. rootpath: The root directory from which to gather files. Can be: 1. An absolute path, e.g. "/usr/lib/somelib" 2. A path in the build tree, expressed "{bld}/subdir" 3. A path in the source tree, expressed "{top...
625941ee442bda511e8be95d
def checkJiraRelease(version, auth): <NEW_LINE> <INDENT> inform("Checking if CSS version {} is released in Jira" .format(version)) <NEW_LINE> url = 'https://jira.esss.lu.se/rest/api/2/search?jql=project=CSSTUDIO AND fixVersion="ESS CS-Studio '+version+'"' <NEW_LINE> headers = {"Content-Type":"application/json"} <NEW_LI...
Check if version is released in Jira. Args: version: Full CSS version number to be released, e.g. 4.6.1.12 auth: Username and password pair for Jira
625941ee45492302aab5e815
def login(): <NEW_LINE> <INDENT> users = load_users() <NEW_LINE> print("\n-------请根据相关提示输入信息登陆-------\n") <NEW_LINE> while True: <NEW_LINE> <INDENT> user = input('请输入用户名:') <NEW_LINE> password = input('密码:') <NEW_LINE> if users.get(user): <NEW_LINE> <INDENT> correct_password = users[user]['password'] <NEW_LINE> if corr...
通过该函数登陆,成功返回用户名与数据列 使用json文件保存账户登陆信息与配置,数据结构为: { username: { "password": password, "salary": salary, "shopping_cart": [goods, price] } } 登陆过程中,输入无效账户可以选择注册账户或者重新输入;
625941ee5fcc89381b1e1c10
def __init__(self): <NEW_LINE> <INDENT> self.discriminator = None
XmlNs0ComplexRelationLeg - a model defined in Swagger
625941ee0fa83653e4657504
def syntax(): <NEW_LINE> <INDENT> print("dump_gps outputs GPS information for GTFS shapefiles and VISTA points.") <NEW_LINE> print("Usage:") <NEW_LINE> print(" python dump_gps.py dbServer network user password shapePath pathMatchFile") <NEW_LINE> sys.exit(0)
Print usage information
625941eed10714528d600236
def build_embedding_network(x_input, **kwargs): <NEW_LINE> <INDENT> x_out = x_input <NEW_LINE> if kwargs['n_filters'] is not None: <NEW_LINE> <INDENT> x_out = neural_blocks.convolutional_layers( x_input=x_out, input_shape=kwargs['conv_input_shape'], n_layer_filters=kwargs['n_filters'], layer_kernel_sizes=kwargs['kernel...
Build a base embedding model from an options dict.
625941ee57b8e32f524839eb
def smoothness_p(n, m=-1, power=0, visual=None): <NEW_LINE> <INDENT> if visual in (1, 0): <NEW_LINE> <INDENT> visual = bool(visual) <NEW_LINE> <DEDENT> elif visual not in (True, False): <NEW_LINE> <INDENT> visual = None <NEW_LINE> <DEDENT> if isinstance(n, str): <NEW_LINE> <INDENT> if visual: <NEW_LINE> <INDENT> return...
Return a list of [m, (p, (M, sm(p + m), psm(p + m)))...] where: 1. p**M is the base-p divisor of n 2. sm(p + m) is the smoothness of p + m (m = -1 by default) 3. psm(p + m) is the power smoothness of p + m The list is sorted according to smoothness (default) or by power smoothness if power=1. The smoothness of the n...
625941ee3346ee7daa2b32bd
def island_perimeter(grid): <NEW_LINE> <INDENT> perim = 0 <NEW_LINE> for y, row in enumerate(grid): <NEW_LINE> <INDENT> for x, item in enumerate(row): <NEW_LINE> <INDENT> if item == 1: <NEW_LINE> <INDENT> if x == 0 or grid[y][x - 1] == 0: <NEW_LINE> <INDENT> perim += 1 <NEW_LINE> <DEDENT> if x == len(row) - 1 or grid[y...
Compute the perimeter of an island
625941eec4546d3d9de72f85
def catch_all_fn(obj): <NEW_LINE> <INDENT> if isinstance(obj, Class1): <NEW_LINE> <INDENT> return Atom('custom-hook!')
This function will fire if "encode_hook" is passed in encode options dict with the key "catch_all" present.
625941ee0a50d4780f6673e3
def __getitem__(self, i): <NEW_LINE> <INDENT> l = len(self) <NEW_LINE> if i < 0: <NEW_LINE> <INDENT> i += l <NEW_LINE> <DEDENT> if i >= l: raise IndexError <NEW_LINE> f = self.readptr <NEW_LINE> f.seek(self.size*i) <NEW_LINE> return self.struct.unpack(f.read(self.size))
Returns the i'th struct. Negative indices work as well. Raised IndexError on invalid index.
625941ee2eb69b55b151ce04
def browse_by_radius(lat, lon, radius): <NEW_LINE> <INDENT> request = "/poiproxy/browseByLonLat?service=panoramio&lon=%f&lat=%f&dist=%f" % (lat, lon, radius) <NEW_LINE> raw_data = get_poi_proxy_server_response(request) <NEW_LINE> return json.loads(raw_data)['features']
Browses POI within the radius of a certain point :param lat: latitude of a point :param lon: longitude of a point :param radius: the radius :return: list of Features. Each feature is a dictionary with the following fields : 'geometry' and 'properties' geometry is also a dictionary and it has the following fields : coor...
625941ee60cbc95b062c6a90
def forward(self, X): <NEW_LINE> <INDENT> return np.tensordot(X, self.W, axes=((-1), (0))) + self.b
Perform forward step transformation with help of tensor product.
625941ee8e71fb1e9831dcf3
def calculate(self, s): <NEW_LINE> <INDENT> l = len(s) <NEW_LINE> if l == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> stk = [] <NEW_LINE> signs = [] <NEW_LINE> ans = 0 <NEW_LINE> num, sign = 0, 1 <NEW_LINE> for i in range(l): <NEW_LINE> <INDENT> if s[i] == ' ': <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> e...
:type s: str :rtype: int
625941ee3c8af77a43ae3cf4
@require(gribid=int, mode=int) <NEW_LINE> def grib_iterator_new(gribid, mode): <NEW_LINE> <INDENT> h = get_handle(gribid) <NEW_LINE> err, iterid = err_last(lib.grib_iterator_new)(h, mode) <NEW_LINE> GRIB_CHECK(err) <NEW_LINE> return put_iterator(iterid)
@brief Create a new geoiterator for the given GRIB message, using its geometry and values. The geoiterator can be used to go through all the geopoints in a GRIB message and retrieve the values corresponding to those geopoints.  Examples: ef grib_iterator.py "grib_iterator.py" @param gribid id of the GRIB loaded i...
625941eeff9c53063f47c73d
def index_calculator(img, index, img_params, additional_params=None, band_name=None): <NEW_LINE> <INDENT> if index not in indices: <NEW_LINE> <INDENT> raise ValueError('Index not defined') <NEW_LINE> <DEDENT> if not band_name: <NEW_LINE> <INDENT> band_name = index <NEW_LINE> <DEDENT> additional_params = additional_para...
:param img: :param index: :param img_params: :param additional_params: :param band_name: :return:
625941ee7b180e01f3dc4d3e
def __on_button_press(self, widget, event): <NEW_LINE> <INDENT> if self.__context is not None: <NEW_LINE> <INDENT> self.__on_button_clicked(self.__menu_button) <NEW_LINE> <DEDENT> if event.button == 3: <NEW_LINE> <INDENT> if GLib.getenv("WAYLAND_DISPLAY") != "" and self.get_ancestor(Gtk.Popover) is n...
Popup menu for track relative to track row @param widget as Gtk.Widget @param event as Gdk.Event
625941ee8e71fb1e9831dcf4
def train(self, data, iters): <NEW_LINE> <INDENT> cur_groups = pd.Series(-1, index=[i for i in range(self.num_observations)]) <NEW_LINE> i = 0 <NEW_LINE> flag_groups = False <NEW_LINE> flag_centroids = False <NEW_LINE> while i < iters and not flag_groups and not flag_centroids: <NEW_LINE> <INDENT> groups = self.group_o...
Returns a Series which represents the final clusters of each data point in the dataset. This function stops clustering if one of the following is met: - The values of the centroids do not change. - The clusters of each data point do not change. - The maximum number of iterations is met. Arguments: data {DataFrame}...
625941ee0c0af96317bb8734
def getAttrCount(self): <NEW_LINE> <INDENT> return super(IFCRECTANGLEPROFILEDEF,self).getAttrCount()+2
get the index of the last attribute
625941ee07d97122c4178de5
def validate_options(self, options): <NEW_LINE> <INDENT> options.google_account_enabled = ( options.google_account_project is not None)
Implements interface.
625941ee56b00c62f0f14baa
def test_line_count(self): <NEW_LINE> <INDENT> self.assertEqual(analyze_text(self.filename)[0], analyze_hbase())
Check that the line count is correct.
625941eecc40096d61595e9b
def register_worker_with_http_info(self, body, **kwargs): <NEW_LINE> <INDENT> all_params = ['body'] <NEW_LINE> all_params.append('callback') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> params = locals() <NEW_LINE> for key, val in iteritems(params['kwargs']): <NEW_LINE> <INDENT> if key not in all_p...
Registers the worker and saves the information. This registers a worker with the information provided. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> ...
625941eebe8e80087fb21187
def dock(self, planet): <NEW_LINE> <INDENT> return "d {} {}".format(self.id, planet.id)
Generate a command to dock to a planet. :param Planet planet: The planet object to dock to :return: The command string to be passed to the Halite engine. :rtype: str
625941ee187af65679ca566d
def test_positive_integer_or_none_4(): <NEW_LINE> <INDENT> assert positive_integer_or_none('none') is None <NEW_LINE> assert positive_integer_or_none('None') is None
Assert that the TPOT CLI interface's positive_integer_or_none parsing return None when value is string 'None' or 'none'.
625941ee29b78933be1e5bf2
def merge(self, imgs): <NEW_LINE> <INDENT> if not imgs: <NEW_LINE> <INDENT> raise ValueError('empty channel list') <NEW_LINE> <DEDENT> if len(imgs) == 1: <NEW_LINE> <INDENT> return imgs[0] <NEW_LINE> <DEDENT> return Image.merge(self.mode, imgs)
Merge image channels. Parameters ---------- imgs : `list` of `PIL.Image.Image` Returns ------- `PIL.Image.Image` Raises ------ ValueError If image channel list is empty.
625941eeeab8aa0e5d26e0a7
def linebreaks(value): <NEW_LINE> <INDENT> import re <NEW_LINE> from jinja2 import Markup <NEW_LINE> value = re.sub(r'(\r\n)|\r|\n', '\n', value) <NEW_LINE> paras = re.split('\n{2,}', value) <NEW_LINE> paras = [u'<p>%s</p>' % p.replace('\n', '<br />') for p in paras] <NEW_LINE> paras = u'\n\n'.join(paras) <NEW_LINE> re...
Converts newlines into <p> and <br />s.
625941ee5e10d32532c5f472
def ws(stream: Subject): <NEW_LINE> <INDENT> ws = create_connection('ws://{domain}/messages'.format(domain = self.__domain)) <NEW_LINE> while True: <NEW_LINE> <INDENT> stream.on_next(Mailcatcher.parse_message( json.loads(ws.recv())))
Thread Process
625941eecad5886f8bd27525
def fit(self, data, parent_node=None, estimator_type=None): <NEW_LINE> <INDENT> if not parent_node: <NEW_LINE> <INDENT> if not self.parent_node: <NEW_LINE> <INDENT> raise ValueError("parent node must be specified for the model") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> parent_node = self.parent_node <NEW_LINE> <DE...
Computes the CPD for each node from a given data in the form of a pandas dataframe. If a variable from the data is not present in the model, it adds that node into the model. Parameters ---------- data : pandas DataFrame object A DataFrame object with column names same as the variable names of network parent_node...
625941ee56ac1b37e6264712
def test_validate_checks_for_wrong_user(self): <NEW_LINE> <INDENT> job = JobDefinition({ 'name': 'name', 'plugin': self.parameters.plugin, 'command': 'true', 'user': 'fred', }) <NEW_LINE> with self.assertRaises(ValidationError) as boom: <NEW_LINE> <INDENT> CheckBoxJobValidator.validate(job) <NEW_LINE> <DEDENT> self.ass...
verify that validate() checks if jobs have a wrong value for the 'user' field. This field has been limited to either not defined or 'root' for sanity. While other choices _may_ be possible having just the two makes our job easier.
625941ee4e4d5625662d491d
@user_app.route('vegetable/k_line', methods=['POST']) <NEW_LINE> @catch_error <NEW_LINE> def get_k_line(): <NEW_LINE> <INDENT> req_json = request.json <NEW_LINE> vegetable_name = req_json['vegetable_name'] <NEW_LINE> date = req_json['date'] <NEW_LINE> if not (vegetable_name and date): <NEW_LINE> <INDENT> return json.du...
获取蔬菜k线图 :return:
625941ee0a366e3fb873ed6c
def __init__(self, user, auth, priv, logging=None): <NEW_LINE> <INDENT> self.__user = user <NEW_LINE> self.__auth = auth <NEW_LINE> self.__priv = priv <NEW_LINE> self.__logging = logging
:param user: Username :param auth: Auth :param priv: Priv
625941eebde94217f3683339
def __unicode__(self): <NEW_LINE> <INDENT> return u'%s' % self.Strain
For a Strain object, the unicode representation is the Strain field.
625941ee15fb5d323cde1065
def __init__(self, collection_path): <NEW_LINE> <INDENT> self.collection_path = collection_path <NEW_LINE> self.lock_path = collection_path + '/access.lock' <NEW_LINE> self.info_path = collection_path + '/collection.json' <NEW_LINE> self.db_path = collection_path + '/meta.sqlite' <NEW_LINE> self.data_dir = collection_p...
Constructor.
625941ee94891a1f4081bff9
def _apimethod_predicate(obj): <NEW_LINE> <INDENT> return getattr(obj, 'rest_route', False) or getattr(obj, '__rest_route__', False)
The predicate for determining if the object is an @apimethod decorated method. :param object obj: The object to check :return: A bool indicating if the object was an @apimethod decorated method. :rtype: bool
625941ee31939e2706e4d3af
def getDataInLines(self): <NEW_LINE> <INDENT> return _fife.RawData_getDataInLines(self)
getDataInLines(RawData self) -> StringVector
625941ee30c21e258bdfa9f0
@auth.requires_login() <NEW_LINE> def update_task(): <NEW_LINE> <INDENT> task_id = request.args(0) <NEW_LINE> task = db.task(id=task_id) or redirect(URL('task_not_found')) <NEW_LINE> task_url = URL('update_task', host='host_defined', scheme='https', args=task_id) <NEW_LINE> if (task.created_by==auth.user.id and task.as...
Allows a user to update a task they have permissions for.
625941ee377c676e912726f4
def __parse_dict(self) -> OrderedDict: <NEW_LINE> <INDENT> self.idx += 1 <NEW_LINE> d = OrderedDict() <NEW_LINE> key_name = None <NEW_LINE> while self.data[self.idx: self.idx + 1] != b'e': <NEW_LINE> <INDENT> if key_name is None: <NEW_LINE> <INDENT> key_name = self.__parse() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT...
Returns an Ordered Dictionary of nested bencode elements.
625941ee60cbc95b062c6a91
def _load_plugins_from_dirs(dirs): <NEW_LINE> <INDENT> log.debug('Trying to load plugins from: %s' % dirs) <NEW_LINE> dirs = [Path(d) for d in dirs if os.path.isdir(d)] <NEW_LINE> plugins_pkg.__path__ = list(map(_strip_trailing_sep, dirs)) <NEW_LINE> for plugins_dir in dirs: <NEW_LINE> <INDENT> for plugin_path in plugi...
:param list dirs: Directories from where plugins are loaded from
625941ee21a7993f00bc8247
def forward(self, state): <NEW_LINE> <INDENT> x = torch.relu(self.batch_norm(self.fc1(state))) <NEW_LINE> x = torch.relu(self.fc2(x)) <NEW_LINE> return torch.tanh(self.fc3(x))
Build an actor (policy) network that maps states -> actions.
625941ee30c21e258bdfa9f1
def get_kernel(self, X1, X2=None): <NEW_LINE> <INDENT> raise NotImplementedError
Compute the kernel matrix for inputs X1 and X2. If X2 is None, return the covariance between X1 and itself.
625941eeaad79263cf390f96