text stringlengths 81 112k |
|---|
Get the value associated with a name in the current context.
The current context could be an dictionary in a list, or a dictionary
outside a list.
Args:
name: name to lookup, e.g. 'foo' or 'foo.bar.baz'
Returns:
The value, or self.undefined_str
Raises:
UndefinedVariable if self... |
Low level method to expand the template piece by piece.
Args:
data_dict: The JSON data dictionary.
callback: A callback which should be called with each expanded token.
group: Dictionary of name -> Template instance (for styles)
Example: You can pass 'f.write' as the callback to write direct... |
Expands the template with the given data dictionary, returning a string.
This is a small wrapper around execute(), and is the most convenient
interface.
Args:
data_dict: The JSON data dictionary. Like the builtin dict() constructor,
it can take a single dictionary as a positional argument... |
Yields a list of tokens resulting from expansion.
This may be useful for WSGI apps. NOTE: In the current implementation, the
entire expanded template must be stored memory.
NOTE: This is a generator, but JavaScript doesn't have generators.
def tokenstream(self, data_dict):
"""Yields a list of to... |
Align an unwrapped phase array to zero-phase
All operations are performed in-place.
def align_unwrapped(sino):
"""Align an unwrapped phase array to zero-phase
All operations are performed in-place.
"""
samples = []
if len(sino.shape) == 2:
# 2D
# take 1D samples at beginning a... |
Return divmod with closest result to zero
def divmod_neg(a, b):
"""Return divmod with closest result to zero"""
q, r = divmod(a, b)
# make sure r is close to zero
sr = np.sign(r)
if np.abs(r) > b/2:
q += sr
r -= b * sr
return q, r |
r"""Compute the phase from a complex wave field sinogram
This step is essential when using the ray approximation before
computation of the refractive index with the inverse Radon
transform.
Parameters
----------
uSin: 2d or 3d complex ndarray
The background-corrected sinogram of the co... |
r"""Convert the complex wave field sinogram to the Rytov phase
This method applies the Rytov approximation to the
recorded complex wave sinogram. To achieve this, the following
filter is applied:
.. math::
u_\mathrm{B}(\mathbf{r}) = u_\mathrm{0}(\mathbf{r})
\ln\!\left(
... |
Handle more data types than the default JSON encoder.
Specifically, it treats a `set` and a `numpy.array` like a `list`.
Example usage: ``json.dumps(obj, default=json_encoder_default)``
def json_encoder_default(obj):
"""Handle more data types than the default JSON encoder.
Specifically, it treats a ... |
Convert a matplotlib figure to an inline HTML image.
:param matplotlib.figure.Figure figure: Figure to display.
:param str image_format: png (default) or svg
:param int dpi: dots-per-inch for raster graphics.
:rtype: str
def fig_to_src(figure, image_format='png', dpi=80):
"""Convert a matplotlib f... |
Reset Axis and set default parameters for H-bridge
def Reset(self):
' Reset Axis and set default parameters for H-bridge '
spi.SPI_write(self.CS, [0xC0, 0x60]) # reset
# spi.SPI_write(self.CS, [0x14, 0x14]) # Stall Treshold setup
# spi.SPI_write(self.CS, [0xFF, 0xFF])
# ... |
Setup of maximum speed
def MaxSpeed(self, speed):
' Setup of maximum speed '
spi.SPI_write(self.CS, [0x07, 0x07]) # Max Speed setup
spi.SPI_write(self.CS, [0x00, 0x00])
spi.SPI_write(self.CS, [speed, speed]) |
Go away from Limit Switch
def ReleaseSW(self):
' Go away from Limit Switch '
while self.ReadStatusBit(2) == 1: # is Limit Switch ON ?
spi.SPI_write(self.CS, [0x92, 0x92] | (~self.Dir & 1)) # release SW
while self.IsBusy():
pass
self.Mov... |
Move some distance units from current position
def Move(self, units):
' Move some distance units from current position '
steps = units * self.SPU # translate units to steps
if steps > 0: # look for direction
spi.SPI_write(self.CS, [0x40 | (... |
create a bounding box vector object or shapefile from coordinates and coordinate reference system.
The CRS can be in either WKT, EPSG or PROJ4 format
Parameters
----------
coordinates: dict
a dictionary containing numerical variables with keys `xmin`, `xmax`, `ymin` and `ymax`
crs: int,... |
dissolve the polygons of a vector file by an attribute field
Parameters
----------
infile: str
the input vector file
outfile: str
the output shapefile
field: str
the field name to merge the polygons by
layername: str
the name of the output vector layer;
If... |
create a Vector object from ogr features
Parameters
----------
feature: list of :osgeo:class:`ogr.Feature` or :osgeo:class:`ogr.Feature`
a single feature or a list of features
ref: Vector
a reference Vector object to retrieve geo information from
layername: str or None
the n... |
intersect two Vector objects
Parameters
----------
obj1: Vector
the first vector object; this object is reprojected to the CRS of obj2 if necessary
obj2: Vector
the second vector object
Returns
-------
Vector
the intersect of obj1 and obj2
def intersect(obj1, obj2)... |
add a feature to the vector object from a geometry
Parameters
----------
geometry: :osgeo:class:`ogr.Geometry`
the geometry to add as a feature
fields: dict or None
the field names and values to assign to the new feature
Returns
-------
... |
add a field to the vector layer
Parameters
----------
name: str
the field name
type: int
the OGR Field Type (OFT), e.g. ogr.OFTString.
See `Module ogr <https://gdal.org/python/osgeo.ogr-module.html>`_.
width: int
the width of the n... |
add a layer to the vector layer
Parameters
----------
name: str
the layer name
srs: int, str or :osgeo:class:`osr.SpatialReference`
the spatial reference system. See :func:`spatialist.auxil.crsConvert` for options.
geomType: int
an OGR well-kn... |
add a vector object to the layer of the current Vector object
Parameters
----------
vec: Vector
the vector object to add
merge: bool
merge overlapping polygons?
Returns
-------
def addvector(self, vec):
"""
add a vector object to... |
create a bounding box from the extent of the Vector object
Parameters
----------
outname: str or None
the name of the vector file to be written; if None, a Vector object is returned
format: str
the name of the file format to write
overwrite: bool
... |
export the geometry of each feature as a wkt string
Parameters
----------
set3D: bool
keep the third (height) dimension?
Returns
-------
def convert2wkt(self, set3D=True):
"""
export the geometry of each feature as a wkt string
Parameters
... |
get features by field attribute
Parameters
----------
fieldname: str
the name of the queried field
attribute: int or str
the field value of interest
Returns
-------
list of :osgeo:class:`ogr.Feature` or :osgeo:class:`ogr.Feature`
... |
get features by numerical (positional) index
Parameters
----------
index: int
the queried index
Returns
-------
:osgeo:class:`ogr.Feature`
the requested feature
def getFeatureByIndex(self, index):
"""
get features by numerical (p... |
initialize a layer object
Returns
-------
def init_layer(self):
"""
initialize a layer object
Returns
-------
"""
self.layer = self.vector.GetLayer()
self.__features = [None] * self.nfeatures |
load all feature into memory
Returns
-------
def load(self):
"""
load all feature into memory
Returns
-------
"""
self.layer.ResetReading()
for i in range(self.nfeatures):
if self.__features[i] is None:
self.__featur... |
in-memory reprojection
Parameters
----------
projection: int, str or :osgeo:class:`osr.SpatialReference`
the target CRS. See :func:`spatialist.auxil.crsConvert`.
Returns
-------
def reproject(self, projection):
"""
in-memory reprojection
Pa... |
directly reset the spatial reference system of the vector object.
This is not going to reproject the Vector object, see :meth:`reproject` instead.
Parameters
----------
crs: int, str or :osgeo:class:`osr.SpatialReference`
the input CRS
Returns
-------
... |
write the Vector object to a file
Parameters
----------
outfile:
the name of the file to write
format: str
the output file format
overwrite: bool
overwrite an already existing file?
Returns
-------
def write(self, outfile, fo... |
SMBus Read Byte: i2c_smbus_read_byte_data()
============================================
This reads a single byte from a device, from a designated register.
The register is specified through the Comm byte.
S Addr Wr [A] Comm [A] S Addr Rd [A] [Data] NA P
Functionality flag: I... |
SMBus Write Word: i2c_smbus_write_word_data()
==============================================
This is the opposite of the Read Word operation. 16 bits
of data is written to a device, to the designated register that is
specified through the Comm byte.
S Addr Wr [A] Comm [A] Data... |
SMBus Block Write: i2c_smbus_write_block_data()
================================================
The opposite of the Block Read command, this writes up to 32 bytes to
a device, to a designated register that is specified through the
Comm byte. The amount of data is specified in the Coun... |
SMBus Block Write - Block Read Process Call
===========================================
SMBus Block Write - Block Read Process Call was introduced in
Revision 2.0 of the specification.
This command selects a device register (through the Comm byte), sends
1 to 31 bytes of data t... |
I2C block transactions do not limit the number of bytes transferred
but the SMBus layer places a limit of 32 bytes.
I2C Block Write: i2c_smbus_write_i2c_block_data()
==================================================
The opposite of the Block Read command, this writes bytes to
... |
I2C block transactions do not limit the number of bytes transferred
but the SMBus layer places a limit of 32 bytes.
I2C Block Read: i2c_smbus_read_i2c_block_data()
================================================
This command reads a block of bytes from a device, from a
design... |
Initialize zmq messaging.
Listen on sub_port. This port might at
some point receive the message to start publishing on a certain
port, but until then, no publishing.
def _init_zmq(self, port_publish, port_subscribe):
"""Initialize zmq messaging.
Listen on sub_port. This port m... |
Executes an process in the analysis with the given message.
It also handles the start and stop signals in case an process_id
is given.
This method is similar to the method in databench.Analysis.
def run_process(self, analysis, action_name, message='__nomessagetoken__'):
"""Executes an... |
Event loop.
def event_loop(self):
"""Event loop."""
try:
zmq.eventloop.ioloop.IOLoop.current().start()
except KeyboardInterrupt:
zmq.eventloop.ioloop.IOLoop.current().stop() |
Emit signal to main.
Args:
signal: Name of the signal to be emitted.
message: Message to be sent.
analysis_id: Identifies the instance of this analysis.
def emit(self, signal, message, analysis_id):
"""Emit signal to main.
Args:
signal: Name of ... |
Writes specified value to the pins defined as output by config_ports() method. Writing to input pins has no effect.
def set_ports(self, port0 = 0x00, port1 = 0x00):
'Writes specified value to the pins defined as output by config_ports() method. Writing to input pins has no effect.'
self.bus.write_byte_... |
Reads logical values at pins.
def get_ports(self):
'Reads logical values at pins.'
return (self.bus.read_byte_data(self.address, self.STATUS_PORT0), self.bus.read_byte_data(self.address, self.STATUS_PORT1)); |
Reads logical values at pins.
def get_config(self):
'Reads logical values at pins.'
return (self.bus.read_byte_data(self.address, self.CONTROL_PORT0), self.bus.read_byte_data(self.address, self.CONTROL_PORT1)); |
Sets INPUT (1) or OUTPUT (0) direction on pins. Inversion setting is applicable for input pins 1-inverted 0-noninverted input polarity.
def set_pullups(self, port0 = 0x00, port1 = 0x00):
'Sets INPUT (1) or OUTPUT (0) direction on pins. Inversion setting is applicable for input pins 1-inverted 0-noninverted i... |
Writes specified value to the pins defined as output by method. Writing to input pins has no effect.
def set_ports(self, port0 = 0x00, port1 = 0x00):
'Writes specified value to the pins defined as output by method. Writing to input pins has no effect.'
self.bus.write_byte_data(self.address, self.CONTRO... |
create a gffutils DB
def get_gtf_db(gtf, in_memory=False):
"""
create a gffutils DB
"""
db_file = gtf + '.db'
if gtf.endswith('.gz'):
db_file = gtf[:-3] + '.db'
if file_exists(db_file):
return gffutils.FeatureDB(db_file)
db_file = ':memory:' if in_memory else db_file
if ... |
create a BED file of transcript-level features with attached gene name
or gene ids
def gtf_to_bed(gtf, alt_out_dir=None):
"""
create a BED file of transcript-level features with attached gene name
or gene ids
"""
out_file = os.path.splitext(gtf)[0] + '.bed'
if file_exists(out_file):
... |
write out a file of transcript->gene mappings.
use the installed tx2gene.csv if it exists, else write a new one out
def tx2genefile(gtf, out_file=None):
"""
write out a file of transcript->gene mappings.
use the installed tx2gene.csv if it exists, else write a new one out
"""
installed_tx2gene ... |
return a dictionary keyed by transcript_id of the associated gene_id
def transcript_to_gene(gtf):
"""
return a dictionary keyed by transcript_id of the associated gene_id
"""
gene_lookup = {}
for feature in complete_features(get_gtf_db(gtf)):
gene_id = feature.attributes.get('gene_id', [Non... |
Sets new output frequency, required parameters are real current frequency at output and new required frequency.
def set_freq(self, fout, freq):
"""
Sets new output frequency, required parameters are real current frequency at output and new required frequency.
"""
hsdiv_tuple = (4, 5, 6,... |
Detects alignment requirements for binary files with new nn::util::BinaryFileHeader.
def _get_file_alignment_for_new_binary_file(self, file: File) -> int:
"""Detects alignment requirements for binary files with new nn::util::BinaryFileHeader."""
if len(file.data) <= 0x20:
return 0
b... |
Only checks and asks questions. Nothing is written to disk.
def check_folders(name):
"""Only checks and asks questions. Nothing is written to disk."""
if os.getcwd().endswith('analyses'):
correct = input('You are in an analyses folder. This will create '
'another analyses folde... |
Create an analysis with given name and suffix.
If it does not exist already, it creates the top level analyses folder
and it's __init__.py and index.yaml file.
def create_analyses(name, kernel=None):
"""Create an analysis with given name and suffix.
If it does not exist already, it creates the top le... |
Create analysis files.
def create_analysis(name, kernel, src_dir, scaffold_name):
"""Create analysis files."""
# analysis folder
folder = os.path.join(os.getcwd(), 'analyses', name)
if not os.path.exists(folder):
os.makedirs(folder)
else:
log.warning('Analysis folder {} already exi... |
convert between different types of spatial references
Parameters
----------
crsIn: int, str or :osgeo:class:`osr.SpatialReference`
the input CRS
crsOut: {'wkt', 'proj4', 'epsg', 'osr', 'opengis' or 'prettyWkt'}
the output CRS type
Returns
-------
int, str or :osgeo:class:`o... |
compute the distance in meters between two points in latlon
Parameters
----------
lat1: int or float
the latitude of point 1
lon1: int or float
the longitude of point 1
lat2: int or float
the latitude of point 2
lon2: int or float
the longitude of point 2
Re... |
a simple wrapper for :osgeo:func:`gdal.Warp`
Parameters
----------
src: str, :osgeo:class:`ogr.DataSource` or :osgeo:class:`gdal.Dataset`
the input data set
dst: str
the output data set
options: dict
additional parameters passed to gdal.Warp; see :osgeo:func:`gdal.WarpOption... |
a simple wrapper for :osgeo:func:`gdal.BuildVRT`
Parameters
----------
src: str, list, :osgeo:class:`ogr.DataSource` or :osgeo:class:`gdal.Dataset`
the input data set(s)
dst: str
the output data set
options: dict
additional parameters passed to gdal.BuildVRT; see :osgeo:func... |
a simple wrapper for `gdal.Translate <https://gdal.org/python/osgeo.gdal-module.html#Translate>`_
Parameters
----------
src: str, :osgeo:class:`ogr.DataSource` or :osgeo:class:`gdal.Dataset`
the input data set
dst: str
the output data set
options: dict
additional parameters ... |
a simple wrapper for gdal.VectorTranslate aka `ogr2ogr <https://www.gdal.org/ogr2ogr.html>`_
Parameters
----------
src: str or :osgeo:class:`ogr.DataSource`
the input data set
dst: str
the output data set
options: dict
additional parameters passed to gdal.VectorTranslate;
... |
a simple wrapper for gdal.Rasterize
Parameters
----------
src: str or :osgeo:class:`ogr.DataSource`
the input data set
dst: str
the output data set
options: dict
additional parameters passed to gdal.Rasterize; see :osgeo:func:`gdal.RasterizeOptions`
Returns
-------
... |
reproject a coordinate from one CRS to another
Parameters
----------
x: int or float
the X coordinate component
y: int or float
the Y coordinate component
s_crs: int, str or :osgeo:class:`osr.SpatialReference`
the source CRS. See :func:`~spatialist.auxil.crsConvert` for ... |
Creates output_dir, work_dir, and sets up log
def set_up_dirs(proc_name, output_dir=None, work_dir=None, log_dir=None):
""" Creates output_dir, work_dir, and sets up log
"""
output_dir = safe_mkdir(adjust_path(output_dir or join(os.getcwd(), proc_name)), 'output_dir')
debug('Saving results into ' + out... |
Generator used to yield 100 KiB chunks for a given response.
def _iter_content_generator(response, decode_unicode):
"""Generator used to yield 100 KiB chunks for a given response."""
for chunk in response.iter_content(100 * 1024, decode_unicode=decode_unicode):
if decode_unicode:
# Replace ... |
Iterates over the response data, one line at a time. When
stream=True is set on the request, this avoids reading the
content at once into memory for large responses.
The function is taken from :meth:`requests.models.Response.iter_lines`, but
modified to use our :func:`~spacetrack.base._iter_content_ge... |
Raises stored :class:`HTTPError`, if one occurred.
This is the :meth:`requests.models.Response.raise_for_status` method,
modified to add the response from Space-Track, if given.
def _raise_for_status(response):
"""Raises stored :class:`HTTPError`, if one occurred.
This is the :meth:`requests.models.R... |
r"""Generic Space-Track query.
The request class methods use this method internally; the public
API is as follows:
.. code-block:: python
st.tle_publish(*args, **kw)
st.basicspacedata.tle_publish(*args, **kw)
st.file(*args, **kw)
st.fileshare.fi... |
Perform get request, handling rate limiting.
def _ratelimited_get(self, *args, **kwargs):
"""Perform get request, handling rate limiting."""
with self._ratelimiter:
resp = self.session.get(*args, **kwargs)
# It's possible that Space-Track will return HTTP status 500 with a
... |
Find first controller that matches given request class.
Order is specified by the keys of
``SpaceTrackClient.request_controllers``
(:class:`~collections.OrderedDict`)
def _find_controller(self, class_):
"""Find first controller that matches given request class.
Order is specif... |
Get raw predicate information for given request class, and cache for
subsequent calls.
def _download_predicate_data(self, class_, controller):
"""Get raw predicate information for given request class, and cache for
subsequent calls.
"""
self.authenticate()
url = ('{0}{1... |
Get full predicate information for given request class, and cache
for subsequent calls.
def get_predicates(self, class_, controller=None):
"""Get full predicate information for given request class, and cache
for subsequent calls.
"""
if class_ not in self._predicates:
... |
Proxy ``get_predicates`` to client with stored request
controller.
def get_predicates(self, class_):
"""Proxy ``get_predicates`` to client with stored request
controller.
"""
return self.client.get_predicates(
class_=class_, controller=self.controller) |
Add the folding menu to the editor, on install.
:param editor: editor instance on which the mode has been installed to.
def on_install(self, editor):
"""
Add the folding menu to the editor, on install.
:param editor: editor instance on which the mode has been installed to.
"""... |
Draw the background rectangle using the current style primitive color
or foldIndicatorBackground if nativeFoldingIndicator is true.
:param rect: The fold zone rect to draw
:param painter: The widget's painter.
def _draw_rect(self, rect, painter):
"""
Draw the background rectan... |
Gets a system color for drawing the fold scope background.
def get_system_bck_color():
"""
Gets a system color for drawing the fold scope background.
"""
def merged_colors(colorA, colorB, factor):
maxFactor = 100
colorA = QtGui.QColor(colorA)
colorB =... |
Draw the fold indicator/trigger (arrow).
:param top: Top position
:param mouse_over: Whether the mouse is over the indicator
:param collapsed: Whether the trigger is collapsed or not.
:param painter: QPainter
def _draw_fold_indicator(self, top, mouse_over, collapsed, painter):
... |
Gets the base scope highlight color (derivated from the editor
background)
def _get_scope_highlight_color(self):
"""
Gets the base scope highlight color (derivated from the editor
background)
"""
color = self.editor.background
if color.lightness() < 128:
... |
Adds a scope decoration that enclose the current scope
:param start: Start of the current scope
:param end: End of the current scope
:param parent_start: Start of the parent scope
:param parent_end: End of the parent scope
:param base_color: base color for scope decoration
... |
Show a scope decoration on the editor widget
:param start: Start line
:param end: End line
def _add_scope_decorations(self, block, start, end):
"""
Show a scope decoration on the editor widget
:param start: Start line
:param end: End line
"""
try:
... |
Highlights the scopes surrounding the current fold scope.
:param block: Block that starts the current fold scope.
def _highlight_surrounding_scopes(self, block):
"""
Highlights the scopes surrounding the current fold scope.
:param block: Block that starts the current fold scope.
... |
Removes scope decorations and background from the editor and the panel
if highlight_caret_scope, else simply update the scope decorations to
match the caret scope.
def leaveEvent(self, event):
"""
Removes scope decorations and background from the editor and the panel
if highligh... |
Add fold decorations (boxes arround a folded block in the editor
widget).
def _add_fold_decoration(self, block, region):
"""
Add fold decorations (boxes arround a folded block in the editor
widget).
"""
deco = TextDecoration(block)
deco.signals.clicked.connect(se... |
Toggle a fold trigger block (expand or collapse it).
:param block: The QTextBlock to expand/collapse
def toggle_fold_trigger(self, block):
"""
Toggle a fold trigger block (expand or collapse it).
:param block: The QTextBlock to expand/collapse
"""
if not TextBlockHelpe... |
On state changed we (dis)connect to the cursorPositionChanged signal
def on_state_changed(self, state):
"""
On state changed we (dis)connect to the cursorPositionChanged signal
"""
if state:
self.editor.key_pressed.connect(self._on_key_pressed)
if self._highlight... |
Override key press to select the current scope if the user wants
to deleted a folded scope (without selecting it).
def _on_key_pressed(self, event):
"""
Override key press to select the current scope if the user wants
to deleted a folded scope (without selecting it).
"""
... |
Auto indent if the released key is the return key.
:param event: the key event
def _on_key_pressed(self, event):
"""
Auto indent if the released key is the return key.
:param event: the key event
"""
if not event.isAccepted():
if event.key() == Qt.Key_Return ... |
Verify that the payload was sent from our GitHub instance.
def verify_signature(self, payload, headers):
"""Verify that the payload was sent from our GitHub instance."""
github_signature = headers.get("x-hub-signature")
if not github_signature:
json_abort(401, "X-Hub-Signature heade... |
Get the options that have been set.
Called after the user has added all their own options
and is ready to use the variables.
def get_options(self):
"""Get the options that have been set.
Called after the user has added all their own options
and is ready to use the variables.
... |
Check for job definitions in known zuul files.
def parse_job_files(self):
"""Check for job definitions in known zuul files."""
repo_jobs = []
for rel_job_file_path, job_info in self.job_files.items():
LOGGER.debug("Checking for job definitions in %s", rel_job_file_path)
... |
Changes the current directory.
Change is made by running a "cd" command followed by a "clear" command.
:param directory:
:return:
def change_directory(self, directory):
"""
Changes the current directory.
Change is made by running a "cd" command followed by a "clear" co... |
Gets the icon file name. Read-only.
def icon(self):
"""
Gets the icon file name. Read-only.
"""
if isinstance(self._icon, str):
if QtGui.QIcon.hasThemeIcon(self._icon):
return QtGui.QIcon.fromTheme(self._icon)
else:
return QtGui.QI... |
Adds the marker to the panel.
:param marker: Marker to add
:type marker: pyqode.core.modes.Marker
def add_marker(self, marker):
"""
Adds the marker to the panel.
:param marker: Marker to add
:type marker: pyqode.core.modes.Marker
"""
self._markers.appen... |
Removes a marker from the panel
:param marker: Marker to remove
:type marker: pyqode.core.Marker
def remove_marker(self, marker):
"""
Removes a marker from the panel
:param marker: Marker to remove
:type marker: pyqode.core.Marker
"""
self._markers.remo... |
Returns the marker that is displayed at the specified line number if
any.
:param line: The marker line.
:return: Marker of None
:rtype: pyqode.core.Marker
def marker_for_line(self, line):
"""
Returns the marker that is displayed at the specified line number if
... |
Display tooltip at the specified top position.
def _display_tooltip(self, tooltip, top):
"""
Display tooltip at the specified top position.
"""
QtWidgets.QToolTip.showText(self.mapToGlobal(QtCore.QPoint(
self.sizeHint().width(), top)), tooltip, self) |
Search occurrences using str.find instead of regular expressions.
:param string: string to parse
:param sub: search string
:param whole_word: True to select whole words only
def finditer_noregex(string, sub, whole_word):
"""
Search occurrences using str.find instead of regular expressions.
:p... |
Generator that finds all occurrences of ``sub`` in ``string``
:param string: string to parse
:param sub: string to search
:param regex: True to search using regex
:param case_sensitive: True to match case, False to ignore case
:param whole_word: True to returns only whole words
:return:
def fi... |
Worker that finds all occurrences of a given string (or regex)
in a given text.
:param data: Request data dict::
{
'string': string to search in text
'sub': input text
'regex': True to consider string as a regular expression
'whole_word': True to match wh... |
Splits a text in a meaningful list of words based on a list of word
separators (define in pyqode.core.settings)
:param txt: Text to split
:param seps: List of words separators
:return: A **set** of words found in the document (excluding
punctuations, numbers, ...)
def split... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.