_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q20100
Pst.less_than_obs_constraints
train
def less_than_obs_constraints(self): """get the names of the observations that are listed as less than inequality constraints. Zero- weighted obs are skipped Returns ------- pandas.Series : obsnme of obseravtions that are non-zero weighted less t...
python
{ "resource": "" }
q20101
Pst.less_than_pi_constraints
train
def less_than_pi_constraints(self): """get the names of the prior information eqs that are listed as less than inequality constraints. Zero- weighted pi are skipped Returns ------- pandas.Series : pilbl of prior information that are non-zero weighted ...
python
{ "resource": "" }
q20102
Pst.greater_than_obs_constraints
train
def greater_than_obs_constraints(self): """get the names of the observations that are listed as greater than inequality constraints. Zero- weighted obs are skipped Returns ------- pandas.Series : obsnme of obseravtions that are non-zero weighted ...
python
{ "resource": "" }
q20103
Pst.greater_than_pi_constraints
train
def greater_than_pi_constraints(self): """get the names of the prior information eqs that are listed as greater than inequality constraints. Zero- weighted pi are skipped Returns ------- pandas.Series : pilbl of prior information that are non-zero weighted ...
python
{ "resource": "" }
q20104
LinearAnalysis.__load_pst
train
def __load_pst(self): """private method set the pst attribute """ if self.pst_arg is None: return None if isinstance(self.pst_arg, Pst): self.__pst = self.pst_arg return self.pst else: try: self.log("loading pst: " +...
python
{ "resource": "" }
q20105
LinearAnalysis.__load_jco
train
def __load_jco(self): """private method to set the jco attribute from a file or a matrix object """ if self.jco_arg is None: return None #raise Exception("linear_analysis.__load_jco(): jco_arg is None") if isinstance(self.jco_arg, Matrix): self.__jco =...
python
{ "resource": "" }
q20106
LinearAnalysis.nnz_obs_names
train
def nnz_obs_names(self): """ wrapper around pyemu.Pst.nnz_obs_names for listing non-zero observation names Returns ------- nnz_obs_names : list pyemu.Pst.nnz_obs_names """ if self.__pst is not None: return self.pst.nnz_obs_names ...
python
{ "resource": "" }
q20107
LinearAnalysis.adj_par_names
train
def adj_par_names(self): """ wrapper around pyemu.Pst.adj_par_names for list adjustable parameter names Returns ------- adj_par_names : list pyemu.Pst.adj_par_names """ if self.__pst is not None: return self.pst.adj_par_names ...
python
{ "resource": "" }
q20108
LinearAnalysis.predictions_iter
train
def predictions_iter(self): """ property decorated prediction iterator Returns ------- iterator : iterator iterator on prediction sensitivity vectors (matrix) """ for fname in self.forecast_names: yield self.predictions.get(col_names=fname)
python
{ "resource": "" }
q20109
LinearAnalysis.pst
train
def pst(self): """ get the pyemu.Pst attribute Returns ------- pst : pyemu.Pst Note ---- returns a references If LinearAnalysis.__pst is None, then the pst attribute is dynamically loaded before returning """ if self.__ps...
python
{ "resource": "" }
q20110
LinearAnalysis.fehalf
train
def fehalf(self): """get the KL parcov scaling matrix attribute. Create the attribute if it has not yet been created Returns ------- fehalf : pyemu.Matrix """ if self.__fehalf != None: return self.__fehalf self.log("fehalf") self.__f...
python
{ "resource": "" }
q20111
LinearAnalysis.qhalf
train
def qhalf(self): """get the square root of the cofactor matrix attribute. Create the attribute if it has not yet been created Returns ------- qhalf : pyemu.Matrix """ if self.__qhalf != None: return self.__qhalf self.log("qhalf") self...
python
{ "resource": "" }
q20112
LinearAnalysis.qhalfx
train
def qhalfx(self): """get the half normal matrix attribute. Create the attribute if it has not yet been created Returns ------- qhalfx : pyemu.Matrix """ if self.__qhalfx is None: self.log("qhalfx") self.__qhalfx = self.qhalf * self.jco ...
python
{ "resource": "" }
q20113
LinearAnalysis.xtqx
train
def xtqx(self): """get the normal matrix attribute. Create the attribute if it has not yet been created Returns ------- xtqx : pyemu.Matrix """ if self.__xtqx is None: self.log("xtqx") self.__xtqx = self.jco.T * (self.obscov ** -1) * self...
python
{ "resource": "" }
q20114
LinearAnalysis.mle_parameter_estimate
train
def mle_parameter_estimate(self): """ get the maximum likelihood parameter estimate. Returns ------- post_expt : pandas.Series the maximum likelihood parameter estimates """ res = self.pst.res assert res is not None # build the prior...
python
{ "resource": "" }
q20115
LinearAnalysis.prior_prediction
train
def prior_prediction(self): """get a dict of prior prediction variances Returns ------- prior_prediction : dict dictionary of prediction name, prior variance pairs """ if self.__prior_prediction is not None: return self.__prior_prediction ...
python
{ "resource": "" }
q20116
LinearAnalysis.apply_karhunen_loeve_scaling
train
def apply_karhunen_loeve_scaling(self): """apply karhuene-loeve scaling to the jacobian matrix. Note ---- This scaling is not necessary for analyses using Schur's complement, but can be very important for error variance analyses. This operation effectively transfers pri...
python
{ "resource": "" }
q20117
LinearAnalysis.clean
train
def clean(self): """drop regularization and prior information observation from the jco """ if self.pst_arg is None: self.logger.statement("linear_analysis.clean(): not pst object") return if not self.pst.estimation and self.pst.nprior > 0: self.drop_pr...
python
{ "resource": "" }
q20118
LinearAnalysis.reset_pst
train
def reset_pst(self,arg): """ reset the LinearAnalysis.pst attribute Parameters ---------- arg : (str or matrix) the value to assign to the pst attribute """ self.logger.statement("resetting pst") self.__pst = None self.pst_arg = arg
python
{ "resource": "" }
q20119
LinearAnalysis.reset_parcov
train
def reset_parcov(self,arg=None): """reset the parcov attribute to None Parameters ---------- arg : str or pyemu.Matrix the value to assign to the parcov attribute. If None, the private __parcov attribute is cleared but not reset """ self.logger.s...
python
{ "resource": "" }
q20120
LinearAnalysis.reset_obscov
train
def reset_obscov(self,arg=None): """reset the obscov attribute to None Parameters ---------- arg : str or pyemu.Matrix the value to assign to the obscov attribute. If None, the private __obscov attribute is cleared but not reset """ self.logger.s...
python
{ "resource": "" }
q20121
LinearAnalysis.drop_prior_information
train
def drop_prior_information(self): """drop the prior information from the jco and pst attributes """ if self.jco is None: self.logger.statement("can't drop prior info, LinearAnalysis.jco is None") return nprior_str = str(self.pst.nprior) self.log("removing ...
python
{ "resource": "" }
q20122
LinearAnalysis.adjust_obscov_resfile
train
def adjust_obscov_resfile(self, resfile=None): """reset the elements of obscov by scaling the implied weights based on the phi components in res_file so that the total phi is equal to the number of non-zero weights. Parameters ---------- resfile : str residua...
python
{ "resource": "" }
q20123
LinearAnalysis.get_par_css_dataframe
train
def get_par_css_dataframe(self): """ get a dataframe of composite scaled sensitivities. Includes both PEST-style and Hill-style. Returns ------- css : pandas.DataFrame """ assert self.jco is not None assert self.pst is not None jco = self.jco.t...
python
{ "resource": "" }
q20124
LinearAnalysis.get_cso_dataframe
train
def get_cso_dataframe(self): """ get a dataframe of composite observation sensitivity, as returned by PEST in the seo file. Note that this formulation deviates slightly from the PEST documentation in that the values are divided by (npar-1) rather than by (npar). The equ...
python
{ "resource": "" }
q20125
plot_id_bar
train
def plot_id_bar(id_df, nsv=None, logger=None, **kwargs): """ Plot a stacked bar chart of identifiability based on a identifiability dataframe Parameters ---------- id_df : pandas dataframe of identifiability nsv : number of singular values to consider logger : pyemu.Logger ...
python
{ "resource": "" }
q20126
res_phi_pie
train
def res_phi_pie(pst,logger=None, **kwargs): """plot current phi components as a pie chart. Parameters ---------- pst : pyemu.Pst logger : pyemu.Logger kwargs : dict accepts 'include_zero' as a flag to include phi groups with only zero-weight obs (not sure why anyone would do thi...
python
{ "resource": "" }
q20127
smp_to_ins
train
def smp_to_ins(smp_filename,ins_filename=None,use_generic_names=False, gwutils_compliant=False, datetime_format=None,prefix=''): """ create an instruction file for an smp file Parameters ---------- smp_filename : str existing smp file ins_filename: str instruction fil...
python
{ "resource": "" }
q20128
dataframe_to_smp
train
def dataframe_to_smp(dataframe,smp_filename,name_col="name", datetime_col="datetime",value_col="value", datetime_format="dd/mm/yyyy", value_format="{0:15.6E}", max_name_len=12): """ write a dataframe as an smp file Parameters ...
python
{ "resource": "" }
q20129
date_parser
train
def date_parser(items): """ datetime parser to help load smp files Parameters ---------- items : iterable something or somethings to try to parse into datetimes Returns ------- dt : iterable the cast datetime things """ try: dt = datetime.strptime(items,"%d/...
python
{ "resource": "" }
q20130
MonteCarlo.get_nsing
train
def get_nsing(self,epsilon=1.0e-4): """ get the number of solution space dimensions given a ratio between the largest and smallest singular values Parameters ---------- epsilon: float singular value ratio Returns ------- nsing : float ...
python
{ "resource": "" }
q20131
MonteCarlo.get_null_proj
train
def get_null_proj(self,nsing=None): """ get a null-space projection matrix of XTQX Parameters ---------- nsing: int optional number of singular components to use If Nonte, then nsing is determined from call to MonteCarlo.get_nsing() R...
python
{ "resource": "" }
q20132
MonteCarlo.draw
train
def draw(self, num_reals=1, par_file = None, obs=False, enforce_bounds=None, cov=None, how="gaussian"): """draw stochastic realizations of parameters and optionally observations, filling MonteCarlo.parensemble and optionally MonteCarlo.obsensemble. Parameters ...
python
{ "resource": "" }
q20133
MonteCarlo.project_parensemble
train
def project_parensemble(self,par_file=None,nsing=None, inplace=True,enforce_bounds='reset'): """ perform the null-space projection operations for null-space monte carlo Parameters ---------- par_file: str an optional file of parameter values to us...
python
{ "resource": "" }
q20134
MonteCarlo.write_psts
train
def write_psts(self,prefix,existing_jco=None,noptmax=None): """ write parameter and optionally observation realizations to a series of pest control files Parameters ---------- prefix: str pest control file prefix existing_jco: str filename of...
python
{ "resource": "" }
q20135
ParetoObjFunc.is_nondominated_pathetic
train
def is_nondominated_pathetic(self, obs_df): """identify which candidate solutions are pareto non-dominated - super patheically slow... Parameters ---------- obs_df : pandas.DataFrame dataframe with columns of observation names and rows of realizations Return...
python
{ "resource": "" }
q20136
ParetoObjFunc.is_nondominated_continuous
train
def is_nondominated_continuous(self, obs_df): """identify which candidate solutions are pareto non-dominated continuously updated, but still slow Parameters ---------- obs_df : pandas.DataFrame dataframe with columns of observation names and rows of realizations ...
python
{ "resource": "" }
q20137
ParetoObjFunc.is_nondominated_kung
train
def is_nondominated_kung(self, obs_df): """identify which candidate solutions are pareto non-dominated using Kungs algorithm Parameters ---------- obs_df : pandas.DataFrame dataframe with columns of observation names and rows of realizations Returns ------- ...
python
{ "resource": "" }
q20138
ParetoObjFunc.crowd_distance
train
def crowd_distance(self,obs_df): """determine the crowding distance for each candidate solution Parameters ---------- obs_df : pandas.DataFrame dataframe with columns of observation names and rows of realizations Returns ------- crowd_distance : pand...
python
{ "resource": "" }
q20139
BaseGlyph._set_unicode
train
def _set_unicode(self, value): """ Assign the primary unicode to the glyph. This will be an integer or None. Subclasses may override this method. """ values = list(self.unicodes) if value in values: values.remove(value) values.insert(0, value)...
python
{ "resource": "" }
q20140
BaseGlyph.clear
train
def clear(self, contours=True, components=True, anchors=True, guidelines=True, image=True): """ Clear the glyph. >>> glyph.clear() This clears: - contours - components - anchors - guidelines - image It's possible to tu...
python
{ "resource": "" }
q20141
BaseGlyph._iterContours
train
def _iterContours(self, **kwargs): """ This must return an iterator that returns wrapped contours. Subclasses may override this method. """ count = len(self) index = 0 while count: yield self[index] count -= 1 index += 1
python
{ "resource": "" }
q20142
BaseGlyph.appendContour
train
def appendContour(self, contour, offset=None): """ Append a contour containing the same data as ``contour`` to this glyph. >>> contour = glyph.appendContour(contour) This will return a :class:`BaseContour` object representing the new contour in the glyph. ``offset``...
python
{ "resource": "" }
q20143
BaseGlyph._appendContour
train
def _appendContour(self, contour, offset=None, **kwargs): """ contour will be an object with a drawPoints method. offset will be a valid offset (x, y). This must return the new contour. Subclasses may override this method. """ copy = contour.copy() if o...
python
{ "resource": "" }
q20144
BaseGlyph.removeContour
train
def removeContour(self, contour): """ Remove ``contour`` from the glyph. >>> glyph.removeContour(contour) ``contour`` may be a :ref:`BaseContour` or an :ref:`type-int` representing a contour index. """ if isinstance(contour, int): index = contour...
python
{ "resource": "" }
q20145
BaseGlyph.appendComponent
train
def appendComponent(self, baseGlyph=None, offset=None, scale=None, component=None): """ Append a component to this glyph. >>> component = glyph.appendComponent("A") This will return a :class:`BaseComponent` object representing the new component in the glyph. ``offset`` indi...
python
{ "resource": "" }
q20146
BaseGlyph._appendComponent
train
def _appendComponent(self, baseGlyph, transformation=None, identifier=None, **kwargs): """ baseGlyph will be a valid glyph name. The baseGlyph may or may not be in the layer. offset will be a valid offset (x, y). scale will be a valid scale (x, y). identifier will be a v...
python
{ "resource": "" }
q20147
BaseGlyph.removeComponent
train
def removeComponent(self, component): """ Remove ``component`` from the glyph. >>> glyph.removeComponent(component) ``component`` may be a :ref:`BaseComponent` or an :ref:`type-int` representing a component index. """ if isinstance(component, int): ...
python
{ "resource": "" }
q20148
BaseGlyph.appendAnchor
train
def appendAnchor(self, name=None, position=None, color=None, anchor=None): """ Append an anchor to this glyph. >>> anchor = glyph.appendAnchor("top", (10, 20)) This will return a :class:`BaseAnchor` object representing the new anchor in the glyph. ``name`` indicated the nam...
python
{ "resource": "" }
q20149
BaseGlyph.removeAnchor
train
def removeAnchor(self, anchor): """ Remove ``anchor`` from the glyph. >>> glyph.removeAnchor(anchor) ``anchor`` may be an :ref:`BaseAnchor` or an :ref:`type-int` representing an anchor index. """ if isinstance(anchor, int): index = anchor ...
python
{ "resource": "" }
q20150
BaseGlyph.removeGuideline
train
def removeGuideline(self, guideline): """ Remove ``guideline`` from the glyph. >>> glyph.removeGuideline(guideline) ``guideline`` may be a :ref:`BaseGuideline` or an :ref:`type-int` representing an guideline index. """ if isinstance(guideline, int): ...
python
{ "resource": "" }
q20151
BaseGlyph.interpolate
train
def interpolate(self, factor, minGlyph, maxGlyph, round=True, suppressError=True): """ Interpolate the contents of this glyph at location ``factor`` in a linear interpolation between ``minGlyph`` and ``maxGlyph``. >>> glyph.interpolate(0.5, otherGlyph1, otherGlyp...
python
{ "resource": "" }
q20152
BaseGlyph.pointInside
train
def pointInside(self, point): """ Determine if ``point`` is in the black or white of the glyph. >>> glyph.pointInside((40, 65)) True ``point`` must be a :ref:`type-coordinate`. """ point = normalizers.normalizeCoordinateTuple(point) return self._...
python
{ "resource": "" }
q20153
BaseGlyph._getLayer
train
def _getLayer(self, name, **kwargs): """ name will be a string, but there may not be a layer with a name matching the string. If not, a ``ValueError`` must be raised. Subclasses may override this method. """ for glyph in self.layers: if glyph.layer.na...
python
{ "resource": "" }
q20154
BaseGlyph.newLayer
train
def newLayer(self, name): """ Make a new layer with ``name`` in this glyph. >>> glyphLayer = glyph.newLayer("background") This will return the new :ref:`type-glyph-layer`. If the layer already exists in this glyph, it will be cleared. """ layerName =...
python
{ "resource": "" }
q20155
BaseGlyph.removeLayer
train
def removeLayer(self, layer): """ Remove ``layer`` from this glyph. >>> glyph.removeLayer("background") Layer can be a :ref:`type-glyph-layer` or a :ref:`type-string` representing a layer name. """ if isinstance(layer, BaseGlyph): layer = layer.l...
python
{ "resource": "" }
q20156
BaseAnchor._get_index
train
def _get_index(self): """ Get the anchor's index. This must return an ``int``. Subclasses may override this method. """ glyph = self.glyph if glyph is None: return None return glyph.anchors.index(self)
python
{ "resource": "" }
q20157
BaseLib.asDict
train
def asDict(self): """ Return the Lib as a ``dict``. This is a backwards compatibility method. """ d = {} for k, v in self.items(): d[k] = v return d
python
{ "resource": "" }
q20158
AutosummaryMethodList.get_items
train
def get_items(self, names): """ Subclass get items to get support for all methods in an given object """ env = self.state.document.settings.env prefixes = get_import_prefixes_from_env(env) methodNames = [] for name in names: methodNames.append(...
python
{ "resource": "" }
q20159
BaseBPoint.round
train
def round(self): """ Round coordinates. """ x, y = self.anchor self.anchor = (normalizers.normalizeRounding(x), normalizers.normalizeRounding(y)) x, y = self.bcpIn self.bcpIn = (normalizers.normalizeRounding(x), normali...
python
{ "resource": "" }
q20160
_sortValue_isItalic
train
def _sortValue_isItalic(font): """ Returns 0 if the font is italic. Returns 1 if the font is not italic. """ info = font.info styleMapStyleName = info.styleMapStyleName if styleMapStyleName is not None and "italic" in styleMapStyleName: return 0 if info.italicAngle not in (None, ...
python
{ "resource": "" }
q20161
_sortValue_isMonospace
train
def _sortValue_isMonospace(font): """ Returns 0 if the font is monospace. Returns 1 if the font is not monospace. """ if font.info.postscriptIsFixedPitch: return 0 if not len(font): return 1 testWidth = None for glyph in font: if testWidth is None: tes...
python
{ "resource": "" }
q20162
BaseGuideline._get_index
train
def _get_index(self): """ Get the guideline's index. This must return an ``int``. Subclasses may override this method. """ glyph = self.glyph if glyph is not None: parent = glyph else: parent = self.font if parent is None: ...
python
{ "resource": "" }
q20163
normalizeFileFormatVersion
train
def normalizeFileFormatVersion(value): """ Normalizes a font's file format version. * **value** must be a :ref:`type-int`. * Returned value will be a ``int``. """ if not isinstance(value, int): raise TypeError("File format versions must be instances of " ":ref:`t...
python
{ "resource": "" }
q20164
normalizeLayerOrder
train
def normalizeLayerOrder(value, font): """ Normalizes layer order. ** **value** must be a ``tuple`` or ``list``. * **value** items must normalize as layer names with :func:`normalizeLayerName`. * **value** must contain layers that exist in **font**. * **value** must not contain duplicate l...
python
{ "resource": "" }
q20165
normalizeDefaultLayerName
train
def normalizeDefaultLayerName(value, font): """ Normalizes default layer name. * **value** must normalize as layer name with :func:`normalizeLayerName`. * **value** must be a layer in **font**. * Returned value will be an unencoded ``unicode`` string. """ value = normalizeLayerName(va...
python
{ "resource": "" }
q20166
normalizeGlyphOrder
train
def normalizeGlyphOrder(value): """ Normalizes glyph order. ** **value** must be a ``tuple`` or ``list``. * **value** items must normalize as glyph names with :func:`normalizeGlyphName`. * **value** must not repeat glyph names. * Returned value will be a ``tuple`` of unencoded ``unicode``...
python
{ "resource": "" }
q20167
normalizeKerningKey
train
def normalizeKerningKey(value): """ Normalizes kerning key. * **value** must be a ``tuple`` or ``list``. * **value** must contain only two members. * **value** items must be :ref:`type-string`. * **value** items must be at least one character long. * Returned value will be a two member ``tu...
python
{ "resource": "" }
q20168
normalizeKerningValue
train
def normalizeKerningValue(value): """ Normalizes kerning value. * **value** must be an :ref:`type-int-float`. * Returned value is the same type as input value. """ if not isinstance(value, (int, float)): raise TypeError("Kerning value must be a int or a float, not %s." ...
python
{ "resource": "" }
q20169
normalizeGroupValue
train
def normalizeGroupValue(value): """ Normalizes group value. * **value** must be a ``list``. * **value** items must normalize as glyph names with :func:`normalizeGlyphName`. * Returned value will be a ``tuple`` of unencoded ``unicode`` strings. """ if not isinstance(value, (tuple, list...
python
{ "resource": "" }
q20170
normalizeFeatureText
train
def normalizeFeatureText(value): """ Normalizes feature text. * **value** must be a :ref:`type-string`. * Returned value will be an unencoded ``unicode`` string. """ if not isinstance(value, basestring): raise TypeError("Feature text must be a string, not %s." % ...
python
{ "resource": "" }
q20171
normalizeLibValue
train
def normalizeLibValue(value): """ Normalizes lib value. * **value** must not be ``None``. * Returned value is the same type as the input value. """ if value is None: raise ValueError("Lib value must not be None.") if isinstance(value, (list, tuple)): for v in value: ...
python
{ "resource": "" }
q20172
normalizeGlyphUnicodes
train
def normalizeGlyphUnicodes(value): """ Normalizes glyph unicodes. * **value** must be a ``list``. * **value** items must normalize as glyph unicodes with :func:`normalizeGlyphUnicode`. * **value** must not repeat unicode values. * Returned value will be a ``tuple`` of ints. """ if...
python
{ "resource": "" }
q20173
normalizeGlyphUnicode
train
def normalizeGlyphUnicode(value): """ Normalizes glyph unicode. * **value** must be an int or hex (represented as a string). * **value** must be in a unicode range. * Returned value will be an ``int``. """ if not isinstance(value, (int, basestring)) or isinstance(value, bool): raise...
python
{ "resource": "" }
q20174
normalizeGlyphWidth
train
def normalizeGlyphWidth(value): """ Normalizes glyph width. * **value** must be a :ref:`type-int-float`. * Returned value is the same type as the input value. """ if not isinstance(value, (int, float)): raise TypeError("Glyph width must be an :ref:`type-int-float`, not %s." ...
python
{ "resource": "" }
q20175
normalizeGlyphLeftMargin
train
def normalizeGlyphLeftMargin(value): """ Normalizes glyph left margin. * **value** must be a :ref:`type-int-float` or `None`. * Returned value is the same type as the input value. """ if not isinstance(value, (int, float)) and value is not None: raise TypeError("Glyph left margin must b...
python
{ "resource": "" }
q20176
normalizeGlyphRightMargin
train
def normalizeGlyphRightMargin(value): """ Normalizes glyph right margin. * **value** must be a :ref:`type-int-float` or `None`. * Returned value is the same type as the input value. """ if not isinstance(value, (int, float)) and value is not None: raise TypeError("Glyph right margin mus...
python
{ "resource": "" }
q20177
normalizeGlyphHeight
train
def normalizeGlyphHeight(value): """ Normalizes glyph height. * **value** must be a :ref:`type-int-float`. * Returned value is the same type as the input value. """ if not isinstance(value, (int, float)): raise TypeError("Glyph height must be an :ref:`type-int-float`, not " ...
python
{ "resource": "" }
q20178
normalizeGlyphBottomMargin
train
def normalizeGlyphBottomMargin(value): """ Normalizes glyph bottom margin. * **value** must be a :ref:`type-int-float` or `None`. * Returned value is the same type as the input value. """ if not isinstance(value, (int, float)) and value is not None: raise TypeError("Glyph bottom margin ...
python
{ "resource": "" }
q20179
normalizeGlyphTopMargin
train
def normalizeGlyphTopMargin(value): """ Normalizes glyph top margin. * **value** must be a :ref:`type-int-float` or `None`. * Returned value is the same type as the input value. """ if not isinstance(value, (int, float)) and value is not None: raise TypeError("Glyph top margin must be a...
python
{ "resource": "" }
q20180
normalizeGlyphFormatVersion
train
def normalizeGlyphFormatVersion(value): """ Normalizes glyph format version for saving to XML string. * **value** must be a :ref:`type-int-float` of either 1 or 2. * Returned value will be an int. """ if not isinstance(value, (int, float)): raise TypeError("Glyph Format Version must be ...
python
{ "resource": "" }
q20181
normalizePointType
train
def normalizePointType(value): """ Normalizes point type. * **value** must be an string. * **value** must be one of the following: +----------+ | move | +----------+ | line | +----------+ | offcurve | +----------+ | curve | +----------+ ...
python
{ "resource": "" }
q20182
normalizePointName
train
def normalizePointName(value): """ Normalizes point name. * **value** must be a :ref:`type-string`. * **value** must be at least one character long. * Returned value will be an unencoded ``unicode`` string. """ if not isinstance(value, basestring): raise TypeError("Point names must ...
python
{ "resource": "" }
q20183
normalizeBPointType
train
def normalizeBPointType(value): """ Normalizes bPoint type. * **value** must be an string. * **value** must be one of the following: +--------+ | corner | +--------+ | curve | +--------+ * Returned value will be an unencoded ``unicode`` string. """ allowedTy...
python
{ "resource": "" }
q20184
normalizeInternalObjectType
train
def normalizeInternalObjectType(value, cls, name): """ Normalizes an internal object type. * **value** must be a instance of **cls**. * Returned value is the same type as the input value. """ if not isinstance(value, cls): raise TypeError("%s must be a %s instance, not %s." ...
python
{ "resource": "" }
q20185
normalizeBoolean
train
def normalizeBoolean(value): """ Normalizes a boolean. * **value** must be an ``int`` with value of 0 or 1, or a ``bool``. * Returned value will be a boolean. """ if isinstance(value, int) and value in (0, 1): value = bool(value) if not isinstance(value, bool): raise ValueEr...
python
{ "resource": "" }
q20186
normalizeIndex
train
def normalizeIndex(value): """ Normalizes index. * **value** must be an ``int`` or ``None``. * Returned value is the same type as the input value. """ if value is not None: if not isinstance(value, int): raise TypeError("Indexes must be None or integers, not %s." ...
python
{ "resource": "" }
q20187
normalizeIdentifier
train
def normalizeIdentifier(value): """ Normalizes identifier. * **value** must be an :ref:`type-string` or `None`. * **value** must not be longer than 100 characters. * **value** must not contain a character out the range of 0x20 - 0x7E. * Returned value is an unencoded ``unicode`` string. """...
python
{ "resource": "" }
q20188
normalizeX
train
def normalizeX(value): """ Normalizes x coordinate. * **value** must be an :ref:`type-int-float`. * Returned value is the same type as the input value. """ if not isinstance(value, (int, float)): raise TypeError("X coordinates must be instances of " ":ref:`type-i...
python
{ "resource": "" }
q20189
normalizeY
train
def normalizeY(value): """ Normalizes y coordinate. * **value** must be an :ref:`type-int-float`. * Returned value is the same type as the input value. """ if not isinstance(value, (int, float)): raise TypeError("Y coordinates must be instances of " ":ref:`type-i...
python
{ "resource": "" }
q20190
normalizeCoordinateTuple
train
def normalizeCoordinateTuple(value): """ Normalizes coordinate tuple. * **value** must be a ``tuple`` or ``list``. * **value** must have exactly two items. * **value** items must be an :ref:`type-int-float`. * Returned value is a ``tuple`` of two values of the same type as the input value...
python
{ "resource": "" }
q20191
normalizeArea
train
def normalizeArea(value): """ Normalizes area. * **value** must be a positive :ref:`type-int-float`. """ if not isinstance(value, (int, float)): raise TypeError("Area must be an instance of :ref:`type-int-float`, " "not %s." % type(value).__name__) if value < 0: ...
python
{ "resource": "" }
q20192
normalizeRotationAngle
train
def normalizeRotationAngle(value): """ Normalizes an angle. * Value must be a :ref:`type-int-float`. * Value must be between -360 and 360. * If the value is negative, it is normalized by adding it to 360 * Returned value is a ``float`` between 0 and 360. """ if not isinstance(value, (in...
python
{ "resource": "" }
q20193
normalizeGlyphNote
train
def normalizeGlyphNote(value): """ Normalizes Glyph Note. * **value** must be a :ref:`type-string`. * Returned value is an unencoded ``unicode`` string """ if not isinstance(value, basestring): raise TypeError("Note must be a string, not %s." % type(value).__name...
python
{ "resource": "" }
q20194
normalizeFilePath
train
def normalizeFilePath(value): """ Normalizes file path. * **value** must be a :ref:`type-string`. * Returned value is an unencoded ``unicode`` string """ if not isinstance(value, basestring): raise TypeError("File paths must be strings, not %s." % type(value).__n...
python
{ "resource": "" }
q20195
normalizeInterpolationFactor
train
def normalizeInterpolationFactor(value): """ Normalizes interpolation factor. * **value** must be an :ref:`type-int-float`, ``tuple`` or ``list``. * If **value** is a ``tuple`` or ``list``, it must have exactly two items. These items must be instances of :ref:`type-int-float`. * Returned valu...
python
{ "resource": "" }
q20196
normalizeRounding
train
def normalizeRounding(value): """ Normalizes rounding. Python 2 and Python 3 handing the rounding of halves (0.5, 1.5, etc) differently. This normalizes rounding to be the same (Python 3 style) in both environments. * **value** must be an :ref:`type-int-float` * Returned value is a ``int``...
python
{ "resource": "" }
q20197
AskString
train
def AskString(message, value='', title='FontParts'): """ An ask a string dialog, a `message` is required. Optionally a `value` and `title` can be provided. :: from fontParts.ui import AskString print(AskString("who are you?")) """ return dispatcher["AskString"](message=message...
python
{ "resource": "" }
q20198
AskYesNoCancel
train
def AskYesNoCancel(message, title='FontParts', default=0, informativeText=""): """ An ask yes, no or cancel dialog, a `message` is required. Optionally a `title`, `default` and `informativeText` can be provided. The `default` option is to indicate which button is the default button. :: fro...
python
{ "resource": "" }
q20199
FindGlyph
train
def FindGlyph(aFont, message="Search for a glyph:", title='FontParts'): """ A dialog to search a glyph for a provided font. Optionally a `message`, `title` and `allFonts` can be provided. from fontParts.ui import FindGlyph from fontParts.world import CurrentFont glyph = FindGlyph(...
python
{ "resource": "" }