code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def __init__(self, set_level="info", name=os.path.split(os.path.splitext(sys.argv[0])[0])[-1], log_name=time.strftime("Hgo" + "%Y-%m-%d.log", time.localtime()), log_path=os.path.join(os.path.dirname(os.path.abspath(__file__)), "log"), use_console=True): <NEW_LINE> <INDENT> self.logger = logging.getLogger(name) <NEW_LIN... | set_level: 设置日志的打印级别,默认为DEBUG
name: 日志中将会打印的name,默认为运行程序的name
log_name: 日志文件的名字,默认为当前时间(年-月-日.log)
log_path: 日志文件夹的路径,默认为logger.py同级目录中的log文件夹
use_console: 是否在控制台打印,默认为True | 625941db29b78933be1e5987 |
def signed_ori_distance(ori1, ori2): <NEW_LINE> <INDENT> ori_dist = ori2 - ori1 <NEW_LINE> ori_dist = (ori_dist + np.pi) % TAU - np.pi <NEW_LINE> return ori_dist | Args:
ori1 (ndarray):
ori2 (ndarray):
Returns:
ndarray: ori_dist
CommandLine:
python -m vtool_ibeis.distance --exec-signed_ori_distance
Example:
>>> # ENABLE_DOCTEST
>>> from vtool_ibeis.distance import * # NOQA
>>> ori1 = np.array([0, 0, 3, 4, 0, 0])
>>> ori2 = np.array([3, 4, 0, ... | 625941db5166f23b2e1a5439 |
def read_book(): <NEW_LINE> <INDENT> for entry in BOOK_OF_LIFE: <NEW_LINE> <INDENT> print(entry) | Reads BOOK_OF_LIFE in a user friendly manner. | 625941db82261d6c526ab783 |
def load(self, abs_p, time, gas, rate, data): <NEW_LINE> <INDENT> n2_loader, he_loader = self._tissue_loaders(abs_p, gas, rate) <NEW_LINE> tp = tuple( (n2_loader(time, p_n2, i), he_loader(time, p_he, i)) for i, (p_n2, p_he) in enumerate(data.tissues) ) <NEW_LINE> return Data(tp, data.gf) | Calculate gas loading for all tissue compartments.
The method returns decompression data model information.
:param abs_p: Absolute pressure [bar] (current depth).
:param time: Time of exposure [min] (i.e. time of ascent).
:param gas: Gas mix configuration.
:param rate: Pressure rate change [bar/min].
:param d... | 625941db9b70327d1c4e10b6 |
def Hypergeometric(name, N, m, n): <NEW_LINE> <INDENT> return HypergeometricPSpace(name, N, m, n).value | Create a Finite Random Variable representing a hypergeometric distribution.
Returns a RandomSymbol.
Examples
========
>>> from sympy.stats import Hypergeometric, density
>>> from sympy import S
>>> X = Hypergeometric('X', 10, 5, 3) # 10 marbles, 5 white (success), 3 draws
>>> density(X)
{0: 1/12, 1: 5/12, 2: 5/12, ... | 625941dbd7e4931a7ee9e1fe |
def __init__(self, config=None, layers=None): <NEW_LINE> <INDENT> super(Prototype, self).__init__(config=config) <NEW_LINE> if layers is None: <NEW_LINE> <INDENT> self.models = [] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> layers = raise_to_list(layers) <NEW_LINE> self.models = layers | During initialization, use the optional config provided to pre-set up the model. This is used
for repeatable experiments.
:param config: a configuration defining the multiple models/configurations for this container to have.
:type config: a dictionary-like object or filename to JSON/YAML file. | 625941db3317a56b86939f32 |
def interp_w_v1(self): <NEW_LINE> <INDENT> con = self.parameters.control.fastaccess <NEW_LINE> new = self.sequences.states.fastaccess_new <NEW_LINE> for jdx in range(1, con.n): <NEW_LINE> <INDENT> if con.v[jdx] >= new.v: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> new.w = ((new.v-con.v[jdx-1]) * (con.w[jdx]-... | Calculate the actual water stage based on linear interpolation.
Required control parameters:
:class:`~hydpy.models.llake.llake_control.N`
:class:`~hydpy.models.llake.llake_control.V`
:class:`~hydpy.models.llake.llake_control.W`
Required state sequence:
:class:`~hydpy.models.llake.llake_states.V`
Calculated s... | 625941db8e05c05ec3eea657 |
def get_needed_fieldnames(arr, names): <NEW_LINE> <INDENT> fieldnames = set([]) <NEW_LINE> cls = arr.__class__ <NEW_LINE> if isinstance(names, string_types): <NEW_LINE> <INDENT> names = [names] <NEW_LINE> <DEDENT> parsed_names = set([]) <NEW_LINE> for name in names: <NEW_LINE> <INDENT> parsed_names.update(get_fields_fr... | Given a FieldArray-like array and a list of names, determines what
fields are needed from the array so that using the names does not result
in an error.
Parameters
----------
arr : instance of a FieldArray or similar
The array from which to determine what fields to get.
names : (list of) strings
A list of the ... | 625941db30dc7b7665901c44 |
def enable(self, enable=True): <NEW_LINE> <INDENT> llogger = local_logger.LocalLogger() <NEW_LINE> llogger.log_method_call(self.__class__.__name__, sys._getframe().f_code.co_name) <NEW_LINE> if enable is False: <NEW_LINE> <INDENT> self.enabled = False <NEW_LINE> llogger.debug("The evaluation logger is disabled") <NEW_L... | Enables or disables the evaluation logger. If the log_ident or the log_folder is None the evaluation logger
can't be enabled.
:param enable: defines whether the evaluation logger should be enabled or disabled
:return: new status of the evaluation logger | 625941db090684286d50efc8 |
def __init__(self, count=1, faces=6): <NEW_LINE> <INDENT> self.__dice = [1] * count <NEW_LINE> self.__faces = faces | Initialize a can of dice. | 625941db10dbd63aa1bd2e82 |
def SetMaximumCurvatureTimeStep(self, *args): <NEW_LINE> <INDENT> return _itkSegmentationLevelSetImageFilterPython.itkSegmentationLevelSetImageFilterIF2IF2F_SetMaximumCurvatureTimeStep(self, *args) | SetMaximumCurvatureTimeStep(self, double n) | 625941dbbe383301e01b5761 |
def similar_items(self, itemid, N=10): <NEW_LINE> <INDENT> scores = self.item_factors.dot(self.item_factors[itemid]) / self.item_norms <NEW_LINE> best = np.argpartition(scores, -N)[-N:] <NEW_LINE> return sorted(zip(best, scores[best] / self.item_norms[itemid]), key=lambda x: -x[1]) | Return the top N similar items for itemid. | 625941db94891a1f4081bd8b |
def load_user(self, user): <NEW_LINE> <INDENT> self.username.data = user.username <NEW_LINE> self.email.data = user.email | Loads users username and email into the form
| 625941dbd99f1b3c44c6786b |
def get_data_dict(self, minified=False): <NEW_LINE> <INDENT> tree = {} <NEW_LINE> for name, field in self.fields.items(): <NEW_LINE> <INDENT> tree[name] = field.get_values() <NEW_LINE> if minified and len(tree[name]) == 1: <NEW_LINE> <INDENT> tree[name] = tree[name][0] <NEW_LINE> <DEDENT> elif minified and len(tree[nam... | get_data_dict([minified])
Get all values from all fields.
:param minified: if True: all list with length of 1 will be converted
to direct value. all empty list will be omited
:rtype: dict | 625941db85dfad0860c3b13c |
def test_add_view_redirects_to_index_if_no_video_uploaded(self): <NEW_LINE> <INDENT> request = create_request(url=self.url, method='post') <NEW_LINE> response = upload(request) <NEW_LINE> self.assertEqual(response.status_code, 302) <NEW_LINE> self.assertEqual('/',response.url) | The add video view should redirect to the index view if
no video is uploaded. | 625941db6aa9bd52df037085 |
def _poll_and_check_lost(self): <NEW_LINE> <INDENT> self.bpf.perf_buffer_poll() <NEW_LINE> self.lost_event_timer -= 1 <NEW_LINE> if self.lost_event_timer == 0: <NEW_LINE> <INDENT> self.lost_event_timer = self.lost_event_telemetry <NEW_LINE> event = {'type': 'lost_event_telemetry', 'count': self.lost_event_count} <NEW_L... | Simple wrapper method which outputs lost event telemetry while polling | 625941db6e29344779a628f0 |
def test_merge_two_app_ccr(self): <NEW_LINE> <INDENT> alphabet_mr = TestCCRMerger2._create_managed_rule(Alphabet, CCRType.GLOBAL) <NEW_LINE> eclipse_app_mr = TestCCRMerger2._create_managed_rule(EclipseCCR, CCRType.APP, "eclipse") <NEW_LINE> vscode_app_mr = TestCCRMerger2._create_managed_rule(VSCodeCcrRule, CCRType.APP,... | Merger successfully merges one global + two CCR app rules. | 625941dbdd821e528d63b488 |
def tearDown(self): <NEW_LINE> <INDENT> self.patched_settings.disable() <NEW_LINE> ContentType.objects.clear_cache() | Remove patched settings and flush cache | 625941db31939e2706e4d146 |
def addRow(self, items): <NEW_LINE> <INDENT> if type(items) == type(list()): <NEW_LINE> <INDENT> self.__addRowList(items) <NEW_LINE> <DEDENT> elif type(items) == type(dict()): <NEW_LINE> <INDENT> self.__addRowMap(items) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise Exception("Unknown row type. Expected list or di... | Add a row of data to the CSV.
``items`` can be a list of values, or a dictionary of values.
* items -- The list, or dictionary of row items
:raises Exception: If ``items`` is a list and is not equal to the
number of headers
:raises Exception: If ``items`` is a dictionary and contains entries
... | 625941dbbe8e80087fb20f1f |
def pathignore(registry, xml_parent, data): <NEW_LINE> <INDENT> ruby = XML.SubElement(xml_parent, 'ruby-proxy-object') <NEW_LINE> robj = XML.SubElement(ruby, 'ruby-object', attrib={ 'pluginid': 'pathignore', 'ruby-class': 'Jenkins::Plugin::Proxies::BuildWrapper' }) <NEW_LINE> pluginid = XML.SubElement(robj, 'pluginid',... | yaml: pathignore
This plugin allows SCM-triggered jobs to ignore
build requests if only certain paths have changed.
Requires the Jenkins :jenkins-wiki:`Pathignore Plugin <Pathignore+Plugin>`.
:arg str ignored: A set of patterns to define ignored changes
Example::
wrappers:
- pathignore:
ignored: "docs... | 625941dbc432627299f04f28 |
def binrange(data_list, enough=None, cohen=0.2, maxBins=16, minBin=4, trivial=1.05): <NEW_LINE> <INDENT> ranges = bins.bins(t=data_list, enough=enough, cohen=cohen, maxBins=maxBins, minBin=minBin,trivial=trivial) <NEW_LINE> res = [ranges[0].lo] <NEW_LINE> for r in ranges: <NEW_LINE> <INDENT> res.append(r.up) <NEW_LINE>... | :param data_list:
:param enough:
:param cohen:
:param maxBins:
:param minBin:
:param trivial:
:return: ist of bin# e.g. {a,b,c,d,e} [a,b] (b,c] (c,d] (d,e] | 625941db9c8ee82313fbba56 |
def atleast_3channels(arr, copy=True): <NEW_LINE> <INDENT> ndims = len(arr.shape) <NEW_LINE> if ndims == 2: <NEW_LINE> <INDENT> res = np.tile(arr[:, :, None], 3) <NEW_LINE> return res <NEW_LINE> <DEDENT> elif ndims == 3: <NEW_LINE> <INDENT> h, w, c = arr.shape <NEW_LINE> if c == 1: <NEW_LINE> <INDENT> res = np.tile(arr... | Ensures that there are 3 channels in the image
Args:
arr (ndarray[N, M, ...]): the image
copy (bool): Always copies if True, if False, then copies only when the
size of the array must change.
Returns:
ndarray: with shape (N, M, C), where C in {3, 4}
CommandLine:
python -m vtool_ibeis.other at... | 625941db24f1403a92600e44 |
def series(self, regex=None, full=False): <NEW_LINE> <INDENT> if not self._server.check_supported('series'): <NEW_LINE> <INDENT> raise DrmsOperationNotSupported( 'Server does not support series list access') <NEW_LINE> <DEDENT> if self._server.url_show_series_wrapper is None: <NEW_LINE> <INDENT> d = self._json.show_ser... | List available data series.
Parameters
----------
regex : string or None
Regular expression, used to select a subset of the
available series. If set to None, a list of all available
series is returned.
full : bool
If True, return a pandas.DataFrame containing additional
series information, like des... | 625941db4527f215b584c735 |
def _assemble_tag_string(self, tags): <NEW_LINE> <INDENT> if len(tags) == 0: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> tag_string = '' <NEW_LINE> for tag in tags: <NEW_LINE> <INDENT> if tag not in tag_string: <NEW_LINE> <INDENT> tag_string += '<' + tag + '>' <NEW_LINE> res = self.tags.find_one({'TagName': tag... | Assembles a tag string by wrapping each tag with '<' and '>'. If any of the tags do not exist in the Tags
collection they are added and for the tags that already exist their Count value is incremented.
:param tags: list containing the tags
:return: tag string containing each tag wrapped with '<' and '>' | 625941db287bf620b61d3d43 |
@login_required <NEW_LINE> @json_view <NEW_LINE> def ajax_thumbnails(request, obj_type, obj_ref, obj_revi): <NEW_LINE> <INDENT> obj = get_obj(obj_type, obj_ref, obj_revi, request.user) <NEW_LINE> files = [] <NEW_LINE> doc = "|".join((obj_type, obj_ref, obj_revi)) <NEW_LINE> for f in obj.files: <NEW_LINE> <INDENT> if f.... | Ajax view to get files and thumbnails of a document.
:param request: :class:`django.http.QueryDict`
:param obj_type: :attr:`.PLMObject.type`
:type obj_type: str
:param obj_ref: :attr:`.PLMObject.reference`
:type obj_ref: str
:param obj_revi: :attr:`.PLMObject.revision`
:type obj_revi: str | 625941dbaad79263cf390d26 |
def ty(self): <NEW_LINE> <INDENT> return self._mat[1,-1] | Returns the y component of the translation portion of the transformation.
Args:
(None)
Returns:
(float): Translation vector.
| 625941dbe1aae11d1e749f9a |
def _get_index_example_value(index: SDIndex) -> object: <NEW_LINE> <INDENT> if index is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if index.__name__ in INDEX_EXAMPLE_VALUES: <NEW_LINE> <INDENT> return INDEX_EXAMPLE_VALUES[index.__name__] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return INDEX_EXAMPLE_... | Return example entry from `index` or None if `index` is None. | 625941db091ae3566866723a |
def write_to_file(contours, file_path): <NEW_LINE> <INDENT> with open(file_path, 'w') as f: <NEW_LINE> <INDENT> for cont in contours: <NEW_LINE> <INDENT> cont = np.stack([cont[:, 1], cont[:, 0]], 1) <NEW_LINE> cont = cont.flatten().astype(str).tolist() <NEW_LINE> cont = ','.join(cont) <NEW_LINE> f.write(cont + '\n') | :param contours: [[x1, y1], [x2, y2]... [xn, yn]]
:param file_path: target file path | 625941dbbe8e80087fb20f20 |
@operator(_symbol_bit_and, runtime_bitwise_and, _symbol_bit_and_) <NEW_LINE> def operator_bit_and(code, source, tc=False): <NEW_LINE> <INDENT> _helper_reducing(code, source, code.pseudop_binary_and) | (& VALUE MASK)
Applies bitwise-and MASK to VALUE
(bitwise-and VALUE MASK)
same as above | 625941db236d856c2ad44abe |
def demo(): <NEW_LINE> <INDENT> import re <NEW_LINE> from nltk.corpus import udhr <NEW_LINE> udhr_corpus = {"danish": "Danish_Dansk-Latin1", "dutch": "Dutch_Nederlands-Latin1", "english": "English-Latin1", "finnish": "Finnish_Suomi-Latin1", "french": "French_Francais-Latin1", "german": "German_De... | This function provides a demonstration of the Snowball stemmers.
After invoking this function and specifying a language,
it stems an excerpt of the Universal Declaration of Human Rights
(which is a part of the NLTK corpus collection) and then prints
out the original and the stemmed text. | 625941dbd58c6744b4257f3f |
def GenerateFreezeGraph(input_graph='input_graph',output_graph='output_graph',model_path=''): <NEW_LINE> <INDENT> print('begin to generate freeze_graph') <NEW_LINE> freeze_graph.freeze_graph(input_graph+'_b.pb',"",True, model_path, 'mul','save/restore_all','save/Const:0', output_graph+'.pb',True,"") | generate freeze_graph | 625941dbd18da76e235327b9 |
def revert_after_second_replace(sbox): <NEW_LINE> <INDENT> sbox.build(read_only = True) <NEW_LINE> wc_dir = sbox.wc_dir <NEW_LINE> rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho') <NEW_LINE> svntest.actions.run_and_verify_svn(None, [], 'rm', rho_path) <NEW_LINE> expected_status = svntest.actions.get_virginal_state... | revert file after second replace | 625941db004d5f362079a613 |
def list_to_dict(L, year): <NEW_LINE> <INDENT> baby_dict = {} <NEW_LINE> for baby in L: <NEW_LINE> <INDENT> if baby[1] % year == 0: <NEW_LINE> <INDENT> baby_dict[baby[:3]] = baby[3] <NEW_LINE> <DEDENT> elif (baby[0], round(baby[1], -1), baby[2]) in baby_dict: <NEW_LINE> <INDENT> baby_dict[(baby[0], round(baby[1], -1), ... | Make a dictionary that groups babies with
same name and gender with given amount of years
starting from 1880.
if year == 5, then
('Mary', 1880, 'F', 7065)
('Mary', 1881, 'F', 6919)
('Mary', 1882, 'F', 8148)
('Mary', 1883, 'F', 8012)
('Mary', 1884, 'F', 9217)
would be grouped into
key: [('Mary',... | 625941db67a9b606de4a8198 |
def set_value(element, value): <NEW_LINE> <INDENT> tag = element.tag <NEW_LINE> if tag == "table:table-cell": <NEW_LINE> <INDENT> element.clear() <NEW_LINE> text = _set_value_and_type(element, value=value) <NEW_LINE> element.text_content = text <NEW_LINE> return <NEW_LINE> <DEDENT> if tag == "text:variable-set": <NEW_L... | Only for "with office:value-type" elements | 625941db046cf37aa974d026 |
def check_if_learned_ordered(word_id, is_experiment): <NEW_LINE> <INDENT> global short_term_memory_length <NEW_LINE> y = get_yes(word_id) <NEW_LINE> n = get_no(word_id) <NEW_LINE> p = get_position(word_id) <NEW_LINE> log.log_info("check_if_learned_ordered - y: " + str(y)) <NEW_LINE> log.log_info("check_if_learned_order... | checks if we know the word well enough. This is the case if the positive answers are higher than the negative and
if the postiion in the ordered short term memory is larger than 9, which actually means we need to know the word
9 times in a row with no mistake
:param word_id:
:return: | 625941db23e79379d52ee842 |
def _update_dtypes(graph, interface): <NEW_LINE> <INDENT> for alias, info in interface.iteritems(): <NEW_LINE> <INDENT> dtype = graph.get_tensor_by_name(info.name).dtype <NEW_LINE> if not info.dtype: <NEW_LINE> <INDENT> info.dtype = dtype.as_datatype_enum <NEW_LINE> <DEDENT> elif info.dtype != dtype.as_datatype_enum: <... | Adds dtype to TensorInfos in interface if necessary.
If already present, validates TensorInfo matches values in the graph.
TensorInfo is updated in place.
Args:
graph: the TensorFlow graph; used to lookup datatypes of tensors.
interface: map from alias to TensorInfo object.
Raises:
ValueError: if the data type... | 625941db0fa83653e465729a |
def has_node(gr: nx.Graph, att:str, val:str) -> bool: <NEW_LINE> <INDENT> return any([node for node in gr.nodes(data=True) if node[1].get(att, None) == val]) | Checks whether a node with value (val) for attribute (att) exists in the network.
source: https://stackoverflow.com/questions/49103913/check-whether-a-node-exists-in-networkx
:param gr: The graph that needs to be searched
:type gr: nx.Graph
:param att: What attribute must be searched.
:type att: str
:param val: What ... | 625941db8c0ade5d55d3ec9e |
def __delitem__(self, name): <NEW_LINE> <INDENT> name = normalizers.normalizeGlyphName(name) <NEW_LINE> if name not in self: <NEW_LINE> <INDENT> raise ValueError("No glyph with the name '%s' exists." % name) <NEW_LINE> <DEDENT> self._removeGlyph(name) | Remove the glyph with name from the layer. ::
>>> del layer["A"] | 625941db8a43f66fc4b54343 |
def get_sibling_relationship_string(self, sib_type, gender_a, gender_b, in_law_a=False, in_law_b=False): <NEW_LINE> <INDENT> if sib_type == self.NORM_SIB or sib_type == self.UNKNOWN_SIB: <NEW_LINE> <INDENT> typestr = '' <NEW_LINE> <DEDENT> elif sib_type == self.HALF_SIB_MOTHER or sib_type == self.HALF_SI... | Determine the string giving the relation between two siblings of
type sib_type.
Eg: b is the brother of a
Here 'brother' is the string we need to determine
This method gives more details about siblings than
get_single_relationship_string can do.
.. warning:: DON'T TRANSLATE THIS PROCEDURE IF LOGIC IS EQUAL IN YOUR
... | 625941db07d97122c4178b72 |
def test_predigest_urls(self): <NEW_LINE> <INDENT> real_longstr = DataDigester.longstr_ptrn <NEW_LINE> DataDigester.longstr_ptrn = re.compile(r'\S{100,}') <NEW_LINE> urls = ["http://www.example.com", "http://example.com", "http://www.example.com/test/" "http://www.example.com/test/test2", ] <NEW_LINE> message = "Test %... | Test url removal in the predigest process | 625941dbfff4ab517eb2f71e |
def glob_imgs(path, ext='*.nii*'): <NEW_LINE> <INDENT> fns = sorted(glob(os.path.join(path, ext))) <NEW_LINE> return fns | grab all `ext` files in a directory and sort them for consistency | 625941db44b2445a33932375 |
def _siftup(self, pos): <NEW_LINE> <INDENT> while pos > 0: <NEW_LINE> <INDENT> parent = self._parent(pos) <NEW_LINE> if self._items[parent] <= self._items[pos]: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> self._swap(parent, pos) <NEW_LINE> pos = parent | Given a heap where the element at the position `pos' may be violating the
heap property, move it up the tree until the heap property is restored. | 625941db26068e7796caefc3 |
def _evmagtonor(mag_type): <NEW_LINE> <INDENT> if mag_type == 'M': <NEW_LINE> <INDENT> warnings.warn('Converting generic magnitude to moment magnitude') <NEW_LINE> return "W" <NEW_LINE> <DEDENT> mag = MAG_MAPPING.get(mag_type, '') <NEW_LINE> if mag == '': <NEW_LINE> <INDENT> warnings.warn(mag_type + ' is not convertibl... | Switch from obspy event magnitude types to seisan syntax.
>>> print(_evmagtonor('mB')) # doctest: +SKIP
B
>>> print(_evmagtonor('M')) # doctest: +SKIP
W
>>> print(_evmagtonor('bob')) # doctest: +SKIP
<BLANKLINE> | 625941dbd53ae8145f87a54d |
def transactions_for_address(self, bitcoin_address): <NEW_LINE> <INDENT> raise NotImplementedError() | TODO doc string | 625941db66673b3332b92372 |
def update_pet(self, data_json): <NEW_LINE> <INDENT> PetObject.name = "Dog" <NEW_LINE> PetObject.id = Test.test_data.new_id <NEW_LINE> PetObject.status = "pending" <NEW_LINE> response = requests.put(self.url + '/pet', json=json.loads(data_json)) <NEW_LINE> return response | method for updating fields of a pet
:param data_json:
:return: | 625941db4428ac0f6e5baad5 |
def perform_create(self, serializer): <NEW_LINE> <INDENT> km_user = KMUser.objects.get(pk=self.kwargs.get("pk")) <NEW_LINE> return serializer.save(km_user=km_user) | Create a new Journal Entry.
The Know Me user referenced in the URL is passed to the
serializer as the owner of the new entry. We can assume that
user exists and is accessible due to the permission classes on
the view.
Args:
serializer:
An instance of the view's serializer class containing
the data... | 625941db66656f66f7cbc48e |
def cli(argv=None): <NEW_LINE> <INDENT> p = argparse.ArgumentParser() <NEW_LINE> p.add_argument('-V', '--version', action='store_true', help='print version and exit') <NEW_LINE> p.add_argument('-T', metavar='TIMEZONE', action='store', help='input timezone; default: local timezone') <NEW_LINE> p.add_argume... | Backend function for command line interface | 625941db046cf37aa974d027 |
def test_diamond(): <NEW_LINE> <INDENT> test_path = tempfile.mkdtemp() <NEW_LINE> x_train, metadata = diamond(test_path) <NEW_LINE> try: <NEW_LINE> <INDENT> assert x_train.shape == (308, 5) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> shutil.rmtree(test_path) <NEW_LINE> raise() | Test module diamond.py by downloading
diamond.csv and testing shape of
extracted data has 308 rows and 5 columns | 625941db2c8b7c6e89b35aa0 |
@functools.lru_cache(maxsize=8) <NEW_LINE> def swap(dim=2, dtype=complex, **kwargs): <NEW_LINE> <INDENT> S = np.identity(dim**2, dtype=dtype) <NEW_LINE> S = (S.reshape([dim, dim, dim, dim]) .transpose([0, 3, 1, 2]) .reshape([dim**2, dim**2])) <NEW_LINE> S = qu(S, dtype=dtype, **kwargs) <NEW_LINE> make_immutable(S) <NEW... | The SWAP operator acting on subsystems of dimension `dim`.
| 625941dbab23a570cc250465 |
def asdir(mat, edge): <NEW_LINE> <INDENT> edge = edge.lower() <NEW_LINE> if edge in 'lw': <NEW_LINE> <INDENT> return mat <NEW_LINE> <DEDENT> if edge in 're': <NEW_LINE> <INDENT> return hflip(mat) <NEW_LINE> <DEDENT> if edge in 'ds': <NEW_LINE> <INDENT> return cw(mat) <NEW_LINE> <DEDENT> if edge in 'un': <NEW_LINE> <IND... | Returns a view of mat as though the specified edge were on the left.
* If edge is 'l' or 'w', the matrix is unchanged.
* If edge is 'r' or 'e', the matrix is flipped horizontally
* If edge is 'd' or 's', the matrix is rotated clockwise (so the leftmost
item from the bottom edge is now the topmost item on the left ed... | 625941dbab23a570cc250466 |
def learn(self, iters=100): <NEW_LINE> <INDENT> self.w = 0 <NEW_LINE> self.t = 0 <NEW_LINE> s = tuple(self.states[self.w][self.t]) <NEW_LINE> actions = [] <NEW_LINE> profit = [] <NEW_LINE> regret = [] <NEW_LINE> for _ in range(iters): <NEW_LINE> <INDENT> a = self.epsilon_greedy(s, self.epsilon) <NEW_LINE> actions.appen... | - Takes in state and epsilon and returns action | 625941db187af65679ca5400 |
def search_min_unvisited_peaks() -> str: <NEW_LINE> <INDENT> current_element = "" <NEW_LINE> current_weight = 2**32 <NEW_LINE> if show_hints: print("-"*50) <NEW_LINE> for key in weights.keys(): <NEW_LINE> <INDENT> if show_hints: print("key = " + str(key)) <NEW_LINE> if (key not in visitedPeaks) and (weights[key] <= cur... | Нахождение вершины с минимальным весом
:return: Имя вершины с минимальным весом | 625941db442bda511e8be6f6 |
def test_get_unscrambled(self): <NEW_LINE> <INDENT> pass | Test case for get_unscrambled
| 625941db377c676e91272489 |
def number_of_bits(number): <NEW_LINE> <INDENT> count = 0 <NEW_LINE> if number < 0: <NEW_LINE> <INDENT> number = number & 0xffffffff <NEW_LINE> <DEDENT> while number: <NEW_LINE> <INDENT> count += 1 <NEW_LINE> number = (number - 1) & number <NEW_LINE> <DEDENT> return count | 输入一个证书,输出该数二进制表示中1的个数
:return: | 625941db1b99ca400220ad94 |
def forward(self, inputs): <NEW_LINE> <INDENT> if self._disabled: <NEW_LINE> <INDENT> return inputs <NEW_LINE> <DEDENT> outputs = inputs <NEW_LINE> if self._if_calib: <NEW_LINE> <INDENT> if self._calibrator is None: <NEW_LINE> <INDENT> raise RuntimeError("Calibrator was not created.") <NEW_LINE> <DEDENT> self._calibrat... | Apply tensor_quant function to inputs
Args:
inputs: A Tensor of type float32.
Returns:
outputs: A Tensor of type output_dtype | 625941db56b00c62f0f1493c |
def get_min_max_lat_lon(self, locations): <NEW_LINE> <INDENT> d = {} <NEW_LINE> for location in locations: <NEW_LINE> <INDENT> sites = location.sites <NEW_LINE> max_lat, min_lat = '', '' <NEW_LINE> max_lon, min_lon = '', '' <NEW_LINE> if not any(sites): <NEW_LINE> <INDENT> d[location.name] = {'location_begin_lat': min_... | Take a list of locations and return a dictionary with:
location1:
'location_begin_lat', 'location_begin_lon',
'location_end_lat', 'location_end_lon'.
and so on. | 625941db097d151d1a223139 |
def skip_connections(self, model_en): <NEW_LINE> <INDENT> if self.base_model == 'resnet50': <NEW_LINE> <INDENT> skip_1, skip_2 = model_en.get_layer(model_en.layers[112].name).output, model_en.get_layer( model_en.layers[50].name).output <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> skip_1, skip_2 = model_en.get_layer('b... | Builds the skip connections based on the pre-trained CNN models for FCN16 and FCN8.
NOTE- FCN32 doesnt use this function, its a base for other class/FCN16,FCN8
# Arguments:
model_en : the model architecture of the encoder part | 625941dbfff4ab517eb2f71f |
def check_var(self, *args, **kwargs): <NEW_LINE> <INDENT> if not self.enable: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if self.cache and self._eval: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.z1[:] = np.equal(self.u.v, self.bound.v) <NEW_LINE> self._eval = True | If enabled, set flags based on inputs. Use cached values if enabled. | 625941db009cb60464c63691 |
def compute(start): <NEW_LINE> <INDENT> if precomputed[start] is not None: <NEW_LINE> <INDENT> return precomputed[start] <NEW_LINE> <DEDENT> height, index = 0, start <NEW_LINE> for word in sentence: <NEW_LINE> <INDENT> if index + len(word) + 1 > cols: <NEW_LINE> <INDENT> index = len(word) <NEW_LINE> height += 1 <NEW_LI... | computes in a DP fashion how many lines it takes
to write all words in senteces, return lines and end | 625941db38b623060ff0b0cf |
def __init__(self, transform_X=False, transform_y=False, transform_w=False, dataset=None, x_max=5., y_max=500.): <NEW_LINE> <INDENT> super(ClippingTransformer, self).__init__( transform_X=transform_X, transform_y=transform_y, transform_w=transform_w, dataset=dataset) <NEW_LINE> assert not transform_w <NEW_LINE> self.x_... | Initialize clipping transformation.
Parameters:
----------
transform_X: bool, optional (default False)
Whether to transform X
transform_y: bool, optional (default False)
Whether to transform y
transform_w: bool, optional (default False)
Whether to transform w
dataset: dc.data.Dataset object, optional
Dataset t... | 625941db5fc7496912cc3c5f |
def play_atari(individual, game_name, game_iterations, env_seeds, vis=False, sleep=0.05): <NEW_LINE> <INDENT> from cv2 import cvtColor, COLOR_RGB2GRAY, resize <NEW_LINE> import keras as K <NEW_LINE> import gym.spaces <NEW_LINE> conv_module = KerasConvModules.gen_DQN_architecture(input_shape=individual.in_shape, output_... | Given an indivudual, play an Atari game and return the score.
:param individual:
:return: sequence of actions as numpy array | 625941db8e71fb1e9831da8a |
def create_lambda_charts(function_name, description): <NEW_LINE> <INDENT> charts = [] <NEW_LINE> charts.append( TimeSeriesChart() .with_name("Lambda " + function_name + " Invocations") .with_description(description) .with_default_plot_type(PlotType.column_chart) .with_chart_legend_optio... | Create Lambda charts
Left chart shows activity and latency.
Right chart shows errors, throttles, and iterator age. | 625941db30dc7b7665901c45 |
def save(self, *args, **kwargs): <NEW_LINE> <INDENT> if not self.full_name: <NEW_LINE> <INDENT> self.full_name = Road.make_full_name( self.prefix_direction, self.name, self.road_type, self.suffix_direction) <NEW_LINE> <DEDENT> return super(Road, self).save(*args, **kwargs) | Populate the full_name property before saving. | 625941db99fddb7c1c9de672 |
def RightClickSystemTrayIcon(button, exact=False, by_tooltip=False): <NEW_LINE> <INDENT> SystemTrayIcons.button(button, exact=exact, by_tooltip=by_tooltip).click_input(button='right') | Right click on a visible tray icon given by button | 625941db4f88993c3716c347 |
def __init__(self, raw_country_input=None): <NEW_LINE> <INDENT> self._raw_country_input = None <NEW_LINE> self.discriminator = None <NEW_LINE> if raw_country_input is not None: <NEW_LINE> <INDENT> self.raw_country_input = raw_country_input | ValidateCountryRequest - a model defined in Swagger | 625941dbadb09d7d5db6ca70 |
def increase_speed(self): <NEW_LINE> <INDENT> self.ship_speed_factor *= self.speedup_scale <NEW_LINE> self.bullet_speed_factor *= self.speedup_scale <NEW_LINE> self.alien_speed_factor *= self.speedup_scale <NEW_LINE> self.alien_points = int(self.alien_points * self.score_scale) <NEW_LINE> print(self.alien_points) | Increaes speed settings and alien point values. | 625941db7b25080760e3973a |
def nature_field_name(model): <NEW_LINE> <INDENT> opts = model._meta <NEW_LINE> fields = [ f.name for f in opts.fields if ( isinstance(f, models.CharField) and not getattr(f, 'blank', False) ) ] <NEW_LINE> if fields: <NEW_LINE> <INDENT> if 'name' in fields: <NEW_LINE> <INDENT> return 'name' <NEW_LINE> <DEDENT> elif 'te... | Return model CharField , SlugField Field name use nature field. | 625941db29b78933be1e5989 |
def read_ksgaps(self): <NEW_LINE> <INDENT> return self.read_value("e0gap") | Read the KS gaps. Returns [nsppol, nkibz] array with KS gaps in eV. | 625941dbbe7bc26dc91cd8dd |
def test_fetch_organization(self): <NEW_LINE> <INDENT> organization1 = OrganizationFactory.create() <NEW_LINE> organization2 = OrganizationFactory.create() <NEW_LINE> with self.assertNumQueries(2): <NEW_LINE> <INDENT> self.assertEqual(data.fetch_organization(organization1.id)['id'], organization1.id) <NEW_LINE> self.as... | Unit Test: test_fetch_organization | 625941dbbf627c535bc134b1 |
def __init__(self, atlas_morphs, morphs_pdb_directory): <NEW_LINE> <INDENT> self.atlas_morphs = atlas_morphs <NEW_LINE> self.morphs_pdb_directory = morphs_pdb_directory | Initializes the repository with the parsed AtlasMorph objects and path to the directory containing the protein
structures.
:param atlas_morphs: Dictionary from morph_id to the parsed AtlasMorph object
:param morphs_pdb_directory: The path to the directory containing the protein structures | 625941db627d3e7fe0d69133 |
def build_the_phrase(self, files_map): <NEW_LINE> <INDENT> raise NotImplementedError() | Builds the phrase from the map
:param files_map: map as a dictionary
:type files_map: Any | 625941db82261d6c526ab785 |
def isHappy(self, n): <NEW_LINE> <INDENT> l1 =[] <NEW_LINE> while n!=1 and n not in l1: <NEW_LINE> <INDENT> l1.append(n) <NEW_LINE> m = str(n) <NEW_LINE> n =0 <NEW_LINE> for i in m: <NEW_LINE> <INDENT> n += int(i)**2 <NEW_LINE> <DEDENT> <DEDENT> return n == 1 | :type n: int
:rtype: bool | 625941db379a373c97cfae28 |
def test_user_repr(self): <NEW_LINE> <INDENT> u = AuthUser('test', 'secret') <NEW_LINE> assert repr(u) == "<User: test>" | Ensure __repr__ function works | 625941db7d43ff24873a2f83 |
def load_connection_info(self, info): <NEW_LINE> <INDENT> self.transport = info.get('transport', self.transport) <NEW_LINE> self.ip = info.get('ip', self._ip_default()) <NEW_LINE> self._record_random_port_names() <NEW_LINE> for name in port_names: <NEW_LINE> <INDENT> if getattr(self, name) == 0 and name in info: <NEW_L... | Load connection info from a dict containing connection info.
Typically this data comes from a connection file
and is called by load_connection_file.
Parameters
----------
info: dict
Dictionary containing connection_info.
See the connection_file spec for details. | 625941db8e05c05ec3eea658 |
def test_func_update_command_path_for_good_case_no_updating_argument_update_true(self): <NEW_LINE> <INDENT> pipe_cur = Pipeline.Pipeline("test_func_update_command_path_for_good_case") <NEW_LINE> str_answer = "java update.jar -xmf 30 -f -g craziness.txt" <NEW_LINE> cmd_cur = Command.Command("java update.jar -xmf 30 -f -... | Test updating a command when the arguments match (but should not update) (true). | 625941dbd8ef3951e3243820 |
def _get_logits(self, h_aug, u_aug): <NEW_LINE> <INDENT> if self.linear_fun == 'tri': <NEW_LINE> <INDENT> ones_h = self.ones[:, :self.JQ] <NEW_LINE> trans_h = K.dot(K.dot(h_aug, self.Wa_1), ones_h) <NEW_LINE> ones_u = self.ones[:, :self.JX] <NEW_LINE> trans_u = K.permute_dimensions(K.dot(K.dot(u_aug, self.Wa_2), ones_u... | :param h_aug: [ ...,2d]
:param u_aug: [....,2d]
:return: | 625941dbd7e4931a7ee9e200 |
def sync_metadata_to_db(self): <NEW_LINE> <INDENT> super(PluginAdapterV3, self).sync_metadata_to_db() <NEW_LINE> db_config_metadata_mapping = { 'attributes_metadata': self.environment_config_name, 'roles_metadata': self.node_roles_config_name, 'volumes_metadata': self.volumes_config_name, 'network_roles_metadata': self... | Sync metadata from all config yaml files to DB | 625941db2eb69b55b151cb94 |
def predict(self, prediction, nms_conf=0.4): <NEW_LINE> <INDENT> conf_mask = (prediction[:, :, 4] > self.confidence).float().unsqueeze(2) <NEW_LINE> prediction = prediction * conf_mask <NEW_LINE> box_corner = prediction.new(*prediction.size()) <NEW_LINE> box_corner[:, :, 0] = (prediction[:, :, 0] - prediction[:, :, 2] ... | prediction:
0:3 - x, y, h, w
4 - confidence
5: - class score | 625941db4d74a7450ccd44a6 |
def test_buffer_exceeded(self): <NEW_LINE> <INDENT> parser = MessageParser(8) <NEW_LINE> msg = b'\x1a\x00\x00\x00\x02msg\x00\x0c\x00\x00\x00hello world\x00\x00' <NEW_LINE> self.assertRaises(RuntimeError, parser.push, msg) | Tests that BSON message parser raises an exception when its buffer
limit is exceeded. | 625941dba79ad161976cc428 |
def simpleOutputCheck(self, outLines): <NEW_LINE> <INDENT> problems = [] <NEW_LINE> lines = [] <NEW_LINE> if outLines.find("\n") != -1: <NEW_LINE> <INDENT> lines = outLines.split("\n") <NEW_LINE> <DEDENT> for line in lines: <NEW_LINE> <INDENT> line = line.lower() <NEW_LINE> if line.find("network is unreachable") != -1:... | parse line by line the outLines text lookng for Exceptions | 625941db507cdc57c6306fc3 |
def begin_list_routes_table( self, resource_group_name, cross_connection_name, peering_name, device_path, **kwargs ): <NEW_LINE> <INDENT> polling = kwargs.pop('polling', True) <NEW_LINE> cls = kwargs.pop('cls', None) <NEW_LINE> lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) <NEW_LINE> cont_... | Gets the currently advertised routes table associated with the express route cross connection
in a resource group.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param cross_connection_name: The name of the ExpressRouteCrossConnection.
:type cross_connection_name: str
:para... | 625941dbd268445f265b5150 |
def parse_optimize_calculation(calc): <NEW_LINE> <INDENT> import numpy as np <NEW_LINE> plugin = calc.get_code().get_attr('input_plugin') <NEW_LINE> if plugin == 'vasp.vasp': <NEW_LINE> <INDENT> forces = calc.out.output_trajectory.get_array('forces')[-1] <NEW_LINE> stress = calc.out.output_trajectory.get_array('stress'... | Parse ths information from plugins nodes and set common units
Stress in kB
Force in eV/Angstrom | 625941dbb545ff76a89140f7 |
def filter_queryset(self, qs, filter_param): <NEW_LINE> <INDENT> return qs | Filter the queryset `qs`, given the selected `filter_param`.
Default implementation does no filtering at all.
Args:
qs (QuerySet): Queryset to filter.
filter_param (str): Param to be filter.
Returns:
QuerySet: Filtered queryset. | 625941dbfb3f5b602dac3978 |
def plotSpectrum(y,Fs): <NEW_LINE> <INDENT> n = len(Data) <NEW_LINE> k = arange(n) <NEW_LINE> T = n/Fs <NEW_LINE> frq = k/T <NEW_LINE> frq = frq[range(n/2)] <NEW_LINE> Y = fft(y)/n <NEW_LINE> Y = Y[range(n/2)] <NEW_LINE> plot(frq,abs(Y),'r') <NEW_LINE> xlabel('Freq (Hz)') <NEW_LINE> ylabel('|Y(freq)|') | Build a function to Plots the Freq domain | 625941db73bcbd0ca4b2c358 |
def parseGeneAssoc(GeneAssocStr): <NEW_LINE> <INDENT> GeneAssocStr_tmp = re.sub(r" and | or ", "_FORSPLIT_", GeneAssocStr) <NEW_LINE> resultat = re.sub(r"\(|\)|\s", "", GeneAssocStr_tmp) <NEW_LINE> if len(resultat) != 0: <NEW_LINE> <INDENT> resultat = list(set(resultat.split("_FORSPLIT_"))) <NEW_LINE> <DEDENT> else: <N... | Given a grammar of 'and', 'or' and '(' ')'. Extracts genes ids to a list.
(geneX and geneY) or geneW' => [geneX,geneY,geneW]
Parameters
----------
GeneAssocStr: str
the string containing genes ids
Returns
-------
list:
the list of unique ids | 625941db15fb5d323cde0df5 |
def setUp(self): <NEW_LINE> <INDENT> self.COMPUTER_SLEEP = self.run_function('power.get_computer_sleep') <NEW_LINE> self.DISPLAY_SLEEP = self.run_function('power.get_display_sleep') <NEW_LINE> self.HARD_DISK_SLEEP = self.run_function('power.get_harddisk_sleep') <NEW_LINE> self.WAKE_ON_MODEM = self.run_function('power.g... | Get current settings | 625941dbf548e778e58cd861 |
def refresh_vm(uuid, snapshot_uuid, vbox_exe): <NEW_LINE> <INDENT> print("\n[INFO] Refreshing MobSF VM") <NEW_LINE> try: <NEW_LINE> <INDENT> if not vbox_exe: <NEW_LINE> <INDENT> print("[ERROR] VirtualBox not found, Manually set VBOXMANAGE_BINARY in settings.py") <NEW_LINE> <DEDENT> args = [vbox_exe, 'controlvm', uuid, ... | Refresh VirtualBox based VMs | 625941db097d151d1a22313a |
def snapshot_all(self): <NEW_LINE> <INDENT> object_values = self.object_values <NEW_LINE> keys = list(object_values.keys()) <NEW_LINE> for key in keys: <NEW_LINE> <INDENT> val = object_values[key] <NEW_LINE> self.set(key, value) <NEW_LINE> <DEDENT> self.save() | Capture all state for stored objects and save. | 625941db4e696a04525c972e |
def mundi_download_url_for_given_safe(safe_title): <NEW_LINE> <INDENT> r = requests.get('{}/Sentinel1/opensearch?uid={}'.format(MUNDI_SEARCH_URL, safe_title)) <NEW_LINE> if r.ok: <NEW_LINE> <INDENT> d = xmltodict.parse(r.text) <NEW_LINE> return d['feed']['entry']['link'][1]['@href'] <NEW_LINE> <DEDENT> else: <NEW_LINE>... | Use Mundi search API to get the url of a given SAFE.
Args:
safe_title (string): title of a safe (without the .SAFE extension)
Return:
url to that SAFE zip file hosted at Mundi | 625941db30dc7b7665901c46 |
def testVifAttachmentContext(self): <NEW_LINE> <INDENT> pass | Test VifAttachmentContext | 625941db7c178a314d6ef746 |
def remote_get_state(self, simNumList): <NEW_LINE> <INDENT> traceList = [] <NEW_LINE> foundOne = False <NEW_LINE> prev = None <NEW_LINE> for n in simNumList: <NEW_LINE> <INDENT> for q in self.simQubits: <NEW_LINE> <INDENT> if q.simNum == n: <NEW_LINE> <INDENT> if foundOne is True and prev.register != q.register: <NEW_L... | Return the state of multiple qubits corresponding to the IDs in simNumList. | 625941db60cbc95b062c6826 |
def top(self): <NEW_LINE> <INDENT> return self.stkVal[-1] | :rtype: int | 625941db656771135c3ebb54 |
def __init__(self, webhook_id=None, webhook_name=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration = Configuration() <NEW_LINE> <DEDENT> self.local_vars_configuration = local_vars_configuration <NEW_LINE> self._webhook_id = None <... | TriggerWebhookEffectProps - a model defined in OpenAPI | 625941db85dfad0860c3b13e |
def identify_tag(self, key_card, value_card=None): <NEW_LINE> <INDENT> dictionary = self._group <NEW_LINE> if key_card not in dictionary: <NEW_LINE> <INDENT> dictionary[key_card.return_tag()] = [value_card.return_tag()] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> dictionary[key_card.return_tag()].append(value_card.re... | takes in two card elements from any decks- one for the key and one for the value and extracts the tags. | 625941dbbe383301e01b5763 |
def set(self, values): <NEW_LINE> <INDENT> if not values: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> usernames = set() <NEW_LINE> for path, operation, policy, exceptions in values: <NEW_LINE> <INDENT> usernames.update(exceptions) <NEW_LINE> <DEDENT> idByUsername, roleByUsername = self._getUserDetails(usernames) <NE... | Update L{NamespacePermission}s and L{TagPermission}s.
@param values: A sequence of C{(path, Operation, Policy, exceptions)}
4-tuples.
@raise RuntimeError: Raised if an invalid L{Operation} is provided. | 625941dbd268445f265b5151 |
def __init__(self): <NEW_LINE> <INDENT> type(self).__counter += 1 | Initialize. | 625941dbbde94217f36830d0 |
def _deb_to_packages(self, package_file): <NEW_LINE> <INDENT> filename = os.path.join(self.repository, package_file.filename) <NEW_LINE> package_version = package_file.binary_package.package_version <NEW_LINE> package = package_version.package <NEW_LINE> if not os.path.isfile(filename): <NEW_LINE> <INDENT> log.critical... | Reads a binary package and outputs a Packages file entry.
``file``
Filename of the deb to read. | 625941db4527f215b584c736 |
def clean_title(self, title): <NEW_LINE> <INDENT> if "site_name" in list(self.article.opengraph.keys()): <NEW_LINE> <INDENT> site_name = self.article.opengraph['site_name'] <NEW_LINE> title = title.replace(site_name, '').strip() <NEW_LINE> <DEDENT> elif (self.article.schema and "publisher" in self.article.schema and "n... | Clean title with the use of og:site_name
in this case try to get rid of site name
and use TITLE_SPLITTERS to reformat title | 625941db442bda511e8be6f7 |
def is_published(self): <NEW_LINE> <INDENT> if self.rc == MQTT_ERR_QUEUE_SIZE: <NEW_LINE> <INDENT> raise ValueError('Message is not queued due to ERR_QUEUE_SIZE') <NEW_LINE> <DEDENT> with self._condition: <NEW_LINE> <INDENT> return self._published | Returns True if the message associated with this object has been
published, else returns False. | 625941dbaad79263cf390d27 |
@APP.teardown_appcontext <NEW_LINE> def shutdown_session(exc=None): <NEW_LINE> <INDENT> if exc is None: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> DB_SESSION.remove() | clean database session on errors | 625941db796e427e537b08aa |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.