index
int64
0
731k
package
stringlengths
2
98
name
stringlengths
1
76
docstring
stringlengths
0
281k
code
stringlengths
4
8.19k
signature
stringlengths
2
42.8k
embed_func_code
listlengths
768
768
725,815
flask_admin.base
_get_view_url
Generate URL for the view. Override to change default behavior.
def _get_view_url(self, admin, url): """ Generate URL for the view. Override to change default behavior. """ if url is None: if admin.url != '/': url = '%s/%s' % (admin.url, self.endpoint) else: if self == admin.index_view: url = '/' ...
(self, admin, url)
[ -0.009386877529323101, 0.0034310161136090755, 0.05359558016061783, 0.05684727430343628, 0.020256144925951958, 0.034161921590566635, 0.049961332231760025, 0.02366086095571518, -0.05072643980383873, 0.038274358958005905, 0.01608632504940033, 0.012672046199440956, 0.0014979314291849732, -0.01...
725,816
flask_admin.base
_handle_view
This method will be executed before calling any view method. It will execute the ``inaccessible_callback`` if the view is not accessible. :param name: View function name :param kwargs: View function arguments
def _handle_view(self, name, **kwargs): """ This method will be executed before calling any view method. It will execute the ``inaccessible_callback`` if the view is not accessible. :param name: View function name :param kwargs: View function arguments...
(self, name, **kwargs)
[ -0.05104178935289383, -0.04919090121984482, -0.004827435594052076, 0.03479313105344772, 0.03384988754987717, 0.031020166352391243, 0.03600332513451576, 0.030593037605285645, -0.015278722159564495, 0.01650671474635601, 0.04054155945777893, 0.03844151273369789, 0.05086381733417511, -0.039865...
725,817
flask_admin.base
_prettify_class_name
Split words in PascalCase string into separate words. :param name: String to prettify
def _prettify_class_name(self, name): """ Split words in PascalCase string into separate words. :param name: String to prettify """ return h.prettify_class_name(name)
(self, name)
[ -0.015966802835464478, -0.016190355643630028, 0.010206028819084167, 0.0019851026590913534, -0.02887265756726265, -0.08391814678907394, 0.010627339594066143, 0.00227636587806046, 0.05041967332363129, -0.013378754258155823, -0.007407324388623238, -0.013327165506780148, -0.005958532448858023, ...
725,818
flask_admin.base
_run_view
This method will run actual view function. While it is similar to _handle_view, can be used to change arguments that are passed to the view. :param fn: View function :param kwargs: Arguments
def _run_view(self, fn, *args, **kwargs): """ This method will run actual view function. While it is similar to _handle_view, can be used to change arguments that are passed to the view. :param fn: View function :param kwargs: Arguments """ try...
(self, fn, *args, **kwargs)
[ 0.033777378499507904, -0.07123120874166489, 0.011948460713028908, 0.025328615680336952, 0.028209680691361427, 0.04280942678451538, -0.0004200630937702954, 0.04570816457271576, -0.01127680204808712, -0.014175540767610073, 0.010393040254712105, 0.06437321752309799, 0.03892087563872337, -0.01...
725,819
flask_admin.base
create_blueprint
Create Flask blueprint.
def create_blueprint(self, admin): """ Create Flask blueprint. """ # Store admin instance self.admin = admin # If the static_url_path is not provided, use the admin's if not self.static_url_path: self.static_url_path = admin.static_url_path # Generate URL self.url = self....
(self, admin)
[ 0.010245272889733315, 0.0003790058835875243, 0.013586523942649364, -0.042457886040210724, -0.010116052813827991, -0.013281934894621372, 0.020342865958809853, 0.0526108592748642, -0.06328070908784866, 0.021727362647652626, 0.010337572544813156, -0.012220487929880619, -0.021764282137155533, ...
725,820
flask_admin.base
get_url
Generate URL for the endpoint. If you want to customize URL generation logic (persist some query string argument, for example), this is right place to do it. :param endpoint: Flask endpoint name :param kwargs: Arguments for `u...
def get_url(self, endpoint, **kwargs): """ Generate URL for the endpoint. If you want to customize URL generation logic (persist some query string argument, for example), this is right place to do it. :param endpoint: Flask endpoint name :param kwargs: ...
(self, endpoint, **kwargs)
[ 0.016235755756497383, -0.04239238426089287, 0.014028185047209263, -0.01043978426605463, 0.001926126889884472, 0.03616545349359512, -0.018276218324899673, 0.008016733452677727, -0.008306971751153469, 0.0035026485566049814, -0.012471452355384827, -0.013421323150396347, 0.03421293944120407, -...
725,821
flask_admin.base
inaccessible_callback
Handle the response to inaccessible views. By default, it throw HTTP 403 error. Override this method to customize the behaviour.
def inaccessible_callback(self, name, **kwargs): """ Handle the response to inaccessible views. By default, it throw HTTP 403 error. Override this method to customize the behaviour. """ return abort(403)
(self, name, **kwargs)
[ -0.036028195172548294, -0.016490349546074867, 0.0027194684371352196, 0.028663409873843193, 0.028375590220093727, 0.02013041451573372, 0.0317109078168869, 0.015762334689497948, 0.02311019040644169, 0.027021147310733795, 0.046423546969890594, 0.00556168332695961, 0.019571706652641296, -0.053...
725,822
flask_admin.base
index
null
def _wrap_view(f): # Avoid wrapping view method twice if hasattr(f, '_wrapped'): return f @wraps(f) def inner(self, *args, **kwargs): # Store current admin view h.set_current_view(self) # Check if administrative piece is accessible abort = self._handle_view(f.__...
(self)
[ 0.03029562532901764, -0.05186469852924347, 0.03377564996480942, 0.0903039276599884, 0.03921649605035782, 0.03607210889458656, 0.009035692550241947, 0.025526052340865135, -0.06267572939395905, 0.014979994855821133, 0.042113568633794785, 0.01990855485200882, 0.012595207430422306, -0.05034549...
725,823
flask_admin.base
is_accessible
Override this method to add permission checks. Flask-Admin does not make any assumptions about the authentication system used in your application, so it is up to you to implement it. By default, it will allow access for everyone.
def is_accessible(self): """ Override this method to add permission checks. Flask-Admin does not make any assumptions about the authentication system used in your application, so it is up to you to implement it. By default, it will allow access for everyone. """ return True
(self)
[ 0.0516572967171669, -0.00439566932618618, 0.041954100131988525, 0.016666458919644356, 0.06355941295623779, 0.0012194437440484762, 0.03563655540347099, -0.01591603271663189, -0.03329801559448242, 0.03520026057958603, 0.020942147821187973, -0.02785305492579937, 0.009354159235954285, 0.001018...
725,824
flask_admin.base
is_visible
Override this method if you want dynamically hide or show administrative views from Flask-Admin menu structure By default, item is visible in menu. Please note that item should be both visible and accessible to be displayed in menu.
def is_visible(self): """ Override this method if you want dynamically hide or show administrative views from Flask-Admin menu structure By default, item is visible in menu. Please note that item should be both visible and accessible to be displayed in menu. """ return True
(self)
[ 0.06101265549659729, -0.0036240904591977596, 0.057516951113939285, -0.007599553093314171, 0.056147500872612, 0.004353863652795553, 0.009514082223176956, 0.005518347956240177, -0.020884130150079727, 0.06342720985412598, -0.021244512870907784, -0.013811635784804821, 0.02592947706580162, -0.0...
725,825
flask_admin.base
render
Render template :param template: Template path to render :param kwargs: Template arguments
def render(self, template, **kwargs): """ Render template :param template: Template path to render :param kwargs: Template arguments """ # Store self as admin_view kwargs['admin_view'] = self kwargs['admin_base_template'] = self.admin.base_template ...
(self, template, **kwargs)
[ 0.03510570153594017, -0.09012788534164429, 0.05862574651837349, 0.038360536098480225, 0.08082836121320724, -0.005138955544680357, -0.014753307215869427, 0.035648174583911896, -0.04107289761304855, -0.008495502173900604, 0.054324716329574585, 0.017795026302337646, -0.05653335526585579, -0.0...
725,826
flask_admin.base
BaseView
Base administrative view. Derive from this class to implement your administrative interface piece. For example:: from flask_admin import BaseView, expose class MyView(BaseView): @expose('/') def index(self): return 'Hello Wor...
class BaseView(with_metaclass(AdminViewMeta, BaseViewClass)): """ Base administrative view. Derive from this class to implement your administrative interface piece. For example:: from flask_admin import BaseView, expose class MyView(BaseView): @expose('/') ...
(name=None, category=None, endpoint=None, url=None, static_folder=None, static_url_path=None, menu_class_name=None, menu_icon_type=None, menu_icon_value=None)
[ 0.043213654309511185, -0.038948360830545425, 0.032580453902482986, -0.011143836192786694, 0.04954151436686516, -0.01211504265666008, 0.0047458927147090435, 0.03882820904254913, -0.044575344771146774, 0.015819642692804337, 0.017031146213412285, 0.0003189898270647973, 0.009596915915608406, 0...
725,827
flask_admin.base
__init__
Constructor. :param name: Name of this view. If not provided, will default to the class name. :param category: View category. If not provided, this view will be shown as a top-level menu item. Otherwise, it will be in a submenu. ...
def __init__(self, name=None, category=None, endpoint=None, url=None, static_folder=None, static_url_path=None, menu_class_name=None, menu_icon_type=None, menu_icon_value=None): """ Constructor. :param name: Name of this view. If not provided, will default to th...
(self, name=None, category=None, endpoint=None, url=None, static_folder=None, static_url_path=None, menu_class_name=None, menu_icon_type=None, menu_icon_value=None)
[ 0.025898991152644157, -0.0169413723051548, 0.047285426408052444, -0.034017737954854965, 0.025706147775053978, -0.008219989016652107, 0.02063434198498726, 0.06093880534172058, -0.056117694824934006, 0.026863213628530502, 0.017163144424557686, 0.05380356311798096, -0.011580301448702812, 0.00...
725,842
flask_admin.base
expose
Use this decorator to expose views in your view classes. :param url: Relative URL for the view :param methods: Allowed HTTP methods. By default only GET is allowed.
def expose(url='/', methods=('GET',)): """ Use this decorator to expose views in your view classes. :param url: Relative URL for the view :param methods: Allowed HTTP methods. By default only GET is allowed. """ def wrap(f): if not hasattr(f, '_urls')...
(url='/', methods=('GET',))
[ -0.03998883441090584, -0.10302207618951797, 0.0492280013859272, -0.0025438927114009857, 0.047587066888809204, 0.047158997505903244, 0.010880101472139359, 0.008191289380192757, -0.03643942251801491, 0.044198185205459595, 0.03526223078370094, 0.011852175928652287, 0.059608686715364456, 0.038...
725,843
flask_admin.base
expose_plugview
Decorator to expose Flask's pluggable view classes (``flask.views.View`` or ``flask.views.MethodView``). :param url: Relative URL for the view .. versionadded:: 1.0.4
def expose_plugview(url='/'): """ Decorator to expose Flask's pluggable view classes (``flask.views.View`` or ``flask.views.MethodView``). :param url: Relative URL for the view .. versionadded:: 1.0.4 """ def wrap(v): handler = expose(url, v.methods) ...
(url='/')
[ -0.005102161318063736, -0.0793631300330162, -0.006616462022066116, 0.0018434030935168266, 0.061501260846853256, 0.06728313863277435, 0.0025467786472290754, 0.0134394196793437, -0.03092271089553833, 0.052621953189373016, 0.04178093373775482, 0.00393201969563961, 0.012097198516130447, 0.0250...
725,846
autofaiss.external.quantize
build_index
Reads embeddings and creates a quantized index from them. The index is stored on the current machine at the given output path. Parameters ---------- embeddings : Union[str, np.ndarray, List[str]] Local path containing all preprocessed vectors and cached files. This could be a singl...
def build_index( embeddings: Union[str, np.ndarray, List[str]], index_path: Optional[str] = "knn.index", index_infos_path: Optional[str] = "index_infos.json", ids_path: Optional[str] = None, save_on_disk: bool = True, file_format: str = "npy", embedding_column_name: str = "embedding", id...
(embeddings: Union[str, numpy.ndarray, List[str]], index_path: Optional[str] = 'knn.index', index_infos_path: Optional[str] = 'index_infos.json', ids_path: Optional[str] = None, save_on_disk: bool = True, file_format: str = 'npy', embedding_column_name: str = 'embedding', id_columns: Optional[List[str]] = None, index_k...
[ 0.02340095490217209, -0.04307073354721069, -0.06724225729703903, 0.015877770259976387, 0.024901535362005234, 0.02149481140077114, -0.07292013615369797, -0.00565759651362896, -0.011619364842772484, -0.04453076049685478, -0.035932835191488266, -0.002051892690360546, -0.020886467769742012, -0...
725,847
autofaiss.external.quantize
build_partitioned_indexes
Create partitioned indexes from a partitioned parquet dataset, i.e. create one index per parquet partition Only supported with PySpark. A PySpark session must be active before calling this function Parameters ---------- partitions : str List of partitions containing embeddings out...
def build_partitioned_indexes( partitions: List[str], output_root_dir: str, embedding_column_name: str = "embedding", index_key: Optional[str] = None, index_path: Optional[str] = None, id_columns: Optional[List[str]] = None, max_index_query_time_ms: float = 10.0, max_index_memory_usage: ...
(partitions: List[str], output_root_dir: str, embedding_column_name: str = 'embedding', index_key: Optional[str] = None, index_path: Optional[str] = None, id_columns: Optional[List[str]] = None, max_index_query_time_ms: float = 10.0, max_index_memory_usage: str = '16G', min_nearest_neighbors_to_retrieve: int = 20, curr...
[ 0.03242471069097519, -0.0335395447909832, -0.07138726860284805, 0.017204370349645615, 0.011611295863986015, 0.018734905868768692, -0.041154440492391586, 0.0016238336684182286, -0.06507616490125656, -0.05797145143151283, -0.0018954566912725568, 0.016117878258228302, -0.036846261471509933, -...
725,851
autofaiss.external.quantize
score_index
Compute metrics on a given index, use cached ground truth for fast scoring the next times. Parameters ---------- index_path : Union[str, faiss.Index] Path to .index file. Or in memory index embeddings: Union[str, np.ndarray] Path containing all preprocessed vectors and cached files...
def score_index( index_path: Union[str, faiss.Index], embeddings: Union[str, np.ndarray], save_on_disk: bool = True, output_index_info_path: str = "infos.json", current_memory_available: str = "32G", verbose: int = logging.INFO, ) -> Optional[Dict[str, Union[str, float, int]]]: """ Compu...
(index_path: Union[str, faiss.swigfaiss_avx512.Index], embeddings: Union[str, numpy.ndarray], save_on_disk: bool = True, output_index_info_path: str = 'infos.json', current_memory_available: str = '32G', verbose: int = 20) -> Optional[Dict[str, Union[str, float, int]]]
[ 0.027075471356511116, -0.025915665552020073, -0.10502243041992188, 0.01789700612425804, 0.05735040828585625, 0.013917672447860241, -0.058950141072273254, 0.0037568716797977686, -0.013257781974971294, -0.018546897917985916, 0.0053491052240133286, 0.02195632830262184, -0.0040193279273808, -0...
725,852
autofaiss.external.quantize
tune_index
Set hyperparameters to the given index. If an index_param is given, set this hyperparameters to the index, otherwise perform a greedy heusistic to make the best out or the max_index_query_time_ms constraint Parameters ---------- index_path : Union[str, faiss.Index] Path to .index file...
def tune_index( index_path: Union[str, faiss.Index], index_key: str, index_param: Optional[str] = None, output_index_path: Optional[str] = "tuned_knn.index", save_on_disk: bool = True, min_nearest_neighbors_to_retrieve: int = 20, max_index_query_time_ms: float = 10.0, use_gpu: bool = Fal...
(index_path: Union[str, faiss.swigfaiss_avx512.Index], index_key: str, index_param: Optional[str] = None, output_index_path: Optional[str] = 'tuned_knn.index', save_on_disk: bool = True, min_nearest_neighbors_to_retrieve: int = 20, max_index_query_time_ms: float = 10.0, use_gpu: bool = False, verbose: int = 20) -> fais...
[ 0.013973206281661987, -0.015418055467307568, -0.06950481981039047, 0.010142456740140915, -0.0025094738230109215, 0.015294482931494713, -0.07665301859378815, -0.01720510423183441, -0.02754717878997326, -0.040988072752952576, -0.00361449783667922, 0.010826858691871166, -0.020417992025613785, ...
725,855
osqp.interface
OSQP
null
class OSQP(object): def __init__(self): self._model = _osqp.OSQP() def version(self): return self._model.version() def setup(self, P=None, q=None, A=None, l=None, u=None, **settings): """ Setup OSQP solver problem of the form minimize 1/2 x' * P * x + q' * x ...
()
[ 0.03217048943042755, -0.04229002818465233, -0.056091148406267166, 0.05913664773106575, -0.03180425986647606, -0.031399477273225784, -0.05848128721117973, -0.07170414924621582, -0.0028431080281734467, -0.027621516957879066, -0.020778782665729523, -0.025983115658164024, 0.0002451578329782933, ...
725,856
osqp.interface
__init__
null
def __init__(self): self._model = _osqp.OSQP()
(self)
[ -0.0008376217447221279, -0.03413502871990204, -0.0413951575756073, 0.0043312255293130875, -0.01708526536822319, -0.016783500090241432, -0.04363177344202995, 0.0004287957854103297, 0.04104013741016388, -0.00012314703781157732, -0.01599358394742012, 0.011316214688122272, 0.016002457588911057, ...
725,857
osqp.interface
adjoint_derivative
Compute adjoint derivative after solve.
def adjoint_derivative(self, dx=None, dy_u=None, dy_l=None, P_idx=None, A_idx=None, eps_iter_ref=1e-04): """ Compute adjoint derivative after solve. """ P, q = self._derivative_cache['P'], self._derivative_cache['q'] A = self._derivative_cache['A'] l, u = self._derivative_...
(self, dx=None, dy_u=None, dy_l=None, P_idx=None, A_idx=None, eps_iter_ref=0.0001)
[ -0.023181283846497536, -0.015938350930809975, -0.03505462408065796, 0.07237083464860916, -0.03406030312180519, -0.03764765337109566, 0.0038408013060688972, -0.07186392694711685, -0.03363138437271118, 0.016991158947348595, -0.008232377469539642, -0.007798581384122372, -0.010157652199268341, ...
725,858
osqp.interface
codegen
Generate embeddable C code for the problem
def codegen(self, folder, project_type='', parameters='vectors', python_ext_name='emosqp', force_rewrite=False, compile_python_ext=True, FLOAT=False, LONG=True): """ Generate embeddable C code for the problem """ # Check parameters arguments if parameters == 'vectors': ...
(self, folder, project_type='', parameters='vectors', python_ext_name='emosqp', force_rewrite=False, compile_python_ext=True, FLOAT=False, LONG=True)
[ 0.037920236587524414, -0.030461397022008896, -0.05888368934392929, 0.0049502006731927395, -0.01958616077899933, -0.04103255644440651, -0.09852106869220734, -0.030783362686634064, -0.01933574303984642, -0.0065287197940051556, 0.031337857246398926, -0.0003795377560891211, -0.031910236924886703...
725,859
osqp.interface
derivative_iterative_refinement
null
def derivative_iterative_refinement(self, rhs, max_iter=20, tol=1e-12): M = self._derivative_cache['M'] # Prefactor solver = self._derivative_cache['solver'] sol = solver.solve(rhs) for k in range(max_iter): delta_sol = solver.solve(rhs - M @ sol) sol = sol + delta_sol if np....
(self, rhs, max_iter=20, tol=1e-12)
[ 0.07105076313018799, -0.013117901049554348, -0.04017017036676407, 0.022353049367666245, -0.055156875401735306, -0.02910250797867775, 0.024965742602944374, -0.04448837414383888, -0.008636405691504478, 0.014097661711275578, -0.005724340211600065, 0.0036423495039343834, -0.07613100111484528, ...
725,860
osqp.interface
setup
Setup OSQP solver problem of the form minimize 1/2 x' * P * x + q' * x subject to l <= A * x <= u solver settings can be specified as additional keyword arguments
def setup(self, P=None, q=None, A=None, l=None, u=None, **settings): """ Setup OSQP solver problem of the form minimize 1/2 x' * P * x + q' * x subject to l <= A * x <= u solver settings can be specified as additional keyword arguments """ # TODO(bart): this will be unnecessary when th...
(self, P=None, q=None, A=None, l=None, u=None, **settings)
[ -0.023703651502728462, 0.004844058305025101, -0.02702428214251995, 0.026476731523871422, -0.019623514264822006, 0.023685988038778305, -0.0320405550301075, -0.11155906319618225, -0.004835227038711309, 0.01831645704805851, -0.022679202258586884, -0.03122805990278721, 0.012708477675914764, 0....
725,861
osqp.interface
solve
Solve QP Problem
def solve(self): """ Solve QP Problem """ # Solve QP results = self._model.solve() # TODO(bart): this will be unnecessary when the derivative will be in C self._derivative_cache['results'] = results return results
(self)
[ 0.03714119642972946, -0.05837920680642128, -0.05496897175908089, 0.03876190260052681, -0.04642649367451668, -0.015498008579015732, -0.027822133153676987, -0.10581864416599274, 0.04487331956624985, 0.007976915687322617, -0.0015531772514805198, -0.02169383503496647, -0.022909365594387054, 0....
725,862
osqp.interface
update
Update OSQP problem arguments
def update(self, q=None, l=None, u=None, Px=None, Px_idx=np.array([]), Ax=None, Ax_idx=np.array([])): """ Update OSQP problem arguments """ # get problem dimensions (n, m) = self._model.dimensions() # check consistency of the input arguments if q is not None and len(q) != n: ...
(self, q=None, l=None, u=None, Px=None, Px_idx=array([], dtype=float64), Ax=None, Ax_idx=array([], dtype=float64))
[ 0.005942539777606726, -0.021496152505278587, -0.07164088636636734, 0.03589818626642227, -0.04544123634696007, -0.03389628604054451, -0.04318666458129883, -0.08816143870353699, -0.0031850652303546667, 0.02353692799806595, -0.02102969028055668, -0.06996939331293106, -0.013012363575398922, 0....
725,863
osqp.interface
update_settings
Update OSQP solver settings It is possible to change: 'max_iter', 'eps_abs', 'eps_rel', 'eps_prim_inf', 'eps_dual_inf', 'rho' 'alpha', 'delta', 'polish', 'polish_refine_iter', ...
def update_settings(self, **kwargs): """ Update OSQP solver settings It is possible to change: 'max_iter', 'eps_abs', 'eps_rel', 'eps_prim_inf', 'eps_dual_inf', 'rho' 'alpha', 'delta', 'polish', 'polish_refine_iter', ...
(self, **kwargs)
[ 0.04814634472131729, -0.05911871790885925, -0.05192612484097481, 0.015917284414172173, -0.03926569223403931, -0.026293335482478142, -0.05277015268802643, -0.03546756133437157, 0.011761358939111233, -0.021320903673768044, -0.01771543174982071, -0.02906395122408867, 0.01932092197239399, 0.06...
725,864
osqp.interface
version
null
def version(self): return self._model.version()
(self)
[ 0.05338920280337334, -0.035852354019880295, -0.0031125361565500498, 0.040456622838974, 0.07360058277845383, -0.045399442315101624, -0.012010031379759312, -0.012111595831811428, 0.023410674184560776, 0.002539118519052863, -0.038763877004384995, -0.04641508683562279, -0.01928037405014038, 0....
725,865
osqp.interface
warm_start
Warm start primal or dual variables
def warm_start(self, x=None, y=None): """ Warm start primal or dual variables """ # get problem dimensions (n, m) = self._model.dimensions() if x is not None: if len(x) != n: raise ValueError("Wrong dimension for variable x") if y is None: self._model.warm...
(self, x=None, y=None)
[ 0.021523507311940193, 0.025642096996307373, 0.042633432894945145, 0.035533607006073, 0.018904153257608414, 0.020472319796681404, -0.008142399601638317, -0.04670032486319542, -0.037119004875421524, -0.001172893331386149, -0.019455596804618835, 0.023643117398023605, 0.003985037095844746, 0.0...
725,871
qsm_forward.qsm_forward
ReconParams
A class used to represent reconstruction parameters. Attributes ---------- subject : str The ID of the subject. session : str The ID of the session. acq : str The acquisition name. run : int The run number. TR : float Repetition time (in seconds)...
class ReconParams: """ A class used to represent reconstruction parameters. Attributes ---------- subject : str The ID of the subject. session : str The ID of the session. acq : str The acquisition name. run : int The run number. TR : float Re...
(subject='1', session=None, acq=None, run=None, TR=0.05, TEs=array([0.004, 0.012, 0.02 , 0.028]), flip_angle=15, B0=7, B0_dir=array([0, 0, 1]), phase_offset=0, generate_phase_offset=True, generate_shim_field=True, voxel_size=array([1., 1., 1.]), peak_snr=inf, random_seed=None, suffix='T2starw', save_phase=True)
[ 0.04129919037222862, -0.06452304124832153, -0.07963521033525467, 0.008264468051493168, -0.03418758139014244, -0.04385492578148842, -0.06085611879825592, -0.040743596851825714, 0.04822560399770737, -0.011658224277198315, -0.03352086991071701, 0.04948494955897331, 0.009695123881101608, 0.087...
725,872
qsm_forward.qsm_forward
__init__
null
def __init__( self, subject="1", session=None, acq=None, run=None, TR=50e-3, TEs=np.array([ 4e-3, 12e-3, 20e-3, 28e-3 ]), flip_angle=15, B0=7, B0_dir=np.array([0, 0, 1]), phase_offset=0, generate_phase_offset=True, g...
(self, subject='1', session=None, acq=None, run=None, TR=0.05, TEs=array([0.004, 0.012, 0.02 , 0.028]), flip_angle=15, B0=7, B0_dir=array([0, 0, 1]), phase_offset=0, generate_phase_offset=True, generate_shim_field=True, voxel_size=array([1., 1., 1.]), peak_snr=inf, random_seed=None, suffix='T2starw', save_phase=True)
[ 0.03465718775987625, 0.0458800345659256, -0.03277145326137543, -0.031306806951761246, -0.009556815028190613, -0.055546700954437256, -0.10062117874622345, 0.012248102575540543, 0.0057853516191244125, -0.00744680967181921, 0.00021740839292760938, 0.09102775156497955, -0.006192706525325775, 0...
725,873
qsm_forward.qsm_forward
TissueParams
A class used to represent tissue parameters. Attributes ---------- root_dir : str or None The path to the root directory containing the tissue parameter files. chi_path : str or ndarray The path to the Chi file or a 3D numpy array containing Chi values. M0_path : str or ndarray...
class TissueParams: """ A class used to represent tissue parameters. Attributes ---------- root_dir : str or None The path to the root directory containing the tissue parameter files. chi_path : str or ndarray The path to the Chi file or a 3D numpy array containing Chi values. ...
(root_dir='', chi='chimodel/ChiModelMIX.nii', M0='maps/M0.nii.gz', R1='maps/R1.nii.gz', R2star='maps/R2star.nii.gz', mask='masks/BrainMask.nii.gz', seg='masks/SegmentedModel.nii.gz', apply_mask=False)
[ 0.02633948065340519, -0.034332435578107834, 0.00606719171628356, 0.032344549894332886, -0.02393745258450508, -0.0742972120642662, -0.06787800043821335, 0.014733129180967808, 0.00802401639521122, -0.01630687154829502, -0.0007668112521059811, 0.0413314513862133, -0.015354343689978123, 0.0609...
725,874
qsm_forward.qsm_forward
__init__
null
def __init__( self, root_dir = "", chi = "chimodel/ChiModelMIX.nii", M0 = "maps/M0.nii.gz", R1 = "maps/R1.nii.gz", R2star = "maps/R2star.nii.gz", mask = "masks/BrainMask.nii.gz", seg = "masks/SegmentedModel.nii.gz", apply_mask = False ): if isi...
(self, root_dir='', chi='chimodel/ChiModelMIX.nii', M0='maps/M0.nii.gz', R1='maps/R1.nii.gz', R2star='maps/R2star.nii.gz', mask='masks/BrainMask.nii.gz', seg='masks/SegmentedModel.nii.gz', apply_mask=False)
[ 0.015424393117427826, 0.002340269275009632, 0.03620883449912071, 0.02742747962474823, -0.020394792780280113, -0.05820023640990257, -0.03432711586356163, 0.06743776798248291, 0.01995762623846531, 0.027237407863140106, 0.02790266089141369, 0.0900944247841835, -0.015433897264301777, 0.0860648...
725,875
qsm_forward.qsm_forward
_do_apply_mask
null
def _do_apply_mask(self, nii): return nib.Nifti1Image(dataobj=nii.get_fdata() * self.mask.get_fdata(), affine=self.nii_affine, header=nii.header) if self._apply_mask else nii
(self, nii)
[ 0.02547929249703884, -0.0382540337741375, 0.08366753906011581, -0.007817510515451431, -0.01991666480898857, -0.05169558897614479, -0.019934212788939476, -0.01672297902405262, 0.031094564124941826, -0.00419829273596406, 0.030164534226059914, 0.02277694270014763, -0.034709393978118896, -0.00...
725,876
qsm_forward.qsm_forward
_load
null
def _load(self, nii_path): nii = nib.load(nii_path) if self._affine is not None: nii = nib.Nifti1Image(dataobj=nii.get_fdata(), affine=self._affine, header=nii.header) return nii
(self, nii_path)
[ 0.00371344480663538, -0.024128245189785957, 0.041780825704336166, -0.02453068643808365, -0.009832397103309631, -0.04053691402077675, -0.004147899337112904, 0.048878446221351624, 0.01795441471040249, -0.017817217856645584, 0.028152666985988617, 0.05345165356993675, -0.055610205978155136, 0....
725,877
qsm_forward.qsm_forward
set_affine
null
def set_affine(self, affine): self._affine = affine
(self, affine)
[ 0.026036612689495087, 0.04896583780646324, 0.09734290838241577, 0.09021227806806564, -0.03833531215786934, -0.04304545372724533, -0.02474459446966648, -0.03066498041152954, -0.0016661306144669652, 0.031090199947357178, 0.013615250587463379, -0.006173882633447647, 0.020917605608701706, 0.08...
725,878
qsm_forward.qsm_forward
add_noise
Add complex Gaussian noise to a signal. Parameters ---------- sig : numpy.ndarray The input signal to which noise will be added. peak_snr : float, optional The peak signal-to-noise ratio, by default np.inf rng : numpy.random.Generator, optional A random number Generator...
def add_noise(sig, peak_snr=np.inf, rng=None): """ Add complex Gaussian noise to a signal. Parameters ---------- sig : numpy.ndarray The input signal to which noise will be added. peak_snr : float, optional The peak signal-to-noise ratio, by default np.inf rng : numpy.random...
(sig, peak_snr=inf, rng=None)
[ 0.005385720636695623, -0.017124522477388382, 0.09063488990068436, 0.08825922757387161, -0.026078226044774055, -0.008008841425180435, -0.022694716230034828, 0.008818724192678928, 0.059679366648197174, -0.00006587328243767843, -0.0015590244438499212, 0.01731349527835846, 0.003799700178205967, ...
725,879
qsm_forward.qsm_forward
crop_imagespace
Crop a nD matrix around its center. Parameters ---------- x : numpy.ndarray The input n-dimensional matrix. shape : tuple of int The desired shape after cropping. Returns ------- numpy.ndarray The cropped matrix.
def crop_imagespace(x, shape): """ Crop a nD matrix around its center. Parameters ---------- x : numpy.ndarray The input n-dimensional matrix. shape : tuple of int The desired shape after cropping. Returns ------- numpy.ndarray The cropped matrix. """ ...
(x, shape)
[ -0.017988523468375206, -0.024950647726655006, -0.01445278525352478, 0.015108902007341385, 0.036979448050260544, -0.03258711099624634, 0.016229767352342606, 0.013341032899916172, 0.06411714851856232, -0.024203402921557426, -0.0054949745535850525, 0.010944385081529617, -0.036195751279592514, ...
725,880
qsm_forward.qsm_forward
crop_kspace
Crop a 3D volume in k-space and apply optional scaling and Gibbs ringing correction. Parameters ---------- volume : numpy.ndarray The input 3D volume. dims : tuple of int The desired dimensions after cropping. scaling : bool, optional Whether to scale the cropped volume...
def crop_kspace(volume, dims, scaling=True, gibbs_correction=True): """ Crop a 3D volume in k-space and apply optional scaling and Gibbs ringing correction. Parameters ---------- volume : numpy.ndarray The input 3D volume. dims : tuple of int The desired dimensions after croppin...
(volume, dims, scaling=True, gibbs_correction=True)
[ 0.0211639404296875, -0.012941524386405945, -0.06855315715074539, 0.04063476622104645, 0.001293477020226419, 0.0428682379424572, 0.003170088166370988, -0.010735071264207363, 0.09265302866697311, -0.0024316017515957355, -0.016633957624435425, -0.06444644927978516, -0.043876901268959045, 0.00...
725,881
qsm_forward.qsm_forward
generate_bids
Simulate T2*-weighted magnitude and phase images and save the outputs in the BIDS-compliant format. This function simulates a T2*-weighted MRI signal based on a ground truth susceptibility map, and saves the outputs (images, JSON headers) in the BIDS-compliant format in the specified directory. P...
def generate_bids(tissue_params: TissueParams, recon_params: ReconParams, bids_dir, save_chi=True, save_mask=True, save_segmentation=True, save_field=False, save_shimmed_field=False, save_shimmed_offset_field=False): """ Simulate T2*-weighted magnitude and phase images and save the outputs in the BIDS-compliant...
(tissue_params: qsm_forward.qsm_forward.TissueParams, recon_params: qsm_forward.qsm_forward.ReconParams, bids_dir, save_chi=True, save_mask=True, save_segmentation=True, save_field=False, save_shimmed_field=False, save_shimmed_offset_field=False)
[ 0.018622297793626785, -0.041642483323812485, -0.05185840651392937, 0.03632837161421776, -0.03889380395412445, -0.06752587109804153, -0.0968451127409935, -0.010290365666151047, -0.02581467479467392, -0.018759731203317642, 0.006831611972302198, 0.07540541887283325, 0.009150809608399868, 0.06...
725,882
qsm_forward.qsm_forward
generate_field
Perform the forward convolution operation. This function performs the forward convolution step of the QSM simulation. Parameters ---------- chi : numpy.ndarray The susceptibility distribution array. Returns ------- numpy.ndarray The resulting magnetic field array afte...
def generate_field(chi, voxel_size=[1, 1, 1], B0_dir=[0, 0, 1]): """ Perform the forward convolution operation. This function performs the forward convolution step of the QSM simulation. Parameters ---------- chi : numpy.ndarray The susceptibility distribution array. Returns -...
(chi, voxel_size=[1, 1, 1], B0_dir=[0, 0, 1])
[ 0.021391719579696655, 0.012619511224329472, -0.04335340857505798, 0.01193376537412405, -0.012975743040442467, 0.024971850216388702, 0.0016041563358157873, -0.016493532806634903, -0.018452808260917664, 0.029424747452139854, 0.03305831179022789, 0.023030385375022888, -0.012192033231258392, 0...
725,883
qsm_forward.qsm_forward
generate_phase_offset
Generate a suitable phase offset. Parameters ---------- M0 : numpy.ndarray The initial magnetization. mask : numpy.ndarray A binary mask that indicates the internal region of interest. dims : tuple of int The dimensions of the input image. Returns ------- n...
def generate_phase_offset(M0, mask, dims): """ Generate a suitable phase offset. Parameters ---------- M0 : numpy.ndarray The initial magnetization. mask : numpy.ndarray A binary mask that indicates the internal region of interest. dims : tuple of int The dimensions ...
(M0, mask, dims)
[ 0.05280458927154541, 0.010809175670146942, -0.016163930296897888, -0.020766664296388626, 0.011180656030774117, -0.0064782570116221905, 0.005236968398094177, 0.019117653369903564, -0.05613885447382927, 0.057443562895059586, 0.049216631799936295, -0.002453130204230547, 0.00645560584962368, 0...
725,884
qsm_forward.qsm_forward
generate_shimmed_field
Simulate field shimming by fitting the field with second- and third-order Legendre polynomials. Parameters ---------- field : numpy.ndarray 3D array representing the magnetic field to fit. mask : numpy.ndarray 3D binary array. Must be the same shape as `field`. A True value at a co...
def generate_shimmed_field(field, mask, order=2): """ Simulate field shimming by fitting the field with second- and third-order Legendre polynomials. Parameters ---------- field : numpy.ndarray 3D array representing the magnetic field to fit. mask : numpy.ndarray 3D binary array...
(field, mask, order=2)
[ 0.04502508044242859, -0.00546340923756361, -0.008240871131420135, 0.056153230369091034, 0.0024480100255459547, -0.03744769096374512, -0.04063238948583603, -0.031188104301691055, -0.023793742060661316, -0.020206376910209656, 0.0910751223564148, 0.038289621472358704, -0.03640442341566086, 0....
725,885
qsm_forward.qsm_forward
generate_signal
Compute the MRI signal based on the given parameters. Parameters ---------- field : numpy.ndarray The magnetic field distribution. B0 : float, optional The main magnetic field strength. Default is 3. TR : float, optional The repetition time. Default is 1. TE : float...
def generate_signal(field, B0=3, TR=1, TE=30e-3, flip_angle=90, phase_offset=0, R1=1, R2star=50, M0=1): """ Compute the MRI signal based on the given parameters. Parameters ---------- field : numpy.ndarray The magnetic field distribution. B0 : float, optional The main magnetic f...
(field, B0=3, TR=1, TE=0.03, flip_angle=90, phase_offset=0, R1=1, R2star=50, M0=1)
[ 0.046992991119623184, -0.006483660079538822, 0.0017067015869542956, 0.03897419944405556, -0.0008573014638386667, -0.05129135027527809, -0.06978513300418854, 0.0024923260789364576, -0.04717359319329262, -0.02288244292140007, 0.07054366916418076, 0.12295475602149963, 0.01504425797611475, 0.0...
725,886
qsm_forward.qsm_forward
generate_susceptibility_phantom
null
def generate_susceptibility_phantom(resolution, background, large_cylinder_val, small_cylinder_radii, small_cylinder_vals): assert len(small_cylinder_radii) == len(small_cylinder_vals), "Number of small cylinders and their values should be the same" # Initialize the 3D array with the background value a...
(resolution, background, large_cylinder_val, small_cylinder_radii, small_cylinder_vals)
[ 0.031755756586790085, -0.03817368298768997, -0.04095602035522461, -0.0036634120624512434, 0.014393963851034641, 0.04644650220870972, -0.05905976891517639, -0.04002857580780983, -0.046409402042627335, -0.03489052131772041, 0.046669088304042816, 0.05145471170544624, -0.008662346750497818, -0...
725,888
qsm_forward.qsm_forward
resize
Resize a Nifti image to a voxel size. Parameters ---------- nii : nibabel.nifti1.Nifti1Image The input Nifti image. voxel_size : list of float The desired voxel size after resizing. interpolation : str Can be 'continuous', 'linear', or 'nearest'. Indicates the resample ...
def resize(nii, voxel_size, interpolation='continuous'): """ Resize a Nifti image to a voxel size. Parameters ---------- nii : nibabel.nifti1.Nifti1Image The input Nifti image. voxel_size : list of float The desired voxel size after resizing. interpolation : str Can ...
(nii, voxel_size, interpolation='continuous')
[ -0.016124319285154343, -0.04931917414069176, 0.03309830278158188, -0.05260197073221207, -0.005947653204202652, 0.005928342230618, -0.005513165146112442, -0.02116437628865242, -0.018412619829177856, -0.006937319412827492, 0.008438715711236, -0.013420840725302696, 0.014193262904882431, 0.037...
725,892
validator_collection.checkers
are_dicts_equivalent
Indicate if :ref:`dicts <python:dict>` passed to this function have identical keys and values. :param args: One or more values, passed as positional arguments. :param strict_typing: If ``True``, will only identify items as equivalent if they have identical sub-typing. If ``False``, related sub-types...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(*args, **kwargs)
[ 0.0027183322235941887, 0.013799999840557575, -0.03053659200668335, -0.007108339108526707, 0.007262113504111767, 0.017113586887717247, 0.0016171099850907922, 0.054009489715099335, -0.07531962543725967, 0.0073265996761620045, 0.01014414057135582, -0.006279942579567432, 0.08262142539024353, -...
725,893
validator_collection.checkers
are_equivalent
Indicate if arguments passed to this function are equivalent. .. hint:: This checker operates recursively on the members contained within iterables and :class:`dict <python:dict>` objects. .. caution:: If you only pass one argument to this checker - even if it is an iterable - the ch...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(*args, **kwargs)
[ 0.0027183322235941887, 0.013799999840557575, -0.03053659200668335, -0.007108339108526707, 0.007262113504111767, 0.017113586887717247, 0.0016171099850907922, 0.054009489715099335, -0.07531962543725967, 0.0073265996761620045, 0.01014414057135582, -0.006279942579567432, 0.08262142539024353, -...
725,894
validator_collection.validators
bytesIO
Validate that ``value`` is a :class:`BytesIO <python:io.BytesIO>` object. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is empty. If ``False``, raises a :class:`EmptyValueError <validator_collection.errors.EmptyValueError>` ...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,896
validator_collection.validators
date
Validate that ``value`` is a valid date. :param value: The value to validate. :type value: :class:`str <python:str>` / :class:`datetime <python:datetime.datetime>` / :class:`date <python:datetime.date>` / :obj:`None <python:None>` :param allow_empty: If ``True``, returns :obj:`None <python:None>` if...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, minimum=None, maximum=None, coerce_value=True, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,897
validator_collection.validators
datetime
Validate that ``value`` is a valid datetime. .. caution:: If supplying a string, the string needs to be in an ISO 8601-format to pass validation. If it is not in an ISO 8601-format, validation will fail. :param value: The value to validate. :type value: :class:`str <python:str>` / :class:`dat...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, minimum=None, maximum=None, coerce_value=True, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,898
validator_collection.validators
decimal
Validate that ``value`` is a :class:`Decimal <python:decimal.Decimal>`. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is :obj:`None <python:None>`. If ``False``, raises a :class:`EmptyValueError <validator_collection.errors.Em...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, minimum=None, maximum=None, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,899
validator_collection.validators
dict
Validate that ``value`` is a :class:`dict <python:dict>`. .. hint:: If ``value`` is a string, this validator will assume it is a JSON object and try to convert it into a :class:`dict <python:dict>` You can override the JSON serializer used by passing it to the ``json_serializer`` property...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, json_serializer=None, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,900
validator_collection.validators
directory_exists
Validate that ``value`` is a valid directory that exists on the local filesystem. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is empty. If ``False``, raises a :class:`EmptyValueError <validator_collection.errors.EmptyValu...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,901
validator_collection.validators
domain
Validate that ``value`` is a valid domain name. .. caution:: This validator does not verify that ``value`` **exists** as a domain. It merely verifies that its contents *might* exist as a domain. .. note:: This validator checks to validate that ``value`` resembles a valid domain name....
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, allow_ips=False, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,902
validator_collection.validators
email
Validate that ``value`` is a valid email address. .. note:: Email address validation is...complicated. The methodology that we have adopted here is *generally* compliant with `RFC 5322 <https://tools.ietf.org/html/rfc5322>`_ and uses a combination of string parsing and regular expressions....
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,904
validator_collection.validators
file_exists
Validate that ``value`` is a valid file that exists on the local filesystem. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is empty. If ``False``, raises a :class:`EmptyValueError <validator_collection.errors.EmptyValueError>` ...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,905
validator_collection.validators
float
Validate that ``value`` is a :class:`float <python:float>`. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is :obj:`None <python:None>`. If ``False``, raises a :class:`EmptyValueError <validator_collection.errors.EmptyValueErro...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, minimum=None, maximum=None, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,906
validator_collection.validators
fraction
Validate that ``value`` is a :class:`Fraction <python:fractions.Fraction>`. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is :obj:`None <python:None>`. If ``False``, raises a :class:`EmptyValueError <validator_collection.error...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, minimum=None, maximum=None, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,907
validator_collection.checkers
has_length
Indicate whether ``value`` has a length greater than or equal to a supplied ``minimum`` and/or less than or equal to ``maximum``. .. note:: This function works on any ``value`` that supports the :func:`len() <python:len>` operation. This means that ``value`` must implement the :func:`__len__...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, minimum=None, maximum=None, **kwargs)
[ 0.0027183322235941887, 0.013799999840557575, -0.03053659200668335, -0.007108339108526707, 0.007262113504111767, 0.017113586887717247, 0.0016171099850907922, 0.054009489715099335, -0.07531962543725967, 0.0073265996761620045, 0.01014414057135582, -0.006279942579567432, 0.08262142539024353, -...
725,908
validator_collection.validators
integer
Validate that ``value`` is an :class:`int <python:int>`. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is :obj:`None <python:None>`. If ``False``, raises a :class:`EmptyValueError <validator_collection.errors.EmptyValueError>`...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, coerce_value=False, minimum=None, maximum=None, base=10, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,909
validator_collection.validators
ip_address
Validate that ``value`` is a valid IP address. .. note:: First, the validator will check if the address is a valid IPv6 address. If that doesn't work, the validator will check if the address is a valid IPv4 address. If neither works, the validator will raise an error (as always). :pa...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,910
validator_collection.validators
ipv4
Validate that ``value`` is a valid IP version 4 address. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is empty. If ``False``, raises a :class:`EmptyValueError <validator_collection.errors.EmptyValueError>` if ``value`` i...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,911
validator_collection.validators
ipv6
Validate that ``value`` is a valid IP address version 6. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is empty. If ``False``, raises a :class:`EmptyValueError <validator_collection.errors.EmptyValueError>` if ``value`` i...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,912
validator_collection.checkers
is_between
Indicate whether ``value`` is greater than or equal to a supplied ``minimum`` and/or less than or equal to ``maximum``. .. note:: This function works on any ``value`` that support comparison operators, whether they are numbers or not. Technically, this means that ``value``, ``minimum``, or `...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, minimum=None, maximum=None, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,913
validator_collection.checkers
is_bytesIO
Indicate whether ``value`` is a :class:`BytesIO <python:io.BytesIO>` object. .. note:: This checker will return ``True`` even if ``value`` is empty, so long as its type is a :class:`BytesIO <python:io.BytesIO>`. :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, `...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,914
validator_collection.checkers
is_date
Indicate whether ``value`` is a :class:`date <python:datetime.date>`. :param value: The value to evaluate. :param minimum: If supplied, will make sure that ``value`` is on or after this value. :type minimum: :class:`datetime <python:datetime.datetime>` / :class:`date <python:datetime.date>` / ...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, minimum=None, maximum=None, coerce_value=False, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,915
validator_collection.checkers
is_datetime
Indicate whether ``value`` is a :class:`datetime <python:datetime.datetime>`. :param value: The value to evaluate. :param minimum: If supplied, will make sure that ``value`` is on or after this value. :type minimum: :class:`datetime <python:datetime.datetime>` / :class:`date <python:datetime.d...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, minimum=None, maximum=None, coerce_value=False, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,916
validator_collection.checkers
is_decimal
Indicate whether ``value`` contains a :class:`Decimal <python:decimal.Decimal>`. :param value: The value to evaluate. :param minimum: If supplied, will make sure that ``value`` is greater than or equal to this value. :type minimum: numeric :param maximum: If supplied, will make sure that ``valu...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, minimum=None, maximum=None, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,917
validator_collection.checkers
is_dict
Indicate whether ``value`` is a valid :class:`dict <python:dict>` .. note:: This will return ``True`` even if ``value`` is an empty :class:`dict <python:dict>`. :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <py...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,918
validator_collection.checkers
is_directory
Indicate whether ``value`` is a directory that exists on the local filesystem. :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate keyword parameters or duplica...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,919
validator_collection.checkers
is_domain
Indicate whether ``value`` is a valid domain. .. caution:: This validator does not verify that ``value`` **exists** as a domain. It merely verifies that its contents *might* exist as a domain. .. note:: This validator checks to validate that ``value`` resembles a valid domain name. I...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,920
validator_collection.checkers
is_email
Indicate whether ``value`` is an email address. .. note:: Email address validation is...complicated. The methodology that we have adopted here is *generally* compliant with `RFC 5322 <https://tools.ietf.org/html/rfc5322>`_ and uses a combination of string parsing and regular expressions. ...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,921
validator_collection.checkers
is_file
Indicate whether ``value`` is a file that exists on the local filesystem. :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate keyword parameters or duplicates ...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,922
validator_collection.checkers
is_float
Indicate whether ``value`` is a :class:`float <python:float>`. :param value: The value to evaluate. :param minimum: If supplied, will make sure that ``value`` is greater than or equal to this value. :type minimum: numeric :param maximum: If supplied, will make sure that ``value`` is less than o...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, minimum=None, maximum=None, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,923
validator_collection.checkers
is_fraction
Indicate whether ``value`` is a :class:`Fraction <python:fractions.Fraction>`. :param value: The value to evaluate. :param minimum: If supplied, will make sure that ``value`` is greater than or equal to this value. :type minimum: numeric :param maximum: If supplied, will make sure that ``value`...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, minimum=None, maximum=None, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,924
validator_collection.checkers
is_integer
Indicate whether ``value`` contains a whole number. :param value: The value to evaluate. :param coerce_value: If ``True``, will return ``True`` if ``value`` can be coerced to whole number. If ``False``, will only return ``True`` if ``value`` is already a whole number (regardless of type). Defaults...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, coerce_value=False, minimum=None, maximum=None, base=10, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,925
validator_collection.checkers
is_ip_address
Indicate whether ``value`` is a valid IP address (version 4 or version 6). :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate keyword parameters or duplicates ...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,926
validator_collection.checkers
is_ipv4
Indicate whether ``value`` is a valid IP version 4 address. :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate keyword parameters or duplicates keyword p...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,927
validator_collection.checkers
is_ipv6
Indicate whether ``value`` is a valid IP version 6 address. :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate keyword parameters or duplicates keyword p...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,928
validator_collection.checkers
is_iterable
Indicate whether ``obj`` is iterable. :param forbid_literals: A collection of literals that will be considered invalid even if they are (actually) iterable. Defaults to a :class:`tuple <python:tuple>` containing :class:`str <python:str>` and :class:`bytes <python:bytes>`. :type forbid_literals: ite...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(obj, forbid_literals=(<class 'str'>, <class 'bytes'>), minimum_length=None, maximum_length=None, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,929
validator_collection.checkers
is_mac_address
Indicate whether ``value`` is a valid MAC address. :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate keyword parameters or duplicates keyword parameters...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,930
validator_collection.checkers
is_none
Indicate whether ``value`` is :obj:`None <python:None>`. :param value: The value to evaluate. :param allow_empty: If ``True``, accepts falsey values as equivalent to :obj:`None <python:None>`. Defaults to ``False``. :type allow_empty: :class:`bool <python:bool>` :returns: ``True`` if ``value`` ...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, allow_empty=False, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,931
validator_collection.checkers
is_not_empty
Indicate whether ``value`` is empty. :param value: The value to evaluate. :returns: ``True`` if ``value`` is empty, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate keyword parameters or duplicates keyword parameters passed to the...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,932
validator_collection.checkers
is_numeric
Indicate whether ``value`` is a numeric value. :param value: The value to evaluate. :param minimum: If supplied, will make sure that ``value`` is greater than or equal to this value. :type minimum: numeric :param maximum: If supplied, will make sure that ``value`` is less than or equal to...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, minimum=None, maximum=None, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,933
validator_collection.checkers
is_on_filesystem
Indicate whether ``value`` is a file or directory that exists on the local filesystem. :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate keyword parameter...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,934
validator_collection.checkers
is_pathlike
Indicate whether ``value`` is a path-like object. :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate keyword parameters or duplicates keyword parameters ...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,935
validator_collection.checkers
is_string
Indicate whether ``value`` is a string. :param value: The value to evaluate. :param coerce_value: If ``True``, will check whether ``value`` can be coerced to a string if it is not already. Defaults to ``False``. :type coerce_value: :class:`bool <python:bool>` :param minimum_length: If supplied,...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, coerce_value=False, minimum_length=None, maximum_length=None, whitespace_padding=False, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,936
validator_collection.checkers
is_stringIO
Indicate whether ``value`` is a :class:`StringIO <python:io.StringIO>` object. .. note:: This checker will return ``True`` even if ``value`` is empty, so long as its type is a :class:`String <python:io.StringIO>`. :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid,...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0026687942445278168, 0.013790423981845379, -0.03057704120874405, -0.007123399060219526, 0.007202768232673407, 0.017153700813651085, 0.001577465794980526, 0.05409020930528641, -0.07540088146924973, 0.007381349336355925, 0.01016919780522585, -0.006329705473035574, 0.08270286023616791, -0.0...
725,937
validator_collection.checkers
is_time
Indicate whether ``value`` is a :class:`time <python:datetime.time>`. :param value: The value to evaluate. :param minimum: If supplied, will make sure that ``value`` is on or after this value. :type minimum: :func:`datetime <validator_collection.validators.datetime>` or :func:`time <validator_collec...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, minimum=None, maximum=None, coerce_value=False, **kwargs)
[ 0.0026687942445278168, 0.013790423981845379, -0.03057704120874405, -0.007123399060219526, 0.007202768232673407, 0.017153700813651085, 0.001577465794980526, 0.05409020930528641, -0.07540088146924973, 0.007381349336355925, 0.01016919780522585, -0.006329705473035574, 0.08270286023616791, -0.0...
725,938
validator_collection.checkers
is_timezone
Indicate whether ``value`` is a :class:`tzinfo <python:datetime.tzinfo>`. .. caution:: This does **not** validate whether the value is a timezone that actually exists, nor can it resolve timzone names (e.g. ``'Eastern'`` or ``'CET'``). For that kind of functionality, we recommend you utilize: ...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, positive=True, **kwargs)
[ 0.0026687942445278168, 0.013790423981845379, -0.03057704120874405, -0.007123399060219526, 0.007202768232673407, 0.017153700813651085, 0.001577465794980526, 0.05409020930528641, -0.07540088146924973, 0.007381349336355925, 0.01016919780522585, -0.006329705473035574, 0.08270286023616791, -0.0...
725,939
validator_collection.checkers
is_type
Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:isinstance>` would cause a circular import error. To us...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(obj, type_, **kwargs)
[ 0.0026687942445278168, 0.013790423981845379, -0.03057704120874405, -0.007123399060219526, 0.007202768232673407, 0.017153700813651085, 0.001577465794980526, 0.05409020930528641, -0.07540088146924973, 0.007381349336355925, 0.01016919780522585, -0.006329705473035574, 0.08270286023616791, -0.0...
725,940
validator_collection.checkers
is_url
Indicate whether ``value`` is a URL. .. note:: URL validation is...complicated. The methodology that we have adopted here is *generally* compliant with `RFC 1738 <https://tools.ietf.org/html/rfc1738>`_, `RFC 6761 <https://tools.ietf.org/html/rfc6761>`_, `RFC 2181 <https://tools.ietf....
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0026687942445278168, 0.013790423981845379, -0.03057704120874405, -0.007123399060219526, 0.007202768232673407, 0.017153700813651085, 0.001577465794980526, 0.05409020930528641, -0.07540088146924973, 0.007381349336355925, 0.01016919780522585, -0.006329705473035574, 0.08270286023616791, -0.0...
725,941
validator_collection.checkers
is_uuid
Indicate whether ``value`` contains a :class:`UUID <python:uuid.UUID>` :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate keyword parameters or duplicates ...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,942
validator_collection.checkers
is_variable_name
Indicate whether ``value`` is a valid Python variable name. .. caution:: This function does **NOT** check whether the variable exists. It only checks that the ``value`` would work as a Python variable (or class, or function, etc.) name. :param value: The value to evaluate. :returns: ``...
def is_type(obj, type_, **kwargs): """Indicate if ``obj`` is a type in ``type_``. .. hint:: This checker is particularly useful when you want to evaluate whether ``obj`` is of a particular type, but importing that type directly to use in :func:`isinstance() <python:is...
(value, **kwargs)
[ 0.0027456344105303288, 0.013760415837168694, -0.030576497316360474, -0.007063745986670256, 0.007267126347869635, 0.01712363213300705, 0.0016245624283328652, 0.05404956266283989, -0.07539954036474228, 0.007396099157631397, 0.010134292766451836, -0.006275027059018612, 0.08270138502120972, -0...
725,943
validator_collection.validators
iterable
Validate that ``value`` is a valid iterable. .. hint:: This validator checks to ensure that ``value`` supports iteration using any of Python's three iteration protocols: the ``__getitem__`` protocol, the ``__iter__`` / ``next()`` protocol, or the inheritance from Python's `Iterable` abstra...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, forbid_literals=(<class 'str'>, <class 'bytes'>), minimum_length=None, maximum_length=None, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,944
validator_collection.validators
mac_address
Validate that ``value`` is a valid MAC address. :param value: The value to validate. :type value: :class:`str <python:str>` / :obj:`None <python:None>` :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is empty. If ``False``, raises a :class:`EmptyValueError <vali...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,945
validator_collection.validators
none
Validate that ``value`` is :obj:`None <python:None>`. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is empty but **not** :obj:`None <python:None>`. If ``False``, raises a :class:`NotNoneError` if ``value`` is empty but **not**...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...
725,946
validator_collection.validators
not_empty
Validate that ``value`` is not empty. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is empty. If ``False``, raises a :class:`EmptyValueError <validator_collection.errors.EmptyValueError>` if ``value`` is empty. Defaults t...
# -*- coding: utf-8 -*- # The lack of a module docstring for this module is **INTENTIONAL**. # The module is imported into the documentation using Sphinx's autodoc # extension, and its member function documentation is automatically incorporated # there as needed. import decimal as decimal_ import fractions import io ...
(value, allow_empty=False, **kwargs)
[ 0.03530561923980713, 0.0046048457734286785, 0.00770893320441246, 0.015979301184415817, -0.012394755147397518, -0.04832658916711807, 0.007466004695743322, -0.02293245680630207, -0.02688409388065338, -0.04806746542453766, 0.04396467283368111, 0.09708505123853683, 0.04040171951055527, 0.01662...