sequence
stringlengths 902
12k
| docstring
stringlengths 4
15.2k
|
---|---|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_normalize_value_ms'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '6', 'type': 'block', 'children': ['7', '18', '42', '68']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '10', 'type': 'binary_operator', 'children': ['11', '17'], 'value': '*'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'round'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'binary_operator', 'children': ['15', '16'], 'value': '/'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '16', 'type': 'integer', 'children': [], 'value': '1000'}; {'id': '17', 'type': 'integer', 'children': [], 'value': '1000'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'sorted_units'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '31', '39']}; {'id': '24', 'type': 'call', 'children': ['25', '30']}; {'id': '25', 'type': 'attribute', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'UNITS_IN_MILLISECONDS'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '30', 'type': 'argument_list', 'children': []}; {'id': '31', 'type': 'keyword_argument', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '33', 'type': 'lambda', 'children': ['34', '36']}; {'id': '34', 'type': 'lambda_parameters', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '36', 'type': 'subscript', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '38', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '39', 'type': 'keyword_argument', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'reverse'}; {'id': '41', 'type': 'True', 'children': []}; {'id': '42', 'type': 'for_statement', 'children': ['43', '46', '47']}; {'id': '43', 'type': 'pattern_list', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'unit'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'unit_in_ms'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'sorted_units'}; {'id': '47', 'type': 'block', 'children': ['48', '54']}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'unit_value'}; {'id': '51', 'type': 'binary_operator', 'children': ['52', '53'], 'value': '/'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'unit_in_ms'}; {'id': '54', 'type': 'if_statement', 'children': ['55', '60']}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'unit_value'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'is_integer'}; {'id': '59', 'type': 'argument_list', 'children': []}; {'id': '60', 'type': 'block', 'children': ['61']}; {'id': '61', 'type': 'return_statement', 'children': ['62']}; {'id': '62', 'type': 'expression_list', 'children': ['63', '67']}; {'id': '63', 'type': 'call', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'unit_value'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'unit'}; {'id': '68', 'type': 'return_statement', 'children': ['69']}; {'id': '69', 'type': 'expression_list', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'MILLISECOND'}
|
Normalize a value in ms to the largest unit possible without decimal places.
Note that this ignores fractions of a second and always returns a value _at least_
in seconds.
:return: the normalized value and unit name
:rtype: Tuple[Union[int, float], str]
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'alerts'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '22']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'endpoint'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'string', 'children': [], 'value': "'/'"}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'tuple', 'children': ['15', '18', '21']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'endpoint'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '21', 'type': 'string', 'children': [], 'value': "'alerts'"}; {'id': '22', 'type': 'return_statement', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '29']}; {'id': '24', 'type': 'attribute', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'alertFactory'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'find'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '33']}; {'id': '30', 'type': 'keyword_argument', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'endpoint'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'endpoint'}; {'id': '33', 'type': 'keyword_argument', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'api_key'}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'api_key'}
|
Query for alerts attached to this incident.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_format_default'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'client'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '6', 'type': 'block', 'children': ['7', '37']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '13']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'File'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'return_statement', 'children': ['15']}; {'id': '15', 'type': 'call', 'children': ['16', '21']}; {'id': '16', 'type': 'attribute', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'relpath'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '36']}; {'id': '26', 'type': 'attribute', 'children': ['27', '35']}; {'id': '27', 'type': '()', 'children': ['28']}; {'id': '28', 'type': 'binary_operator', 'children': ['29', '32'], 'value': '/'}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'client'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'workflow_path'}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'resolve'}; {'id': '36', 'type': 'argument_list', 'children': []}; {'id': '37', 'type': 'return_statement', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'value'}
|
Format default values.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fft'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '12']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'axis'}; {'id': '10', 'type': 'unary_operator', 'children': ['11'], 'value': '-'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'norm'}; {'id': '14', 'type': 'None', 'children': []}; {'id': '15', 'type': 'block', 'children': ['16', '27', '46']}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'mkl_fft'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'fft'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25', '26']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'axis'}; {'id': '27', 'type': 'if_statement', 'children': ['28', '32']}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': '_unitary'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'norm'}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'augmented_assignment', 'children': ['35', '36'], 'value': '*='}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '36', 'type': 'binary_operator', 'children': ['37', '38'], 'value': '/'}; {'id': '37', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'sqrt'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'subscript', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'axis'}; {'id': '46', 'type': 'return_statement', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'output'}
|
Compute the one-dimensional discrete Fourier Transform.
This function computes the one-dimensional *n*-point discrete Fourier
Transform (DFT) with the efficient Fast Fourier Transform (FFT)
algorithm [CT].
Parameters
----------
a : array_like
Input array, can be complex.
n : int, optional
Length of the transformed axis of the output.
If `n` is smaller than the length of the input, the input is cropped.
If it is larger, the input is padded with zeros. If `n` is not given,
the length of the input along the axis specified by `axis` is used.
axis : int, optional
Axis over which to compute the FFT. If not given, the last axis is
used.
norm : {None, "ortho"}, optional
.. versionadded:: 1.10.0
Normalization mode (see `numpy.fft`). Default is None.
Returns
-------
out : complex ndarray
The truncated or zero-padded input, transformed along the axis
indicated by `axis`, or the last one if `axis` is not specified.
Raises
------
IndexError
if `axes` is larger than the last axis of `a`.
See Also
--------
numpy.fft : for definition of the DFT and conventions used.
ifft : The inverse of `fft`.
fft2 : The two-dimensional FFT.
fftn : The *n*-dimensional FFT.
rfftn : The *n*-dimensional FFT of real input.
fftfreq : Frequency bins for given FFT parameters.
Notes
-----
FFT (Fast Fourier Transform) refers to a way the discrete Fourier
Transform (DFT) can be calculated efficiently, by using symmetries in the
calculated terms. The symmetry is highest when `n` is a power of 2, and
the transform is therefore most efficient for these sizes.
The DFT is defined, with the conventions used in this implementation, in
the documentation for the `numpy.fft` module.
References
----------
.. [CT] Cooley, James W., and John W. Tukey, 1965, "An algorithm for the
machine calculation of complex Fourier series," *Math. Comput.*
19: 297-301.
Examples
--------
>>> np.fft.fft(np.exp(2j * np.pi * np.arange(8) / 8))
array([ -3.44505240e-16 +1.14383329e-17j,
8.00000000e+00 -5.71092652e-15j,
2.33482938e-16 +1.22460635e-16j,
1.64863782e-15 +1.77635684e-15j,
9.95839695e-17 +2.33482938e-16j,
0.00000000e+00 +1.66837030e-15j,
1.14383329e-17 +1.22460635e-16j,
-1.64863782e-15 +1.77635684e-15j])
>>> import matplotlib.pyplot as plt
>>> t = np.arange(256)
>>> sp = np.fft.fft(np.sin(t))
>>> freq = np.fft.fftfreq(t.shape[-1])
>>> plt.plot(freq, sp.real, freq, sp.imag)
[<matplotlib.lines.Line2D object at 0x...>, <matplotlib.lines.Line2D object at 0x...>]
>>> plt.show()
In this example, real input has an FFT which is Hermitian, i.e., symmetric
in the real part and anti-symmetric in the imaginary part, as described in
the `numpy.fft` documentation.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sign'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '7', 'type': 'block', 'children': ['8', '25', '32']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'hmac'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'HMAC'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17', '22']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'algorithm'}; {'id': '21', 'type': 'argument_list', 'children': []}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'default_backend'}; {'id': '24', 'type': 'argument_list', 'children': []}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'finalize'}; {'id': '37', 'type': 'argument_list', 'children': []}
|
Create a signature over a message as defined in RFC7515 using a
symmetric key
:param msg: The message
:param key: The key
:return: A signature
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'default_start'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '16', '50']}; {'id': '5', 'type': 'expression_statement', 'children': ['6']}; {'id': '6', 'type': 'assignment', 'children': ['7', '13']}; {'id': '7', 'type': 'tuple_pattern', 'children': ['8', '9', '10', '11', '12']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'daemon'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'pidfile'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'startup'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'fork'}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'parsearg'}; {'id': '15', 'type': 'argument_list', 'children': []}; {'id': '16', 'type': 'if_statement', 'children': ['17', '20', '42']}; {'id': '17', 'type': 'comparison_operator', 'children': ['18', '19'], 'value': 'is'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '19', 'type': 'None', 'children': []}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'if_statement', 'children': ['22', '30', '35']}; {'id': '22', 'type': 'call', 'children': ['23', '28']}; {'id': '23', 'type': 'attribute', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'isfile'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'string', 'children': [], 'value': "'/etc/vlcp.conf'"}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '34', 'type': 'string', 'children': [], 'value': "'/etc/vlcp.conf'"}; {'id': '35', 'type': 'else_clause', 'children': ['36']}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'string', 'children': [], 'value': "'/etc/vlcp.conf is not found; start without configurations.'"}; {'id': '42', 'type': 'elif_clause', 'children': ['43', '45']}; {'id': '43', 'type': 'not_operator', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '45', 'type': 'block', 'children': ['46']}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '49', 'type': 'None', 'children': []}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'main'}; {'id': '53', 'type': 'argument_list', 'children': ['54', '55', '56', '57', '58']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'startup'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'daemon'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'pidfile'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'fork'}
|
Use `sys.argv` for starting parameters. This is the entry-point of `vlcp-start`
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_context_menu_items'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'replace_items'}; {'id': '8', 'type': 'False', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '28', '37', '46']}; {'id': '10', 'type': 'for_statement', 'children': ['11', '14', '15']}; {'id': '11', 'type': 'pattern_list', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '15', 'type': 'block', 'children': ['16', '22']}; {'id': '16', 'type': 'assert_statement', 'children': ['17']}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'basestring'}; {'id': '22', 'type': 'assert_statement', 'children': ['23']}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '25', 'type': 'argument_list', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'basestring'}; {'id': '28', 'type': 'if_statement', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'replace_items'}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': '_context_menu_items'}; {'id': '36', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'call', 'children': ['39', '44']}; {'id': '39', 'type': 'attribute', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': '_context_menu_items'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'extend'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '53']}; {'id': '48', 'type': 'attribute', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': '_listitem'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'addContextMenuItems'}; {'id': '53', 'type': 'argument_list', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'replace_items'}
|
Adds context menu items. If replace_items is True all
previous context menu items will be removed.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_assert_can_do_op'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '13']}; {'id': '8', 'type': 'not_operator', 'children': ['9']}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'is_scalar'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '13', 'type': 'block', 'children': ['14', '18']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '17', 'type': 'string', 'children': [], 'value': '"\'value\' must be a scalar, passed: {0}"'}; {'id': '18', 'type': 'raise_statement', 'children': ['19']}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'attribute', 'children': ['28', '32']}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': '__name__'}
|
Check value is valid for scalar op.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'pwgen'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '6', 'type': 'None', 'children': []}; {'id': '7', 'type': 'block', 'children': ['8', '26', '45', '53', '69']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '12']}; {'id': '9', 'type': 'comparison_operator', 'children': ['10', '11'], 'value': 'is'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'random'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'choice'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25']}; {'id': '24', 'type': 'integer', 'children': [], 'value': '35'}; {'id': '25', 'type': 'integer', 'children': [], 'value': '45'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'alphanumeric_chars'}; {'id': '29', 'type': 'list_comprehension', 'children': ['30', '31', '41']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'l'}; {'id': '31', 'type': 'for_in_clause', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'l'}; {'id': '33', 'type': '()', 'children': ['34']}; {'id': '34', 'type': 'binary_operator', 'children': ['35', '38'], 'value': '+'}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'ascii_letters'}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'string'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'digits'}; {'id': '41', 'type': 'if_clause', 'children': ['42']}; {'id': '42', 'type': 'comparison_operator', 'children': ['43', '44'], 'value': 'not in'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'l'}; {'id': '44', 'type': 'string', 'children': [], 'value': "'l0QD1vAEIOUaeiou'"}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'random_generator'}; {'id': '48', 'type': 'call', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'random'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'SystemRandom'}; {'id': '52', 'type': 'argument_list', 'children': []}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'assignment', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'random_chars'}; {'id': '56', 'type': 'list_comprehension', 'children': ['57', '63']}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'random_generator'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'choice'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'alphanumeric_chars'}; {'id': '63', 'type': 'for_in_clause', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '69', 'type': 'return_statement', 'children': ['70']}; {'id': '70', 'type': '()', 'children': ['71']}; {'id': '71', 'type': 'call', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'string', 'children': [], 'value': "''"}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'random_chars'}
|
Generate a random pasword.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_unsubscribe_myself'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '10']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'UNSUBSCRIBE_ENDPOINT'}; {'id': '10', 'type': 'return_statement', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '17']}; {'id': '12', 'type': 'attribute', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_session'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '19', '22', '25']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '19', 'type': 'keyword_argument', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'method'}; {'id': '21', 'type': 'string', 'children': [], 'value': "'GET'"}; {'id': '22', 'type': 'keyword_argument', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'raw'}; {'id': '24', 'type': 'True', 'children': []}; {'id': '25', 'type': 'keyword_argument', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '27', 'type': 'False', 'children': []}
|
Unsubscribe this base station for all events.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'make_frequency_series'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'vec'}; {'id': '5', 'type': 'block', 'children': ['6', '15']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '12']}; {'id': '7', 'type': 'call', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '9', 'type': 'argument_list', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'vec'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'FrequencySeries'}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'return_statement', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'vec'}; {'id': '15', 'type': 'if_statement', 'children': ['16', '21', '77']}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '18', 'type': 'argument_list', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'vec'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'TimeSeries'}; {'id': '21', 'type': 'block', 'children': ['22', '29', '37', '47', '69', '75']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'N'}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'vec'}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '32', 'type': 'binary_operator', 'children': ['33', '36'], 'value': '+'}; {'id': '33', 'type': 'binary_operator', 'children': ['34', '35'], 'value': '/'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'N'}; {'id': '35', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '36', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'delta_f'}; {'id': '40', 'type': 'binary_operator', 'children': ['41', '44'], 'value': '/'}; {'id': '41', 'type': 'binary_operator', 'children': ['42', '43'], 'value': '/'}; {'id': '42', 'type': 'float', 'children': [], 'value': '1.0'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'N'}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'vec'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'delta_t'}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'assignment', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'vectilde'}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'FrequencySeries'}; {'id': '52', 'type': 'argument_list', 'children': ['53', '63', '66']}; {'id': '53', 'type': 'call', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'zeros'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '59', 'type': 'call', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'complex_same_precision_as'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'vec'}; {'id': '63', 'type': 'keyword_argument', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'delta_f'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'delta_f'}; {'id': '66', 'type': 'keyword_argument', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '68', 'type': 'False', 'children': []}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'call', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'fft'}; {'id': '72', 'type': 'argument_list', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'vec'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'vectilde'}; {'id': '75', 'type': 'return_statement', 'children': ['76']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'vectilde'}; {'id': '77', 'type': 'else_clause', 'children': ['78']}; {'id': '78', 'type': 'block', 'children': ['79']}; {'id': '79', 'type': 'raise_statement', 'children': ['80']}; {'id': '80', 'type': 'call', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '82', 'type': 'argument_list', 'children': ['83']}; {'id': '83', 'type': 'string', 'children': [], 'value': '"Can only convert a TimeSeries to a FrequencySeries"'}
|
Return a frequency series of the input vector.
If the input is a frequency series it is returned, else if the input
vector is a real time series it is fourier transformed and returned as a
frequency series.
Parameters
----------
vector : TimeSeries or FrequencySeries
Returns
-------
Frequency Series: FrequencySeries
A frequency domain version of the input vector.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_args'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'namespace'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '73']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '10', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '11', 'type': 'for_statement', 'children': ['12', '13', '19']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'shlex'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '19', 'type': 'block', 'children': ['20', '25']}; {'id': '20', 'type': 'if_statement', 'children': ['21', '23']}; {'id': '21', 'type': 'not_operator', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'continue_statement', 'children': []}; {'id': '25', 'type': 'if_statement', 'children': ['26', '31', '64']}; {'id': '26', 'type': 'comparison_operator', 'children': ['27', '30'], 'value': '=='}; {'id': '27', 'type': 'subscript', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '29', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '30', 'type': 'string', 'children': [], 'value': "'$'"}; {'id': '31', 'type': 'block', 'children': ['32', '40']}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'var_name'}; {'id': '35', 'type': 'subscript', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '37', 'type': 'slice', 'children': ['38', '39']}; {'id': '38', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '39', 'type': 'colon', 'children': []}; {'id': '40', 'type': 'if_statement', 'children': ['41', '44', '55']}; {'id': '41', 'type': 'comparison_operator', 'children': ['42', '43'], 'value': 'in'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'var_name'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'namespace'}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': '()', 'children': ['52']}; {'id': '52', 'type': 'subscript', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'namespace'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'var_name'}; {'id': '55', 'type': 'else_clause', 'children': ['56']}; {'id': '56', 'type': 'block', 'children': ['57']}; {'id': '57', 'type': 'raise_statement', 'children': ['58']}; {'id': '58', 'type': 'call', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'binary_operator', 'children': ['62', '63'], 'value': '%'}; {'id': '62', 'type': 'string', 'children': [], 'value': "'Undefined variable referenced in command line: %s'"}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '64', 'type': 'else_clause', 'children': ['65']}; {'id': '65', 'type': 'block', 'children': ['66']}; {'id': '66', 'type': 'expression_statement', 'children': ['67']}; {'id': '67', 'type': 'call', 'children': ['68', '71']}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'arg'}; {'id': '73', 'type': 'return_statement', 'children': ['74']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'args'}
|
Expand any meta-variable references in the argument list.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'open'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '8', 'type': 'string', 'children': [], 'value': "'r'"}; {'id': '9', 'type': 'dictionary_splat_pattern', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '11', 'type': 'block', 'children': ['12', '32']}; {'id': '12', 'type': 'if_statement', 'children': ['13', '26']}; {'id': '13', 'type': 'boolean_operator', 'children': ['14', '17'], 'value': 'and'}; {'id': '14', 'type': 'comparison_operator', 'children': ['15', '16'], 'value': 'in'}; {'id': '15', 'type': 'string', 'children': [], 'value': "'r'"}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '17', 'type': 'not_operator', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '24']}; {'id': '19', 'type': 'attribute', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'raise_statement', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'FileNotFound'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '39']}; {'id': '34', 'type': 'attribute', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '41', '42']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'mode'}; {'id': '42', 'type': 'dictionary_splat', 'children': ['43']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
|
Open the file and return a file-like object.
:param str filename: The storage root-relative filename
:param str mode: The open mode (``(r|w)b?``)
:raises FileNotFound: If trying to read a file that does not exists
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_queue_for_the_action'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '31', '39', '55', '65']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'mod'}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '12', 'type': 'argument_list', 'children': ['13', '14', '15']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '14', 'type': 'string', 'children': [], 'value': "'module_type'"}; {'id': '15', 'type': 'string', 'children': [], 'value': "'fork'"}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'queues'}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '30']}; {'id': '23', 'type': 'attribute', 'children': ['24', '29']}; {'id': '24', 'type': 'subscript', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'q_by_mod'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'mod'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '30', 'type': 'argument_list', 'children': []}; {'id': '31', 'type': 'if_statement', 'children': ['32', '34']}; {'id': '32', 'type': 'not_operator', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'queues'}; {'id': '34', 'type': 'block', 'children': ['35']}; {'id': '35', 'type': 'return_statement', 'children': ['36']}; {'id': '36', 'type': 'tuple', 'children': ['37', '38']}; {'id': '37', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '38', 'type': 'None', 'children': []}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'rr_qid'}; {'id': '44', 'type': 'binary_operator', 'children': ['45', '51'], 'value': '%'}; {'id': '45', 'type': '()', 'children': ['46']}; {'id': '46', 'type': 'binary_operator', 'children': ['47', '50'], 'value': '+'}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'rr_qid'}; {'id': '50', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'queues'}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'assignment', 'children': ['57', '60']}; {'id': '57', 'type': 'tuple_pattern', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'worker_id'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'queue'}; {'id': '60', 'type': 'subscript', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'queues'}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'rr_qid'}; {'id': '65', 'type': 'return_statement', 'children': ['66']}; {'id': '66', 'type': 'tuple', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'worker_id'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'queue'}
|
Find action queue for the action depending on the module.
The id is found with action modulo on action id
:param a: the action that need action queue to be assigned
:type action: object
:return: worker id and queue. (0, None) if no queue for the module_type
:rtype: tuple
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '18']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'search_associations_go'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10', '13', '16']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'subject_category'}; {'id': '6', 'type': 'None', 'children': []}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'object_category'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'relation'}; {'id': '12', 'type': 'None', 'children': []}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'subject'}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'dictionary_splat_pattern', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '18', 'type': 'block', 'children': ['19', '23', '35', '52']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'go_golr_url'}; {'id': '22', 'type': 'string', 'children': [], 'value': '"http://golr.geneontology.org/solr/"'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'go_solr'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'pysolr'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'Solr'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'go_golr_url'}; {'id': '32', 'type': 'keyword_argument', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'timeout'}; {'id': '34', 'type': 'integer', 'children': [], 'value': '5'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '46']}; {'id': '37', 'type': 'subscript', 'children': ['38', '45']}; {'id': '38', 'type': 'attribute', 'children': ['39', '44']}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'go_solr'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'get_session'}; {'id': '43', 'type': 'argument_list', 'children': []}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '45', 'type': 'string', 'children': [], 'value': "'User-Agent'"}; {'id': '46', 'type': 'call', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'get_user_agent'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'keyword_argument', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'caller_name'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': '__name__'}; {'id': '52', 'type': 'return_statement', 'children': ['53']}; {'id': '53', 'type': 'call', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'search_associations'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '57', '58', '59', '60', '63', '68']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'subject_category'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'object_category'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'relation'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'subject'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'solr'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'go_solr'}; {'id': '63', 'type': 'keyword_argument', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'field_mapping'}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'goassoc_fieldmap'}; {'id': '67', 'type': 'argument_list', 'children': []}; {'id': '68', 'type': 'dictionary_splat', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
|
Perform association search using Monarch golr
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'print_token'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'token_node_index'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '22', '32', '42']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'err_msg'}; {'id': '10', 'type': 'string', 'children': [], 'value': '"The given node is not a token node."'}; {'id': '11', 'type': 'assert_statement', 'children': ['12', '21']}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '20']}; {'id': '15', 'type': 'subscript', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'nodes'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'token_node_index'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'TokenNode'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'err_msg'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'onset'}; {'id': '25', 'type': 'attribute', 'children': ['26', '31']}; {'id': '26', 'type': 'subscript', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'nodes'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'token_node_index'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'onset'}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '35', 'type': 'attribute', 'children': ['36', '41']}; {'id': '36', 'type': 'subscript', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'nodes'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'token_node_index'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'subscript', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '47', 'type': 'slice', 'children': ['48', '49', '50']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'onset'}; {'id': '49', 'type': 'colon', 'children': []}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'offset'}
|
returns the string representation of a token.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'regexer_for_targets'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'targets'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'for_statement', 'children': ['7', '8', '9']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'targets'}; {'id': '9', 'type': 'block', 'children': ['10', '23', '31']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '15']}; {'id': '12', 'type': 'pattern_list', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'file_ext'}; {'id': '15', 'type': 'call', 'children': ['16', '21']}; {'id': '16', 'type': 'attribute', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'splitext'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'regexer'}; {'id': '26', 'type': 'subscript', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'regexers'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'file_ext'}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'yield', 'children': ['33']}; {'id': '33', 'type': 'expression_list', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'regexer'}
|
Pairs up target files with their correct regex
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '23']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'equities'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'futures'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'exchanges'}; {'id': '13', 'type': 'None', 'children': []}; {'id': '14', 'type': 'default_parameter', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'root_symbols'}; {'id': '16', 'type': 'None', 'children': []}; {'id': '17', 'type': 'default_parameter', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'equity_supplementary_mappings'}; {'id': '19', 'type': 'None', 'children': []}; {'id': '20', 'type': 'default_parameter', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'chunk_size'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'DEFAULT_CHUNK_SIZE'}; {'id': '23', 'type': 'block', 'children': ['24', '70', '129']}; {'id': '24', 'type': 'if_statement', 'children': ['25', '28']}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '27'], 'value': 'is'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'exchanges'}; {'id': '27', 'type': 'None', 'children': []}; {'id': '28', 'type': 'block', 'children': ['29', '46']}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'exchange_names'}; {'id': '32', 'type': 'list_comprehension', 'children': ['33', '36', '42']}; {'id': '33', 'type': 'subscript', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'df'}; {'id': '35', 'type': 'string', 'children': [], 'value': "'exchange'"}; {'id': '36', 'type': 'for_in_clause', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'df'}; {'id': '38', 'type': 'tuple', 'children': ['39', '40', '41']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'equities'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'futures'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'root_symbols'}; {'id': '42', 'type': 'if_clause', 'children': ['43']}; {'id': '43', 'type': 'comparison_operator', 'children': ['44', '45'], 'value': 'is not'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'df'}; {'id': '45', 'type': 'None', 'children': []}; {'id': '46', 'type': 'if_statement', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'exchange_names'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'exchanges'}; {'id': '52', 'type': 'call', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'pd'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'DataFrame'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'dictionary', 'children': ['58']}; {'id': '58', 'type': 'pair', 'children': ['59', '60']}; {'id': '59', 'type': 'string', 'children': [], 'value': "'exchange'"}; {'id': '60', 'type': 'call', 'children': ['61', '69']}; {'id': '61', 'type': 'attribute', 'children': ['62', '68']}; {'id': '62', 'type': 'call', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'pd'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'concat'}; {'id': '66', 'type': 'argument_list', 'children': ['67']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'exchange_names'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'unique'}; {'id': '69', 'type': 'argument_list', 'children': []}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'assignment', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '73', 'type': 'call', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': '_load_data'}; {'id': '77', 'type': 'argument_list', 'children': ['78', '88', '98', '108', '118']}; {'id': '78', 'type': 'conditional_expression', 'children': ['79', '80', '83'], 'value': 'if'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'equities'}; {'id': '80', 'type': 'comparison_operator', 'children': ['81', '82'], 'value': 'is not'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'equities'}; {'id': '82', 'type': 'None', 'children': []}; {'id': '83', 'type': 'call', 'children': ['84', '87']}; {'id': '84', 'type': 'attribute', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'pd'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'DataFrame'}; {'id': '87', 'type': 'argument_list', 'children': []}; {'id': '88', 'type': 'conditional_expression', 'children': ['89', '90', '93'], 'value': 'if'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'futures'}; {'id': '90', 'type': 'comparison_operator', 'children': ['91', '92'], 'value': 'is not'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'futures'}; {'id': '92', 'type': 'None', 'children': []}; {'id': '93', 'type': 'call', 'children': ['94', '97']}; {'id': '94', 'type': 'attribute', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'pd'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'DataFrame'}; {'id': '97', 'type': 'argument_list', 'children': []}; {'id': '98', 'type': 'conditional_expression', 'children': ['99', '100', '103'], 'value': 'if'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'exchanges'}; {'id': '100', 'type': 'comparison_operator', 'children': ['101', '102'], 'value': 'is not'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'exchanges'}; {'id': '102', 'type': 'None', 'children': []}; {'id': '103', 'type': 'call', 'children': ['104', '107']}; {'id': '104', 'type': 'attribute', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'pd'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'DataFrame'}; {'id': '107', 'type': 'argument_list', 'children': []}; {'id': '108', 'type': 'conditional_expression', 'children': ['109', '110', '113'], 'value': 'if'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'root_symbols'}; {'id': '110', 'type': 'comparison_operator', 'children': ['111', '112'], 'value': 'is not'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'root_symbols'}; {'id': '112', 'type': 'None', 'children': []}; {'id': '113', 'type': 'call', 'children': ['114', '117']}; {'id': '114', 'type': 'attribute', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'pd'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'DataFrame'}; {'id': '117', 'type': 'argument_list', 'children': []}; {'id': '118', 'type': '()', 'children': ['119']}; {'id': '119', 'type': 'conditional_expression', 'children': ['120', '121', '124'], 'value': 'if'}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'equity_supplementary_mappings'}; {'id': '121', 'type': 'comparison_operator', 'children': ['122', '123'], 'value': 'is not'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'equity_supplementary_mappings'}; {'id': '123', 'type': 'None', 'children': []}; {'id': '124', 'type': 'call', 'children': ['125', '128']}; {'id': '125', 'type': 'attribute', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'pd'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'DataFrame'}; {'id': '128', 'type': 'argument_list', 'children': []}; {'id': '129', 'type': 'expression_statement', 'children': ['130']}; {'id': '130', 'type': 'call', 'children': ['131', '134']}; {'id': '131', 'type': 'attribute', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '133', 'type': 'identifier', 'children': [], 'value': '_real_write'}; {'id': '134', 'type': 'argument_list', 'children': ['135', '140', '145', '150', '155', '160', '165']}; {'id': '135', 'type': 'keyword_argument', 'children': ['136', '137']}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'equities'}; {'id': '137', 'type': 'attribute', 'children': ['138', '139']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'equities'}; {'id': '140', 'type': 'keyword_argument', 'children': ['141', '142']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'equity_symbol_mappings'}; {'id': '142', 'type': 'attribute', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'equities_mappings'}; {'id': '145', 'type': 'keyword_argument', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'equity_supplementary_mappings'}; {'id': '147', 'type': 'attribute', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'equity_supplementary_mappings'}; {'id': '150', 'type': 'keyword_argument', 'children': ['151', '152']}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'futures'}; {'id': '152', 'type': 'attribute', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'futures'}; {'id': '155', 'type': 'keyword_argument', 'children': ['156', '157']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'root_symbols'}; {'id': '157', 'type': 'attribute', 'children': ['158', '159']}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'root_symbols'}; {'id': '160', 'type': 'keyword_argument', 'children': ['161', '162']}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'exchanges'}; {'id': '162', 'type': 'attribute', 'children': ['163', '164']}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'exchanges'}; {'id': '165', 'type': 'keyword_argument', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'chunk_size'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'chunk_size'}
|
Write asset metadata to a sqlite database.
Parameters
----------
equities : pd.DataFrame, optional
The equity metadata. The columns for this dataframe are:
symbol : str
The ticker symbol for this equity.
asset_name : str
The full name for this asset.
start_date : datetime
The date when this asset was created.
end_date : datetime, optional
The last date we have trade data for this asset.
first_traded : datetime, optional
The first date we have trade data for this asset.
auto_close_date : datetime, optional
The date on which to close any positions in this asset.
exchange : str
The exchange where this asset is traded.
The index of this dataframe should contain the sids.
futures : pd.DataFrame, optional
The future contract metadata. The columns for this dataframe are:
symbol : str
The ticker symbol for this futures contract.
root_symbol : str
The root symbol, or the symbol with the expiration stripped
out.
asset_name : str
The full name for this asset.
start_date : datetime, optional
The date when this asset was created.
end_date : datetime, optional
The last date we have trade data for this asset.
first_traded : datetime, optional
The first date we have trade data for this asset.
exchange : str
The exchange where this asset is traded.
notice_date : datetime
The date when the owner of the contract may be forced
to take physical delivery of the contract's asset.
expiration_date : datetime
The date when the contract expires.
auto_close_date : datetime
The date when the broker will automatically close any
positions in this contract.
tick_size : float
The minimum price movement of the contract.
multiplier: float
The amount of the underlying asset represented by this
contract.
exchanges : pd.DataFrame, optional
The exchanges where assets can be traded. The columns of this
dataframe are:
exchange : str
The full name of the exchange.
canonical_name : str
The canonical name of the exchange.
country_code : str
The ISO 3166 alpha-2 country code of the exchange.
root_symbols : pd.DataFrame, optional
The root symbols for the futures contracts. The columns for this
dataframe are:
root_symbol : str
The root symbol name.
root_symbol_id : int
The unique id for this root symbol.
sector : string, optional
The sector of this root symbol.
description : string, optional
A short description of this root symbol.
exchange : str
The exchange where this root symbol is traded.
equity_supplementary_mappings : pd.DataFrame, optional
Additional mappings from values of abitrary type to assets.
chunk_size : int, optional
The amount of rows to write to the SQLite table at once.
This defaults to the default number of bind params in sqlite.
If you have compiled sqlite3 with more bind or less params you may
want to pass that value here.
See Also
--------
zipline.assets.asset_finder
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'namedb_is_name_zonefile_hash'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cur'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'zonefile_hash'}; {'id': '7', 'type': 'block', 'children': ['8', '12', '18', '27', '31', '42']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'select_query'}; {'id': '11', 'type': 'string', 'children': [], 'value': "'SELECT COUNT(value_hash) FROM history WHERE history_id = ? AND value_hash = ?'"}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'select_args'}; {'id': '15', 'type': 'tuple', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'zonefile_hash'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'namedb_query_execute'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25', '26']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'cur'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'select_query'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'select_args'}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '30', 'type': 'None', 'children': []}; {'id': '31', 'type': 'for_statement', 'children': ['32', '33', '34']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '34', 'type': 'block', 'children': ['35', '41']}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '38', 'type': 'subscript', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '40', 'type': 'string', 'children': [], 'value': "'COUNT(value_hash)'"}; {'id': '41', 'type': 'break_statement', 'children': []}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'comparison_operator', 'children': ['44', '45'], 'value': '>'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '45', 'type': 'integer', 'children': [], 'value': '0'}
|
Determine if a zone file hash was sent by a name.
Return True if so, false if not
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'decode_mysql_literal'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '5', 'type': 'block', 'children': ['6', '16', '32', '45', '58', '71']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '13']}; {'id': '7', 'type': 'call', 'children': ['8', '11']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'MYSQL_NULL_PATTERN'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'return_statement', 'children': ['15']}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'if_statement', 'children': ['17', '23']}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'MYSQL_BOOLEAN_PATTERN'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'return_statement', 'children': ['25']}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '31'], 'value': '=='}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '30', 'type': 'argument_list', 'children': []}; {'id': '31', 'type': 'string', 'children': [], 'value': '"true"'}; {'id': '32', 'type': 'if_statement', 'children': ['33', '39']}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'MYSQL_FLOAT_PATTERN'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'return_statement', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '45', 'type': 'if_statement', 'children': ['46', '52']}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'MYSQL_INT_PATTERN'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'return_statement', 'children': ['54']}; {'id': '54', 'type': 'call', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '58', 'type': 'if_statement', 'children': ['59', '65']}; {'id': '59', 'type': 'call', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'MYSQL_STRING_PATTERN'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '63', 'type': 'argument_list', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '65', 'type': 'block', 'children': ['66']}; {'id': '66', 'type': 'return_statement', 'children': ['67']}; {'id': '67', 'type': 'call', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'decode_mysql_string_literal'}; {'id': '69', 'type': 'argument_list', 'children': ['70']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '71', 'type': 'raise_statement', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'binary_operator', 'children': ['76', '77'], 'value': '%'}; {'id': '76', 'type': 'string', 'children': [], 'value': '"Unable to decode given value: %r"'}; {'id': '77', 'type': 'tuple', 'children': ['78']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'text'}
|
Attempts to decode given MySQL literal into Python value.
:param text: Value to be decoded, as MySQL literal.
:type text: str
:return: Python version of the given MySQL literal.
:rtype: any
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'importPreflibFile'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'fileName'}; {'id': '6', 'type': 'block', 'children': ['7', '15', '32', '38', '53', '59']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'elecFileObj'}; {'id': '10', 'type': 'call', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '12', 'type': 'argument_list', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'fileName'}; {'id': '14', 'type': 'string', 'children': [], 'value': "'r'"}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '26']}; {'id': '17', 'type': 'pattern_list', 'children': ['18', '21', '22', '23']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'candMap'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'rankMaps'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'wmgMapsCounts'}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'numVoters'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'prefpy_io'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'read_election_file'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'elecFileObj'}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'elecFileObj'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'close'}; {'id': '37', 'type': 'argument_list', 'children': []}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'numCands'}; {'id': '43', 'type': 'call', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '45', 'type': 'argument_list', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '52']}; {'id': '47', 'type': 'attribute', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'candMap'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '52', 'type': 'argument_list', 'children': []}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'assignment', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'preferences'}; {'id': '58', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '59', 'type': 'for_statement', 'children': ['60', '61', '69']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '61', 'type': 'call', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '63', 'type': 'argument_list', 'children': ['64', '65']}; {'id': '64', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '65', 'type': 'call', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'rankMaps'}; {'id': '69', 'type': 'block', 'children': ['70', '81']}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'assignment', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'wmgMap'}; {'id': '73', 'type': 'call', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'genWmgMapFromRankMap'}; {'id': '77', 'type': 'argument_list', 'children': ['78']}; {'id': '78', 'type': 'subscript', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'rankMaps'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '81', 'type': 'expression_statement', 'children': ['82']}; {'id': '82', 'type': 'call', 'children': ['83', '88']}; {'id': '83', 'type': 'attribute', 'children': ['84', '87']}; {'id': '84', 'type': 'attribute', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'preferences'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '88', 'type': 'argument_list', 'children': ['89']}; {'id': '89', 'type': 'call', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'Preference'}; {'id': '91', 'type': 'argument_list', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'wmgMap'}; {'id': '93', 'type': 'subscript', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'wmgMapsCounts'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'i'}
|
Imports a preflib format file that contains all the information of a Profile. This function
will completely override all members of the current Profile object. Currently, we assume
that in an election where incomplete ordering are allowed, if a voter ranks only one
candidate, then the voter did not prefer any candidates over another. This may lead to some
discrepancies when importing and exporting a .toi preflib file or a .soi preflib file.
:ivar str fileName: The name of the input file to be imported.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_locale_choices'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'locale_dir'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '19', '56', '63']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'file_name_s'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'listdir'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'locale_dir'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'choice_s'}; {'id': '18', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '19', 'type': 'for_statement', 'children': ['20', '21', '22']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'file_name'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'file_name_s'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'if_statement', 'children': ['24', '32']}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'file_name'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'endswith'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'I18n'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'TT_FILE_EXT_STXT'}; {'id': '32', 'type': 'block', 'children': ['33', '46']}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '38']}; {'id': '35', 'type': 'pattern_list', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'file_name_noext'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '38', 'type': 'call', 'children': ['39', '44']}; {'id': '39', 'type': 'attribute', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'splitext'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'file_name'}; {'id': '46', 'type': 'if_statement', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'file_name_noext'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'call', 'children': ['51', '54']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'choice_s'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '54', 'type': 'argument_list', 'children': ['55']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'file_name_noext'}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'choice_s'}; {'id': '59', 'type': 'call', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'choice_s'}; {'id': '63', 'type': 'return_statement', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'choice_s'}
|
Get a list of locale file names in the given locale dir.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '__prepare_info_from_dicomdir_file'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'writedicomdirfile'}; {'id': '7', 'type': 'True', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '13', '29', '33', '86', '144', '150', '156', '162']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'createdcmdir'}; {'id': '12', 'type': 'True', 'children': []}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'dicomdirfile'}; {'id': '16', 'type': 'call', 'children': ['17', '22']}; {'id': '17', 'type': 'attribute', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'dirpath'}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'dicomdir_filename'}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'ftype'}; {'id': '32', 'type': 'string', 'children': [], 'value': "'pickle'"}; {'id': '33', 'type': 'if_statement', 'children': ['34', '42']}; {'id': '34', 'type': 'call', 'children': ['35', '40']}; {'id': '35', 'type': 'attribute', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'exists'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'dicomdirfile'}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'try_statement', 'children': ['44', '72']}; {'id': '44', 'type': 'block', 'children': ['45', '55', '66']}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'dcmdirplus'}; {'id': '48', 'type': 'call', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'misc'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'obj_from_file'}; {'id': '52', 'type': 'argument_list', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'dicomdirfile'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'ftype'}; {'id': '55', 'type': 'if_statement', 'children': ['56', '61']}; {'id': '56', 'type': 'comparison_operator', 'children': ['57', '60'], 'value': '=='}; {'id': '57', 'type': 'subscript', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'dcmdirplus'}; {'id': '59', 'type': 'string', 'children': [], 'value': "'version'"}; {'id': '60', 'type': 'identifier', 'children': [], 'value': '__version__'}; {'id': '61', 'type': 'block', 'children': ['62']}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'createdcmdir'}; {'id': '65', 'type': 'False', 'children': []}; {'id': '66', 'type': 'expression_statement', 'children': ['67']}; {'id': '67', 'type': 'assignment', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'dcmdir'}; {'id': '69', 'type': 'subscript', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'dcmdirplus'}; {'id': '71', 'type': 'string', 'children': [], 'value': "'filesinfo'"}; {'id': '72', 'type': 'except_clause', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '74', 'type': 'block', 'children': ['75', '82']}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'call', 'children': ['77', '80']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'string', 'children': [], 'value': "'Found dicomdir.pkl with wrong version'"}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'assignment', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'createdcmdir'}; {'id': '85', 'type': 'True', 'children': []}; {'id': '86', 'type': 'if_statement', 'children': ['87', '92']}; {'id': '87', 'type': 'boolean_operator', 'children': ['88', '89'], 'value': 'or'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'createdcmdir'}; {'id': '89', 'type': 'attribute', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'force_create_dicomdir'}; {'id': '92', 'type': 'block', 'children': ['93', '101', '107']}; {'id': '93', 'type': 'expression_statement', 'children': ['94']}; {'id': '94', 'type': 'assignment', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'dcmdirplus'}; {'id': '96', 'type': 'call', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': '_create_dicomdir_info'}; {'id': '100', 'type': 'argument_list', 'children': []}; {'id': '101', 'type': 'expression_statement', 'children': ['102']}; {'id': '102', 'type': 'assignment', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'dcmdir'}; {'id': '104', 'type': 'subscript', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'dcmdirplus'}; {'id': '106', 'type': 'string', 'children': [], 'value': "'filesinfo'"}; {'id': '107', 'type': 'if_statement', 'children': ['108', '117']}; {'id': '108', 'type': 'boolean_operator', 'children': ['109', '111'], 'value': 'and'}; {'id': '109', 'type': '()', 'children': ['110']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'writedicomdirfile'}; {'id': '111', 'type': 'comparison_operator', 'children': ['112', '116'], 'value': '>'}; {'id': '112', 'type': 'call', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '114', 'type': 'argument_list', 'children': ['115']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'dcmdir'}; {'id': '116', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '117', 'type': 'block', 'children': ['118']}; {'id': '118', 'type': 'try_statement', 'children': ['119', '129']}; {'id': '119', 'type': 'block', 'children': ['120']}; {'id': '120', 'type': 'expression_statement', 'children': ['121']}; {'id': '121', 'type': 'call', 'children': ['122', '125']}; {'id': '122', 'type': 'attribute', 'children': ['123', '124']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'misc'}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'obj_to_file'}; {'id': '125', 'type': 'argument_list', 'children': ['126', '127', '128']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'dcmdirplus'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'dicomdirfile'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'ftype'}; {'id': '129', 'type': 'except_clause', 'children': ['130']}; {'id': '130', 'type': 'block', 'children': ['131', '138']}; {'id': '131', 'type': 'expression_statement', 'children': ['132']}; {'id': '132', 'type': 'call', 'children': ['133', '136']}; {'id': '133', 'type': 'attribute', 'children': ['134', '135']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'warning'}; {'id': '136', 'type': 'argument_list', 'children': ['137']}; {'id': '137', 'type': 'string', 'children': [], 'value': "'Cannot write dcmdir file'"}; {'id': '138', 'type': 'expression_statement', 'children': ['139']}; {'id': '139', 'type': 'call', 'children': ['140', '143']}; {'id': '140', 'type': 'attribute', 'children': ['141', '142']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'traceback'}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'print_exc'}; {'id': '143', 'type': 'argument_list', 'children': []}; {'id': '144', 'type': 'expression_statement', 'children': ['145']}; {'id': '145', 'type': 'assignment', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'dcmdir'}; {'id': '147', 'type': 'subscript', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'dcmdirplus'}; {'id': '149', 'type': 'string', 'children': [], 'value': "'filesinfo'"}; {'id': '150', 'type': 'expression_statement', 'children': ['151']}; {'id': '151', 'type': 'assignment', 'children': ['152', '155']}; {'id': '152', 'type': 'attribute', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'dcmdirplus'}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'dcmdirplus'}; {'id': '156', 'type': 'expression_statement', 'children': ['157']}; {'id': '157', 'type': 'assignment', 'children': ['158', '161']}; {'id': '158', 'type': 'attribute', 'children': ['159', '160']}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '160', 'type': 'identifier', 'children': [], 'value': 'files_with_info'}; {'id': '161', 'type': 'identifier', 'children': [], 'value': 'dcmdir'}; {'id': '162', 'type': 'return_statement', 'children': ['163']}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'dcmdir'}
|
Check if exists dicomdir file and load it or cerate it
dcmdir = get_dir(dirpath)
dcmdir: list with filenames, SeriesNumber and SliceLocation
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'tilt_residual'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '7', 'type': 'block', 'children': ['8', '20', '29']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'bg'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'tilt_model'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '15', 'type': 'keyword_argument', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '23', 'type': 'subscript', 'children': ['24', '28']}; {'id': '24', 'type': '()', 'children': ['25']}; {'id': '25', 'type': 'binary_operator', 'children': ['26', '27'], 'value': '-'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'bg'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '29', 'type': 'return_statement', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'res'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'flatten'}; {'id': '34', 'type': 'argument_list', 'children': []}
|
lmfit tilt residuals
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_try_to_compute_deterministic_class_id'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'depth'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '5'}; {'id': '8', 'type': 'block', 'children': ['9', '18', '59', '73']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'class_id'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'pickle'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'dumps'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '18', 'type': 'for_statement', 'children': ['19', '20', '24']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'depth'}; {'id': '24', 'type': 'block', 'children': ['25', '39', '55']}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'new_class_id'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'pickle'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'dumps'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'pickle'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'loads'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'class_id'}; {'id': '39', 'type': 'if_statement', 'children': ['40', '43']}; {'id': '40', 'type': 'comparison_operator', 'children': ['41', '42'], 'value': '=='}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'new_class_id'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'class_id'}; {'id': '43', 'type': 'block', 'children': ['44']}; {'id': '44', 'type': 'return_statement', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '54']}; {'id': '46', 'type': 'attribute', 'children': ['47', '53']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'hashlib'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'sha1'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'new_class_id'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'digest'}; {'id': '54', 'type': 'argument_list', 'children': []}; {'id': '55', 'type': 'expression_statement', 'children': ['56']}; {'id': '56', 'type': 'assignment', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'class_id'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'new_class_id'}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'warning'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'call', 'children': ['66', '71']}; {'id': '66', 'type': 'attribute', 'children': ['67', '70']}; {'id': '67', 'type': 'concatenated_string', 'children': ['68', '69']}; {'id': '68', 'type': 'string', 'children': [], 'value': '"WARNING: Could not produce a deterministic class ID for class "'}; {'id': '69', 'type': 'string', 'children': [], 'value': '"{}"'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '73', 'type': 'return_statement', 'children': ['74']}; {'id': '74', 'type': 'call', 'children': ['75', '83']}; {'id': '75', 'type': 'attribute', 'children': ['76', '82']}; {'id': '76', 'type': 'call', 'children': ['77', '80']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'hashlib'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'sha1'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'new_class_id'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'digest'}; {'id': '83', 'type': 'argument_list', 'children': []}
|
Attempt to produce a deterministic class ID for a given class.
The goal here is for the class ID to be the same when this is run on
different worker processes. Pickling, loading, and pickling again seems to
produce more consistent results than simply pickling. This is a bit crazy
and could cause problems, in which case we should revert it and figure out
something better.
Args:
cls: The class to produce an ID for.
depth: The number of times to repeatedly try to load and dump the
string while trying to reach a fixed point.
Returns:
A class ID for this class. We attempt to make the class ID the same
when this function is run on different workers, but that is not
guaranteed.
Raises:
Exception: This could raise an exception if cloudpickle raises an
exception.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_float'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'position'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'dummy0'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'dummy1'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'dummy2'}; {'id': '9', 'type': 'block', 'children': ['10', '16']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '13', 'type': 'binary_operator', 'children': ['14', '15'], 'value': '+'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'position'}; {'id': '15', 'type': 'integer', 'children': [], 'value': '8'}; {'id': '16', 'type': 'return_statement', 'children': ['17']}; {'id': '17', 'type': 'expression_list', 'children': ['18', '29']}; {'id': '18', 'type': 'subscript', 'children': ['19', '28']}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_UNPACK_FLOAT'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'subscript', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '24', 'type': 'slice', 'children': ['25', '26', '27']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'position'}; {'id': '26', 'type': 'colon', 'children': []}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '28', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'end'}
|
Decode a BSON double to python float.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'apply_boundary_conditions'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'dictionary_splat_pattern', 'children': ['6']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '7', 'type': 'block', 'children': ['8', '16', '24', '37', '50', '65', '80']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'polarval'}; {'id': '11', 'type': 'subscript', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_polar_angle'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'azval'}; {'id': '19', 'type': 'subscript', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': '_azimuthal_angle'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'polarval'}; {'id': '27', 'type': 'call', 'children': ['28', '35']}; {'id': '28', 'type': 'attribute', 'children': ['29', '34']}; {'id': '29', 'type': 'attribute', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': '_polardist'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': '_domain'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'apply_conditions'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'polarval'}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'azval'}; {'id': '40', 'type': 'call', 'children': ['41', '48']}; {'id': '41', 'type': 'attribute', 'children': ['42', '47']}; {'id': '42', 'type': 'attribute', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': '_azimuthaldist'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': '_domain'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'apply_conditions'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'azval'}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'polarval'}; {'id': '53', 'type': 'call', 'children': ['54', '63']}; {'id': '54', 'type': 'attribute', 'children': ['55', '62']}; {'id': '55', 'type': 'subscript', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': '_bounds'}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': '_polar_angle'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'apply_conditions'}; {'id': '63', 'type': 'argument_list', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'polarval'}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'assignment', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'azval'}; {'id': '68', 'type': 'call', 'children': ['69', '78']}; {'id': '69', 'type': 'attribute', 'children': ['70', '77']}; {'id': '70', 'type': 'subscript', 'children': ['71', '74']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': '_bounds'}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': '_azimuthal_angle'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'apply_conditions'}; {'id': '78', 'type': 'argument_list', 'children': ['79']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'azval'}; {'id': '80', 'type': 'return_statement', 'children': ['81']}; {'id': '81', 'type': 'dictionary', 'children': ['82', '87']}; {'id': '82', 'type': 'pair', 'children': ['83', '86']}; {'id': '83', 'type': 'attribute', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': '_polar_angle'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'polarval'}; {'id': '87', 'type': 'pair', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': '_azimuthal_angle'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'azval'}
|
Maps the given values to be within the domain of the azimuthal and
polar angles, before applying any other boundary conditions.
Parameters
----------
\**kwargs :
The keyword args must include values for both the azimuthal and
polar angle, using the names they were initilialized with. For
example, if `polar_angle='theta'` and `azimuthal_angle=`phi`, then
the keyword args must be `theta={val1}, phi={val2}`.
Returns
-------
dict
A dictionary of the parameter names and the conditioned values.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '32']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'by_median_home_value'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '9', '14', '19', '26', '29']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '7', 'type': 'unary_operator', 'children': ['8'], 'value': '-'}; {'id': '8', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'upper'}; {'id': '11', 'type': 'binary_operator', 'children': ['12', '13'], 'value': '**'}; {'id': '12', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '13', 'type': 'integer', 'children': [], 'value': '31'}; {'id': '14', 'type': 'default_parameter', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'zipcode_type'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'ZipcodeType'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'Standard'}; {'id': '19', 'type': 'default_parameter', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'sort_by'}; {'id': '21', 'type': 'attribute', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'SimpleZipcode'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'median_home_value'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '26', 'type': 'default_parameter', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'ascending'}; {'id': '28', 'type': 'False', 'children': []}; {'id': '29', 'type': 'default_parameter', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'returns'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'DEFAULT_LIMIT'}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '38', 'type': 'argument_list', 'children': ['39', '42', '45', '48', '51', '54']}; {'id': '39', 'type': 'keyword_argument', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'median_home_value_lower'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '42', 'type': 'keyword_argument', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'median_home_value_upper'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'upper'}; {'id': '45', 'type': 'keyword_argument', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'sort_by'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'sort_by'}; {'id': '48', 'type': 'keyword_argument', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'zipcode_type'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'zipcode_type'}; {'id': '51', 'type': 'keyword_argument', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'ascending'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'ascending'}; {'id': '54', 'type': 'keyword_argument', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'returns'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'returns'}
|
Search zipcode information by median home value.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'pivot_wavelength'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '25', '32', '40', '55']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'wl'}; {'id': '9', 'type': 'call', 'children': ['10', '17']}; {'id': '10', 'type': 'attribute', 'children': ['11', '16']}; {'id': '11', 'type': 'attribute', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'registry'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_pivot_wavelengths'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'tuple', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'telescope'}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'band'}; {'id': '25', 'type': 'if_statement', 'children': ['26', '29']}; {'id': '26', 'type': 'comparison_operator', 'children': ['27', '28'], 'value': 'is not'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'wl'}; {'id': '28', 'type': 'None', 'children': []}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'return_statement', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'wl'}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'wl'}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'calc_pivot_wavelength'}; {'id': '39', 'type': 'argument_list', 'children': []}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '47']}; {'id': '42', 'type': 'attribute', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'registry'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'register_pivot_wavelength'}; {'id': '47', 'type': 'argument_list', 'children': ['48', '51', '54']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'telescope'}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'band'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'wl'}; {'id': '55', 'type': 'return_statement', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'wl'}
|
Get the bandpass' pivot wavelength.
Unlike calc_pivot_wavelength(), this function will use a cached
value if available.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_last'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '24']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '9', 'type': 'call', 'children': ['10', '17']}; {'id': '10', 'type': 'attribute', 'children': ['11', '16']}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'table'}; {'id': '15', 'type': 'argument_list', 'children': []}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'where'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '19']}; {'id': '18', 'type': 'string', 'children': [], 'value': "'batch'"}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'get_last_batch_number'}; {'id': '23', 'type': 'argument_list', 'children': []}; {'id': '24', 'type': 'return_statement', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '35']}; {'id': '26', 'type': 'attribute', 'children': ['27', '34']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'order_by'}; {'id': '31', 'type': 'argument_list', 'children': ['32', '33']}; {'id': '32', 'type': 'string', 'children': [], 'value': "'migration'"}; {'id': '33', 'type': 'string', 'children': [], 'value': "'desc'"}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '35', 'type': 'argument_list', 'children': []}
|
Get the last migration batch.
:rtype: list
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'document_data'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'document_id'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '14', '101']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '13'], 'value': 'is'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'document_id'}; {'id': '13', 'type': 'None', 'children': []}; {'id': '14', 'type': 'block', 'children': ['15', '25', '33', '67', '77', '86', '95']}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '20']}; {'id': '17', 'type': 'pattern_list', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'parent_path'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'expected_prefix'}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': '_parent_info'}; {'id': '24', 'type': 'argument_list', 'children': []}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'document_pb'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'document_pb2'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'Document'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'created_document_pb'}; {'id': '36', 'type': 'call', 'children': ['37', '44']}; {'id': '37', 'type': 'attribute', 'children': ['38', '43']}; {'id': '38', 'type': 'attribute', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': '_client'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': '_firestore_api'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'create_document'}; {'id': '44', 'type': 'argument_list', 'children': ['45', '46', '51', '54', '57', '60']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'parent_path'}; {'id': '46', 'type': 'keyword_argument', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'collection_id'}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '51', 'type': 'keyword_argument', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'document_id'}; {'id': '53', 'type': 'None', 'children': []}; {'id': '54', 'type': 'keyword_argument', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'document'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'document_pb'}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '59', 'type': 'None', 'children': []}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'metadata'}; {'id': '62', 'type': 'attribute', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': '_client'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': '_rpc_metadata'}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'assignment', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'new_document_id'}; {'id': '70', 'type': 'call', 'children': ['71', '74']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': '_helpers'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'get_doc_id'}; {'id': '74', 'type': 'argument_list', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'created_document_pb'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'expected_prefix'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'document_ref'}; {'id': '80', 'type': 'call', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'document'}; {'id': '84', 'type': 'argument_list', 'children': ['85']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'new_document_id'}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'assignment', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'set_result'}; {'id': '89', 'type': 'call', 'children': ['90', '93']}; {'id': '90', 'type': 'attribute', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'document_ref'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '93', 'type': 'argument_list', 'children': ['94']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'document_data'}; {'id': '95', 'type': 'return_statement', 'children': ['96']}; {'id': '96', 'type': 'expression_list', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'set_result'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'update_time'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'document_ref'}; {'id': '101', 'type': 'else_clause', 'children': ['102']}; {'id': '102', 'type': 'block', 'children': ['103', '112', '121']}; {'id': '103', 'type': 'expression_statement', 'children': ['104']}; {'id': '104', 'type': 'assignment', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'document_ref'}; {'id': '106', 'type': 'call', 'children': ['107', '110']}; {'id': '107', 'type': 'attribute', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'document'}; {'id': '110', 'type': 'argument_list', 'children': ['111']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'document_id'}; {'id': '112', 'type': 'expression_statement', 'children': ['113']}; {'id': '113', 'type': 'assignment', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'write_result'}; {'id': '115', 'type': 'call', 'children': ['116', '119']}; {'id': '116', 'type': 'attribute', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'document_ref'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'create'}; {'id': '119', 'type': 'argument_list', 'children': ['120']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'document_data'}; {'id': '121', 'type': 'return_statement', 'children': ['122']}; {'id': '122', 'type': 'expression_list', 'children': ['123', '126']}; {'id': '123', 'type': 'attribute', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'write_result'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'update_time'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'document_ref'}
|
Create a document in the Firestore database with the provided data.
Args:
document_data (dict): Property names and values to use for
creating the document.
document_id (Optional[str]): The document identifier within the
current collection. If not provided, an ID will be
automatically assigned by the server (the assigned ID will be
a random 20 character string composed of digits,
uppercase and lowercase letters).
Returns:
Tuple[google.protobuf.timestamp_pb2.Timestamp, \
~.firestore_v1beta1.document.DocumentReference]: Pair of
* The ``update_time`` when the document was created (or
overwritten).
* A document reference for the created document.
Raises:
~google.cloud.exceptions.Conflict: If ``document_id`` is provided
and the document already exists.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'query_by_student'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'student_id'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'end_time'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'start_time'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13', '17', '21', '25', '31', '42', '53', '74']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '16', 'type': 'dictionary', 'children': []}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '20', 'type': 'dictionary', 'children': []}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '24', 'type': 'dictionary', 'children': []}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '30']}; {'id': '27', 'type': 'subscript', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '29', 'type': 'string', 'children': [], 'value': '"student_id"'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'student_id'}; {'id': '31', 'type': 'if_statement', 'children': ['32', '35']}; {'id': '32', 'type': 'comparison_operator', 'children': ['33', '34'], 'value': 'is not'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'start_time'}; {'id': '34', 'type': 'None', 'children': []}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '41']}; {'id': '38', 'type': 'subscript', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '40', 'type': 'string', 'children': [], 'value': '"start_time"'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'start_time'}; {'id': '42', 'type': 'if_statement', 'children': ['43', '46']}; {'id': '43', 'type': 'comparison_operator', 'children': ['44', '45'], 'value': 'is not'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'end_time'}; {'id': '45', 'type': 'None', 'children': []}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'assignment', 'children': ['49', '52']}; {'id': '49', 'type': 'subscript', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '51', 'type': 'string', 'children': [], 'value': '"end_time"'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'end_time'}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'call', 'children': ['55', '60']}; {'id': '55', 'type': 'attribute', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'call', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'string', 'children': [], 'value': '"GET /api/v1/audit/grade_change/students/{student_id} with query params: {params} and form data: {data}"'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '65', 'type': 'argument_list', 'children': ['66', '69', '72']}; {'id': '66', 'type': 'keyword_argument', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '69', 'type': 'keyword_argument', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '72', 'type': 'dictionary_splat', 'children': ['73']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '74', 'type': 'return_statement', 'children': ['75']}; {'id': '75', 'type': 'call', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'generic_request'}; {'id': '79', 'type': 'argument_list', 'children': ['80', '81', '88', '91', '94']}; {'id': '80', 'type': 'string', 'children': [], 'value': '"GET"'}; {'id': '81', 'type': 'call', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'string', 'children': [], 'value': '"/api/v1/audit/grade_change/students/{student_id}"'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '85', 'type': 'argument_list', 'children': ['86']}; {'id': '86', 'type': 'dictionary_splat', 'children': ['87']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '88', 'type': 'keyword_argument', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '91', 'type': 'keyword_argument', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '94', 'type': 'keyword_argument', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'all_pages'}; {'id': '96', 'type': 'True', 'children': []}
|
Query by student.
List grade change events for a given student.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'retrieve_customer'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'handle'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'with_additional_data'}; {'id': '8', 'type': 'False', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '38']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'E'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'retrieveCustomerRequest'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '29']}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'E'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'handle'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'handle'}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'E'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'withAdditionalData'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'with_additional_data'}; {'id': '38', 'type': 'return_statement', 'children': ['39']}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'as_model'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'Customer'}
|
Retrieve information of an existing customer.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'clear_list_value'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '6', 'type': 'block', 'children': ['7', '15', '30']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '10']}; {'id': '8', 'type': 'not_operator', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'return_statement', 'children': ['12']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'empty_value'}; {'id': '15', 'type': 'if_statement', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'clean_empty'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '23', 'type': 'list_comprehension', 'children': ['24', '25', '28']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '25', 'type': 'for_in_clause', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '28', 'type': 'if_clause', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '30', 'type': 'return_statement', 'children': ['31']}; {'id': '31', 'type': 'boolean_operator', 'children': ['32', '33'], 'value': 'or'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'empty_value'}
|
Clean the argument value to eliminate None or Falsy values if needed.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_wire_events'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '16', '26', '36', '46', '56']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'augmented_assignment', 'children': ['8', '13'], 'value': '+='}; {'id': '8', 'type': 'attribute', 'children': ['9', '12']}; {'id': '9', 'type': 'attribute', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': '_device'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'on_open'}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_on_open'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'augmented_assignment', 'children': ['18', '23'], 'value': '+='}; {'id': '18', 'type': 'attribute', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '_device'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'on_close'}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': '_on_close'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'augmented_assignment', 'children': ['28', '33'], 'value': '+='}; {'id': '28', 'type': 'attribute', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': '_device'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'on_read'}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': '_on_read'}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'augmented_assignment', 'children': ['38', '43'], 'value': '+='}; {'id': '38', 'type': 'attribute', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': '_device'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'on_write'}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': '_on_write'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'augmented_assignment', 'children': ['48', '53'], 'value': '+='}; {'id': '48', 'type': 'attribute', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': '_zonetracker'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'on_fault'}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': '_on_zone_fault'}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'augmented_assignment', 'children': ['58', '63'], 'value': '+='}; {'id': '58', 'type': 'attribute', 'children': ['59', '62']}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': '_zonetracker'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'on_restore'}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': '_on_zone_restore'}
|
Wires up the internal device events.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'reward_bonus'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'assignment_id'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'amount'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'reason'}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'try_statement', 'children': ['10', '22']}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'return_statement', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '18']}; {'id': '13', 'type': 'attribute', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'mturkservice'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'grant_bonus'}; {'id': '18', 'type': 'argument_list', 'children': ['19', '20', '21']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'assignment_id'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'amount'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'reason'}; {'id': '22', 'type': 'except_clause', 'children': ['23', '27']}; {'id': '23', 'type': 'as_pattern', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'MTurkServiceException'}; {'id': '25', 'type': 'as_pattern_target', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'ex'}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'exception'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'ex'}
|
Reward the Turker for a specified assignment with a bonus.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'inspect_select_calculation'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'try_statement', 'children': ['7', '28']}; {'id': '7', 'type': 'block', 'children': ['8', '16']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '11', 'type': 'attribute', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'ctx'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'cif_select'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '23']}; {'id': '18', 'type': 'attribute', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'ctx'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'cif'}; {'id': '23', 'type': 'attribute', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'outputs'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'cif'}; {'id': '28', 'type': 'except_clause', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'exceptions'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'NotExistent'}; {'id': '32', 'type': 'block', 'children': ['33', '47']}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'report'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'string', 'children': [], 'value': "'aborting: CifSelectCalculation<{}> did not return the required cif output'"}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'node'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'uuid'}; {'id': '47', 'type': 'return_statement', 'children': ['48']}; {'id': '48', 'type': 'attribute', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'exit_codes'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'ERROR_CIF_SELECT_FAILED'}
|
Inspect the result of the CifSelectCalculation, verifying that it produced a CifData output node.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'from_chords'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'chords'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'duration'}; {'id': '8', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '9', 'type': 'block', 'children': ['10', '18', '117', '142']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'tun'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'get_tuning'}; {'id': '17', 'type': 'argument_list', 'children': []}; {'id': '18', 'type': 'function_definition', 'children': ['19', '20', '23']}; {'id': '19', 'type': 'function_name', 'children': [], 'value': 'add_chord'}; {'id': '20', 'type': 'parameters', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'chord'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'duration'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'if_statement', 'children': ['25', '31', '44']}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '30'], 'value': '=='}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'chord'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'for_statement', 'children': ['33', '34', '35']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'chord'}; {'id': '35', 'type': 'block', 'children': ['36']}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'call', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'add_chord'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '41', 'type': 'binary_operator', 'children': ['42', '43'], 'value': '*'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'duration'}; {'id': '43', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '44', 'type': 'else_clause', 'children': ['45']}; {'id': '45', 'type': 'block', 'children': ['46', '57', '72']}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'chord'}; {'id': '49', 'type': 'call', 'children': ['50', '55']}; {'id': '50', 'type': 'attribute', 'children': ['51', '54']}; {'id': '51', 'type': 'call', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'NoteContainer'}; {'id': '53', 'type': 'argument_list', 'children': []}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'from_chord'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'chord'}; {'id': '57', 'type': 'if_statement', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'tun'}; {'id': '59', 'type': 'block', 'children': ['60']}; {'id': '60', 'type': 'expression_statement', 'children': ['61']}; {'id': '61', 'type': 'assignment', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'chord'}; {'id': '63', 'type': 'call', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'tun'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'find_chord_fingering'}; {'id': '67', 'type': 'argument_list', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'chord'}; {'id': '69', 'type': 'keyword_argument', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'return_best_as_NoteContainer'}; {'id': '71', 'type': 'True', 'children': []}; {'id': '72', 'type': 'if_statement', 'children': ['73', '81']}; {'id': '73', 'type': 'not_operator', 'children': ['74']}; {'id': '74', 'type': 'call', 'children': ['75', '78']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'add_notes'}; {'id': '78', 'type': 'argument_list', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'chord'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'duration'}; {'id': '81', 'type': 'block', 'children': ['82', '95', '103']}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'assignment', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'dur'}; {'id': '85', 'type': 'call', 'children': ['86', '94']}; {'id': '86', 'type': 'attribute', 'children': ['87', '93']}; {'id': '87', 'type': 'subscript', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'bars'}; {'id': '91', 'type': 'unary_operator', 'children': ['92'], 'value': '-'}; {'id': '92', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'value_left'}; {'id': '94', 'type': 'argument_list', 'children': []}; {'id': '95', 'type': 'expression_statement', 'children': ['96']}; {'id': '96', 'type': 'call', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'add_notes'}; {'id': '100', 'type': 'argument_list', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'chord'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'dur'}; {'id': '103', 'type': 'expression_statement', 'children': ['104']}; {'id': '104', 'type': 'call', 'children': ['105', '108']}; {'id': '105', 'type': 'attribute', 'children': ['106', '107']}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'add_notes'}; {'id': '108', 'type': 'argument_list', 'children': ['109', '110']}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'chord'}; {'id': '110', 'type': 'call', 'children': ['111', '114']}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'subtract'}; {'id': '114', 'type': 'argument_list', 'children': ['115', '116']}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'duration'}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'dur'}; {'id': '117', 'type': 'for_statement', 'children': ['118', '119', '120']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'chords'}; {'id': '120', 'type': 'block', 'children': ['121']}; {'id': '121', 'type': 'if_statement', 'children': ['122', '125', '132']}; {'id': '122', 'type': 'comparison_operator', 'children': ['123', '124'], 'value': 'is not'}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '124', 'type': 'None', 'children': []}; {'id': '125', 'type': 'block', 'children': ['126']}; {'id': '126', 'type': 'expression_statement', 'children': ['127']}; {'id': '127', 'type': 'call', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'add_chord'}; {'id': '129', 'type': 'argument_list', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'duration'}; {'id': '132', 'type': 'else_clause', 'children': ['133']}; {'id': '133', 'type': 'block', 'children': ['134']}; {'id': '134', 'type': 'expression_statement', 'children': ['135']}; {'id': '135', 'type': 'call', 'children': ['136', '139']}; {'id': '136', 'type': 'attribute', 'children': ['137', '138']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'add_notes'}; {'id': '139', 'type': 'argument_list', 'children': ['140', '141']}; {'id': '140', 'type': 'None', 'children': []}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'duration'}; {'id': '142', 'type': 'return_statement', 'children': ['143']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'self'}
|
Add chords to the Track.
The given chords should be a list of shorthand strings or list of
list of shorthand strings, etc.
Each sublist divides the value by 2.
If a tuning is set, chords will be expanded so they have a proper
fingering.
Example:
>>> t = Track().from_chords(['C', ['Am', 'Dm'], 'G7', 'C#'], 1)
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'extract_coverage'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'typed_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'container'}; {'id': '7', 'type': 'type', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'Container'}; {'id': '9', 'type': 'type', 'children': ['10']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'FileLineSet'}; {'id': '11', 'type': 'block', 'children': ['12', '18', '34', '52']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'uid'}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'container'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'uid'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '21', 'type': 'call', 'children': ['22', '27']}; {'id': '22', 'type': 'attribute', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': '__api'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'post'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'string', 'children': [], 'value': "'containers/{}/read-coverage'"}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'uid'}; {'id': '34', 'type': 'if_statement', 'children': ['35', '40']}; {'id': '35', 'type': 'comparison_operator', 'children': ['36', '39'], 'value': '=='}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '39', 'type': 'integer', 'children': [], 'value': '200'}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'FileLineSet'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'from_dict'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '51', 'type': 'argument_list', 'children': []}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'call', 'children': ['54', '59']}; {'id': '54', 'type': 'attribute', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': '__api'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'handle_erroneous_response'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'r'}
|
Extracts a report of the lines that have been executed since the last
time that a coverage report was extracted.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'size_r_img_inches'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'height'}; {'id': '6', 'type': 'block', 'children': ['7', '16']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'aspect_ratio'}; {'id': '10', 'type': 'binary_operator', 'children': ['11', '12'], 'value': '/'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'height'}; {'id': '12', 'type': '()', 'children': ['13']}; {'id': '13', 'type': 'binary_operator', 'children': ['14', '15'], 'value': '*'}; {'id': '14', 'type': 'float', 'children': [], 'value': '1.0'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '16', 'type': 'return_statement', 'children': ['17']}; {'id': '17', 'type': 'expression_list', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'R_IMAGE_SIZE'}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'round'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '25']}; {'id': '22', 'type': 'binary_operator', 'children': ['23', '24'], 'value': '*'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'aspect_ratio'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'R_IMAGE_SIZE'}; {'id': '25', 'type': 'integer', 'children': [], 'value': '2'}
|
Compute the width and height for an R image for display in IPython
Neight width nor height can be null but should be integer pixel values > 0.
Returns a tuple of (width, height) that should be used by ggsave in R to
produce an appropriately sized jpeg/png/pdf image with the right aspect
ratio. The returned values are in inches.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'package_releases'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'project_name'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'try_statement', 'children': ['8', '18']}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'return_statement', 'children': ['10']}; {'id': '10', 'type': 'call', 'children': ['11', '16']}; {'id': '11', 'type': 'attribute', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': '_connection'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'package_releases'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'project_name'}; {'id': '18', 'type': 'except_clause', 'children': ['19', '23']}; {'id': '19', 'type': 'as_pattern', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'Exception'}; {'id': '21', 'type': 'as_pattern_target', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'err'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'raise_statement', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'PyPIClientError'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'err'}
|
Retrieve the versions from PyPI by ``project_name``.
Args:
project_name (str): The name of the project we wish to retrieve
the versions of.
Returns:
list: Of string versions.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_remote_port_id_local'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'tlv_data'}; {'id': '6', 'type': 'block', 'children': ['7', '20', '26', '37']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '12']}; {'id': '9', 'type': 'pattern_list', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'parsed_val'}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_check_common_tlv_format'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '18', '19']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'tlv_data'}; {'id': '18', 'type': 'string', 'children': [], 'value': '"Local:"'}; {'id': '19', 'type': 'string', 'children': [], 'value': '"Port ID TLV"'}; {'id': '20', 'type': 'if_statement', 'children': ['21', '23']}; {'id': '21', 'type': 'not_operator', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'return_statement', 'children': ['25']}; {'id': '25', 'type': 'None', 'children': []}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'local'}; {'id': '29', 'type': 'call', 'children': ['30', '35']}; {'id': '30', 'type': 'attribute', 'children': ['31', '34']}; {'id': '31', 'type': 'subscript', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'parsed_val'}; {'id': '33', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'string', 'children': [], 'value': "'\\n'"}; {'id': '37', 'type': 'return_statement', 'children': ['38']}; {'id': '38', 'type': 'call', 'children': ['39', '44']}; {'id': '39', 'type': 'attribute', 'children': ['40', '43']}; {'id': '40', 'type': 'subscript', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'local'}; {'id': '42', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '44', 'type': 'argument_list', 'children': []}
|
Returns Remote Port ID Local from the TLV.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_generate_badges'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '14', '26', '34', '42', '48', '60', '68', '76', '82', '94']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'daycount'}; {'id': '9', 'type': 'attribute', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': '_stats'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'downloads_per_day'}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'day'}; {'id': '17', 'type': 'call', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_generate_badge'}; {'id': '21', 'type': 'argument_list', 'children': ['22', '23']}; {'id': '22', 'type': 'string', 'children': [], 'value': "'Downloads'"}; {'id': '23', 'type': 'binary_operator', 'children': ['24', '25'], 'value': '%'}; {'id': '24', 'type': 'string', 'children': [], 'value': "'%d/day'"}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'daycount'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '33']}; {'id': '28', 'type': 'subscript', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': '_badges'}; {'id': '32', 'type': 'string', 'children': [], 'value': "'per-day'"}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'day'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'weekcount'}; {'id': '37', 'type': 'attribute', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': '_stats'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'downloads_per_week'}; {'id': '42', 'type': 'if_statement', 'children': ['43', '46']}; {'id': '43', 'type': 'comparison_operator', 'children': ['44', '45'], 'value': 'is'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'weekcount'}; {'id': '45', 'type': 'None', 'children': []}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'return_statement', 'children': []}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'week'}; {'id': '51', 'type': 'call', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': '_generate_badge'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '57']}; {'id': '56', 'type': 'string', 'children': [], 'value': "'Downloads'"}; {'id': '57', 'type': 'binary_operator', 'children': ['58', '59'], 'value': '%'}; {'id': '58', 'type': 'string', 'children': [], 'value': "'%d/week'"}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'weekcount'}; {'id': '60', 'type': 'expression_statement', 'children': ['61']}; {'id': '61', 'type': 'assignment', 'children': ['62', '67']}; {'id': '62', 'type': 'subscript', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': '_badges'}; {'id': '66', 'type': 'string', 'children': [], 'value': "'per-week'"}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'week'}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'monthcount'}; {'id': '71', 'type': 'attribute', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': '_stats'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'downloads_per_month'}; {'id': '76', 'type': 'if_statement', 'children': ['77', '80']}; {'id': '77', 'type': 'comparison_operator', 'children': ['78', '79'], 'value': 'is'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'monthcount'}; {'id': '79', 'type': 'None', 'children': []}; {'id': '80', 'type': 'block', 'children': ['81']}; {'id': '81', 'type': 'return_statement', 'children': []}; {'id': '82', 'type': 'expression_statement', 'children': ['83']}; {'id': '83', 'type': 'assignment', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'month'}; {'id': '85', 'type': 'call', 'children': ['86', '89']}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': '_generate_badge'}; {'id': '89', 'type': 'argument_list', 'children': ['90', '91']}; {'id': '90', 'type': 'string', 'children': [], 'value': "'Downloads'"}; {'id': '91', 'type': 'binary_operator', 'children': ['92', '93'], 'value': '%'}; {'id': '92', 'type': 'string', 'children': [], 'value': "'%d/month'"}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'monthcount'}; {'id': '94', 'type': 'expression_statement', 'children': ['95']}; {'id': '95', 'type': 'assignment', 'children': ['96', '101']}; {'id': '96', 'type': 'subscript', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': '_badges'}; {'id': '100', 'type': 'string', 'children': [], 'value': "'per-month'"}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'month'}
|
Generate download badges. Append them to ``self._badges``.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_init_add_goid_alt'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '12', '16', '22', '28', '34', '91', '107']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'goid_alts'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '11', 'type': 'argument_list', 'children': []}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'go2cnt_add'}; {'id': '15', 'type': 'dictionary', 'children': []}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'aspect_counts'}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'aspect_counts'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'gocnts'}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'gocnts'}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'go2obj'}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'go2obj'}; {'id': '34', 'type': 'for_statement', 'children': ['35', '38', '43']}; {'id': '35', 'type': 'pattern_list', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'go_id'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'cnt'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'gocnts'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '42', 'type': 'argument_list', 'children': []}; {'id': '43', 'type': 'block', 'children': ['44', '50', '62', '77', '83']}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'goobj'}; {'id': '47', 'type': 'subscript', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'go2obj'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'go_id'}; {'id': '50', 'type': 'assert_statement', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'cnt'}; {'id': '52', 'type': 'call', 'children': ['53', '56']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'string', 'children': [], 'value': '"NO TERM COUNTS FOR {GO}"'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'GO'}; {'id': '59', 'type': 'attribute', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'goobj'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'item_id'}; {'id': '62', 'type': 'if_statement', 'children': ['63', '68']}; {'id': '63', 'type': 'comparison_operator', 'children': ['64', '65'], 'value': '!='}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'go_id'}; {'id': '65', 'type': 'attribute', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'goobj'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'item_id'}; {'id': '68', 'type': 'block', 'children': ['69']}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'assignment', 'children': ['71', '76']}; {'id': '71', 'type': 'subscript', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'go2cnt_add'}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'goobj'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'item_id'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'cnt'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'augmented_assignment', 'children': ['79', '80'], 'value': '|='}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'goid_alts'}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'goobj'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'alt_ids'}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'augmented_assignment', 'children': ['85', '90'], 'value': '+='}; {'id': '85', 'type': 'subscript', 'children': ['86', '87']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'aspect_counts'}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'goobj'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'namespace'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'cnt'}; {'id': '91', 'type': 'for_statement', 'children': ['92', '95', '100']}; {'id': '92', 'type': 'pattern_list', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'goid'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'cnt'}; {'id': '95', 'type': 'call', 'children': ['96', '99']}; {'id': '96', 'type': 'attribute', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'go2cnt_add'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '99', 'type': 'argument_list', 'children': []}; {'id': '100', 'type': 'block', 'children': ['101']}; {'id': '101', 'type': 'expression_statement', 'children': ['102']}; {'id': '102', 'type': 'assignment', 'children': ['103', '106']}; {'id': '103', 'type': 'subscript', 'children': ['104', '105']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'gocnts'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'goid'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'cnt'}; {'id': '107', 'type': 'for_statement', 'children': ['108', '109', '115']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'alt_goid'}; {'id': '109', 'type': 'call', 'children': ['110', '113']}; {'id': '110', 'type': 'attribute', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'goid_alts'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'difference'}; {'id': '113', 'type': 'argument_list', 'children': ['114']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'gocnts'}; {'id': '115', 'type': 'block', 'children': ['116', '122', '130', '150']}; {'id': '116', 'type': 'expression_statement', 'children': ['117']}; {'id': '117', 'type': 'assignment', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'goobj'}; {'id': '119', 'type': 'subscript', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'go2obj'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'alt_goid'}; {'id': '122', 'type': 'expression_statement', 'children': ['123']}; {'id': '123', 'type': 'assignment', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'cnt'}; {'id': '125', 'type': 'subscript', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'gocnts'}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'goobj'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'item_id'}; {'id': '130', 'type': 'assert_statement', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'cnt'}; {'id': '132', 'type': 'call', 'children': ['133', '136']}; {'id': '133', 'type': 'attribute', 'children': ['134', '135']}; {'id': '134', 'type': 'string', 'children': [], 'value': '"NO TERM COUNTS FOR ALT_ID({GOa}) ID({GO}): {NAME}"'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '136', 'type': 'argument_list', 'children': ['137', '140', '145']}; {'id': '137', 'type': 'keyword_argument', 'children': ['138', '139']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'GOa'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'alt_goid'}; {'id': '140', 'type': 'keyword_argument', 'children': ['141', '142']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'GO'}; {'id': '142', 'type': 'attribute', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'goobj'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'item_id'}; {'id': '145', 'type': 'keyword_argument', 'children': ['146', '147']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'NAME'}; {'id': '147', 'type': 'attribute', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'goobj'}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '150', 'type': 'expression_statement', 'children': ['151']}; {'id': '151', 'type': 'assignment', 'children': ['152', '155']}; {'id': '152', 'type': 'subscript', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'gocnts'}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'alt_goid'}; {'id': '155', 'type': 'identifier', 'children': [], 'value': 'cnt'}
|
Add alternate GO IDs to term counts.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'on_resolve'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '6', 'type': 'list_splat_pattern', 'children': ['7']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '8', 'type': 'dictionary_splat_pattern', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'return_statement', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_register_hook'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16', '17', '18', '20']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'ON_RESOLVE'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'target'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'func'}; {'id': '18', 'type': 'list_splat', 'children': ['19']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '20', 'type': 'dictionary_splat', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
|
Register a resolution hook.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'toggleDrawingSensitive'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'drawing'}; {'id': '7', 'type': 'True', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '21']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'call', 'children': ['11', '18']}; {'id': '11', 'type': 'attribute', 'children': ['12', '17']}; {'id': '12', 'type': 'attribute', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'actions'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'editMode'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'setEnabled'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'not_operator', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'drawing'}; {'id': '21', 'type': 'if_statement', 'children': ['22', '30']}; {'id': '22', 'type': 'boolean_operator', 'children': ['23', '25'], 'value': 'and'}; {'id': '23', 'type': 'not_operator', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'drawing'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'beginner'}; {'id': '29', 'type': 'argument_list', 'children': []}; {'id': '30', 'type': 'block', 'children': ['31', '36', '45', '53']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'string', 'children': [], 'value': "'Cancel creation.'"}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'call', 'children': ['38', '43']}; {'id': '38', 'type': 'attribute', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'canvas'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'setEditing'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'True', 'children': []}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '52']}; {'id': '47', 'type': 'attribute', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'canvas'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'restoreCursor'}; {'id': '52', 'type': 'argument_list', 'children': []}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'call', 'children': ['55', '62']}; {'id': '55', 'type': 'attribute', 'children': ['56', '61']}; {'id': '56', 'type': 'attribute', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'actions'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'create'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'setEnabled'}; {'id': '62', 'type': 'argument_list', 'children': ['63']}; {'id': '63', 'type': 'True', 'children': []}
|
In the middle of drawing, toggling between modes should be disabled.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'angle2vecs'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'vec1'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'vec2'}; {'id': '6', 'type': 'block', 'children': ['7', '17', '36', '55', '78']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'dot'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'dot'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'vec1'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'vec2'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'vec1_modulus'}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'sqrt'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '35']}; {'id': '26', 'type': 'attribute', 'children': ['27', '34']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'multiply'}; {'id': '31', 'type': 'argument_list', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'vec1'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'vec1'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '35', 'type': 'argument_list', 'children': []}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'vec2_modulus'}; {'id': '39', 'type': 'call', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'sqrt'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'call', 'children': ['45', '54']}; {'id': '45', 'type': 'attribute', 'children': ['46', '53']}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'np'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'multiply'}; {'id': '50', 'type': 'argument_list', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'vec2'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'vec2'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '54', 'type': 'argument_list', 'children': []}; {'id': '55', 'type': 'if_statement', 'children': ['56', '62', '67']}; {'id': '56', 'type': 'comparison_operator', 'children': ['57', '61'], 'value': '=='}; {'id': '57', 'type': '()', 'children': ['58']}; {'id': '58', 'type': 'binary_operator', 'children': ['59', '60'], 'value': '*'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'vec1_modulus'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'vec2_modulus'}; {'id': '61', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '62', 'type': 'block', 'children': ['63']}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'assignment', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'cos_angle'}; {'id': '66', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '67', 'type': 'else_clause', 'children': ['68']}; {'id': '68', 'type': 'block', 'children': ['69']}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'assignment', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'cos_angle'}; {'id': '72', 'type': 'binary_operator', 'children': ['73', '74'], 'value': '/'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'dot'}; {'id': '74', 'type': '()', 'children': ['75']}; {'id': '75', 'type': 'binary_operator', 'children': ['76', '77'], 'value': '*'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'vec1_modulus'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'vec2_modulus'}; {'id': '78', 'type': 'return_statement', 'children': ['79']}; {'id': '79', 'type': 'call', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'math'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'degrees'}; {'id': '83', 'type': 'argument_list', 'children': ['84']}; {'id': '84', 'type': 'call', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'acos'}; {'id': '86', 'type': 'argument_list', 'children': ['87']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'cos_angle'}
|
angle between two vectors
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_update_prx'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '18', '46', '56', '64']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'qx'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'scipy'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'ones'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'N_CODON'}; {'id': '15', 'type': 'keyword_argument', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '17', 'type': 'string', 'children': [], 'value': "'float'"}; {'id': '18', 'type': 'for_statement', 'children': ['19', '20', '24']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '24', 'type': 'block', 'children': ['25']}; {'id': '25', 'type': 'for_statement', 'children': ['26', '27', '31']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'w'}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'N_NT'}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'augmented_assignment', 'children': ['34', '41'], 'value': '*='}; {'id': '34', 'type': 'subscript', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'qx'}; {'id': '36', 'type': 'subscript', 'children': ['37', '40']}; {'id': '37', 'type': 'subscript', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'CODON_NT'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'j'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'w'}; {'id': '41', 'type': 'subscript', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'phi'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'w'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'frx'}; {'id': '49', 'type': 'binary_operator', 'children': ['50', '53'], 'value': '**'}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'pi_codon'}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'beta'}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'prx'}; {'id': '61', 'type': 'binary_operator', 'children': ['62', '63'], 'value': '*'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'frx'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'qx'}; {'id': '64', 'type': 'with_statement', 'children': ['65', '84']}; {'id': '65', 'type': 'with_clause', 'children': ['66']}; {'id': '66', 'type': 'with_item', 'children': ['67']}; {'id': '67', 'type': 'call', 'children': ['68', '71']}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'scipy'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'errstate'}; {'id': '71', 'type': 'argument_list', 'children': ['72', '75', '78', '81']}; {'id': '72', 'type': 'keyword_argument', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'divide'}; {'id': '74', 'type': 'string', 'children': [], 'value': "'raise'"}; {'id': '75', 'type': 'keyword_argument', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'under'}; {'id': '77', 'type': 'string', 'children': [], 'value': "'raise'"}; {'id': '78', 'type': 'keyword_argument', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'over'}; {'id': '80', 'type': 'string', 'children': [], 'value': "'raise'"}; {'id': '81', 'type': 'keyword_argument', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'invalid'}; {'id': '83', 'type': 'string', 'children': [], 'value': "'raise'"}; {'id': '84', 'type': 'block', 'children': ['85']}; {'id': '85', 'type': 'for_statement', 'children': ['86', '87', '93']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '87', 'type': 'call', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '89', 'type': 'argument_list', 'children': ['90']}; {'id': '90', 'type': 'attribute', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'nsites'}; {'id': '93', 'type': 'block', 'children': ['94']}; {'id': '94', 'type': 'expression_statement', 'children': ['95']}; {'id': '95', 'type': 'augmented_assignment', 'children': ['96', '101'], 'value': '/='}; {'id': '96', 'type': 'subscript', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'prx'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '101', 'type': 'call', 'children': ['102', '109']}; {'id': '102', 'type': 'attribute', 'children': ['103', '108']}; {'id': '103', 'type': 'subscript', 'children': ['104', '107']}; {'id': '104', 'type': 'attribute', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'prx'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '109', 'type': 'argument_list', 'children': []}
|
Update `prx` from `phi`, `pi_codon`, and `beta`.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fmt_transition'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'return_statement', 'children': ['7']}; {'id': '7', 'type': 'call', 'children': ['8', '11']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'string', 'children': [], 'value': '"Transition({} {} {})"'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '11', 'type': 'argument_list', 'children': ['12', '21', '22']}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'fmt_mechanism'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'cause_indices'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'node_labels'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'ARROW_RIGHT'}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'fmt_mechanism'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'effect_indices'}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 't'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'node_labels'}
|
Format a |Transition|.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'delete'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '30']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '9', 'type': 'call', 'children': ['10', '15']}; {'id': '10', 'type': 'attribute', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_client'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': '_request'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17']}; {'id': '16', 'type': 'string', 'children': [], 'value': "'DELETE'"}; {'id': '17', 'type': 'call', 'children': ['18', '23']}; {'id': '18', 'type': 'attribute', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '_client'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': '_build_url'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25']}; {'id': '24', 'type': 'string', 'children': [], 'value': "'service'"}; {'id': '25', 'type': 'keyword_argument', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'service_id'}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '30', 'type': 'if_statement', 'children': ['31', '40']}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '35'], 'value': '!='}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'status_code'}; {'id': '35', 'type': 'attribute', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'codes'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'no_content'}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'raise_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'APIError'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'string', 'children': [], 'value': '"Could not delete service: {} with id {}"'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '49', 'type': 'argument_list', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'id'}
|
Delete this service.
:raises APIError: if delete was not succesfull.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'dictionary_splat_pattern', 'children': ['6']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '7', 'type': 'block', 'children': ['8', '17', '41']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'dumps'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'put'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '31', '38']}; {'id': '25', 'type': 'binary_operator', 'children': ['26', '27'], 'value': '%'}; {'id': '26', 'type': 'string', 'children': [], 'value': '"https://kippt.com/api/clips/%s"'}; {'id': '27', 'type': '()', 'children': ['28']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'id'}; {'id': '31', 'type': 'keyword_argument', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '33', 'type': 'attribute', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'kippt'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'header'}; {'id': '38', 'type': 'keyword_argument', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '41', 'type': 'return_statement', 'children': ['42']}; {'id': '42', 'type': '()', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '47', 'type': 'argument_list', 'children': []}
|
Updates a Clip.
Parameters:
- args Dictionary of other fields
Accepted fields can be found here:
https://github.com/kippt/api-documentation/blob/master/objects/clip.md
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_collapse_header'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'header'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '50']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '10', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '11', 'type': 'for_statement', 'children': ['12', '15', '19']}; {'id': '12', 'type': 'pattern_list', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'enumerate'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'header'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'if_statement', 'children': ['21', '29', '40']}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'h'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': '_col_quals'}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'call', 'children': ['32', '38']}; {'id': '32', 'type': 'attribute', 'children': ['33', '37']}; {'id': '33', 'type': 'subscript', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '35', 'type': 'unary_operator', 'children': ['36'], 'value': '-'}; {'id': '36', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '40', 'type': 'else_clause', 'children': ['41']}; {'id': '41', 'type': 'block', 'children': ['42']}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'out'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'list', 'children': ['49'], 'value': '[i]'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '50', 'type': 'return_statement', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'out'}
|
Combine header columns into related groups.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '6', 'type': 'block', 'children': ['7', '38', '57', '85']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '11']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '11', 'type': 'block', 'children': ['12']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '24', '25']}; {'id': '14', 'type': 'pattern_list', 'children': ['15', '18', '21']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'vertices_substitution_dict'}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'edges_substitution_dict'}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'match_info'}; {'id': '24', 'type': 'line_continuation', 'children': [], 'value': '\\'}; {'id': '25', 'type': 'call', 'children': ['26', '31']}; {'id': '26', 'type': 'attribute', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'get_variables_substitution_dictionaries'}; {'id': '31', 'type': 'argument_list', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'g'}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'matching_graph'}; {'id': '38', 'type': 'try_statement', 'children': ['39', '54']}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'matching_graph'}; {'id': '45', 'type': 'call', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': '__apply_code_to_graph'}; {'id': '49', 'type': 'argument_list', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'matching_graph'}; {'id': '54', 'type': 'except_clause', 'children': ['55']}; {'id': '55', 'type': 'block', 'children': ['56']}; {'id': '56', 'type': 'pass_statement', 'children': []}; {'id': '57', 'type': 'try_statement', 'children': ['58', '82']}; {'id': '58', 'type': 'block', 'children': ['59', '68']}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'assignment', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '62', 'type': 'call', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': '__substitute_names_in_code'}; {'id': '66', 'type': 'argument_list', 'children': ['67']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'g'}; {'id': '73', 'type': 'call', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': '__apply_code_to_graph'}; {'id': '77', 'type': 'argument_list', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '79', 'type': 'attribute', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'g'}; {'id': '82', 'type': 'except_clause', 'children': ['83']}; {'id': '83', 'type': 'block', 'children': ['84']}; {'id': '84', 'type': 'pass_statement', 'children': []}; {'id': '85', 'type': 'return_statement', 'children': ['86']}; {'id': '86', 'type': 'True', 'children': []}
|
Executes the code and apply it to the self.g
:param code: the LISP code to execute
:return: True/False, depending on the result of the LISP code
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'delete_session'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'ticket'}; {'id': '6', 'type': 'block', 'children': ['7', '15', '27']}; {'id': '7', 'type': 'assert_statement', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'session_storage_adapter'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'CASSessionAdapter'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'logging'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'string', 'children': [], 'value': "'[CAS] Deleting session for ticket {}'"}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'ticket'}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '34']}; {'id': '29', 'type': 'attribute', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'session_storage_adapter'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'delete'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'ticket'}
|
Delete a session record associated with a service ticket.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'display_arr'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'screen'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'arr'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'video_size'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'transpose'}; {'id': '8', 'type': 'block', 'children': ['9', '35', '47']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '11', '29']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'transpose'}; {'id': '11', 'type': 'block', 'children': ['12']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'pyg_img'}; {'id': '15', 'type': 'call', 'children': ['16', '21']}; {'id': '16', 'type': 'attribute', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'pygame'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'surfarray'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'make_surface'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'arr'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'swapaxes'}; {'id': '26', 'type': 'argument_list', 'children': ['27', '28']}; {'id': '27', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '28', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '29', 'type': 'else_clause', 'children': ['30']}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'pyg_img'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'arr'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'pyg_img'}; {'id': '38', 'type': 'call', 'children': ['39', '44']}; {'id': '39', 'type': 'attribute', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'pygame'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'transform'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'scale'}; {'id': '44', 'type': 'argument_list', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'pyg_img'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'video_size'}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'call', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'screen'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'blit'}; {'id': '52', 'type': 'argument_list', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'pyg_img'}; {'id': '54', 'type': 'tuple', 'children': ['55', '56']}; {'id': '55', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '56', 'type': 'integer', 'children': [], 'value': '0'}
|
Display an image to the pygame screen.
Args:
screen (pygame.Surface): the pygame surface to write frames to
arr (np.ndarray): numpy array representing a single frame of gameplay
video_size (tuple): the size to render the frame as
transpose (bool): whether to transpose the frame before displaying
Returns:
None
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_caveat_v1_to_dict'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '28', '51', '64']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'serialized'}; {'id': '9', 'type': 'dictionary', 'children': []}; {'id': '10', 'type': 'if_statement', 'children': ['11', '19']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '18'], 'value': '>'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'caveat_id'}; {'id': '18', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '25']}; {'id': '22', 'type': 'subscript', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'serialized'}; {'id': '24', 'type': 'string', 'children': [], 'value': "'cid'"}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'caveat_id'}; {'id': '28', 'type': 'if_statement', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'verification_key_id'}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '38']}; {'id': '35', 'type': 'subscript', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'serialized'}; {'id': '37', 'type': 'string', 'children': [], 'value': "'vid'"}; {'id': '38', 'type': 'call', 'children': ['39', '49']}; {'id': '39', 'type': 'attribute', 'children': ['40', '48']}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'raw_urlsafe_b64encode'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'verification_key_id'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'decode'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'string', 'children': [], 'value': "'utf-8'"}; {'id': '51', 'type': 'if_statement', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'location'}; {'id': '55', 'type': 'block', 'children': ['56']}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '61']}; {'id': '58', 'type': 'subscript', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'serialized'}; {'id': '60', 'type': 'string', 'children': [], 'value': "'cl'"}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'location'}; {'id': '64', 'type': 'return_statement', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'serialized'}
|
Return a caveat as a dictionary for export as the JSON
macaroon v1 format.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_sumDiceRolls'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'rollList'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '13', '29']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '10', 'type': 'argument_list', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'rollList'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'RollList'}; {'id': '13', 'type': 'block', 'children': ['14', '23']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'call', 'children': ['16', '21']}; {'id': '16', 'type': 'attribute', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'rolls'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '21', 'type': 'argument_list', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'rollList'}; {'id': '23', 'type': 'return_statement', 'children': ['24']}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'rollList'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '28', 'type': 'argument_list', 'children': []}; {'id': '29', 'type': 'else_clause', 'children': ['30']}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'return_statement', 'children': ['32']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'rollList'}
|
convert from dice roll structure to a single integer result
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_peek'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'list_splat_pattern', 'children': ['6']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'types'}; {'id': '7', 'type': 'block', 'children': ['8', '22']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'tok'}; {'id': '11', 'type': 'call', 'children': ['12', '17']}; {'id': '12', 'type': 'attribute', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_scanner'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'token'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': '_pos'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'types'}; {'id': '22', 'type': 'return_statement', 'children': ['23']}; {'id': '23', 'type': 'subscript', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'tok'}; {'id': '25', 'type': 'integer', 'children': [], 'value': '2'}
|
Returns the token type for lookahead; if there are any args
then the list of args is the set of token types to allow
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'remove_from_tor'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'protocol'}; {'id': '6', 'type': 'block', 'children': ['7', '26']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '10', 'type': 'yield', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'protocol'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'queue_command'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'binary_operator', 'children': ['17', '18'], 'value': '%'}; {'id': '17', 'type': 'string', 'children': [], 'value': "'DEL_ONION %s'"}; {'id': '18', 'type': 'subscript', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'hostname'}; {'id': '22', 'type': 'slice', 'children': ['23', '24']}; {'id': '23', 'type': 'colon', 'children': []}; {'id': '24', 'type': 'unary_operator', 'children': ['25'], 'value': '-'}; {'id': '25', 'type': 'integer', 'children': [], 'value': '6'}; {'id': '26', 'type': 'if_statement', 'children': ['27', '34']}; {'id': '27', 'type': 'comparison_operator', 'children': ['28', '33'], 'value': '!='}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'strip'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'string', 'children': [], 'value': "'OK'"}; {'id': '34', 'type': 'block', 'children': ['35']}; {'id': '35', 'type': 'raise_statement', 'children': ['36']}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'RuntimeError'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'binary_operator', 'children': ['40', '41'], 'value': '%'}; {'id': '40', 'type': 'string', 'children': [], 'value': '\'Failed to remove hidden service: "%s".\''}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'r'}
|
Returns a Deferred which fires with None
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'remove_autosave_file'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'fileinfo'}; {'id': '6', 'type': 'block', 'children': ['7', '13', '21', '29', '71', '77', '91']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'fileinfo'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '13', 'type': 'if_statement', 'children': ['14', '19']}; {'id': '14', 'type': 'comparison_operator', 'children': ['15', '16'], 'value': 'not in'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'name_mapping'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'return_statement', 'children': []}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'autosave_filename'}; {'id': '24', 'type': 'subscript', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'name_mapping'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '29', 'type': 'try_statement', 'children': ['30', '38']}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'remove'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'autosave_filename'}; {'id': '38', 'type': 'except_clause', 'children': ['39', '43']}; {'id': '39', 'type': 'as_pattern', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'EnvironmentError'}; {'id': '41', 'type': 'as_pattern_target', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '43', 'type': 'block', 'children': ['44', '57', '65']}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '47', 'type': '()', 'children': ['48']}; {'id': '48', 'type': 'call', 'children': ['49', '55']}; {'id': '49', 'type': 'attribute', 'children': ['50', '54']}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'string', 'children': [], 'value': "'Error while removing autosave file {}'"}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'autosave_filename'}; {'id': '57', 'type': 'expression_statement', 'children': ['58']}; {'id': '58', 'type': 'assignment', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'msgbox'}; {'id': '60', 'type': 'call', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'AutosaveErrorDialog'}; {'id': '62', 'type': 'argument_list', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'action'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'error'}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'call', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'msgbox'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'exec_if_enabled'}; {'id': '70', 'type': 'argument_list', 'children': []}; {'id': '71', 'type': 'delete_statement', 'children': ['72']}; {'id': '72', 'type': 'subscript', 'children': ['73', '76']}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'name_mapping'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'call', 'children': ['79', '86']}; {'id': '79', 'type': 'attribute', 'children': ['80', '85']}; {'id': '80', 'type': 'attribute', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'stack'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'sig_option_changed'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'emit'}; {'id': '86', 'type': 'argument_list', 'children': ['87', '88']}; {'id': '87', 'type': 'string', 'children': [], 'value': "'autosave_mapping'"}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'name_mapping'}; {'id': '91', 'type': 'expression_statement', 'children': ['92']}; {'id': '92', 'type': 'call', 'children': ['93', '96']}; {'id': '93', 'type': 'attribute', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'logger'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '96', 'type': 'argument_list', 'children': ['97', '98']}; {'id': '97', 'type': 'string', 'children': [], 'value': "'Removing autosave file %s'"}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'autosave_filename'}
|
Remove autosave file for specified file.
This function also updates `self.autosave_mapping` and clears the
`changed_since_autosave` flag.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'show_instance'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'call'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '19', '26', '38', '45', '54', '94']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '13']}; {'id': '10', 'type': 'comparison_operator', 'children': ['11', '12'], 'value': '!='}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'call'}; {'id': '12', 'type': 'string', 'children': [], 'value': "'action'"}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'raise_statement', 'children': ['15']}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'SaltCloudException'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'string', 'children': [], 'value': "'The show_instance action must be called with -a or --action.'"}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'node_id'}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'get_linode_id_from_name'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'node_data'}; {'id': '29', 'type': 'call', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'get_linode'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'keyword_argument', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '34', 'type': 'dictionary', 'children': ['35']}; {'id': '35', 'type': 'pair', 'children': ['36', '37']}; {'id': '36', 'type': 'string', 'children': [], 'value': "'linode_id'"}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'node_id'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'ips'}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'get_ips'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'node_id'}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'state'}; {'id': '48', 'type': 'call', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'subscript', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'node_data'}; {'id': '53', 'type': 'string', 'children': [], 'value': "'STATUS'"}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '57', 'type': 'dictionary', 'children': ['58', '63', '68', '73', '78', '84', '89']}; {'id': '58', 'type': 'pair', 'children': ['59', '60']}; {'id': '59', 'type': 'string', 'children': [], 'value': "'id'"}; {'id': '60', 'type': 'subscript', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'node_data'}; {'id': '62', 'type': 'string', 'children': [], 'value': "'LINODEID'"}; {'id': '63', 'type': 'pair', 'children': ['64', '65']}; {'id': '64', 'type': 'string', 'children': [], 'value': "'image'"}; {'id': '65', 'type': 'subscript', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'node_data'}; {'id': '67', 'type': 'string', 'children': [], 'value': "'DISTRIBUTIONVENDOR'"}; {'id': '68', 'type': 'pair', 'children': ['69', '70']}; {'id': '69', 'type': 'string', 'children': [], 'value': "'name'"}; {'id': '70', 'type': 'subscript', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'node_data'}; {'id': '72', 'type': 'string', 'children': [], 'value': "'LABEL'"}; {'id': '73', 'type': 'pair', 'children': ['74', '75']}; {'id': '74', 'type': 'string', 'children': [], 'value': "'size'"}; {'id': '75', 'type': 'subscript', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'node_data'}; {'id': '77', 'type': 'string', 'children': [], 'value': "'TOTALRAM'"}; {'id': '78', 'type': 'pair', 'children': ['79', '80']}; {'id': '79', 'type': 'string', 'children': [], 'value': "'state'"}; {'id': '80', 'type': 'call', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': '_get_status_descr_by_id'}; {'id': '82', 'type': 'argument_list', 'children': ['83']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'state'}; {'id': '84', 'type': 'pair', 'children': ['85', '86']}; {'id': '85', 'type': 'string', 'children': [], 'value': "'private_ips'"}; {'id': '86', 'type': 'subscript', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'ips'}; {'id': '88', 'type': 'string', 'children': [], 'value': "'private_ips'"}; {'id': '89', 'type': 'pair', 'children': ['90', '91']}; {'id': '90', 'type': 'string', 'children': [], 'value': "'public_ips'"}; {'id': '91', 'type': 'subscript', 'children': ['92', '93']}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'ips'}; {'id': '93', 'type': 'string', 'children': [], 'value': "'public_ips'"}; {'id': '94', 'type': 'return_statement', 'children': ['95']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'ret'}
|
Displays details about a particular Linode VM. Either a name or a linode_id must
be provided.
.. versionadded:: 2015.8.0
name
The name of the VM for which to display details.
CLI Example:
.. code-block:: bash
salt-cloud -a show_instance vm_name
.. note::
The ``image`` label only displays information about the VM's distribution vendor,
such as "Debian" or "RHEL" and does not display the actual image name. This is
due to a limitation of the Linode API.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'is_in_current_deployment'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'extra_prefix'}; {'id': '7', 'type': 'string', 'children': [], 'value': '""'}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'return_statement', 'children': ['10']}; {'id': '10', 'type': 'comparison_operator', 'children': ['11', '29'], 'value': 'is not'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 're'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '26']}; {'id': '16', 'type': 'binary_operator', 'children': ['17', '18'], 'value': '%'}; {'id': '17', 'type': 'string', 'children': [], 'value': 'r"^%s"'}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'string', 'children': [], 'value': "'-'"}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'list', 'children': ['24', '25'], 'value': '[DEFAULT_PREFIX, extra_prefix]'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'DEFAULT_PREFIX'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'extra_prefix'}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'server'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '29', 'type': 'None', 'children': []}
|
Check if an existing server in the system take part to
the current deployment
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'object_factory'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'api'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'api_version'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '7', 'type': 'block', 'children': ['8', '17', '37', '46']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'resource_list'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'api'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'resource_list'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'api_version'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'resource'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'next'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '36']}; {'id': '23', 'type': 'generator_expression', 'children': ['24', '25', '30']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'resource'}; {'id': '25', 'type': 'for_in_clause', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'resource'}; {'id': '27', 'type': 'subscript', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'resource_list'}; {'id': '29', 'type': 'string', 'children': [], 'value': '"resources"'}; {'id': '30', 'type': 'if_clause', 'children': ['31']}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '35'], 'value': '=='}; {'id': '32', 'type': 'subscript', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'resource'}; {'id': '34', 'type': 'string', 'children': [], 'value': '"kind"'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '36', 'type': 'None', 'children': []}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '40', 'type': 'conditional_expression', 'children': ['41', '42', '45'], 'value': 'if'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'NamespacedAPIObject'}; {'id': '42', 'type': 'subscript', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'resource'}; {'id': '44', 'type': 'string', 'children': [], 'value': '"namespaced"'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'APIObject'}; {'id': '46', 'type': 'return_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '49', 'type': 'argument_list', 'children': ['50', '51', '53']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'kind'}; {'id': '51', 'type': 'tuple', 'children': ['52']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '53', 'type': 'dictionary', 'children': ['54', '57', '62']}; {'id': '54', 'type': 'pair', 'children': ['55', '56']}; {'id': '55', 'type': 'string', 'children': [], 'value': '"version"'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'api_version'}; {'id': '57', 'type': 'pair', 'children': ['58', '59']}; {'id': '58', 'type': 'string', 'children': [], 'value': '"endpoint"'}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'resource'}; {'id': '61', 'type': 'string', 'children': [], 'value': '"name"'}; {'id': '62', 'type': 'pair', 'children': ['63', '64']}; {'id': '63', 'type': 'string', 'children': [], 'value': '"kind"'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'kind'}
|
Dynamically builds a Python class for the given Kubernetes object in an API.
For example:
api = pykube.HTTPClient(...)
NetworkPolicy = pykube.object_factory(api, "networking.k8s.io/v1", "NetworkPolicy")
This enables construction of any Kubernetes object kind without explicit support
from pykube.
Currently, the HTTPClient passed to this function will not be bound to the returned type.
It is planned to fix this, but in the mean time pass it as you would normally.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'remove_diagonal'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '5', 'type': 'block', 'children': ['6', '18', '41', '48', '58', '68', '78', '88']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '12']}; {'id': '7', 'type': 'not_operator', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'isspmatrix_csr'}; {'id': '10', 'type': 'argument_list', 'children': ['11']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'raise_statement', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'string', 'children': [], 'value': "'expected csr_matrix'"}; {'id': '18', 'type': 'if_statement', 'children': ['19', '30']}; {'id': '19', 'type': 'comparison_operator', 'children': ['20', '25'], 'value': '!='}; {'id': '20', 'type': 'subscript', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '24', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '25', 'type': 'subscript', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '29', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'raise_statement', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'binary_operator', 'children': ['36', '37'], 'value': '%'}; {'id': '36', 'type': 'string', 'children': [], 'value': "'expected square matrix, shape=%s'"}; {'id': '37', 'type': 'tuple', 'children': ['38']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'shape'}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'assignment', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'coo_matrix'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '51', 'type': 'comparison_operator', 'children': ['52', '55'], 'value': '!='}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'col'}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'assignment', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '63', 'type': 'subscript', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'col'}; {'id': '73', 'type': 'subscript', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'col'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'assignment', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '83', 'type': 'subscript', 'children': ['84', '87']}; {'id': '84', 'type': 'attribute', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '88', 'type': 'return_statement', 'children': ['89']}; {'id': '89', 'type': 'call', 'children': ['90', '93']}; {'id': '90', 'type': 'attribute', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'S'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'tocsr'}; {'id': '93', 'type': 'argument_list', 'children': []}
|
Remove the diagonal of the matrix S.
Parameters
----------
S : csr_matrix
Square matrix
Returns
-------
S : csr_matrix
Strength matrix with the diagonal removed
Notes
-----
This is needed by all the splitting routines which operate on matrix graphs
with an assumed zero diagonal
Examples
--------
>>> from pyamg.gallery import poisson
>>> from pyamg.util.utils import remove_diagonal
>>> A = poisson( (4,), format='csr' )
>>> C = remove_diagonal(A)
>>> C.todense()
matrix([[ 0., -1., 0., 0.],
[-1., 0., -1., 0.],
[ 0., -1., 0., -1.],
[ 0., 0., -1., 0.]])
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'size'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '11', '69']}; {'id': '6', 'type': 'import_statement', 'children': ['7']}; {'id': '7', 'type': 'aliased_import', 'children': ['8', '10']}; {'id': '8', 'type': 'dotted_name', 'children': ['9']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'tensorflow'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '11', 'type': 'if_statement', 'children': ['12', '17']}; {'id': '12', 'type': 'comparison_operator', 'children': ['13', '16'], 'value': 'is'}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': '_size'}; {'id': '16', 'type': 'None', 'children': []}; {'id': '17', 'type': 'block', 'children': ['18', '24', '41']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': '_size'}; {'id': '23', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '27', 'type': 'call', 'children': ['28', '33']}; {'id': '28', 'type': 'attribute', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'python_io'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'TFRecordOptions'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'attribute', 'children': ['35', '40']}; {'id': '35', 'type': 'attribute', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'python_io'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'TFRecordCompressionType'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'GZIP'}; {'id': '41', 'type': 'for_statement', 'children': ['42', '43', '46']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'tfexample_file'}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '46', 'type': 'block', 'children': ['47']}; {'id': '47', 'type': 'expression_statement', 'children': ['48']}; {'id': '48', 'type': 'augmented_assignment', 'children': ['49', '52'], 'value': '+='}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': '_size'}; {'id': '52', 'type': 'call', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '54', 'type': 'generator_expression', 'children': ['55', '56']}; {'id': '55', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '56', 'type': 'for_in_clause', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '58', 'type': 'call', 'children': ['59', '64']}; {'id': '59', 'type': 'attribute', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'python_io'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'tf_record_iterator'}; {'id': '64', 'type': 'argument_list', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'tfexample_file'}; {'id': '66', 'type': 'keyword_argument', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '69', 'type': 'return_statement', 'children': ['70']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': '_size'}
|
The number of instances in the data. If the underlying data source changes,
it may be outdated.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'insert'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '7', 'type': 'block', 'children': ['8', '20', '27', '58']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'call', 'children': ['10', '17']}; {'id': '10', 'type': 'attribute', 'children': ['11', '16']}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'super'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'ObservableList'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'insert'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'item'}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'if_statement', 'children': ['28', '31', '38']}; {'id': '28', 'type': 'comparison_operator', 'children': ['29', '30'], 'value': '>='}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '31', 'type': 'block', 'children': ['32']}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '35', 'type': 'binary_operator', 'children': ['36', '37'], 'value': '-'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '37', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '38', 'type': 'elif_clause', 'children': ['39', '42']}; {'id': '39', 'type': 'comparison_operator', 'children': ['40', '41'], 'value': '<'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '41', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '42', 'type': 'block', 'children': ['43', '49']}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'augmented_assignment', 'children': ['45', '46'], 'value': '+='}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '46', 'type': 'binary_operator', 'children': ['47', '48'], 'value': '-'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'length'}; {'id': '48', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '49', 'type': 'if_statement', 'children': ['50', '53']}; {'id': '50', 'type': 'comparison_operator', 'children': ['51', '52'], 'value': '<'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '52', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '57', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'call', 'children': ['60', '63']}; {'id': '60', 'type': 'attribute', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': '_notify_add_at'}; {'id': '63', 'type': 'argument_list', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'index'}
|
See list.insert.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'expectation'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'typed_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'operator'}; {'id': '7', 'type': 'type', 'children': ['8']}; {'id': '8', 'type': 'generic_type', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'Union'}; {'id': '10', 'type': 'type_parameter', 'children': ['11', '13']}; {'id': '11', 'type': 'type', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'PauliTerm'}; {'id': '13', 'type': 'type', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'PauliSum'}; {'id': '15', 'type': 'block', 'children': ['16', '32']}; {'id': '16', 'type': 'if_statement', 'children': ['17', '23']}; {'id': '17', 'type': 'not_operator', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'operator'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'PauliSum'}; {'id': '23', 'type': 'block', 'children': ['24']}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'operator'}; {'id': '27', 'type': 'call', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'PauliSum'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'list', 'children': ['31'], 'value': '[operator]'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'operator'}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'sum'}; {'id': '35', 'type': 'generator_expression', 'children': ['36', '48']}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': '_term_expectation'}; {'id': '38', 'type': 'argument_list', 'children': ['39', '42', '43']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'wf'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'term'}; {'id': '43', 'type': 'keyword_argument', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'n_qubits'}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'n_qubits'}; {'id': '48', 'type': 'for_in_clause', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'term'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'operator'}
|
Compute the expectation of an operator.
:param operator: The operator
:return: The operator's expectation value
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'pp'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '1024'}; {'id': '8', 'type': 'block', 'children': ['9', '13', '17', '39', '49']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'degree'}; {'id': '12', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'pattern'}; {'id': '16', 'type': 'string', 'children': [], 'value': '"%4d %s"'}; {'id': '17', 'type': 'while_statement', 'children': ['18', '21']}; {'id': '18', 'type': 'comparison_operator', 'children': ['19', '20'], 'value': '>'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '21', 'type': 'block', 'children': ['22', '26', '35']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'pattern'}; {'id': '25', 'type': 'string', 'children': [], 'value': '"%7.2f %s"'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '29', 'type': 'binary_operator', 'children': ['30', '31'], 'value': '/'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '31', 'type': 'call', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'base'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'augmented_assignment', 'children': ['37', '38'], 'value': '+='}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'degree'}; {'id': '38', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'assignment', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'scales'}; {'id': '42', 'type': 'list', 'children': ['43', '44', '45', '46', '47', '48'], 'value': "['B', 'KB', 'MB', 'GB', 'TB', 'EB']"}; {'id': '43', 'type': 'string', 'children': [], 'value': "'B'"}; {'id': '44', 'type': 'string', 'children': [], 'value': "'KB'"}; {'id': '45', 'type': 'string', 'children': [], 'value': "'MB'"}; {'id': '46', 'type': 'string', 'children': [], 'value': "'GB'"}; {'id': '47', 'type': 'string', 'children': [], 'value': "'TB'"}; {'id': '48', 'type': 'string', 'children': [], 'value': "'EB'"}; {'id': '49', 'type': 'return_statement', 'children': ['50']}; {'id': '50', 'type': 'binary_operator', 'children': ['51', '52'], 'value': '%'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'pattern'}; {'id': '52', 'type': 'tuple', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '54', 'type': 'subscript', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'scales'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'degree'}
|
Pretty-print the integer `i` as a human-readable size representation.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_original_images'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'dictionary_splat_pattern', 'children': ['6']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '7', 'type': 'block', 'children': ['8', '44', '178']}; {'id': '8', 'type': 'function_definition', 'children': ['9', '10', '12']}; {'id': '9', 'type': 'function_name', 'children': [], 'value': 'test'}; {'id': '10', 'type': 'parameters', 'children': ['11']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '12', 'type': 'block', 'children': ['13', '21', '42']}; {'id': '13', 'type': 'if_statement', 'children': ['14', '18']}; {'id': '14', 'type': 'not_operator', 'children': ['15']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'original'}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'return_statement', 'children': ['20']}; {'id': '20', 'type': 'False', 'children': []}; {'id': '21', 'type': 'for_statement', 'children': ['22', '25', '30']}; {'id': '22', 'type': 'pattern_list', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '29', 'type': 'argument_list', 'children': []}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'if_statement', 'children': ['32', '39']}; {'id': '32', 'type': 'comparison_operator', 'children': ['33', '38'], 'value': '!='}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '35', 'type': 'argument_list', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'return_statement', 'children': ['41']}; {'id': '41', 'type': 'False', 'children': []}; {'id': '42', 'type': 'return_statement', 'children': ['43']}; {'id': '43', 'type': 'True', 'children': []}; {'id': '44', 'type': 'if_statement', 'children': ['45', '55', '155']}; {'id': '45', 'type': 'comparison_operator', 'children': ['46', '54'], 'value': 'is'}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'Session'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'object_session'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '54', 'type': 'None', 'children': []}; {'id': '55', 'type': 'block', 'children': ['56', '60', '81', '90', '129']}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'images'}; {'id': '59', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '60', 'type': 'for_statement', 'children': ['61', '64', '67']}; {'id': '61', 'type': 'pattern_list', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'store'}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': '_stored_images'}; {'id': '67', 'type': 'block', 'children': ['68']}; {'id': '68', 'type': 'if_statement', 'children': ['69', '73']}; {'id': '69', 'type': 'call', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'test'}; {'id': '71', 'type': 'argument_list', 'children': ['72']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '73', 'type': 'block', 'children': ['74']}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'call', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'images'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '79', 'type': 'argument_list', 'children': ['80']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '81', 'type': 'expression_statement', 'children': ['82']}; {'id': '82', 'type': 'assignment', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'state'}; {'id': '84', 'type': 'call', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'instance_state'}; {'id': '86', 'type': 'argument_list', 'children': ['87']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'instance'}; {'id': '90', 'type': 'try_statement', 'children': ['91', '106', '110']}; {'id': '91', 'type': 'block', 'children': ['92']}; {'id': '92', 'type': 'expression_statement', 'children': ['93']}; {'id': '93', 'type': 'assignment', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'added'}; {'id': '95', 'type': 'attribute', 'children': ['96', '105']}; {'id': '96', 'type': 'subscript', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'state'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'committed_state'}; {'id': '100', 'type': 'attribute', 'children': ['101', '104']}; {'id': '101', 'type': 'attribute', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'added_items'}; {'id': '106', 'type': 'except_clause', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'KeyError'}; {'id': '108', 'type': 'block', 'children': ['109']}; {'id': '109', 'type': 'pass_statement', 'children': []}; {'id': '110', 'type': 'else_clause', 'children': ['111']}; {'id': '111', 'type': 'block', 'children': ['112']}; {'id': '112', 'type': 'for_statement', 'children': ['113', '114', '115']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'added'}; {'id': '115', 'type': 'block', 'children': ['116']}; {'id': '116', 'type': 'if_statement', 'children': ['117', '121']}; {'id': '117', 'type': 'call', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'test'}; {'id': '119', 'type': 'argument_list', 'children': ['120']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '121', 'type': 'block', 'children': ['122']}; {'id': '122', 'type': 'expression_statement', 'children': ['123']}; {'id': '123', 'type': 'call', 'children': ['124', '127']}; {'id': '124', 'type': 'attribute', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'images'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '127', 'type': 'argument_list', 'children': ['128']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '129', 'type': 'if_statement', 'children': ['130', '133']}; {'id': '130', 'type': 'attribute', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '133', 'type': 'block', 'children': ['134']}; {'id': '134', 'type': 'for_statement', 'children': ['135', '136', '141']}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '136', 'type': 'attribute', 'children': ['137', '140']}; {'id': '137', 'type': 'attribute', 'children': ['138', '139']}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'new'}; {'id': '141', 'type': 'block', 'children': ['142']}; {'id': '142', 'type': 'if_statement', 'children': ['143', '147']}; {'id': '143', 'type': 'call', 'children': ['144', '145']}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'test'}; {'id': '145', 'type': 'argument_list', 'children': ['146']}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '147', 'type': 'block', 'children': ['148']}; {'id': '148', 'type': 'expression_statement', 'children': ['149']}; {'id': '149', 'type': 'call', 'children': ['150', '153']}; {'id': '150', 'type': 'attribute', 'children': ['151', '152']}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'images'}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '153', 'type': 'argument_list', 'children': ['154']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'image'}; {'id': '155', 'type': 'else_clause', 'children': ['156']}; {'id': '156', 'type': 'block', 'children': ['157', '170']}; {'id': '157', 'type': 'expression_statement', 'children': ['158']}; {'id': '158', 'type': 'assignment', 'children': ['159', '160']}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '160', 'type': 'call', 'children': ['161', '164']}; {'id': '161', 'type': 'attribute', 'children': ['162', '163']}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'filter_by'}; {'id': '164', 'type': 'argument_list', 'children': ['165', '168']}; {'id': '165', 'type': 'keyword_argument', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'original'}; {'id': '167', 'type': 'True', 'children': []}; {'id': '168', 'type': 'dictionary_splat', 'children': ['169']}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '170', 'type': 'expression_statement', 'children': ['171']}; {'id': '171', 'type': 'assignment', 'children': ['172', '173']}; {'id': '172', 'type': 'identifier', 'children': [], 'value': 'images'}; {'id': '173', 'type': 'call', 'children': ['174', '177']}; {'id': '174', 'type': 'attribute', 'children': ['175', '176']}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '176', 'type': 'identifier', 'children': [], 'value': 'all'}; {'id': '177', 'type': 'argument_list', 'children': []}; {'id': '178', 'type': 'return_statement', 'children': ['179']}; {'id': '179', 'type': 'identifier', 'children': [], 'value': 'images'}
|
A list of the original images.
:returns: A list of the original images.
:rtype: :class:`typing.Sequence`\ [:class:`Image`]
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'base64_b64decode'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'instr'}; {'id': '5', 'type': 'block', 'children': ['6', '24']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'decoded'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'base64'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'b64decode'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '22']}; {'id': '15', 'type': 'attribute', 'children': ['16', '21']}; {'id': '16', 'type': 'attribute', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'salt'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'stringutils'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'to_bytes'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'instr'}; {'id': '24', 'type': 'try_statement', 'children': ['25', '51']}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'return_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '35']}; {'id': '28', 'type': 'attribute', 'children': ['29', '34']}; {'id': '29', 'type': 'attribute', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'salt'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'stringutils'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'to_unicode'}; {'id': '35', 'type': 'argument_list', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'decoded'}; {'id': '37', 'type': 'keyword_argument', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'encoding'}; {'id': '39', 'type': 'conditional_expression', 'children': ['40', '41', '50'], 'value': 'if'}; {'id': '40', 'type': 'string', 'children': [], 'value': "'utf8'"}; {'id': '41', 'type': 'call', 'children': ['42', '49']}; {'id': '42', 'type': 'attribute', 'children': ['43', '48']}; {'id': '43', 'type': 'attribute', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'salt'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'platform'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'is_windows'}; {'id': '49', 'type': 'argument_list', 'children': []}; {'id': '50', 'type': 'None', 'children': []}; {'id': '51', 'type': 'except_clause', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'UnicodeDecodeError'}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'return_statement', 'children': ['55']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'decoded'}
|
Decode a base64-encoded string using the "modern" Python interface.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_analog_map'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '14', '79']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'current_time'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '13', 'type': 'argument_list', 'children': []}; {'id': '14', 'type': 'if_statement', 'children': ['15', '27']}; {'id': '15', 'type': 'comparison_operator', 'children': ['16', '26'], 'value': 'is'}; {'id': '16', 'type': 'call', 'children': ['17', '22']}; {'id': '17', 'type': 'attribute', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'query_reply_data'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'PrivateConstants'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'ANALOG_MAPPING_RESPONSE'}; {'id': '26', 'type': 'None', 'children': []}; {'id': '27', 'type': 'block', 'children': ['28', '38']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'await', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': '_send_sysex'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'PrivateConstants'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'ANALOG_MAPPING_QUERY'}; {'id': '38', 'type': 'while_statement', 'children': ['39', '51']}; {'id': '39', 'type': 'comparison_operator', 'children': ['40', '50'], 'value': 'is'}; {'id': '40', 'type': 'call', 'children': ['41', '46']}; {'id': '41', 'type': 'attribute', 'children': ['42', '45']}; {'id': '42', 'type': 'attribute', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'query_reply_data'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '46', 'type': 'argument_list', 'children': ['47']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'PrivateConstants'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'ANALOG_MAPPING_RESPONSE'}; {'id': '50', 'type': 'None', 'children': []}; {'id': '51', 'type': 'block', 'children': ['52', '60', '69']}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'elapsed_time'}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'time'}; {'id': '59', 'type': 'argument_list', 'children': []}; {'id': '60', 'type': 'if_statement', 'children': ['61', '66']}; {'id': '61', 'type': 'comparison_operator', 'children': ['62', '65'], 'value': '>'}; {'id': '62', 'type': 'binary_operator', 'children': ['63', '64'], 'value': '-'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'elapsed_time'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'current_time'}; {'id': '65', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '66', 'type': 'block', 'children': ['67']}; {'id': '67', 'type': 'return_statement', 'children': ['68']}; {'id': '68', 'type': 'None', 'children': []}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'await', 'children': ['71']}; {'id': '71', 'type': 'call', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'asyncio'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'sleep'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'sleep_tune'}; {'id': '79', 'type': 'return_statement', 'children': ['80']}; {'id': '80', 'type': 'call', 'children': ['81', '86']}; {'id': '81', 'type': 'attribute', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'query_reply_data'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '86', 'type': 'argument_list', 'children': ['87']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'PrivateConstants'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'ANALOG_MAPPING_RESPONSE'}
|
This method requests a Firmata analog map query and returns the results.
:returns: An analog map response or None if a timeout occurs
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'list_documents'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'limit'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '13', '36', '43']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'limit_str'}; {'id': '12', 'type': 'string', 'children': [], 'value': "''"}; {'id': '13', 'type': 'if_statement', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'limit'}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'try_statement', 'children': ['17', '30']}; {'id': '17', 'type': 'block', 'children': ['18']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'limit_str'}; {'id': '21', 'type': 'call', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'string', 'children': [], 'value': "'LIMIT {}'"}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'limit'}; {'id': '30', 'type': 'except_clause', 'children': ['31', '34']}; {'id': '31', 'type': 'tuple', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'TypeError'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '34', 'type': 'block', 'children': ['35']}; {'id': '35', 'type': 'pass_statement', 'children': []}; {'id': '36', 'type': 'expression_statement', 'children': ['37']}; {'id': '37', 'type': 'assignment', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '39', 'type': '()', 'children': ['40']}; {'id': '40', 'type': 'binary_operator', 'children': ['41', '42'], 'value': '+'}; {'id': '41', 'type': 'string', 'children': [], 'value': "'SELECT identifier FROM identifier_index '"}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'limit_str'}; {'id': '43', 'type': 'for_statement', 'children': ['44', '45', '63']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '45', 'type': 'call', 'children': ['46', '62']}; {'id': '46', 'type': 'attribute', 'children': ['47', '61']}; {'id': '47', 'type': 'call', 'children': ['48', '59']}; {'id': '48', 'type': 'attribute', 'children': ['49', '58']}; {'id': '49', 'type': 'attribute', 'children': ['50', '57']}; {'id': '50', 'type': 'attribute', 'children': ['51', '56']}; {'id': '51', 'type': 'attribute', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'backend'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'library'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'database'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'execute'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'fetchall'}; {'id': '62', 'type': 'argument_list', 'children': []}; {'id': '63', 'type': 'block', 'children': ['64']}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'yield', 'children': ['66']}; {'id': '66', 'type': 'subscript', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '68', 'type': 'string', 'children': [], 'value': "'identifier'"}
|
Generates vids of all indexed identifiers.
Args:
limit (int, optional): If not empty, the maximum number of results to return
Generates:
str: vid of the document.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'reset'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '8', '14', '20', '26', '32', '38', '44', '50', '56', '62', '68', '74', '80', '86', '92', '98', '116', '146', '160', '166']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'string', 'children': [], 'value': '"Initialises all needed variables to default values"'}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'metadata'}; {'id': '13', 'type': 'dictionary', 'children': []}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '19', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'spine'}; {'id': '25', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'guide'}; {'id': '31', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'pages'}; {'id': '37', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '43']}; {'id': '40', 'type': 'attribute', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'toc'}; {'id': '43', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'assignment', 'children': ['46', '49']}; {'id': '46', 'type': 'attribute', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'bindings'}; {'id': '49', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'IDENTIFIER_ID'}; {'id': '55', 'type': 'string', 'children': [], 'value': "'id'"}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'FOLDER_NAME'}; {'id': '61', 'type': 'string', 'children': [], 'value': "'EPUB'"}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': '_id_html'}; {'id': '67', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '68', 'type': 'expression_statement', 'children': ['69']}; {'id': '69', 'type': 'assignment', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': '_id_image'}; {'id': '73', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'assignment', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': '_id_static'}; {'id': '79', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '80', 'type': 'expression_statement', 'children': ['81']}; {'id': '81', 'type': 'assignment', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'title'}; {'id': '85', 'type': 'string', 'children': [], 'value': "''"}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'assignment', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'language'}; {'id': '91', 'type': 'string', 'children': [], 'value': "'en'"}; {'id': '92', 'type': 'expression_statement', 'children': ['93']}; {'id': '93', 'type': 'assignment', 'children': ['94', '97']}; {'id': '94', 'type': 'attribute', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'direction'}; {'id': '97', 'type': 'None', 'children': []}; {'id': '98', 'type': 'expression_statement', 'children': ['99']}; {'id': '99', 'type': 'assignment', 'children': ['100', '103']}; {'id': '100', 'type': 'attribute', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'templates'}; {'id': '103', 'type': 'dictionary', 'children': ['104', '107', '110', '113']}; {'id': '104', 'type': 'pair', 'children': ['105', '106']}; {'id': '105', 'type': 'string', 'children': [], 'value': "'ncx'"}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'NCX_XML'}; {'id': '107', 'type': 'pair', 'children': ['108', '109']}; {'id': '108', 'type': 'string', 'children': [], 'value': "'nav'"}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'NAV_XML'}; {'id': '110', 'type': 'pair', 'children': ['111', '112']}; {'id': '111', 'type': 'string', 'children': [], 'value': "'chapter'"}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'CHAPTER_XML'}; {'id': '113', 'type': 'pair', 'children': ['114', '115']}; {'id': '114', 'type': 'string', 'children': [], 'value': "'cover'"}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'COVER_XML'}; {'id': '116', 'type': 'expression_statement', 'children': ['117']}; {'id': '117', 'type': 'call', 'children': ['118', '121']}; {'id': '118', 'type': 'attribute', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'add_metadata'}; {'id': '121', 'type': 'argument_list', 'children': ['122', '123', '124', '125']}; {'id': '122', 'type': 'string', 'children': [], 'value': "'OPF'"}; {'id': '123', 'type': 'string', 'children': [], 'value': "'generator'"}; {'id': '124', 'type': 'string', 'children': [], 'value': "''"}; {'id': '125', 'type': 'dictionary', 'children': ['126', '129']}; {'id': '126', 'type': 'pair', 'children': ['127', '128']}; {'id': '127', 'type': 'string', 'children': [], 'value': "'name'"}; {'id': '128', 'type': 'string', 'children': [], 'value': "'generator'"}; {'id': '129', 'type': 'pair', 'children': ['130', '131']}; {'id': '130', 'type': 'string', 'children': [], 'value': "'content'"}; {'id': '131', 'type': 'binary_operator', 'children': ['132', '133'], 'value': '%'}; {'id': '132', 'type': 'string', 'children': [], 'value': "'Ebook-lib %s'"}; {'id': '133', 'type': 'call', 'children': ['134', '137']}; {'id': '134', 'type': 'attribute', 'children': ['135', '136']}; {'id': '135', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '137', 'type': 'argument_list', 'children': ['138']}; {'id': '138', 'type': 'list_comprehension', 'children': ['139', '143']}; {'id': '139', 'type': 'call', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '141', 'type': 'argument_list', 'children': ['142']}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '143', 'type': 'for_in_clause', 'children': ['144', '145']}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'VERSION'}; {'id': '146', 'type': 'expression_statement', 'children': ['147']}; {'id': '147', 'type': 'call', 'children': ['148', '151']}; {'id': '148', 'type': 'attribute', 'children': ['149', '150']}; {'id': '149', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'set_identifier'}; {'id': '151', 'type': 'argument_list', 'children': ['152']}; {'id': '152', 'type': 'call', 'children': ['153', '154']}; {'id': '153', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '154', 'type': 'argument_list', 'children': ['155']}; {'id': '155', 'type': 'call', 'children': ['156', '159']}; {'id': '156', 'type': 'attribute', 'children': ['157', '158']}; {'id': '157', 'type': 'identifier', 'children': [], 'value': 'uuid'}; {'id': '158', 'type': 'identifier', 'children': [], 'value': 'uuid4'}; {'id': '159', 'type': 'argument_list', 'children': []}; {'id': '160', 'type': 'expression_statement', 'children': ['161']}; {'id': '161', 'type': 'assignment', 'children': ['162', '165']}; {'id': '162', 'type': 'attribute', 'children': ['163', '164']}; {'id': '163', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '164', 'type': 'identifier', 'children': [], 'value': 'prefixes'}; {'id': '165', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '166', 'type': 'expression_statement', 'children': ['167']}; {'id': '167', 'type': 'assignment', 'children': ['168', '171']}; {'id': '168', 'type': 'attribute', 'children': ['169', '170']}; {'id': '169', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '170', 'type': 'identifier', 'children': [], 'value': 'namespaces'}; {'id': '171', 'type': 'dictionary', 'children': []}
|
Initialises all needed variables to default values
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'previous'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'day_of_week'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '20', '34', '45', '63']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '13']}; {'id': '10', 'type': 'comparison_operator', 'children': ['11', '12'], 'value': 'is'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'day_of_week'}; {'id': '12', 'type': 'None', 'children': []}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'expression_statement', 'children': ['15']}; {'id': '15', 'type': 'assignment', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'day_of_week'}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'day_of_week'}; {'id': '20', 'type': 'if_statement', 'children': ['21', '28']}; {'id': '21', 'type': 'boolean_operator', 'children': ['22', '25'], 'value': 'or'}; {'id': '22', 'type': 'comparison_operator', 'children': ['23', '24'], 'value': '<'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'day_of_week'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'SUNDAY'}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '27'], 'value': '>'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'day_of_week'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'SATURDAY'}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'raise_statement', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'string', 'children': [], 'value': '"Invalid day of week"'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'dt'}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'subtract'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'keyword_argument', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'days'}; {'id': '44', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '45', 'type': 'while_statement', 'children': ['46', '51']}; {'id': '46', 'type': 'comparison_operator', 'children': ['47', '50'], 'value': '!='}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'dt'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'day_of_week'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'day_of_week'}; {'id': '51', 'type': 'block', 'children': ['52']}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'dt'}; {'id': '55', 'type': 'call', 'children': ['56', '59']}; {'id': '56', 'type': 'attribute', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'dt'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'subtract'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'days'}; {'id': '62', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '63', 'type': 'return_statement', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'dt'}
|
Modify to the previous occurrence of a given day of the week.
If no day_of_week is provided, modify to the previous occurrence
of the current day of the week. Use the supplied consts
to indicate the desired day_of_week, ex. pendulum.MONDAY.
:param day_of_week: The previous day of week to reset to.
:type day_of_week: int or None
:rtype: Date
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'AddMapping'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'new_mapping'}; {'id': '7', 'type': 'block', 'children': ['8', '26', '42']}; {'id': '8', 'type': 'for_statement', 'children': ['9', '10', '13']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': '_REQUIRED_MAPPING_FIELDS'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'if_statement', 'children': ['15', '18']}; {'id': '15', 'type': 'comparison_operator', 'children': ['16', '17'], 'value': 'not in'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'new_mapping'}; {'id': '18', 'type': 'block', 'children': ['19']}; {'id': '19', 'type': 'raise_statement', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'problems'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'InvalidMapping'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'field'}; {'id': '26', 'type': 'if_statement', 'children': ['27', '34']}; {'id': '27', 'type': 'comparison_operator', 'children': ['28', '29'], 'value': 'in'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '29', 'type': 'call', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'GetKnownFilenames'}; {'id': '33', 'type': 'argument_list', 'children': []}; {'id': '34', 'type': 'block', 'children': ['35']}; {'id': '35', 'type': 'raise_statement', 'children': ['36']}; {'id': '36', 'type': 'call', 'children': ['37', '40']}; {'id': '37', 'type': 'attribute', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'problems'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'DuplicateMapping'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '49']}; {'id': '44', 'type': 'subscript', 'children': ['45', '48']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': '_file_mapping'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'new_mapping'}
|
Adds an entry to the list of known filenames.
Args:
filename: The filename whose mapping is being added.
new_mapping: A dictionary with the mapping to add. Must contain all
fields in _REQUIRED_MAPPING_FIELDS.
Raises:
DuplicateMapping if the filename already exists in the mapping
InvalidMapping if not all required fields are present
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'format_file_path'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'filepath'}; {'id': '5', 'type': 'block', 'children': ['6', '78']}; {'id': '6', 'type': 'try_statement', 'children': ['7', '75']}; {'id': '7', 'type': 'block', 'children': ['8', '17', '35', '46', '55', '66']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'is_windows_network_mount'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'WINDOWS_NETWORK_MOUNT_PATTERN'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'filepath'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'filepath'}; {'id': '20', 'type': 'call', 'children': ['21', '26']}; {'id': '21', 'type': 'attribute', 'children': ['22', '25']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'realpath'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '33']}; {'id': '28', 'type': 'attribute', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'abspath'}; {'id': '33', 'type': 'argument_list', 'children': ['34']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'filepath'}; {'id': '35', 'type': 'expression_statement', 'children': ['36']}; {'id': '36', 'type': 'assignment', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'filepath'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 're'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'sub'}; {'id': '42', 'type': 'argument_list', 'children': ['43', '44', '45']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'BACKSLASH_REPLACE_PATTERN'}; {'id': '44', 'type': 'string', 'children': [], 'value': "'/'"}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'filepath'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'is_windows_drive'}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'WINDOWS_DRIVE_PATTERN'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'filepath'}; {'id': '55', 'type': 'if_statement', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'is_windows_drive'}; {'id': '57', 'type': 'block', 'children': ['58']}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'assignment', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'filepath'}; {'id': '61', 'type': 'call', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'filepath'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'capitalize'}; {'id': '65', 'type': 'argument_list', 'children': []}; {'id': '66', 'type': 'if_statement', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'is_windows_network_mount'}; {'id': '68', 'type': 'block', 'children': ['69']}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'assignment', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'filepath'}; {'id': '72', 'type': 'binary_operator', 'children': ['73', '74'], 'value': '+'}; {'id': '73', 'type': 'string', 'children': [], 'value': "'/'"}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'filepath'}; {'id': '75', 'type': 'except_clause', 'children': ['76']}; {'id': '76', 'type': 'block', 'children': ['77']}; {'id': '77', 'type': 'pass_statement', 'children': []}; {'id': '78', 'type': 'return_statement', 'children': ['79']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'filepath'}
|
Formats a path as absolute and with the correct platform separator.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_validate_auth'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '8', 'type': 'block', 'children': ['9', '13', '66']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'errs'}; {'id': '12', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '13', 'type': 'if_statement', 'children': ['14', '19', '46']}; {'id': '14', 'type': 'comparison_operator', 'children': ['15', '18'], 'value': '=='}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '18', 'type': 'string', 'children': [], 'value': "'apiKey'"}; {'id': '19', 'type': 'block', 'children': ['20', '33']}; {'id': '20', 'type': 'if_statement', 'children': ['21', '25']}; {'id': '21', 'type': 'not_operator', 'children': ['22']}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'passAs'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'call', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'errs'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '31', 'type': 'argument_list', 'children': ['32']}; {'id': '32', 'type': 'string', 'children': [], 'value': '\'need "passAs" for apiKey\''}; {'id': '33', 'type': 'if_statement', 'children': ['34', '38']}; {'id': '34', 'type': 'not_operator', 'children': ['35']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'keyname'}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'errs'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'string', 'children': [], 'value': '\'need "keyname" for apiKey\''}; {'id': '46', 'type': 'elif_clause', 'children': ['47', '52']}; {'id': '47', 'type': 'comparison_operator', 'children': ['48', '51'], 'value': '=='}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '51', 'type': 'string', 'children': [], 'value': "'oauth2'"}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'if_statement', 'children': ['54', '58']}; {'id': '54', 'type': 'not_operator', 'children': ['55']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'grantTypes'}; {'id': '58', 'type': 'block', 'children': ['59']}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'call', 'children': ['61', '64']}; {'id': '61', 'type': 'attribute', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'errs'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'string', 'children': [], 'value': '\'need "grantTypes" for oauth2\''}; {'id': '66', 'type': 'return_statement', 'children': ['67']}; {'id': '67', 'type': 'expression_list', 'children': ['68', '69', '74']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '69', 'type': 'attribute', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'obj'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': '__class__'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': '__name__'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'errs'}
|
validate that apiKey and oauth2 requirements
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'concretize_load_idx'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'strategies'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '45', '56']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '16', '20']}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '13', 'type': 'argument_list', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '16', 'type': 'block', 'children': ['17']}; {'id': '17', 'type': 'return_statement', 'children': ['18']}; {'id': '18', 'type': 'list', 'children': ['19'], 'value': '[idx]'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '20', 'type': 'elif_clause', 'children': ['21', '32']}; {'id': '21', 'type': 'not_operator', 'children': ['22']}; {'id': '22', 'type': 'call', 'children': ['23', '30']}; {'id': '23', 'type': 'attribute', 'children': ['24', '29']}; {'id': '24', 'type': 'attribute', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'state'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'solver'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'symbolic'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '32', 'type': 'block', 'children': ['33']}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'list', 'children': ['35'], 'value': '[self.state.solver.eval(idx)]'}; {'id': '35', 'type': 'call', 'children': ['36', '43']}; {'id': '36', 'type': 'attribute', 'children': ['37', '42']}; {'id': '37', 'type': 'attribute', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'state'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'solver'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'eval'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '45', 'type': 'expression_statement', 'children': ['46']}; {'id': '46', 'type': 'assignment', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'strategies'}; {'id': '48', 'type': 'conditional_expression', 'children': ['49', '52', '55'], 'value': 'if'}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'load_strategies'}; {'id': '52', 'type': 'comparison_operator', 'children': ['53', '54'], 'value': 'is'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'strategies'}; {'id': '54', 'type': 'None', 'children': []}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'strategies'}; {'id': '56', 'type': 'return_statement', 'children': ['57']}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': '_apply_concretization_strategies'}; {'id': '61', 'type': 'argument_list', 'children': ['62', '63', '64']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'idx'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'strategies'}; {'id': '64', 'type': 'string', 'children': [], 'value': "'load'"}
|
Concretizes a load index.
:param idx: An expression for the index.
:param strategies: A list of concretization strategies (to override the default).
:param min_idx: Minimum value for a concretized index (inclusive).
:param max_idx: Maximum value for a concretized index (exclusive).
:returns: A list of concrete indexes.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update_ff'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'ff'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'mol2'}; {'id': '8', 'type': 'False', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'force_ff_assign'}; {'id': '11', 'type': 'False', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13', '17', '47', '60']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'aff'}; {'id': '16', 'type': 'False', 'children': []}; {'id': '17', 'type': 'if_statement', 'children': ['18', '19', '24', '35']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'force_ff_assign'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'aff'}; {'id': '23', 'type': 'True', 'children': []}; {'id': '24', 'type': 'elif_clause', 'children': ['25', '30']}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '27'], 'value': 'not in'}; {'id': '26', 'type': 'string', 'children': [], 'value': "'assigned_ff'"}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'tags'}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'aff'}; {'id': '34', 'type': 'True', 'children': []}; {'id': '35', 'type': 'elif_clause', 'children': ['36', '42']}; {'id': '36', 'type': 'not_operator', 'children': ['37']}; {'id': '37', 'type': 'subscript', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'tags'}; {'id': '41', 'type': 'string', 'children': [], 'value': "'assigned_ff'"}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'aff'}; {'id': '46', 'type': 'True', 'children': []}; {'id': '47', 'type': 'if_statement', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'aff'}; {'id': '49', 'type': 'block', 'children': ['50']}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'call', 'children': ['52', '55']}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'assign_force_field'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'ff'}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'mol2'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'mol2'}; {'id': '60', 'type': 'return_statement', 'children': []}
|
Manages assigning the force field parameters.
The aim of this method is to avoid unnecessary assignment of the
force field.
Parameters
----------
ff: BuffForceField
The force field to be used for scoring.
mol2: bool, optional
If true, mol2 style labels will also be used.
force_ff_assign: bool, optional
If true, the force field will be completely reassigned, ignoring the
cached parameters.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'Fierz_to_Bern_chrom'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'C'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'dd'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '7', 'type': 'block', 'children': ['8', '21', '34', '72']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'sqrt'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'binary_operator', 'children': ['15', '18'], 'value': '*'}; {'id': '15', 'type': 'binary_operator', 'children': ['16', '17'], 'value': '*'}; {'id': '16', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'pi'}; {'id': '18', 'type': 'subscript', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '20', 'type': 'string', 'children': [], 'value': "'alpha_e'"}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'gs'}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'sqrt'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'binary_operator', 'children': ['28', '31'], 'value': '*'}; {'id': '28', 'type': 'binary_operator', 'children': ['29', '30'], 'value': '*'}; {'id': '29', 'type': 'integer', 'children': [], 'value': '4'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'pi'}; {'id': '31', 'type': 'subscript', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '33', 'type': 'string', 'children': [], 'value': "'alpha_s'"}; {'id': '34', 'type': 'if_statement', 'children': ['35', '42', '49', '60']}; {'id': '35', 'type': 'boolean_operator', 'children': ['36', '39'], 'value': 'or'}; {'id': '36', 'type': 'comparison_operator', 'children': ['37', '38'], 'value': '=='}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'dd'}; {'id': '38', 'type': 'string', 'children': [], 'value': "'sb'"}; {'id': '39', 'type': 'comparison_operator', 'children': ['40', '41'], 'value': '=='}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'dd'}; {'id': '41', 'type': 'string', 'children': [], 'value': "'db'"}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'mq'}; {'id': '46', 'type': 'subscript', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '48', 'type': 'string', 'children': [], 'value': "'m_b'"}; {'id': '49', 'type': 'elif_clause', 'children': ['50', '53']}; {'id': '50', 'type': 'comparison_operator', 'children': ['51', '52'], 'value': '=='}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'dd'}; {'id': '52', 'type': 'string', 'children': [], 'value': "'ds'"}; {'id': '53', 'type': 'block', 'children': ['54']}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'mq'}; {'id': '57', 'type': 'subscript', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'parameters'}; {'id': '59', 'type': 'string', 'children': [], 'value': "'m_s'"}; {'id': '60', 'type': 'else_clause', 'children': ['61']}; {'id': '61', 'type': 'block', 'children': ['62']}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'call', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'KeyError'}; {'id': '65', 'type': 'argument_list', 'children': ['66']}; {'id': '66', 'type': 'call', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'string', 'children': [], 'value': '"Not sure what to do with quark mass for flavour {}"'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'dd'}; {'id': '72', 'type': 'return_statement', 'children': ['73']}; {'id': '73', 'type': 'dictionary', 'children': ['74', '91', '104', '121']}; {'id': '74', 'type': 'pair', 'children': ['75', '78']}; {'id': '75', 'type': 'binary_operator', 'children': ['76', '77'], 'value': '+'}; {'id': '76', 'type': 'string', 'children': [], 'value': "'7gamma'"}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'dd'}; {'id': '78', 'type': 'binary_operator', 'children': ['79', '86'], 'value': '*'}; {'id': '79', 'type': 'binary_operator', 'children': ['80', '85'], 'value': '/'}; {'id': '80', 'type': 'binary_operator', 'children': ['81', '84'], 'value': '/'}; {'id': '81', 'type': 'binary_operator', 'children': ['82', '83'], 'value': '**'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'gs'}; {'id': '83', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'mq'}; {'id': '86', 'type': 'subscript', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'C'}; {'id': '88', 'type': 'binary_operator', 'children': ['89', '90'], 'value': '+'}; {'id': '89', 'type': 'string', 'children': [], 'value': "'F7gamma'"}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'dd'}; {'id': '91', 'type': 'pair', 'children': ['92', '95']}; {'id': '92', 'type': 'binary_operator', 'children': ['93', '94'], 'value': '+'}; {'id': '93', 'type': 'string', 'children': [], 'value': "'8g'"}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'dd'}; {'id': '95', 'type': 'binary_operator', 'children': ['96', '99'], 'value': '*'}; {'id': '96', 'type': 'binary_operator', 'children': ['97', '98'], 'value': '/'}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'gs'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'mq'}; {'id': '99', 'type': 'subscript', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'C'}; {'id': '101', 'type': 'binary_operator', 'children': ['102', '103'], 'value': '+'}; {'id': '102', 'type': 'string', 'children': [], 'value': "'F8g'"}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'dd'}; {'id': '104', 'type': 'pair', 'children': ['105', '108']}; {'id': '105', 'type': 'binary_operator', 'children': ['106', '107'], 'value': '+'}; {'id': '106', 'type': 'string', 'children': [], 'value': "'7pgamma'"}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'dd'}; {'id': '108', 'type': 'binary_operator', 'children': ['109', '116'], 'value': '*'}; {'id': '109', 'type': 'binary_operator', 'children': ['110', '115'], 'value': '/'}; {'id': '110', 'type': 'binary_operator', 'children': ['111', '114'], 'value': '/'}; {'id': '111', 'type': 'binary_operator', 'children': ['112', '113'], 'value': '**'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'gs'}; {'id': '113', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'mq'}; {'id': '116', 'type': 'subscript', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'C'}; {'id': '118', 'type': 'binary_operator', 'children': ['119', '120'], 'value': '+'}; {'id': '119', 'type': 'string', 'children': [], 'value': "'F7pgamma'"}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'dd'}; {'id': '121', 'type': 'pair', 'children': ['122', '125']}; {'id': '122', 'type': 'binary_operator', 'children': ['123', '124'], 'value': '+'}; {'id': '123', 'type': 'string', 'children': [], 'value': "'8pg'"}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'dd'}; {'id': '125', 'type': 'binary_operator', 'children': ['126', '129'], 'value': '*'}; {'id': '126', 'type': 'binary_operator', 'children': ['127', '128'], 'value': '/'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'gs'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'mq'}; {'id': '129', 'type': 'subscript', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'C'}; {'id': '131', 'type': 'binary_operator', 'children': ['132', '133'], 'value': '+'}; {'id': '132', 'type': 'string', 'children': [], 'value': "'F8pg'"}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'dd'}
|
From Fierz to chromomagnetic Bern basis for Class V.
dd should be of the form 'sb', 'ds' etc.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'is_cached'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'link'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '11', '14', '29']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '10'], 'value': 'is'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'link'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'block', 'children': ['12']}; {'id': '12', 'type': 'return_statement', 'children': ['13']}; {'id': '13', 'type': 'False', 'children': []}; {'id': '14', 'type': 'elif_clause', 'children': ['15', '20']}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'hasattr'}; {'id': '17', 'type': 'argument_list', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'link'}; {'id': '19', 'type': 'string', 'children': [], 'value': "'uri'"}; {'id': '20', 'type': 'block', 'children': ['21']}; {'id': '21', 'type': 'return_statement', 'children': ['22']}; {'id': '22', 'type': 'comparison_operator', 'children': ['23', '26'], 'value': 'in'}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'link'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'id_map'}; {'id': '29', 'type': 'else_clause', 'children': ['30']}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'return_statement', 'children': ['32']}; {'id': '32', 'type': 'comparison_operator', 'children': ['33', '34'], 'value': 'in'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'link'}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'id_map'}
|
Returns whether the current navigator is cached. Intended
to be overwritten and customized by subclasses.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'reconnect'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '5', 'type': 'block', 'children': ['6', '23', '39']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '12']}; {'id': '7', 'type': 'call', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '9', 'type': 'argument_list', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'FflConnection'}; {'id': '12', 'type': 'block', 'children': ['13']}; {'id': '13', 'type': 'return_statement', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '19']}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'type'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'ffldir'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'kw'}; {'id': '26', 'type': 'conditional_expression', 'children': ['27', '33', '38'], 'value': 'if'}; {'id': '27', 'type': 'dictionary', 'children': ['28']}; {'id': '28', 'type': 'pair', 'children': ['29', '30']}; {'id': '29', 'type': 'string', 'children': [], 'value': "'context'"}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': '_context'}; {'id': '33', 'type': 'comparison_operator', 'children': ['34', '37'], 'value': '!='}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '37', 'type': 'integer', 'children': [], 'value': '80'}; {'id': '38', 'type': 'dictionary', 'children': []}; {'id': '39', 'type': 'return_statement', 'children': ['40']}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': '__class__'}; {'id': '44', 'type': 'argument_list', 'children': ['45', '48', '53']}; {'id': '45', 'type': 'attribute', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '48', 'type': 'keyword_argument', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'connection'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '53', 'type': 'dictionary_splat', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'kw'}
|
Open a new datafind connection based on an existing connection
This is required because of https://git.ligo.org/lscsoft/glue/issues/1
Parameters
----------
connection : :class:`~gwdatafind.http.HTTPConnection` or `FflConnection`
a connection object (doesn't need to be open)
Returns
-------
newconn : :class:`~gwdatafind.http.HTTPConnection` or `FflConnection`
the new open connection to the same `host:port` server
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'write_csv_header'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'mol'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'csv_writer'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '18', '25', '35', '46']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '10', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'string', 'children': [], 'value': "'id'"}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'string', 'children': [], 'value': "'status'"}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'queryList'}; {'id': '28', 'type': 'call', 'children': ['29', '34']}; {'id': '29', 'type': 'attribute', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'mol'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'properties'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'keys'}; {'id': '34', 'type': 'argument_list', 'children': []}; {'id': '35', 'type': 'for_statement', 'children': ['36', '37', '38']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'queryLabel'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'queryList'}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'line'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'queryLabel'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'csv_writer'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'writerow'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'line'}
|
Write the csv header
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'HasColumn'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'table_name'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'column_name'}; {'id': '7', 'type': 'block', 'children': ['8', '19', '25', '33', '45', '128', '136']}; {'id': '8', 'type': 'if_statement', 'children': ['9', '13']}; {'id': '9', 'type': 'not_operator', 'children': ['10']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': '_connection'}; {'id': '13', 'type': 'block', 'children': ['14']}; {'id': '14', 'type': 'raise_statement', 'children': ['15']}; {'id': '15', 'type': 'call', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'IOError'}; {'id': '17', 'type': 'argument_list', 'children': ['18']}; {'id': '18', 'type': 'string', 'children': [], 'value': "'Not opened.'"}; {'id': '19', 'type': 'if_statement', 'children': ['20', '22']}; {'id': '20', 'type': 'not_operator', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'column_name'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'return_statement', 'children': ['24']}; {'id': '24', 'type': 'False', 'children': []}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'table_name'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'table_name'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'column_names'}; {'id': '36', 'type': 'call', 'children': ['37', '42']}; {'id': '37', 'type': 'attribute', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': '_column_names_per_table'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '42', 'type': 'argument_list', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'table_name'}; {'id': '44', 'type': 'None', 'children': []}; {'id': '45', 'type': 'if_statement', 'children': ['46', '49']}; {'id': '46', 'type': 'comparison_operator', 'children': ['47', '48'], 'value': 'is'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'column_names'}; {'id': '48', 'type': 'None', 'children': []}; {'id': '49', 'type': 'block', 'children': ['50', '54', '70', '120']}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'column_names'}; {'id': '53', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '61']}; {'id': '56', 'type': 'attribute', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': '_cursor'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'execute'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'call', 'children': ['63', '68']}; {'id': '63', 'type': 'attribute', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': '_HAS_COLUMN_QUERY'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'table_name'}; {'id': '70', 'type': 'for_statement', 'children': ['71', '72', '79']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '72', 'type': 'call', 'children': ['73', '78']}; {'id': '73', 'type': 'attribute', 'children': ['74', '77']}; {'id': '74', 'type': 'attribute', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': '_cursor'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'fetchall'}; {'id': '78', 'type': 'argument_list', 'children': []}; {'id': '79', 'type': 'block', 'children': ['80', '87', '93', '109']}; {'id': '80', 'type': 'if_statement', 'children': ['81', '85']}; {'id': '81', 'type': 'not_operator', 'children': ['82']}; {'id': '82', 'type': 'subscript', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '84', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '85', 'type': 'block', 'children': ['86']}; {'id': '86', 'type': 'continue_statement', 'children': []}; {'id': '87', 'type': 'expression_statement', 'children': ['88']}; {'id': '88', 'type': 'assignment', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'row_column_name'}; {'id': '90', 'type': 'subscript', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '92', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '93', 'type': 'if_statement', 'children': ['94', '99']}; {'id': '94', 'type': 'call', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '96', 'type': 'argument_list', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'row_column_name'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'bytes'}; {'id': '99', 'type': 'block', 'children': ['100']}; {'id': '100', 'type': 'expression_statement', 'children': ['101']}; {'id': '101', 'type': 'assignment', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'row_column_name'}; {'id': '103', 'type': 'call', 'children': ['104', '107']}; {'id': '104', 'type': 'attribute', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'row_column_name'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'decode'}; {'id': '107', 'type': 'argument_list', 'children': ['108']}; {'id': '108', 'type': 'string', 'children': [], 'value': "'utf-8'"}; {'id': '109', 'type': 'expression_statement', 'children': ['110']}; {'id': '110', 'type': 'call', 'children': ['111', '114']}; {'id': '111', 'type': 'attribute', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'column_names'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '114', 'type': 'argument_list', 'children': ['115']}; {'id': '115', 'type': 'call', 'children': ['116', '119']}; {'id': '116', 'type': 'attribute', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'row_column_name'}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '119', 'type': 'argument_list', 'children': []}; {'id': '120', 'type': 'expression_statement', 'children': ['121']}; {'id': '121', 'type': 'assignment', 'children': ['122', '127']}; {'id': '122', 'type': 'subscript', 'children': ['123', '126']}; {'id': '123', 'type': 'attribute', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': '_column_names_per_table'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'table_name'}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'column_names'}; {'id': '128', 'type': 'expression_statement', 'children': ['129']}; {'id': '129', 'type': 'assignment', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'column_name'}; {'id': '131', 'type': 'call', 'children': ['132', '135']}; {'id': '132', 'type': 'attribute', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'column_name'}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '135', 'type': 'argument_list', 'children': []}; {'id': '136', 'type': 'return_statement', 'children': ['137']}; {'id': '137', 'type': 'comparison_operator', 'children': ['138', '139'], 'value': 'in'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'column_name'}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'column_names'}
|
Determines if a specific column exists.
Args:
table_name (str): name of the table.
column_name (str): name of the column.
Returns:
bool: True if the column exists.
Raises:
IOError: if the database file is not opened.
OSError: if the database file is not opened.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'show_syspath'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '41']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'editor'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'CollectionsEditor'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'keyword_argument', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'parent'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'editor'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'setup'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '24', '27', '30', '33']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '24', 'type': 'keyword_argument', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'title'}; {'id': '26', 'type': 'string', 'children': [], 'value': '"sys.path"'}; {'id': '27', 'type': 'keyword_argument', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'readonly'}; {'id': '29', 'type': 'True', 'children': []}; {'id': '30', 'type': 'keyword_argument', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '600'}; {'id': '33', 'type': 'keyword_argument', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'icon'}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'ima'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'icon'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'string', 'children': [], 'value': "'syspath'"}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '48']}; {'id': '43', 'type': 'attribute', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'dialog_manager'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'show'}; {'id': '48', 'type': 'argument_list', 'children': ['49']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'editor'}
|
Show sys.path
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'restart_walk'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '11']}; {'id': '7', 'type': 'not_operator', 'children': ['8']}; {'id': '8', 'type': 'attribute', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': '_restartwalk'}; {'id': '11', 'type': 'block', 'children': ['12', '18']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '_restartwalk'}; {'id': '17', 'type': 'True', 'children': []}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'await', 'children': ['20']}; {'id': '20', 'type': 'call', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'wait_for_send'}; {'id': '24', 'type': 'argument_list', 'children': ['25']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'FlowUpdaterNotification'}; {'id': '27', 'type': 'argument_list', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'FlowUpdaterNotification'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'STARTWALK'}
|
Force a re-walk
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'source'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'source'}; {'id': '6', 'type': 'block', 'children': ['7', '17']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'call', 'children': ['9', '14']}; {'id': '9', 'type': 'attribute', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'BaseView'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'source'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'fset'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'source'}; {'id': '17', 'type': 'if_statement', 'children': ['18', '21']}; {'id': '18', 'type': 'attribute', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'main_pane'}; {'id': '21', 'type': 'block', 'children': ['22', '32']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '29']}; {'id': '24', 'type': 'attribute', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'main_pane'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'object'}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'contents'}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '39']}; {'id': '34', 'type': 'attribute', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'label_pane'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'object'}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'label'}
|
When the source gets updated, update the pane object
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_GetAuthCookie'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'auth_token'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '21', '41', '64', '105']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'continue_location'}; {'id': '10', 'type': 'string', 'children': [], 'value': '"http://localhost/"'}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '14', 'type': 'dictionary', 'children': ['15', '18']}; {'id': '15', 'type': 'pair', 'children': ['16', '17']}; {'id': '16', 'type': 'string', 'children': [], 'value': '"continue"'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'continue_location'}; {'id': '18', 'type': 'pair', 'children': ['19', '20']}; {'id': '19', 'type': 'string', 'children': [], 'value': '"auth"'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'auth_token'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': '_CreateRequest'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'binary_operator', 'children': ['30', '31'], 'value': '%'}; {'id': '30', 'type': 'string', 'children': [], 'value': '"https://%s/_ah/login?%s"'}; {'id': '31', 'type': 'tuple', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'urllib'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'urlencode'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'args'}; {'id': '41', 'type': 'try_statement', 'children': ['42', '54']}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '46', 'type': 'call', 'children': ['47', '52']}; {'id': '47', 'type': 'attribute', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'opener'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'open'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '54', 'type': 'except_clause', 'children': ['55', '58', '59']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'urllib2'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'HTTPError'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '59', 'type': 'block', 'children': ['60']}; {'id': '60', 'type': 'expression_statement', 'children': ['61']}; {'id': '61', 'type': 'assignment', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '64', 'type': 'if_statement', 'children': ['65', '81']}; {'id': '65', 'type': '()', 'children': ['66']}; {'id': '66', 'type': 'boolean_operator', 'children': ['67', '72'], 'value': 'or'}; {'id': '67', 'type': 'comparison_operator', 'children': ['68', '71'], 'value': '!='}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '71', 'type': 'integer', 'children': [], 'value': '302'}; {'id': '72', 'type': 'comparison_operator', 'children': ['73', '80'], 'value': '!='}; {'id': '73', 'type': 'subscript', 'children': ['74', '79']}; {'id': '74', 'type': 'call', 'children': ['75', '78']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'info'}; {'id': '78', 'type': 'argument_list', 'children': []}; {'id': '79', 'type': 'string', 'children': [], 'value': '"location"'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'continue_location'}; {'id': '81', 'type': 'block', 'children': ['82']}; {'id': '82', 'type': 'raise_statement', 'children': ['83']}; {'id': '83', 'type': 'call', 'children': ['84', '87']}; {'id': '84', 'type': 'attribute', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'urllib2'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'HTTPError'}; {'id': '87', 'type': 'argument_list', 'children': ['88', '93', '96', '99', '102']}; {'id': '88', 'type': 'call', 'children': ['89', '92']}; {'id': '89', 'type': 'attribute', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'get_full_url'}; {'id': '92', 'type': 'argument_list', 'children': []}; {'id': '93', 'type': 'attribute', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'code'}; {'id': '96', 'type': 'attribute', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '99', 'type': 'attribute', 'children': ['100', '101']}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'headers'}; {'id': '102', 'type': 'attribute', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'fp'}; {'id': '105', 'type': 'expression_statement', 'children': ['106']}; {'id': '106', 'type': 'assignment', 'children': ['107', '110']}; {'id': '107', 'type': 'attribute', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'authenticated'}; {'id': '110', 'type': 'True', 'children': []}
|
Fetches authentication cookies for an authentication token.
Args:
auth_token: The authentication token returned by ClientLogin.
Raises:
HTTPError: If there was an error fetching the authentication cookies.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '17']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'distribution'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'normalized'}; {'id': '13', 'type': 'True', 'children': []}; {'id': '14', 'type': 'default_parameter', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '16', 'type': 'None', 'children': []}; {'id': '17', 'type': 'block', 'children': ['18', '34', '42', '122']}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '24']}; {'id': '20', 'type': 'pattern_list', 'children': ['21', '22', '23']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '24', 'type': 'call', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': '_check_boundaries'}; {'id': '28', 'type': 'argument_list', 'children': ['29', '30', '31']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '31', 'type': 'keyword_argument', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'counter'}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'histogram'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'Histogram'}; {'id': '41', 'type': 'argument_list', 'children': []}; {'id': '42', 'type': 'for_statement', 'children': ['43', '47', '55']}; {'id': '43', 'type': 'pattern_list', 'children': ['44', '45', '46']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'mask'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'iterperiods'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'keyword_argument', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '54', 'type': 'True', 'children': []}; {'id': '55', 'type': 'block', 'children': ['56']}; {'id': '56', 'type': 'for_statement', 'children': ['57', '61', '68']}; {'id': '57', 'type': 'pattern_list', 'children': ['58', '59', '60']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 't0'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 't1'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '61', 'type': 'call', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'iterperiods'}; {'id': '65', 'type': 'argument_list', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '68', 'type': 'block', 'children': ['69', '83']}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'assignment', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'duration'}; {'id': '72', 'type': 'call', 'children': ['73', '76']}; {'id': '73', 'type': 'attribute', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'utils'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'duration_to_number'}; {'id': '76', 'type': 'argument_list', 'children': ['77', '80']}; {'id': '77', 'type': 'binary_operator', 'children': ['78', '79'], 'value': '-'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 't1'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 't0'}; {'id': '80', 'type': 'keyword_argument', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'units'}; {'id': '82', 'type': 'string', 'children': [], 'value': "'seconds'"}; {'id': '83', 'type': 'try_statement', 'children': ['84', '91']}; {'id': '84', 'type': 'block', 'children': ['85']}; {'id': '85', 'type': 'expression_statement', 'children': ['86']}; {'id': '86', 'type': 'augmented_assignment', 'children': ['87', '90'], 'value': '+='}; {'id': '87', 'type': 'subscript', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'counter'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'duration'}; {'id': '91', 'type': 'except_clause', 'children': ['92', '98']}; {'id': '92', 'type': 'as_pattern', 'children': ['93', '96']}; {'id': '93', 'type': 'attribute', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'histogram'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'UnorderableElements'}; {'id': '96', 'type': 'as_pattern_target', 'children': ['97']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '98', 'type': 'block', 'children': ['99', '116']}; {'id': '99', 'type': 'expression_statement', 'children': ['100']}; {'id': '100', 'type': 'assignment', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'counter'}; {'id': '102', 'type': 'call', 'children': ['103', '108']}; {'id': '103', 'type': 'attribute', 'children': ['104', '107']}; {'id': '104', 'type': 'attribute', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'histogram'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'Histogram'}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'from_dict'}; {'id': '108', 'type': 'argument_list', 'children': ['109', '113']}; {'id': '109', 'type': 'call', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '111', 'type': 'argument_list', 'children': ['112']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'counter'}; {'id': '113', 'type': 'keyword_argument', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'hash'}; {'id': '116', 'type': 'expression_statement', 'children': ['117']}; {'id': '117', 'type': 'augmented_assignment', 'children': ['118', '121'], 'value': '+='}; {'id': '118', 'type': 'subscript', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'counter'}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'value'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'duration'}; {'id': '122', 'type': 'if_statement', 'children': ['123', '124', '131']}; {'id': '123', 'type': 'identifier', 'children': [], 'value': 'normalized'}; {'id': '124', 'type': 'block', 'children': ['125']}; {'id': '125', 'type': 'return_statement', 'children': ['126']}; {'id': '126', 'type': 'call', 'children': ['127', '130']}; {'id': '127', 'type': 'attribute', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'counter'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'normalized'}; {'id': '130', 'type': 'argument_list', 'children': []}; {'id': '131', 'type': 'else_clause', 'children': ['132']}; {'id': '132', 'type': 'block', 'children': ['133']}; {'id': '133', 'type': 'return_statement', 'children': ['134']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'counter'}
|
Calculate the distribution of values over the given time range from
`start` to `end`.
Args:
start (orderable, optional): The lower time bound of
when to calculate the distribution. By default, the
first time point will be used.
end (orderable, optional): The upper time bound of
when to calculate the distribution. By default, the
last time point will be used.
normalized (bool): If True, distribution will sum to
one. If False and the time values of the TimeSeries
are datetimes, the units will be seconds.
mask (:obj:`TimeSeries`, optional): A
domain on which to calculate the distribution.
Returns:
:obj:`Histogram` with the results.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'query'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'design'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'use_devmode'}; {'id': '9', 'type': 'False', 'children': []}; {'id': '10', 'type': 'dictionary_splat_pattern', 'children': ['11']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '12', 'type': 'block', 'children': ['13', '23', '33']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'design'}; {'id': '16', 'type': 'call', 'children': ['17', '20']}; {'id': '17', 'type': 'attribute', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_mk_devmode'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'design'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'use_devmode'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'itercls'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '32']}; {'id': '31', 'type': 'string', 'children': [], 'value': "'itercls'"}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'View'}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'itercls'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '38', '39', '40']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'design'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '40', 'type': 'dictionary_splat', 'children': ['41']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'kwargs'}
|
Query a pre-defined MapReduce view, passing parameters.
This method executes a view on the cluster. It accepts various
parameters for the view and returns an iterable object
(specifically, a :class:`~.View`).
:param string design: The design document
:param string view: The view function contained within the design
document
:param boolean use_devmode: Whether the view name should be
transformed into a development-mode view. See documentation
on :meth:`~.BucketManager.design_create` for more
explanation.
:param kwargs: Extra arguments passed to the :class:`~.View`
object constructor.
:param kwargs: Additional parameters passed to the
:class:`~.View` constructor. See that class'
documentation for accepted parameters.
.. seealso::
:class:`~.View`
contains more extensive documentation and examples
:class:`couchbase.views.params.Query`
contains documentation on the available query options
:class:`~.SpatialQuery`
contains documentation on the available query options
for Geospatial views.
.. note::
To query a spatial view, you must explicitly use the
:class:`.SpatialQuery`. Passing key-value view parameters
in ``kwargs`` is not supported for spatial views.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_container_names'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '17']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'current_containers'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'containers'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'keyword_argument', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'all'}; {'id': '16', 'type': 'True', 'children': []}; {'id': '17', 'type': 'return_statement', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '20', 'type': 'generator_expression', 'children': ['21', '26', '29']}; {'id': '21', 'type': 'subscript', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'c_name'}; {'id': '23', 'type': 'slice', 'children': ['24', '25']}; {'id': '24', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '25', 'type': 'colon', 'children': []}; {'id': '26', 'type': 'for_in_clause', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'current_containers'}; {'id': '29', 'type': 'for_in_clause', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'c_name'}; {'id': '31', 'type': 'subscript', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'c'}; {'id': '33', 'type': 'string', 'children': [], 'value': "'Names'"}
|
Fetches names of all present containers from Docker.
:return: All container names.
:rtype: set
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'search_index_simple'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'search_term'}; {'id': '8', 'type': 'block', 'children': ['9', '15', '30', '39']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'session'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '18', 'type': 'binary_operator', 'children': ['19', '20'], 'value': '%'}; {'id': '19', 'type': 'string', 'children': [], 'value': "'http://%s:%s/%s/_search?q=%s:%s'"}; {'id': '20', 'type': 'tuple', 'children': ['21', '24', '27', '28', '29']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'host'}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'port'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'search_term'}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'response'}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'request'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '37', 'type': 'argument_list', 'children': ['38']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '39', 'type': 'return_statement', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'response'}
|
Search the index using a simple key and search_term
@param index Name of the index
@param key Search Key
@param search_term The term to be searched for
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'cls_get_by_name'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '6', 'type': 'block', 'children': ['7']}; {'id': '7', 'type': 'try_statement', 'children': ['8', '17', '84']}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '17', 'type': 'except_clause', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'AttributeError'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'for_statement', 'children': ['21', '22', '38', '69']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '22', 'type': 'generator_expression', 'children': ['23', '24', '30']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '24', 'type': 'for_in_clause', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '26', 'type': 'call', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'dir'}; {'id': '28', 'type': 'argument_list', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '30', 'type': 'if_clause', 'children': ['31']}; {'id': '31', 'type': 'not_operator', 'children': ['32']}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '36', 'type': 'argument_list', 'children': ['37']}; {'id': '37', 'type': 'string', 'children': [], 'value': "'_'"}; {'id': '38', 'type': 'block', 'children': ['39', '53', '62']}; {'id': '39', 'type': 'try_statement', 'children': ['40', '49']}; {'id': '40', 'type': 'block', 'children': ['41']}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'assignment', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '44', 'type': 'call', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '46', 'type': 'argument_list', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'attr'}; {'id': '49', 'type': 'except_clause', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'AttributeError'}; {'id': '51', 'type': 'block', 'children': ['52']}; {'id': '52', 'type': 'continue_statement', 'children': []}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'assignment', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'valname'}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'getattr'}; {'id': '58', 'type': 'argument_list', 'children': ['59', '60', '61']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '60', 'type': 'string', 'children': [], 'value': "'name'"}; {'id': '61', 'type': 'None', 'children': []}; {'id': '62', 'type': 'if_statement', 'children': ['63', '66']}; {'id': '63', 'type': 'comparison_operator', 'children': ['64', '65'], 'value': '=='}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'valname'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '66', 'type': 'block', 'children': ['67']}; {'id': '67', 'type': 'return_statement', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'val'}; {'id': '69', 'type': 'else_clause', 'children': ['70']}; {'id': '70', 'type': 'block', 'children': ['71']}; {'id': '71', 'type': 'raise_statement', 'children': ['72']}; {'id': '72', 'type': 'call', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'call', 'children': ['76', '79']}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'string', 'children': [], 'value': "'No {} with that name: {}'"}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '79', 'type': 'argument_list', 'children': ['80', '83']}; {'id': '80', 'type': 'attribute', 'children': ['81', '82']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'cls'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': '__name__'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '84', 'type': 'else_clause', 'children': ['85']}; {'id': '85', 'type': 'block', 'children': ['86']}; {'id': '86', 'type': 'return_statement', 'children': ['87']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'val'}
|
Return a class attribute by searching the attributes `name` attribute.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'login_service_description'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '14', '32', '53', '67', '81']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '9', 'type': 'binary_operator', 'children': ['10', '11'], 'value': '+'}; {'id': '10', 'type': 'string', 'children': [], 'value': "'Login to '"}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '14', 'type': 'if_statement', 'children': ['15', '19']}; {'id': '15', 'type': '()', 'children': ['16']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'auth_type'}; {'id': '19', 'type': 'block', 'children': ['20']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '23', 'type': 'binary_operator', 'children': ['24', '31'], 'value': '+'}; {'id': '24', 'type': 'binary_operator', 'children': ['25', '28'], 'value': '+'}; {'id': '25', 'type': 'binary_operator', 'children': ['26', '27'], 'value': '+'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '27', 'type': 'string', 'children': [], 'value': "' ('"}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'auth_type'}; {'id': '31', 'type': 'string', 'children': [], 'value': "')'"}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'desc'}; {'id': '35', 'type': 'dictionary', 'children': ['36', '41', '50']}; {'id': '36', 'type': 'pair', 'children': ['37', '38']}; {'id': '37', 'type': 'string', 'children': [], 'value': '"@id"'}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'login_uri'}; {'id': '41', 'type': 'pair', 'children': ['42', '43']}; {'id': '42', 'type': 'string', 'children': [], 'value': '"profile"'}; {'id': '43', 'type': 'binary_operator', 'children': ['44', '47'], 'value': '+'}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'profile_base'}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'auth_pattern'}; {'id': '50', 'type': 'pair', 'children': ['51', '52']}; {'id': '51', 'type': 'string', 'children': [], 'value': '"label"'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'label'}; {'id': '53', 'type': 'if_statement', 'children': ['54', '58']}; {'id': '54', 'type': '()', 'children': ['55']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'header'}; {'id': '58', 'type': 'block', 'children': ['59']}; {'id': '59', 'type': 'expression_statement', 'children': ['60']}; {'id': '60', 'type': 'assignment', 'children': ['61', '64']}; {'id': '61', 'type': 'subscript', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'desc'}; {'id': '63', 'type': 'string', 'children': [], 'value': "'header'"}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'header'}; {'id': '67', 'type': 'if_statement', 'children': ['68', '72']}; {'id': '68', 'type': '()', 'children': ['69']}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'description'}; {'id': '72', 'type': 'block', 'children': ['73']}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'assignment', 'children': ['75', '78']}; {'id': '75', 'type': 'subscript', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'desc'}; {'id': '77', 'type': 'string', 'children': [], 'value': "'description'"}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'description'}; {'id': '81', 'type': 'return_statement', 'children': ['82']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'desc'}
|
Login service description.
The login service description _MUST_ include the token service
description. The authentication pattern is indicated via the
profile URI which is built using self.auth_pattern.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'compute_nats_and_bits_per_dim'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'data_dim'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'latent_dim'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'average_reconstruction'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'average_prior'}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'with_statement', 'children': ['10', '21']}; {'id': '10', 'type': 'with_clause', 'children': ['11']}; {'id': '11', 'type': 'with_item', 'children': ['12']}; {'id': '12', 'type': 'call', 'children': ['13', '16']}; {'id': '13', 'type': 'attribute', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'name_scope'}; {'id': '16', 'type': 'argument_list', 'children': ['17', '18']}; {'id': '17', 'type': 'None', 'children': []}; {'id': '18', 'type': 'keyword_argument', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'default_name'}; {'id': '20', 'type': 'string', 'children': [], 'value': '"compute_nats_per_dim"'}; {'id': '21', 'type': 'block', 'children': ['22', '34', '46', '52', '58', '64', '77', '95']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'data_dim'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'cast'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'data_dim'}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'average_reconstruction'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'latent_dim'}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'cast'}; {'id': '41', 'type': 'argument_list', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'latent_dim'}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'average_prior'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'dtype'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'negative_log_likelihood'}; {'id': '49', 'type': 'binary_operator', 'children': ['50', '51'], 'value': '*'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'data_dim'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'average_reconstruction'}; {'id': '52', 'type': 'expression_statement', 'children': ['53']}; {'id': '53', 'type': 'assignment', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'negative_log_prior'}; {'id': '55', 'type': 'binary_operator', 'children': ['56', '57'], 'value': '*'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'latent_dim'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'average_prior'}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'assignment', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'negative_elbo'}; {'id': '61', 'type': 'binary_operator', 'children': ['62', '63'], 'value': '+'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'negative_log_likelihood'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'negative_log_prior'}; {'id': '64', 'type': 'expression_statement', 'children': ['65']}; {'id': '65', 'type': 'assignment', 'children': ['66', '67']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'nats_per_dim'}; {'id': '67', 'type': 'call', 'children': ['68', '71']}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'divide'}; {'id': '71', 'type': 'argument_list', 'children': ['72', '73', '74']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'negative_elbo'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'data_dim'}; {'id': '74', 'type': 'keyword_argument', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '76', 'type': 'string', 'children': [], 'value': '"nats_per_dim"'}; {'id': '77', 'type': 'expression_statement', 'children': ['78']}; {'id': '78', 'type': 'assignment', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'bits_per_dim'}; {'id': '80', 'type': 'call', 'children': ['81', '84']}; {'id': '81', 'type': 'attribute', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'divide'}; {'id': '84', 'type': 'argument_list', 'children': ['85', '86', '92']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'nats_per_dim'}; {'id': '86', 'type': 'call', 'children': ['87', '90']}; {'id': '87', 'type': 'attribute', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'tf'}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'log'}; {'id': '90', 'type': 'argument_list', 'children': ['91']}; {'id': '91', 'type': 'float', 'children': [], 'value': '2.'}; {'id': '92', 'type': 'keyword_argument', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '94', 'type': 'string', 'children': [], 'value': '"bits_per_dim"'}; {'id': '95', 'type': 'return_statement', 'children': ['96']}; {'id': '96', 'type': 'expression_list', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'nats_per_dim'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'bits_per_dim'}
|
Computes negative ELBO, which is an upper bound on the negative likelihood.
Args:
data_dim: int-like indicating data dimensionality.
latent_dim: int-like indicating latent dimensionality.
average_reconstruction: Scalar Tensor indicating the reconstruction cost
averaged over all data dimensions and any data batches.
average_prior: Scalar Tensor indicating the negative log-prior probability
averaged over all latent dimensions and any data batches.
Returns:
Tuple of scalar Tensors, representing the nats and bits per data dimension
(e.g., subpixels) respectively.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sendContact'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'context'}; {'id': '7', 'type': 'dictionary', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9']}; {'id': '9', 'type': 'for_statement', 'children': ['10', '11', '14']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'recipient'}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'recipients'}; {'id': '14', 'type': 'block', 'children': ['15', '29']}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'call', 'children': ['17', '24']}; {'id': '17', 'type': 'attribute', 'children': ['18', '23']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'super'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'ContactFormMail'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': '__init__'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'recipient'}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'async'}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'sendEmail'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '36', '37']}; {'id': '35', 'type': 'string', 'children': [], 'value': "'contactForm'"}; {'id': '36', 'type': 'string', 'children': [], 'value': "'New contact form message'"}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'context'}
|
Send contact form message to single or multiple recipients
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_build_matches'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'matches'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'uuids'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'no_filtered'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'fastmode'}; {'id': '9', 'type': 'False', 'children': []}; {'id': '10', 'type': 'block', 'children': ['11', '15', '83', '87', '99', '103', '128']}; {'id': '11', 'type': 'expression_statement', 'children': ['12']}; {'id': '12', 'type': 'assignment', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '14', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '15', 'type': 'for_statement', 'children': ['16', '17', '18']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'matches'}; {'id': '18', 'type': 'block', 'children': ['19', '33', '40', '76']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'mk'}; {'id': '22', 'type': 'conditional_expression', 'children': ['23', '28', '30'], 'value': 'if'}; {'id': '23', 'type': 'attribute', 'children': ['24', '27']}; {'id': '24', 'type': 'subscript', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '26', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'uuid'}; {'id': '28', 'type': 'not_operator', 'children': ['29']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'fastmode'}; {'id': '30', 'type': 'subscript', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '32', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'subset'}; {'id': '36', 'type': 'list', 'children': ['37'], 'value': '[uuids[mk]]'}; {'id': '37', 'type': 'subscript', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'uuids'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'mk'}; {'id': '40', 'type': 'for_statement', 'children': ['41', '42', '47']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'id_'}; {'id': '42', 'type': 'subscript', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'm'}; {'id': '44', 'type': 'slice', 'children': ['45', '46']}; {'id': '45', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '46', 'type': 'colon', 'children': []}; {'id': '47', 'type': 'block', 'children': ['48', '58', '64']}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'uk'}; {'id': '51', 'type': 'conditional_expression', 'children': ['52', '55', '57'], 'value': 'if'}; {'id': '52', 'type': 'attribute', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'id_'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'uuid'}; {'id': '55', 'type': 'not_operator', 'children': ['56']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'fastmode'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'id_'}; {'id': '58', 'type': 'expression_statement', 'children': ['59']}; {'id': '59', 'type': 'assignment', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'u'}; {'id': '61', 'type': 'subscript', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'uuids'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'uk'}; {'id': '64', 'type': 'if_statement', 'children': ['65', '68']}; {'id': '65', 'type': 'comparison_operator', 'children': ['66', '67'], 'value': 'not in'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'u'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'subset'}; {'id': '68', 'type': 'block', 'children': ['69']}; {'id': '69', 'type': 'expression_statement', 'children': ['70']}; {'id': '70', 'type': 'call', 'children': ['71', '74']}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'subset'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '74', 'type': 'argument_list', 'children': ['75']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'u'}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'call', 'children': ['78', '81']}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '81', 'type': 'argument_list', 'children': ['82']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'subset'}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'augmented_assignment', 'children': ['85', '86'], 'value': '+='}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'no_filtered'}; {'id': '87', 'type': 'expression_statement', 'children': ['88']}; {'id': '88', 'type': 'call', 'children': ['89', '92']}; {'id': '89', 'type': 'attribute', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '92', 'type': 'argument_list', 'children': ['93', '96']}; {'id': '93', 'type': 'keyword_argument', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '96', 'type': 'keyword_argument', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'reverse'}; {'id': '98', 'type': 'True', 'children': []}; {'id': '99', 'type': 'expression_statement', 'children': ['100']}; {'id': '100', 'type': 'assignment', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'sresult'}; {'id': '102', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '103', 'type': 'for_statement', 'children': ['104', '105', '106']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '106', 'type': 'block', 'children': ['107', '121']}; {'id': '107', 'type': 'expression_statement', 'children': ['108']}; {'id': '108', 'type': 'call', 'children': ['109', '112']}; {'id': '109', 'type': 'attribute', 'children': ['110', '111']}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '112', 'type': 'argument_list', 'children': ['113']}; {'id': '113', 'type': 'keyword_argument', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '115', 'type': 'lambda', 'children': ['116', '118']}; {'id': '116', 'type': 'lambda_parameters', 'children': ['117']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'id_'}; {'id': '118', 'type': 'attribute', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'id_'}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'uuid'}; {'id': '121', 'type': 'expression_statement', 'children': ['122']}; {'id': '122', 'type': 'call', 'children': ['123', '126']}; {'id': '123', 'type': 'attribute', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'sresult'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '126', 'type': 'argument_list', 'children': ['127']}; {'id': '127', 'type': 'identifier', 'children': [], 'value': 'r'}; {'id': '128', 'type': 'return_statement', 'children': ['129']}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'sresult'}
|
Build a list with matching subsets
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'has_adjacent_leaves_only'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '14', '55']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'leaves'}; {'id': '9', 'type': 'call', 'children': ['10', '13']}; {'id': '10', 'type': 'attribute', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'leaves'}; {'id': '13', 'type': 'argument_list', 'children': []}; {'id': '14', 'type': 'for_statement', 'children': ['15', '16', '25']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '16', 'type': 'call', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'binary_operator', 'children': ['20', '24'], 'value': '-'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '22', 'type': 'argument_list', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'leaves'}; {'id': '24', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '25', 'type': 'block', 'children': ['26', '34', '44']}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'current_interval'}; {'id': '29', 'type': 'attribute', 'children': ['30', '33']}; {'id': '30', 'type': 'subscript', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'leaves'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'interval'}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'next_interval'}; {'id': '37', 'type': 'attribute', 'children': ['38', '43']}; {'id': '38', 'type': 'subscript', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'leaves'}; {'id': '40', 'type': 'binary_operator', 'children': ['41', '42'], 'value': '+'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'i'}; {'id': '42', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'interval'}; {'id': '44', 'type': 'if_statement', 'children': ['45', '52']}; {'id': '45', 'type': 'not_operator', 'children': ['46']}; {'id': '46', 'type': 'call', 'children': ['47', '50']}; {'id': '47', 'type': 'attribute', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'current_interval'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'is_adjacent_before'}; {'id': '50', 'type': 'argument_list', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'next_interval'}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'return_statement', 'children': ['54']}; {'id': '54', 'type': 'False', 'children': []}; {'id': '55', 'type': 'return_statement', 'children': ['56']}; {'id': '56', 'type': 'True', 'children': []}
|
Return ``True`` if the sync map fragments
which are the leaves of the sync map tree
are all adjacent.
:rtype: bool
.. versionadded:: 1.7.0
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'define_zip_index_for_species'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'names_ppn_world'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'number_names_ppn_world'}; {'id': '6', 'type': 'block', 'children': ['7', '9', '13']}; {'id': '7', 'type': 'global_statement', 'children': ['8']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'cl'}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'cl'}; {'id': '12', 'type': 'dictionary', 'children': []}; {'id': '13', 'type': 'for_statement', 'children': ['14', '17', '22']}; {'id': '14', 'type': 'pattern_list', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'b'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'zip'}; {'id': '19', 'type': 'argument_list', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'names_ppn_world'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'number_names_ppn_world'}; {'id': '22', 'type': 'block', 'children': ['23']}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '28']}; {'id': '25', 'type': 'subscript', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'cl'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'a'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'b'}
|
This just give back cl, that is the original index as it is read from files from a data file.
|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'send_msg_multi'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'profile'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'recipients'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'rooms'}; {'id': '11', 'type': 'None', 'children': []}; {'id': '12', 'type': 'block', 'children': ['13', '29', '46', '50', '62', '74', '83', '98', '116', '122', '130']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '16', 'type': 'dictionary', 'children': ['17', '20', '23', '26']}; {'id': '17', 'type': 'pair', 'children': ['18', '19']}; {'id': '18', 'type': 'string', 'children': [], 'value': "'name'"}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '20', 'type': 'pair', 'children': ['21', '22']}; {'id': '21', 'type': 'string', 'children': [], 'value': "'changes'"}; {'id': '22', 'type': 'dictionary', 'children': []}; {'id': '23', 'type': 'pair', 'children': ['24', '25']}; {'id': '24', 'type': 'string', 'children': [], 'value': "'result'"}; {'id': '25', 'type': 'None', 'children': []}; {'id': '26', 'type': 'pair', 'children': ['27', '28']}; {'id': '27', 'type': 'string', 'children': [], 'value': "'comment'"}; {'id': '28', 'type': 'string', 'children': [], 'value': "''"}; {'id': '29', 'type': 'if_statement', 'children': ['30', '37']}; {'id': '30', 'type': 'boolean_operator', 'children': ['31', '34'], 'value': 'and'}; {'id': '31', 'type': 'comparison_operator', 'children': ['32', '33'], 'value': 'is'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'recipients'}; {'id': '33', 'type': 'None', 'children': []}; {'id': '34', 'type': 'comparison_operator', 'children': ['35', '36'], 'value': 'is'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'rooms'}; {'id': '36', 'type': 'None', 'children': []}; {'id': '37', 'type': 'block', 'children': ['38', '44']}; {'id': '38', 'type': 'expression_statement', 'children': ['39']}; {'id': '39', 'type': 'assignment', 'children': ['40', '43']}; {'id': '40', 'type': 'subscript', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '42', 'type': 'string', 'children': [], 'value': "'comment'"}; {'id': '43', 'type': 'string', 'children': [], 'value': '"Recipients and rooms are empty, no need to send"'}; {'id': '44', 'type': 'return_statement', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '49', 'type': 'string', 'children': [], 'value': "''"}; {'id': '50', 'type': 'if_statement', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'recipients'}; {'id': '52', 'type': 'block', 'children': ['53']}; {'id': '53', 'type': 'expression_statement', 'children': ['54']}; {'id': '54', 'type': 'augmented_assignment', 'children': ['55', '56'], 'value': '+='}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '56', 'type': 'call', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'string', 'children': [], 'value': "' users {0}'"}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'recipients'}; {'id': '62', 'type': 'if_statement', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'rooms'}; {'id': '64', 'type': 'block', 'children': ['65']}; {'id': '65', 'type': 'expression_statement', 'children': ['66']}; {'id': '66', 'type': 'augmented_assignment', 'children': ['67', '68'], 'value': '+='}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '68', 'type': 'call', 'children': ['69', '72']}; {'id': '69', 'type': 'attribute', 'children': ['70', '71']}; {'id': '70', 'type': 'string', 'children': [], 'value': "' rooms {0}'"}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '72', 'type': 'argument_list', 'children': ['73']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'rooms'}; {'id': '74', 'type': 'expression_statement', 'children': ['75']}; {'id': '75', 'type': 'augmented_assignment', 'children': ['76', '77'], 'value': '+='}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '77', 'type': 'call', 'children': ['78', '81']}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'string', 'children': [], 'value': "', message: {0}'"}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '81', 'type': 'argument_list', 'children': ['82']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '83', 'type': 'if_statement', 'children': ['84', '87']}; {'id': '84', 'type': 'subscript', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': '__opts__'}; {'id': '86', 'type': 'string', 'children': [], 'value': "'test'"}; {'id': '87', 'type': 'block', 'children': ['88', '96']}; {'id': '88', 'type': 'expression_statement', 'children': ['89']}; {'id': '89', 'type': 'assignment', 'children': ['90', '93']}; {'id': '90', 'type': 'subscript', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '92', 'type': 'string', 'children': [], 'value': "'comment'"}; {'id': '93', 'type': 'binary_operator', 'children': ['94', '95'], 'value': '+'}; {'id': '94', 'type': 'string', 'children': [], 'value': "'Need to send'"}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '96', 'type': 'return_statement', 'children': ['97']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '98', 'type': 'expression_statement', 'children': ['99']}; {'id': '99', 'type': 'call', 'children': ['100', '103']}; {'id': '100', 'type': 'subscript', 'children': ['101', '102']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': '__salt__'}; {'id': '102', 'type': 'string', 'children': [], 'value': "'xmpp.send_msg_multi'"}; {'id': '103', 'type': 'argument_list', 'children': ['104', '107', '110', '113']}; {'id': '104', 'type': 'keyword_argument', 'children': ['105', '106']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'message'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '107', 'type': 'keyword_argument', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'recipients'}; {'id': '109', 'type': 'identifier', 'children': [], 'value': 'recipients'}; {'id': '110', 'type': 'keyword_argument', 'children': ['111', '112']}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'rooms'}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'rooms'}; {'id': '113', 'type': 'keyword_argument', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'profile'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'profile'}; {'id': '116', 'type': 'expression_statement', 'children': ['117']}; {'id': '117', 'type': 'assignment', 'children': ['118', '121']}; {'id': '118', 'type': 'subscript', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '120', 'type': 'string', 'children': [], 'value': "'result'"}; {'id': '121', 'type': 'True', 'children': []}; {'id': '122', 'type': 'expression_statement', 'children': ['123']}; {'id': '123', 'type': 'assignment', 'children': ['124', '127']}; {'id': '124', 'type': 'subscript', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'ret'}; {'id': '126', 'type': 'string', 'children': [], 'value': "'comment'"}; {'id': '127', 'type': 'binary_operator', 'children': ['128', '129'], 'value': '+'}; {'id': '128', 'type': 'string', 'children': [], 'value': "'Sent message to'"}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'comment'}; {'id': '130', 'type': 'return_statement', 'children': ['131']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'ret'}
|
Send a message to an list of recipients or rooms
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'
- profile: my-xmpp-account
- recipients:
- [email protected]/salt
- rooms:
- [email protected]
name
The message to send to the XMPP user
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.