text stringlengths 81 112k |
|---|
r"""
Sort file data.
:param fname: Name of the comma-separated values file to sort
:type fname: FileNameExists_
:param order: Sort order
:type order: :ref:`CsvColFilter`
:param has_header: Flag that indicates whether the comma-separated
values file to sort has column ... |
Create the aiohttp session and run the example.
async def main() -> None:
"""Create the aiohttp session and run the example."""
logging.basicConfig(level=logging.INFO)
async with ClientSession() as websession:
try:
# Create a client:
client = Client(websession)
... |
Makes a Call to the LBRY API
:param str method: Method to call from the LBRY API. See the full list of methods at
https://lbryio.github.io/lbry/cli/
:param dict params: Parameters to give the method selected
:param float timeout: The number of seconds to wait for a connection until we ... |
수집 상태 확인
args
CorpNum : 팝빌회원 사업자번호
JobID : 작업아이디
UserID : 팝빌회원 아이디
return
수집 상태 정보
raise
PopbillException
def getJobState(self, CorpNum, JobID, UserID=None):
""" 수집 상태 확인
args
... |
수집 결과 조회
args
CorpNum : 팝빌회원 사업자번호
JobID : 작업아이디
Type : 문서형태 배열, N-일반전자세금계산서, M-수정전자세금계산서
TaxType : 과세형태 배열, T-과세, N-면세, Z-영세
PurposeType : 영수/청구, R-영수, C-청구, N-없음
TaxRegIDType : 종사업장번호 사업자유형, S-공급자, B-공급받는자, T-수... |
수집 결과 요약정보 조회
args
CorpNum : 팝빌회원 사업자번호
JobID : 작업아이디
Type : 문서형태 배열, N-일반전자세금계산서, M-수정전자세금계산서
TaxType : 과세형태 배열, T-과세, N-면세, Z-영세
PurposeType : 영수/청구, R-영수, C-청구, N-없음
TaxRegIDType : 종사업장번호 사업자유형, S-공급자, B-공급받는자... |
전자세금계산서 상세정보 확인
args
CorpNum : 팝빌회원 사업자번호
NTSConfirmNum : 국세청 승인번호
UserID : 팝빌회원 아이디
return
전자세금계산서 정보객체
raise
PopbillException
def getTaxinvoice(self, CorpNum, NTSConfirmNum, UserID=None):
""" 전... |
전자세금계산서 상세정보 확인 - XML
args
CorpNum : 팝빌회원 사업자번호
NTSConfirmNum : 국세청 승인번호
UserID : 팝빌회원 아이디
return
전자세금계산서 정보객체
raise
PopbillException
def getXML(self, CorpNum, NTSConfirmNum, UserID=None):
""" 전자... |
홈택스 전자세금계산서 보기 팝업 URL
args
CorpNum : 팝빌회원 사업자번호
NTSConfirmNum : 국세청 승인 번호
UserID : 팝빌회원 아이디
return
전자세금계산서 보기 팝업 URL 반환
raise
PopbillException
def getPopUpURL(self, CorpNum, NTSConfirmNum, UserID=None):
... |
This method may be used to create a new document for writing as xml
to the OPS subdirectory of the ePub structure.
def make_document(self, titlestring):
"""
This method may be used to create a new document for writing as xml
to the OPS subdirectory of the ePub structure.
"""
... |
This function will write a document to an XML file.
def write_document(self, name, document):
"""
This function will write a document to an XML file.
"""
with open(name, 'wb') as out:
out.write(etree.tostring(document,
encoding='utf-8',
... |
Receives a date_tuple object, and outputs a string
for placement in the article content.
def format_date_string(self, date_tuple):
"""
Receives a date_tuple object, and outputs a string
for placement in the article content.
"""
months = ['', 'January', 'February', 'March... |
Returns True if the article has out-of-flow tables, indicates separate
tables document.
This method is used to indicate whether rendering this article's content
will result in the creation of out-of-flow HTML tables. This method has
a base class implementation representing a common logi... |
Ingests an Article to create navigation structures and parse global
metadata.
def process(self, article):
"""
Ingests an Article to create navigation structures and parse global
metadata.
"""
if self.article is not None and not self.collection:
log.warning('C... |
This is a wrapper for depth-first recursive analysis of the article
def map_navigation(self):
"""
This is a wrapper for depth-first recursive analysis of the article
"""
#All articles should have titles
title_id = 'titlepage-{0}'.format(self.article_doi)
title_label = se... |
This function recursively traverses the content of an input article to
add the correct elements to the NCX file's navMap and Lists.
def recursive_article_navmap(self, src_element, depth=0, first=True):
"""
This function recursively traverses the content of an input article to
add the co... |
Creates the NCX specified file for EPUB2
def render_EPUB2(self, location):
"""
Creates the NCX specified file for EPUB2
"""
def make_navlabel(text):
"""
Creates and returns a navLabel element with the supplied text.
"""
navlabel = etree.E... |
Create 1D Gaussian. Source:
http://mathworld.wolfram.com/GaussianFunction.html
def funcGauss1D(x, mu, sig):
""" Create 1D Gaussian. Source:
http://mathworld.wolfram.com/GaussianFunction.html
"""
arrOut = np.exp(-np.power((x - mu)/sig, 2.)/2)
# normalize
# arrOut = arrOut/(np.sqrt(2.*np.pi)*s... |
Create 2D Gaussian kernel. Source:
http://mathworld.wolfram.com/GaussianFunction.html
def funcGauss2D(varSizeX, varSizeY, varPosX, varPosY, varSd):
""" Create 2D Gaussian kernel. Source:
http://mathworld.wolfram.com/GaussianFunction.html
"""
varSizeX = int(varSizeX)
varSizeY = int(varSizeY)
... |
Function for convolution of pixel-wise 'design matrix' with HRF model.
def funcConvPar(aryDm,
vecHrf,
varNumVol):
"""
Function for convolution of pixel-wise 'design matrix' with HRF model.
"""
# In order to avoid an artefact at the end of the time series, we have to
... |
Simulates an AR(1) model using the parameters beta, c, and sigma.
Returns an array with length n
n := number of time points
beta := correlation weight
sigma := standard deviation of the noise, can be a vector
c := constant added to the noise, default 0
based on:
source1: https://github.com... |
Function for creating neural time course models.
This function should be used to create neural models if different
predictors for every motion direction are included.
def funcNrlTcMotPred(idxPrc,
varPixX,
varPixY,
NrlMdlChunk,
... |
Function for finding best pRF model for voxel time course.
This function should be used if there is only one predictor.
def funcFindPrf(idxPrc,
aryFuncChnk,
aryPrfTc,
aryMdls,
queOut):
"""
Function for finding best pRF model for voxel time co... |
Function for finding best pRF model for voxel time course.
This function should be used if there are several predictors.
def funcFindPrfMltpPrdXVal(idxPrc,
aryFuncChnkTrn,
aryFuncChnkTst,
aryPrfMdlsTrnConv,
... |
r"""
Concatenate two comma-separated values file.
Data rows from the second file are appended at the end of the data rows
from the first file
:param fname1: Name of the first comma-separated values file, the file
whose data appears first in the output file
:type fname1: FileNam... |
Handles the movement of images to the cache. Must be helpful if it finds
that the folder for this article already exists.
def move_images_to_cache(source, destination):
"""
Handles the movement of images to the cache. Must be helpful if it finds
that the folder for this article already exists.
"""
... |
The method used to handle an explicitly defined image directory by the
user as a parsed argument.
def explicit_images(images, image_destination, rootname, config):
"""
The method used to handle an explicitly defined image directory by the
user as a parsed argument.
"""
log.info('Explicit image ... |
The method used to handle Input-Relative image inclusion.
def input_relative_images(input_path, image_destination, rootname, config):
"""
The method used to handle Input-Relative image inclusion.
"""
log.debug('Looking for input relative images')
input_dirname = os.path.dirname(input_path)
for ... |
The method to be used by get_images() for copying images out of the cache.
def image_cache(article_cache, img_dir):
"""
The method to be used by get_images() for copying images out of the cache.
"""
log.debug('Looking for image directory in the cache')
if os.path.isdir(article_cache):
log.i... |
Main logic controller for the placement of images into the output directory
Controlling logic for placement of the appropriate imager files into the
EPUB directory. This function interacts with interface arguments as well as
the local installation config.py file. These may change behavior of this
funct... |
Initiates the image cache if it does not exist
def make_image_cache(img_cache):
"""
Initiates the image cache if it does not exist
"""
log.info('Initiating the image cache at {0}'.format(img_cache))
if not os.path.isdir(img_cache):
utils.mkdir_p(img_cache)
utils.mkdir_p(os.path.join... |
Fetch the images from Frontiers' website. This method may fail to properly
locate all the images and should be avoided if the files can be accessed
locally. Downloading the images to an appropriate directory in the cache,
or to a directory specified by passed argument are the preferred means to
access i... |
Fetch the images for a PLoS article from the internet.
PLoS images are known through the inspection of <graphic> and
<inline-graphic> elements. The information in these tags are then parsed
into appropriate URLs for downloading.
def fetch_plos_images(article_doi, output_dir, document):
"""
Fetch t... |
Save empirical and fitted time courses to nii file format.
Parameters
----------
strCsvCnfg : str
Absolute file path of config file used for pRF fitting.
lgcTest : boolean
Whether this is a test (pytest). If yes, absolute path of pyprf libary
will be prepended to config file pat... |
Simulate pRF response given pRF parameters and stimulus apertures.
Parameters
----------
strPrior : str
Absolute file path of config file used for pRF fitting.
strStmApr : str
Absolute file path to stimulus aperture used in in-silico experiment.
lgcNoise : boolean
Should noi... |
Return the dict element whose numeric key is closest to a target.
def get_nearest_by_numeric_key(data: dict, key: int) -> Any:
"""Return the dict element whose numeric key is closest to a target."""
return data.get(key, data[min(data.keys(), key=lambda k: abs(k - key))]) |
Create a blueprint resource route from a decorated function.
:param uri: endpoint at which the route will be accessible.
:param methods: list of acceptable HTTP methods.
:param host:
:param strict_slashes:
:param version:
:param name: user defined route name for url_for
... |
Create a blueprint resource route from a function.
:param uri: endpoint at which the route will be accessible.
:param methods: list of acceptable HTTP methods.
:param host:
:param strict_slashes:
:param version:
:param name: user defined route name for url_for
:r... |
Returns the connection to the database using the settings.
This function should not be called outside of this file.
Use db instead.
def _get_db():
"""
Returns the connection to the database using the settings.
This function should not be called outside of this file.
Use db instead.
"""
... |
Calculate voxel betas and R^2 for the best model.
Parameters
----------
idxPrc : TODO
(?)
aryPrfTc : np.array, shape (?)
Population receptive field time courses.
lstAllMdlInd : list
List of the indices of all models.
aryFuncChnk : TODO
Chunk of something(?)
a... |
Frontiers method.
Given an Article class instance, this is responsible for returning the
names for creators of the article. For our purposes, it is sufficient to
list only the authors, returning their name, role=aut, and file-as name.
This returns a list of Creator(name, role, file_as)... |
Frontiers method.
Given an Article class instance, this will return a string representing
the title of the article. This is done for PloS by serializing the text
in the Article's
def nav_title(self, article):
"""
Frontiers method.
Given an Article class instance, this ... |
This method may be built to support elements from different Tag Suite
versions with the following tag names:
citation, element-citation, mixed-citation, and nlm-citation
The citation-type attribute is optional, and may also be empty; if it has a
value then it should appear in the following prescrib... |
Attempts to resolve a PLoS DOI into a URL path to the XML file.
def plos_doi_to_xmlurl(doi_string):
"""
Attempts to resolve a PLoS DOI into a URL path to the XML file.
"""
#Create URL to request DOI resolution from http://dx.doi.org
doi_url = 'http://dx.doi.org/{0}'.format(doi_string)
log.debug... |
This method accepts a DOI string and attempts to download the appropriate
xml file. If successful, it returns a path to that file. As with all URL
input types, the success of this method depends on supporting per-publisher
conventions and will fail on unsupported publishers
def doi_input(doi_string, downlo... |
This method expects a direct URL link to an xml file. It will apply no
modifications to the received URL string, so ensure good input.
def url_input(url_string, download=True):
"""
This method expects a direct URL link to an xml file. It will apply no
modifications to the received URL string, so ensure... |
This method provides support for Frontiers production using base zipfiles
as the input for ePub creation. It expects a valid pathname for one of the
two zipfiles, and that both zipfiles are present in the same directory.
def frontiersZipInput(zip_path, output_prefix, download=None):
"""
This method pro... |
Raises an RedValidationError, if the given listing does not comply with cwl_job_listing_schema.
If listing is None or an empty list, no exception is thrown.
:param key: The input key to build an error message if needed.
:param listing: The listing to validate
:raise RedValidationError: If the given lis... |
Returns a list of mounting connectors
:param red_data: The red data to be searched
:param ignore_outputs: If outputs should be ignored
:return: A list of connectors with active mount option.
def red_get_mount_connectors(red_data, ignore_outputs):
"""
Returns a list of mounting connectors
:par... |
Invokes the cleanup functions for all inputs.
def cleanup(connector_manager, red_data, tmp_dir):
"""
Invokes the cleanup functions for all inputs.
"""
for key, arg in red_data['inputs'].items():
val = arg
if isinstance(arg, list):
for index, i in enumerate(arg):
... |
Executes a connector by executing the given connector_command. The content of args will be the content of the
files handed to the connector cli.
:param connector_command: The connector command to execute.
:param top_level_argument: The top level command line argument for the connector cli.
... |
Checks if a given listing is present under the given directory path.
:param directory_path: The path to the base directory
:param listing: The listing to check
:return: None if no errors could be found, otherwise a string describing the error
def directory_listing_content_check(directory_path,... |
Imports pycuda at runtime and reads GPU information.
:return: A list of available cuda GPUs.
def get_cuda_devices():
"""
Imports pycuda at runtime and reads GPU information.
:return: A list of available cuda GPUs.
"""
devices = []
try:
import pycuda.autoinit
import pycuda.... |
Determines sufficient GPUs for the given requirements and returns a list of GPUDevices.
If there aren't sufficient GPUs a InsufficientGPUException is thrown.
:param available_devices: A list of GPUDevices
:param requirements: A list of GPURequirements
:return: A list of sufficient devices
def match_g... |
Extracts the GPU from a dictionary requirements as list of GPURequirements.
:param gpus_reqs: A dictionary {'count': <count>} or a list [{min_vram: <min_vram>}, {min_vram: <min_vram>}, ...]
:return: A list of GPURequirements
def get_gpu_requirements(gpus_reqs):
"""
Extracts the GPU from a dictionary r... |
Updates a dictionary containing environment variables to setup Nvidia-GPUs.
:param environment: The environment variables to update
:param gpu_ids: A list of GPU ids
def set_nvidia_environment_variables(environment, gpu_ids):
"""
Updates a dictionary containing environment variables to setup Nvidia-GP... |
Returns whether the device is sufficient for this requirement.
:param device: A GPUDevice instance.
:type device: GPUDevice
:return: True if the requirement is fulfilled otherwise False
def is_sufficient(self, device):
"""
Returns whether the device is sufficient for this requi... |
Cross-platform placement of cached files
def cache_location():
'''Cross-platform placement of cached files'''
plat = platform.platform()
log.debug('Platform read as: {0}'.format(plat))
if plat.startswith('Windows'):
log.debug('Windows platform detected')
return os.path.join(os.environ['... |
If the config.py file exists, import it as a module. If it does not exist,
call sys.exit() with a request to run oaepub configure.
def load_config_module():
"""
If the config.py file exists, import it as a module. If it does not exist,
call sys.exit() with a request to run oaepub configure.
"""
... |
This function receives two strings representing system paths. The first is
the working directory and it should be an absolute path. The second is the
relative path and it should not be absolute. This function will render an
OS-appropriate absolute path, which is the normalized path from working
to relat... |
This function will return an appropriate absolute path for the path it is
given. If the input is absolute, it will return unmodified; if the input is
relative, it will be rendered as relative to the current working directory.
def get_absolute_path(some_path):
"""
This function will return an appropriat... |
Determination of the directory for output placement involves possibilities
for explicit user instruction (absolute path or relative to execution) and
implicit default configuration (absolute path or relative to input) from
the system global configuration file. This function is responsible for
reliably r... |
Returns the root name of a file from a full file path.
It will not raise an error if the result is empty, but an warning will be
issued.
def file_root_name(name):
"""
Returns the root name of a file from a full file path.
It will not raise an error if the result is empty, but an warning will be
... |
Generator function that will iterate over all files in the specified
directory and return a path to the files which possess a matching extension.
You should include the period in your extension, and matching is not case
sensitive: '.xml' will also match '.XML' and vice versa.
An empty string passed to... |
This method takes the name of an epub file as an argument. This name is
the input for the java execution of a locally installed epubcheck-.jar. The
location of this .jar file is configured in config.py.
def epubcheck(epubname, config=None):
"""
This method takes the name of an epub file as an argument.... |
If a directory already exists that will be overwritten by some action, this
will ask the user whether or not to continue with the deletion.
If the user responds affirmatively, then the directory will be removed. If
the user responds negatively, then the process will abort.
def dir_exists(directory):
"... |
Get the closest dict entry based on latitude/longitude.
def get_nearest_by_coordinates(
data: list, latitude_key: str, longitude_key: str,
target_latitude: float, target_longitude: float) -> Any:
"""Get the closest dict entry based on latitude/longitude."""
return min(
data,
key... |
Determine the distance between two latitude/longitude pairs.
def haversine(lat1: float, lon1: float, lat2: float, lon2: float) -> float:
"""Determine the distance between two latitude/longitude pairs."""
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
# haversine formula
dlon = lon2 - ... |
Returns an iterator over all of the insertion points in a given file.
def in_file(self, fn: str) -> Iterator[InsertionPoint]:
"""
Returns an iterator over all of the insertion points in a given file.
"""
logger.debug("finding insertion points in file: %s", fn)
yield from self.__... |
Returns an iterator over all of the insertion points located at a
given line.
def at_line(self, line: FileLine) -> Iterator[InsertionPoint]:
"""
Returns an iterator over all of the insertion points located at a
given line.
"""
logger.debug("finding insertion points at li... |
휴폐업조회 단가 확인.
args
CorpNum : 팝빌회원 사업자번호
return
발행단가 by float
raise
PopbillException
def getUnitCost(self, CorpNum):
""" 휴폐업조회 단가 확인.
args
CorpNum : 팝빌회원 사업자번호
return
발행단가 b... |
휴폐업조회 - 단건
args
MemberCorpNum : 팝빌회원 사업자번호
CorpNum : 조회할 사업자번호
MgtKey : 문서관리번호
return
휴폐업정보 object
raise
PopbillException
def checkCorpNum(self, MemberCorpNum, CheckCorpNum):
""" 휴폐업조회 - 단건
... |
휴폐업조회 대량 확인, 최대 1000건
args
MemberCorpNum : 팝빌회원 사업자번호
CorpNumList : 조회할 사업자번호 배열
return
휴폐업정보 Object as List
raise
PopbillException
def checkCorpNums(self, MemberCorpNum, CorpNumList):
""" 휴폐업조회 대량 확인, 최대 1000건
... |
Load PNG files.
Parameters
----------
varNumVol : float
Number of volumes, i.e. number of time points in all runs.
tplPngSize : tuple
Shape of the stimulus image (i.e. png).
strPathPng: str
Path to the folder cointaining the png files.
Returns
-------
aryPngData ... |
Load presentation order of motion directions.
Parameters
----------
vecRunLngth : list
Number of volumes in every run
strPathPresOrd : str
Path to the npy vector containing order of presented motion directions.
vecVslStim: list
Key of (stimulus) condition presented in every ... |
Create pixel-wise boxcar functions.
Parameters
----------
input1 : 2d numpy array, shape [n_samples, n_measurements]
Description of input 1.
input2 : float, positive
Description of input 2.
Returns
-------
data : 2d numpy array, shape [n_samples, n_measurements]
Closed... |
Create 2D Gaussian kernel.
Parameters
----------
varSizeX : int, positive
Width of the visual field.
varSizeY : int, positive
Height of the visual field..
varPosX : int, positive
X position of centre of 2D Gauss.
varPosY : int, positive
Y position of centre of 2D... |
Spatially convolve boxcar functions with 2D Gaussian.
Parameters
----------
idxPrc : 2d numpy array, shape [n_samples, n_measurements]
Description of input 1.
aryBoxCar : float, positive
Description of input 2.
aryMdlParamsChnk : 2d numpy array, shape [n_samples, n_measurements]
... |
Create neural model time courses from pixel-wise boxcar functions.
Parameters
----------
aryBoxCar : 4d numpy array, shape [n_x_pix, n_y_pix, n_mtn_dir, n_vol]
Description of input 1.
varNumMtDrctn : float, positive
Description of input 2.
varNumVol : float, positive
Descrip... |
Create 2D Gaussian kernel.
Parameters
----------
aryNrlTc : 5d numpy array, shape [n_x_pos, n_y_pos, n_sd, n_mtn_dir, n_vol]
Description of input 1.
varNumVol : float, positive
Description of input 2.
varTr : float, positive
Description of input 1.
tplPngSize : tuple
... |
Resample pixel-time courses in high-res visual space.
Parameters
----------
input1 : 2d numpy array, shape [n_samples, n_measurements]
Description of input 1.
input2 : float, positive
Description of input 2.
Returns
-------
data : 2d numpy array, shape [n_samples, n_measuremen... |
Parses the Command Line Arguments using argparse.
def get_arg_parse():
"""Parses the Command Line Arguments using argparse."""
# Create parser object:
objParser = argparse.ArgumentParser()
# Add argument to namespace -strCsvPrf results file path:
objParser.add_argument('-strCsvPrf', required=True,... |
pyprf_sim entry point.
def main():
"""pyprf_sim entry point."""
# Get list of input arguments (without first one, which is the path to the
# function that is called): --NOTE: This is another way of accessing
# input arguments, but since we use 'argparse' it is redundant.
# lstArgs = sys.argv[1:]
... |
Requires that the user is logged in and authorized to execute requests
Except if the method is in authorized_methods of the auth_collection
Then he can execute the requests even not being authorized
def login_required(wrapped):
"""
Requires that the user is logged in and authorized to execute requests
... |
If a keyword argument 'serialize' with a True value is passed to the
Wrapped function, the return of the wrapped function will be serialized.
Nothing happens if the argument is not passed or the value is not True
def serializable(wrapped):
"""
If a keyword argument 'serialize' with a True value is pass... |
Deserializes a string into a PyMongo BSON
def deserialize(to_deserialize, *args, **kwargs):
"""
Deserializes a string into a PyMongo BSON
"""
if isinstance(to_deserialize, string_types):
if re.match('^[0-9a-f]{24}$', to_deserialize):
return ObjectId(to_deserialize)
try:
... |
Tries to atomically create the requested file.
def _doAtomicFileCreation(filePath):
"""Tries to atomically create the requested file."""
try:
_os.close(_os.open(filePath, _os.O_CREAT | _os.O_EXCL))
return True
except OSError as e:
if e.errno == _errno.EEXIST:
return Fals... |
Finds the next available file-name in a sequence.
This function will create a file of zero size and will return the path to
it to the caller. No files which exist will be altered in this operation
and concurrent executions of this function will return separate files. In
case of conflict, the function w... |
Executes the script, gets prefix/suffix from the command prompt and
produces output on STDOUT. For help with command line options, invoke
script with '--help'.
def _run(passedArgs=None, stderr=None, stdout=None, exitFn=None):
"""Executes the script, gets prefix/suffix from the command prompt and
produc... |
Returns the value str, truncated to MAX_ERROR_STR_LEN characters. If
it's truncated, the returned value will have '...' on the end.
def _errstr(value):
"""Returns the value str, truncated to MAX_ERROR_STR_LEN characters. If
it's truncated, the returned value will have '...' on the end.
"""
value =... |
Like the strip() string method, except the strip argument describes
different behavior:
If strip is None, whitespace is stripped.
If strip is a string, the characters in the string are stripped.
If strip is False, nothing is stripped.
def _getStrippedValue(value, strip):
"""Like the strip() stri... |
Raise ValidationException with standardExcMsg, unless customExcMsg is specified.
def _raiseValidationException(standardExcMsg, customExcMsg=None):
"""Raise ValidationException with standardExcMsg, unless customExcMsg is specified."""
if customExcMsg is None:
raise ValidationException(str(standardExcMsg... |
Returns a tuple of two values: the first is a bool that tells the caller
if they should immediately return True, the second is a new, possibly stripped
value to replace the value passed for value parameter.
We'd want the caller immediately return value in some cases where further
validation isn't neede... |
Returns None if the blank, strip, and blocklistRegexes parameters are valid
of PySimpleValidate's validation functions have. Raises a PySimpleValidateException
if any of the arguments are invalid.
def _validateGenericParameters(blank, strip, allowlistRegexes, blocklistRegexes):
"""Returns None if the blank... |
Raises an exception if the arguments are invalid. This is called by
the validateNum(), validateInt(), and validateFloat() functions to
check its arguments. This code was refactored out to a separate function
so that the PyInputPlus module (or other modules) could check their
parameters' arguments for in... |
Raises ValidationException if value is not a string. This function
is identical to the built-in input() function, but also offers the
PySimpleValidate features of not allowing blank values by default,
automatically stripping whitespace, and having allowlist/blocklist
regular expressions.
Returns va... |
Raises ValidationException if value is not a float or int.
Returns value, so it can be used inline in an expression:
print(2 + validateNum(your_number))
Note that since int() and float() ignore leading or trailing whitespace
when converting a string to a number, so does this validateNum().
*... |
Raises ValidationException if value is not a int.
Returns value, so it can be used inline in an expression:
print(2 + validateInt(your_number))
Note that since int() and ignore leading or trailing whitespace
when converting a string to a number, so does this validateNum().
* value (str): The... |
Raises PySimpleValidateException if the arguments are invalid. This is called by
the validateChoice() function to check its arguments. This code was
refactored out to a separate function so that the PyInputPlus module (or
other modules) could check their parameters' arguments for inputChoice().
def _valida... |
Raises ValidationException if value is not one of the values in
choices. Returns the selected choice.
Returns the value in choices that was selected, so it can be used inline
in an expression:
print('You chose ' + validateChoice(your_choice, ['cat', 'dog']))
Note that value itself is not retu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.