L i7dZddlmZddlZddlmZmZddlmZm Z ddl m Z ejdk\rddlmZnddlmZerdd lmZmZGd d eZGd d e eZeZy)zGTools for creating transform & filter expressions with a python syntax.) annotationsN) TYPE_CHECKINGAny)ConstExpressionFunctionExpression)ExprRef) )override) ExpressionIntoExpressionceZdZdZed dZed dZed dZed dZed dZ ed dZ ed dZ ed d Z ed d Z y ) _ExprMetaz~ Metaclass for :class:`expr`. Currently providing read-only class properties, representing JavaScript constants. ctdS)z.Not a number (same as JavaScript literal NaN).NaNrclss Z/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/altair/expr/__init__.pyrz _ExprMeta.NaNu%%ctdS)z+The natural log of 10 (alias to Math.LN10).LN10rrs rrz_ExprMeta.LN10#sv&&rctdS)z.The transcendental number e (alias to Math.E).Errs rrz _ExprMeta.E(ss##rctdS)z/The base 10 logarithm e (alias to Math.LOG10E).LOG10Errs rrz_ExprMeta.LOG10E-sx((rctdS)z0The base 2 logarithm of e (alias to Math.LOG2E).LOG2Errs rrz_ExprMeta.LOG2E2w''rctdS)z/The square root of 0.5 (alias to Math.SQRT1_2).SQRT1_2rrs rr"z_ExprMeta.SQRT1_27sy))rctdS)z)The natural log of 2 (alias to Math.LN2).LN2rrs rr$z _ExprMeta.LN2<rrctdS)z-The square root of 2 (alias to Math.SQRT1_2).SQRT2rrs rr&z_ExprMeta.SQRT2Ar rctdS)z0The transcendental number pi (alias to Math.PI).PIrrs rr(z _ExprMeta.PIFst$$rNreturnr )__name__ __module__ __qualname____doc__propertyrrrrrr"r$r&r(rrrrs &&''$$))((**&&((%%rrceZdZdZeddZeddZeddZeddZ eddZ eddZ eddZ edd Z edd Zedd Zedd Zedd ZeddZeddZe ddZeddZeddZeddZeddZeddZeddZeddZeddZe ddZeddZeddZeddZ eddZ!eddZ"e ddZ#e dd Z$edd!Z%edd"Z&edd#Z'edd$Z(edd%Z)edd&Z*e d dd(Z+e d dd)Z,e d dd*Z-e d dd+Z.e d dd,Z/e d dd-Z0e d dd.Z1e d dd/Z2e d dd0Z3e d dd1Z4e d dd2Z5e d dd3Z6edd4Z7e d dd5Z8edd6Z9edd7Z:edd8Z;edd9Zedd<Z?edd=Z@edd>ZAedd?ZBedd@ZCeddAZDeddBZEe d ddCZFe d ddDZGe d ddEZHeddFZIeddGZJeddHZKeddIZLeddJZMeddKZNeddLZOeddMZPeddNZQeddOZReddPZSe d ddQZTe d ddRZUeddSZVe ddTZWeddUZXeddVZYe d ddWZZeddXZ[eddYZ\eddZZ]edd[Z^edd\Z_edd]Z`edd^Zae d dd_Zbedd`ZceddaZde d ddbZeeddcZfedddZge ddeZhe d ddfZieddgZje d ddhZkeddiZle d ddjZmeddkZneddlZoeddmZpeddnZqeddoZre d ddpZse ddqZte ddrZue ddsZve ddtZwe d dduZxe d ddvZyeddwZzeddxZ{eddyZ|eddzZ}edd{Z~e dd|Zedd}Zeddd~ZedddZedddZedddZeddZeddZeddZeddZe ddZe d ddZe d ddZedddZe d ddZedddZe d ddZe d ddZe d ddZeddZeddZe ddZe ddZe ddZe ddZe ddZe ddZe d ddZe d ddZe d ddZe d ddZe ddZeddZeddZeddZeddZe d ddZe d ddZe d ddZy')expra Utility providing *constants* and *classmethods* to construct expressions. `Expressions`_ can be used to write basic formulas that enable custom interactions. Alternatively, an `inline expression`_ may be defined via :class:`expr()`. Parameters ---------- expr: str A `vega expression`_ string. Returns ------- ``ExprRef`` .. _Expressions: https://altair-viz.github.io/user_guide/interactions.html#expressions .. _inline expression: https://altair-viz.github.io/user_guide/interactions.html#inline-expressions .. _vega expression: https://vega.github.io/vega/docs/expressions/ Examples -------- >>> import altair as alt >>> bind_range = alt.binding_range(min=100, max=300, name="Slider value: ") >>> param_width = alt.param(bind=bind_range, name="param_width") >>> param_color = alt.param( ... expr=alt.expr.if_(param_width < 200, "red", "black"), ... name="param_color", ... ) >>> y = alt.Y("yval").axis(titleColor=param_color) >>> y Y({ axis: {'titleColor': Parameter('param_color', VariableParameter({ expr: if((param_width < 200),'red','black'), name: 'param_color' }))}, shorthand: 'yval' }) .. _Number.isNaN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNan .. _Number.isFinite: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite .. _Math.abs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs .. _Math.acos: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acos .. _Math.asin: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asin .. _Math.atan: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan .. _Math.atan2: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2 .. _Math.ceil: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil .. _Math.cos: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cos .. _Math.exp: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/exp .. _Math.floor: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor .. _Math.hypot: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot .. _Math.log: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log .. _Math.max: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max .. _Math.min: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min .. _Math.pow: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow .. _Math.random: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random .. _Math.round: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round .. _Math.sin: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sin .. _Math.sqrt: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sqrt .. _Math.tan: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tan .. _normal (Gaussian) probability distribution: https://en.wikipedia.org/wiki/Normal_distribution .. _cumulative distribution function: https://en.wikipedia.org/wiki/Cumulative_distribution_function .. _probability density function: https://en.wikipedia.org/wiki/Probability_density_function .. _log-normal probability distribution: https://en.wikipedia.org/wiki/Log-normal_distribution .. _continuous uniform probability distribution: https://en.wikipedia.org/wiki/Continuous_uniform_distribution .. _*unit*: https://vega.github.io/vega/docs/api/time/#time-units .. _JavaScript's String.replace: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace .. _d3-format specifier: https://github.com/d3/d3-format/ .. _*units*: https://vega.github.io/vega/docs/api/time/#time-units .. _timeUnitSpecifier API documentation: https://vega.github.io/vega/docs/api/time/#timeUnitSpecifier .. _timeFormat: https://vega.github.io/vega/docs/expressions/#timeFormat .. _utcFormat: https://vega.github.io/vega/docs/expressions/#utcFormat .. _d3-time-format specifier: https://github.com/d3/d3-time-format/ .. _TimeMultiFormat object: https://vega.github.io/vega/docs/types/#TimeMultiFormat .. _UTC: https://en.wikipedia.org/wiki/Coordinated_Universal_Time .. _JavaScript's RegExp: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp .. _RGB: https://en.wikipedia.org/wiki/RGB_color_model .. _d3-color's rgb function: https://github.com/d3/d3-color#rgb .. _HSL: https://en.wikipedia.org/wiki/HSL_and_HSV .. _d3-color's hsl function: https://github.com/d3/d3-color#hsl .. _CIE LAB: https://en.wikipedia.org/wiki/Lab_color_space#CIELAB .. _d3-color's lab function: https://github.com/d3/d3-color#lab .. _HCL: https://en.wikipedia.org/wiki/Lab_color_space#CIELAB .. _d3-color's hcl function: https://github.com/d3/d3-color#hcl .. _W3C Web Content Accessibility Guidelines: https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef .. _continuous color scheme: https://vega.github.io/vega/docs/schemes .. _geoArea: https://github.com/d3/d3-geo#geoArea .. _path.area: https://github.com/d3/d3-geo#path_area .. _geoBounds: https://github.com/d3/d3-geo#geoBounds .. _path.bounds: https://github.com/d3/d3-geo#path_bounds .. _geoCentroid: https://github.com/d3/d3-geo#geoCentroid .. _path.centroid: https://github.com/d3/d3-geo#path_centroid .. _window.screen: https://developer.mozilla.org/en-US/docs/Web/API/Window/screen ct|S)N)r2)_ExprRef)rr2s r__new__z expr.__new__s T""rctd|fS)z7Returns true if ``value`` is an array, false otherwise.isArrayrrvalues rr7z expr.isArray")eX66rctd|fS)zPReturns true if ``value`` is a boolean (``true`` or ``false``), false otherwise. isBooleanr8r9s rr=zexpr.isBooleans"+x88rctd|fS)z Returns true if ``value`` is a Date object, false otherwise. This method will return false for timestamp numbers or date-formatted strings; it recognizes Date objects only. isDater8r9s rr?z expr.isDates"(UH55rctd|fS)z Returns true if ``value`` is a defined value, false if ``value`` equals ``undefined``. This method will return true for ``null`` and ``NaN`` values. isDefinedr8r9s rrAzexpr.isDefined"+x88rctd|fS)z Returns true if ``value`` is a number, false otherwise. ``NaN`` and ``Infinity`` are considered numbers. isNumberr8r9s rrDz expr.isNumber"*uh77rctd|fS)zUReturns true if ``value`` is an object (including arrays and Dates), false otherwise.isObjectr8r9s rrGz expr.isObject"*uh77rctd|fS)zSReturns true if ``value`` is a RegExp (regular expression) object, false otherwise.isRegExpr8r9s rrJz expr.isRegExprHrctd|fS)z7Returns true if ``value`` is a string, false otherwise.isStringr8r9s rrLz expr.isStringrHrctd|fS)zVReturns true if ``value`` is not ``null``, ``undefined``, or ``NaN``, false otherwise.isValidr8r9s rrNz expr.isValid r;rctd|fS)y Coerces the input ``value`` to a string. Null values and empty strings are mapped to ``null``. toBooleanr8r9s rrQzexpr.toBoolean%rBrctd|fS)aP Coerces the input ``value`` to a Date instance. Null values and empty strings are mapped to ``null``. If an optional *parser* function is provided, it is used to perform date parsing, otherwise ``Date.parse`` is used. Be aware that ``Date.parse`` has different implementations across browsers! toDater8r9s rrSz expr.toDate.s"(UH55rctd|fS)zy Coerces the input ``value`` to a number. Null values and empty strings are mapped to ``null``. toNumberr8r9s rrUz expr.toNumber9rErctd|fS)rPtoStringr8r9s rrWz expr.toStringBrErc td|||fS)z If ``test`` is truthy, returns ``thenValue``. Otherwise, returns ``elseValue``. The *if* function is equivalent to the ternary operator ``a ? b : c``. ifr8)rtest thenValue elseValues rif_zexpr.if_Ks"$y)(DEErctd|fS)z Returns true if ``value`` is not a number. Same as JavaScript's `Number.isNaN`_. .. _Number.isNaN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNan isNaNr8r9s rr_z expr.isNaN["'E844rctd|fS)z Returns true if ``value`` is a finite number. Same as JavaScript's `Number.isFinite`_. .. _Number.isFinite: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite isFiniter8r9s rrbz expr.isFinitegs"*uh77rctd|fS)z Returns the absolute value of ``value``. Same as JavaScript's `Math.abs`_. .. _Math.abs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs absr8r9s rrdzexpr.abss"%%22rctd|fS)z Trigonometric arccosine. Same as JavaScript's `Math.acos`_. .. _Math.acos: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/acos acosr8r9s rrgz expr.acos"&5(33rctd|fS)z Trigonometric arcsine. Same as JavaScript's `Math.asin`_. .. _Math.asin: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/asin asinr8r9s rrjz expr.asinrhrctd|fS)z Trigonometric arctangent. Same as JavaScript's `Math.atan`_. .. _Math.atan: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan atanr8r9s rrlz expr.atanrhrctd||fS)z Returns the arctangent of *dy / dx*. Same as JavaScript's `Math.atan2`_. .. _Math.atan2: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2 atan2r8)rdydxs rrnz expr.atan2s"'B844rctd|fS)z Rounds ``value`` to the nearest integer of equal or greater value. Same as JavaScript's `Math.ceil`_. .. _Math.ceil: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil ceilr8r9s rrrz expr.ceilrhrc td|||fS)zDRestricts ``value`` to be between the specified ``min`` and ``max``.clampr8rr:minmaxs rrtz expr.clamps "'E3+<==rctd|fS)z Trigonometric cosine. Same as JavaScript's `Math.cos`_. .. _Math.cos: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cos cosr8r9s rryzexpr.cosrerctd|fS)z Returns the value of *e* raised to the provided ``exponent``. Same as JavaScript's `Math.exp`_. .. _Math.exp: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/exp expr8)rexponents rr{zexpr.exps"%(55rctd|fS)a Rounds ``value`` to the nearest integer of equal or lower value. Same as JavaScript's `Math.floor`_. .. _Math.floor: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor floorr8r9s rr~z expr.floorr`rctd|fS)z Returns the square root of the sum of squares of its arguments. Same as JavaScript's `Math.hypot`_. .. _Math.hypot: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot hypotr8r9s rrz expr.hypotr`rctd|fS)z Returns the natural logarithm of ``value``. Same as JavaScript's `Math.log`_. .. _Math.log: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log logr8r9s rrzexpr.logrerc$td||g|S)z Returns the maximum argument value. Same as JavaScript's `Math.max`_. .. _Math.max: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max rwr8rvalue1value2argss rrwzexpr.max"%&&)@4)@AArc$td||g|S)z Returns the minimum argument value. Same as JavaScript's `Math.min`_. .. _Math.min: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min rvr8rs rrvzexpr.min rrctd||fS)z Returns ``value`` raised to the given ``exponent``. Same as JavaScript's `Math.pow`_. .. _Math.pow: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow powr8)rr:r|s rrzexpr.pows"%%):;;rctddS)z Returns a pseudo-random number in the range [0,1). Same as JavaScript's `Math.random`_. .. _Math.random: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random randomr0r8rs rrz expr.random&s"(B//rctd|fS)z Rounds ``value`` to the nearest integer. Same as JavaScript's `Math.round`_. .. _Math.round: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round roundr8r9s rrz expr.round2r`rctd|fS)z Trigonometric sine. Same as JavaScript's `Math.sin`_. .. _Math.sin: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sin sinr8r9s rrzexpr.sin>rerctd|fS)z Square root function. Same as JavaScript's `Math.sqrt`_. .. _Math.sqrt: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sqrt sqrtr8r9s rrz expr.sqrtJrhrctd|fS)z Trigonometric tangent. Same as JavaScript's `Math.tan`_. .. _Math.tan: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/tan tanr8r9s rrzexpr.tanVrerNctd||fS)au Returns a sample from a univariate `normal (Gaussian) probability distribution`_ with specified ``mean`` and standard deviation ``stdev``. If unspecified, the mean defaults to ``0`` and the standard deviation defaults to ``1``. .. _normal (Gaussian) probability distribution: https://en.wikipedia.org/wiki/Normal_distribution sampleNormalr8rmeanstdevs rrzexpr.sampleNormalbs".4-@@rc td|||fS)a Returns the value of the `cumulative distribution function`_ at the given input domain ``value`` for a normal distribution with specified ``mean`` and standard deviation ``stdev``. If unspecified, the mean defaults to ``0`` and the standard deviation defaults to ``1``. .. _cumulative distribution function: https://en.wikipedia.org/wiki/Cumulative_distribution_function cumulativeNormalr8rr:rrs rrzexpr.cumulativeNormalps ""4udE6JKKrc td|||fS)a Returns the value of the `probability density function`_ at the given input domain ``value``, for a normal distribution with specified ``mean`` and standard deviation ``stdev``. If unspecified, the mean defaults to ``0`` and the standard deviation defaults to ``1``. .. _probability density function: https://en.wikipedia.org/wiki/Probability_density_function densityNormalr8rs rrzexpr.densityNormals "/E43GHHrc td|||fS)a Returns the quantile value (the inverse of the `cumulative distribution function`_) for the given input ``probability``, for a normal distribution with specified ``mean`` and standard deviation ``stdev``. If unspecified, the mean defaults to ``0`` and the standard deviation defaults to ``1``. .. _cumulative distribution function: https://en.wikipedia.org/wiki/Cumulative_distribution_function quantileNormalr8r probabilityrrs rrzexpr.quantileNormals ""2[$4NOOrctd||fS)a Returns a sample from a univariate `log-normal probability distribution`_ with specified log ``mean`` and log standard deviation ``stdev``. If unspecified, the log mean defaults to ``0`` and the log standard deviation defaults to ``1``. .. _log-normal probability distribution: https://en.wikipedia.org/wiki/Log-normal_distribution sampleLogNormalr8rs rrzexpr.sampleLogNormals""3dE]CCrc td|||fS)a Returns the value of the `cumulative distribution function`_ at the given input domain ``value`` for a log-normal distribution with specified log ``mean`` and log standard deviation ``stdev``. If unspecified, the log mean defaults to ``0`` and the log standard deviation defaults to ``1``. .. _cumulative distribution function: https://en.wikipedia.org/wiki/Cumulative_distribution_function cumulativeLogNormalr8rs rrzexpr.cumulativeLogNormals"""7%u9MNNrc td|||fS)a Returns the value of the `probability density function`_ at the given input domain ``value``, for a log-normal distribution with specified log ``mean`` and log standard deviation ``stdev``. If unspecified, the log mean defaults to ``0`` and the log standard deviation defaults to ``1``. .. _probability density function: https://en.wikipedia.org/wiki/Probability_density_function densityLogNormalr8rs rrzexpr.densityLogNormals"""4udE6JKKrc td|||fS)a Returns the quantile value (the inverse of the `cumulative distribution function`_) for the given input ``probability``, for a log-normal distribution with specified log ``mean`` and log standard deviation ``stdev``. If unspecified, the log mean defaults to ``0`` and the log standard deviation defaults to ``1``. .. _cumulative distribution function: https://en.wikipedia.org/wiki/Cumulative_distribution_function quantileLogNormalr8rs rrzexpr.quantileLogNormals"""5 T57QRRrctd||fS)a Returns a sample from a univariate `continuous uniform probability distribution`_ over the interval [``min``, ``max``). If unspecified, ``min`` defaults to ``0`` and ``max`` defaults to ``1``. If only one argument is provided, it is interpreted as the ``max`` value. .. _continuous uniform probability distribution: https://en.wikipedia.org/wiki/Continuous_uniform_distribution sampleUniformr8)rrvrws rrzexpr.sampleUniforms"/C:>>rc td|||fS)a Returns the value of the `cumulative distribution function`_ at the given input domain ``value`` for a uniform distribution over the interval [``min``, ``max``). If unspecified, ``min`` defaults to ``0`` and ``max`` defaults to ``1``. If only one argument is provided, it is interpreted as the ``max`` value. .. _cumulative distribution function: https://en.wikipedia.org/wiki/Cumulative_distribution_function cumulativeUniformr8rus rrzexpr.cumulativeUniforms"""5sC7HIIrc td|||fS)a Returns the value of the `probability density function`_ at the given input domain ``value``, for a uniform distribution over the interval [``min``, ``max``). If unspecified, ``min`` defaults to ``0`` and ``max`` defaults to ``1``. If only one argument is provided, it is interpreted as the ``max`` value. .. _probability density function: https://en.wikipedia.org/wiki/Probability_density_function densityUniformr8rus rrzexpr.densityUniforms"""2UC4EFFrc td|||fS)a Returns the quantile value (the inverse of the `cumulative distribution function`_) for the given input ``probability``, for a uniform distribution over the interval [``min``, ``max``). If unspecified, ``min`` defaults to ``0`` and ``max`` defaults to ``1``. If only one argument is provided, it is interpreted as the ``max`` value. .. _cumulative distribution function: https://en.wikipedia.org/wiki/Cumulative_distribution_function quantileUniformr8)rrrvrws rrzexpr.quantileUniform#s"""3k35LMMrctddS)z+Returns the timestamp for the current time.nowr0r8rs rrzexpr.now6s"%,,rc (td|||||||fS)zz Returns a new ``Date`` instance. The ``month`` is 0-based, such that ``1`` represents February. datetimer8ryearmonthdayhourrvsecmillisecs rrz expr.datetime;s%"" uc4c8D  rctd|fS)zMReturns the day of the month for the given ``datetime`` value, in local time.dater8rrs rrz expr.dateP"&8+66rctd|fS)zLReturns the day of the week for the given ``datetime`` value, in local time.rr8rs rrzexpr.dayUs"%(55rctd|fS)zVReturns the one-based day of the year for the given ``datetime`` value, in local time. dayofyearr8rs rrzexpr.dayofyearZs"+{;;rctd|fS)zAReturns the year for the given ``datetime`` value, in local time.rr8rs rrz expr.year_rrctd|fS)zVReturns the quarter of the year (0-3) for the given ``datetime`` value, in local time.quarterr8rs rrz expr.quarterd")h[99rctd|fS)zOReturns the (zero-based) month for the given ``datetime`` value, in local time.rr8rs rrz expr.monthi"'H;77rctd|fS)aA Returns the week number of the year for the given *datetime*, in local time. This function assumes Sunday-based weeks. Days before the first Sunday of the year are considered to be in week 0, the first Sunday of the year is the start of week 1, the second Sunday week 2, *etc.*. weekr8rrs rrz expr.weekns"&4'22rctd|fS)zLReturns the hours component for the given ``datetime`` value, in local time.hoursr8rs rrz expr.hoursyrrctd|fS)zNReturns the minutes component for the given ``datetime`` value, in local time.minutesr8rs rrz expr.minutes~rrctd|fS)zNReturns the seconds component for the given ``datetime`` value, in local time.secondsr8rs rrz expr.secondsrrctd|fS)zSReturns the milliseconds component for the given ``datetime`` value, in local time. millisecondsr8rs rrzexpr.milliseconds".8+>>rctd|fS)zCReturns the epoch-based timestamp for the given ``datetime`` value.timer8rs rrz expr.timerrctd|fS)z\Returns the timezone offset from the local timezone to UTC for the given ``datetime`` value.timezoneoffsetr8rs rrzexpr.timezoneoffsets""2XK@@rc td|||fS)aQ Returns a new ``Date`` instance that offsets the given ``date`` by the specified time `*unit*`_ in the local timezone. The optional ``step`` argument indicates the number of time unit steps to offset by (default 1). .. _*unit*: https://vega.github.io/vega/docs/api/time/#time-units timeOffsetr8runitrsteps rrzexpr.timeOffsets",tT0BCCrc"td||||fS)a Returns an array of ``Date`` instances from ``start`` (inclusive) to ``stop`` (exclusive), with each entry separated by the given time `*unit*`_ in the local timezone. The optional ``step`` argument indicates the number of time unit steps to take between each sequence entry (default 1). .. _*unit*: https://vega.github.io/vega/docs/api/time/#time-units timeSequencer8rrstartstoprs rrzexpr.timeSequences$".4d2KLLrc (td|||||||fS)z Returns a timestamp for the given UTC date. The ``month`` is 0-based, such that ``1`` represents February. utcr8rs rrzexpr.utcs ""%$sD#sH)UVVrctd|fS)zKReturns the day of the month for the given ``datetime`` value, in UTC time.utcdater8rs rrz expr.utcdaterrctd|fS)zJReturns the day of the week for the given ``datetime`` value, in UTC time.utcdayr8rs rrz expr.utcdays"(XK88rctd|fS)zTReturns the one-based day of the year for the given ``datetime`` value, in UTC time. utcdayofyearr8rs rrzexpr.utcdayofyearrrctd|fS)z?Returns the year for the given ``datetime`` value, in UTC time.utcyearr8rs rrz expr.utcyearrrctd|fS)zTReturns the quarter of the year (0-3) for the given ``datetime`` value, in UTC time. utcquarterr8rs rrzexpr.utcquarter", <::rctd|fS)z Returns a new array with elements in a reverse order of the input ``array``. The first array element becomes the last, and the last array element becomes the first. reverser8rs rr"z expr.reversews")eX66rctd|S)aj Returns an array containing an arithmetic sequence of numbers. If ``step`` is omitted, it defaults to 1. If ``start`` is omitted, it defaults to 0. The ``stop`` value is exclusive; it is not included in the result. If ``step`` is positive, the last element is the largest *start + i * step* less than ``stop``; if ``step`` is negative, the last element is the smallest *start + i * step* greater than ``stop``. If the returned array would contain an infinite number of values, an empty range is returned. The arguments are not required to be integers. sequencer8rrs rr$z expr.sequences"*d33rc td|||fS)z Returns a section of ``array`` between the ``start`` and ``end`` indices. If the ``end`` argument is negative, it is treated as an offset from the end of the array (*alt.expr.length(array) + end*). slicer8)rrrends rr'z expr.slices"'E5#+>??rctd|fS)zyReturns the span of ``array``: the difference between the last and first elements, or *array[array.length-1] - array[0]*.spanr8rs rr*z expr.spans"&5(33rctd|fS)z,Transforms ``string`` to lower-case letters.lowerr8rstrings rr,z expr.lower"'F955rc"td||||fS)a Pads a ``string`` value with repeated instances of a ``character`` up to a specified ``length``. If ``character`` is not specified, a space (' ') is used. By default, padding is added to the end of a string. An optional ``align`` parameter specifies if padding should be added to the ``'left'`` (beginning), ``'center'``, or ``'right'`` (end) of the input string. padr8)rr.r characteraligns rr1zexpr.pads "%&&)U)KLLrctd|fS)zv Parses the input ``string`` to a floating-point value. Same as JavaScript's ``parseFloat``. parseFloatr8r-s rr5zexpr.parseFloats", ::rctd|fS)zn Parses the input ``string`` to an integer value. Same as JavaScript's ``parseInt``. parseIntr8r-s rr7z expr.parseInts"*vi88rc td|||fS)a Returns a new string with some or all matches of ``pattern`` replaced by a ``replacement`` string. The ``pattern`` can be a string or a regular expression. If ``pattern`` is a string, only the first instance will be replaced. Same as `JavaScript's String.replace`_. .. _JavaScript's String.replace: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace replacer8)rr.pattern replacements rr9z expr.replaces"")fg{-KLLrc td|||fS)zJReturns a section of ``string`` between the ``start`` and ``end`` indices. substringr8)rr.rr(s rr=zexpr.substrings"+s/CDDrctd|fS)zHReturns a trimmed string with preceding and trailing whitespace removed.trimr8r-s rr?z expr.trims"&6)44rc"td||||fS)u Truncates an input ``string`` to a target ``length``. The optional ``align`` argument indicates what part of the string should be truncated: ``'left'`` (the beginning), ``'center'``, or ``'right'`` (the end). By default, the ``'right'`` end of the string is truncated. The optional ``ellipsis`` argument indicates the string to use to indicate truncated content; by default the ellipsis character ``…`` (``…``) is used. truncater8)rr.rr3ellipsiss rrAz expr.truncates$"*vvuh.OPPrctd|fS)z,Transforms ``string`` to upper-case letters.upperr8r-s rrDz expr.upperr/rc$td||g|S)a7 Merges the input objects ``object1``, ``object2``, etc into a new output object. Inputs are visited in sequential order, such that key values from later arguments can overwrite those from earlier arguments. Example: ``alt.expr.merge({a:1, b:2}, {a:3}) -> {a:3, b:2}``. merger8)robject1object2rs rrFz expr.merges"'GW+Dt+DEErctd|fS)z Formats a (0-6) *weekday* number as a full week day name, according to the current locale. For example: ``alt.expr.dayFormat(0) -> "Sunday"``. dayFormatr8rrs rrJzexpr.dayFormats"+v66rctd|fS)z Formats a (0-6) *weekday* number as an abbreviated week day name, according to the current locale. For example: ``alt.expr.dayAbbrevFormat(0) -> "Sun"``. dayAbbrevFormatr8rKs rrMzexpr.dayAbbrevFormats""3cV<??rctd|fS)z Formats a (zero-based) ``month`` number as a full month name, according to the current locale. For example: ``alt.expr.monthFormat(0) -> "January"``. monthFormatr8rrs rrSzexpr.monthFormat0s"-%::rctd|fS)z Formats a (zero-based) ``month`` number as an abbreviated month name, according to the current locale. For example: ``alt.expr.monthAbbrevFormat(0) -> "Jan"``. monthAbbrevFormatr8rTs rrVzexpr.monthAbbrevFormat9s""5x@@rctd||fS)a Returns a time format specifier string for the given time `*units*`_. The optional ``specifiers`` object provides a set of specifier sub-strings for customizing the format; for more, see the `timeUnitSpecifier API documentation`_. The resulting specifier string can then be used as input to the `timeFormat`_ or `utcFormat`_ functions, or as the *format* parameter of an axis or legend. For example: ``alt.expr.timeFormat(date, alt.expr.timeUnitSpecifier('year'))`` or ``alt.expr.timeFormat(date, alt.expr.timeUnitSpecifier(['hours', 'minutes']))``. .. _*units*: https://vega.github.io/vega/docs/api/time/#time-units .. _timeUnitSpecifier API documentation: https://vega.github.io/vega/docs/api/time/#timeUnitSpecifier .. _timeFormat: https://vega.github.io/vega/docs/expressions/#timeFormat .. _utcFormat: https://vega.github.io/vega/docs/expressions/#utcFormat timeUnitSpecifierr8)runits specifierss rrXzexpr.timeUnitSpecifierBs.""5z7JKKrctd||fS)a Formats a datetime ``value`` (either a ``Date`` object or timestamp) as a string, according to the local time. The ``specifier`` must be a valid `d3-time-format specifier`_ or `TimeMultiFormat object`_. For example: ``alt.expr.timeFormat(timestamp, '%A')``. Null values are formatted as ``"null"``. .. _d3-time-format specifier: https://github.com/d3/d3-time-format/ .. _TimeMultiFormat object: https://vega.github.io/vega/docs/types/#TimeMultiFormat timeFormatr8rPs rr\zexpr.timeFormat[s ", 0BCCrctd||fS)aF Parses a ``string`` value to a Date object, according to the local time. The ``specifier`` must be a valid `d3-time-format specifier`_. For example: ``alt.expr.timeParse('June 30, 2015', '%B %d, %Y')``. .. _d3-time-format specifier: https://github.com/d3/d3-time-format/ timeParser8)rr.rQs rr^zexpr.timeParsems"+ /BCCrctd||fS)ah Formats a datetime ``value`` (either a ``Date`` object or timestamp) as a string, according to `UTC`_ time. The ``specifier`` must be a valid `d3-time-format specifier`_ or `TimeMultiFormat object`_. For example: ``alt.expr.utcFormat(timestamp, '%A')``. Null values are formatted as ``"null"``. .. _UTC: https://en.wikipedia.org/wiki/Coordinated_Universal_Time .. _d3-time-format specifier: https://github.com/d3/d3-time-format/ .. _TimeMultiFormat object: https://vega.github.io/vega/docs/types/#TimeMultiFormat utcFormatr8rPs rr`zexpr.utcFormat|s$"+y/ABBrctd||fS)a Parses a *string* value to a Date object, according to `UTC`_ time. The ``specifier`` must be a valid `d3-time-format specifier`_. For example: ``alt.expr.utcParse('June 30, 2015', '%B %d, %Y')``. .. _UTC: https://en.wikipedia.org/wiki/Coordinated_Universal_Time .. _d3-time-format specifier: https://github.com/d3/d3-time-format/ utcParser8rPs rrbz expr.utcParses"*ui.@AArctd||fS)a Creates a regular expression instance from an input ``pattern`` string and optional ``flags``. Same as `JavaScript's RegExp`_. .. _JavaScript's RegExp: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp regexpr8)rr:flagss rrdz expr.regexps"(We,<==rctd||fS)z Evaluates a regular expression ``regexp`` against the input ``string``, returning ``true`` if the string matches the pattern, ``false`` otherwise. For example: ``alt.expr.test(/\\d{3}/, "32-21-9483") -> true``. rZr8)rrdr.s rrZz expr.tests"&66*:;;rctd|S)a Constructs a new `RGB`_ color. If ``r``, ``g`` and ``b`` are specified, these represent the channel values of the returned color; an ``opacity`` may also be specified. If a CSS Color Module Level 3 *specifier* string is specified, it is parsed and then converted to the RGB color space. Uses `d3-color's rgb function`_. .. _RGB: https://en.wikipedia.org/wiki/RGB_color_model .. _d3-color's rgb function: https://github.com/d3/d3-color#rgb rgbr8r%s rrhzexpr.rgb"%..rctd|S)a Constructs a new `HSL`_ color. If ``h``, ``s`` and ``l`` are specified, these represent the channel values of the returned color; an ``opacity`` may also be specified. If a CSS Color Module Level 3 *specifier* string is specified, it is parsed and then converted to the HSL color space. Uses `d3-color's hsl function`_. .. _HSL: https://en.wikipedia.org/wiki/HSL_and_HSV .. _d3-color's hsl function: https://github.com/d3/d3-color#hsl hslr8r%s rrkzexpr.hslrirctd|S)a! Constructs a new `CIE LAB`_ color. If ``l``, ``a`` and ``b`` are specified, these represent the channel values of the returned color; an ``opacity`` may also be specified. If a CSS Color Module Level 3 *specifier* string is specified, it is parsed and then converted to the LAB color space. Uses `d3-color's lab function`_. .. _CIE LAB: https://en.wikipedia.org/wiki/Lab_color_space#CIELAB .. _d3-color's lab function: https://github.com/d3/d3-color#lab labr8r%s rrmzexpr.labrirctd|S)a2 Constructs a new `HCL`_ (hue, chroma, luminance) color. If ``h``, ``c`` and ``l`` are specified, these represent the channel values of the returned color; an ``opacity`` may also be specified. If a CSS Color Module Level 3 *specifier* string is specified, it is parsed and then converted to the HCL color space. Uses `d3-color's hcl function`_. .. _HCL: https://en.wikipedia.org/wiki/Lab_color_space#CIELAB .. _d3-color's hcl function: https://github.com/d3/d3-color#hcl hclr8r%s rrozexpr.hclrirctd|fS)a Returns the luminance for the given color ``specifier`` (compatible with `d3-color's rgb function`_). The luminance is calculated according to the `W3C Web Content Accessibility Guidelines`_. .. _d3-color's rgb function: https://github.com/d3/d3-color#rgb .. _W3C Web Content Accessibility Guidelines: https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef luminancer8)rrQs rrqzexpr.luminances"+ |<">)7>>L> >>  3 3 6 6 5 5 5 5 3 3 B# B-; BDG B  B B B# B-; BDG B  B B < < 0 0 5 5 3 3 4 4 3 3BF A! A1? A  A A $ $ LLL L  LL" $ $ III I  II" $ $ P#PP P  PP"BF D! D1? D  D D $ $ OOO O  OO$ $ $ LLL L  LL$ $ $ S#SS S  SS$?C ?  ?.< ?  ? ?#" JJJ J  JJ$#" GGG G  GG$#" N#NN N  NN$-- ##""#'          !    (7766<<77::883388::::??77AAPT D! D)7 D?M D  D D $ MMM M  M MM& ##""#'WWW W  W  WW!W WW$::99??::==;;66;;====BBPT C! C)7 C?M C  C C $ LLL L  L LL&66 C" C)7 C>L C  C C====@D>">/=> >> AA66==44;;77 4 4QU @" @+9 @@N @  @ @4466 %) $ MMM" M  M MM";;99MM M$ M  MM$ # EEE E  EE55 !%#' QQQ Q ! Q QQ&66@D F$ F/= FMP F  F F77== @ @;;AAAEL"L0>L LL0D"D/=D DD" D# D0> D  D DC"C/=C CC&B"B/=B BB >B >$ >-; >  > >>B<#<-;< <<// // // //  = = H' H5C H  H H..44110000==::6633B!B*8BAOB BB !% A A A A  A A !% B B B B  B B99;? ;! ;*8 ;  ; ;::;? >! >*8 >  > >(,'+ T T% T% T  T T !% FF F  F  F FF,@@== G# G,: GFT G  G G J# J,: JFT J  J J O O O$ O  O O L L L$ L  L LVVV$ V ! V VV YYY$ Y ! Y YY  !% K"K K K  KK, !% M"M M M  MM2 !% O"O O O  OO,AE C' C0> C  C C F! F+9 FCQ F  F FAA770044>B C# C-; CKN C  C C>B C# C-; CKN C  C C>B D# D-; DKN D  D Drr2) metaclass)r. __future__rsystypingrraltair.expr.corerraltair.vegalite.v5.schema.corerr4 version_infor typing_extensionsr r typerr2 _ExprTyper0rrrs[N" %@>w*;2%2%jaD8yaDH=  r