code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def dbFilename(filename=None, suffix=None): <NEW_LINE> <INDENT> filename = filename or 'sickrage.db' <NEW_LINE> if suffix: <NEW_LINE> <INDENT> filename = filename + ".{}".format(suffix) <NEW_LINE> <DEDENT> return os.path.join(sickrage.DATA_DIR, filename) | @param filename: The sqlite database filename to use. If not specified,
will be made to be sickrage.db
@param suffix: The suffix to append to the filename. A '.' will be added
automatically, i.e. suffix='v0' will make dbfile.db.v0
@return: the correct location of the database file. | 625941ead8ef3951e32439fa |
def encode_labels(labels, labels_set): <NEW_LINE> <INDENT> encoded_labels = [] <NEW_LINE> for label in labels: <NEW_LINE> <INDENT> encoded_labels.append(labels_set.index(label)) <NEW_LINE> <DEDENT> return encoded_labels | Maps each label to a unique index.
:param labels: (list of strings) labels of every instance in the dataset
:param labels_set: (list of strings) set of labels that appear in the dataset
:return (list of int) encoded labels | 625941ea60cbc95b062c6a00 |
def test_grpform_no_wsc_done(dev): <NEW_LINE> <INDENT> addr0 = dev[0].p2p_dev_addr() <NEW_LINE> addr1 = dev[1].p2p_dev_addr() <NEW_LINE> for i in range(0, 2): <NEW_LINE> <INDENT> dev[0].request("SET ext_eapol_frame_io 1") <NEW_LINE> dev[1].request("SET ext_eapol_frame_io 1") <NEW_LINE> dev[0].p2p_listen() <NEW_LINE> de... | P2P group formation with WSC-Done not sent | 625941ead7e4931a7ee9e3db |
def set_runs_per_restart(self, num): <NEW_LINE> <INDENT> raise NotImplementedError() | Set the number of continuous runs between restarts | 625941ea8c3a87329515887d |
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'emotiondetection.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... | Run administrative tasks. | 625941ea5f7d997b87174f58 |
def speed_sound(h): <NEW_LINE> <INDENT> T = Temp(h) <NEW_LINE> return np.sqrt(1.4*T*R) | Calculate the speed of sound at a certain height in meter | 625941ea07d97122c4178d53 |
def savebool(doc, pnode, name, value): <NEW_LINE> <INDENT> if not value: return <NEW_LINE> ET.SubElement(pnode, name) | Possibly encode a bool value | 625941ea0a50d4780f667352 |
def get_weights(self): <NEW_LINE> <INDENT> return self.model.get_weights() | gets the current weights from the model
:return: list of numpy arrays | 625941ea8a349b6b435e862f |
def parse(directory, data, channels, image_size): <NEW_LINE> <INDENT> if not os.path.exists(directory): <NEW_LINE> <INDENT> os.makedirs(directory) <NEW_LINE> <DEDENT> warnings.filterwarnings("ignore") <NEW_LINE> regex = channel_regex(channels) <NEW_LINE> for label, data_directory in data.items(): <NEW_LINE> <INDENT> if... | Extracts single-channel .PNG images, cropped from .TIF files.
Extracted images are saved to the following directory structure:
directory/
class_label_0/
class_label_0_XX_YYYY_ZZ.png
class_label_0_XX_YYYY_ZZ.png
...
class_label_1/
class_label_1_XX_YYYY... | 625941eadc8b845886cb59f3 |
def filter(self, pathname): <NEW_LINE> <INDENT> for file_filter in self.filters: <NEW_LINE> <INDENT> if not file_filter.filter(pathname): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> return True | filter log file. | 625941ead6c5a1020814450b |
def setMarketCallBack(self, markets) : <NEW_LINE> <INDENT> self.proto.markets = markets | Define Callbacks on Market Events for websocket connections
:param markets: Array of market pairs to register to
:type markets: array of asset pairs
Example
.. code-block:: python
market = {"quote" : quote["id"],
"base" : base["id"],
"base_symbol" : base["symbol"],
"quo... | 625941ea8e71fb1e9831dc64 |
def consumer_deleted(self, id): <NEW_LINE> <INDENT> collection = Bind.get_collection() <NEW_LINE> agent_manager = factory.consumer_agent_manager() <NEW_LINE> for bind in self.find_by_consumer(id): <NEW_LINE> <INDENT> collection.remove(bind, safe=True) <NEW_LINE> repo_id = bind['repo_id'] <NEW_LINE> agent_manager.unbind... | Notification that a consumer has been deleted.
Associated binds are removed.
@param id: A consumer ID.
@type id: str | 625941ea596a897236089f76 |
def process_action_file(action_file): <NEW_LINE> <INDENT> global MIN_PAUSE_DURATION,MIN_PAUSE_DURATION2 <NEW_LINE> time_list = [] <NEW_LINE> pause_counts = Counter() <NEW_LINE> pause_counts2 = Counter() <NEW_LINE> pause_means = [] <NEW_LINE> pause_ratio = [] <NEW_LINE> pause_ratio2 = [] <NEW_LINE> event_counters = defa... | Args:
Returns:
Raises: | 625941eacdde0d52a9e534f3 |
def __init__(self): <NEW_LINE> <INDENT> FaceContainer.__init__(self) <NEW_LINE> self.status_check_life = asarray([]) | Initialize the class attributes. | 625941ea55399d3f05588b74 |
def new_in_list(my_list, idx, element): <NEW_LINE> <INDENT> new_list = my_list[:] <NEW_LINE> __len = len(my_list) <NEW_LINE> if idx > __len - 1 or __len < 0: <NEW_LINE> <INDENT> return new_list <NEW_LINE> <DEDENT> new_list[idx] = element <NEW_LINE> return new_list | Replaces element in a list at a specific
position without modifyiing original list | 625941ea63d6d428bbe449ad |
def get(self): <NEW_LINE> <INDENT> return PaymentController.payments() | Fetch donation form to load to users
in order to make payments. | 625941ea8da39b475bd65436 |
def mark_file(srcfile, DIFF_ADDS, DIFF_DELS): <NEW_LINE> <INDENT> LN = 0 <NEW_LINE> is_changed = False <NEW_LINE> curline = "" <NEW_LINE> out_buff = [] <NEW_LINE> eos_next = False <NEW_LINE> sect_wr = "" <NEW_LINE> sect_re = re.compile(r"^(--|---+|\+\+\++|\.\.\.+|\*\*\*+|___+|===+|///+)\s*$") <NEW_LINE> def write_chang... | Marks diffs in file, specified in srcfile.
Writes result using f_write (currently to STDOUT) | 625941eaad47b63b2c50a43b |
def serialize(self): <NEW_LINE> <INDENT> code = StringIO() <NEW_LINE> for inst in self.instructions: <NEW_LINE> <INDENT> inst.assembler_pass2(self, code.tell()) <NEW_LINE> code.write(inst.serialize()) <NEW_LINE> <DEDENT> for inst in self.jumps: <NEW_LINE> <INDENT> assert inst in self.instructions <NEW_LINE> code.seek(i... | Serialize this code to a string, and also
resolve any jump offsets. | 625941ea44b2445a3393254f |
def chebyshev(A, b1, x1, iterations=50, diag=None, diag_inv=None, c=None, d=None): <NEW_LINE> <INDENT> x = x1.flatten() <NEW_LINE> b = b1.flatten() <NEW_LINE> if diag_inv is None: <NEW_LINE> <INDENT> diag = np.diag(np.diag(A)) <NEW_LINE> diag_inv = np.linalg.inv(diag) <NEW_LINE> alpha = dominant_eigen(A) <NEW_LINE> bet... | Chebychev acceleration
This method uses chebyshev acceleration to smooth solution to Ax=b
:param A: The operator matrix in the Ax = b equation, as a numpy array
:param b1: The solution matrix in the Ax=b equation, as a numpy array
:param x1: The input matrix in the Ax=b equation, as a numpy array
:param diag: A with a... | 625941ea97e22403b379d458 |
def call_function(self, func, posargs, namedargs=None): <NEW_LINE> <INDENT> namedargs = namedargs or {} <NEW_LINE> frame = self.frame <NEW_LINE> if hasattr(func, 'im_func'): <NEW_LINE> <INDENT> if func.im_self: <NEW_LINE> <INDENT> posargs.insert(0, func.im_self) <NEW_LINE> <DEDENT> if not self.isinstance(posargs[0], fu... | Call a VM function with the given arguments and return the result.
This is were subclass override should occur as well.
Args:
func: The function to call.
posargs: The positional arguments.
namedargs: The keyword arguments (defaults to {}).
Returns:
The return value of the function. | 625941ea30c21e258bdfa95f |
def check_nrpe_plugin_client(internal_ip): <NEW_LINE> <INDENT> print("the output of running the check_nrpe plugin is: ") <NEW_LINE> os.system('/usr/lib64/nagios/plugins/check_nrpe -H' + internal_ip) | Checks the nrpe plugin on the client using the supplied internal IP | 625941eacc0a2c11143dd34e |
def __init__(self, code=None): <NEW_LINE> <INDENT> self.openapi_types = { 'code': str } <NEW_LINE> self.attribute_map = { 'code': 'code' } <NEW_LINE> self._code = code | InlineResponse404 - a model defined in OpenAPI
:param code: The code of this InlineResponse404. # noqa: E501
:type code: str | 625941ea76e4537e8c351b33 |
def get_item_location(item): <NEW_LINE> <INDENT> return item.location.version_agnostic().replace(branch=None) | Gets the version agnostic item location | 625941eacc0a2c11143dd34f |
def __init__(self, num_workers, num_nodes, results_addr, graph_addr, comm_addr, msg_addr, info_addr, export_addr, view_addr, prometheus_dir, hutch): <NEW_LINE> <INDENT> super().__init__(results_addr, hutch=hutch) <NEW_LINE> self.name = "manager" <NEW_LINE> self.num_workers = num_workers <NEW_LINE> self.num_nodes = num_... | protocol right now only tells you how to communicate with workers | 625941ea099cdd3c635f1115 |
def email_visitor(object, action): <NEW_LINE> <INDENT> email('postman/email_visitor_subject.txt', 'postman/email_visitor.txt', [object.email], object, action) | Email a visitor. | 625941ead10714528d6001a5 |
def ex_list_placement_groups(self, names=None): <NEW_LINE> <INDENT> names = names or [] <NEW_LINE> params = {'Action': 'DescribePlacementGroups'} <NEW_LINE> for index, name in enumerate(names): <NEW_LINE> <INDENT> params['GroupName.%s' % index + 1] = name <NEW_LINE> <DEDENT> response = self.connection.request(self.path... | A list of placement groups.
:param names: Placement Group names
:type names: ``list`` of ``str``
:rtype: ``list`` of :class:`.EC2PlacementGroup` | 625941ea4d74a7450ccd4682 |
def stats(self, line): <NEW_LINE> <INDENT> line = str(line, 'utf-8').split("|") <NEW_LINE> srcip = line[0] <NEW_LINE> dstip = line[1].replace(":*","") <NEW_LINE> signature = line[9] <NEW_LINE> result = self.check(srcip, dstip, signature) <NEW_LINE> self.parse_data(line, result) <NEW_LINE> self.count[result] += 1 <NEW_L... | Determines the type and parses the data
:param line: a line from the results file
:type line: bytes | 625941eaf548e778e58cda3c |
@app.route('/transfer', methods=['POST']) <NEW_LINE> def transfer_money(): <NEW_LINE> <INDENT> source_acc = request.get_json().get('source_account', None) <NEW_LINE> target_acc = request.get_json().get('target_account', None) <NEW_LINE> amount = request.get_json().get('amount', None) <NEW_LINE> service = ServiceFactory... | todo: FAZER VALIDACOES E ESCREVER TESTES UNITÁRIOS
:return: | 625941eabf627c535bc1368c |
def testExport(self): <NEW_LINE> <INDENT> labels = [1., 0., 0.2] <NEW_LINE> def _input_fn(num_epochs=None): <NEW_LINE> <INDENT> features = { 'age': tf.train.limit_epochs(tf.constant([[0.8], [0.15], [0.]]), num_epochs=num_epochs), 'language': tf.SparseTensor(values=['en', 'fr', 'zh'], indices=[[0, 0], [0, 1], [2, 0]], s... | Tests export model for servo. | 625941ea7b180e01f3dc4cb0 |
def find_family(self, sets_list, threshold=0.7, log=False): <NEW_LINE> <INDENT> sets_list.sort(reverse = True) <NEW_LINE> for item in sets_list: <NEW_LINE> <INDENT> text = "\nProcessing item: {}\n".format(item) <NEW_LINE> path, count = item[1], item[0] <NEW_LINE> if not self.base: <NEW_LINE> <INDENT> self.base = set(pa... | This method finds the base, family_members and family_count of the Family object.
It requires the following input variables:
- sets_list: a list of path sets in which each element is a tuple (c, p) where c is
the path count and p is the path set.
- threshold: float between 0 and 1. It is needed to calculate if a pat... | 625941eaa219f33f34628e1f |
def sum_square_diff_1(rang): <NEW_LINE> <INDENT> return sum(rang)**2 - sum([x**2 for x in rang]) | returns the diff between sum of squares and square of the sum | 625941eabd1bec0571d90aec |
def wrap_function(self, func): <NEW_LINE> <INDENT> if iscoroutinefunction(func): <NEW_LINE> <INDENT> @coroutine <NEW_LINE> def f(*args, **kwargs): <NEW_LINE> <INDENT> with self._count_ctxmgr(): <NEW_LINE> <INDENT> res = yield from func(*args, **kwargs) <NEW_LINE> return res <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> else: <... | Wrap a function to profile it.
| 625941ea1f037a2d8b9466ba |
def isSameTree(self, p, q): <NEW_LINE> <INDENT> ans_p, ans_q = [], [] <NEW_LINE> if p == q: <NEW_LINE> <INDENT> return (True) <NEW_LINE> <DEDENT> def traverse(node, answer): <NEW_LINE> <INDENT> answer.append(node.val if node else "null") <NEW_LINE> answer.append(traverse(node.left, answer) if node.left else "null") <NE... | :type p: TreeNode
:type q: TreeNode
:rtype: bool | 625941ea16aa5153ce362935 |
def initialize(cells, value): <NEW_LINE> <INDENT> if isinstance(value, Const): <NEW_LINE> <INDENT> cells[value] = value | Initialize lattice cells with constants | 625941ea5510c4643540f895 |
def get_transitive_dependencies(definitions_by_node: Definitions, node: Node) -> Nodes: <NEW_LINE> <INDENT> dependencies: Set = set() <NEW_LINE> pending_dependencies = set([node]) <NEW_LINE> while len(pending_dependencies) > 0: <NEW_LINE> <INDENT> dependencies.update(pending_dependencies) <NEW_LINE> new_pending_depende... | Get transitive dependencies of a node | 625941eab5575c28eb68e4c1 |
def delete_share_replica(self, replica_id, version=LATEST_MICROVERSION): <NEW_LINE> <INDENT> uri = "share-replicas/%s" % replica_id <NEW_LINE> headers, extra_headers = utils.get_extra_headers( version, constants.SHARE_REPLICA_GRADUATION_VERSION) <NEW_LINE> resp, body = self.delete(uri, headers=headers, extra_headers=ex... | Delete share_replica. | 625941ea99cbb53fe67930a2 |
def czzb(self,code=None): <NEW_LINE> <INDENT> if code is not None: <NEW_LINE> <INDENT> self.setcode(code) <NEW_LINE> <DEDENT> df=wd.get_cwfx_qq(self.__code,mtype='czzb') <NEW_LINE> df=df.dropna(how='all',axis=1) <NEW_LINE> return df | 偿债及资本结构
czzb:
cqbl: 产权比率(%)
czyzb: 长期债务与营运资金比率(%)
gdzcbl: 固定资产净值率(%)
gzjzl: 固定资产净值率(%
ldbl: 流动比率(%)
qsjzbl: 清算价值比率(%)
sdbl: 速动比率(%)
xjbl:现金比率(%)
zbgbbl: 资本固定化比率(%)
zbhbl: 资本化比率(%)
zcfzl: 资产负债率(%)
zzc:总资产(元) | 625941eacdde0d52a9e534f4 |
def parseCmdArgs(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description="%s selects a subset of Tor " "exit relays." % sys.argv[0]) <NEW_LINE> parser.add_argument("-b", "--badexit", action="store_true", help="Select bad exit relays.") <NEW_LINE> parser.add_argument("-c", "--countrycode", type=str, default=... | Parses and returns command line arguments. | 625941ea460517430c394635 |
def plot_matches_low_level(im1, im2, matches): <NEW_LINE> <INDENT> img1 = piio.read(im1).astype(np.uint8) <NEW_LINE> img2 = piio.read(im2).astype(np.uint8) <NEW_LINE> if img1.shape[2] > 3: <NEW_LINE> <INDENT> img1 = img1[:, :, 0:3] <NEW_LINE> <DEDENT> if img2.shape[2] > 3: <NEW_LINE> <INDENT> img2 = img2[:, :, 0:3] <NE... | Displays two images side by side with matches highlighted
Args:
im1, im2: paths to the two input images
matches: 2D numpy array of size 4xN containing a list of matches (a
list of pairs of points, each pair being represented by x1, y1, x2,
y2)
Returns:
path to the resulting image, to be di... | 625941eaa17c0f6771cbe50c |
def __init__(self, device, input_nc, output_nc, epsilon=.3, norm="Linf", ngf=64, norm_layer=nn.BatchNorm2d, use_dropout=False, n_blocks=6, padding_type='reflect'): <NEW_LINE> <INDENT> assert(n_blocks >= 0) <NEW_LINE> super(ResnetGenerator, self).__init__() <NEW_LINE> _st_sample = SampleST() <NEW_LINE> self.sample = lam... | Construct a Resnet-based generator
Parameters:
input_nc (int) -- the number of channels in input images
output_nc (int) -- the number of channels in output images
ngf (int) -- the number of filters in the last conv layer
norm_layer -- normalization layer
use_dropout (bool... | 625941ea293b9510aa2c374e |
def test_pairwise_distance_numpy_weighted(): <NEW_LINE> <INDENT> D = pairwise_proximity(W, metric='weighted_jaccard', min_support=10) <NEW_LINE> true = np.array([ [1., 0.6, 0.3, 0.1], [0.6, 1., 0., 0.], [0.3, 0., 1., 0.], [0.1, 0., 0., 1.]], dtype=float) <NEW_LINE> assert np.isclose(D, true).all() | Test pairwise distance: using Numpy (dense matrix) using weighted jaccard | 625941eaaad79263cf390f05 |
def make_start_dict(lexeme_values): <NEW_LINE> <INDENT> start_dict = dict() <NEW_LINE> for lexeme, value in lexeme_values: <NEW_LINE> <INDENT> cur_value = start_dict.setdefault(lexeme, set()) <NEW_LINE> if cur_value is None: <NEW_LINE> <INDENT> start_dict[lexeme] = cur_value = set() <NEW_LINE> <DEDENT> cur_value.add(va... | Return a dictionary of starting phrases of the lexemes.
If a character sequence occurs as the start of a lexical entry but not as
a lexical entry then it is in the dictionary with value None. If a character
sequence occurs as a lexical entry (regardless of whether it also occurs
at the start of another lexical entry) t... | 625941ea8a43f66fc4b5451d |
@view_config(route_name='delete') <NEW_LINE> def delete(request): <NEW_LINE> <INDENT> paste = Paste.get(request.matchdict['idContent']) <NEW_LINE> password = _buildPassword(paste.username, paste.created, request.POST['password']) <NEW_LINE> if password == paste.password: <NEW_LINE> <INDENT> paste.delete() <NEW_LINE> re... | Delete a paste.
return to / if succed
return to deleteConfigm is fail. | 625941ea956e5f7376d71329 |
def formatted_suffix(self) -> str: <NEW_LINE> <INDENT> return self._custom_format(self._suffix, self._suffix_replacement_fields) | Get the suffix after formatting using the suffix replacement field mapping. | 625941ea4e696a04525c990b |
def predict(self, X: pd.DataFrame) -> pd.DataFrame: <NEW_LINE> <INDENT> if self.dim == 1: <NEW_LINE> <INDENT> X_ = X[:, None] <NEW_LINE> X_0 = np.hstack([X_, np.reshape(np.array([0] * len(X)), (len(X), 1))]) <NEW_LINE> X_1 = np.hstack([X_, np.reshape(np.array([1] * len(X)), (len(X), 1))]) <NEW_LINE> noise_dict_0 = {"ou... | Infers the treatment effect for a certain set of input covariates.
Returns the predicted ITE and posterior variance.
:X: The input covariates at which the outcomes need to be predicted | 625941eaf7d966606f6aa4c7 |
def generateAPIRootBody(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.gerrymanderNodeFilenames() <NEW_LINE> self.generateViewHierarchies() <NEW_LINE> self.generateUnabridgedAPI() <NEW_LINE> with open(self.full_root_file_path, "a") as generated_index: <NEW_LINE> <INDENT> generated_index.write( ".. include:: {... | Generates the root library api file's body text. The method calls
:func:`exhale.ExhaleRoot.gerrymanderNodeFilenames` first to enable proper
internal linkage between reStructuredText documents. Afterward, it calls
:func:`exhale.ExhaleRoot.generateViewHierarchies` followed by
:func:`exhale.ExhaleRoot.generateUnabridged... | 625941ea4f88993c3716c520 |
def popup(self): <NEW_LINE> <INDENT> value = ' - '.join([obj.type for obj in self.overlapping_sprites]) <NEW_LINE> if self.popup_class: <NEW_LINE> <INDENT> games.screen.add(self.popup_class(value=value, size=20, color=color.blue, x=self.x, y=self.y - 40)) | Создает всплывающий текст | 625941eaac7a0e7691ed4580 |
def pipe(self, command, timeout=None, cwd=None): <NEW_LINE> <INDENT> if not timeout: <NEW_LINE> <INDENT> timeout = self.timeout <NEW_LINE> <DEDENT> if not self.was_run: <NEW_LINE> <INDENT> self.run(block=False, cwd=cwd) <NEW_LINE> <DEDENT> data = self.out <NEW_LINE> if timeout: <NEW_LINE> <INDENT> c = Command(command, ... | Runs the current command and passes its output to the next
given process. | 625941eafbf16365ca6f668c |
def _deselect(self, index=None): <NEW_LINE> <INDENT> plot = self.component <NEW_LINE> for name in ('index', 'value'): <NEW_LINE> <INDENT> if not hasattr(plot, name): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> md = getattr(plot, name).metadata <NEW_LINE> if not self.selection_metadata_name in md: <NEW_LINE> <INDEN... | Deselects a particular index. If no index is given, then
deselects all points. | 625941ea5166f23b2e1a5616 |
def ProjectEuler37(): <NEW_LINE> <INDENT> count =2 <NEW_LINE> numbers=[37,73, 23, 53] <NEW_LINE> MaxDigits = 10 <NEW_LINE> TotalNo = 11 <NEW_LINE> for d in range(3,MaxDigits+1): <NEW_LINE> <INDENT> for n in ListOfCandiates(d): <NEW_LINE> <INDENT> if( all(prime.isprime(i) for i in ListOfTruncatble(n,d))): <NEW_LINE> <IN... | The number 3797 has an interesting property. Being prime itself,
it is possible to continuously remove digits from left to right,
and remain prime at each stage: 3797, 797, 97, and 7.
Similarly we can work from right to left: 3797, 379, 37, and 3.
Find the sum of the only eleven primes that are both truncatable from... | 625941eaeab8aa0e5d26e017 |
def test_password_is_nullable(self, db): <NEW_LINE> <INDENT> user = User(username='foo', email='foo@bar.com') <NEW_LINE> db.session.add(user) <NEW_LINE> db.session.commit() <NEW_LINE> assert user.password is None | Test null password. | 625941ea8c0ade5d55d3ee7c |
def summary(self): <NEW_LINE> <INDENT> import allocbench.plots as plt <NEW_LINE> plt.plot(self, "{throughput}/1000000", fig_options={ 'ylabel': "MOPS/s", 'title': "Larson: {fixed_part_str}", }, file_postfix="throughput") <NEW_LINE> plt.plot(self, "({L1-dcache-load-misses}/{L1-dcache-loads})*100", fig_options={ 'ylabel'... | Create plots showing throughput and L1 data chache miss rate | 625941eaaad79263cf390f06 |
def user_data(self, access_token, *args, **kwargs): <NEW_LINE> <INDENT> return self.get_json( 'https://api.dribbble.com/v1/user', headers={ 'Authorization': 'Bearer {0}'.format(access_token) }) | Loads user data from service | 625941eade87d2750b860255 |
def putOutgoing(self, name, type, value): <NEW_LINE> <INDENT> with self.entry_lock: <NEW_LINE> <INDENT> tableEntry = self.namedEntries.get(name) <NEW_LINE> if tableEntry is None: <NEW_LINE> <INDENT> if hasattr(type, 'internalizeValue'): <NEW_LINE> <INDENT> value = type.internalizeValue(name, value, None) <NEW_LINE> <DE... | Stores the given value under the given name and queues it for
transmission to the remote end.
:param name: The name under which to store the given value.
:param type: The type of the given value.
:param value: The value to store.
If the type is different than that which is stored, it will be
changed. | 625941ea5e10d32532c5f3e2 |
def points(self, B=0): <NEW_LINE> <INDENT> from sage.schemes.projective.projective_rational_point import enum_projective_rational_field <NEW_LINE> from sage.schemes.projective.projective_rational_point import enum_projective_finite_field <NEW_LINE> R = self.value_ring() <NEW_LINE> if is_RationalField(R): <NEW_LINE> <IN... | Return some or all rational points of a projective scheme.
INPUT:
- `B` -- integer (optional, default=0). The bound for the
coordinates.
OUTPUT:
A list of points. Over a finite field, all points are
returned. Over an infinite field, all points satisfying the
bound are returned.
EXAMPLES::
sage: P1 = Project... | 625941eaa8370b7717052d5b |
def setEditorData(self, editor, index): <NEW_LINE> <INDENT> simulation = index.model().sourceModel().simulation <NEW_LINE> serviceCode = index.model().data(index, Qt.EditRole) <NEW_LINE> startSearchIndex = simulation.servicesModel.index(0, 0) <NEW_LINE> serviceIndexes = simulation.servicesModel.match( startSearchIndex,... | Sets the values from the model in the combo box | 625941eaab23a570cc250644 |
def initialize_many(drivers, register_finalizer=True, on_initializing=None, on_initialized=None, on_exception=None, concurrent=False, dependencies=None): <NEW_LINE> <INDENT> if dependencies: <NEW_LINE> <INDENT> names = {driver.name: driver for driver in drivers} <NEW_LINE> groups = helpers.solve_dependencies(dependenci... | Initialize a group of drivers.
Parameters
----------
drivers :
an iterable of drivers.
register_finalizer :
register driver.finalize method to be called at python exit. (Default value = True)
on_initializing :
a callable to be executed BEFORE initialization.
It takes the driver as the first argument. (... | 625941eadd821e528d63b663 |
def get_ice_number(self, person_id): <NEW_LINE> <INDENT> self.pe.clear() <NEW_LINE> self.pe.find(person_id) <NEW_LINE> intern_ice_num = self._get_ice_number_by_source_system( self.co.system_intern_ice) <NEW_LINE> if intern_ice_num: <NEW_LINE> <INDENT> return intern_ice_num <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ... | Gets ICE number from Cerebrum's database for the given person and
returns it.
If person has ICE number from both system_intern_ice and
system_kr_reg, the one from system_intern_ice is returned.
:param int person_id: The person's entity_id in Cerebrum
:return: Person's ICE number from BAS, or None if no ICE number is
f... | 625941ea97e22403b379d459 |
def fix(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if not self.ci.getcurrvalue(): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.iditerator = 0 <NEW_LINE> eventlist = self.statechglogger.findrulechanges(self.rulenumber) <NEW_LINE> for event in eventlist: <NEW_LINE> <INDENT> self.statechglogger.deleteentry... | Make config changes to securetty file (or sshd_config if solaris)
to ensure that root can only log in via local console
@author: bemalmbe
@change: dwalker - implemented previous even deletion, more in depth
file checking for appropriate contents along with writing any fixes
to the file using methods found in s... | 625941ea1d351010ab855fd8 |
def traverseYield(self, thead_tr, tbody_class): <NEW_LINE> <INDENT> for tr in tbody_class: <NEW_LINE> <INDENT> tbody_tr = {} <NEW_LINE> thead_length = len(thead_tr) <NEW_LINE> for tr_len in range(thead_length): <NEW_LINE> <INDENT> tr_td = tr.find_all('td') <NEW_LINE> if tr_len == thead_length - 1: <NEW_LINE> <INDENT> t... | 页面操作按钮的统计,每个页面的都不一样需要单独尽心编写
:param thead_tr: 页面内容标题
:param tbody_class: 页面内容展示项
:return: | 625941eaf9cc0f698b140ab5 |
def equivalent(self, other: QueryResult) -> bool: <NEW_LINE> <INDENT> if self._level == other._level: <NEW_LINE> <INDENT> return self == other <NEW_LINE> <DEDENT> if self._level < other._level: <NEW_LINE> <INDENT> low, high = self, other <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> high, low = self, other <NEW_LINE> <... | Slightly looser equality testing allows different levels
Provided the lower level QueryResult has sub-counts that match the
higher level one, they are considered equivalent | 625941eabaa26c4b54cb15d8 |
def write(embeds, fname, format=Format.Word2Vec, **kwargs): <NEW_LINE> <INDENT> if format == Format.Word2Vec: <NEW_LINE> <INDENT> word2vec.write(embeds, fname, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return NotImplemented | Writes a dictionary of embeddings { term : embed}
to a file, in the format specified. | 625941ea7d43ff24873a3161 |
def draw_data_set(self): <NEW_LINE> <INDENT> import OpenGL.GL as gl <NEW_LINE> for i in range(1, 9): <NEW_LINE> <INDENT> gl.glCallList(self.gllist_id + i) | Draws the N-D data set in the scene. | 625941ea6e29344779a62ace |
def __init__(self, action: Action): <NEW_LINE> <INDENT> PgNode.__init__(self) <NEW_LINE> self.action = action <NEW_LINE> self.prenodes = self.precond_s_nodes() <NEW_LINE> self.effnodes = self.effect_s_nodes() <NEW_LINE> self.is_persistent = False <NEW_LINE> if self.prenodes == self.effnodes: <NEW_LINE> <INDENT> self.is... | A-level Planning Graph node constructor
:param action: Action
a ground action, i.e. this action cannot contain any variables
Instance variables calculated:
An A-level will always have an S-level as its parent and an S-level as its child.
The preconditions and effects will become the parents and child... | 625941eabde94217f36832aa |
def get_web_page(url="http://www.dota2.com/heroes/", lang=""): <NEW_LINE> <INDENT> global _cached_language, _cached_bs_page <NEW_LINE> if (lang != "" and _cached_language != lang) or _cached_bs_page is None: <NEW_LINE> <INDENT> raw = requests.get(url + "?l=" + lang).text <NEW_LINE> _cached_bs_page = BeautifulSoup(raw) ... | Read the hero list from the official site, and return a BeautifulSoup object. | 625941ea377c676e91272664 |
def retrieve_customer(self, callback, **params): <NEW_LINE> <INDENT> self._require(params, ['id']) <NEW_LINE> return self._call(callback, 'retrieve_customer', params) | Retrieve billing info for the given customer. Used for recurring billing. | 625941ea090684286d50f1ab |
def get_max_count(self): <NEW_LINE> <INDENT> return settings.PASSWORD_MAX_CONSECUTIVE | :returns: :py:attr:`password_policies.conf.Settings.PASSWORD_MAX_CONSECUTIVE` | 625941ea462c4b4f79d1db8d |
def regression_loss(pred_boxes, gt_boxes, weights=1.0): <NEW_LINE> <INDENT> loss = tf.losses.huber_loss(predictions=pred_boxes, labels=gt_boxes, weights=weights, scope='box_loss') <NEW_LINE> return loss | Regression loss (Smooth L1 loss: also known as huber loss)
Args:
pred_boxes: [# anchors, 4]
gt_boxes: [# anchors, 4]
weights: Tensor of weights multiplied by loss with shape [# anchors] | 625941ea9c8ee82313fbbc35 |
def _transfer_log(self, log: Dict[str, Any]) -> bool: <NEW_LINE> <INDENT> project_id = self._project_manager.project.id <NEW_LINE> node_id = self._node_manager.node.id <NEW_LINE> try: <NEW_LINE> <INDENT> self.logger.info(f'Sending log message from module "{log.get("module")}" ' f'to API "{self._url}" ...') <NEW_LINE> d... | Sends a log message to a defined remote OpenADMS Server instance.
Args:
log: The log message dictionary.
Returns:
True on successful transmission, False on error. | 625941ea3539df3088e2e809 |
def _test_component_failed(component_type): <NEW_LINE> <INDENT> num_local_schedulers = 4 <NEW_LINE> num_workers_per_scheduler = 8 <NEW_LINE> ray.worker._init( num_local_schedulers=num_local_schedulers, start_ray_local=True, num_cpus=[num_workers_per_scheduler] * num_local_schedulers, redirect_output=True) <NEW_LINE> @r... | Kill a component on all worker nodes and check workload succeeds. | 625941ea656771135c3ebd32 |
def wait_on_thread(self, deferred, timeout=10): <NEW_LINE> <INDENT> start_time = time.time() <NEW_LINE> while not deferred.called: <NEW_LINE> <INDENT> if start_time + timeout < time.time(): <NEW_LINE> <INDENT> raise ValueError("Timed out waiting for threadpool") <NEW_LINE> <DEDENT> self.reactor.advance(0.01) <NEW_LINE>... | Wait until a Deferred is done, where it's waiting on a real thread. | 625941eacc40096d61595e0c |
def initializeFiles(): <NEW_LINE> <INDENT> domain = 'https://www.fhfa.gov' <NEW_LINE> extension = '/DataTools/Downloads/Pages/FHLBank-Public-Use-Database-Previous-Years.aspx' <NEW_LINE> url = domain + extension <NEW_LINE> if not os.path.exists(os.path.join(os.path.dirname(os.path.dirname(__file__)) ,'data','input')): <... | Initialize the files to be analyzed in the input folder. This function
will scrape the fhfa website to get the available loan data information | 625941eaadb09d7d5db6cc4a |
def daysrange(first=None, second=None, wipe=False): <NEW_LINE> <INDENT> _first, _second = parse(first), parse(second) <NEW_LINE> (_start, _end) = (_second, _first) if _first > _second else (_first, _second) <NEW_LINE> days_between = (_end - _start).days <NEW_LINE> date_list = [_end - datetime.timedelta(days=x) for x in... | get all days between first and second
:param first: datetime, date or string
:param second: datetime, date or string
:return: list | 625941ea7cff6e4e81117e43 |
def test_User(self): <NEW_LINE> <INDENT> my_user = User() <NEW_LINE> my_user.first_name = 'Holberton' <NEW_LINE> my_user.last_name = 'School' <NEW_LINE> my_user.email = '2020@holbertonschool.com' <NEW_LINE> self.assertEqual(my_user.first_name, 'Holberton') <NEW_LINE> self.assertEqual(my_user.last_name, 'School') <NEW_L... | Test attributes of Class Use | 625941ea187af65679ca55de |
def __iter__(self): <NEW_LINE> <INDENT> return iter((l,v) for k,v in self.child.items() for l in k) | Returns an expanded representation of the set structure. | 625941eaac7a0e7691ed4581 |
def get_url(self, urlname): <NEW_LINE> <INDENT> kwargs = self.comment_object.detail_url_kwargs <NEW_LINE> kwargs.update({"comment_uuid": self.uuid}) <NEW_LINE> return reverse_lazy( self.comment_object.object_url_namespace + ":comment:" + urlname, kwargs=kwargs, ) | This method resolves the requested urlname of the Comment object | 625941ea56b00c62f0f14b1a |
def __init__(self, force_fresh=False, force_stale=False): <NEW_LINE> <INDENT> self.force_fresh = force_fresh <NEW_LINE> self.force_stale = force_stale | Initialize API class
:param force_fresh,force_stale: if either of these is set to True the
data must either loaded from server or from local data. Be default
fresh data is prefered, but falls back to local data. | 625941ea1b99ca400220af71 |
def getData(self): <NEW_LINE> <INDENT> if self.numberButton.isChecked(): <NEW_LINE> <INDENT> rev = "rev({0})".format(self.numberSpinBox.value()) <NEW_LINE> <DEDENT> elif self.idButton.isChecked(): <NEW_LINE> <INDENT> rev = "id({0})".format(self.idEdit.text()) <NEW_LINE> <DEDENT> elif self.tagButton.isChecked(): <NEW_LI... | Public method to retrieve the entered data.
@return tuple giving the revision, a flag indicating not to commit
the signature, a commit message, an ID of the key to be used,
a flag indicating a local signature and a flag indicating a forced
signature (string, boolean, string, string, boolean, boolean) | 625941eaa934411ee3751b53 |
def _seek_country(self, ipnum): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> offset = 0 <NEW_LINE> seek_depth = 127 if len(str(ipnum)) > 10 else 31 <NEW_LINE> for depth in range(seek_depth, -1, -1): <NEW_LINE> <INDENT> if self._flags & MEMORY_CACHE: <NEW_LINE> <INDENT> startIndex = 2 * self._recordLength * offset <NEW_... | Using the record length and appropriate start points, seek to the
country that corresponds to the converted IP address integer.
Return offset of record.
:arg ipnum: Result of ip2long conversion | 625941eafff4ab517eb2f8fd |
def start(e): <NEW_LINE> <INDENT> def exit_program(s, f): <NEW_LINE> <INDENT> signal.signal(signal.SIGTERM, signal.SIG_IGN) <NEW_LINE> signal.signal(signal.SIGINT, signal.SIG_IGN) <NEW_LINE> e.quit() <NEW_LINE> <DEDENT> signal.signal(signal.SIGTERM, exit_program) <NEW_LINE> signal.signal(signal.SIGINT, exit_program) <N... | Run an exectutable class. This provides a way to make sure that a class is
properly closed on SIGINT and SIGTERM.
Note: This function should only be called from the main thread. | 625941eac4546d3d9de72ef6 |
def trajectory_set_item(self, idx, value): <NEW_LINE> <INDENT> import mdtraj <NEW_LINE> assert isinstance(self, mdtraj.Trajectory), type(self) <NEW_LINE> if not isinstance(value, mdtraj.Trajectory): <NEW_LINE> <INDENT> raise TypeError("value to assign is of incorrect type(%s). Should be mdtraj.Trajectory" % type(value)... | :param self: mdtraj.Trajectory
:param idx: possible slices over frames,
:param value:
:return: | 625941ea29b78933be1e5b64 |
def stop(self): <NEW_LINE> <INDENT> self.state = False <NEW_LINE> with display_manager(self.display) as d: <NEW_LINE> <INDENT> d.record_disable_context(self.ctx) <NEW_LINE> d.ungrab_keyboard(X.CurrentTime) <NEW_LINE> <DEDENT> with display_manager(self.display2): <NEW_LINE> <INDENT> d.record_disable_context(self.ctx) <N... | Stop listening for keyboard input events. | 625941eae1aae11d1e74a17a |
def _send_request(self, path, data): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> response = self.connector.post(path=path, json=data) <NEW_LINE> if response.status_code == codes.ok: <NEW_LINE> <INDENT> server_response = json.loads(jws.get_unverified_claims(response.json()['token'])) <NEW_LINE> return self._check_for_e... | Sends request to the FURS Server and decodes response.
:param path: (string) Server path
:param data: (dict) Data to be sent
:return: (dict) Received response
:raises:
ConnectionTimedOutException: If connection timed out
ConnectionException: If FURS responded with status code different than 200
FURSExcept... | 625941ea01c39578d7e752f9 |
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, ApplicationApiHealth): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.to_dict() == other.to_dict() | Returns true if both objects are equal | 625941eafb3f5b602dac3b56 |
def stop(self): <NEW_LINE> <INDENT> raise exceptions.ProtocolError("Sounder classes must redefine stop()") | Clear any currently playing sound | 625941eabe383301e01b593a |
def _deserialize(self, data): <NEW_LINE> <INDENT> if data[0] == 'None': <NEW_LINE> <INDENT> data.pop(0) <NEW_LINE> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> cur = data.pop(0) <NEW_LINE> root = _TreeNode(None) <NEW_LINE> val, label, split = cur.split('|') <NEW_LINE> root.val = int(val) <NEW_LINE> root.la... | 反序列化二叉树 | 625941ea38b623060ff0b2ab |
def stop( self, resource_group_name, factory_name, integration_runtime_name, custom_headers=None, raw=False, **operation_config): <NEW_LINE> <INDENT> raw_result = self._stop_initial( resource_group_name=resource_group_name, factory_name=factory_name, integration_runtime_name=integration_runtime_name, custom_headers=cus... | Stops a ManagedReserved type integration runtime.
:param resource_group_name: The resource group name.
:type resource_group_name: str
:param factory_name: The factory name.
:type factory_name: str
:param integration_runtime_name: The integration runtime name.
:type integration_runtime_name: str
:param dict custom_head... | 625941ea0c0af96317bb86a6 |
def is_series(data): <NEW_LINE> <INDENT> dd = None <NEW_LINE> if 'dask.dataframe' in sys.modules: <NEW_LINE> <INDENT> import dask.dataframe as dd <NEW_LINE> <DEDENT> return((pd is not None and isinstance(data, pd.Series)) or (dd is not None and isinstance(data, dd.Series))) | Checks whether the supplied data is of Series type. | 625941ead268445f265b532d |
def fizz_buzz_game(number): <NEW_LINE> <INDENT> if type(number) != int: <NEW_LINE> <INDENT> return "Invalid data type" <NEW_LINE> <DEDENT> if is_divisible(number, 3) and is_divisible(number, 5): <NEW_LINE> <INDENT> return 'FizzBuzz' <NEW_LINE> <DEDENT> if is_divisible(number, 3): <NEW_LINE> <INDENT> return 'Fizz' <NEW_... | If number is divisible by 3 return 'Fizz', if divisible by 5 return 'Buzz' and if divisible by 3 and 5 return
'FizzBuzz'. In any other situation return number
Args:
number: int number
Returns: A word if number is divisible by 3, 5 or both; number otherwise | 625941ea1f5feb6acb0c5007 |
def output(self, text, command='', relevant=False): <NEW_LINE> <INDENT> if not self.quiet: <NEW_LINE> <INDENT> if relevant and type(text) != str: <NEW_LINE> <INDENT> self.recursive_print(self.format_print(text, command, relevant)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print(self.format_print(text, command, rele... | Outputs text with whatever formatting chars we need,
Writes text to file if necessary.
:param text: Text to output
:param command: Command issued when text was generated
:param relevant: Value determining if we are working with relevant text(Response from server)
:return: | 625941ea236d856c2ad44c9f |
def parse_config(config_path): <NEW_LINE> <INDENT> config_data = sorted([line.strip() for line in path(config_path).lines() if line.strip() and not line.startswith('#')]) <NEW_LINE> config_cleaned_data = [] <NEW_LINE> for d in config_data: <NEW_LINE> <INDENT> if '=' in d: <NEW_LINE> <INDENT> split_position = d.index('=... | Return a nested dictionary containing configuration from an
Arduino-formatted configuration file _(e.g., `platform.txt`,
`boards.txt`)_. | 625941ea67a9b606de4a8375 |
def generata_random_title(): <NEW_LINE> <INDENT> random_str='' <NEW_LINE> base_str='ABCDEFGHIGKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz0123456789' <NEW_LINE> length=len(base_str)-1 <NEW_LINE> for i in range(4): <NEW_LINE> <INDENT> random_str +=base_str[random.randint(0,length)] <NEW_LINE> <DEDENT> title="自动化课程%s"%rand... | 生成指定长度的随机字符串 | 625941ea6fb2d068a760f563 |
def get_test_case_resid(test_case): <NEW_LINE> <INDENT> return get_resource_identity("testcase", "/api/v1/testcases?name=" + urllib.quote(test_case)) | Get the resourceIdentity of a role, based on the description of the role | 625941ea097d151d1a223315 |
def bar_format_json(self, objects, graph_title): <NEW_LINE> <INDENT> bar_json = { 'title': graph_title, 'values': self.get_object_values(objects) } <NEW_LINE> return json.dumps(bar_json) | Convert the given set of user objects to the
correct format for trend graphs | 625941ea66673b3332b9254f |
def cover_main(): <NEW_LINE> <INDENT> import coverage <NEW_LINE> cov = coverage.coverage(branch=True, source=['pyvmd']) <NEW_LINE> cov.start() <NEW_LINE> unit = unittest.main(exit=False) <NEW_LINE> cov.stop() <NEW_LINE> cov.save() <NEW_LINE> if not hasattr(unit, 'result'): <NEW_LINE> <INDENT> sys.exit(2) <NEW_LINE> <DE... | Run tests with coverage. | 625941eaa8ecb033257d3589 |
def get_path_info(self, filtered_relation=None): <NEW_LINE> <INDENT> opts = self.remote_field.model._meta <NEW_LINE> from_opts = self.model._meta <NEW_LINE> return [PathInfo( from_opts=from_opts, to_opts=opts, target_fields=self.foreign_related_fields, join_field=self, m2m=False, direct=True, filtered_relation=filtered... | Get path from this field to the related model. | 625941ead7e4931a7ee9e3dd |
def _updateMaskedValueSet(): <NEW_LINE> <INDENT> global masked_value_set <NEW_LINE> for confName in controller.CONF: <NEW_LINE> <INDENT> if (controller.getParamKeyValue(confName, "MASK_INPUT") is True): <NEW_LINE> <INDENT> masked_value_set.add(controller.CONF[confName]) | For every param in conf
has MASK_INPUT enabled keep the user input
in the 'masked_value_set' | 625941eae8904600ed9f23f3 |
def queue_size(self) -> int: <NEW_LINE> <INDENT> return self.r.llen(QUEUE_KEY) | Returns the number of transactions in the queue
:return: An integer specifying the number of transactions in the queue | 625941eade87d2750b860256 |
def __le__(self, other): <NEW_LINE> <INDENT> return self.__size <= other.__size | equal comparison. | 625941eabaa26c4b54cb15d9 |
@commandWrap <NEW_LINE> def CreatePondOptions(*args, **kwargs): <NEW_LINE> <INDENT> return cmds.CreatePondOptions(*args, **kwargs) | :rtype: list|str|DagNode|AttrObject|ArrayAttrObject|Components1Base | 625941eaab23a570cc250645 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.