INSTRUCTION stringlengths 1 46.3k | RESPONSE stringlengths 75 80.2k |
|---|---|
Setter method for multicast_ssm_mapping, mapped from YANG variable /igmp_snooping_state/multicast_ssm_mapping (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_multicast_ssm_mapping is considered as a private
method. Backends looking to populate this variable shoul... | def _set_multicast_ssm_mapping(self, v, load=False):
"""
Setter method for multicast_ssm_mapping, mapped from YANG variable /igmp_snooping_state/multicast_ssm_mapping (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_multicast_ssm_mapping is considered as a pri... |
Setter method for igmp_statistics, mapped from YANG variable /igmp_snooping_state/igmp_statistics (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_igmp_statistics is considered as a private
method. Backends looking to populate this variable should
do so via ca... | def _set_igmp_statistics(self, v, load=False):
"""
Setter method for igmp_statistics, mapped from YANG variable /igmp_snooping_state/igmp_statistics (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_igmp_statistics is considered as a private
method. Backend... |
Setter method for debug_igmp, mapped from YANG variable /igmp_snooping_state/debug_igmp (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_debug_igmp is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._... | def _set_debug_igmp(self, v, load=False):
"""
Setter method for debug_igmp, mapped from YANG variable /igmp_snooping_state/debug_igmp (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_debug_igmp is considered as a private
method. Backends looking to populat... |
Setter method for igmp_interface_statistics, mapped from YANG variable /igmp_snooping_state/igmp_interface_statistics (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_igmp_interface_statistics is considered as a private
method. Backends looking to populate this va... | def _set_igmp_interface_statistics(self, v, load=False):
"""
Setter method for igmp_interface_statistics, mapped from YANG variable /igmp_snooping_state/igmp_interface_statistics (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_igmp_interface_statistics is con... |
Setter method for af_ipv4_neighbor_addr, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv4/ipv4_unicast/af_vrf/neighbor/af_ipv4_vrf_neighbor_address_holder/af_ipv4_neighbor_addr (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_af_ipv4_neighbor_add... | def _set_af_ipv4_neighbor_addr(self, v, load=False):
"""
Setter method for af_ipv4_neighbor_addr, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv4/ipv4_unicast/af_vrf/neighbor/af_ipv4_vrf_neighbor_address_holder/af_ipv4_neighbor_addr (list)
If this variable is read-only (config: f... |
Helper function for spatial lookups filters.
Provide spatial lookup types as keywords without underscores instead of the
usual "geometryfield__lookuptype" format. | def filter_geometry(queryset, **filters):
"""Helper function for spatial lookups filters.
Provide spatial lookup types as keywords without underscores instead of the
usual "geometryfield__lookuptype" format.
"""
fieldname = geo_field(queryset).name
query = {'%s__%s' % (fieldname, k): v for k, v... |
Returns the GeometryField for a django or spillway GeoQuerySet. | def geo_field(queryset):
"""Returns the GeometryField for a django or spillway GeoQuerySet."""
for field in queryset.model._meta.fields:
if isinstance(field, models.GeometryField):
return field
raise exceptions.FieldDoesNotExist('No GeometryField found') |
Returns the GeoQuerySet spatial reference identifier. | def get_srid(queryset):
"""Returns the GeoQuerySet spatial reference identifier."""
try:
srid = list(six.viewvalues(queryset.query.annotations))[0].srid
except (AttributeError, IndexError):
srid = None
return srid or geo_field(queryset).srid |
Returns a 1D array with higher dimensions aggregated using stat fn.
Arguments:
arr -- ndarray
stat -- numpy or numpy.ma function as str to call | def agg_dims(arr, stat):
"""Returns a 1D array with higher dimensions aggregated using stat fn.
Arguments:
arr -- ndarray
stat -- numpy or numpy.ma function as str to call
"""
axis = None
if arr.ndim > 2:
axis = 1
arr = arr.reshape(arr.shape[0], -1)
module = np.ma if has... |
Returns the GeoQuerySet extent as a 4-tuple.
Keyword args:
srid -- EPSG id for for transforming the output geometry. | def extent(self, srid=None):
"""Returns the GeoQuerySet extent as a 4-tuple.
Keyword args:
srid -- EPSG id for for transforming the output geometry.
"""
expr = self.geo_field.name
if srid:
expr = geofn.Transform(expr, srid)
expr = models.Extent(expr)
... |
Returns tranlated and scaled geometries suitable for Mapbox vector
tiles. | def pbf(self, bbox, geo_col=None, scale=4096):
"""Returns tranlated and scaled geometries suitable for Mapbox vector
tiles.
"""
col = geo_col or self.geo_field.name
w, s, e, n = bbox.extent
trans = self._trans_scale(col, -w, -s,
scale / (... |
Returns a GeoQuerySet intersecting a tile boundary.
Arguments:
bbox -- tile extent as geometry
Keyword args:
z -- tile zoom level used as basis for geometry simplification
format -- vector tile format as str (pbf, geojson)
clip -- clip geometries to tile boundary as bool... | def tile(self, bbox, z=0, format=None, clip=True):
"""Returns a GeoQuerySet intersecting a tile boundary.
Arguments:
bbox -- tile extent as geometry
Keyword args:
z -- tile zoom level used as basis for geometry simplification
format -- vector tile format as str (pbf, geo... |
Returns a list of ndarrays.
Keyword args:
field_name -- raster field name as str | def arrays(self, field_name=None):
"""Returns a list of ndarrays.
Keyword args:
field_name -- raster field name as str
"""
fieldname = field_name or self.raster_field.name
arrays = []
for obj in self:
arr = getattr(obj, fieldname)
if isins... |
Returns list of ndarrays averaged to a given number of periods.
Arguments:
periods -- desired number of periods as int | def aggregate_periods(self, periods):
"""Returns list of ndarrays averaged to a given number of periods.
Arguments:
periods -- desired number of periods as int
"""
try:
fieldname = self.raster_field.name
except TypeError:
raise exceptions.FieldDoe... |
Returns the raster FileField instance on the model. | def raster_field(self):
"""Returns the raster FileField instance on the model."""
for field in self.model._meta.fields:
if isinstance(field, models.FileField):
return field
return False |
Returns a new RasterQuerySet with subsetted/summarized ndarrays.
Arguments:
geom -- geometry for masking or spatial subsetting
Keyword args:
stat -- any numpy summary stat method as str (min/max/mean/etc) | def summarize(self, geom, stat=None):
"""Returns a new RasterQuerySet with subsetted/summarized ndarrays.
Arguments:
geom -- geometry for masking or spatial subsetting
Keyword args:
stat -- any numpy summary stat method as str (min/max/mean/etc)
"""
if not hasatt... |
Returns a new RasterQuerySet with possibly warped/converted rasters.
Keyword args:
format -- raster file extension format as str
geom -- geometry for masking or spatial subsetting
srid -- spatial reference identifier as int for warping to | def warp(self, srid=None, format=None, geom=None):
"""Returns a new RasterQuerySet with possibly warped/converted rasters.
Keyword args:
format -- raster file extension format as str
geom -- geometry for masking or spatial subsetting
srid -- spatial reference identifier as int f... |
Returns a .zip archive of selected rasters. | def zipfiles(self, path=None, arcdirname='data'):
"""Returns a .zip archive of selected rasters."""
if path:
fp = open(path, 'w+b')
else:
prefix = '%s-' % arcdirname
fp = tempfile.NamedTemporaryFile(prefix=prefix, suffix='.zip')
with zipfile.ZipFile(fp... |
Initializes Steam API library.
:param str|int app_id: Application ID.
:raises: SteamApiStartupError | def init(self, app_id=None):
"""Initializes Steam API library.
:param str|int app_id: Application ID.
:raises: SteamApiStartupError
"""
self.set_app_id(app_id)
err_msg = (
'Unable to initialize. Check Steam client is running '
'and Steam applicat... |
Setter method for gigabitethernet, mapped from YANG variable /interface/gigabitethernet (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_gigabitethernet is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._... | def _set_gigabitethernet(self, v, load=False):
"""
Setter method for gigabitethernet, mapped from YANG variable /interface/gigabitethernet (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_gigabitethernet is considered as a private
method. Backends looking to po... |
Setter method for tengigabitethernet, mapped from YANG variable /interface/tengigabitethernet (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_tengigabitethernet is considered as a private
method. Backends looking to populate this variable should
do so via calling ... | def _set_tengigabitethernet(self, v, load=False):
"""
Setter method for tengigabitethernet, mapped from YANG variable /interface/tengigabitethernet (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_tengigabitethernet is considered as a private
method. Backends l... |
Setter method for fortygigabitethernet, mapped from YANG variable /interface/fortygigabitethernet (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_fortygigabitethernet is considered as a private
method. Backends looking to populate this variable should
do so via ca... | def _set_fortygigabitethernet(self, v, load=False):
"""
Setter method for fortygigabitethernet, mapped from YANG variable /interface/fortygigabitethernet (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_fortygigabitethernet is considered as a private
method. Ba... |
Setter method for hundredgigabitethernet, mapped from YANG variable /interface/hundredgigabitethernet (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_hundredgigabitethernet is considered as a private
method. Backends looking to populate this variable should
do so ... | def _set_hundredgigabitethernet(self, v, load=False):
"""
Setter method for hundredgigabitethernet, mapped from YANG variable /interface/hundredgigabitethernet (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_hundredgigabitethernet is considered as a private
me... |
Setter method for port_channel, mapped from YANG variable /interface/port_channel (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_port_channel is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_port_... | def _set_port_channel(self, v, load=False):
"""
Setter method for port_channel, mapped from YANG variable /interface/port_channel (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_port_channel is considered as a private
method. Backends looking to populate this ... |
Setter method for management, mapped from YANG variable /interface/management (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_management is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_management(... | def _set_management(self, v, load=False):
"""
Setter method for management, mapped from YANG variable /interface/management (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_management is considered as a private
method. Backends looking to populate this variable... |
Setter method for fc_port, mapped from YANG variable /interface/fc_port (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_fc_port is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_fc_port() directly.
... | def _set_fc_port(self, v, load=False):
"""
Setter method for fc_port, mapped from YANG variable /interface/fc_port (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_fc_port is considered as a private
method. Backends looking to populate this variable should
... |
Setter method for fcoe, mapped from YANG variable /interface/fcoe (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_fcoe is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_fcoe() directly.
YANG De... | def _set_fcoe(self, v, load=False):
"""
Setter method for fcoe, mapped from YANG variable /interface/fcoe (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_fcoe is considered as a private
method. Backends looking to populate this variable should
do so via ca... |
Setter method for port_security_mac_address, mapped from YANG variable /interface/port_channel/switchport/port_security/port_security_mac_address (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_port_security_mac_address is considered as a private
method. Backends look... | def _set_port_security_mac_address(self, v, load=False):
"""
Setter method for port_security_mac_address, mapped from YANG variable /interface/port_channel/switchport/port_security/port_security_mac_address (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_port_secu... |
Setter method for filter_change_update_delay, mapped from YANG variable /rbridge_id/filter_change_update_delay (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_filter_change_update_delay is considered as a private
method. Backends looking to populate this variable shou... | def _set_filter_change_update_delay(self, v, load=False):
"""
Setter method for filter_change_update_delay, mapped from YANG variable /rbridge_id/filter_change_update_delay (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_filter_change_update_delay is considered as... |
Setter method for use_vrf, mapped from YANG variable /rbridge_id/ssh/server/ssh_vrf_cont/use_vrf (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_use_vrf is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj.... | def _set_use_vrf(self, v, load=False):
"""
Setter method for use_vrf, mapped from YANG variable /rbridge_id/ssh/server/ssh_vrf_cont/use_vrf (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_use_vrf is considered as a private
method. Backends looking to populate ... |
Download a dict of files to the given directory and modify the path to a docker-friendly one if
requested.
:param dict files: A dictionary of filenames: fsIDs
:param str work_dir: The destination directory
:param bool docker: Should the file path be converted to our standard docker '/data/filename'?
... | def get_files_from_filestore(job, files, work_dir, docker=False):
"""
Download a dict of files to the given directory and modify the path to a docker-friendly one if
requested.
:param dict files: A dictionary of filenames: fsIDs
:param str work_dir: The destination directory
:param bool docker:... |
Given a path, return that files path inside the docker mount directory (/data).
:param str filepath: The path to a file
:param str work_dir: The part of the path to replace with /data
:return: The docker-friendly path for `filepath`
:rtype: str | def docker_path(filepath, work_dir=None):
"""
Given a path, return that files path inside the docker mount directory (/data).
:param str filepath: The path to a file
:param str work_dir: The part of the path to replace with /data
:return: The docker-friendly path for `filepath`
:rtype: str
... |
Gunzips the input file to the same directory
:param input_gzip_file: File to be gunzipped
:return: path to the gunzipped file
:rtype: str | def gunzip(input_gzip_file, block_size=1024):
"""
Gunzips the input file to the same directory
:param input_gzip_file: File to be gunzipped
:return: path to the gunzipped file
:rtype: str
"""
assert os.path.splitext(input_gzip_file)[1] == '.gz'
assert is_gzipfile(input_gzip_file)
wi... |
Attempt to ascertain the gzip status of a file based on the "magic signatures" of the file.
This was taken from the stack overflow post
http://stackoverflow.com/questions/13044562/python-mechanism-to-identify-compressed-file-type\
-and-uncompress
:param str filename: A path to a file
:return: ... | def is_gzipfile(filename):
"""
Attempt to ascertain the gzip status of a file based on the "magic signatures" of the file.
This was taken from the stack overflow post
http://stackoverflow.com/questions/13044562/python-mechanism-to-identify-compressed-file-type\
-and-uncompress
:param str f... |
Download a supplied "URL" that points to a file in the NCBI GDC database. The path to the gdc
download token must be provided. The file is downloaded and written to the jobstore if
requested.
:param str gdc_url: URL for the file (in the form of gdc://<UUID>)
:param str gdc_download_token: Path to the... | def get_file_from_gdc(job, gdc_url, gdc_download_token, write_to_jobstore=True):
"""
Download a supplied "URL" that points to a file in the NCBI GDC database. The path to the gdc
download token must be provided. The file is downloaded and written to the jobstore if
requested.
:param str gdc_url: ... |
Download a supplied URL that points to a file on Amazon S3. If the file is encrypted using
sse-c (with the user-provided key or with a hash of the usesr provided master key) then the
encryption keys will be used when downloading. The file is downloaded and written to the
jobstore if requested.
:param... | def get_file_from_s3(job, s3_url, encryption_key=None, per_file_encryption=True,
write_to_jobstore=True):
"""
Download a supplied URL that points to a file on Amazon S3. If the file is encrypted using
sse-c (with the user-provided key or with a hash of the usesr provided master key) th... |
Download a supplied URL that points to a file on an http, https or ftp server. If the file is
found to be an https s3 link then the file is downloaded using `get_file_from_s3`. The file is
downloaded and written to the jobstore if requested.
Encryption arguments are for passing to `get_file_from_s3` if req... | def get_file_from_url(job, any_url, encryption_key=None, per_file_encryption=True,
write_to_jobstore=True):
"""
Download a supplied URL that points to a file on an http, https or ftp server. If the file is
found to be an https s3 link then the file is downloaded using `get_file_from_s... |
Split an input bam to paired fastqs.
:param str bamfile: Path to a bam file
:param dict univ_options: Dict of universal options used by almost all tools
:param dict picard_options: Dict of options specific to Picard
:return: Path to the _1.fastq file
:rtype: str | def bam2fastq(bamfile, univ_options, picard_options):
"""
Split an input bam to paired fastqs.
:param str bamfile: Path to a bam file
:param dict univ_options: Dict of universal options used by almost all tools
:param dict picard_options: Dict of options specific to Picard
:return: Path to the ... |
Write out a file to a given location. The location can be either a directory on the local
machine, or a folder with a bucket on AWS.
:param str fsid: The file store id for the file to be exported
:param str file_name: The name of the file that neeeds to be exported (path to file is also
acceptab... | def export_results(job, fsid, file_name, univ_options, subfolder=None):
"""
Write out a file to a given location. The location can be either a directory on the local
machine, or a folder with a bucket on AWS.
:param str fsid: The file store id for the file to be exported
:param str file_name: The n... |
Delete the fastqs from the job Store once their purpose has been achieved (i.e. after all
mapping steps)
:param dict patient_dict: Dict of list of input fastqs | def delete_fastqs(job, patient_dict):
"""
Delete the fastqs from the job Store once their purpose has been achieved (i.e. after all
mapping steps)
:param dict patient_dict: Dict of list of input fastqs
"""
for key in patient_dict.keys():
if 'fastq' not in key:
continue
... |
Delete the bams from the job Store once their purpose has been achieved (i.e. after all
mutation calling steps). Will also delete the chimeric junction file from Star.
:param dict bams: Dict of bam and bai files
:param str patient_id: The ID of the patient for logging purposes. | def delete_bams(job, bams, patient_id):
"""
Delete the bams from the job Store once their purpose has been achieved (i.e. after all
mutation calling steps). Will also delete the chimeric junction file from Star.
:param dict bams: Dict of bam and bai files
:param str patient_id: The ID of the patien... |
Reads an input peptide fasta file into memory in the form of a dict of fasta record: sequence
:param str in_peptfile: Path to a peptide fasta
:return: Dict of fasta record: sequence
:rtype: dict | def read_peptide_file(in_peptfile):
"""
Reads an input peptide fasta file into memory in the form of a dict of fasta record: sequence
:param str in_peptfile: Path to a peptide fasta
:return: Dict of fasta record: sequence
:rtype: dict
"""
peptides = defaultdict()
pept = None
with op... |
Parse a chromosome string into a list.
:param chromosome_string: Input chromosome string
:return: list of chromosomes to handle
:rtype: list | def parse_chromosome_string(job, chromosome_string):
"""
Parse a chromosome string into a list.
:param chromosome_string: Input chromosome string
:return: list of chromosomes to handle
:rtype: list
"""
if chromosome_string is None:
return []
else:
assert isinstance(chrom... |
Sort a list of chromosomes in the order 1..22, X, Y, M, <others in alphabetical order>.
:param list in_chroms: Input chromosomes
:return: Sorted chromosomes
:rtype: list[str] | def chrom_sorted(in_chroms):
"""
Sort a list of chromosomes in the order 1..22, X, Y, M, <others in alphabetical order>.
:param list in_chroms: Input chromosomes
:return: Sorted chromosomes
:rtype: list[str]
"""
in_chroms.sort()
canonicals = [str(c) for c in range(1, 23)] + ['X', 'Y', '... |
Sort a list of chromosomes in the order 1..22, X, Y, M/MT
:param list in_chroms: Input chromosomes
:return: Sorted chromosomes
:rtype: list[str] | def canonical_chrom_sorted(in_chroms):
"""
Sort a list of chromosomes in the order 1..22, X, Y, M/MT
:param list in_chroms: Input chromosomes
:return: Sorted chromosomes
:rtype: list[str]
"""
if len(in_chroms) == 0:
return []
chr_prefix = False
mt = False
if in_chroms[0]... |
Send an email to the user when the run finishes.
:param dict univ_options: Dict of universal options used by almost all tools | def email_report(job, univ_options):
"""
Send an email to the user when the run finishes.
:param dict univ_options: Dict of universal options used by almost all tools
"""
fromadd = "results@protect.cgl.genomics.ucsc.edu"
msg = MIMEMultipart()
msg['From'] = fromadd
if univ_options['mail... |
Setter method for defaultacc, mapped from YANG variable /aaa_config/aaa/accounting/commands/defaultacc (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_defaultacc is considered as a private
method. Backends looking to populate this variable should
do so via ca... | def _set_defaultacc(self, v, load=False):
"""
Setter method for defaultacc, mapped from YANG variable /aaa_config/aaa/accounting/commands/defaultacc (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_defaultacc is considered as a private
method. Backends loo... |
Setter method for loopback, mapped from YANG variable /interface/ethernet/loopback (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_loopback is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_l... | def _set_loopback(self, v, load=False):
"""
Setter method for loopback, mapped from YANG variable /interface/ethernet/loopback (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_loopback is considered as a private
method. Backends looking to populate this ... |
Setter method for strip_header, mapped from YANG variable /interface/ethernet/strip_header (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_strip_header is considered as a private
method. Backends looking to populate this variable should
do so via calling th... | def _set_strip_header(self, v, load=False):
"""
Setter method for strip_header, mapped from YANG variable /interface/ethernet/strip_header (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_strip_header is considered as a private
method. Backends looking t... |
Setter method for port_profile_status, mapped from YANG variable /brocade_port_profile_ext_rpc/get_port_profile_status/input/port_profile_status (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_port_profile_status is considered as a private
method. Backends look... | def _set_port_profile_status(self, v, load=False):
"""
Setter method for port_profile_status, mapped from YANG variable /brocade_port_profile_ext_rpc/get_port_profile_status/input/port_profile_status (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_port_prof... |
Return hashable structure from non-hashable structure using hippie means
dict and set are sorted and their content subjected to same hippie means.
Note that the key identifies the current content of the structure. | def make_key_hippie(obj, typed=True):
"""Return hashable structure from non-hashable structure using hippie means
dict and set are sorted and their content subjected to same hippie means.
Note that the key identifies the current content of the structure.
"""
ftype = type if typed else lambda o: N... |
Returns a typed and/or strict key callable.
A strict key callable will fail on traditionaly non-hashable object,
while a strict=False hashing will use hippie hashing that can hash
mutable object.
A typed key callable will use type of each object in the hash and will
distinguish with same hash but ... | def hashing(typed=True, strict=False):
"""Returns a typed and/or strict key callable.
A strict key callable will fail on traditionaly non-hashable object,
while a strict=False hashing will use hippie hashing that can hash
mutable object.
A typed key callable will use type of each object in the has... |
Returns the decorator and the undecorated function of given object. | def undecorate(func):
"""Returns the decorator and the undecorated function of given object."""
orig_call_wrapper = lambda x: x
for call_wrapper, unwrap in SUPPORTED_DECORATOR.items():
if isinstance(func, call_wrapper):
func = unwrap(func)
orig_call_wrapper = call_wrapper
... |
The @cache decorator
Compatility with using ``@cache()`` and ``@cache`` is managed in
the current function. | def cache(*args, **kwargs):
"""The @cache decorator
Compatility with using ``@cache()`` and ``@cache`` is managed in
the current function.
"""
## only one argument ?
if len(args) == 1 and len(kwargs) == 0 and \
(callable(args[0]) or \
isinstance(args[0], tuple(SUPPORTED_... |
Setter method for gshut_route_map, mapped from YANG variable /rbridge_id/router/router_bgp/router_bgp_attributes/graceful_shutdown/gshut_route_map (rmap-type)
If this variable is read-only (config: false) in the
source YANG file, then _set_gshut_route_map is considered as a private
method. Backends looking ... | def _set_gshut_route_map(self, v, load=False):
"""
Setter method for gshut_route_map, mapped from YANG variable /rbridge_id/router/router_bgp/router_bgp_attributes/graceful_shutdown/gshut_route_map (rmap-type)
If this variable is read-only (config: false) in the
source YANG file, then _set_gshut_route_m... |
Setter method for gshut_timer_attributes, mapped from YANG variable /rbridge_id/router/router_bgp/router_bgp_attributes/graceful_shutdown/gshut_timer_attributes (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_gshut_timer_attributes is considered as a private
meth... | def _set_gshut_timer_attributes(self, v, load=False):
"""
Setter method for gshut_timer_attributes, mapped from YANG variable /rbridge_id/router/router_bgp/router_bgp_attributes/graceful_shutdown/gshut_timer_attributes (container)
If this variable is read-only (config: false) in the
source YANG file, th... |
Market-related commands. | def item(ctx, appid, title):
"""Market-related commands."""
ctx.obj['appid'] = appid
ctx.obj['title'] = title |
Prints out market item price. | def get_price(ctx, currency):
"""Prints out market item price."""
appid = ctx.obj['appid']
title = ctx.obj['title']
item_ = Item(appid, title)
item_.get_price_data(currency)
click.secho('Lowest price: %s %s' % (item_.price_lowest, item_.price_currency), fg='green') |
Prints out cards available for application. | def get_cards(ctx):
"""Prints out cards available for application."""
appid = ctx.obj['appid']
app = Application(appid)
click.secho('Cards for `%s` [appid: %s]' % (app.title, appid), fg='green')
if not app.has_cards:
click.secho('This app has no cards.', fg='red', err=True)
return... |
Prints out lowest card prices for an application.
Comma-separated list of application IDs is supported. | def get_card_prices(ctx, currency):
"""Prints out lowest card prices for an application.
Comma-separated list of application IDs is supported.
"""
appid = ctx.obj['appid']
detailed = True
appids = [appid]
if ',' in appid:
appids = [appid.strip() for appid in appid.split(',')]
... |
Prints out total gems count for a Steam user. | def get_gems(ctx):
"""Prints out total gems count for a Steam user."""
username = ctx.obj['username']
click.secho(
'Total gems owned by `%s`: %d' % (username, User(username).gems_total),
fg='green') |
Prints out games owned by a Steam user. | def get_games(ctx):
"""Prints out games owned by a Steam user."""
username = ctx.obj['username']
games = User(username).get_games_owned()
for game in sorted(games.values(), key=itemgetter('title')):
click.echo('%s [appid: %s]' % (game['title'], game['appid']))
click.secho('Total gems owne... |
Prints out price stats for booster packs available in Steam user inventory. | def get_booster_stats(ctx, currency):
"""Prints out price stats for booster packs available in Steam user inventory."""
username = ctx.obj['username']
inventory = User(username)._get_inventory_raw()
boosters = {}
for item in inventory['rgDescriptions'].values():
is_booster = False
... |
Prints out price stats for cards available in Steam user inventory. | def get_cards_stats(ctx, currency, skip_owned, appid, foil):
"""Prints out price stats for cards available in Steam user inventory."""
username = ctx.obj['username']
cards_by_app = defaultdict(list)
inventory = User(username).traverse_inventory(item_filter=TAG_ITEM_CLASS_CARD)
for item in inventor... |
Setter method for uda_profile_offsets, mapped from YANG variable /uda_key/profile/uda_profile_offsets (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_uda_profile_offsets is considered as a private
method. Backends looking to populate this variable should
do s... | def _set_uda_profile_offsets(self, v, load=False):
"""
Setter method for uda_profile_offsets, mapped from YANG variable /uda_key/profile/uda_profile_offsets (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_uda_profile_offsets is considered as a private
met... |
Setter method for vrf, mapped from YANG variable /routing_system/interface/ve/vrf (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_vrf is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_vrf() dir... | def _set_vrf(self, v, load=False):
"""
Setter method for vrf, mapped from YANG variable /routing_system/interface/ve/vrf (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_vrf is considered as a private
method. Backends looking to populate this variable shou... |
Setter method for intf_isis, mapped from YANG variable /routing_system/interface/ve/intf_isis (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_intf_isis is considered as a private
method. Backends looking to populate this variable should
do so via calling this... | def _set_intf_isis(self, v, load=False):
"""
Setter method for intf_isis, mapped from YANG variable /routing_system/interface/ve/intf_isis (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_intf_isis is considered as a private
method. Backends looking to pop... |
Setter method for l2traceroute, mapped from YANG variable /brocade_trilloam_rpc/l2traceroute (rpc)
If this variable is read-only (config: false) in the
source YANG file, then _set_l2traceroute is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj.... | def _set_l2traceroute(self, v, load=False):
"""
Setter method for l2traceroute, mapped from YANG variable /brocade_trilloam_rpc/l2traceroute (rpc)
If this variable is read-only (config: false) in the
source YANG file, then _set_l2traceroute is considered as a private
method. Backends looking to popu... |
Setter method for preferred_lifetime, mapped from YANG variable /interface/fortygigabitethernet/ipv6/ipv6_nd_ra/ipv6_intf_cmds/nd/prefix/lifetime/preferred/preferred_lifetime (common-def:time-interval-sec)
If this variable is read-only (config: false) in the
source YANG file, then _set_preferred_lifetime is con... | def _set_preferred_lifetime(self, v, load=False):
"""
Setter method for preferred_lifetime, mapped from YANG variable /interface/fortygigabitethernet/ipv6/ipv6_nd_ra/ipv6_intf_cmds/nd/prefix/lifetime/preferred/preferred_lifetime (common-def:time-interval-sec)
If this variable is read-only (config: false) in... |
Setter method for preferred_infinite, mapped from YANG variable /interface/fortygigabitethernet/ipv6/ipv6_nd_ra/ipv6_intf_cmds/nd/prefix/lifetime/preferred/preferred_infinite (empty)
If this variable is read-only (config: false) in the
source YANG file, then _set_preferred_infinite is considered as a private
... | def _set_preferred_infinite(self, v, load=False):
"""
Setter method for preferred_infinite, mapped from YANG variable /interface/fortygigabitethernet/ipv6/ipv6_nd_ra/ipv6_intf_cmds/nd/prefix/lifetime/preferred/preferred_infinite (empty)
If this variable is read-only (config: false) in the
source YANG fi... |
Setter method for static_route_nh, mapped from YANG variable /rbridge_id/vrf/address_family/ipv6/unicast/ipv6/route/static_route_nh (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_static_route_nh is considered as a private
method. Backends looking to populate this var... | def _set_static_route_nh(self, v, load=False):
"""
Setter method for static_route_nh, mapped from YANG variable /rbridge_id/vrf/address_family/ipv6/unicast/ipv6/route/static_route_nh (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_static_route_nh is considered as ... |
Setter method for range, mapped from YANG variable /rbridge_id/router/ospf/area/range (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_range is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_range() ... | def _set_range(self, v, load=False):
"""
Setter method for range, mapped from YANG variable /rbridge_id/router/ospf/area/range (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_range is considered as a private
method. Backends looking to populate this variable s... |
Setter method for virtual_link, mapped from YANG variable /rbridge_id/router/ospf/area/virtual_link (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_virtual_link is considered as a private
method. Backends looking to populate this variable should
do so via calling ... | def _set_virtual_link(self, v, load=False):
"""
Setter method for virtual_link, mapped from YANG variable /rbridge_id/router/ospf/area/virtual_link (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_virtual_link is considered as a private
method. Backends looking... |
Setter method for span, mapped from YANG variable /policy_map/class/span (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_span is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_span() directly.
... | def _set_span(self, v, load=False):
"""
Setter method for span, mapped from YANG variable /policy_map/class/span (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_span is considered as a private
method. Backends looking to populate this variable should
... |
Setter method for fcoe_map_fabric_map, mapped from YANG variable /fcoe/fcoe_map/fcoe_map_fabric_map (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_fcoe_map_fabric_map is considered as a private
method. Backends looking to populate this variable should
do so ... | def _set_fcoe_map_fabric_map(self, v, load=False):
"""
Setter method for fcoe_map_fabric_map, mapped from YANG variable /fcoe/fcoe_map/fcoe_map_fabric_map (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_fcoe_map_fabric_map is considered as a private
metho... |
Setter method for fcoe_map_cee_map, mapped from YANG variable /fcoe/fcoe_map/fcoe_map_cee_map (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_fcoe_map_cee_map is considered as a private
method. Backends looking to populate this variable should
do so via calli... | def _set_fcoe_map_cee_map(self, v, load=False):
"""
Setter method for fcoe_map_cee_map, mapped from YANG variable /fcoe/fcoe_map/fcoe_map_cee_map (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_fcoe_map_cee_map is considered as a private
method. Backends ... |
Setter method for link_local_route_oif_type, mapped from YANG variable /rbridge_id/vrf/address_family/ipv6/unicast/ipv6/route/link_local_static_route_nh/link_local_route_oif_type (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_link_local_route_oif_type is considere... | def _set_link_local_route_oif_type(self, v, load=False):
"""
Setter method for link_local_route_oif_type, mapped from YANG variable /rbridge_id/vrf/address_family/ipv6/unicast/ipv6/route/link_local_static_route_nh/link_local_route_oif_type (enumeration)
If this variable is read-only (config: false) in the
... |
Setter method for collector, mapped from YANG variable /telemetry/collector (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_collector is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_collector() di... | def _set_collector(self, v, load=False):
"""
Setter method for collector, mapped from YANG variable /telemetry/collector (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_collector is considered as a private
method. Backends looking to populate this variable sho... |
Setter method for server, mapped from YANG variable /telemetry/server (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_server is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_server() directly. | def _set_server(self, v, load=False):
"""
Setter method for server, mapped from YANG variable /telemetry/server (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_server is considered as a private
method. Backends looking to populate this variable should
do s... |
Setter method for l4protocol, mapped from YANG variable /brocade_trilloam_rpc/l2traceroute/input/l4protocol (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_l4protocol is considered as a private
method. Backends looking to populate this variable should
do so... | def _set_l4protocol(self, v, load=False):
"""
Setter method for l4protocol, mapped from YANG variable /brocade_trilloam_rpc/l2traceroute/input/l4protocol (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_l4protocol is considered as a private
method. Backe... |
Setter method for get_mac_acl_for_intf, mapped from YANG variable /brocade_mac_access_list_rpc/get_mac_acl_for_intf (rpc)
If this variable is read-only (config: false) in the
source YANG file, then _set_get_mac_acl_for_intf is considered as a private
method. Backends looking to populate this variable should... | def _set_get_mac_acl_for_intf(self, v, load=False):
"""
Setter method for get_mac_acl_for_intf, mapped from YANG variable /brocade_mac_access_list_rpc/get_mac_acl_for_intf (rpc)
If this variable is read-only (config: false) in the
source YANG file, then _set_get_mac_acl_for_intf is considered as a priva... |
Setter method for router_isis_cmds_holder, mapped from YANG variable /routing_system/router/isis/router_isis_cmds_holder (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_router_isis_cmds_holder is considered as a private
method. Backends looking to populate this v... | def _set_router_isis_cmds_holder(self, v, load=False):
"""
Setter method for router_isis_cmds_holder, mapped from YANG variable /routing_system/router/isis/router_isis_cmds_holder (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_router_isis_cmds_holder is cons... |
Setter method for show_bare_metal_state, mapped from YANG variable /brocade_preprovision_rpc/show_bare_metal_state (rpc)
If this variable is read-only (config: false) in the
source YANG file, then _set_show_bare_metal_state is considered as a private
method. Backends looking to populate this variable should... | def _set_show_bare_metal_state(self, v, load=False):
"""
Setter method for show_bare_metal_state, mapped from YANG variable /brocade_preprovision_rpc/show_bare_metal_state (rpc)
If this variable is read-only (config: false) in the
source YANG file, then _set_show_bare_metal_state is considered as a priv... |
Setter method for tag, mapped from YANG variable /brocade_interface_ext_rpc/get_vlan_brief/output/vlan/interface/tag (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_tag is considered as a private
method. Backends looking to populate this variable should
do ... | def _set_tag(self, v, load=False):
"""
Setter method for tag, mapped from YANG variable /brocade_interface_ext_rpc/get_vlan_brief/output/vlan/interface/tag (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_tag is considered as a private
method. Backends l... |
Setter method for route_table, mapped from YANG variable /hardware/profile/route_table (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_route_table is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._... | def _set_route_table(self, v, load=False):
"""
Setter method for route_table, mapped from YANG variable /hardware/profile/route_table (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_route_table is considered as a private
method. Backends looking to popula... |
Setter method for cluster, mapped from YANG variable /mgmt_cluster/cluster (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_cluster is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_cluster() di... | def _set_cluster(self, v, load=False):
"""
Setter method for cluster, mapped from YANG variable /mgmt_cluster/cluster (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_cluster is considered as a private
method. Backends looking to populate this variable sho... |
Parse from a string representation (repr) | def loads(cls, s: str) -> 'Money':
"""Parse from a string representation (repr)"""
try:
currency, amount = s.strip().split()
return cls(amount, currency)
except ValueError as err:
raise ValueError("failed to parse string "
" '{}': ... |
Setter method for peripheral_show_option, mapped from YANG variable /show/show_firmware_dummy/show_firmware_option/peripheral_show_option (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_peripheral_show_option is considered as a private
method. Backends looking to... | def _set_peripheral_show_option(self, v, load=False):
"""
Setter method for peripheral_show_option, mapped from YANG variable /show/show_firmware_dummy/show_firmware_option/peripheral_show_option (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_peripheral_show... |
Setter method for version, mapped from YANG variable /rbridge_id/openflow/logical_instance/version (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_version is considered as a private
method. Backends looking to populate this variable should
do so via calling thisOb... | def _set_version(self, v, load=False):
"""
Setter method for version, mapped from YANG variable /rbridge_id/openflow/logical_instance/version (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_version is considered as a private
method. Backends looking to populat... |
Setter method for passive, mapped from YANG variable /rbridge_id/openflow/logical_instance/passive (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_passive is considered as a private
method. Backends looking to populate this variable should
do so via calling t... | def _set_passive(self, v, load=False):
"""
Setter method for passive, mapped from YANG variable /rbridge_id/openflow/logical_instance/passive (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_passive is considered as a private
method. Backends looking to po... |
Setter method for default_forwarding_action, mapped from YANG variable /rbridge_id/openflow/logical_instance/default_forwarding_action (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_default_forwarding_action is considered as a private
method. Backends looking ... | def _set_default_forwarding_action(self, v, load=False):
"""
Setter method for default_forwarding_action, mapped from YANG variable /rbridge_id/openflow/logical_instance/default_forwarding_action (enumeration)
If this variable is read-only (config: false) in the
source YANG file, then _set_default_forwa... |
Setter method for neighbor_route_map_name_direction_out, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv6/ipv6_unicast/af_ipv6_vrf/neighbor/af_ipv6_vrf_neighbor_address_holder/af_ipv6_neighbor_addr/neighbor_route_map/neighbor_route_map_direction_out/neighbor_route_map_name_direction_out (comm... | def _set_neighbor_route_map_name_direction_out(self, v, load=False):
"""
Setter method for neighbor_route_map_name_direction_out, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv6/ipv6_unicast/af_ipv6_vrf/neighbor/af_ipv6_vrf_neighbor_address_holder/af_ipv6_neighbor_addr/neighbor_route... |
Setter method for mldVlan, mapped from YANG variable /interface_vlan/interface/vlan/ipv6/mldVlan (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_mldVlan is considered as a private
method. Backends looking to populate this variable should
do so via calling thi... | def _set_mldVlan(self, v, load=False):
"""
Setter method for mldVlan, mapped from YANG variable /interface_vlan/interface/vlan/ipv6/mldVlan (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_mldVlan is considered as a private
method. Backends looking to popu... |
Setter method for rspan_access, mapped from YANG variable /interface/fortygigabitethernet/switchport/access/rspan_access (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_rspan_access is considered as a private
method. Backends looking to populate this variable sho... | def _set_rspan_access(self, v, load=False):
"""
Setter method for rspan_access, mapped from YANG variable /interface/fortygigabitethernet/switchport/access/rspan_access (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_rspan_access is considered as a private
... |
Setter method for port_channel_redundancy_group, mapped from YANG variable /port_channel_redundancy_group (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_port_channel_redundancy_group is considered as a private
method. Backends looking to populate this variable should... | def _set_port_channel_redundancy_group(self, v, load=False):
"""
Setter method for port_channel_redundancy_group, mapped from YANG variable /port_channel_redundancy_group (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_port_channel_redundancy_group is considered a... |
Setter method for vlag_commit_mode, mapped from YANG variable /vlag_commit_mode (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_vlag_commit_mode is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._se... | def _set_vlag_commit_mode(self, v, load=False):
"""
Setter method for vlag_commit_mode, mapped from YANG variable /vlag_commit_mode (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_vlag_commit_mode is considered as a private
method. Backends looking to pop... |
Setter method for isns, mapped from YANG variable /isns (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_isns is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_isns() directly.
YANG Descrip... | def _set_isns(self, v, load=False):
"""
Setter method for isns, mapped from YANG variable /isns (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_isns is considered as a private
method. Backends looking to populate this variable should
do so via calling... |
Setter method for vcenter, mapped from YANG variable /vcenter (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_vcenter is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_vcenter() directly.
YANG ... | def _set_vcenter(self, v, load=False):
"""
Setter method for vcenter, mapped from YANG variable /vcenter (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_vcenter is considered as a private
method. Backends looking to populate this variable should
do so via ... |
Setter method for uplink_switch, mapped from YANG variable /uplink_switch (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_uplink_switch is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_uplink_... | def _set_uplink_switch(self, v, load=False):
"""
Setter method for uplink_switch, mapped from YANG variable /uplink_switch (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_uplink_switch is considered as a private
method. Backends looking to populate this v... |
Setter method for police_priority_map, mapped from YANG variable /police_priority_map (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_police_priority_map is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj... | def _set_police_priority_map(self, v, load=False):
"""
Setter method for police_priority_map, mapped from YANG variable /police_priority_map (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_police_priority_map is considered as a private
method. Backends looking... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.