body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
6d696bf079093eec1bd87ef0ace66a0024ea838d2c8f7ab543ae557c166b4426 | def _inception(model_path, **kwargs):
'Constructs a ResNet-18 model.\n\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n '
model = InceptionI3d(400, in_channels=3)
if (model_path == ''):
return model
params = torch.load(model_path)
model.load_state_... | Constructs a ResNet-18 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | models/rgb_I3D.py | _inception | victor-gui/LateTemporalModeling3DCNN | 144 | python | def _inception(model_path, **kwargs):
'Constructs a ResNet-18 model.\n\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n '
model = InceptionI3d(400, in_channels=3)
if (model_path == ):
return model
params = torch.load(model_path)
model.load_state_di... | def _inception(model_path, **kwargs):
'Constructs a ResNet-18 model.\n\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n '
model = InceptionI3d(400, in_channels=3)
if (model_path == ):
return model
params = torch.load(model_path)
model.load_state_di... |
495e9478cb812190101f01ab53a3ee067bf110ada5784cfedd784480079fe2ac | def _inception_flow(model_path, **kwargs):
'Constructs a ResNet-18 model.\n\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n '
model = InceptionI3d(400, in_channels=2)
if (model_path == ''):
return model
params = torch.load(model_path)
model.load_s... | Constructs a ResNet-18 model.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet | models/rgb_I3D.py | _inception_flow | victor-gui/LateTemporalModeling3DCNN | 144 | python | def _inception_flow(model_path, **kwargs):
'Constructs a ResNet-18 model.\n\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n '
model = InceptionI3d(400, in_channels=2)
if (model_path == ):
return model
params = torch.load(model_path)
model.load_sta... | def _inception_flow(model_path, **kwargs):
'Constructs a ResNet-18 model.\n\n Args:\n pretrained (bool): If True, returns a model pre-trained on ImageNet\n '
model = InceptionI3d(400, in_channels=2)
if (model_path == ):
return model
params = torch.load(model_path)
model.load_sta... |
b9c3d149a5806708606392c77eb42ae986078bd06843aae8240fe20321f20414 | def __init__(self, in_channels, output_channels, kernel_shape=(1, 1, 1), stride=(1, 1, 1), padding=0, activation_fn=F.relu, use_batch_norm=True, use_bias=False, name='unit_3d'):
'Initializes Unit3D module.'
super(Unit3D, self).__init__()
self._output_channels = output_channels
self._kernel_shape = kerne... | Initializes Unit3D module. | models/rgb_I3D.py | __init__ | victor-gui/LateTemporalModeling3DCNN | 144 | python | def __init__(self, in_channels, output_channels, kernel_shape=(1, 1, 1), stride=(1, 1, 1), padding=0, activation_fn=F.relu, use_batch_norm=True, use_bias=False, name='unit_3d'):
super(Unit3D, self).__init__()
self._output_channels = output_channels
self._kernel_shape = kernel_shape
self._stride = s... | def __init__(self, in_channels, output_channels, kernel_shape=(1, 1, 1), stride=(1, 1, 1), padding=0, activation_fn=F.relu, use_batch_norm=True, use_bias=False, name='unit_3d'):
super(Unit3D, self).__init__()
self._output_channels = output_channels
self._kernel_shape = kernel_shape
self._stride = s... |
569356b609e7aa39a47b7b3e64f31f4f0054e6156a0f8eafc54077cd16887f27 | def __init__(self, num_classes=400, spatial_squeeze=True, final_endpoint='Logits', name='inception_i3d', in_channels=3, dropout_keep_prob=0.5):
"Initializes I3D model instance.\n Args:\n num_classes: The number of outputs in the logit layer (default 400, which\n matches the Kinetics dat... | Initializes I3D model instance.
Args:
num_classes: The number of outputs in the logit layer (default 400, which
matches the Kinetics dataset).
spatial_squeeze: Whether to squeeze the spatial dimensions for the logits
before returning (default True).
final_endpoint: The model contains many possible end... | models/rgb_I3D.py | __init__ | victor-gui/LateTemporalModeling3DCNN | 144 | python | def __init__(self, num_classes=400, spatial_squeeze=True, final_endpoint='Logits', name='inception_i3d', in_channels=3, dropout_keep_prob=0.5):
"Initializes I3D model instance.\n Args:\n num_classes: The number of outputs in the logit layer (default 400, which\n matches the Kinetics dat... | def __init__(self, num_classes=400, spatial_squeeze=True, final_endpoint='Logits', name='inception_i3d', in_channels=3, dropout_keep_prob=0.5):
"Initializes I3D model instance.\n Args:\n num_classes: The number of outputs in the logit layer (default 400, which\n matches the Kinetics dat... |
31ca0c4bb06d2e46a6935908a57f3090dc69bb2f33115b7767d7fd18e0c9821e | def is_clockwise(x_triads, y_triads):
'Returns boolean array which tells whether the three points in 2D plane given by x_triads & y_triads are\n oriented clockwise. https://en.wikipedia.org/wiki/Curve_orientation#Orientation_of_a_simple_polygon\n\n Parameters\n ----------\n x_triads, y_triads : np.ndarr... | Returns boolean array which tells whether the three points in 2D plane given by x_triads & y_triads are
oriented clockwise. https://en.wikipedia.org/wiki/Curve_orientation#Orientation_of_a_simple_polygon
Parameters
----------
x_triads, y_triads : np.ndarray
Array of 2D coordinates for triangles in a plane
Returns... | src/matching/utils.py | is_clockwise | wdoppenberg/crater-detection | 8 | python | def is_clockwise(x_triads, y_triads):
'Returns boolean array which tells whether the three points in 2D plane given by x_triads & y_triads are\n oriented clockwise. https://en.wikipedia.org/wiki/Curve_orientation#Orientation_of_a_simple_polygon\n\n Parameters\n ----------\n x_triads, y_triads : np.ndarr... | def is_clockwise(x_triads, y_triads):
'Returns boolean array which tells whether the three points in 2D plane given by x_triads & y_triads are\n oriented clockwise. https://en.wikipedia.org/wiki/Curve_orientation#Orientation_of_a_simple_polygon\n\n Parameters\n ----------\n x_triads, y_triads : np.ndarr... |
2aea27e609fd5b333797650683c23c65eb8e22f2f9e279c37e6170bae3d735de | def cyclic_permutations(it, step=1):
'Returns cyclic permutations for iterable.\n\n Parameters\n ----------\n it : iterable object\n step : int, optional\n\n Yields\n -------\n Cyclic permutation of it\n '
(yield it)
for k in range(step, len(it), step):
if isinstance(it, list... | Returns cyclic permutations for iterable.
Parameters
----------
it : iterable object
step : int, optional
Yields
-------
Cyclic permutation of it | src/matching/utils.py | cyclic_permutations | wdoppenberg/crater-detection | 8 | python | def cyclic_permutations(it, step=1):
'Returns cyclic permutations for iterable.\n\n Parameters\n ----------\n it : iterable object\n step : int, optional\n\n Yields\n -------\n Cyclic permutation of it\n '
(yield it)
for k in range(step, len(it), step):
if isinstance(it, list... | def cyclic_permutations(it, step=1):
'Returns cyclic permutations for iterable.\n\n Parameters\n ----------\n it : iterable object\n step : int, optional\n\n Yields\n -------\n Cyclic permutation of it\n '
(yield it)
for k in range(step, len(it), step):
if isinstance(it, list... |
9235841bae929892ed9b560a7e931404f3df9c884e7014cfc22851bc803abd77 | def get_cliques_by_length(G, length_clique):
' Return the list of all cliques in an undirected graph G with length\n equal to length_clique. '
cliques = []
for c in nx.enumerate_all_cliques(G):
if (len(c) <= length_clique):
if (len(c) == length_clique):
cliques.append(... | Return the list of all cliques in an undirected graph G with length
equal to length_clique. | src/matching/utils.py | get_cliques_by_length | wdoppenberg/crater-detection | 8 | python | def get_cliques_by_length(G, length_clique):
' Return the list of all cliques in an undirected graph G with length\n equal to length_clique. '
cliques = []
for c in nx.enumerate_all_cliques(G):
if (len(c) <= length_clique):
if (len(c) == length_clique):
cliques.append(... | def get_cliques_by_length(G, length_clique):
' Return the list of all cliques in an undirected graph G with length\n equal to length_clique. '
cliques = []
for c in nx.enumerate_all_cliques(G):
if (len(c) <= length_clique):
if (len(c) == length_clique):
cliques.append(... |
86de9b1a039ba9be8ad35b9b59d57578d4e5300a36cdfbf15ee2827163bea362 | def latlong2cartesian(lat, long, alt=0, rad=1737.1):
'\n Calculate Cartesian coordinates from latitude + longitude information\n '
f = (1.0 / 825.0)
ls = np.arctan((((1 - f) ** 2) * np.tan(lat)))
x = (((rad * np.cos(ls)) * np.cos(long)) + ((alt * np.cos(lat)) * np.cos(long)))
y = (((rad * np.c... | Calculate Cartesian coordinates from latitude + longitude information | src/matching/utils.py | latlong2cartesian | wdoppenberg/crater-detection | 8 | python | def latlong2cartesian(lat, long, alt=0, rad=1737.1):
'\n \n '
f = (1.0 / 825.0)
ls = np.arctan((((1 - f) ** 2) * np.tan(lat)))
x = (((rad * np.cos(ls)) * np.cos(long)) + ((alt * np.cos(lat)) * np.cos(long)))
y = (((rad * np.cos(ls)) * np.sin(long)) + ((alt * np.cos(lat)) * np.sin(long)))
z... | def latlong2cartesian(lat, long, alt=0, rad=1737.1):
'\n \n '
f = (1.0 / 825.0)
ls = np.arctan((((1 - f) ** 2) * np.tan(lat)))
x = (((rad * np.cos(ls)) * np.cos(long)) + ((alt * np.cos(lat)) * np.cos(long)))
y = (((rad * np.cos(ls)) * np.sin(long)) + ((alt * np.cos(lat)) * np.sin(long)))
z... |
35d1653ab680874fb50594cf3275d80237d33c677e911a80429fecab418d3bb1 | @njit
def enhanced_pattern_shifting(n, start_n=0) -> Tuple[(int, int, int)]:
'Generator function returning next crater triad according to Enhanced Pattern Shifting Method [1].\n\n Parameters\n ----------\n n : int\n Number of detected instances.\n start_n: int\n Iteration to start from, us... | Generator function returning next crater triad according to Enhanced Pattern Shifting Method [1].
Parameters
----------
n : int
Number of detected instances.
start_n: int
Iteration to start from, useful for batch processing of triads.
Returns
-------
i, j, k : int
References
----------
.. [1] Arnas, D., Fial... | src/matching/utils.py | enhanced_pattern_shifting | wdoppenberg/crater-detection | 8 | python | @njit
def enhanced_pattern_shifting(n, start_n=0) -> Tuple[(int, int, int)]:
'Generator function returning next crater triad according to Enhanced Pattern Shifting Method [1].\n\n Parameters\n ----------\n n : int\n Number of detected instances.\n start_n: int\n Iteration to start from, us... | @njit
def enhanced_pattern_shifting(n, start_n=0) -> Tuple[(int, int, int)]:
'Generator function returning next crater triad according to Enhanced Pattern Shifting Method [1].\n\n Parameters\n ----------\n n : int\n Number of detected instances.\n start_n: int\n Iteration to start from, us... |
6c8e243967c37a061f1b6679d9efd34d08c4f54fd89eb7a4d4d877a5f19fce09 | def test_execution(self):
'Just checks that the visualizer at least runs without errors.'
self.result = self.plot(tree=self.tree, feature_table=self.table, sample_metadata=self.md, feature_metadata=self.fmd)
self.assertIsInstance(self.result, Results)
self.assertIsInstance(self.result.visualization, Vis... | Just checks that the visualizer at least runs without errors. | tests/python/test_integration.py | test_execution | sjanssen2/empress | 0 | python | def test_execution(self):
self.result = self.plot(tree=self.tree, feature_table=self.table, sample_metadata=self.md, feature_metadata=self.fmd)
self.assertIsInstance(self.result, Results)
self.assertIsInstance(self.result.visualization, Visualization) | def test_execution(self):
self.result = self.plot(tree=self.tree, feature_table=self.table, sample_metadata=self.md, feature_metadata=self.fmd)
self.assertIsInstance(self.result, Results)
self.assertIsInstance(self.result.visualization, Visualization)<|docstring|>Just checks that the visualizer at leas... |
2ff8482cd78e86a304617d476c63ba6882305400ccd22cb88ae0c2d26a2c5e31 | def _get_measure(self, measure):
"Execute a 'get' measure command.\n\n :param measure: The measure command to execute.\n :type measure: str\n\n :returns: A list with the result of the executed measure command.\n :rtype: list\n\n :raises SerialException, SerialTimeoutException: are... | Execute a 'get' measure command.
:param measure: The measure command to execute.
:type measure: str
:returns: A list with the result of the executed measure command.
:rtype: list
:raises SerialException, SerialTimeoutException: are raised if something
with the serial communication does not work.
:raises WireSTIn... | wire_st_sdk/iolink/iolink_sensor.py | _get_measure | STMicroelectronics/WireSTSDK_Python | 9 | python | def _get_measure(self, measure):
"Execute a 'get' measure command.\n\n :param measure: The measure command to execute.\n :type measure: str\n\n :returns: A list with the result of the executed measure command.\n :rtype: list\n\n :raises SerialException, SerialTimeoutException: are... | def _get_measure(self, measure):
"Execute a 'get' measure command.\n\n :param measure: The measure command to execute.\n :type measure: str\n\n :returns: A list with the result of the executed measure command.\n :rtype: list\n\n :raises SerialException, SerialTimeoutException: are... |
8925d3f42770b42eb893d89615e7d0726261bfd7b15801cc489cf81014f34758 | def _bytes_to_floats(self, data, precision=0):
'Converts an array of bytes to floating point numbers in Little Endian\n order (four bytes per number).\n\n :param data: Input array of bytes that contains the values to convert.\n :type data: str\n\n :param precision: Number of digits after... | Converts an array of bytes to floating point numbers in Little Endian
order (four bytes per number).
:param data: Input array of bytes that contains the values to convert.
:type data: str
:param precision: Number of digits after the decimal point.
:type precision: int
:returns: A list of floating point numbers.
:rty... | wire_st_sdk/iolink/iolink_sensor.py | _bytes_to_floats | STMicroelectronics/WireSTSDK_Python | 9 | python | def _bytes_to_floats(self, data, precision=0):
'Converts an array of bytes to floating point numbers in Little Endian\n order (four bytes per number).\n\n :param data: Input array of bytes that contains the values to convert.\n :type data: str\n\n :param precision: Number of digits after... | def _bytes_to_floats(self, data, precision=0):
'Converts an array of bytes to floating point numbers in Little Endian\n order (four bytes per number).\n\n :param data: Input array of bytes that contains the values to convert.\n :type data: str\n\n :param precision: Number of digits after... |
73e415dd36430349fefe5df75a340e053758c95d1644b6aafddbb47e1fe2fc6d | def get_env(self):
'Get environmental data.\n\n :returns: A list with Pressure [mbar], Humidity [%], and Temperature [C]\n values.\n :rtype: list\n\n :raises SerialException, SerialTimeoutException: are raised if something\n with the serial communication does not work.\n ... | Get environmental data.
:returns: A list with Pressure [mbar], Humidity [%], and Temperature [C]
values.
:rtype: list
:raises SerialException, SerialTimeoutException: are raised if something
with the serial communication does not work.
:raises WireSTInvalidOperationException: is raised if the command has
... | wire_st_sdk/iolink/iolink_sensor.py | get_env | STMicroelectronics/WireSTSDK_Python | 9 | python | def get_env(self):
'Get environmental data.\n\n :returns: A list with Pressure [mbar], Humidity [%], and Temperature [C]\n values.\n :rtype: list\n\n :raises SerialException, SerialTimeoutException: are raised if something\n with the serial communication does not work.\n ... | def get_env(self):
'Get environmental data.\n\n :returns: A list with Pressure [mbar], Humidity [%], and Temperature [C]\n values.\n :rtype: list\n\n :raises SerialException, SerialTimeoutException: are raised if something\n with the serial communication does not work.\n ... |
ae2607833f4d2d14a336dbfd729740014326b75bf0bd7c7347e78618bd23d523 | def get_tdm(self):
'Get time domain data.\n\n :returns: A two-elements list, with a list of RMS Speed values on X,Y,Z\n axes [mm/s] as the first element, and a list of Peak Acceleration\n values on X,Y,Z axes [m/s2] as the second element.\n :rtype: list\n\n :raises SerialE... | Get time domain data.
:returns: A two-elements list, with a list of RMS Speed values on X,Y,Z
axes [mm/s] as the first element, and a list of Peak Acceleration
values on X,Y,Z axes [m/s2] as the second element.
:rtype: list
:raises SerialException, SerialTimeoutException: are raised if something
with the ... | wire_st_sdk/iolink/iolink_sensor.py | get_tdm | STMicroelectronics/WireSTSDK_Python | 9 | python | def get_tdm(self):
'Get time domain data.\n\n :returns: A two-elements list, with a list of RMS Speed values on X,Y,Z\n axes [mm/s] as the first element, and a list of Peak Acceleration\n values on X,Y,Z axes [m/s2] as the second element.\n :rtype: list\n\n :raises SerialE... | def get_tdm(self):
'Get time domain data.\n\n :returns: A two-elements list, with a list of RMS Speed values on X,Y,Z\n axes [mm/s] as the first element, and a list of Peak Acceleration\n values on X,Y,Z axes [m/s2] as the second element.\n :rtype: list\n\n :raises SerialE... |
7be130c8404479aca54ca0e47c99cfb14115f26ac9eb0f67be7d54f098920957 | def get_fft(self):
'Get Fast Fourier Transform of vibration data.\n\n :returns: A n-elements list, with each element being a list of four\n values: the first is a frequency [Hz] and the other three are the\n corresponding vibration values on the three axis [m/s2].\n :rtype: list\... | Get Fast Fourier Transform of vibration data.
:returns: A n-elements list, with each element being a list of four
values: the first is a frequency [Hz] and the other three are the
corresponding vibration values on the three axis [m/s2].
:rtype: list
:raises SerialException, SerialTimeoutException: are raised ... | wire_st_sdk/iolink/iolink_sensor.py | get_fft | STMicroelectronics/WireSTSDK_Python | 9 | python | def get_fft(self):
'Get Fast Fourier Transform of vibration data.\n\n :returns: A n-elements list, with each element being a list of four\n values: the first is a frequency [Hz] and the other three are the\n corresponding vibration values on the three axis [m/s2].\n :rtype: list\... | def get_fft(self):
'Get Fast Fourier Transform of vibration data.\n\n :returns: A n-elements list, with each element being a list of four\n values: the first is a frequency [Hz] and the other three are the\n corresponding vibration values on the three axis [m/s2].\n :rtype: list\... |
9f930e063403e8f80c4e5bc5e934994108378d0db7c281c44541f0f28249547e | def _set_parameter(self, parameter, value):
"Execute a 'set' parameter command.\n\n :param parameter: The parameter command to execute.\n :type parameter: str\n\n :param value: The parameter value to set.\n :type value: str\n\n :returns: True if the parameter has been set correctl... | Execute a 'set' parameter command.
:param parameter: The parameter command to execute.
:type parameter: str
:param value: The parameter value to set.
:type value: str
:returns: True if the parameter has been set correctly, False otherwise.
:rtype: bool
:raises SerialException, SerialTimeoutException: are raised if ... | wire_st_sdk/iolink/iolink_sensor.py | _set_parameter | STMicroelectronics/WireSTSDK_Python | 9 | python | def _set_parameter(self, parameter, value):
"Execute a 'set' parameter command.\n\n :param parameter: The parameter command to execute.\n :type parameter: str\n\n :param value: The parameter value to set.\n :type value: str\n\n :returns: True if the parameter has been set correctl... | def _set_parameter(self, parameter, value):
"Execute a 'set' parameter command.\n\n :param parameter: The parameter command to execute.\n :type parameter: str\n\n :param value: The parameter value to set.\n :type value: str\n\n :returns: True if the parameter has been set correctl... |
55938d21e05be62ca87a99476be3046abcc315faba72f1fdbb9131a413f5206b | def set_odr(self, odr):
"Set accelerometer's output data rate.\n\n :param odr: Accelerometer's output data rate.\n :type odr: :class:`wire_st_sdk.iolink.iolink_protocol.ODR`\n\n :returns: True if the parameter has been set correctly, False otherwise.\n :rtype: bool\n\n :raises Ser... | Set accelerometer's output data rate.
:param odr: Accelerometer's output data rate.
:type odr: :class:`wire_st_sdk.iolink.iolink_protocol.ODR`
:returns: True if the parameter has been set correctly, False otherwise.
:rtype: bool
:raises SerialException, SerialTimeoutException: are raised if something
with the se... | wire_st_sdk/iolink/iolink_sensor.py | set_odr | STMicroelectronics/WireSTSDK_Python | 9 | python | def set_odr(self, odr):
"Set accelerometer's output data rate.\n\n :param odr: Accelerometer's output data rate.\n :type odr: :class:`wire_st_sdk.iolink.iolink_protocol.ODR`\n\n :returns: True if the parameter has been set correctly, False otherwise.\n :rtype: bool\n\n :raises Ser... | def set_odr(self, odr):
"Set accelerometer's output data rate.\n\n :param odr: Accelerometer's output data rate.\n :type odr: :class:`wire_st_sdk.iolink.iolink_protocol.ODR`\n\n :returns: True if the parameter has been set correctly, False otherwise.\n :rtype: bool\n\n :raises Ser... |
20c06e11e022dc8d0cc15e74835042657fd96cdd7798e5956242d5f388b45fd5 | def set_fls(self, fls):
"Set accelerometer's full scale.\n\n :param fls: Accelerometer's full scale.\n :type fls: :class:`wire_st_sdk.iolink.iolink_protocol.FLS`\n\n :returns: True if the parameter has been set correctly, False otherwise.\n :rtype: bool\n\n :raises SerialException... | Set accelerometer's full scale.
:param fls: Accelerometer's full scale.
:type fls: :class:`wire_st_sdk.iolink.iolink_protocol.FLS`
:returns: True if the parameter has been set correctly, False otherwise.
:rtype: bool
:raises SerialException, SerialTimeoutException: are raised if something
with the serial communi... | wire_st_sdk/iolink/iolink_sensor.py | set_fls | STMicroelectronics/WireSTSDK_Python | 9 | python | def set_fls(self, fls):
"Set accelerometer's full scale.\n\n :param fls: Accelerometer's full scale.\n :type fls: :class:`wire_st_sdk.iolink.iolink_protocol.FLS`\n\n :returns: True if the parameter has been set correctly, False otherwise.\n :rtype: bool\n\n :raises SerialException... | def set_fls(self, fls):
"Set accelerometer's full scale.\n\n :param fls: Accelerometer's full scale.\n :type fls: :class:`wire_st_sdk.iolink.iolink_protocol.FLS`\n\n :returns: True if the parameter has been set correctly, False otherwise.\n :rtype: bool\n\n :raises SerialException... |
4d04b6c41e2a858007bef9d5b2a11d69a5c8e084f0d5d12e9f4677149e6c4aa8 | def set_sze(self, sze):
"Set accelerometer's input array size for FFT.\n\n :param sze: Accelerometer's input array size for FFT.\n :type sze: :class:`wire_st_sdk.iolink.iolink_protocol.SZE`\n\n :returns: True if the parameter has been set correctly, False otherwise.\n :rtype: bool\n\n ... | Set accelerometer's input array size for FFT.
:param sze: Accelerometer's input array size for FFT.
:type sze: :class:`wire_st_sdk.iolink.iolink_protocol.SZE`
:returns: True if the parameter has been set correctly, False otherwise.
:rtype: bool
:raises SerialException, SerialTimeoutException: are raised if something... | wire_st_sdk/iolink/iolink_sensor.py | set_sze | STMicroelectronics/WireSTSDK_Python | 9 | python | def set_sze(self, sze):
"Set accelerometer's input array size for FFT.\n\n :param sze: Accelerometer's input array size for FFT.\n :type sze: :class:`wire_st_sdk.iolink.iolink_protocol.SZE`\n\n :returns: True if the parameter has been set correctly, False otherwise.\n :rtype: bool\n\n ... | def set_sze(self, sze):
"Set accelerometer's input array size for FFT.\n\n :param sze: Accelerometer's input array size for FFT.\n :type sze: :class:`wire_st_sdk.iolink.iolink_protocol.SZE`\n\n :returns: True if the parameter has been set correctly, False otherwise.\n :rtype: bool\n\n ... |
ff33b2bf838daaf38c207ceab20197479edc871cc8b2b802280a3a30035f3920 | def set_sub(self, sub):
"Set accelerometer's number of subranges.\n\n :param sub: Number of subranges.\n :type sub: :class:`wire_st_sdk.iolink.iolink_protocol.SUB`\n\n :returns: True if the parameter has been set correctly, False otherwise.\n :rtype: bool\n\n :raises SerialExcepti... | Set accelerometer's number of subranges.
:param sub: Number of subranges.
:type sub: :class:`wire_st_sdk.iolink.iolink_protocol.SUB`
:returns: True if the parameter has been set correctly, False otherwise.
:rtype: bool
:raises SerialException, SerialTimeoutException: are raised if something
with the serial commu... | wire_st_sdk/iolink/iolink_sensor.py | set_sub | STMicroelectronics/WireSTSDK_Python | 9 | python | def set_sub(self, sub):
"Set accelerometer's number of subranges.\n\n :param sub: Number of subranges.\n :type sub: :class:`wire_st_sdk.iolink.iolink_protocol.SUB`\n\n :returns: True if the parameter has been set correctly, False otherwise.\n :rtype: bool\n\n :raises SerialExcepti... | def set_sub(self, sub):
"Set accelerometer's number of subranges.\n\n :param sub: Number of subranges.\n :type sub: :class:`wire_st_sdk.iolink.iolink_protocol.SUB`\n\n :returns: True if the parameter has been set correctly, False otherwise.\n :rtype: bool\n\n :raises SerialExcepti... |
c6a90cd6da968b4db1e06eb544fc954160bfd553a7261039dbbb8348a40928f3 | def set_acq(self, acq):
"Set accelerometer's total acquisition time, which is valid for all\n types of analysis.\n\n :param acq: Accelerometer's total acquisition time (must be in the range\n [ACQ_MIN..ACQ_MAX]).\n :type acq: int\n\n :returns: True if the parameter has been se... | Set accelerometer's total acquisition time, which is valid for all
types of analysis.
:param acq: Accelerometer's total acquisition time (must be in the range
[ACQ_MIN..ACQ_MAX]).
:type acq: int
:returns: True if the parameter has been set correctly, False otherwise.
:rtype: bool
:raises SerialException, SerialT... | wire_st_sdk/iolink/iolink_sensor.py | set_acq | STMicroelectronics/WireSTSDK_Python | 9 | python | def set_acq(self, acq):
"Set accelerometer's total acquisition time, which is valid for all\n types of analysis.\n\n :param acq: Accelerometer's total acquisition time (must be in the range\n [ACQ_MIN..ACQ_MAX]).\n :type acq: int\n\n :returns: True if the parameter has been se... | def set_acq(self, acq):
"Set accelerometer's total acquisition time, which is valid for all\n types of analysis.\n\n :param acq: Accelerometer's total acquisition time (must be in the range\n [ACQ_MIN..ACQ_MAX]).\n :type acq: int\n\n :returns: True if the parameter has been se... |
89ec337d84680b1978a32c1001a3a420b9a006a4b6fd39b43ec6a8c88c051cd0 | def set_ovl(self, ovl):
"Set accelerometer's overlapping percentage between two consecutive\n FFT analysis.\n\n :param ovl: Accelerometer's overlapping percentage between two\n consecutive FFT analysis (must be in the range [OVL_MIN..OVL_MAX]).\n :type ovl: int\n\n :returns: T... | Set accelerometer's overlapping percentage between two consecutive
FFT analysis.
:param ovl: Accelerometer's overlapping percentage between two
consecutive FFT analysis (must be in the range [OVL_MIN..OVL_MAX]).
:type ovl: int
:returns: True if the parameter has been set correctly, False otherwise.
:rtype: bool
... | wire_st_sdk/iolink/iolink_sensor.py | set_ovl | STMicroelectronics/WireSTSDK_Python | 9 | python | def set_ovl(self, ovl):
"Set accelerometer's overlapping percentage between two consecutive\n FFT analysis.\n\n :param ovl: Accelerometer's overlapping percentage between two\n consecutive FFT analysis (must be in the range [OVL_MIN..OVL_MAX]).\n :type ovl: int\n\n :returns: T... | def set_ovl(self, ovl):
"Set accelerometer's overlapping percentage between two consecutive\n FFT analysis.\n\n :param ovl: Accelerometer's overlapping percentage between two\n consecutive FFT analysis (must be in the range [OVL_MIN..OVL_MAX]).\n :type ovl: int\n\n :returns: T... |
8bf68e32bc538376a22b072ea384100180ca0917f9ab50f79237b493fca5d030 | def epoch_to_text(ts):
'\n Convert an epoch timestamp to UK local time as text\n '
return datetime.fromtimestamp(ts, tz=timezone('Europe/London')).isoformat() | Convert an epoch timestamp to UK local time as text | tfc_web/api/extractors/util.py | epoch_to_text | SmartCambridge/tfc_web | 2 | python | def epoch_to_text(ts):
'\n \n '
return datetime.fromtimestamp(ts, tz=timezone('Europe/London')).isoformat() | def epoch_to_text(ts):
'\n \n '
return datetime.fromtimestamp(ts, tz=timezone('Europe/London')).isoformat()<|docstring|>Convert an epoch timestamp to UK local time as text<|endoftext|> |
5ec3d64ada9780a4b8aa4645ce518e3a6cb57deb044ab31764bad0edb582a04c | def __init__(self, dbcontext, indexing_root, catalog_key, doc_map_key, catalog_factory, metadata_factory):
'\n dbcontext\n IZODBNode instance.\n indexing_root\n Indexing root. defaults to self.dbcontext.\n catalog_key\n DB key of catalog.\n doc_map_key\n ... | dbcontext
IZODBNode instance.
indexing_root
Indexing root. defaults to self.dbcontext.
catalog_key
DB key of catalog.
doc_map_key
DB key of doc_map.
catalog_factory
Factory callback for creating catalog instance.
metadata_factory
Factory callback for creating node metadata. | src/cone/zodb/catalog.py | __init__ | conestack/cone.zodb | 0 | python | def __init__(self, dbcontext, indexing_root, catalog_key, doc_map_key, catalog_factory, metadata_factory):
'\n dbcontext\n IZODBNode instance.\n indexing_root\n Indexing root. defaults to self.dbcontext.\n catalog_key\n DB key of catalog.\n doc_map_key\n ... | def __init__(self, dbcontext, indexing_root, catalog_key, doc_map_key, catalog_factory, metadata_factory):
'\n dbcontext\n IZODBNode instance.\n indexing_root\n Indexing root. defaults to self.dbcontext.\n catalog_key\n DB key of catalog.\n doc_map_key\n ... |
7155c56248199d490e840ed06b945bc1f324b30f1f737b3d7173e8d16f9e7507 | def validate_field_data(self, validation, data):
"\n Ensure we've been passed legitimate values, particularly for the audio URLs.\n "
if (data.sources is None):
validation.add(ValidationMessage(ValidationMessage.ERROR, _(u'You must specify at least one source URL!')))
else:
sou... | Ensure we've been passed legitimate values, particularly for the audio URLs. | audio/fields.py | validate_field_data | nuclearfurnace/xblock-audio | 0 | python | def validate_field_data(self, validation, data):
"\n \n "
if (data.sources is None):
validation.add(ValidationMessage(ValidationMessage.ERROR, _(u'You must specify at least one source URL!')))
else:
sources = filter(None, data.sources.split('\n'))
if (len(sources) == 0)... | def validate_field_data(self, validation, data):
"\n \n "
if (data.sources is None):
validation.add(ValidationMessage(ValidationMessage.ERROR, _(u'You must specify at least one source URL!')))
else:
sources = filter(None, data.sources.split('\n'))
if (len(sources) == 0)... |
e71ff5a9af01b3c6b13ebfec61c80562225561b9499413415fd7fbdec885b6a5 | def upgrade():
'Migrations for the upgrade.'
conn = op.get_bind()
statement = text("\n UPDATE db_dbnode SET type = 'data.code.Code.' WHERE type = 'code.Code.';\n ")
conn.execute(statement) | Migrations for the upgrade. | aiida/backends/sqlalchemy/migrations/versions/a603da2cc809_code_sub_class_of_data.py | upgrade | azadoks/aiida-core | 180 | python | def upgrade():
conn = op.get_bind()
statement = text("\n UPDATE db_dbnode SET type = 'data.code.Code.' WHERE type = 'code.Code.';\n ")
conn.execute(statement) | def upgrade():
conn = op.get_bind()
statement = text("\n UPDATE db_dbnode SET type = 'data.code.Code.' WHERE type = 'code.Code.';\n ")
conn.execute(statement)<|docstring|>Migrations for the upgrade.<|endoftext|> |
e77c1f8aca2a42899ef5114c40edd8b4b1985d0aa326cee757687484742c3db9 | def downgrade():
'Migrations for the downgrade.'
conn = op.get_bind()
statement = text("\n UPDATE db_dbnode SET type = 'code.Code.' WHERE type = 'data.code.Code.';\n ")
conn.execute(statement) | Migrations for the downgrade. | aiida/backends/sqlalchemy/migrations/versions/a603da2cc809_code_sub_class_of_data.py | downgrade | azadoks/aiida-core | 180 | python | def downgrade():
conn = op.get_bind()
statement = text("\n UPDATE db_dbnode SET type = 'code.Code.' WHERE type = 'data.code.Code.';\n ")
conn.execute(statement) | def downgrade():
conn = op.get_bind()
statement = text("\n UPDATE db_dbnode SET type = 'code.Code.' WHERE type = 'data.code.Code.';\n ")
conn.execute(statement)<|docstring|>Migrations for the downgrade.<|endoftext|> |
d7be571e3035ca1c2e09371a43c10239a1f320b92e10350142caabf74194c316 | @not_implemented_for('multigraph')
def closeness_centrality(G, weight=None, n_workers=None):
'Compute closeness centrality for nodes.\n\n .. math::\n\n C_{WF}(u) = \x0crac{n-1}{N-1} \x0crac{n - 1}{\\sum_{v=1}^{n-1} d(v, u)},\n \n Notice that the closeness distance function computes the \n outcomi... | Compute closeness centrality for nodes.
.. math::
C_{WF}(u) = rac{n-1}{N-1} rac{n - 1}{\sum_{v=1}^{n-1} d(v, u)},
Notice that the closeness distance function computes the
outcoming distance to `u` for directed graphs. To use
incoming distance, act on `G.reverse()`.
Parameters
----------
G : graph
A easygr... | easygraph/functions/centrality/clossness.py | closeness_centrality | tddschn/Easy-Graph | 1 | python | @not_implemented_for('multigraph')
def closeness_centrality(G, weight=None, n_workers=None):
'Compute closeness centrality for nodes.\n\n .. math::\n\n C_{WF}(u) = \x0crac{n-1}{N-1} \x0crac{n - 1}{\\sum_{v=1}^{n-1} d(v, u)},\n \n Notice that the closeness distance function computes the \n outcomi... | @not_implemented_for('multigraph')
def closeness_centrality(G, weight=None, n_workers=None):
'Compute closeness centrality for nodes.\n\n .. math::\n\n C_{WF}(u) = \x0crac{n-1}{N-1} \x0crac{n - 1}{\\sum_{v=1}^{n-1} d(v, u)},\n \n Notice that the closeness distance function computes the \n outcomi... |
8fa03785b0f609ff90356f694dc75387bf73e10427858b16aa6469ebad07b1b4 | def find_missing(list_a, list_b):
'\n it takes list_a and list_b, which defers by one item,\n and returns the extra number in the longer list\n :parameter list_a list containing the int items\n :parameter list_b list containing the int items\n return: the extra number in the long... | it takes list_a and list_b, which defers by one item,
and returns the extra number in the longer list
:parameter list_a list containing the int items
:parameter list_b list containing the int items
return: the extra number in the longer list | andela_labs/Missing Number Lab (Programming Logic)/missing_numbers.py | find_missing | brotich/andela_bootcamp_X | 0 | python | def find_missing(list_a, list_b):
'\n it takes list_a and list_b, which defers by one item,\n and returns the extra number in the longer list\n :parameter list_a list containing the int items\n :parameter list_b list containing the int items\n return: the extra number in the long... | def find_missing(list_a, list_b):
'\n it takes list_a and list_b, which defers by one item,\n and returns the extra number in the longer list\n :parameter list_a list containing the int items\n :parameter list_b list containing the int items\n return: the extra number in the long... |
6bf082d2e97d5e6ac9e21bae08c1b77b5c43b19fad705c58ba8ee8f4e62007b2 | def build_spans(s, blocks):
's:string, blocks are pairs of (idx,len) of perfect matches'
if (not blocks):
return ([], 0, 0)
matched_indices = ([0] * len(s))
for (i, l) in blocks:
for idx in range(i, (i + l)):
matched_indices[idx] = max(matched_indices[idx], l)
spandata = ... | s:string, blocks are pairs of (idx,len) of perfect matches | paraanno/app.py | build_spans | TurkuNLP/rew-para-anno | 0 | python | def build_spans(s, blocks):
if (not blocks):
return ([], 0, 0)
matched_indices = ([0] * len(s))
for (i, l) in blocks:
for idx in range(i, (i + l)):
matched_indices[idx] = max(matched_indices[idx], l)
spandata = []
for (c, matched_len) in zip(s, matched_indices):
... | def build_spans(s, blocks):
if (not blocks):
return ([], 0, 0)
matched_indices = ([0] * len(s))
for (i, l) in blocks:
for idx in range(i, (i + l)):
matched_indices[idx] = max(matched_indices[idx], l)
spandata = []
for (c, matched_len) in zip(s, matched_indices):
... |
6f319ebd5d4c7854b7a2ccc8298dbd661cb69653af5468bc73ca56b3056e16a9 | def __init__(self, child1, child2, is_pure_python):
'Constructor for Conjunction node\n\n Parameters:\n child1 : stl.Node\n child2 : stl.Node\n '
super(Addition, self).__init__()
self.addChild(child1)
self.addChild(child2)
self.in_vars = (child1.in_var... | Constructor for Conjunction node
Parameters:
child1 : stl.Node
child2 : stl.Node | rtamt/node/stl/addition.py | __init__ | BentleyJOakes/rtamt | 0 | python | def __init__(self, child1, child2, is_pure_python):
'Constructor for Conjunction node\n\n Parameters:\n child1 : stl.Node\n child2 : stl.Node\n '
super(Addition, self).__init__()
self.addChild(child1)
self.addChild(child2)
self.in_vars = (child1.in_var... | def __init__(self, child1, child2, is_pure_python):
'Constructor for Conjunction node\n\n Parameters:\n child1 : stl.Node\n child2 : stl.Node\n '
super(Addition, self).__init__()
self.addChild(child1)
self.addChild(child2)
self.in_vars = (child1.in_var... |
e10c4ee5a323226642487c4e30556be8083fad29819fe0bfa977bbded4a9ccfc | def main():
'\n NAME\n tk03.py\n\n DESCRIPTION\n generates set of vectors drawn from TK03.gad at given lat and\n rotated about vertical axis by given Dec\n\n INPUT (COMMAND LINE ENTRY)\n OUTPUT\n dec, inc, int\n\n SYNTAX\n tk03.py [command line options] [> OutputFi... | NAME
tk03.py
DESCRIPTION
generates set of vectors drawn from TK03.gad at given lat and
rotated about vertical axis by given Dec
INPUT (COMMAND LINE ENTRY)
OUTPUT
dec, inc, int
SYNTAX
tk03.py [command line options] [> OutputFileName]
OPTIONS
-n N specify N, default is 100
-d D specify me... | programs/tk03.py | main | apivarunas/PmagPy | 2 | python | def main():
'\n NAME\n tk03.py\n\n DESCRIPTION\n generates set of vectors drawn from TK03.gad at given lat and\n rotated about vertical axis by given Dec\n\n INPUT (COMMAND LINE ENTRY)\n OUTPUT\n dec, inc, int\n\n SYNTAX\n tk03.py [command line options] [> OutputFi... | def main():
'\n NAME\n tk03.py\n\n DESCRIPTION\n generates set of vectors drawn from TK03.gad at given lat and\n rotated about vertical axis by given Dec\n\n INPUT (COMMAND LINE ENTRY)\n OUTPUT\n dec, inc, int\n\n SYNTAX\n tk03.py [command line options] [> OutputFi... |
ce7c087cd4c33a4803ac36f76769897d845a6537f71d2fe811e19e4849825931 | def straceback():
'Returns a string with the traceback.'
import traceback
return traceback.format_exc() | Returns a string with the traceback. | pymatgen/io/abinitio/events.py | straceback | jmflorez/pymatgen | 1 | python | def straceback():
import traceback
return traceback.format_exc() | def straceback():
import traceback
return traceback.format_exc()<|docstring|>Returns a string with the traceback.<|endoftext|> |
ed9e2777fde8458626d9c9fa84d83fc953221c9dce461a408a0e1fd59cc8f4a8 | def __init__(self, message, src_file, src_line):
'\n Basic constructor for `AbinitEvent`. \n\n Args:\n message:\n String with human-readable message providing info on the event.\n src_file:\n String with the name of the Fortran file where the event i... | Basic constructor for `AbinitEvent`.
Args:
message:
String with human-readable message providing info on the event.
src_file:
String with the name of the Fortran file where the event is raised.
src_line
Integer giving the line number in src_file. | pymatgen/io/abinitio/events.py | __init__ | jmflorez/pymatgen | 1 | python | def __init__(self, message, src_file, src_line):
'\n Basic constructor for `AbinitEvent`. \n\n Args:\n message:\n String with human-readable message providing info on the event.\n src_file:\n String with the name of the Fortran file where the event i... | def __init__(self, message, src_file, src_line):
'\n Basic constructor for `AbinitEvent`. \n\n Args:\n message:\n String with human-readable message providing info on the event.\n src_file:\n String with the name of the Fortran file where the event i... |
95b07f5950e76e57ee66ccfa68cbff6bd7e16c6da26ac587b997afe900ad51c8 | @property
def name(self):
'Name of the event (class name)'
return self.__class__.__name__ | Name of the event (class name) | pymatgen/io/abinitio/events.py | name | jmflorez/pymatgen | 1 | python | @property
def name(self):
return self.__class__.__name__ | @property
def name(self):
return self.__class__.__name__<|docstring|>Name of the event (class name)<|endoftext|> |
fc178a961ba7255f23e7f30afe889540d1ed8039f94980b8819307a0771618d1 | @property
def baseclass(self):
'The baseclass of self.'
for cls in _BASE_CLASSES:
if isinstance(self, cls):
return cls
err_msg = ('Cannot determine the base class of %s' % self.__class__.__name__)
raise ValueError(err_msg) | The baseclass of self. | pymatgen/io/abinitio/events.py | baseclass | jmflorez/pymatgen | 1 | python | @property
def baseclass(self):
for cls in _BASE_CLASSES:
if isinstance(self, cls):
return cls
err_msg = ('Cannot determine the base class of %s' % self.__class__.__name__)
raise ValueError(err_msg) | @property
def baseclass(self):
for cls in _BASE_CLASSES:
if isinstance(self, cls):
return cls
err_msg = ('Cannot determine the base class of %s' % self.__class__.__name__)
raise ValueError(err_msg)<|docstring|>The baseclass of self.<|endoftext|> |
e7fb6c09f6300708ee3bfef72d115305a15a23d5cea2fab8c3caee063032268d | def action(self):
'\n Returns a dictionary whose values that can be used to decide\n which actions should be performed e.g the SCF data at the last\n iteration can be used to decide whether the calculations should\n be restarted or not.\n '
return {} | Returns a dictionary whose values that can be used to decide
which actions should be performed e.g the SCF data at the last
iteration can be used to decide whether the calculations should
be restarted or not. | pymatgen/io/abinitio/events.py | action | jmflorez/pymatgen | 1 | python | def action(self):
'\n Returns a dictionary whose values that can be used to decide\n which actions should be performed e.g the SCF data at the last\n iteration can be used to decide whether the calculations should\n be restarted or not.\n '
return {} | def action(self):
'\n Returns a dictionary whose values that can be used to decide\n which actions should be performed e.g the SCF data at the last\n iteration can be used to decide whether the calculations should\n be restarted or not.\n '
return {}<|docstring|>Returns a dict... |
62c3a0748c6fa862bf99c4381262d87b449f89bfff473a4fbf98eac87d1135b5 | def __init__(self, filename, events=None):
'\n Args:\n filename:\n Name of the file\n events:\n List of Event objects\n '
self.filename = os.path.abspath(filename)
self._events = []
self._events_by_baseclass = collections.defaultdict(list... | Args:
filename:
Name of the file
events:
List of Event objects | pymatgen/io/abinitio/events.py | __init__ | jmflorez/pymatgen | 1 | python | def __init__(self, filename, events=None):
'\n Args:\n filename:\n Name of the file\n events:\n List of Event objects\n '
self.filename = os.path.abspath(filename)
self._events = []
self._events_by_baseclass = collections.defaultdict(list... | def __init__(self, filename, events=None):
'\n Args:\n filename:\n Name of the file\n events:\n List of Event objects\n '
self.filename = os.path.abspath(filename)
self._events = []
self._events_by_baseclass = collections.defaultdict(list... |
9326bffb83fffc0ba8a51168d52f71699cd3a7dd53a53ba8334211ad91f15d9a | def append(self, event):
'Add an event to the list.'
self._events.append(event)
self._events_by_baseclass[event.baseclass].append(event) | Add an event to the list. | pymatgen/io/abinitio/events.py | append | jmflorez/pymatgen | 1 | python | def append(self, event):
self._events.append(event)
self._events_by_baseclass[event.baseclass].append(event) | def append(self, event):
self._events.append(event)
self._events_by_baseclass[event.baseclass].append(event)<|docstring|>Add an event to the list.<|endoftext|> |
4cc04c8a4c4b270fe3ed3d26a488cc4c495ec27488d18c8df4dab0fc456e9c18 | def set_run_completed(self, bool_value):
'Set the value of _run_completed.'
self._run_completed = bool_value | Set the value of _run_completed. | pymatgen/io/abinitio/events.py | set_run_completed | jmflorez/pymatgen | 1 | python | def set_run_completed(self, bool_value):
self._run_completed = bool_value | def set_run_completed(self, bool_value):
self._run_completed = bool_value<|docstring|>Set the value of _run_completed.<|endoftext|> |
9fe1c43b90261e04a7d8bd153671077d70652e3d3bc5e26d77f2dd16fa2fcd76 | @property
def run_completed(self):
'\n Returns True if the calculation terminated.\n '
try:
return self._run_completed
except AttributeError:
return False | Returns True if the calculation terminated. | pymatgen/io/abinitio/events.py | run_completed | jmflorez/pymatgen | 1 | python | @property
def run_completed(self):
'\n \n '
try:
return self._run_completed
except AttributeError:
return False | @property
def run_completed(self):
'\n \n '
try:
return self._run_completed
except AttributeError:
return False<|docstring|>Returns True if the calculation terminated.<|endoftext|> |
5f5090c8980aaeaeff1a6ee02c5baf932f27fbcbab34a50f41c9c0d0de2807d2 | @property
def comments(self):
'List of comments found.'
return self.select(AbinitComment) | List of comments found. | pymatgen/io/abinitio/events.py | comments | jmflorez/pymatgen | 1 | python | @property
def comments(self):
return self.select(AbinitComment) | @property
def comments(self):
return self.select(AbinitComment)<|docstring|>List of comments found.<|endoftext|> |
9e13a51d461f121c83c4bc4f0a1cde332b0fcdbcc2f3e4ac7925ad796b019b0a | @property
def errors(self):
'List of errors found.'
return self.select(AbinitError) | List of errors found. | pymatgen/io/abinitio/events.py | errors | jmflorez/pymatgen | 1 | python | @property
def errors(self):
return self.select(AbinitError) | @property
def errors(self):
return self.select(AbinitError)<|docstring|>List of errors found.<|endoftext|> |
c63f190827d1e67c7f6535a0279ee5e97f09113b6c65d1f7b20a8af8a152c006 | @property
def bugs(self):
'List of bugs found.'
return self.select(AbinitBug) | List of bugs found. | pymatgen/io/abinitio/events.py | bugs | jmflorez/pymatgen | 1 | python | @property
def bugs(self):
return self.select(AbinitBug) | @property
def bugs(self):
return self.select(AbinitBug)<|docstring|>List of bugs found.<|endoftext|> |
3761ed524a374dfd156d4046895a6043031a51dd63049dc6afbff3d44f3d00b6 | @property
def warnings(self):
'List of warnings found.'
return self.select(AbinitWarning) | List of warnings found. | pymatgen/io/abinitio/events.py | warnings | jmflorez/pymatgen | 1 | python | @property
def warnings(self):
return self.select(AbinitWarning) | @property
def warnings(self):
return self.select(AbinitWarning)<|docstring|>List of warnings found.<|endoftext|> |
d824f626c62253221af91c01b03f95715647d26f620362b3118858335c07a30f | @property
def num_warnings(self):
'Number of warnings reported.'
return len(self.warnings) | Number of warnings reported. | pymatgen/io/abinitio/events.py | num_warnings | jmflorez/pymatgen | 1 | python | @property
def num_warnings(self):
return len(self.warnings) | @property
def num_warnings(self):
return len(self.warnings)<|docstring|>Number of warnings reported.<|endoftext|> |
d16954be1a932a3155076573700414a067ac21918221bd540b2871b02eca52fe | @property
def num_errors(self):
'Number of errors reported.'
return len(self.errors) | Number of errors reported. | pymatgen/io/abinitio/events.py | num_errors | jmflorez/pymatgen | 1 | python | @property
def num_errors(self):
return len(self.errors) | @property
def num_errors(self):
return len(self.errors)<|docstring|>Number of errors reported.<|endoftext|> |
384d9a8903ccb870b1b35e99129381b432923044f022ba612476861ed6e894a0 | @property
def num_comments(self):
'Number of comments reported.'
return len(self.comments) | Number of comments reported. | pymatgen/io/abinitio/events.py | num_comments | jmflorez/pymatgen | 1 | python | @property
def num_comments(self):
return len(self.comments) | @property
def num_comments(self):
return len(self.comments)<|docstring|>Number of comments reported.<|endoftext|> |
09996027b4aa16452d1da89a72c859f5e026551a0e234fe224bad1de9756f351 | def select(self, base_class):
'\n Return the list of events that inherits from class base_class\n\n Args:\n only_critical:\n if True, only critical events are returned.\n '
return self._events_by_baseclass[base_class][:] | Return the list of events that inherits from class base_class
Args:
only_critical:
if True, only critical events are returned. | pymatgen/io/abinitio/events.py | select | jmflorez/pymatgen | 1 | python | def select(self, base_class):
'\n Return the list of events that inherits from class base_class\n\n Args:\n only_critical:\n if True, only critical events are returned.\n '
return self._events_by_baseclass[base_class][:] | def select(self, base_class):
'\n Return the list of events that inherits from class base_class\n\n Args:\n only_critical:\n if True, only critical events are returned.\n '
return self._events_by_baseclass[base_class][:]<|docstring|>Return the list of events that i... |
d8f8aad3fd5d30f1eb497c6573237ee1c9a5148097a80a1e91a53a6efd32dafd | @staticmethod
def parse(filename):
'\n This is the new parser, it will be used when we implement\n the new format in abinit.\n '
run_completed = False
filename = os.path.abspath(filename)
report = EventReport(filename)
w = WildCard('*Error|*Warning|*Comment|*ERROR|*WARNING|*COMM... | This is the new parser, it will be used when we implement
the new format in abinit. | pymatgen/io/abinitio/events.py | parse | jmflorez/pymatgen | 1 | python | @staticmethod
def parse(filename):
'\n This is the new parser, it will be used when we implement\n the new format in abinit.\n '
run_completed = False
filename = os.path.abspath(filename)
report = EventReport(filename)
w = WildCard('*Error|*Warning|*Comment|*ERROR|*WARNING|*COMM... | @staticmethod
def parse(filename):
'\n This is the new parser, it will be used when we implement\n the new format in abinit.\n '
run_completed = False
filename = os.path.abspath(filename)
report = EventReport(filename)
w = WildCard('*Error|*Warning|*Comment|*ERROR|*WARNING|*COMM... |
2e7864739976233f9fc1139e2dec462f68a821dd89b2eb3b30c0383330d38918 | def report_exception(self, filename, exc):
'\n This method is used when self.parser raises an Exception so that\n we can report a customized `EventReport` object with info the exception.\n '
return EventReport(filename, events=[Error(str(exc))]) | This method is used when self.parser raises an Exception so that
we can report a customized `EventReport` object with info the exception. | pymatgen/io/abinitio/events.py | report_exception | jmflorez/pymatgen | 1 | python | def report_exception(self, filename, exc):
'\n This method is used when self.parser raises an Exception so that\n we can report a customized `EventReport` object with info the exception.\n '
return EventReport(filename, events=[Error(str(exc))]) | def report_exception(self, filename, exc):
'\n This method is used when self.parser raises an Exception so that\n we can report a customized `EventReport` object with info the exception.\n '
return EventReport(filename, events=[Error(str(exc))])<|docstring|>This method is used when self.par... |
ed2400ff362355000dcd60aa3e2acf2b9b137c1c20b2b6689609aa3278ef6da0 | def UT2datetime(indate, inut):
'\n\tConverts date of the format YYYYMMDD and time in floating point \n\thours to a datetime object.\n\t\n\t'
if (np.size(indate) == 1):
date = (np.zeros(np.size(inut), dtype='int32') + indate)
else:
date = np.int32(indate)
if (np.size(inut) == 1):
... | Converts date of the format YYYYMMDD and time in floating point
hours to a datetime object. | build/lib/DateTimeTools/UT2datetime.py | UT2datetime | pshustov/DateTimeTools | 0 | python | def UT2datetime(indate, inut):
'\n\tConverts date of the format YYYYMMDD and time in floating point \n\thours to a datetime object.\n\t\n\t'
if (np.size(indate) == 1):
date = (np.zeros(np.size(inut), dtype='int32') + indate)
else:
date = np.int32(indate)
if (np.size(inut) == 1):
... | def UT2datetime(indate, inut):
'\n\tConverts date of the format YYYYMMDD and time in floating point \n\thours to a datetime object.\n\t\n\t'
if (np.size(indate) == 1):
date = (np.zeros(np.size(inut), dtype='int32') + indate)
else:
date = np.int32(indate)
if (np.size(inut) == 1):
... |
c67c21d1f2f6c6702da8b0432c80b45dfe0c45ea10f37b5b514fcbff7443e7a3 | def datetime2UT(DT):
'\n\tConverts datetime objects to arrays of dates with the format \n\tYYYYMMDD and times in floating point hours. \n\t'
if hasattr(DT, '__iter__'):
n = np.size(DT)
ut = np.zeros(n, dtype='float32')
date = np.zeros(n, dtype='int32')
for i in range(0, n):
... | Converts datetime objects to arrays of dates with the format
YYYYMMDD and times in floating point hours. | build/lib/DateTimeTools/UT2datetime.py | datetime2UT | pshustov/DateTimeTools | 0 | python | def datetime2UT(DT):
'\n\tConverts datetime objects to arrays of dates with the format \n\tYYYYMMDD and times in floating point hours. \n\t'
if hasattr(DT, '__iter__'):
n = np.size(DT)
ut = np.zeros(n, dtype='float32')
date = np.zeros(n, dtype='int32')
for i in range(0, n):
... | def datetime2UT(DT):
'\n\tConverts datetime objects to arrays of dates with the format \n\tYYYYMMDD and times in floating point hours. \n\t'
if hasattr(DT, '__iter__'):
n = np.size(DT)
ut = np.zeros(n, dtype='float32')
date = np.zeros(n, dtype='int32')
for i in range(0, n):
... |
2f5e72daef8d2ce6bb81ce086d641a6b264aa7c50d75b576ff606f0e843c818b | def get_args(func):
'Given a function, returns a tuple (*required*, *optional*), tuples of\n non-keyword and keyword arguments respectively. If a function contains\n splats (\\* or \\**), a :exc:`~cosmic.exceptions.SpecError` will be raised.\n '
(args, varargs, keywords, defaults) = inspect.getargspec(... | Given a function, returns a tuple (*required*, *optional*), tuples of
non-keyword and keyword arguments respectively. If a function contains
splats (\* or \**), a :exc:`~cosmic.exceptions.SpecError` will be raised. | cosmic/tools.py | get_args | cosmic-api/cosmic.py | 1 | python | def get_args(func):
'Given a function, returns a tuple (*required*, *optional*), tuples of\n non-keyword and keyword arguments respectively. If a function contains\n splats (\\* or \\**), a :exc:`~cosmic.exceptions.SpecError` will be raised.\n '
(args, varargs, keywords, defaults) = inspect.getargspec(... | def get_args(func):
'Given a function, returns a tuple (*required*, *optional*), tuples of\n non-keyword and keyword arguments respectively. If a function contains\n splats (\\* or \\**), a :exc:`~cosmic.exceptions.SpecError` will be raised.\n '
(args, varargs, keywords, defaults) = inspect.getargspec(... |
578cb96f8a1b03294f09ec3bf6e6112388e287d26fac8004109f07bcb2af3983 | def args_to_datum(*args, **kwargs):
'Takes arbitrary args and kwargs and packs them into a dict if there are\n more than one. Returns `None` if there are no arguments. Must be called\n with either a single argument or multiple keyword arguments.\n '
if ((len(args) == 1) and (len(kwargs) == 0)):
... | Takes arbitrary args and kwargs and packs them into a dict if there are
more than one. Returns `None` if there are no arguments. Must be called
with either a single argument or multiple keyword arguments. | cosmic/tools.py | args_to_datum | cosmic-api/cosmic.py | 1 | python | def args_to_datum(*args, **kwargs):
'Takes arbitrary args and kwargs and packs them into a dict if there are\n more than one. Returns `None` if there are no arguments. Must be called\n with either a single argument or multiple keyword arguments.\n '
if ((len(args) == 1) and (len(kwargs) == 0)):
... | def args_to_datum(*args, **kwargs):
'Takes arbitrary args and kwargs and packs them into a dict if there are\n more than one. Returns `None` if there are no arguments. Must be called\n with either a single argument or multiple keyword arguments.\n '
if ((len(args) == 1) and (len(kwargs) == 0)):
... |
4385e08b9faac316e0dbaca0e1454d36e30e3974cb403ff3b2e3bbe6cbc7e71b | def assert_is_compatible(schema, required_args, optional_args):
'Raises a :exc:`~cosmic.exceptions.SpecError` if function argument spec\n (as returned by :func:`get_args`) is incompatible with the given schema.\n By incompatible, it is meant that there exists such a piece of data that\n is valid according ... | Raises a :exc:`~cosmic.exceptions.SpecError` if function argument spec
(as returned by :func:`get_args`) is incompatible with the given schema.
By incompatible, it is meant that there exists such a piece of data that
is valid according to the schema, but that could not be applied to the
function by :func:`apply_to_func... | cosmic/tools.py | assert_is_compatible | cosmic-api/cosmic.py | 1 | python | def assert_is_compatible(schema, required_args, optional_args):
'Raises a :exc:`~cosmic.exceptions.SpecError` if function argument spec\n (as returned by :func:`get_args`) is incompatible with the given schema.\n By incompatible, it is meant that there exists such a piece of data that\n is valid according ... | def assert_is_compatible(schema, required_args, optional_args):
'Raises a :exc:`~cosmic.exceptions.SpecError` if function argument spec\n (as returned by :func:`get_args`) is incompatible with the given schema.\n By incompatible, it is meant that there exists such a piece of data that\n is valid according ... |
395181d993a4faee8ba601971e4b729a49aadaeed2446cdf5e19737e30a87e0b | def s3_import_csv(r):
'\n Import CSV file into database\n\n Args:\n r: the S3Request\n\n Note:\n Called by S3CRUD.create\n '
import cgi
import csv
csv.field_size_limit(1000000000)
infile = r.post_vars.filename
if (isinstance(infile, cgi.FieldStorage)... | Import CSV file into database
Args:
r: the S3Request
Note:
Called by S3CRUD.create | modules/s3/s3import.py | s3_import_csv | annehaley/eden | 205 | python | def s3_import_csv(r):
'\n Import CSV file into database\n\n Args:\n r: the S3Request\n\n Note:\n Called by S3CRUD.create\n '
import cgi
import csv
csv.field_size_limit(1000000000)
infile = r.post_vars.filename
if (isinstance(infile, cgi.FieldStorage)... | def s3_import_csv(r):
'\n Import CSV file into database\n\n Args:\n r: the S3Request\n\n Note:\n Called by S3CRUD.create\n '
import cgi
import csv
csv.field_size_limit(1000000000)
infile = r.post_vars.filename
if (isinstance(infile, cgi.FieldStorage)... |
bc0c8040f86eedee582004d4e816bbdd343b1edcb5ffc89c1157b3f3c56483cf | def s3_import_url(r):
'\n Import data from vars in URL query\n\n Args:\n r: the S3Request\n\n Note:\n Can only update single records (no mass-update)\n Called by S3CRUD.create / S3CRUD.update\n '
xml = current.xml
table = r.target()[2]
record = r.... | Import data from vars in URL query
Args:
r: the S3Request
Note:
Can only update single records (no mass-update)
Called by S3CRUD.create / S3CRUD.update | modules/s3/s3import.py | s3_import_url | annehaley/eden | 205 | python | def s3_import_url(r):
'\n Import data from vars in URL query\n\n Args:\n r: the S3Request\n\n Note:\n Can only update single records (no mass-update)\n Called by S3CRUD.create / S3CRUD.update\n '
xml = current.xml
table = r.target()[2]
record = r.... | def s3_import_url(r):
'\n Import data from vars in URL query\n\n Args:\n r: the S3Request\n\n Note:\n Can only update single records (no mass-update)\n Called by S3CRUD.create / S3CRUD.update\n '
xml = current.xml
table = r.target()[2]
record = r.... |
83c4cfa3cd33d99d8a79f237e30b75e8cf534a4958146123cce6b7c9974a791f | def apply_method(self, r, **attr):
'\n Args\n r: the S3Request\n attr: dictionary of parameters for the method handler\n\n Returns:\n output object to send to the view\n\n Known means of communicating with this module:\n\n It e... | Args
r: the S3Request
attr: dictionary of parameters for the method handler
Returns:
output object to send to the view
Known means of communicating with this module:
It expects a URL of the form: /prefix/name/import
It will interpret the http requests as follows:
GET will trigger the upload
POST ... | modules/s3/s3import.py | apply_method | annehaley/eden | 205 | python | def apply_method(self, r, **attr):
'\n Args\n r: the S3Request\n attr: dictionary of parameters for the method handler\n\n Returns:\n output object to send to the view\n\n Known means of communicating with this module:\n\n It e... | def apply_method(self, r, **attr):
'\n Args\n r: the S3Request\n attr: dictionary of parameters for the method handler\n\n Returns:\n output object to send to the view\n\n Known means of communicating with this module:\n\n It e... |
7c64370dd6947d8f115471a332312c1bc797c4e36d6e56bc23f585435c130abb | def upload(self, r, **attr):
'\n This will display the upload form\n It will ask for a file to be uploaded or for a job to be selected.\n\n If a file is uploaded then it will guess at the file type and\n ask for the transform file to be used. The transform files will\n ... | This will display the upload form
It will ask for a file to be uploaded or for a job to be selected.
If a file is uploaded then it will guess at the file type and
ask for the transform file to be used. The transform files will
be in a dataTable with the module specific files shown first and
after those all other known... | modules/s3/s3import.py | upload | annehaley/eden | 205 | python | def upload(self, r, **attr):
'\n This will display the upload form\n It will ask for a file to be uploaded or for a job to be selected.\n\n If a file is uploaded then it will guess at the file type and\n ask for the transform file to be used. The transform files will\n ... | def upload(self, r, **attr):
'\n This will display the upload form\n It will ask for a file to be uploaded or for a job to be selected.\n\n If a file is uploaded then it will guess at the file type and\n ask for the transform file to be used. The transform files will\n ... |
e55c5ac3bf297a7beb676b385adce5e048d8b2f2fcf5fd814f5d9e2a1f1acc73 | def generate_job(self, r, **attr):
'\n Generate an ImportJob from the submitted upload form\n '
db = current.db
response = current.response
s3 = response.s3
ajax = self.ajax
table = self.upload_table
if ajax:
sfilename = ofilename = r.post_vars['file'].filename
... | Generate an ImportJob from the submitted upload form | modules/s3/s3import.py | generate_job | annehaley/eden | 205 | python | def generate_job(self, r, **attr):
'\n \n '
db = current.db
response = current.response
s3 = response.s3
ajax = self.ajax
table = self.upload_table
if ajax:
sfilename = ofilename = r.post_vars['file'].filename
upload_id = table.insert(controller=self.control... | def generate_job(self, r, **attr):
'\n \n '
db = current.db
response = current.response
s3 = response.s3
ajax = self.ajax
table = self.upload_table
if ajax:
sfilename = ofilename = r.post_vars['file'].filename
upload_id = table.insert(controller=self.control... |
82b062255b72f5e00731cd46fdc435e628114de9155c1d1f64ec96b9e71a5e75 | def commit(self, source, transform):
'\n Import a source\n\n Args:\n source: the source\n transform: the stylesheet path\n '
session = current.session
try:
user = session.auth.user.id
except AttributeError:
user = None
extens... | Import a source
Args:
source: the source
transform: the stylesheet path | modules/s3/s3import.py | commit | annehaley/eden | 205 | python | def commit(self, source, transform):
'\n Import a source\n\n Args:\n source: the source\n transform: the stylesheet path\n '
session = current.session
try:
user = session.auth.user.id
except AttributeError:
user = None
extens... | def commit(self, source, transform):
'\n Import a source\n\n Args:\n source: the source\n transform: the stylesheet path\n '
session = current.session
try:
user = session.auth.user.id
except AttributeError:
user = None
extens... |
622dc3da16474f65f688cf099618858dbe56e8e40c718c091fe5306144f739a5 | def delete_job(self, upload_id):
'\n Delete an uploaded file and the corresponding import job\n\n Args:\n upload_id: the upload ID\n '
db = current.db
request = self.request
resource = request.resource
job_id = self.job_id
if job_id:
result = r... | Delete an uploaded file and the corresponding import job
Args:
upload_id: the upload ID | modules/s3/s3import.py | delete_job | annehaley/eden | 205 | python | def delete_job(self, upload_id):
'\n Delete an uploaded file and the corresponding import job\n\n Args:\n upload_id: the upload ID\n '
db = current.db
request = self.request
resource = request.resource
job_id = self.job_id
if job_id:
result = r... | def delete_job(self, upload_id):
'\n Delete an uploaded file and the corresponding import job\n\n Args:\n upload_id: the upload ID\n '
db = current.db
request = self.request
resource = request.resource
job_id = self.job_id
if job_id:
result = r... |
e8eab9071a1c67a6dc5861354295920641a8d5fe2dfc110aedf978763964e583 | def _upload_form(self, r, **attr):
'\n Create and process the upload form, including csv_extra_fields\n '
EXTRA_FIELDS = 'csv_extra_fields'
TEMPLATE = 'csv_template'
REPLACE_OPTION = 'replace_option'
response = current.response
s3 = response.s3
request = self.request
ta... | Create and process the upload form, including csv_extra_fields | modules/s3/s3import.py | _upload_form | annehaley/eden | 205 | python | def _upload_form(self, r, **attr):
'\n \n '
EXTRA_FIELDS = 'csv_extra_fields'
TEMPLATE = 'csv_template'
REPLACE_OPTION = 'replace_option'
response = current.response
s3 = response.s3
request = self.request
table = self.upload_table
formstyle = s3.crud.formstyle
... | def _upload_form(self, r, **attr):
'\n \n '
EXTRA_FIELDS = 'csv_extra_fields'
TEMPLATE = 'csv_template'
REPLACE_OPTION = 'replace_option'
response = current.response
s3 = response.s3
request = self.request
table = self.upload_table
formstyle = s3.crud.formstyle
... |
f2d111ca57f7cfefe709fe2c12c157e339e5060cea587452c86599e3ac35637b | def _create_upload_dataTable(self):
'\n List of previous Import jobs\n '
db = current.db
request = self.request
controller = self.controller
function = self.function
s3 = current.response.s3
table = self.upload_table
s3.filter = ((table.controller == controller) & (tabl... | List of previous Import jobs | modules/s3/s3import.py | _create_upload_dataTable | annehaley/eden | 205 | python | def _create_upload_dataTable(self):
'\n \n '
db = current.db
request = self.request
controller = self.controller
function = self.function
s3 = current.response.s3
table = self.upload_table
s3.filter = ((table.controller == controller) & (table.function == function))
... | def _create_upload_dataTable(self):
'\n \n '
db = current.db
request = self.request
controller = self.controller
function = self.function
s3 = current.response.s3
table = self.upload_table
s3.filter = ((table.controller == controller) & (table.function == function))
... |
cd0b28824154b0610e14c0a01458fbff044b1033f9ebecda47824ba1083f8c00 | def _create_import_item_dataTable(self, upload_id, job_id):
'\n @todo: docstring?\n '
s3 = current.response.s3
represent = {'s3_import_item.element': self._item_element_represent}
self._use_import_item_table(job_id)
table = self.table
query = ((table.job_id == job_id) & (table.... | @todo: docstring? | modules/s3/s3import.py | _create_import_item_dataTable | annehaley/eden | 205 | python | def _create_import_item_dataTable(self, upload_id, job_id):
'\n \n '
s3 = current.response.s3
represent = {'s3_import_item.element': self._item_element_represent}
self._use_import_item_table(job_id)
table = self.table
query = ((table.job_id == job_id) & (table.tablename == self... | def _create_import_item_dataTable(self, upload_id, job_id):
'\n \n '
s3 = current.response.s3
represent = {'s3_import_item.element': self._item_element_represent}
self._use_import_item_table(job_id)
table = self.table
query = ((table.job_id == job_id) & (table.tablename == self... |
fefa0b12414bb3370fac413e085f27671fca21de708483cf6cf8b90c9014549d | def _generate_import_job(self, upload_id, infile, file_format, stylesheet=None, commit_job=False):
'\n This will take a s3_import_upload record and\n generate the importJob\n\n Args:\n infile: The uploaded file\n '
if (file_format in ('csv', 'comma-separate... | This will take a s3_import_upload record and
generate the importJob
Args:
infile: The uploaded file | modules/s3/s3import.py | _generate_import_job | annehaley/eden | 205 | python | def _generate_import_job(self, upload_id, infile, file_format, stylesheet=None, commit_job=False):
'\n This will take a s3_import_upload record and\n generate the importJob\n\n Args:\n infile: The uploaded file\n '
if (file_format in ('csv', 'comma-separate... | def _generate_import_job(self, upload_id, infile, file_format, stylesheet=None, commit_job=False):
'\n This will take a s3_import_upload record and\n generate the importJob\n\n Args:\n infile: The uploaded file\n '
if (file_format in ('csv', 'comma-separate... |
04cd521e553fd4e8c29a3419d20df24278e70ae42ba2aab47fad7cac660a482d | def _get_stylesheet(self, file_format='csv'):
'\n Get the stylesheet for transformation of the import\n\n Args:\n file_format: the import source file format\n '
if (file_format == 'csv'):
xslt_path = os.path.join(self.xslt_path, 's3csv')
else:
xslt... | Get the stylesheet for transformation of the import
Args:
file_format: the import source file format | modules/s3/s3import.py | _get_stylesheet | annehaley/eden | 205 | python | def _get_stylesheet(self, file_format='csv'):
'\n Get the stylesheet for transformation of the import\n\n Args:\n file_format: the import source file format\n '
if (file_format == 'csv'):
xslt_path = os.path.join(self.xslt_path, 's3csv')
else:
xslt... | def _get_stylesheet(self, file_format='csv'):
'\n Get the stylesheet for transformation of the import\n\n Args:\n file_format: the import source file format\n '
if (file_format == 'csv'):
xslt_path = os.path.join(self.xslt_path, 's3csv')
else:
xslt... |
ce811c21fa86dd376acce52e5e6c124e22ee7226d4515452561c9df0309ab222 | def _commit_import_job(self, upload_id, items):
'\n This will save all of the selected import items\n '
db = current.db
resource = self.request.resource
self.importDetails = {}
table = self.upload_table
row = db((table.id == upload_id)).select(table.job_id, table.replace_option... | This will save all of the selected import items | modules/s3/s3import.py | _commit_import_job | annehaley/eden | 205 | python | def _commit_import_job(self, upload_id, items):
'\n \n '
db = current.db
resource = self.request.resource
self.importDetails = {}
table = self.upload_table
row = db((table.id == upload_id)).select(table.job_id, table.replace_option, limitby=(0, 1)).first()
if (row is None):... | def _commit_import_job(self, upload_id, items):
'\n \n '
db = current.db
resource = self.request.resource
self.importDetails = {}
table = self.upload_table
row = db((table.id == upload_id)).select(table.job_id, table.replace_option, limitby=(0, 1)).first()
if (row is None):... |
3cd5f99010fe32b238a1c9c5807e27e25fe272d07a5b8b4489e3dd86341539a0 | def _store_import_details(self, job_id, key):
'\n This will store the details from an importJob\n '
itable = S3ImportJob.define_item_table()
query = ((itable.job_id == job_id) & (itable.tablename == self.controller_tablename))
rows = current.db(query).select(itable.data, itable.error)
... | This will store the details from an importJob | modules/s3/s3import.py | _store_import_details | annehaley/eden | 205 | python | def _store_import_details(self, job_id, key):
'\n \n '
itable = S3ImportJob.define_item_table()
query = ((itable.job_id == job_id) & (itable.tablename == self.controller_tablename))
rows = current.db(query).select(itable.data, itable.error)
items = [{'data': row.data, 'error': row.... | def _store_import_details(self, job_id, key):
'\n \n '
itable = S3ImportJob.define_item_table()
query = ((itable.job_id == job_id) & (itable.tablename == self.controller_tablename))
rows = current.db(query).select(itable.data, itable.error)
items = [{'data': row.data, 'error': row.... |
f66d3169a0070aaaf3d55f9d74ac4bcf35d9d2be6aee2a00477ba7f937143933 | def _update_upload_job(self, upload_id):
'\n This will record the results from the import, and change the\n status of the upload job\n\n TODO:\n report errors in referenced records, too\n '
resource = self.request.resource
db = current.db
totalPreDe... | This will record the results from the import, and change the
status of the upload job
TODO:
report errors in referenced records, too | modules/s3/s3import.py | _update_upload_job | annehaley/eden | 205 | python | def _update_upload_job(self, upload_id):
'\n This will record the results from the import, and change the\n status of the upload job\n\n TODO:\n report errors in referenced records, too\n '
resource = self.request.resource
db = current.db
totalPreDe... | def _update_upload_job(self, upload_id):
'\n This will record the results from the import, and change the\n status of the upload job\n\n TODO:\n report errors in referenced records, too\n '
resource = self.request.resource
db = current.db
totalPreDe... |
b2c92cb585688543110d49cc7a4bbb3953f86b30a96059161f2b8957a9f46ee6 | def _display_completed_job(self, totals, timestmp=None):
'\n Generate a summary flash message for a completed import job\n\n Args:\n totals: the job totals as tuple\n (total imported, total errors, total ignored)\n timestmp: the timestamp of... | Generate a summary flash message for a completed import job
Args:
totals: the job totals as tuple
(total imported, total errors, total ignored)
timestmp: the timestamp of the completion | modules/s3/s3import.py | _display_completed_job | annehaley/eden | 205 | python | def _display_completed_job(self, totals, timestmp=None):
'\n Generate a summary flash message for a completed import job\n\n Args:\n totals: the job totals as tuple\n (total imported, total errors, total ignored)\n timestmp: the timestamp of... | def _display_completed_job(self, totals, timestmp=None):
'\n Generate a summary flash message for a completed import job\n\n Args:\n totals: the job totals as tuple\n (total imported, total errors, total ignored)\n timestmp: the timestamp of... |
76bf3daddb2b3959441426e499bb11a46c6a14ef44c7085644601d00097c8ab1 | def _dataTable(self, list_fields, represent=None, ajax_item_id=None, dt_bulk_select=None):
'\n Method to get the data for the dataTable\n This can be either a raw html representation or\n and ajax call update\n Additional data will be cached to limit calls back to the ser... | Method to get the data for the dataTable
This can be either a raw html representation or
and ajax call update
Additional data will be cached to limit calls back to the server
Args:
list_fields: list of field names
sort_by: list of sort by columns
represent: a dict of field callback functions used
... | modules/s3/s3import.py | _dataTable | annehaley/eden | 205 | python | def _dataTable(self, list_fields, represent=None, ajax_item_id=None, dt_bulk_select=None):
'\n Method to get the data for the dataTable\n This can be either a raw html representation or\n and ajax call update\n Additional data will be cached to limit calls back to the ser... | def _dataTable(self, list_fields, represent=None, ajax_item_id=None, dt_bulk_select=None):
'\n Method to get the data for the dataTable\n This can be either a raw html representation or\n and ajax call update\n Additional data will be cached to limit calls back to the ser... |
fff6ac03b27d4300c787c36743c614573c9c326128a863f11fa389308142564b | def _item_element_represent(self, item_id, value):
'\n Represent the element in an import item for dataTable display\n\n Args:\n value: the string containing the element\n '
try:
element = etree.fromstring(value)
except:
return DIV(value)
db = ... | Represent the element in an import item for dataTable display
Args:
value: the string containing the element | modules/s3/s3import.py | _item_element_represent | annehaley/eden | 205 | python | def _item_element_represent(self, item_id, value):
'\n Represent the element in an import item for dataTable display\n\n Args:\n value: the string containing the element\n '
try:
element = etree.fromstring(value)
except:
return DIV(value)
db = ... | def _item_element_represent(self, item_id, value):
'\n Represent the element in an import item for dataTable display\n\n Args:\n value: the string containing the element\n '
try:
element = etree.fromstring(value)
except:
return DIV(value)
db = ... |
8102c72de8eecdda425593f689a5a6cf5fdc8fe60a3923cc2d5a372e45ee92f6 | @staticmethod
def _add_item_details(data, table, details=None, prefix=False):
'\n Add details of the item element\n\n Args:\n data: the list of data elements in the item element\n table: the table for the data\n details: the existing details rows li... | Add details of the item element
Args:
data: the list of data elements in the item element
table: the table for the data
details: the existing details rows list (to append to) | modules/s3/s3import.py | _add_item_details | annehaley/eden | 205 | python | @staticmethod
def _add_item_details(data, table, details=None, prefix=False):
'\n Add details of the item element\n\n Args:\n data: the list of data elements in the item element\n table: the table for the data\n details: the existing details rows li... | @staticmethod
def _add_item_details(data, table, details=None, prefix=False):
'\n Add details of the item element\n\n Args:\n data: the list of data elements in the item element\n table: the table for the data\n details: the existing details rows li... |
285913e9e5307ef6897e57bc53b51c31ba887d4d754cf323924cee05999bd3c3 | @staticmethod
def _decode_data(field, value):
'\n Try to decode string data into their original type\n\n Args:\n field: the Field instance\n value: the stringified value\n\n TODO:\n Replace this by ordinary decoder\n '
if ((fie... | Try to decode string data into their original type
Args:
field: the Field instance
value: the stringified value
TODO:
Replace this by ordinary decoder | modules/s3/s3import.py | _decode_data | annehaley/eden | 205 | python | @staticmethod
def _decode_data(field, value):
'\n Try to decode string data into their original type\n\n Args:\n field: the Field instance\n value: the stringified value\n\n TODO:\n Replace this by ordinary decoder\n '
if ((fie... | @staticmethod
def _decode_data(field, value):
'\n Try to decode string data into their original type\n\n Args:\n field: the Field instance\n value: the stringified value\n\n TODO:\n Replace this by ordinary decoder\n '
if ((fie... |
98ec711806e5930a986cca4c99e0a05bd7f86700a0069190ed182735ab59ba74 | @staticmethod
def date_represent(date_obj):
'\n Represent a datetime object as string\n\n Args:\n date_obj: the datetime object\n\n TODO:\n Replace by S3DateTime method?\n '
return date_obj.strftime('%d %B %Y, %I:%M%p') | Represent a datetime object as string
Args:
date_obj: the datetime object
TODO:
Replace by S3DateTime method? | modules/s3/s3import.py | date_represent | annehaley/eden | 205 | python | @staticmethod
def date_represent(date_obj):
'\n Represent a datetime object as string\n\n Args:\n date_obj: the datetime object\n\n TODO:\n Replace by S3DateTime method?\n '
return date_obj.strftime('%d %B %Y, %I:%M%p') | @staticmethod
def date_represent(date_obj):
'\n Represent a datetime object as string\n\n Args:\n date_obj: the datetime object\n\n TODO:\n Replace by S3DateTime method?\n '
return date_obj.strftime('%d %B %Y, %I:%M%p')<|docstring|>Represent ... |
fff7cfb1106e955ff15ad4b44dfa7b70c1b481823204d4946e888776487bd45b | def _process_item_list(self, upload_id, req_vars):
'\n Get the list of IDs for the selected items from the "mode"\n and "selected" request variables\n\n Args:\n upload_id: the upload_id\n vars: the request variables\n '
items = None
if ('... | Get the list of IDs for the selected items from the "mode"
and "selected" request variables
Args:
upload_id: the upload_id
vars: the request variables | modules/s3/s3import.py | _process_item_list | annehaley/eden | 205 | python | def _process_item_list(self, upload_id, req_vars):
'\n Get the list of IDs for the selected items from the "mode"\n and "selected" request variables\n\n Args:\n upload_id: the upload_id\n vars: the request variables\n '
items = None
if ('... | def _process_item_list(self, upload_id, req_vars):
'\n Get the list of IDs for the selected items from the "mode"\n and "selected" request variables\n\n Args:\n upload_id: the upload_id\n vars: the request variables\n '
items = None
if ('... |
b135d3a513c43063a496cb8fced492def87f4cead0749cd1d0f1a83a52e08ce2 | def _get_all_items(self, upload_id, as_string=False):
'\n Get a list of the record IDs of all import items for\n the the given upload ID\n\n Args:\n upload_id: the upload ID\n as_string: represent each ID as string\n '
item_table = S3ImportJo... | Get a list of the record IDs of all import items for
the the given upload ID
Args:
upload_id: the upload ID
as_string: represent each ID as string | modules/s3/s3import.py | _get_all_items | annehaley/eden | 205 | python | def _get_all_items(self, upload_id, as_string=False):
'\n Get a list of the record IDs of all import items for\n the the given upload ID\n\n Args:\n upload_id: the upload ID\n as_string: represent each ID as string\n '
item_table = S3ImportJo... | def _get_all_items(self, upload_id, as_string=False):
'\n Get a list of the record IDs of all import items for\n the the given upload ID\n\n Args:\n upload_id: the upload ID\n as_string: represent each ID as string\n '
item_table = S3ImportJo... |
ec4eb4ae28df75b2abb14890e2d9709d0dafe1d0cc1987e94b204f13443c268d | def _use_upload_table(self):
'\n Set the resource and the table to being s3_import_upload\n '
self.tablename = self.upload_tablename
if (self.upload_resource is None):
self.upload_resource = current.s3db.resource(self.tablename)
self.resource = self.upload_resource
self.tab... | Set the resource and the table to being s3_import_upload | modules/s3/s3import.py | _use_upload_table | annehaley/eden | 205 | python | def _use_upload_table(self):
'\n \n '
self.tablename = self.upload_tablename
if (self.upload_resource is None):
self.upload_resource = current.s3db.resource(self.tablename)
self.resource = self.upload_resource
self.table = self.upload_table | def _use_upload_table(self):
'\n \n '
self.tablename = self.upload_tablename
if (self.upload_resource is None):
self.upload_resource = current.s3db.resource(self.tablename)
self.resource = self.upload_resource
self.table = self.upload_table<|docstring|>Set the resource and ... |
897b7f1ef59dc96446be52115ccbc078fa94677e2207ef3217dce257727873b5 | def _use_controller_table(self):
'\n Set the resource and the table to be the imported resource\n '
self.resource = self.controller_resource
self.table = self.controller_table
self.tablename = self.controller_tablename | Set the resource and the table to be the imported resource | modules/s3/s3import.py | _use_controller_table | annehaley/eden | 205 | python | def _use_controller_table(self):
'\n \n '
self.resource = self.controller_resource
self.table = self.controller_table
self.tablename = self.controller_tablename | def _use_controller_table(self):
'\n \n '
self.resource = self.controller_resource
self.table = self.controller_table
self.tablename = self.controller_tablename<|docstring|>Set the resource and the table to be the imported resource<|endoftext|> |
b162809af2a1efdadef35dd94d3124f1d6f8e8baf41552adf82ad8cef9a0d949 | def _use_import_item_table(self, job_id):
'\n Set the resource and the table to being s3_import_item\n '
self.table = S3ImportJob.define_item_table()
self.tablename = S3ImportJob.ITEM_TABLE_NAME
if (self.item_resource == None):
self.item_resource = current.s3db.resource(self.ta... | Set the resource and the table to being s3_import_item | modules/s3/s3import.py | _use_import_item_table | annehaley/eden | 205 | python | def _use_import_item_table(self, job_id):
'\n \n '
self.table = S3ImportJob.define_item_table()
self.tablename = S3ImportJob.ITEM_TABLE_NAME
if (self.item_resource == None):
self.item_resource = current.s3db.resource(self.tablename)
self.resource = self.item_resource | def _use_import_item_table(self, job_id):
'\n \n '
self.table = S3ImportJob.define_item_table()
self.tablename = S3ImportJob.ITEM_TABLE_NAME
if (self.item_resource == None):
self.item_resource = current.s3db.resource(self.tablename)
self.resource = self.item_resource<|docst... |
16093ba8501827e1e233f1cbfb40ba61c87ac30bfa765e33d4322e07a425e87f | def __define_table(self):
' Configures the upload table '
T = current.T
request = current.request
self.upload_tablename = self.UPLOAD_TABLE_NAME
import_upload_status = {1: T('Pending'), 2: T('In error'), 3: T('Completed')}
now = request.utcnow
table = self.define_upload_table()
table.fil... | Configures the upload table | modules/s3/s3import.py | __define_table | annehaley/eden | 205 | python | def __define_table(self):
' '
T = current.T
request = current.request
self.upload_tablename = self.UPLOAD_TABLE_NAME
import_upload_status = {1: T('Pending'), 2: T('In error'), 3: T('Completed')}
now = request.utcnow
table = self.define_upload_table()
table.file.upload_folder = os.path.j... | def __define_table(self):
' '
T = current.T
request = current.request
self.upload_tablename = self.UPLOAD_TABLE_NAME
import_upload_status = {1: T('Pending'), 2: T('In error'), 3: T('Completed')}
now = request.utcnow
table = self.define_upload_table()
table.file.upload_folder = os.path.j... |
44852323f610fa9005900631b4a29e4aac9d79837fd59942da6880bc9707d480 | @classmethod
def define_upload_table(cls):
' Defines the upload table '
db = current.db
UPLOAD_TABLE_NAME = cls.UPLOAD_TABLE_NAME
if (UPLOAD_TABLE_NAME not in db):
db.define_table(UPLOAD_TABLE_NAME, Field('controller', readable=False, writable=False), Field('function', readable=False, writable=F... | Defines the upload table | modules/s3/s3import.py | define_upload_table | annehaley/eden | 205 | python | @classmethod
def define_upload_table(cls):
' '
db = current.db
UPLOAD_TABLE_NAME = cls.UPLOAD_TABLE_NAME
if (UPLOAD_TABLE_NAME not in db):
db.define_table(UPLOAD_TABLE_NAME, Field('controller', readable=False, writable=False), Field('function', readable=False, writable=False), Field('file', 'up... | @classmethod
def define_upload_table(cls):
' '
db = current.db
UPLOAD_TABLE_NAME = cls.UPLOAD_TABLE_NAME
if (UPLOAD_TABLE_NAME not in db):
db.define_table(UPLOAD_TABLE_NAME, Field('controller', readable=False, writable=False), Field('function', readable=False, writable=False), Field('file', 'up... |
7f5b90dd9acf95b7585175cedeb15e6f9265e81e5430b5ebdd7949ac9d1116c2 | def __init__(self, job):
'\n Constructor\n\n Args:\n job: the import job this item belongs to\n '
self.job = job
self.lock = False
self.error = None
self.item_id = uuid.uuid4()
self.id = None
self.uid = None
self.table = None
self.tablename... | Constructor
Args:
job: the import job this item belongs to | modules/s3/s3import.py | __init__ | annehaley/eden | 205 | python | def __init__(self, job):
'\n Constructor\n\n Args:\n job: the import job this item belongs to\n '
self.job = job
self.lock = False
self.error = None
self.item_id = uuid.uuid4()
self.id = None
self.uid = None
self.table = None
self.tablename... | def __init__(self, job):
'\n Constructor\n\n Args:\n job: the import job this item belongs to\n '
self.job = job
self.lock = False
self.error = None
self.item_id = uuid.uuid4()
self.id = None
self.uid = None
self.table = None
self.tablename... |
050163082962a386171159e54a42d41c3e5365dd6ba05079f2c551a447c8ff3f | def __repr__(self):
' Helper method for debugging '
_str = ('<S3ImportItem %s {item_id=%s uid=%s id=%s error=%s data=%s}>' % (self.table, self.item_id, self.uid, self.id, self.error, self.data))
return _str | Helper method for debugging | modules/s3/s3import.py | __repr__ | annehaley/eden | 205 | python | def __repr__(self):
' '
_str = ('<S3ImportItem %s {item_id=%s uid=%s id=%s error=%s data=%s}>' % (self.table, self.item_id, self.uid, self.id, self.error, self.data))
return _str | def __repr__(self):
' '
_str = ('<S3ImportItem %s {item_id=%s uid=%s id=%s error=%s data=%s}>' % (self.table, self.item_id, self.uid, self.id, self.error, self.data))
return _str<|docstring|>Helper method for debugging<|endoftext|> |
e19c41de098f79eaf7edb82bce7d82c3de602ac730d6ee67b9b0774751af8b4b | def parse(self, element, original=None, table=None, tree=None, files=None):
'\n Read data from a <resource> element\n\n Args:\n element: the element\n table: the DB table\n tree: the import tree\n files: uploaded files\n\n ... | Read data from a <resource> element
Args:
element: the element
table: the DB table
tree: the import tree
files: uploaded files
Returns:
True if successful, False if not (sets self.error) | modules/s3/s3import.py | parse | annehaley/eden | 205 | python | def parse(self, element, original=None, table=None, tree=None, files=None):
'\n Read data from a <resource> element\n\n Args:\n element: the element\n table: the DB table\n tree: the import tree\n files: uploaded files\n\n ... | def parse(self, element, original=None, table=None, tree=None, files=None):
'\n Read data from a <resource> element\n\n Args:\n element: the element\n table: the DB table\n tree: the import tree\n files: uploaded files\n\n ... |
53e7355c75c6b6da453d2385e3cf5ef7200aa77f52a851a7fe5c7e7b56e6f486 | def deduplicate(self):
'\n Detect whether this is an update or a new record\n '
table = self.table
if ((table is None) or self.id):
return
METHOD = self.METHOD
CREATE = METHOD['CREATE']
UPDATE = METHOD['UPDATE']
DELETE = METHOD['DELETE']
MERGE = METHOD['MERGE']
... | Detect whether this is an update or a new record | modules/s3/s3import.py | deduplicate | annehaley/eden | 205 | python | def deduplicate(self):
'\n \n '
table = self.table
if ((table is None) or self.id):
return
METHOD = self.METHOD
CREATE = METHOD['CREATE']
UPDATE = METHOD['UPDATE']
DELETE = METHOD['DELETE']
MERGE = METHOD['MERGE']
xml = current.xml
UID = xml.UID
data... | def deduplicate(self):
'\n \n '
table = self.table
if ((table is None) or self.id):
return
METHOD = self.METHOD
CREATE = METHOD['CREATE']
UPDATE = METHOD['UPDATE']
DELETE = METHOD['DELETE']
MERGE = METHOD['MERGE']
xml = current.xml
UID = xml.UID
data... |
59d3c13cb6a853e1c0cf3b4a8e6e11887ee1837ac12c6947550c06db10012789 | def authorize(self):
'\n Authorize the import of this item, sets self.permitted\n '
if (not self.table):
return False
auth = current.auth
tablename = self.tablename
if ((not auth.override) and (tablename.split('_', 1)[0] in auth.PROTECTED)):
return False
METHOD ... | Authorize the import of this item, sets self.permitted | modules/s3/s3import.py | authorize | annehaley/eden | 205 | python | def authorize(self):
'\n \n '
if (not self.table):
return False
auth = current.auth
tablename = self.tablename
if ((not auth.override) and (tablename.split('_', 1)[0] in auth.PROTECTED)):
return False
METHOD = self.METHOD
if (self.data.deleted is True):
... | def authorize(self):
'\n \n '
if (not self.table):
return False
auth = current.auth
tablename = self.tablename
if ((not auth.override) and (tablename.split('_', 1)[0] in auth.PROTECTED)):
return False
METHOD = self.METHOD
if (self.data.deleted is True):
... |
6cb87dfb5fe7ec5c714abf64d63a82ba8cdd24e95eb4415f3ccf9b6a2378701e | def validate(self):
'\n Validate this item (=record onvalidation), sets self.accepted\n '
data = self.data
if (self.accepted is not None):
return self.accepted
if ((data is None) or (not self.table)):
self.accepted = False
return False
xml = current.xml
... | Validate this item (=record onvalidation), sets self.accepted | modules/s3/s3import.py | validate | annehaley/eden | 205 | python | def validate(self):
'\n \n '
data = self.data
if (self.accepted is not None):
return self.accepted
if ((data is None) or (not self.table)):
self.accepted = False
return False
xml = current.xml
ERROR = xml.ATTRIBUTE['error']
METHOD = self.METHOD
D... | def validate(self):
'\n \n '
data = self.data
if (self.accepted is not None):
return self.accepted
if ((data is None) or (not self.table)):
self.accepted = False
return False
xml = current.xml
ERROR = xml.ATTRIBUTE['error']
METHOD = self.METHOD
D... |
0337b2cbd9c8624d427d30110a88a70fdfb1d5b42e5a560484c385682f191983 | def commit(self, ignore_errors=False):
'\n Commit this item to the database\n\n Args:\n ignore_errors: skip invalid components\n (still reports errors)\n '
if self.committed:
return True
if ((self.parent is not None) and self.... | Commit this item to the database
Args:
ignore_errors: skip invalid components
(still reports errors) | modules/s3/s3import.py | commit | annehaley/eden | 205 | python | def commit(self, ignore_errors=False):
'\n Commit this item to the database\n\n Args:\n ignore_errors: skip invalid components\n (still reports errors)\n '
if self.committed:
return True
if ((self.parent is not None) and self.... | def commit(self, ignore_errors=False):
'\n Commit this item to the database\n\n Args:\n ignore_errors: skip invalid components\n (still reports errors)\n '
if self.committed:
return True
if ((self.parent is not None) and self.... |
2e4ed6e6b1c60ad8e8318658722352053c4861603b1493c284809d86e486ae8b | def _dynamic_defaults(self, data):
'\n Applies dynamic defaults from any keys in data that start with\n an underscore, used only for new records and only if the respective\n field is not populated yet.\n\n Args:\n data: the data dict\n '
for (k, ... | Applies dynamic defaults from any keys in data that start with
an underscore, used only for new records and only if the respective
field is not populated yet.
Args:
data: the data dict | modules/s3/s3import.py | _dynamic_defaults | annehaley/eden | 205 | python | def _dynamic_defaults(self, data):
'\n Applies dynamic defaults from any keys in data that start with\n an underscore, used only for new records and only if the respective\n field is not populated yet.\n\n Args:\n data: the data dict\n '
for (k, ... | def _dynamic_defaults(self, data):
'\n Applies dynamic defaults from any keys in data that start with\n an underscore, used only for new records and only if the respective\n field is not populated yet.\n\n Args:\n data: the data dict\n '
for (k, ... |
42643b242406090c287d3c7e28d47fcbceee68528d1dca6b3fdde0a7722ad483 | def _resolve_references(self):
'\n Resolve the references of this item (=look up all foreign\n keys from other items of the same job). If a foreign key\n is not yet available, it will be scheduled for later update.\n '
table = self.table
if (not table):
return... | Resolve the references of this item (=look up all foreign
keys from other items of the same job). If a foreign key
is not yet available, it will be scheduled for later update. | modules/s3/s3import.py | _resolve_references | annehaley/eden | 205 | python | def _resolve_references(self):
'\n Resolve the references of this item (=look up all foreign\n keys from other items of the same job). If a foreign key\n is not yet available, it will be scheduled for later update.\n '
table = self.table
if (not table):
return... | def _resolve_references(self):
'\n Resolve the references of this item (=look up all foreign\n keys from other items of the same job). If a foreign key\n is not yet available, it will be scheduled for later update.\n '
table = self.table
if (not table):
return... |
539649048fda0e3701c505e0e68f5aed7b439eebf16ccc968d6a728f1286ba33 | def _update_reference(self, field, value):
'\n Helper method to update a foreign key in an already written\n record. Will be called by the referenced item after (and only\n if) it has been committed. This is only needed if the reference\n could not be resolved before comm... | Helper method to update a foreign key in an already written
record. Will be called by the referenced item after (and only
if) it has been committed. This is only needed if the reference
could not be resolved before commit due to circular references.
Args:
field: the field name of the foreign key
value: the val... | modules/s3/s3import.py | _update_reference | annehaley/eden | 205 | python | def _update_reference(self, field, value):
'\n Helper method to update a foreign key in an already written\n record. Will be called by the referenced item after (and only\n if) it has been committed. This is only needed if the reference\n could not be resolved before comm... | def _update_reference(self, field, value):
'\n Helper method to update a foreign key in an already written\n record. Will be called by the referenced item after (and only\n if) it has been committed. This is only needed if the reference\n could not be resolved before comm... |
f75497e9c2022f55e245fb021ea6593619d25fce16c7823f999c3a4de140cb89 | def _update_objref(self, field, refkey, value):
'\n Update object references in a JSON field\n\n Args:\n fieldname: the name of the JSON field\n refkey: the reference key, a tuple (tablename, uidtype, uid)\n value: the foreign key value\n '
... | Update object references in a JSON field
Args:
fieldname: the name of the JSON field
refkey: the reference key, a tuple (tablename, uidtype, uid)
value: the foreign key value | modules/s3/s3import.py | _update_objref | annehaley/eden | 205 | python | def _update_objref(self, field, refkey, value):
'\n Update object references in a JSON field\n\n Args:\n fieldname: the name of the JSON field\n refkey: the reference key, a tuple (tablename, uidtype, uid)\n value: the foreign key value\n '
... | def _update_objref(self, field, refkey, value):
'\n Update object references in a JSON field\n\n Args:\n fieldname: the name of the JSON field\n refkey: the reference key, a tuple (tablename, uidtype, uid)\n value: the foreign key value\n '
... |
7920143cbee40a50d47a184382fc9991abc9bc1192fd26b4d28f1b31b14f6b35 | def store(self, item_table=None):
'\n Store this item in the DB\n '
if (item_table is None):
return None
item_id = self.item_id
db = current.db
row = db((item_table.item_id == item_id)).select(item_table.id, limitby=(0, 1)).first()
if row:
record_id = row.id
... | Store this item in the DB | modules/s3/s3import.py | store | annehaley/eden | 205 | python | def store(self, item_table=None):
'\n \n '
if (item_table is None):
return None
item_id = self.item_id
db = current.db
row = db((item_table.item_id == item_id)).select(item_table.id, limitby=(0, 1)).first()
if row:
record_id = row.id
else:
record_id ... | def store(self, item_table=None):
'\n \n '
if (item_table is None):
return None
item_id = self.item_id
db = current.db
row = db((item_table.item_id == item_id)).select(item_table.id, limitby=(0, 1)).first()
if row:
record_id = row.id
else:
record_id ... |
75ff8580c4985f56b0413feab22e2ef7fc100dfeaa44d3be9488768c9069f27b | def restore(self, row):
'\n Restore an item from a item table row. This does not restore\n the references (since this can not be done before all items\n are restored), must call job.restore_references() to do that\n\n Args:\n row: the item table row\n ... | Restore an item from a item table row. This does not restore
the references (since this can not be done before all items
are restored), must call job.restore_references() to do that
Args:
row: the item table row | modules/s3/s3import.py | restore | annehaley/eden | 205 | python | def restore(self, row):
'\n Restore an item from a item table row. This does not restore\n the references (since this can not be done before all items\n are restored), must call job.restore_references() to do that\n\n Args:\n row: the item table row\n ... | def restore(self, row):
'\n Restore an item from a item table row. This does not restore\n the references (since this can not be done before all items\n are restored), must call job.restore_references() to do that\n\n Args:\n row: the item table row\n ... |
ec0e9cd5fe4b992911c549c7f3894b7eea6e1bab3efb56fee6f85756c001c286 | def __init__(self, table, tree=None, files=None, job_id=None, strategy=None, update_policy=None, conflict_policy=None, last_sync=None, onconflict=None):
'\n Args:\n tree: the element tree to import\n files: files attached to the import (for upload fields)\n jo... | Args:
tree: the element tree to import
files: files attached to the import (for upload fields)
job_id: restore job from database (record ID or job_id)
strategy: the import strategy
update_policy: the update policy
conflict_policy: the conflict resolution policy
last_sync: the last synchroniz... | modules/s3/s3import.py | __init__ | annehaley/eden | 205 | python | def __init__(self, table, tree=None, files=None, job_id=None, strategy=None, update_policy=None, conflict_policy=None, last_sync=None, onconflict=None):
'\n Args:\n tree: the element tree to import\n files: files attached to the import (for upload fields)\n jo... | def __init__(self, table, tree=None, files=None, job_id=None, strategy=None, update_policy=None, conflict_policy=None, last_sync=None, onconflict=None):
'\n Args:\n tree: the element tree to import\n files: files attached to the import (for upload fields)\n jo... |
90fb07ed096c8bc50e408e1ad6a9ca38cb1b3b0d6539892d0233cfd198855bc7 | @property
def uidmap(self):
'\n Map uuid/tuid => element, for faster reference lookups\n '
uidmap = self._uidmap
tree = self.tree
if ((uidmap is None) and (tree is not None)):
root = (tree if isinstance(tree, etree._Element) else tree.getroot())
xml = current.xml
... | Map uuid/tuid => element, for faster reference lookups | modules/s3/s3import.py | uidmap | annehaley/eden | 205 | python | @property
def uidmap(self):
'\n \n '
uidmap = self._uidmap
tree = self.tree
if ((uidmap is None) and (tree is not None)):
root = (tree if isinstance(tree, etree._Element) else tree.getroot())
xml = current.xml
UUID = xml.UID
TUID = xml.ATTRIBUTE.tuid
... | @property
def uidmap(self):
'\n \n '
uidmap = self._uidmap
tree = self.tree
if ((uidmap is None) and (tree is not None)):
root = (tree if isinstance(tree, etree._Element) else tree.getroot())
xml = current.xml
UUID = xml.UID
TUID = xml.ATTRIBUTE.tuid
... |
c97bc4ac351bd87933f93fa2a04ece875045517730cd0958ca845eee6b59cc03 | def add_item(self, element=None, original=None, components=None, parent=None, joinby=None):
'\n Parse and validate an XML element and add it as new item\n to the job.\n\n Args:\n element: the element\n original: the original DB record (if already availa... | Parse and validate an XML element and add it as new item
to the job.
Args:
element: the element
original: the original DB record (if already available,
will otherwise be looked-up by this function)
components: a dictionary of components (as in S3Resource)
to include in the job... | modules/s3/s3import.py | add_item | annehaley/eden | 205 | python | def add_item(self, element=None, original=None, components=None, parent=None, joinby=None):
'\n Parse and validate an XML element and add it as new item\n to the job.\n\n Args:\n element: the element\n original: the original DB record (if already availa... | def add_item(self, element=None, original=None, components=None, parent=None, joinby=None):
'\n Parse and validate an XML element and add it as new item\n to the job.\n\n Args:\n element: the element\n original: the original DB record (if already availa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.