text stringlengths 81 112k |
|---|
Numerical autofocusing of a field using the Helmholtz equation.
Parameters
----------
field : 1d or 2d ndarray
Electric field is BG-Corrected, i.e. field = EX/BEx
nm : float
Refractive index of medium.
res : float
Size of wavelength in pixels.
ival : tuple of floats
... |
Numerical autofocusing of a stack using the Helmholtz equation.
Parameters
----------
fieldstack : 2d or 3d ndarray
Electric field is BG-Corrected, i.e. Field = EX/BEx
nm : float
Refractive index of medium.
res : float
Size of wavelength in pixels.
ival : tuple of float... |
Find the focus by minimizing the `metric` of an image
Parameters
----------
field : 2d array
electric field
metric_func : callable
some metric to be minimized
ival : tuple of floats
(minimum, maximum) of interval to search in pixels
nm : float
RI of medium
re... |
Generates blacklists / whitelists
def prepare_project(project, project_dir, binaries, ips, urls):
"""
Generates blacklists / whitelists
"""
# Get Various Lists / Project Waivers
lists = get_lists.GetLists()
# Get file name black list and project waivers
file_audit_list, file_audit_project... |
Main scan tasks begin
def scan_file(project, project_dir, binaries, ips, urls, file_audit_list,
file_audit_project_list, flag_list, ignore_list, hashlist,
file_ignore, ignore_directories, url_ignore, ip_ignore, apikey):
"""
Main scan tasks begin
"""
logger.info("Commencing s... |
If an IP Address is found, scan it
def scan_ipaddr(ipaddr, line, project, split_path, apikey):
"""
If an IP Address is found, scan it
"""
logger.info('Found what I believe is an IP Address: %s', line.strip())
logger.info('File %s. Parsed IP Address: %s', split_path, ipaddr)
with open(reports_di... |
If URL is found, scan it
def scan_url(url, line, project, split_path, apikey):
"""
If URL is found, scan it
"""
logger.info('File %s contains what I believe is a URL: %s', split_path, line.strip())
logger.info('Scanning: %s', url)
with open(reports_dir + "urls-" + project + ".log", "a") as gate... |
parse the 'Maps' subfolder directory divining criteria for valid maps
def getIndex(folderPath=None):
"""parse the 'Maps' subfolder directory divining criteria for valid maps"""
try: return cache.structure
except AttributeError: pass # if it doesn't exist, generate and cache the map file data
if fold... |
Stringify a number, preventing unwanted scientific notations.
def _stringify_number(v):
'''
Stringify a number, preventing unwanted scientific notations.
'''
if isinstance(v, (float, Decimal)):
if math.isinf(v) and v > 0:
v = 'Infinity'
elif math.isinf(v) and v < 0:
... |
Resolve the tag using etcd so that the current instance indicates
a concrete, latest image.
Note that alias resolving does not take the registry component into
account.
async def resolve_alias(cls, alias_key: str, etcd: etcd.AsyncEtcd):
'''
Resolve the tag using etcd so that th... |
Accessing web-based ontology service is too long, so we cache the
information in a pickle file and query the services only if the info
has not already been cached.
def getOntoCategory(curie, alwaysFetch=False):
"""
Accessing web-based ontology service is too long, so we cache the
information ... |
Setup root logger for package
def _init_logging(anteater_log):
""" Setup root logger for package """
LOG.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - '
'%(levelname)s - %(message)s')
ch.setFormatter(f... |
Creates a directory for scan reports
def check_dir():
""" Creates a directory for scan reports """
try:
os.makedirs(reports_dir)
logger.info('Creating reports directory: %s', reports_dir)
except OSError as e:
if e.errno != errno.EEXIST:
raise |
Main function, mostly for passing arguments
def main():
""" Main function, mostly for passing arguments """
_init_logging(config.get('config', 'anteater_log'))
check_dir()
arguments = docopt(__doc__, version=__version__)
if arguments['<patchset>']:
prepare_patchset(arguments['<project>'], ... |
Fit a Stan model. Caches the compiled model.
*args and **kwargs are passed to the pystan.stan function.
Arguments you most likely want to pass: data, init, iter, chains.
Unlike pystan.stan, if the n_jobs kwarg is not specified, it defaults to
-1.
Parameters
-------------------
mo... |
cross correlate with other, for all pairs
closer than rmax, iterate.
for r, i, j in A.enumiter(...):
...
where r is the distance, i and j are the original
input array index of the data.
This uses a thread to convert from KDNode.enum.
def enu... |
cross correlate with other, for all pairs
closer than rmax, iterate.
>>> def process(r, i, j, **kwargs):
>>> ...
>>> A.enum(... process, **kwargs):
>>> ...
where r is the distance, i and j are the original
input array index of t... |
Gray & Moore based fast dual tree counting.
r is the edge of bins:
-inf or r[i-1] < count[i] <= r[i]
attrs: None or tuple
if tuple, attrs = (attr_self, attr_other)
Returns: count,
count, weight of attrs is not None
def count(self, oth... |
Friend-of-Friend clustering with linking length.
Returns: the label
def fof(self, linkinglength, out=None, method='splay'):
""" Friend-of-Friend clustering with linking length.
Returns: the label
"""
if out is None:
out = numpy.empty(self.size, dtype='intp'... |
Calculate the total number of points between [min, max).
If attr is given, also calculate the sum of the weight.
This is a M log(N) operation, where M is the number of min/max
queries and N is number of points.
def integrate(self, min, max, attr=None, info={}):
""" Calcula... |
Divide a tree branch to a forest,
each subtree of size at most chunksize
def make_forest(self, chunksize):
""" Divide a tree branch to a forest,
each subtree of size at most chunksize """
heap = []
heappush(heap, (-self.size, self))
while True:
w, x... |
Install a third party odoo add-on
:param string repo_url: url of the repo that contains the patch.
:param string branch: name of the branch to checkout.
:param string destination: the folder where the add-on should end up at.
:param string commit: Optional commit rev to checkout to. If mentioned, that ... |
Use the conf file to list all the third party Odoo add-ons that will be installed
and the patches that should be applied.
:param string destination: the folder where add-ons should end up at.
Default: pwd/3rd
:param string conf_file: path to a conf file that describe the add-... |
Find rightmost value less than x
def find_lt(a, x):
"""Find rightmost value less than x"""
i = bisect.bisect_left(a, x)
if i:
return a[i-1]
raise ValueError |
Entry point to parse an ISA-Tab directory.
isatab_ref can point to a directory of ISA-Tab data, in which case we
search for the investigator file, or be a reference to the high level
investigation file.
def parse(isatab_ref):
"""Entry point to parse an ISA-Tab directory.
isatab_ref can point to a d... |
Parse a section of an ISA-Tab, assigning information to a supplied record.
def _parse_region(self, rec, line_iter):
"""Parse a section of an ISA-Tab, assigning information to a supplied record.
"""
had_info = False
keyvals, section = self._parse_keyvals(line_iter)
if keyvals:
... |
Read tab delimited file, handling ISA-Tab special case headers.
def _line_iter(self, in_handle):
"""Read tab delimited file, handling ISA-Tab special case headers.
"""
reader = csv.reader(in_handle, dialect="excel-tab")
for line in reader:
if len(line) > 0 and line[0]:
... |
Generate dictionary from key/value pairs.
def _parse_keyvals(self, line_iter):
"""Generate dictionary from key/value pairs.
"""
out = None
line = None
for line in line_iter:
if len(line) == 1 and line[0].upper() == line[0]:
break
else:
... |
Retrieve row data from files associated with the ISATabRecord.
def parse(self, rec):
"""Retrieve row data from files associated with the ISATabRecord.
"""
final_studies = []
for study in rec.studies:
source_data = self._parse_study(study.metadata["Study File Name"],
... |
Parse study or assay row oriented file around the supplied base node.
def _parse_study(self, fname, node_types):
"""Parse study or assay row oriented file around the supplied base node.
"""
if not os.path.exists(os.path.join(self._dir, fname)):
return None
nodes = {}
... |
Convert node metadata back into a standard dictionary and list.
def _finalize_metadata(self, node):
"""Convert node metadata back into a standard dictionary and list.
"""
final = {}
for key, val in iter(node.metadata.items()):
#val = list(val)
#if isinstance(val[... |
Parse out key value pairs for line information based on a group of values.
def _line_by_type(self, line, header, hgroups, htypes, out, want_type,
collapse_quals_fn = None):
"""Parse out key value pairs for line information based on a group of values.
"""
for index, htype i... |
Combine attributes in multiple columns into single named tuple.
def _collapse_attributes(self, line, header, indexes):
"""Combine attributes in multiple columns into single named tuple.
"""
names = []
vals = []
pat = re.compile("[\W]+")
for i in indexes:
name... |
Remove ISA-Tab specific information from Header[real name] headers.
def _clean_header(self, header):
"""Remove ISA-Tab specific information from Header[real name] headers.
"""
if header.find("[") >= 0:
header = header.replace("]", "").split("[")[-1]
# ISATab can start with n... |
Characterize header groups into different data types.
def _characterize_header(self, header, hgroups):
"""Characterize header groups into different data types.
"""
out = []
for h in [header[g[0]] for g in hgroups]:
this_ctype = None
for ctype, names in self._col_... |
Combine header columns into related groups.
def _collapse_header(self, header):
"""Combine header columns into related groups.
"""
out = []
for i, h in enumerate(header):
if h.startswith(self._col_quals):
out[-1].append(i)
else:
ou... |
PURPOSE: command-line interface for map information
def main(): # mini/unit test
"""
PURPOSE: command-line interface for map information
"""
options = optionsParser().parse_args()
params = getSelectionParams(options)
if options.list or options.details:
specifiedMaps = filterMapNames(
... |
Parse file extension.
- *.pickle: uncompressed, utf-8 encode pickle file
- *.gz: compressed, utf-8 encode pickle file
def is_pickle_file(abspath):
"""Parse file extension.
- *.pickle: uncompressed, utf-8 encode pickle file
- *.gz: compressed, utf-8 encode pickle file
"""
abspath =... |
Load Pickle from file. If file are not exists, returns ``default``.
:param abspath: file path. use absolute path as much as you can.
extension has to be ``.pickle`` or ``.gz`` (for compressed Pickle).
:type abspath: string
:param default: default ``dict()``, if ``abspath`` not exists, return the
... |
Dump picklable object to file.
Provides multiple choice to customize the behavior.
:param data: picklable python object.
:type data: dict or list
:param abspath: ``save as`` path, file extension has to be ``.pickle`` or ``.gz``
(for compressed Pickle)
:type abspath: string
:param pk_p... |
A stable version of :func:`dump`, this method will silently overwrite
existing file.
There's a issue with :func:`dump`: If your program is interrupted while
writing, you got an incomplete file, and you also lose the original file.
So this method write pickle to a temporary file first, then rename... |
Convert arbitrary pickable Python Object to bytes.
**中文文档**
将可Pickle化的Python对象转化为bytestr
def obj2bytes(obj, pk_protocol=py23.pk_protocol):
"""Convert arbitrary pickable Python Object to bytes.
**中文文档**
将可Pickle化的Python对象转化为bytestr
"""
return pickle.dumps(obj, protocol=pk_protocol) |
Convert arbitrary object to base64 encoded string.
**中文文档**
将可Pickle化的Python对象转化为utf-8编码的 ``纯ASCII字符串``
def obj2str(obj, pk_protocol=py23.pk_protocol):
"""Convert arbitrary object to base64 encoded string.
**中文文档**
将可Pickle化的Python对象转化为utf-8编码的 ``纯ASCII字符串``
"""
return base64.urlsafe_b6... |
bincount supporting scalar and vector weight
def bincount(dig, weight, minlength):
""" bincount supporting scalar and vector weight """
if numpy.isscalar(weight):
return numpy.bincount(dig, minlength=minlength) * weight
else:
return numpy.bincount(dig, weight, minlength) |
Resets the users network to make changes take effect
def reset_network(message):
"""Resets the users network to make changes take effect"""
for command in settings.RESTART_NETWORK:
try:
subprocess.check_call(command)
except:
pass
print(message) |
Disables access to websites that are defined as 'distractors
def improve():
"""Disables access to websites that are defined as 'distractors'"""
with open(settings.HOSTS_FILE, "r+") as hosts_file:
contents = hosts_file.read()
if not settings.START_TOKEN in contents and not settings.END_TOKEN in ... |
Enables access to websites that are defined as 'distractors
def lose():
"""Enables access to websites that are defined as 'distractors'"""
changed = False
with open(settings.HOSTS_FILE, "r") as hosts_file:
new_file = []
in_block = False
for line in hosts_file:
if in_bloc... |
Enables temporarily breaking concentration
def take_break(minutes: hug.types.number=5):
"""Enables temporarily breaking concentration"""
print("")
print("######################################### ARE YOU SURE? #####################################")
try:
for remaining in range(60, -1, -1):
... |
Tuple of (low_port, high_port) reflecting the local port range
assigned to outbound connections. We use this as part of a heuristic
to determine whether a connection is inbound or outbound.
def local_port_range(self):
"""Tuple of (low_port, high_port) reflecting the local port range
ass... |
Format a number using base-2 SI prefixes
def _si(number):
"""Format a number using base-2 SI prefixes"""
prefixes = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
while number > 1024:
number /= 1024.0
prefixes.pop(0)
return '%0.2f%s' % (number, prefixes.pop(0)) |
Retrieve requested URL
def _get_url(url):
"""Retrieve requested URL"""
try:
data = HTTP_SESSION.get(url, stream=True)
data.raise_for_status()
except requests.exceptions.RequestException as exc:
raise FetcherException(exc)
return data |
Extract files while explicitly setting the proper permissions
def _extract_file(zip_fp, info, path):
"""Extract files while explicitly setting the proper permissions"""
zip_fp.extract(info.filename, path=path)
out_path = os.path.join(path, info.filename)
perm = info.external_attr >> 16
perm |= sta... |
Taskcluster denotes builds in one of two formats - i.e. linux64-asan or linux64-asan-opt
The latter is generated. If it fails, the caller should try the former.
def build_string(self):
"""
Taskcluster denotes builds in one of two formats - i.e. linux64-asan or linux64-asan-opt
The latte... |
Generate platform prefix for cross-platform downloads.
def auto_name_prefix(self):
"""
Generate platform prefix for cross-platform downloads.
"""
# if the platform is not native, auto_name would clobber native downloads.
# make a prefix to avoid this
native_system = std_... |
Generator for all possible BuildTasks with these parameters
def iterall(cls, build, branch, flags, platform=None):
"""Generator for all possible BuildTasks with these parameters"""
# Prepare build type
if platform is None:
platform = Platform()
target_platform = platform.gec... |
Multiple entries exist per push date. Iterate over all until a working entry is found
def _pushdate_urls(cls, pushdate, branch, target_platform):
"""Multiple entries exist per push date. Iterate over all until a working entry is found"""
url_base = cls.URL_BASE + '/namespaces/gecko.v2.mozilla-' + branc... |
Retrieve the URL for revision based builds
def _revision_url(cls, rev, branch, target_platform):
"""Retrieve the URL for revision based builds"""
namespace = 'gecko.v2.mozilla-' + branch + '.revision.' + rev
product = 'mobile' if 'android' in target_platform else 'firefox'
return cls.UR... |
Return an iterable for all available builds matching a particular build type
def iterall(cls, target, branch, build, flags, platform=None):
"""Return an iterable for all available builds matching a particular build type"""
flags = BuildFlags(*flags)
for task in BuildTask.iterall(build, branch, ... |
Retrieve the artifacts json object
def _artifacts(self):
"""Retrieve the artifacts json object"""
if '_artifacts' not in self._memo:
json = _get_url(self._artifacts_url).json()
self._memo['_artifacts'] = json['artifacts']
return self._memo['_artifacts'] |
Build the artifact basename
Builds are base.tar.bz2, info is base.json, shell is base.jsshell.zip...
def _artifact_base(self):
"""
Build the artifact basename
Builds are base.tar.bz2, info is base.json, shell is base.jsshell.zip...
"""
if '_artifact_base' not in self._me... |
Return the build's info
def build_info(self):
"""Return the build's info"""
if 'build_info' not in self._memo:
self._memo['build_info'] = _get_url(self.artifact_url('json')).json()
return self._memo['build_info'] |
Return the build's mozinfo
def moz_info(self):
"""Return the build's mozinfo"""
if 'moz_info' not in self._memo:
self._memo['moz_info'] = _get_url(self.artifact_url('mozinfo.json')).json()
return self._memo['moz_info'] |
Download and extract the build and requested extra artifacts
@type path:
@param path:
@type tests:
@param tests:
@type full_symbols:
@param full_symbols:
def extract_build(self, path='.', tests=None, full_symbols=False):
"""
Download and extract the bu... |
Update directory to work with DOMFuzz
@type path: str
@param path: A string representation of the fuzzmanager config path
def _layout_for_domfuzz(self, path):
"""
Update directory to work with DOMFuzz
@type path: str
@param path: A string representation of the fuzzmana... |
Write fuzzmanager config file for selected build
@type path: basestring
@param path: A string representation of the fuzzmanager config path
def _write_fuzzmanagerconf(self, path):
"""
Write fuzzmanager config file for selected build
@type path: basestring
@param path: ... |
Download and extract a zip artifact
@type suffix:
@param suffix:
@type path:
@param path:
def extract_zip(self, suffix, path='.'):
"""
Download and extract a zip artifact
@type suffix:
@param suffix:
@type path:
@param path:
""... |
Extract builds with .tar.(*) extension
When unpacking a build archive, only extract the firefox directory
@type suffix:
@param suffix:
@type path:
@param path:
def extract_tar(self, suffix, path='.'):
"""
Extract builds with .tar.(*) extension
When unpa... |
Download Android .apk
@type path:
@param path:
def download_apk(self, path='.'):
"""
Download Android .apk
@type path:
@param path:
"""
apk_fd, apk_fn = tempfile.mkstemp(prefix='fuzzfetch-', suffix='.apk')
os.close(apk_fd)
try:
... |
Extract builds with .dmg extension
Will only work if `hdiutil` is available.
@type path:
@param path:
def extract_dmg(self, path='.'):
"""
Extract builds with .dmg extension
Will only work if `hdiutil` is available.
@type path:
@param path:
""... |
Construct a Fetcher from given command line arguments.
@type args: list(str)
@param args: Command line arguments (optional). Default is to use args from sys.argv
@type skip_dir_check: bool
@param skip_dir_check: Boolean identifying whether to check for existing build directory
... |
fuzzfetch main entry point
Run with --help for usage
def main(cls):
"""
fuzzfetch main entry point
Run with --help for usage
"""
log_level = logging.INFO
log_fmt = '[%(asctime)s] %(message)s'
if bool(os.getenv('DEBUG')):
log_level = logging.... |
Get the original response for comparing, confirm ``is_cookie_necessary``
def init_original_response(self):
"""Get the original response for comparing, confirm ``is_cookie_necessary``"""
if 'json' in self.request:
self.request['data'] = json.dumps(self.request.pop('json')).encode(
... |
Get the original response for comparing, confirm is_cookie_necessary
def init_original_response(self):
"""Get the original response for comparing, confirm is_cookie_necessary"""
no_cookie_resp = None
self.is_cookie_necessary = True
if 'json' in self.request:
self.request['da... |
Do nothing but sort the params of url.
raw_url: the raw url to be sorted;
kwargs: (optional) same kwargs for ``sorted``.
def sort_url_qsl(cls, raw_url, **kwargs):
"""Do nothing but sort the params of url.
raw_url: the raw url to be sorted;
kwargs: (optional) ... |
Only clean the url params and return self.
def clean_url(self):
"""Only clean the url params and return self."""
raw_url = self.request['url']
parsed_url = urlparse(raw_url)
qsl = parse_qsl(parsed_url.query)
for qs in qsl:
new_url = self._join_url(parsed_url,
... |
Only clean the post-data and return self.
Including form-data / bytes-data / json-data.
def clean_post_data(self):
"""Only clean the post-data and return self.
Including form-data / bytes-data / json-data."""
data = self.request.get('data')
if not (data and s... |
Only clean the cookie from headers and return self.
def clean_cookie(self):
"""Only clean the cookie from headers and return self."""
if not self.is_cookie_necessary:
return self
headers = self.request.get('headers', {})
cookies = SimpleCookie(headers['Cookie'])
for ... |
Only clean the headers (cookie include) and return self.
def clean_headers(self):
"""Only clean the headers (cookie include) and return self."""
if not isinstance(self.request.get('headers'), dict):
return self
headers = self.request['headers']
if 'Cookie' in headers:
... |
Remove the non-sense args from the self.ignore, return self.new_request
def reset_new_request(self):
"""Remove the non-sense args from the self.ignore, return self.new_request"""
raw_url = self.new_request['url']
parsed_url = urlparse(raw_url)
qsl = parse_qsl(parsed_url.query)
n... |
Whole task, clean_all + reset_new_request, return self.new_request.
def result(self):
"""Whole task, clean_all + reset_new_request, return self.new_request."""
if not self.tasks:
self.clean_all()
tasks_length = len(self.tasks)
self.logger_function(
'%s tasks of r... |
Property return key-value json-string from __slots__.
def as_json(self, ensure_ascii=False):
"""Property return key-value json-string from __slots__."""
return json.dumps(self.as_dict, ensure_ascii=ensure_ascii) |
the main entry point for the HelpMe Command line application. Currently,
the user can request help or set config values for a particular helper.
def main():
'''the main entry point for the HelpMe Command line application. Currently,
the user can request help or set config values for a particular help... |
Get value stored in cache file or store there default value.
:param key:
:param default_value:
:return:
def get_or_save_default(self, key, default_value):
"""
Get value stored in cache file or store there default value.
:param key:
:param default_value:
:... |
Save overlay to dicom.
def saveOverlayToDicomCopy(input_dcmfilelist, output_dicom_dir, overlays,
crinfo, orig_shape):
""" Save overlay to dicom. """
from . import datawriter as dwriter
# import qmisc
if not os.path.exists(output_dicom_dir):
os.makedirs(output_dicom_d... |
Create path with "_segmentation" suffix and keep extension.
:param path:
:return:
def __get_segmentation_path(self, path):
""" Create path with "_segmentation" suffix and keep extension.
:param path:
:return:
"""
startpath, ext = os.path.splitext(path)
... |
:param data3d: input ndarray data
:param path: output path, to specify slice number advanced formatting options (like {:06d}) can be used
Check function filename_format() for more details.
:param metadata: {'voxelsize_mm': [1, 1, 1]}
:param filetype: dcm, vtk, rawiv, image_stack
... |
There is a bug in simple ITK for Z axis in 3D images. This is a fix
:param path:
:param metadata:
:return:
def _fix_sitk_bug(self, path, metadata):
"""
There is a bug in simple ITK for Z axis in 3D images. This is a fix
:param path:
:param metadata:
:retu... |
Function make 3D data from dicom file slices
:dcmfilelist list of sorted .dcm files
:overlays dictionary of binary overlays. {1:np.array([...]), 3:...}
:out_dir output directory
def DataCopyWithOverlay(self, dcmfilelist, out_dir, overlays):
"""
Function make 3D data from dicom ... |
Function adds overlay to existing file.
def add_overlay_to_slice_file(
self,
filename,
overlay,
i_overlay,
filename_out=None
):
""" Function adds overlay to existing file.
"""
if filename_out is None:
filename_out = filename
filena... |
Flags a method as deprecated.
:param instructions: A human-friendly string of instructions, such as: 'Please migrate to add_proxy() ASAP.'
:return: DeprecatedWarning
def deprecated(instructions):
"""
Flags a method as deprecated.
:param instructions: A human-friendly string of instructions, such ... |
Logs a message only when logging level is verbose.
:param str|list[str] message: The message.
def log_verbose(self, message):
"""
Logs a message only when logging level is verbose.
:param str|list[str] message: The message.
"""
if self.get_verbosity() >= Output.VERBOSI... |
Logs a message only when logging level is very verbose.
:param str|list[str] message: The message.
def log_very_verbose(self, message):
"""
Logs a message only when logging level is very verbose.
:param str|list[str] message: The message.
"""
if self.get_verbosity() >=... |
Get a feed
Arguments:
config -- the configuration
url -- The URL of the feed
retval -- a tuple of feed,previous_version,changed
async def get_feed(config, url):
""" Get a feed
Arguments:
config -- the configuration
url -- The URL of the feed
retval -- a tuple of feed,previous_... |
Returns the known namespace of the RFC5005 extension, if any
def archive_namespace(self):
""" Returns the known namespace of the RFC5005 extension, if any """
try:
for ns_prefix, url in self.feed.namespaces.items():
if url == 'http://purl.org/syndication/history/1.0':
... |
Given a parsed feed, return the links to its entries, including ones
which disappeared (as a quick-and-dirty way to support deletions)
def entry_links(self):
""" Given a parsed feed, return the links to its entries, including ones
which disappeared (as a quick-and-dirty way to support deletions... |
Given a parsed feed, returns True if this is an archive feed
def is_archive(self):
""" Given a parsed feed, returns True if this is an archive feed """
ns_prefix = self.archive_namespace
if ns_prefix:
if ns_prefix + '_archive' in self.feed.feed:
# This is declared t... |
Update WebSub hub to know about this feed
async def update_websub(self, config, hub):
""" Update WebSub hub to know about this feed """
try:
LOGGER.debug("WebSub: Notifying %s of %s", hub, self.url)
request = await utils.retry_post(
config,
hub,
... |
Returns a list of tags.
@param str name: The name of the tag.
:rtype: list[str]
def get_tags(self, name):
"""
Returns a list of tags.
@param str name: The name of the tag.
:rtype: list[str]
"""
tags = list()
for tag in self._tags:
... |
Removes leading empty lines from a list of lines.
:param list[str] lines: The lines.
def __remove_leading_empty_lines(lines):
"""
Removes leading empty lines from a list of lines.
:param list[str] lines: The lines.
"""
tmp = list()
empty = True
for i in... |
Removes leading empty lines from a list of lines.
:param list[str] lines: The lines.
def __remove_trailing_empty_lines(lines):
"""
Removes leading empty lines from a list of lines.
:param list[str] lines: The lines.
"""
lines.reverse()
tmp = DocBlockReflection.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.