text stringlengths 81 112k |
|---|
Convert SitemapIndex into a string.
def to_string(self):
"""Convert SitemapIndex into a string."""
root = etree.Element('sitemapindex', nsmap={None: SITEMAP_NS})
for sitemap in self.sitemaps:
sm = etree.SubElement(root, 'sitemap')
etree.SubElement(sm, 'loc').text = sitem... |
Add a new url to the sitemap.
This function can either be called with a :class:`UrlEntry`
or some keyword and positional arguments that are forwarded to
the :class:`UrlEntry` constructor.
def add_url(self, *args, **kwargs):
"""Add a new url to the sitemap.
This function can ei... |
Convert the sitemap into a string.
def to_string(self):
"""Convert the sitemap into a string."""
root = etree.Element('urlset', nsmap={None: SITEMAP_NS})
for url in self.urls:
url.generate(root)
return etree.tostring(root, pretty_print=True, xml_declaration=True,
... |
Create <url> element under root_element.
def generate(self, root_element=None):
"""Create <url> element under root_element."""
if root_element is not None:
url = etree.SubElement(root_element, 'url')
else:
url = etree.Element('url')
etree.SubElement(url, 'loc').t... |
Creates a :py:class:`Queue` object and a co-routine yielding from that
queue. The queue should be populated with 2-tuples of the form `(command,
message)`, where `command` is one of [`msg`, `end`].
When the `end` command is recieved, the co-routine returns, ending the
stream.
When a `msg` command ... |
Determine if given url is a page that should be in sitemap.
def notblocked(page):
"""Determine if given url is a page that should be in sitemap."""
for blocked in PAGES_TO_BLOCK:
if blocked[0] != '*':
blocked = '*' + blocked
rx = re.compile(blocked.replace('*', '[^$]*'))
if ... |
Return a sitemap xml file for search engines.
def sitemap(request):
"""Return a sitemap xml file for search engines."""
xml = Sitemap()
author = request.matchdict.get('from_id')
if author is not None:
match = "AND '{}' = authors[1]".format(author)
else:
match = ''
with db_conne... |
Return a sitemap index xml file for search engines.
def sitemap_index(request):
"""Return a sitemap index xml file for search engines."""
sitemaps = []
with db_connect() as db_connection:
with db_connection.cursor() as cursor:
cursor.execute("""\
SELECT authors[1], max(r... |
Calculate the volume of a polygon revolved around an axis
The volume estimation assumes rotational symmetry.
Green`s theorem and the Gaussian divergence theorem allow to
formulate the volume as a line integral.
Parameters
----------
cont: ndarray or list of ndarrays of shape (N,2)
A 2D... |
Put contour coordinates into counter-clockwise order
Parameters
----------
cx, cy: 1d ndarrays
The x- and y-coordinates of the contour
Returns
-------
cx_cc, cy_cc:
The x- and y-coordinates of the contour in
counter-clockwise orientation.
def counter_clockwise(cx, cy):... |
Add track/sector list
def add_metadata_sectors(self, vtoc, sector_list, header):
"""Add track/sector list
"""
tslist = BaseSectorList(header)
for start in range(0, len(sector_list), header.ts_pairs):
end = min(start + header.ts_pairs, len(sector_list))
if _xd: lo... |
Return all subjects (tags) in the database except "internal" scheme.
def _get_subject_list_generator(cursor):
"""Return all subjects (tags) in the database except "internal" scheme."""
subject = None
last_tagid = None
cursor.execute(SQL['get-subject-list'])
for s in cursor.fetchall():
tagid... |
Return a dict with archive metadata for webview.
def extras(request):
"""Return a dict with archive metadata for webview."""
key = request.matchdict.get('key', '').lstrip('/')
key_map = {
'languages': _get_available_languages_and_count,
'subjects': _get_subject_list,
'featured': _ge... |
Run a function call for `delay` seconds, and raise a RuntimeError
if the operation didn't complete.
def timeout(delay, call, *args, **kwargs):
"""Run a function call for `delay` seconds, and raise a RuntimeError
if the operation didn't complete."""
return_value = None
def target():
nonloca... |
Create an argument parser with the given ``name`` and ``description``.
The name is used to make ``cnx-archive-<name>`` program name.
This creates and returns a parser with
the ``config_uri`` argument declared.
def create_parser(name, description=None):
"""Create an argument parser with the given ``nam... |
Parse ``argparse`` style arguments into app settings.
Given an ``argparse`` set of arguments as ``args``
parse the arguments to return the application settings.
This assumes the parser was created using ``create_parser``.
def get_app_settings_from_arguments(args):
"""Parse ``argparse`` style arguments... |
Checks if port is open on host. This is used to check if the
Xenon-GRPC server is running.
def check_socket(host, port):
"""Checks if port is open on host. This is used to check if the
Xenon-GRPC server is running."""
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
retu... |
Try to connect over a secure channel.
def get_secure_channel(crt_file, key_file, port=50051):
"""Try to connect over a secure channel."""
creds = grpc.ssl_channel_credentials(
root_certificates=open(str(crt_file), 'rb').read(),
private_key=open(str(key_file), 'rb').read(),
certificate_... |
Finds a free port.
def find_free_port():
"""Finds a free port."""
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
sock.bind(('', 0))
return sock.getsockname()[1] |
Print stream from file to logger.
def print_stream(file, name):
"""Print stream from file to logger."""
logger = logging.getLogger('xenon.{}'.format(name))
for line in file:
logger.info('[{}] {}'.format(name, line.strip())) |
Start the Xenon GRPC server on the specified port, or, if a service
is already running on that port, connect to that.
If no port is given, a random port is selected. This means that, by
default, every python instance will start its own instance of a xenon-grpc
process.
:param port: the port number... |
Add cors headers needed for web app implementation.
def add_cors_headers(request, response):
"""Add cors headers needed for web app implementation."""
response.headerlist.append(('Access-Control-Allow-Origin', '*'))
response.headerlist.append(
('Access-Control-Allow-Methods', 'GET, OPTIONS'))
r... |
Initializes the trace data
def trace(self):
"""Initializes the trace data"""
if self._trace is None:
self._trace = self.load_trace(self.mname)
return self._trace |
Loads the traces and returns them as a dictionary
Currently, only loading traces from tdms files is supported.
This forces us to load the full tdms file into memory which
takes some time.
def load_trace(mname):
"""Loads the traces and returns them as a dictionary
Currently, on... |
Tries to find the traces tdms file name
Returns None if no trace file is found.
def find_trace_file(mname):
"""Tries to find the traces tdms file name
Returns None if no trace file is found.
"""
mname = pathlib.Path(mname)
tname = None
if mname.exists():
... |
This function fetches a docker secret
:param name: the name of the docker secret
:param default: the default value if no secret found
:param cast_to: casts the value to the given type
:param autocast_name: whether the name should be lowercase for secrets and upper case for environment
:param getenv... |
Takes an argument and updates the hash.
The argument can be an np.array, string, or list
of things that are convertable to strings.
def _update_hash(self, arg):
""" Takes an argument and updates the hash.
The argument can be an np.array, string, or list
of things that are conver... |
Remove all cached objects
def clear_cache():
"""Remove all cached objects"""
del Cache._keys
for k in list(Cache._cache.keys()):
it = Cache._cache.pop(k)
del it
del Cache._cache
Cache._keys = []
Cache._cache = {}
gc.collect() |
Get index (into the raw data of the disk image) of start of sector
This base class method assumes the sectors are one after another, in
order starting from the beginning of the raw data.
def get_pos(self, sector):
"""Get index (into the raw data of the disk image) of start of sector
T... |
Get contiguous sectors
:param start: first sector number to read (note: numbering starts from 1)
:param end: last sector number to read
:returns: bytes
def get_sector_slice(self, start, end=None):
""" Get contiguous sectors
:param start: first sector number to ... |
Get contiguous sectors
:param start: first sector number to read (note: numbering starts from 1)
:param end: last sector number to read
:returns: bytes
def get_sectors(self, start, end=None):
""" Get contiguous sectors
:param start: first sector number to read ... |
Write data to a file on disk
This throws various exceptions on failures, for instance if there is
not enough space on disk or a free entry is not available in the
catalog.
def write_file(self, filename, filetype, data):
"""Write data to a file on disk
This throws various excep... |
Helper function for transforming an aray to log-scale
Parameters
----------
a: np.ndarray
Input array
scale:
If set to "log", take the logarithm of `a`; if set to
"linear" return `a` unchanged.
Returns
-------
b: np.ndarray
... |
All available features
def features(self):
"""All available features"""
mycols = []
for col in dfn.feature_names:
if col in self:
mycols.append(col)
mycols.sort()
return mycols |
Downsampling by removing points at dense locations
Parameters
----------
xax: str
Identifier for x axis (e.g. "area_um", "aspect", "deform")
yax: str
Identifier for y axis
downsample: int
Number of points to draw in the down-sampled plot.
... |
Evaluate the kernel density estimate for contour plots
Parameters
----------
xax: str
Identifier for X axis (e.g. "area_um", "aspect", "deform")
yax: str
Identifier for Y axis
xacc: float
Contour accuracy in x direction
yacc: float
... |
Evaluate the kernel density estimate for scatter plots
Parameters
----------
xax: str
Identifier for X axis (e.g. "area_um", "aspect", "deform")
yax: str
Identifier for Y axis
positions: list of two 1d ndarrays or ndarray of shape (2, N)
The p... |
Associate a Polygon Filter with this instance
Parameters
----------
filt: int or instance of `PolygonFilter`
The polygon filter to add
def polygon_filter_add(self, filt):
"""Associate a Polygon Filter with this instance
Parameters
----------
filt: i... |
Remove a polygon filter from this instance
Parameters
----------
filt: int or instance of `PolygonFilter`
The polygon filter to remove
def polygon_filter_rm(self, filt):
"""Remove a polygon filter from this instance
Parameters
----------
filt: int o... |
Check whether a dataset is complete
Parameters
----------
path_or_ds: str or RTDCBase
Full path to a dataset on disk or an instance of RTDCBase
Returns
-------
violations: list of str
Dataset format violations (hard)
alerts: list of str
Dataset format alerts (soft)
... |
Initialize a new RT-DC dataset
Parameters
----------
data:
can be one of the following:
- dict
- .tdms file
- .rtdc file
- subclass of `RTDCBase`
(will create a hierarchy child)
identifier: str
A unique identifier for this dataset. If set to `N... |
Parse ``log`` buffer based on ``url_pattern``.
Given a buffer as ``log``, parse the log buffer into
a mapping of ident-hashes to a hit count,
the timestamp of the initial log,
and the last timestamp in the log.
def parse_log(log, url_pattern):
"""Parse ``log`` buffer based on ``url_pattern``.
... |
Count the hits from logfile.
def main(argv=None):
"""Count the hits from logfile."""
parser = create_parser('hits_counter', description=__doc__)
parser.add_argument('--hostname', default='cnx.org',
help="hostname of the site (default: cnx.org)")
parser.add_argument('--log-format... |
boolean
def fbool(value):
"""boolean"""
if isinstance(value, str_types):
value = value.lower()
if value == "false":
value = False
elif value == "true":
value = True
elif value:
value = bool(float(value))
else:
raise ValueEr... |
integer
def fint(value):
"""integer"""
if isinstance(value, str_types):
# strings might have been saved wrongly as booleans
value = value.lower()
if value == "false":
value = 0
elif value == "true":
value = 1
elif value:
value = int(fl... |
A list of integers
def fintlist(alist):
"""A list of integers"""
outlist = []
if not isinstance(alist, (list, tuple)):
# we have a string (comma-separated integers)
alist = alist.strip().strip("[] ").split(",")
for it in alist:
if it:
outlist.append(fint(it))
ret... |
Exports filtered event images to an avi file
Parameters
----------
path: str
Path to a .tsv file. The ending .tsv is added automatically.
filtered: bool
If set to `True`, only the filtered data (index in ds._filter)
are used.
override: bool
... |
Export the data of an RT-DC dataset to an .fcs file
Parameters
----------
mm: instance of dclab.RTDCBase
The dataset that will be exported.
path: str
Path to a .tsv file. The ending .tsv is added automatically.
features: list of str
The featur... |
Export the data of the current instance to an HDF5 file
Parameters
----------
path: str
Path to an .rtdc file. The ending .rtdc is added
automatically.
features: list of str
The features in the resulting .tsv file. These are strings
that a... |
Export the data of the current instance to a .tsv file
Parameters
----------
path: str
Path to a .tsv file. The ending .tsv is added automatically.
features: list of str
The features in the resulting .tsv file. These are strings
that are defined in `d... |
Compute md5 hex-hash of a file
Parameters
----------
fname: str
path to the file
blocksize: int
block size in bytes read from the file
(set to `0` to hash the entire file)
count: int
number of blocks read from the file
def hashfile(fname, blocksize=65536, count=0):
... |
String representation of an object for hashing
def obj2str(obj):
"""String representation of an object for hashing"""
if isinstance(obj, str_types):
return obj.encode("utf-8")
elif isinstance(obj, pathlib.Path):
return obj2str(str(obj))
elif isinstance(obj, (bool, int, float)):
... |
Creates a self-signed certificate key pair.
def create_self_signed_cert():
"""Creates a self-signed certificate key pair."""
config_dir = Path(BaseDirectory.xdg_config_home) / 'xenon-grpc'
config_dir.mkdir(parents=True, exist_ok=True)
key_prefix = gethostname()
crt_file = config_dir / ('%s.crt' % ... |
Get the project name from a path.
For a path "/home/peter/hans/HLC12398/online/M1_13.tdms" or
For a path "/home/peter/hans/HLC12398/online/data/M1_13.tdms" or
without the ".tdms" file, this will return always "HLC12398".
Parameters
----------
path: str
path to tdms file
append_mx: ... |
Recursively find projects based on '.tdms' file endings
Searches the `directory` recursively and return a sorted list
of all found '.tdms' project files, except fluorescence
data trace files which end with `_traces.tdms`.
def get_tdms_files(directory):
"""Recursively find projects based on '.tdms' fil... |
Initializes the current RT-DC dataset with a tdms file.
def _init_data_with_tdms(self, tdms_filename):
"""Initializes the current RT-DC dataset with a tdms file.
"""
tdms_file = TdmsFile(str(tdms_filename))
# time is always there
table = "Cell Track"
# Edit naming.dclab2... |
Hash value based on file name and .ini file content
def hash(self):
"""Hash value based on file name and .ini file content"""
if self._hash is None:
# Only hash _camera.ini and _para.ini
fsh = [self.path.with_name(self._mid + "_camera.ini"),
self.path.with_nam... |
Determines the offset of the contours w.r.t. other data columns
Notes
-----
- the "frame" column of `rtdc_dataset` is compared to
the first contour in the contour text file to determine an
offset by one event
- modifies the property `event_offset` and sets `_initial... |
Tries to find a contour file that belongs to an RTDC dataset
Returns None if no contour file is found.
def find_contour_file(rtdc_dataset):
"""Tries to find a contour file that belongs to an RTDC dataset
Returns None if no contour file is found.
"""
cont_id = rtdc_dataset.path... |
Open and index the contour file
This function populates the internal list of contours
as strings which will be available as `self.data`.
def _index_file(self):
"""Open and index the contour file
This function populates the internal list of contours
as strings which will be ava... |
Return the frame number of a contour
def get_frame(self, idx):
"""Return the frame number of a contour"""
cont = self.data[idx]
frame = int(cont.strip().split(" ", 1)[0])
return frame |
Returns the viscosity for RT-DC-specific media
Parameters
----------
medium: str
The medium to compute the viscosity for.
One of ["CellCarrier", "CellCarrier B", "water"].
channel_width: float
The channel width in µm
flow_rate: float
Flow rate in µl/s
temperature... |
Compute statistics for an RT-DC dataset
Parameters
----------
ds: dclab.rtdc_dataset.RTDCBase
The dataset for which to compute the statistics.
methods: list of str or None
The methods wih which to compute the statistics.
The list of available methods is given with
`dclab... |
Compute an intelligent value for the mode
The most common value in experimental is not very useful if there
are a lot of digits after the comma. This method approaches this
issue by rounding to bin size that is determined by the
Freedman–Diaconis rule.
Parameters
----------
data: 1d ndarra... |
Convenience wrapper to get statistics data
def _get_data(self, kwargs):
"""Convenience wrapper to get statistics data"""
if "ds" not in kwargs:
raise ValueError("Keyword argument 'ds' missing.")
ds = kwargs["ds"]
if self.req_feature:
if "feature" not in kwargs:... |
Return filtered feature data
The features are filtered according to the user-defined filters,
using the information in `ds._filter`. In addition, all
`nan` and `inf` values are purged.
Parameters
----------
ds: dclab.rtdc_dataset.RTDCBase
The dataset contain... |
Retrieve the exception
def get_exception(self):
"""Retrieve the exception"""
if self.exc_info:
try:
six.reraise(*self.exc_info)
except Exception as e:
return e |
Makes sure there aren't any SAM resources in a template that will be used in a CloudFormation StackSet
:return: bool
def check_global_valid(self):
"""
Makes sure there aren't any SAM resources in a template that will be used in a CloudFormation StackSet
:return: bool
"""
... |
Checks if a CloudFormation stack with given name exists
:param stack_name: Name or ID of the stack
:return: True if stack exists. False otherwise
def has_stack(self, stack_name):
"""
Checks if a CloudFormation stack with given name exists
:param stack_name: Name or ID of the sta... |
Check whether flyweight object with specified key has already been created.
Returns:
bool: True if already created, False if not
def has_key(cls, *args):
"""
Check whether flyweight object with specified key has already been created.
Returns:
bool: True if alre... |
Return flyweight object with specified key, if it has already been created.
Returns:
cls or None: Previously constructed flyweight object with given
key or None if key not found
def from_key(cls, *args):
"""
Return flyweight object with specified key, if it has already ... |
Write the metric to elasticsearch
Args:
name (str): The name of the metric to write
data (dict): Additional data to store with the metric
def write(self, name, **data):
"""
Write the metric to elasticsearch
Args:
name (str): The name of the metric t... |
Write multiple metrics to elasticsearch in one request
Args:
metrics (list): data with mappings to send to elasticsearch
def bulk_write(self, metrics):
"""
Write multiple metrics to elasticsearch in one request
Args:
metrics (list): data with mappings to send t... |
Compute avg and/or std of the event brightness
The event brightness is defined by the gray-scale values of the
image data within the event mask area.
Parameters
----------
mask: ndarray or list of ndarrays of shape (M,N) and dtype bool
The mask values, True where the event is located in `i... |
Search archive contents.
Look up search results in cache, if not in cache,
do a database search and cache the result
def search(query, query_type, nocache=False):
"""Search archive contents.
Look up search results in cache, if not in cache,
do a database search and cache the result
"""
se... |
Determine available features for an RT-DC dataset
Parameters
----------
rtdc_ds: instance of RTDCBase
The dataset to check availability for
Returns
-------
features: dict
Dictionary with feature names as keys and instances
of `Ancilla... |
Compute the feature with self.method
Parameters
----------
rtdc_ds: instance of RTDCBase
The dataset to compute the feature for
Returns
-------
feature: array- or list-like
The computed data feature (read-only).
def compute(self, rtdc_ds):
... |
Return all all instances that compute `feature_name`
def get_instances(feature_name):
"""Return all all instances that compute `feature_name`"""
feats = []
for ft in AncillaryFeature.features:
if ft.feature_name == feature_name:
feats.append(ft)
return feats |
Used for identifying an ancillary computation
The data columns and the used configuration keys/values
are hashed.
def hash(self, rtdc_ds):
"""Used for identifying an ancillary computation
The data columns and the used configuration keys/values
are hashed.
"""
h... |
Check whether the feature is available
Parameters
----------
rtdc_ds: instance of RTDCBase
The dataset to check availability for
Returns
-------
available: bool
`True`, if feature can be computed with `compute`
Notes
-----
... |
:raises: kafka.errors.NoBrokersAvailable if the connection is broken
def producer(self):
"""
:raises: kafka.errors.NoBrokersAvailable if the connection is broken
"""
if self._producer:
return self._producer
self._producer = KafkaProducer(
bootstrap_serve... |
Write the metric to kafka
Args:
name (str): The name of the metric to write
data (dict): Additional data to store with the metric
def write(self, name, **data):
"""
Write the metric to kafka
Args:
name (str): The name of the metric to write
... |
Write multiple metrics to kafka in one request
Args:
metrics (list):
def bulk_write(self, metrics):
"""
Write multiple metrics to kafka in one request
Args:
metrics (list):
"""
try:
for metric in metrics:
self.produce... |
Build the text of the file and write the file.
def create_module_file(package, module, opts):
"""Build the text of the file and write the file."""
if not opts.noheadings:
text = format_heading(1, '%s module' % module)
else:
text = ''
# text += format_heading(2, ':mod:`%s` Module' % modu... |
Build the text of the file and write the file.
def create_package_file(root, master_package, subroot, py_files, opts, subs):
"""Build the text of the file and write the file."""
text = format_heading(1, '%s' % makename(master_package, subroot))
if opts.modulefirst:
text += format_directive(subroot... |
Check if we want to skip this module.
def shall_skip(module, opts):
"""Check if we want to skip this module."""
# skip it if there is nothing (or just \n or \r\n) in the file
if path.getsize(module) <= 2:
return True
# skip if it has a "private" name and this is selected
filename = path.bas... |
Use threads and a subproc to bodge a timeout on top of filesystem access
def safe_stat(path, timeout=1, cmd=None):
"Use threads and a subproc to bodge a timeout on top of filesystem access"
global safe_stat_process
if cmd is None:
cmd = ['/usr/bin/stat']
cmd.append(path)
def target():
... |
Get the names of all polygon filters in the order of creation
def get_polygon_filter_names():
"""Get the names of all polygon filters in the order of creation"""
names = []
for p in PolygonFilter.instances:
names.append(p.name)
return names |
Check if the data given is valid
def _check_data(self):
"""Check if the data given is valid"""
if self.axes is None:
raise PolygonFilterError("`axes` parm not set.")
if self.points is None:
raise PolygonFilterError("`points` parm not set.")
self.points = np.array... |
Import all filters from a text file
def _load(self, filename):
"""Import all filters from a text file"""
filename = pathlib.Path(filename)
with filename.open() as fd:
data = fd.readlines()
# Get the strings that correspond to self.fileid
bool_head = [l.strip().start... |
Define a unique id
def _set_unique_id(self, unique_id):
"""Define a unique id"""
assert isinstance(unique_id, int), "unique_id must be an integer"
if PolygonFilter.instace_exists(unique_id):
newid = max(PolygonFilter._instance_counter, unique_id+1)
msg = "PolygonFilter ... |
Return a copy of the current instance
Parameters
----------
invert: bool
The copy will be inverted w.r.t. the original
def copy(self, invert=False):
"""Return a copy of the current instance
Parameters
----------
invert: bool
The copy wil... |
Filter a set of datax and datay according to `self.points`
def filter(self, datax, datay):
"""Filter a set of datax and datay according to `self.points`"""
f = np.ones(datax.shape, dtype=bool)
for i, p in enumerate(zip(datax, datay)):
f[i] = PolygonFilter.point_in_poly(p, self.point... |
Get an instance of the `PolygonFilter` using a unique id
def get_instance_from_id(unique_id):
"""Get an instance of the `PolygonFilter` using a unique id"""
for instance in PolygonFilter.instances:
if instance.unique_id == unique_id:
return instance
# if this does no... |
Import all polygons from a .poly file.
Returns a list of the imported polygon filters
def import_all(path):
"""Import all polygons from a .poly file.
Returns a list of the imported polygon filters
"""
plist = []
fid = 0
while True:
try:
... |
Determine whether a point is within a polygon area
Uses the ray casting algorithm.
Parameters
----------
p: float
Coordinates of the point
poly: array_like of shape (N, 2)
Polygon (`PolygonFilter.points`)
Returns
-------
inside: ... |
Remove a polygon filter from `PolygonFilter.instances`
def remove(unique_id):
"""Remove a polygon filter from `PolygonFilter.instances`"""
for p in PolygonFilter.instances:
if p.unique_id == unique_id:
PolygonFilter.instances.remove(p) |
Save all data to a text file (appends data if file exists).
Polyfile can be either a path to a file or a file object that
was opened with the write "w" parameter. By using the file
object, multiple instances of this class can write their data.
If `ret_fobj` is `True`, then the file obj... |
Save all polygon filters
def save_all(polyfile):
"""Save all polygon filters"""
nump = len(PolygonFilter.instances)
if nump == 0:
raise PolygonFilterError("There are not polygon filters to save.")
for p in PolygonFilter.instances:
# we return the ret_obj, so we d... |
Retrieve a file's data.
def get_resource(request):
"""Retrieve a file's data."""
hash = request.matchdict['hash']
# Do the file lookup
with db_connect() as db_connection:
with db_connection.cursor() as cursor:
args = dict(hash=hash)
cursor.execute(SQL['get-resource'], a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.