_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q248400 | SequenceExtractor.extract | train | def extract(self, reads_to_extract, database_fasta_file, output_file):
'''Extract the reads_to_extract from the database_fasta_file and put them in
output_file.
Parameters
----------
reads_to_extract: Iterable of str
IDs of reads to be extracted
database_fast... | python | {
"resource": ""
} |
q248401 | SequenceExtractor.extract_forward_and_reverse_complement | train | def extract_forward_and_reverse_complement(
self, forward_reads_to_extract, reverse_reads_to_extract, database_fasta_file,
output_file):
'''As per extract except also reverse complement the sequences.'''
self.extract(forward_reads_to_extract, database_fasta_file, output_file)
... | python | {
"resource": ""
} |
q248402 | Stats_And_Summary.write_tabular_otu_table | train | def write_tabular_otu_table(self, sample_names, read_taxonomies, combined_output_otu_table_io):
'''A function that takes a hash of trusted placements, and compiles them
into an OTU-esque table.'''
delim = u'\t'
combined_output_otu_table_io.write(delim.join(['#ID',
... | python | {
"resource": ""
} |
q248403 | Stats_And_Summary.write_krona_plot | train | def write_krona_plot(self, sample_names, read_taxonomies, output_krona_filename):
'''Creates krona plot at the given location. Assumes the krona executable
ktImportText is available on the shell PATH'''
tempfiles = []
for n in sample_names:
tempfiles.append(tempfile.NamedTemp... | python | {
"resource": ""
} |
q248404 | Clusterer.uncluster_annotations | train | def uncluster_annotations(self, input_annotations, reverse_pipe):
'''
Update the annotations hash provided by pplacer to include all
representatives within each cluster
Parameters
----------
input_annotations : hash
Classifications for each representative seq... | python | {
"resource": ""
} |
q248405 | Clusterer.cluster | train | def cluster(self, input_fasta_list, reverse_pipe):
'''
cluster - Clusters reads at 100% identity level and writes them to
file. Resets the input_fasta variable as the FASTA file containing the
clusters.
Parameters
----------
input_fasta_list : list
l... | python | {
"resource": ""
} |
q248406 | Archive.create | train | def create(self, input_package_path, output_package_path, **kwargs):
"""Create an archived GraftM package
Parameters
----------
input_package_path: str
path to gpkg to be archived
output_pacakge_path: str
output package path
kwargs:
fo... | python | {
"resource": ""
} |
q248407 | Archive.extract | train | def extract(self, archive_path, output_package_path, **kwargs):
'''Extract an archived GraftM package.
Parameters
----------
archive_path: str
path to archive
output_package_path: str
path to where to put the extracted file
kwargs:
for... | python | {
"resource": ""
} |
q248408 | Archive._setup_output | train | def _setup_output(self, path, force):
'''Clear the way for an output to be placed at path'''
# Allow for special case of output being a pipe
if os.path.isdir(path) or os.path.isfile(path):
if force:
| python | {
"resource": ""
} |
q248409 | HMMSearchResult.import_from_nhmmer_table | train | def import_from_nhmmer_table(hmmout_path):
'''Generate new results object from the output of nhmmer search'''
# nhmmer format is
# qseqid queryname hmmfrom hmmto alifrom alito envfrom envto sqlen strand evalue bitscore bias description
# 0 2 4 5 6 7 8 ... | python | {
"resource": ""
} |
q248410 | HmmSearcher.hmmsearch | train | def hmmsearch(self, input_pipe, hmms, output_files):
r"""Run HMMsearch with all the HMMs, generating output files
Parameters
----------
input_pipe: String
A string which is a partial command line. When this command is run
is outputs to STDOUT fasta formatted prot... | python | {
"resource": ""
} |
q248411 | HmmSearcher._munch_off_batch | train | def _munch_off_batch(self, queue):
r"""Take a batch of sequences off the queue, and return pairs_to_run.
The queue given as a parameter is affected
"""
# if the number of CPUs used == 1, just pop one off (which == below)
# elif the the number of things in the queue is 1, use all... | python | {
"resource": ""
} |
q248412 | HmmSearcher._hmm_command | train | def _hmm_command(self, input_pipe, pairs_to_run):
r"""INTERNAL method for getting cmdline for running a batch of HMMs.
Parameters
----------
input_pipe: as hmmsearch
pairs_to_run: list
list with 2 members: (1) list of hmm and output file, (2) number of
CP... | python | {
"resource": ""
} |
q248413 | Create._parse_contents | train | def _parse_contents(self, contents_file_path):
'''
Parse the contents .json file and return the dictionary
Parameters
----------
contents_file_path: str
| python | {
"resource": ""
} |
q248414 | Create._check_reads_hit | train | def _check_reads_hit(self, alignment_io, min_aligned_fraction):
'''Given an alignment return a list of sequence names that are less
than the min_aligned_fraction'''
to_return = []
alignment_length = None
for s in SeqIO.parse(alignment_io, "fasta"):
if not alignment_le... | python | {
"resource": ""
} |
q248415 | Create._align_sequences | train | def _align_sequences(self, input_sequences_path, output_alignment_path,
threads):
'''Align sequences into alignment_file
Parameters
----------
input_sequences_path: str
path to input sequences in fasta format
output_alignment_path: str
... | python | {
"resource": ""
} |
q248416 | Create._get_hmm_from_alignment | train | def _get_hmm_from_alignment(self, alignment, hmm_filename, output_alignment_filename):
'''Return a HMM file and alignment of sequences to that HMM
Parameters
----------
alignment: str
path to aligned proteins
hmm_filename: str
write the hmm to this file p... | python | {
"resource": ""
} |
q248417 | Create._align_sequences_to_hmm | train | def _align_sequences_to_hmm(self, hmm_file, sequences_file, output_alignment_file):
'''Align sequences to an HMM, and write an alignment of
these proteins after cleanup so that they can be used for tree-making
Parameters
----------
sequences_file: str
path to file of... | python | {
"resource": ""
} |
q248418 | Create._define_range | train | def _define_range(self, sequences):
'''
define_range - define the maximum range within which two hits in a db
search can be linked. This is defined as 1.5X the average length of all
reads in the database.
Parameters
----------
sequences : str
A path t... | python | {
"resource": ""
} |
q248419 | Create._generate_tree_log_file | train | def _generate_tree_log_file(self, tree, alignment, output_tree_file_path,
output_log_file_path, residue_type, fasttree):
'''Generate the FastTree log file given a tree and the alignment that
made that tree
Returns
-------
Nothing. The log file as p... | python | {
"resource": ""
} |
q248420 | Create._remove_sequences_from_alignment | train | def _remove_sequences_from_alignment(self, sequence_names, input_alignment_file, output_alignment_file):
'''Remove sequences from the alignment file that have names in
sequence_names
Parameters
----------
sequence_names: list of str
names of sequences to remove
... | python | {
"resource": ""
} |
q248421 | Create._create_dmnd_database | train | def _create_dmnd_database(self, unaligned_sequences_path, daa_output):
'''
Build a diamond database using diamond makedb
Parameters
----------
unaligned_sequences_path: str
| python | {
"resource": ""
} |
q248422 | Create._check_for_duplicate_sequence_names | train | def _check_for_duplicate_sequence_names(self, fasta_file_path):
"""Test if the given fasta file contains sequences with duplicate
sequence names.
Parameters
----------
fasta_file_path: string
path to file that is to be checked
| python | {
"resource": ""
} |
q248423 | Getaxnseq.read_taxtastic_taxonomy_and_seqinfo | train | def read_taxtastic_taxonomy_and_seqinfo(self, taxonomy_io, seqinfo_io):
'''Read the taxonomy and seqinfo files into a dictionary of
sequence_name => taxonomy, where the taxonomy is an array of lineages
given to that sequence.
Possibly this method is unable to handle the full de... | python | {
"resource": ""
} |
q248424 | SequenceIO.each_sequence | train | def each_sequence(self, fp):
'''Like each except iterate over Sequence | python | {
"resource": ""
} |
q248425 | _fields_list_to_dict | train | def _fields_list_to_dict(fields):
"""Takes a list of field names and returns a matching dictionary.
["a", "b"] becomes {"a": 1, "b": 1} | python | {
"resource": ""
} |
q248426 | Connection._socket_connect | train | def _socket_connect(self):
"""create a socket, connect, register a stream with the async backend"""
self.usage_count = 0
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
s.connect((self._host, self._port))
self.__stream = self.__backend.register_s... | python | {
"resource": ""
} |
q248427 | Connection._socket_close | train | def _socket_close(self):
"""cleanup after the socket is closed by the other end"""
callback = self.__callback
self.__callback = None
try:
if callback:
callback(None, InterfaceError('connection closed'))
finally:
# Flush the job queue, don't... | python | {
"resource": ""
} |
q248428 | Connection._close | train | def _close(self):
"""close the socket and cleanup"""
callback = self.__callback
self.__callback = None
try:
if callback:
callback(None, InterfaceError('connection closed'))
finally:
# Flush the job queue, don't call the callbacks associated... | python | {
"resource": ""
} |
q248429 | Connection.send_message | train | def send_message(self, message, callback):
""" send a message over the wire; callback=None indicates a safe=False call where we write and forget about it"""
if self.__callback is not None:
raise ProgrammingError('connection already in use')
if callback:
err_call... | python | {
"resource": ""
} |
q248430 | Connection._next_job | train | def _next_job(self):
"""execute the next job from the top of the queue"""
if self.__job_queue:
# Produce message | python | {
"resource": ""
} |
q248431 | ConnectionPools.get_connection_pool | train | def get_connection_pool(self, pool_id, *args, **kwargs):
"""get a connection pool, transparently creating it if it doesn't already exist
:Parameters:
- `pool_id`: unique id for a connection pool
"""
| python | {
"resource": ""
} |
q248432 | ConnectionPools.close_idle_connections | train | def close_idle_connections(self, pool_id=None):
"""close idle connections to mongo"""
if not hasattr(self, '_pools'):
return
if pool_id:
if pool_id not in self._pools:
raise ProgrammingError("pool %r does not exist" % pool_id)
| python | {
"resource": ""
} |
q248433 | ConnectionPool.connection | train | def connection(self):
""" get a cached connection from the pool """
self._condition.acquire()
try:
if (self._maxconnections and self._connections >= self._maxconnections):
raise TooManyConnections("%d connections are already equal to the max: %d" % (self._con... | python | {
"resource": ""
} |
q248434 | Cursor.__query_options | train | def __query_options(self):
"""Get the query options string to use for this query."""
options = 0
if self.__tailable:
options |= _QUERY_OPTIONS["tailable_cursor"]
if self.__slave_okay or self.__pool._slave_okay:
| python | {
"resource": ""
} |
q248435 | update_context | train | def update_context(app, pagename, templatename, context, doctree):
""" Remove sphinx-tabs CSS and JS asset files if not used in a page """
if doctree is None:
return
visitor = _FindTabsDirectiveVisitor(doctree)
doctree.walk(visitor)
if not visitor.found_tabs_directive:
paths = [posix... | python | {
"resource": ""
} |
q248436 | copy_assets | train | def copy_assets(app, exception):
""" Copy asset files to the output """
if 'getLogger' in dir(logging):
log = logging.getLogger(__name__).info # pylint: disable=no-member
else:
log = app.info
builders = get_compatible_builders(app)
if exception:
return
if app.builder.nam... | python | {
"resource": ""
} |
q248437 | setup | train | def setup(app):
""" Set up the plugin """
app.add_config_value('sphinx_tabs_nowarn', False, '')
app.add_config_value('sphinx_tabs_valid_builders', [], '')
app.add_directive('tabs', TabsDirective)
app.add_directive('tab', TabDirective)
app.add_directive('group-tab', GroupTabDirective)
app.add... | python | {
"resource": ""
} |
q248438 | TabsDirective.run | train | def run(self):
""" Parse a tabs directive """
self.assert_has_content()
env = self.state.document.settings.env
node = nodes.container()
node['classes'] = ['sphinx-tabs']
if 'next_tabs_id' not in env.temp_data:
env.temp_data['next_tabs_id'] = 0
if 'ta... | python | {
"resource": ""
} |
q248439 | Client.connection | train | def connection(self, collectionname, dbname=None):
"""Get a cursor to a collection by name.
raises `DataError` on names with unallowable characters.
:Parameters:
- `collectionname`: the name of the collection
- `dbname`: (optional) overide the default db for a connection
... | python | {
"resource": ""
} |
q248440 | Client.collection_names | train | def collection_names(self, callback):
"""Get a list of all the collection names in selected database"""
| python | {
"resource": ""
} |
q248441 | Client._collection_names_result | train | def _collection_names_result(self, callback, results, error=None):
"""callback to for collection names query, filters out collection names"""
names = [r['name'] for r in results if r['name'].count('.') == | python | {
"resource": ""
} |
q248442 | DockerfileParser.parent_images | train | def parent_images(self, parents):
"""
setter for images in 'FROM' instructions.
Images are updated per build stage with the given parents in the order they appear.
Raises RuntimeError if a different number of parents are given than there are stages
as that is likely to be a mista... | python | {
"resource": ""
} |
q248443 | DockerfileParser.baseimage | train | def baseimage(self, new_image):
"""
change image of final stage FROM instruction
"""
images | python | {
"resource": ""
} |
q248444 | DockerfileParser.cmd | train | def cmd(self, value):
"""
setter for final 'CMD' instruction in final build stage
"""
cmd = None
for insndesc in self.structure:
if insndesc['instruction'] == 'FROM': # | python | {
"resource": ""
} |
q248445 | DockerfileParser._instruction_getter | train | def _instruction_getter(self, name, env_replace):
"""
Get LABEL or ENV instructions with environment replacement
:param name: e.g. 'LABEL' or 'ENV'
:param env_replace: bool, whether to perform ENV substitution
:return: Labels instance or Envs instance
"""
if name... | python | {
"resource": ""
} |
q248446 | b2u | train | def b2u(string):
""" bytes to unicode """
if (isinstance(string, bytes) | python | {
"resource": ""
} |
q248447 | u2b | train | def u2b(string):
""" unicode to bytes"""
if ((PY2 and isinstance(string, unicode)) or
| python | {
"resource": ""
} |
q248448 | WordSplitter._update_quoting_state | train | def _update_quoting_state(self, ch):
"""
Update self.quotes and self.escaped
:param ch: str, current character
:return: ch if it was not used to update quoting state, else ''
"""
# Set whether the next character is escaped
# Unquoted:
# a backslash esc... | python | {
"resource": ""
} |
q248449 | WordSplitter.split | train | def split(self, maxsplit=None, dequote=True):
"""
Generator for the words of the string
:param maxsplit: perform at most maxsplit splits;
if None, do not limit the number of splits
:param dequote: remove quotes and escape characters once consumed
"""
class W... | python | {
"resource": ""
} |
q248450 | Context.get_line_value | train | def get_line_value(self, context_type):
"""
Get the values defined on this line.
:param context_type: "ENV" or "LABEL"
:return: values of given type defined on this line
"""
if context_type.upper() == "ENV":
| python | {
"resource": ""
} |
q248451 | Context.get_values | train | def get_values(self, context_type):
"""
Get the values valid on this line.
:param context_type: "ENV" or "LABEL"
| python | {
"resource": ""
} |
q248452 | uniqueStates | train | def uniqueStates(states,rates):
"""
Returns unique states and sums up the corresponding rates.
States should be a 2d numpy array with on each row a state, and rates a 1d numpy array with length equal to the number of rows in states.
This may be helpful in the | python | {
"resource": ""
} |
q248453 | markovChain.checkInitialState | train | def checkInitialState(self,initialState):
"""
Check whether the initial state is of the correct type.
The state should be either an int, list, tuple or np.array and all its elements must be integer.
Returns an int if the state is an integer, otherwise a tuple.
"""
assert ... | python | {
"resource": ""
} |
q248454 | markovChain.indirectInitialMatrix | train | def indirectInitialMatrix(self, initialState):
"""
Given some initial state, this iteratively determines new states.
We repeatedly call the transition function on unvisited states in the frontier set.
Each newly visited state is put in a dictionary called 'mapping' and the rates are stor... | python | {
"resource": ""
} |
q248455 | markovChain.getStateCode | train | def getStateCode(self,state):
"""
Calculates the state code for a specific state or set of states.
We transform the states so that they are nonnegative and take an inner product.
| python | {
"resource": ""
} |
q248456 | markovChain.getStateIndex | train | def getStateIndex(self,state):
"""
Returns the index of a state by calculating the state code and searching for this code a sorted list.
Can be called on multiple states at once.
"""
| python | {
"resource": ""
} |
q248457 | markovChain.transitionStates | train | def transitionStates(self,state):
"""
Return the indices of new states and their rates.
"""
newstates,rates = self.transition(state)
| python | {
"resource": ""
} |
q248458 | markovChain.convertToRateMatrix | train | def convertToRateMatrix(self, Q):
"""
Converts the initial matrix to a rate matrix.
We make all rows in Q sum to zero by subtracting the row sums from the diagonal.
"""
rowSums = Q.sum(axis=1).getA1()
| python | {
"resource": ""
} |
q248459 | markovChain.getTransitionMatrix | train | def getTransitionMatrix(self,probabilities=True):
"""
If self.P has been given already, we will reuse it and convert it to a sparse csr matrix if needed.
Otherwise, we will generate it using the direct or indirect method.
Since most solution methods use a probability matrix, thi... | python | {
"resource": ""
} |
q248460 | markovChain.printPi | train | def printPi(self):
"""
Prints all states state and their steady state probabilities.
Not recommended for large state spaces.
"""
assert self.pi is not None, "Calculate pi before calling printPi()"
assert len(self.mapping)>0, "printPi() can only be | python | {
"resource": ""
} |
q248461 | launch_ipython | train | def launch_ipython(argv=None):
"""
Force usage of QtConsole under Windows
"""
from .linux import launch_ipython as _launch_ipython_linux
os.environ = {str(k): str(v) for k,v in os.environ.items()}
try:
from qtconsole.qtconsoleapp import JupyterQtConsoleApp
except ImportError:
... | python | {
"resource": ""
} |
q248462 | launch_ipython | train | def launch_ipython(argv=None, ipython_app=None):
"""
Launch IPython from this interpreter with custom args if needed.
Chimera magic commands are also enabled automatically.
"""
try:
if ipython_app is None:
from IPython.terminal.ipapp import TerminalIPythonApp as ipython_app
... | python | {
"resource": ""
} |
q248463 | launch_notebook | train | def launch_notebook(argv=None):
"""
Launch a Jupyter Notebook, with custom Untitled filenames and
a prepopulated first cell with necessary boilerplate code.
Notes
-----
To populate the first cell, the function `new_notebook` imported
in notebook.services.contents needs to be monkey patched.... | python | {
"resource": ""
} |
q248464 | enable_chimera_inline | train | def enable_chimera_inline():
"""
Enable IPython magic commands to run some Chimera actions
Currently supported:
- %chimera_export_3D [<model>]:
Depicts the Chimera 3D canvas in a WebGL iframe. Requires
a headless Chimera build and a Notebook instance. SLOW.
- %chimera_run <command>:... | python | {
"resource": ""
} |
q248465 | chimera_view | train | def chimera_view(*molecules):
"""
Depicts the requested molecules with NGLViewer in a Python notebook.
This method does not require a headless Chimera build, however.
Parameters
----------
molecules : tuple of chimera.Molecule
Molecules to display. If none is given, all present molecule... | python | {
"resource": ""
} |
q248466 | enable_chimera | train | def enable_chimera(verbose=False, nogui=True):
"""
Bypass script loading and initialize Chimera correctly, once
the env has been properly patched.
Parameters
----------
verbose : bool, optional, default=False
If True, let Chimera speak freely. It can be _very_ verbose.
nogui : bool,... | python | {
"resource": ""
} |
q248467 | patch_sys_version | train | def patch_sys_version():
""" Remove Continuum copyright statement to avoid parsing errors in IDLE """
if '|' in sys.version:
sys_version = | python | {
"resource": ""
} |
q248468 | patch_environ | train | def patch_environ(nogui=True):
"""
Patch current environment variables so Chimera can start up and we can import its modules.
Be warned that calling this function WILL restart your interpreter. Otherwise, Python
won't catch the new LD_LIBRARY_PATH (or platform equivalent) and Chimera won't find its
... | python | {
"resource": ""
} |
q248469 | guess_chimera_path | train | def guess_chimera_path(search_all=False):
"""
Try to guess Chimera installation path.
Parameters
----------
search_all : bool, optional, default=False
If no CHIMERADIR env var is set, collect all posible
locations of Chimera installations.
Returns
-------
paths: list of... | python | {
"resource": ""
} |
q248470 | make_micro | train | def make_micro(content, error=None, version=None, mode=None, mask=None,
encoding=None, boost_error=True):
"""\
Creates a Micro QR Code.
See :py:func:`make` for a description of the parameters.
| python | {
"resource": ""
} |
q248471 | make_sequence | train | def make_sequence(content, error=None, version=None, mode=None, mask=None,
encoding=None, boost_error=True, symbol_count=None):
"""\
Creates a sequence of QR Codes.
If the content fits into one QR Code and neither ``version`` nor
``symbol_count`` is provided, this function may return ... | python | {
"resource": ""
} |
q248472 | QRCode.designator | train | def designator(self):
"""\
Returns the version and error correction level as string `V-E` where
`V` represents the version number and `E` the error level.
""" | python | {
"resource": ""
} |
q248473 | QRCode.matrix_iter | train | def matrix_iter(self, scale=1, border=None):
"""\
Returns an iterator over the matrix which includes the border.
The border is returned as sequence of light modules.
Dark modules are reported as ``0x1``, light modules have the value
``0x0``.
The following example conver... | python | {
"resource": ""
} |
q248474 | QRCode.show | train | def show(self, delete_after=20, scale=10, border=None, color='#000',
background='#fff'): # pragma: no cover
"""\
Displays this QR code.
This method is mainly intended for debugging purposes.
This method saves the output of the :py:meth:`png` method (by default
wit... | python | {
"resource": ""
} |
q248475 | QRCode.svg_data_uri | train | def svg_data_uri(self, xmldecl=False, encode_minimal=False,
omit_charset=False, nl=False, **kw):
"""\
Converts the QR Code into a SVG data URI.
The XML declaration is omitted by default (set ``xmldecl`` to ``True``
to enable it), further the newline is omitted by de... | python | {
"resource": ""
} |
q248476 | QRCode.png_data_uri | train | def png_data_uri(self, **kw):
"""\
Converts the QR Code into a PNG data URI.
Uses the same keyword parameters as the usual PNG serializer.
:rtype: | python | {
"resource": ""
} |
q248477 | QRCode.terminal | train | def terminal(self, out=None, border=None):
"""\
Serializes the matrix as ANSI escape code.
:param out: Filename or a file-like object supporting to write text.
If ``None`` (default), the matrix is written to ``sys.stdout``.
:param int border: Integer indicating the size ... | python | {
"resource": ""
} |
q248478 | QRCode.save | train | def save(self, out, kind=None, **kw):
"""\
Serializes the QR Code in one of the supported formats.
The serialization format depends on the filename extension.
**Common keywords**
========== ==============================================================
Name ... | python | {
"resource": ""
} |
q248479 | QRCodeSequence.terminal | train | def terminal(self, out=None, border=None):
"""\
Serializes the sequence of QR Codes as ANSI escape code.
See :py:meth:`QRCode.terminal()` for details.
| python | {
"resource": ""
} |
q248480 | QRCodeSequence.save | train | def save(self, out, kind=None, **kw):
"""\
Saves the sequence of QR Code to `out`.
If `out` is a filename, this method modifies the filename and adds
``<Number of QR Codes>-<Current QR Code>`` to it.
``structured-append.svg`` becomes (if the sequence contains two QR Codes):
... | python | {
"resource": ""
} |
q248481 | writable | train | def writable(file_or_path, mode, encoding=None):
"""\
Returns a writable file-like object.
Usage::
with writable(file_name_or_path, 'wb') as f:
...
:param file_or_path: Either a file-like object or a filename.
:param str mode: String indicating the writing mode | python | {
"resource": ""
} |
q248482 | as_svg_data_uri | train | def as_svg_data_uri(matrix, version, scale=1, border=None, color='#000',
background=None, xmldecl=False, svgns=True, title=None,
desc=None, svgid=None, svgclass='segno',
lineclass='qrline', omitsize=False, unit='',
encoding='utf-8', svgvers... | python | {
"resource": ""
} |
q248483 | write_svg_debug | train | def write_svg_debug(matrix, version, out, scale=15, border=None,
fallback_color='fuchsia', color_mapping=None,
add_legend=True):
"""\
Internal SVG serializer which is useful to debugging purposes.
This function is not exposed to the QRCode class by intention and the
... | python | {
"resource": ""
} |
q248484 | write_eps | train | def write_eps(matrix, version, out, scale=1, border=None, color='#000',
background=None):
"""\
Serializes the QR Code as EPS document.
:param matrix: The matrix to serialize.
:param int version: The (Micro) QR code version
:param out: Filename or a file-like object supporting to write... | python | {
"resource": ""
} |
q248485 | as_png_data_uri | train | def as_png_data_uri(matrix, version, scale=1, border=None, color='#000',
background='#fff', compresslevel=9, addad=True):
"""\
Converts the provided matrix into a PNG data URI.
:rtype: str
"""
buff = io.BytesIO()
write_png(matrix, version, buff, scale=scale, border=border, c... | python | {
"resource": ""
} |
q248486 | write_txt | train | def write_txt(matrix, version, out, border=None, color='1', background='0'):
"""\
Serializes QR code in a text format.
:param matrix: The matrix to serialize.
:param int version: The (Micro) QR code version
:param out: Filename or a file-like object supporting to write text.
:param int border: ... | python | {
"resource": ""
} |
q248487 | write_tex | train | def write_tex(matrix, version, out, scale=1, border=None, color='black', unit='pt', url=None):
"""\
Serializes the matrix as LaTeX PGF picture.
Requires the `PGF/TikZ <https://en.wikipedia.org/wiki/PGF/TikZ>`_ package
(i.e. ``\\usepackage{pgf}``) in the LaTeX source.
:param matrix: The matrix to s... | python | {
"resource": ""
} |
q248488 | write_terminal | train | def write_terminal(matrix, version, out, border=None):
"""\
Function to write to a terminal which supports ANSI escape codes.
:param matrix: The matrix to serialize.
:param int version: The (Micro) QR code version.
:param out: Filename or a file-like object supporting to write text.
:param int ... | python | {
"resource": ""
} |
q248489 | write_terminal_win | train | def write_terminal_win(matrix, version, border=None): # pragma: no cover
"""\
Function to write a QR Code to a MS Windows terminal.
:param matrix: The matrix to serialize.
:param int version: The (Micro) QR code version
:param int border: Integer indicating the size of the quiet zone.
... | python | {
"resource": ""
} |
q248490 | _pack_bits_into_byte | train | def _pack_bits_into_byte(iterable):
"""\
Packs eight bits into one byte.
If the length of the iterable is not a multiple of eight, ``0x0`` is used
to fill-up the missing values.
| python | {
"resource": ""
} |
q248491 | save | train | def save(matrix, version, out, kind=None, **kw):
"""\
Serializes the matrix in any of the supported formats.
:param matrix: The matrix to serialize.
:param int version: The (Micro) QR code version
:param out: A filename or a writable file-like object with a
``name`` attribute. If a stre... | python | {
"resource": ""
} |
q248492 | parse | train | def parse(args):
"""\
Parses the arguments and returns the result.
"""
parser = make_parser()
if not len(args):
parser.print_help()
sys.exit(1)
parsed_args = parser.parse_args(args)
if parsed_args.error == '-':
parsed_args.error = None
# 'micro' is False by defaul... | python | {
"resource": ""
} |
q248493 | build_config | train | def build_config(config, filename=None):
"""\
Builds a configuration and returns it. The config contains only keywords,
which are supported by the serializer. Unsupported values are ignored.
"""
# Done here since it seems not to be possible to detect if an argument
# was supplied by the user or ... | python | {
"resource": ""
} |
q248494 | make_wifi_data | train | def make_wifi_data(ssid, password, security, hidden=False):
"""\
Creates WIFI configuration string.
:param str ssid: The SSID of the network.
:param str|None password: The password.
:param str|None security: Authentication type; the value should
be "WEP" or "WPA". Set to ``None`` to omi... | python | {
"resource": ""
} |
q248495 | make_wifi | train | def make_wifi(ssid, password, security, hidden=False):
"""\
Creates a WIFI configuration QR Code.
:param str ssid: The SSID of the network.
:param str|None password: The password.
:param str|None security: Authentication type; the value should
| python | {
"resource": ""
} |
q248496 | make_mecard_data | train | def make_mecard_data(name, reading=None, email=None, phone=None, videophone=None,
memo=None, nickname=None, birthday=None, url=None,
pobox=None, roomno=None, houseno=None, city=None,
prefecture=None, zipcode=None, country=None):
"""\
Creates a strin... | python | {
"resource": ""
} |
q248497 | make_geo_data | train | def make_geo_data(lat, lng):
"""\
Creates a geo location URI.
:param float lat: Latitude
:param float lng: Longitude
:rtype: str
"""
def float_to_str(f): | python | {
"resource": ""
} |
q248498 | boost_error_level | train | def boost_error_level(version, error, segments, eci, is_sa=False):
"""\
Increases the error level if possible.
:param int version: Version constant.
:param int|None error: Error level constant or ``None``
:param Segments segments: Instance of :py:class:`Segments`
:param bool eci: Indicates if E... | python | {
"resource": ""
} |
q248499 | write_segment | train | def write_segment(buff, segment, ver, ver_range, eci=False):
"""\
Writes a segment.
:param buff: The byte buffer.
:param _Segment segment: The segment to serialize.
:param ver: ``None`` if a QR Code is written, "M1", "M2", "M3", or "M4" if a
Micro QR Code is written.
:param ver_rang... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.