code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def hrm_vars(module): <NEW_LINE> <INDENT> auth = current.auth <NEW_LINE> if not auth.is_logged_in(): <NEW_LINE> <INDENT> auth.permission.fail() <NEW_LINE> <DEDENT> s3db = current.s3db <NEW_LINE> session = current.session <NEW_LINE> if session.s3.hrm is None: <NEW_LINE> <INDENT> session.s3.hrm = Storage() <NEW_LINE> <DE... | Set session and response variables | 625941c87c178a314d6ef4ca |
def should_shift(self, block, name): <NEW_LINE> <INDENT> category = block.category <NEW_LINE> if category == 'course': <NEW_LINE> <INDENT> if name in self.COURSE_OVERRIDEN_NAMES: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> if category in self.BLOCK_OVERRIDEN_CATEGORIES: <NEW_LINE> <INDENT> if name in s... | Defines when to shift(override) field value | 625941c891af0d3eaac9ba84 |
def __init__(self, *args): <NEW_LINE> <INDENT> self.configs = dict() <NEW_LINE> self.parsers = list() <NEW_LINE> self._config = None <NEW_LINE> for arg in args: <NEW_LINE> <INDENT> self.addConfig(**arg) | Initializes a ConfigManager.
Inputs: args - ConfigManagers can be optionally initialized with a sequence of dictionaries representing
configuration options to add to the ConfigManager. | 625941c86aa9bd52df036e10 |
def parse_legend_kwargs(self, **defaults): <NEW_LINE> <INDENT> return self._parse_extra_params('legend', **defaults) | Pop the legend arguments from the `pargs` for this `Plot`
| 625941c83317a56b86939cc6 |
def globalkeys(self): <NEW_LINE> <INDENT> for key in self.__globals.keys(): <NEW_LINE> <INDENT> yield key | Yields global keys. | 625941c82eb69b55b151c91a |
def viewkeys(self): <NEW_LINE> <INDENT> return _dictionary_keys(self) | Return a new view of the dictionary's keys | 625941c83317a56b86939cc7 |
def read_line(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> expected_bytes = self.report_size(len(self._inas)) <NEW_LINE> cmd = struct.pack("<H", self.CMD_NEXT) <NEW_LINE> bytesread = self.wr_command(cmd, read_count=expected_bytes) <NEW_LINE> <DEDENT> except usb.core.USBError as e: <NEW_LINE> <INDENT> print("READ... | Read a line of data from the setup INAs
Returns:
list of dicts of the values read by ina/type tuple, otherwise None.
[{ts:100, (vbat, power):450}, {ts:200, (vbat, power):440}] | 625941c899fddb7c1c9de3fd |
def getNotificationUUIDList(self): <NEW_LINE> <INDENT> return list(self._notification_set) | Returns the list of nodes waiting for the transaction to be
finished | 625941c8236d856c2ad44845 |
def log(self, *args): <NEW_LINE> <INDENT> for msg in args: <NEW_LINE> <INDENT> self.logger.message(msg) | Process a log message | 625941c896565a6dacc8f738 |
@utils.arg('--service', metavar='<service-type>', default=None, help='Service type to return.') <NEW_LINE> @require_service_catalog <NEW_LINE> def do_catalog(kc, args): <NEW_LINE> <INDENT> endpoints = kc.service_catalog.get_endpoints(service_type=args.service) <NEW_LINE> for (service, service_endpoints) in six.iteritem... | List service catalog, possibly filtered by service. | 625941c8d268445f265b4eda |
def are_possible_pairs(self, key_val): <NEW_LINE> <INDENT> letters = list(key_val.keys()) <NEW_LINE> for idx, first in enumerate(letters): <NEW_LINE> <INDENT> for second in letters[idx + 1:]: <NEW_LINE> <INDENT> if not self.possible_pairs[(first, second)][self._index(key_val[first], key_val[second])]: <NEW_LINE> <INDEN... | :param key_val: A dictionary of letter -> number
:return: True iff all combinations of letters in the dictionary and corresponding values appears in possible_pairs | 625941c84a966d76dd55107b |
def best_base(self,seq1,seq2,qual1,qual2,pos,offset1,offset2): <NEW_LINE> <INDENT> phred33="!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ" <NEW_LINE> pos_qual1=qual1[pos] <NEW_LINE> pos_qual2=qual2[pos+offset1] <NEW_LINE> phred33_pos_qual1 = phred33.find(pos_qual1) <NEW_LINE> phred33_pos_qual2 = phred33.find(pos_qual2) <... | Identifies nucleotide with better score. | 625941c821bff66bcd6849c0 |
def kl(self, old_dist_info, new_dist_info): <NEW_LINE> <INDENT> raise NotImplementedError | Compute the KL divergence of two distributions | 625941c88e7ae83300e4b039 |
def check_root_uuid_in_grub(self): <NEW_LINE> <INDENT> if len(self.root_uuid) == 0: <NEW_LINE> <INDENT> logging.warning(_("'ruuid' variable is not set. I can't check root UUID in grub.cfg, let's hope it's ok")) <NEW_LINE> return <NEW_LINE> <DEDENT> ruuid_str = 'root=UUID={0}'.format(self.root_uuid) <NEW_LINE> cmdline_l... | Checks grub.cfg for correct root UUID | 625941c88c0ade5d55d3ea26 |
def testCreateConnectionRequestBodyData(self): <NEW_LINE> <INDENT> pass | Test CreateConnectionRequestBodyData | 625941c84f88993c3716c0d4 |
def rank_intervaldom(self): <NEW_LINE> <INDENT> rank = dok_matrix((self.nbDecision, self.nbDecision)) <NEW_LINE> for i in range(self.nbDecision): <NEW_LINE> <INDENT> for j in range(self.nbDecision): <NEW_LINE> <INDENT> if self.scores[j, 1] < self.scores[i, 0]: <NEW_LINE> <INDENT> rank[i, j] = 1 <NEW_LINE> <DEDENT> elif... | Return a sparse matrix encoding partial ordering obtained by Int. dominance
:return: a preference matrix of labels based on interval dominance.
usually provides a partial order
:rtype: :class:`~scipy.sparse.dok_matrix`
| 625941c8a8ecb033257d313a |
def get_batch_order_items(self, sellable, value, quantity): <NEW_LINE> <INDENT> order_items = [] <NEW_LINE> storable = sellable.product_storable <NEW_LINE> original_batch_items = self.get_batch_items() <NEW_LINE> if issubclass(self.batch_selection_dialog, BatchDecreaseSelectionDialog): <NEW_LINE> <INDENT> extra_kw = di... | Get order items for sellable considering it's |batches|
By default, this will run :obj:`.batch_selection_dialog` to get
the batches and their quantities and then call :meth:`.get_order_item`
on each one.
:param sellable: a |sellable|
:param value: the value (e.g. price, cost) of the sellable
:param quantity: the quan... | 625941c8bde94217f3682e5e |
def _get_resource_name(self, resource, parent, name, uuid): <NEW_LINE> <INDENT> fq_name = list(parent.fq_name) <NEW_LINE> fq_name.append(name) <NEW_LINE> obj = self._api.fq_name_to_id(resource, fq_name) <NEW_LINE> if obj is None: <NEW_LINE> <INDENT> return name <NEW_LINE> <DEDENT> return name + '_' + uuid | Generate an unique name. This is display name if there are
no conflicts or display_name + uuid. | 625941c8d18da76e23532542 |
def write(self, s): <NEW_LINE> <INDENT> if isinstance(s, str): <NEW_LINE> <INDENT> self._body.write(s.encode(self.charset)) <NEW_LINE> <DEDENT> elif isinstance(s, bytes): <NEW_LINE> <INDENT> self._body.write(s) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._body.write(str(s)) | Appends a string to the response sent to the client.
@param s: string to write
@type s: str
@return: None | 625941c8a17c0f6771cbe0bd |
def to_atmlab_dict(self): <NEW_LINE> <INDENT> d = {} <NEW_LINE> if self.name is None: <NEW_LINE> <INDENT> d['name'] = '' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> d['name'] = self.name <NEW_LINE> <DEDENT> d['grids'] = self.grids <NEW_LINE> d['gridnames'] = self.gridnames <NEW_LINE> d['data'] = self.data <NEW_LINE> ... | Returns a copy of the GriddedField as a dictionary.
Returns a dictionary compatible with an atmlab structure.
Returns:
Dictionary containing the grids and data. | 625941c857b8e32f52483507 |
def get_distr_multi_and_scaled_insured(df_cov): <NEW_LINE> <INDENT> bucket_size = 20 <NEW_LINE> cols_ia = ['Insured_Amount1','Insured_Amount2','Insured_Amount3', 'Coverage_Deductible_if_applied'] <NEW_LINE> insured_amounts = df_cov[cols_ia].drop_duplicates(cols_ia) <NEW_LINE> sample_arr = [] <NEW_LINE> for ias in insur... | In:
DataFrame(df_cov), # df_policy by coverage, with additional 'Premium_dir' and 'Premium_indir'
Out:
DataFrame(df_cov),
Description:
get policy, coverage level distribution multiplier (1/0.65 or 1/0.7927) and scaled insured amount | 625941c8a17c0f6771cbe0be |
def window_header(stdscr, title): <NEW_LINE> <INDENT> header = ' ' + title + (' ' * (curses.COLS - len(title) - 1)) <NEW_LINE> stdscr.addstr(0,0,header,curses.A_STANDOUT) | Adds a header to the window with the title on the left. | 625941c863d6d428bbe4455c |
def evaluate_entropy(piece: Piece) -> float: <NEW_LINE> <INDENT> positions = [ x.scale_element.position_in_degrees for x in piece.counterpoint ] <NEW_LINE> counter = Counter(positions) <NEW_LINE> lower_position = piece.lowest_element.position_in_degrees <NEW_LINE> upper_position = piece.highest_element.position_in_degr... | Evaluate non-triviality of counterpoint line based on entropy.
:param piece:
`Piece` instance
:return:
normalized average over all lines entropy of pitches distribution | 625941c8fbf16365ca6f622f |
def post(self, name): <NEW_LINE> <INDENT> if ItemModel.find_item_by_name(name): <NEW_LINE> <INDENT> return{"message": "item already exists"}, 400 <NEW_LINE> <DEDENT> data = Item.parser.parse_args() <NEW_LINE> new_item = ItemModel(name, **data) <NEW_LINE> try: <NEW_LINE> <INDENT> new_item.save_to_db() <NEW_LINE> <DEDENT... | endponint for creating an item, it does not accept full json, but parses it and uses only {price: <float>} | 625941c8460517430c3941f4 |
def __init__(self, pathsfile, chassisfile, target, outbasename, imgdir=None, cmpdnamefile=None, customchassisfile=None): <NEW_LINE> <INDENT> self.pathsfile = pathsfile <NEW_LINE> self.chassisfile = chassisfile <NEW_LINE> self.target = target <NEW_LINE> self.outbasename = outbasename <NEW_LINE> self.imgdir = imgdir <NEW... | Initialization. | 625941c8442bda511e8be486 |
def pause(self, _): <NEW_LINE> <INDENT> self.playing = False | suspend playing and allow continuation later. | 625941c85510c4643540f453 |
def plot_tseries(*args, **kwargs) : <NEW_LINE> <INDENT> data = kwargs.pop('data') <NEW_LINE> return data.dropna().plot(x=args[0], y=args[1], **kwargs) | Simple plotting function to pass to FacetGrid. | 625941c8bf627c535bc1323b |
def bellman_operator(gm, w): <NEW_LINE> <INDENT> Aw = lambda x: interp(x, gm.grid, w) <NEW_LINE> Tw = np.empty(len(w)) <NEW_LINE> for i, k in enumerate(gm.grid): <NEW_LINE> <INDENT> objective = lambda c: - gm.u(c) - gm.beta * Aw(gm.f(k) - c) <NEW_LINE> c_star = fminbound(objective, 1e-6, gm.f(k)) <NEW_LINE> Tw[i] = - ... | The approximate Bellman operator, which computes and returns the updated
value function Tw on the grid poitns.
Parameters:
* gm is an instance of the growthModel class
* w is a flat NumPy array with len(w) = len(grid)
The vector w represents the value of the input function on the grid
points. | 625941c829b78933be1e571a |
def _detect_http_redirection(http_response: HTTPResponse, server_host_name: str, server_port: int) -> Optional[str]: <NEW_LINE> <INDENT> next_location_path = None <NEW_LINE> if 300 <= http_response.status < 400: <NEW_LINE> <INDENT> location_header = _extract_first_header_value(http_response, "Location") <NEW_LINE> if l... | If the HTTP response contains a redirection to the same server, return the path to the new location.
| 625941c8adb09d7d5db6c7fd |
def test_onchange_one2many_multi(self): <NEW_LINE> <INDENT> partner1 = self.env['res.partner'].create({'name': 'A partner'}) <NEW_LINE> multi = self.env['test_new_api.multi'].create({'partner': partner1.id}) <NEW_LINE> line1 = multi.lines.create({'multi': multi.id}) <NEW_LINE> field_onchange = multi._onchange_spec() <N... | test the effect of multiple onchange methods on one2many fields | 625941c807d97122c41788f6 |
def gettext_noop(s): <NEW_LINE> <INDENT> return s | Return same string, Dummy function to find translatable strings with makemessages | 625941c87cff6e4e811179f3 |
@account_required <NEW_LINE> def edit(request): <NEW_LINE> <INDENT> form = AccountForm(request.POST or None, instance=request.account, initial={'username': request.account.username, 'email': request.account.email}) <NEW_LINE> if form.is_valid(): <NEW_LINE> <INDENT> account = Account.objects.update_user_account( account... | アカウント情報編集ページ | 625941c80383005118ecf650 |
def execute_command(self, command_name, **kwargs): <NEW_LINE> <INDENT> with self.command_lock: <NEW_LINE> <INDENT> extension_part, command_part = self.split_command(command_name) <NEW_LINE> if len(self.command_results) > 0: <NEW_LINE> <INDENT> last_command = list(self.command_results.values())[-1] <NEW_LINE> if not las... | Execute an agent command. | 625941c897e22403b379d006 |
def d_vector(self, k): <NEW_LINE> <INDENT> from sage.modules.free_module_element import vector <NEW_LINE> if self._use_d_vec: <NEW_LINE> <INDENT> return copy(self._D).column(k) <NEW_LINE> <DEDENT> elif self._use_fpolys: <NEW_LINE> <INDENT> f = self.cluster_variable(k) <NEW_LINE> if f in self._R.gens(): <NEW_LINE> <INDE... | Return the ``k``-th *d-vector* of ``self``. This is the exponent vector
of the denominator of the ``k``-th cluster variable.
EXAMPLES::
sage: S = ClusterSeed(['A',3])
sage: S.mutate([2,1,2])
sage: [ S.d_vector(k) for k in range(3) ]
[(-1, 0, 0), (0, 1, 1), (0, 1, 0)] | 625941c807f4c71912b114ef |
def __init__(self, mailhost, fromaddr, toaddrs, subject, credentials=None, secure=None, timeout=5.0): <NEW_LINE> <INDENT> logging.Handler.__init__(self) <NEW_LINE> if isinstance(mailhost, (list, tuple)): <NEW_LINE> <INDENT> self.mailhost, self.mailport = mailhost <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.mailh... | Initialize the handler.
Initialize the instance with the from and to addresses and subject
line of the email. To specify a non-standard SMTP port, use the
(host, port) tuple format for the mailhost argument. To specify
authentication credentials, supply a (username, password) tuple
for the credentials argument. To spe... | 625941c897e22403b379d007 |
def iterbytes(s): <NEW_LINE> <INDENT> if isinstance(s, (bytes, memoryview)): <NEW_LINE> <INDENT> return (ord(_c) for _c in s) <NEW_LINE> <DEDENT> return s | Iterate over bytes/bytearray/memoryview, returning int. | 625941c83617ad0b5ed67f65 |
def drawAll(plots): <NEW_LINE> <INDENT> for plotName, plotInfo in plots.iteritems(): <NEW_LINE> <INDENT> plotInfo['t1'] = tree1 <NEW_LINE> plotInfo['t2'] = tree2 <NEW_LINE> plotInfo['name1'] = a1 <NEW_LINE> plotInfo['name2'] = a2 <NEW_LINE> c = draw( **plotInfo) <NEW_LINE> plotInfo.comparator = c | create and draw the comparators corresponding to each of the plot info in the input
plots dictionary | 625941c850812a4eaa59c390 |
def test_check_returned_value(self): <NEW_LINE> <INDENT> expected_return = self.mock_GwyEllipseSelection.from_gwy.return_value <NEW_LINE> actual_return = GwyChannel._get_ellipse_sel(self.gwyfile, self.channel_id) <NEW_LINE> self.assertIs(expected_return, actual_return) | Return object returned by GwyEllipseSelections constructor
| 625941c88a349b6b435e81e0 |
def _get_filesize(self): <NEW_LINE> <INDENT> where = self.fstream.tell() <NEW_LINE> self.fstream.seek(0, 2) <NEW_LINE> size = self.fstream.tell() <NEW_LINE> self.fstream.seek(where, 0) <NEW_LINE> return size | Returns the file size. | 625941c8a219f33f346289d8 |
def read_url(url): <NEW_LINE> <INDENT> req = requests.get(url) <NEW_LINE> if not req.ok: <NEW_LINE> <INDENT> _give_warning(req.content) <NEW_LINE> <DEDENT> return req.content | Read url. | 625941c899cbb53fe6792c54 |
def format_number(number: Any) -> str: <NEW_LINE> <INDENT> if not isinstance(options.digits, int): <NEW_LINE> <INDENT> raise TypeError("options.digits must be an int.") <NEW_LINE> <DEDENT> template = f"{{:^+{options.digits + 6}.{options.digits - 1}E}}" <NEW_LINE> formatted = template.format(float(number)) <NEW_LINE> if... | Prepare a number to be displayed as a string. | 625941c87d847024c06be328 |
def fit(self, X, y, sample_weight=None): <NEW_LINE> <INDENT> X, y = check_X_y(X, y, 'csr') <NEW_LINE> _, n_features = X.shape <NEW_LINE> labelbin = LabelBinarizer() <NEW_LINE> Y = labelbin.fit_transform(y) <NEW_LINE> self.classes_ = labelbin.classes_ <NEW_LINE> if Y.shape[1] == 1: <NEW_LINE> <INDENT> Y = np.concatenate... | Fit Naive Bayes classifier according to X, y
Parameters
----------
X : {array-like, sparse matrix}, shape = [n_samples, n_features]
Training vectors, where n_samples is the number of samples and
n_features is the number of features.
y : array-like, shape = [n_samples]
Target values.
sample_weight : array... | 625941c8d99f1b3c44c675fd |
def solve(max_d=10**6): <NEW_LINE> <INDENT> phi_sieve = list(range(2, max_d + 1)) <NEW_LINE> for p in sieve.primerange(2, max_d): <NEW_LINE> <INDENT> partial_totient = 1 - 1.0 / p <NEW_LINE> for multiple in range(p, max_d + 1, p): <NEW_LINE> <INDENT> phi_sieve[multiple - 2] *= partial_totient <NEW_LINE> <DEDENT> <DEDEN... | The number of reduced proper fractions for d is the number of numbers less than d and relatively prime to d.
This is phi(d). | 625941c8091ae35668666fcd |
def get_item(self, i): <NEW_LINE> <INDENT> pass | (OneDimensionalMatrix, int) -> float
Return the i'th item in this matrix | 625941c8099cdd3c635f0cc8 |
def double_oracle(max_oracle, min_oracle, start_max, start_min, payoff, epsilon, num_iterations): <NEW_LINE> <INDENT> max_strats = [start_max] <NEW_LINE> min_strats = [start_min] <NEW_LINE> max_probs = [1] <NEW_LINE> min_probs = [1] <NEW_LINE> vals = [] <NEW_LINE> iter_num = 0 <NEW_LINE> curr_value = payoff(start_max, ... | Implementation of the generic double oracle algorithm.
max/min_oracle: best response oracle for the maximizating (minimizing) player
start_max/min: arbitrary pure strategy for the maximizing (minimizing) player to initialize with
payoff: a function returning the payoff to a strategy for the max player and min player... | 625941c8090684286d50ed52 |
def ex_input(): <NEW_LINE> <INDENT> input_value = input('input an Integer!') <NEW_LINE> print(input_value) | 入力
input | 625941c8b545ff76a8913e84 |
def add_children(self, children): <NEW_LINE> <INDENT> self.children += children <NEW_LINE> for child in children: <NEW_LINE> <INDENT> child.parent = self <NEW_LINE> self.click_handler.propagate_handler(child.click_handler) <NEW_LINE> <DEDENT> if len(children) > 0: <NEW_LINE> <INDENT> self.invalidate() | @type children: list of Drawable | tuple of Drawable | 625941c8e1aae11d1e749d24 |
def callback(self,status,response): <NEW_LINE> <INDENT> if not status: <NEW_LINE> <INDENT> Logger().log(str(response),False) <NEW_LINE> return <NEW_LINE> <DEDENT> ret = json.loads(response.text) <NEW_LINE> if ret['code'] == 1000: <NEW_LINE> <INDENT> Logger().log(ret['message'],True) <NEW_LINE> <DEDENT> else: <NEW_LINE>... | 提交资产后的回调函数 | 625941c8ff9c53063f47c261 |
def lightness(self): <NEW_LINE> <INDENT> return 0 | lightness(self) -> int | 625941c873bcbd0ca4b2c0e4 |
def __init__(self, r, s): <NEW_LINE> <INDENT> if r in ['a', 'j', 'q', 'k']: <NEW_LINE> <INDENT> self.r = r.upper() <NEW_LINE> <DEDENT> elif r in range(2,11) or r in ['A', 'J', 'Q', 'K']: <NEW_LINE> <INDENT> self.r = r <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise ValueError('''Please input a valid card rank(integ... | Initialize card with rank and suit | 625941c87d43ff24873a2d0e |
def setup_platform(hass, config, add_devices, discovery_info=None): <NEW_LINE> <INDENT> import Adafruit_DHT <NEW_LINE> SENSOR_TYPES[SENSOR_TEMPERATURE][1] = hass.config.units.temperature_unit <NEW_LINE> available_sensors = { "DHT11": Adafruit_DHT.DHT11, "DHT22": Adafruit_DHT.DHT22, "AM2302": Adafruit_DHT.AM2302 } <NEW_... | Set up the DHT sensor. | 625941c8377c676e91272216 |
def getFile(wsdlClient, codeString): <NEW_LINE> <INDENT> tries = 0 <NEW_LINE> logger = logging.getLogger("rkn") <NEW_LINE> try: <NEW_LINE> <INDENT> while tries < MAXTRIES: <NEW_LINE> <INDENT> result = wsdlClient.service.getResult(code=codeString) <NEW_LINE> if result['resultCode'] == 0: <NEW_LINE> <INDENT> logger.info(... | Try to download file from RKN
Returns archive or None if error | 625941c8851cf427c661a57d |
def __init__( self, config=None ): <NEW_LINE> <INDENT> if config is None: <NEW_LINE> <INDENT> with self.readSharedFileStream( "config.pickle", isProtected=False ) as fileHandle: <NEW_LINE> <INDENT> self.__config = cPickle.load(fileHandle) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> self.__config = config <NE... | :param config: If config is not None then the
given configuration object will be written to the shared file "config.pickle" which can
later be retrieved using the readSharedFileStream. See writeConfigToStore.
If this file already exists it will be overwritten. If config is None,
the shared file "config.pickle" is ass... | 625941c801c39578d7e74ea9 |
def test_revise_rule_revise(self): <NEW_LINE> <INDENT> pass | Test case for revise_rule_revise
Update an Existing Rule and Reorder the Rule # noqa: E501 | 625941c88e05c05ec3eea3e1 |
def move_group_to_group_by_name(self, group_name, parent_group_name, autocreate_parent_group=False, parent_group_pos=None): <NEW_LINE> <INDENT> group = self.get_group_by_name(group_name) <NEW_LINE> parent_group = self.get_group_by_name(parent_group_name) <NEW_LINE> if not group: <NEW_LINE> <INDENT> return None <NEW_LIN... | Velluga el grup indicat dins el group especificat per noms
---
Move the indicated group within the specified group by names | 625941c8435de62698dfdcba |
def deserialize(self, raw_jws, key=None, alg=None): <NEW_LINE> <INDENT> self.objects = dict() <NEW_LINE> o = dict() <NEW_LINE> try: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> djws = json_decode(raw_jws) <NEW_LINE> if 'signatures' in djws: <NEW_LINE> <INDENT> o['signatures'] = list() <NEW_LINE> for s in djws['signatur... | Deserialize a JWS token.
NOTE: Destroys any current status and tries to import the raw
JWS provided.
:param raw_jws: a 'raw' JWS token (JSON Encoded or Compact
notation) string.
:param key: A (:class:`jwcrypto.jwk.JWK`) verification key (optional).
If a key is provided a verification step will be attempted after
t... | 625941c856ac1b37e626423e |
def isrst(filename): <NEW_LINE> <INDENT> return filename[-4:] == '.rst' | Returns true if filename is an rst | 625941c8442bda511e8be487 |
def detail_list(self, request, group_snapshots): <NEW_LINE> <INDENT> return self._list_view(self.detail, request, group_snapshots) | Detailed view of a list of group_snapshots . | 625941c8627d3e7fe0d68ebd |
@pytest.fixture <NEW_LINE> def capabilities( request, driver_class, chrome_options, firefox_options, session_capabilities ): <NEW_LINE> <INDENT> capabilities = copy.deepcopy(session_capabilities) <NEW_LINE> if driver_class == webdriver.Remote: <NEW_LINE> <INDENT> browser = capabilities.get("browserName", "").upper() <N... | Returns combined capabilities | 625941c8d6c5a102081440b8 |
def __eq__(self, other): <NEW_LINE> <INDENT> if type(other) is not type(self): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> other = other.reduced() <NEW_LINE> this = self.reduced() <NEW_LINE> return this.num == other.num == 0 or (this.num == other.num and this.den == other.den) | Checks equality; reduces both fractions first | 625941c8187af65679ca518c |
def test_design_comments_find_one_get(self): <NEW_LINE> <INDENT> pass | Test case for design_comments_find_one_get
Find first instance of the model matched by filter from the data source. | 625941c88a349b6b435e81e1 |
def get_sum(self, field=None): <NEW_LINE> <INDENT> if not field: <NEW_LINE> <INDENT> raise AttributeError("Please provide field to apply aggregation to!") <NEW_LINE> <DEDENT> agg = A("sum", field=field) <NEW_LINE> self.aggregations['sum_' + field] = agg <NEW_LINE> return self | Create a sum aggregation object and add it to the aggregation dict
:param field: the field present in the index that is to be aggregated
:returns: self, which allows the method to be chainable with the other methods | 625941c8796e427e537b0633 |
def __rsub__(self, other): <NEW_LINE> <INDENT> return promote(other).__sub__(self) | Returns a new variable that represents other - self.
Promotes other in case it is an int or float. | 625941c816aa5153ce3624e6 |
def isMatch(self, s, p): <NEW_LINE> <INDENT> s_length, p_length = len(s), len(p) <NEW_LINE> if '*' not in p and p_length != s_length: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if p_length == 0: <NEW_LINE> <INDENT> return s_length == p_length <NEW_LINE> <DEDENT> starts_normal, ends_normal = self.get_normal(p)... | :type s: str
:type p: str
:rtype: bool | 625941c88da39b475bd64fe1 |
def main(): <NEW_LINE> <INDENT> num_list = int(input('Enter the number of list elements:')) <NEW_LINE> float_nums = get_floats(num_list) <NEW_LINE> sum_hard = summer(float_nums) <NEW_LINE> avgr = average(float_nums) <NEW_LINE> stan_dev1 = std_dev(float_nums, avgr) | This calls all the fucntions in the program | 625941c8a8ecb033257d313b |
def test_int_lit_3(self): <NEW_LINE> <INDENT> self.assertTrue(TestLexer.checkLexeme("0x0987","0,x0987,<EOF>",9)) | test integer literal | 625941c8f7d966606f6aa071 |
def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> _simuPOP_op.RandomParentsChooser_swiginit(self, _simuPOP_op.new_RandomParentsChooser(*args, **kwargs)) | Usage:
RandomParentsChooser(replacement=True, selectionField="fitness")
Details:
Create a random parents chooser that choose two parents with or
without replacement (parameter replacement, default to True). If
selection is enabled and information field selectionField exists
in the passed populati... | 625941c823849d37ff7b30fe |
def enable_save_button(self): <NEW_LINE> <INDENT> result = self.str_validity_status() <NEW_LINE> self.editor.buttonBox.button(QDialogButtonBox.Save).setEnabled(result) | Enables or disables the Save button of the STR editor based on the
validity status of the editor. | 625941c83eb6a72ae02ec549 |
def test_add_sequence(self): <NEW_LINE> <INDENT> pass | Test case for add_sequence
Adds a new sequence. | 625941c85fcc89381b1e172c |
def most_common_tokens( tokens: Iterable[bytes], max_n_tokens=100 ) -> List[Tuple[str, int]]: <NEW_LINE> <INDENT> counter = Counter(tokens) <NEW_LINE> most_common = counter.most_common(max_n_tokens) <NEW_LINE> return [(token.decode("utf-8"), n) for token, n in most_common] | Build `(token, count)` pairs for the most frequent tokens in `tokens`.
Converts tokens back to utf-8. | 625941c81f5feb6acb0c4bbf |
@app.teardown_appcontext <NEW_LINE> def close_session(exception): <NEW_LINE> <INDENT> storage.close() | Remove the db session or save file | 625941c83617ad0b5ed67f66 |
def init_conv_standard(X, y, input_layer, random_state, learning_step_function=init_ols_balanced, init_conv_min_layers=1, init_conv_max_layers=3, init_min_conv_neurons_per_layer=1, init_max_conv_neurons_per_layer=5, prob_conv=0.75, init_min_layers=1, init_max_layers=1, init_min_neurons_per_layer=1, init_max_neurons_per... | Creates a new NeuralNetwork's instance from scratch and returns a neural network
with all connections established, as well as bias, learning_step, semantics and predictions
already computed.
Returns
-------
nn : NeuralNetwork | 625941c821a7993f00bc7d5c |
def exchange_sort(arr): <NEW_LINE> <INDENT> arr_len = len(arr) <NEW_LINE> for i in range(arr_len-1): <NEW_LINE> <INDENT> for j in range(i+1, arr_len): <NEW_LINE> <INDENT> if(arr[i] > arr[j]): <NEW_LINE> <INDENT> arr[i], arr[j] = arr[j], arr[i] <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return arr | Reference : https://en.wikipedia.org/wiki/Sorting_algorithm#Exchange_sort
Complexity : O(n^2) | 625941c860cbc95b062c65b1 |
def itkBinaryMask3DMeshSourceIUS3MD3Q_cast(*args): <NEW_LINE> <INDENT> return _itkBinaryMask3DMeshSourcePython.itkBinaryMask3DMeshSourceIUS3MD3Q_cast(*args) | itkBinaryMask3DMeshSourceIUS3MD3Q_cast(itkLightObject obj) -> itkBinaryMask3DMeshSourceIUS3MD3Q | 625941c83346ee7daa2b2dd9 |
def printMostDistinctive(s, file_name, inversion): <NEW_LINE> <INDENT> if len(s) < 10: <NEW_LINE> <INDENT> loops = len(s) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> loops = 10 <NEW_LINE> <DEDENT> print() <NEW_LINE> print("Ten most distinctive words in the file %s:" %(file_name)) <NEW_LINE> print() <NEW_LINE> print("... | Prints the ten most 'distinctive' words in a text.
Is called in distinctive(). | 625941c8dd821e528d63b218 |
def testShippingCentreInput(self): <NEW_LINE> <INDENT> pass | Test ShippingCentreInput | 625941c891af0d3eaac9ba86 |
def RedistributeConfig(r): <NEW_LINE> <INDENT> return r.request("put", "/2/redistribute-config") | Tells the cluster to redistribute its configuration files.
@return: job id | 625941c8283ffb24f3c55970 |
@silencio(log_level='WARNING') <NEW_LINE> @skipif_yask <NEW_LINE> @pytest.mark.parametrize('space_order', [4]) <NEW_LINE> @pytest.mark.parametrize('kernel', ['OT2']) <NEW_LINE> @pytest.mark.parametrize('shape', [(70, 80), (50, 50, 50)]) <NEW_LINE> def test_checkpointed_gradient_test(shape, kernel, space_order): <NEW_LI... | Run the gradient test but with checkpointing | 625941c8f9cc0f698b14066a |
def process_click(self): <NEW_LINE> <INDENT> if self.hover_child and self.hover_child.hover: <NEW_LINE> <INDENT> if self.hover_child.is_active: <NEW_LINE> <INDENT> self.hover_child.get_clicked() <NEW_LINE> return True <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> if self.open_menu: <NEW_LINE> <INDENT> self.clo... | Calls click on a children
Finds out if a child has hover and calls click on it. If not, closes all open menus.
Returns True if a click hit a menu object, False otherwise. | 625941c8be8e80087fb20cb2 |
def read_config(graph, config_filename): <NEW_LINE> <INDENT> import ConfigParser <NEW_LINE> if config_filename.endswith('.txt'): <NEW_LINE> <INDENT> default_filename = config_filename[:-4] + '.png' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> default_filename = config_filename + '.png' <NEW_LINE> <DEDENT> config = Con... | Initialize a MergeDot graph's input data from a config file. | 625941c8b57a9660fec338f2 |
@app.after_request <NEW_LINE> def add_headers(response): <NEW_LINE> <INDENT> if response.status_code == 200: <NEW_LINE> <INDENT> if flask.session: <NEW_LINE> <INDENT> response.headers["Cache-Control"] = "private" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if not response.headers.get("Cache-Control"): <NEW_LINE> <IND... | Generic rules for headers to add to all requests
- X-Hostname: Mention the name of the host/pod running the application
- Cache-Control: Add cache-control headers for public and private pages | 625941c8be383301e01b54f5 |
def test_trustRootOpenID1(self): <NEW_LINE> <INDENT> msg = Message(OPENID1_NS) <NEW_LINE> msg.setArg(OPENID_NS, 'mode', 'checkid_setup') <NEW_LINE> msg.setArg(OPENID_NS, 'trust_root', 'http://real_trust_root/') <NEW_LINE> msg.setArg(OPENID_NS, 'realm', 'http://fake_trust_root/') <NEW_LINE> msg.setArg(OPENID_NS, 'return... | Ignore openid.realm in OpenID 1 | 625941c824f1403a92600bd5 |
def delete_network(self, context, id): <NEW_LINE> <INDENT> LOG.debug(_("NECPluginV2.delete_network() called, id=%s ."), id) <NEW_LINE> net = super(NECPluginV2, self).get_network(context, id) <NEW_LINE> tenant_id = net['tenant_id'] <NEW_LINE> if self.packet_filter_enabled: <NEW_LINE> <INDENT> filters = dict(network_id=[... | Delete network and packet_filters associated with the network.
Delete network entry from DB and OFC. Then delete packet_filters
associated with the network. If the network is the last resource
of the tenant, delete unnessary ofc_tenant. | 625941c831939e2706e4ceda |
def _get_gamma1(lam: float, aux_g: float) -> float: <NEW_LINE> <INDENT> if lam > 0: <NEW_LINE> <INDENT> return (aux_g + np.log(lam)) / np.pi <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return (aux_g + np.log(-lam)) / np.pi + (2 * np.sin(lam) - lam) | Return result of first integral (Gamma_1 in my thesis).
Args:
lam: Non-dimensional x-position.
aux_g: Second result of `_get_aux_fg`. | 625941c84a966d76dd55107d |
def expandall(self): <NEW_LINE> <INDENT> _driver_ = self.__driver <NEW_LINE> treenodes = _driver_.find_elements_by_xpath("//span[contains(@class,'switch')][not(contains(@class,'docu'))]") <NEW_LINE> for i in range(0, len(treenodes)): <NEW_LINE> <INDENT> if "close" in treenodes[i].get_attribute("class"): <NEW_LINE> <IND... | 展开所有树节点
:return: | 625941c821bff66bcd6849c2 |
def p_numbers(p): <NEW_LINE> <INDENT> if len(p) == 2: <NEW_LINE> <INDENT> p[0] = [p[1]] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p[0] = p[1] + [p[3]] | numbers : numbers COMMA NUMBER
| NUMBER | 625941c88e7ae83300e4b03b |
def main(path,classfication,path2): <NEW_LINE> <INDENT> words=doc(path,classfication) <NEW_LINE> filted=filte(words,path2) <NEW_LINE> stat=static(filted) <NEW_LINE> cores=focus(stat) <NEW_LINE> print(cores) <NEW_LINE> ven0=vector(stat,filted) <NEW_LINE> for i in ven0.items(): <NEW_LINE> <INDENT> print(i) <NEW_LINE> <DE... | :param path: 字符串,文本分析的文件路径
:param classfication: 字符串,文字类别,english or chinese
:param path2: 字符串,停用词表路径
:return:none | 625941c88c0ade5d55d3ea28 |
def update(self, state, action, nextState, reward): <NEW_LINE> <INDENT> sample = reward + self.discount * self.computeValueFromQValues(nextState) <NEW_LINE> self.qValues[(state, action)] = (1 - self.alpha) * self.getQValue(state, action) + self.alpha * sample | The parent class calls this to observe a
state = action => nextState and reward transition.
You should do your Q-Value update here
NOTE: You should never call this function,
it will be called on your behalf | 625941c8d7e4931a7ee9df8c |
def finish(self): <NEW_LINE> <INDENT> if len(self._requests) == 0: <NEW_LINE> <INDENT> raise ValueError("No deferred requests") <NEW_LINE> <DEDENT> multi = MIMEMultipart() <NEW_LINE> for method, uri, headers, body in self._requests: <NEW_LINE> <INDENT> subrequest = MIMEApplicationHTTP(method, uri, headers, body) <NEW_L... | Submit a single `multipart/mixed` request w/ deferred requests.
:rtype: list of tuples
:returns: one ``(status, reason, payload)`` tuple per deferred request.
:raises: ValueError if no requests have been deferred. | 625941c80383005118ecf651 |
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, CreateFileOptions): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__ | Returns true if both objects are equal | 625941c8cad5886f8bd27048 |
def getProxiesContent(self, selDict, sortList, start=0, limit=0): <NEW_LINE> <INDENT> data = [] <NEW_LINE> sqlWhere = ["Pem is not NULL"] <NEW_LINE> for table, fields in [ ("ProxyDB_CleanProxies", ("UserName", "UserDN", "ExpirationTime")), ("ProxyDB_Proxies", ("UserName", "UserDN", "UserGroup", "ExpirationTime", "Persi... | Get the contents of the db, parameters are a filter to the db
:param dict selDict: selection dict that contain fields and their posible values
:param dict sortList: dict with sorting fields
:param int start: search limit start
:param int start: search limit amount
:return: S_OK(dict)/S_ERROR() -- dict contain fields,... | 625941c8be383301e01b54f6 |
def exchange_first_last(seq): <NEW_LINE> <INDENT> return seq[-1:] + seq[1:-1] + seq[0:1] | Return a copy of seq with the 1st and last items exchanged. | 625941c84f6381625f114aaa |
def timeCorrection(self): <NEW_LINE> <INDENT> return _DataModel.Arrival_timeCorrection(self) | timeCorrection(Arrival self) -> double | 625941c88c3a873295158428 |
def generate_binary_structure(rank, connectivity): <NEW_LINE> <INDENT> if connectivity < 1: <NEW_LINE> <INDENT> connectivity = 1 <NEW_LINE> <DEDENT> if rank < 1: <NEW_LINE> <INDENT> return numpy.array(True, dtype=bool) <NEW_LINE> <DEDENT> output = numpy.fabs(numpy.indices([3] * rank) - 1) <NEW_LINE> output = numpy.add.... | Generate a binary structure for binary morphological operations. | 625941c8442bda511e8be488 |
def multiple_replace(dict, text): <NEW_LINE> <INDENT> regex = re.compile("(%s)" % "|".join(map(re.escape, list(dict.keys())))) <NEW_LINE> return regex.sub(lambda mo: dict[mo.string[mo.start():mo.end()]], text) | Replace in 'text' all occurences of any key in the given
dictionary by its corresponding value. Returns the new string. | 625941c80c0af96317bb8257 |
def getWebsiteLists(): <NEW_LINE> <INDENT> interactions = [] <NEW_LINE> for file in glob.glob("*.csv"): <NEW_LINE> <INDENT> links = getLinks(file) <NEW_LINE> websites = [] <NEW_LINE> for link in links: <NEW_LINE> <INDENT> if link.startswith('http'): <NEW_LINE> <INDENT> website = getWebsite(link) <NEW_LINE> if website !... | Crawls the current directory to process csv files and turn them into graphs based on the urls and their interactions in each csv. | 625941c8004d5f362079a3a2 |
def update_generalisation(fabric: dict, domain: str, neuron_id: str, sub_graph: SubGraph, learn_rate: float, learn_edge_types: set) -> None: <NEW_LINE> <INDENT> fabric['domains'][domain]['neurons'][neuron_id]['generalisation'].learn(sub_graph=sub_graph, learn_rate=learn_rate, learn_edge_types=learn_edge_types, prune_th... | function updates the generalisation for a neuron
:param fabric: the fabric that contains the domain
:param domain: the domain that contains the neuron
:param neuron_id: the neuron id
:param sub_graph: the sub_graph to learn
:param learn_rate:
:param learn_edge_types:
:return: | 625941c8e8904600ed9f1f9b |
def getAlphaPb(T): <NEW_LINE> <INDENT> return (3.408 + 0.0112*(T + 273.15))*1e-6 | Thermal diffusivity of molten lead [m/s^2] at given temperature [C] | 625941c84527f215b584c4c6 |
def __ne__(self,other): <NEW_LINE> <INDENT> return not self == other | Difference test.
The function calls the ``__eq__`` test.
TESTS::
sage: from sage.sets.set_from_iterator import EnumeratedSetFromIterator
sage: E4 = EnumeratedSetFromIterator(graphs, args=(4,), category=FiniteEnumeratedSets())
sage: F4 = EnumeratedSetFromIterator(graphs, args=(4,), category=FiniteEnumerat... | 625941c8d58c6744b4257ccf |
def apnd(_list, _el): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _list.index(_el) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> _list.append(_el) <NEW_LINE> <DEDENT> return _list | Appends _el to the _list if it is not in this list.
Returns _list | 625941c8d53ae8145f87a2e0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.