Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
TestSimplestCases.test_single_epoch_bright_transient
(self)
A bright transient appears at field centre in one image.
A bright transient appears at field centre in one image.
def test_single_epoch_bright_transient(self): """A bright transient appears at field centre in one image.""" im_params = self.im_params transient_src = db_subs.MockSource( template_extractedsource=db_subs.example_extractedsource_tuple( ra=im_params[0]['centre_ra'], ...
[ "def", "test_single_epoch_bright_transient", "(", "self", ")", ":", "im_params", "=", "self", ".", "im_params", "transient_src", "=", "db_subs", ".", "MockSource", "(", "template_extractedsource", "=", "db_subs", ".", "example_extractedsource_tuple", "(", "ra", "=", ...
[ 100, 4 ]
[ 162, 69 ]
python
en
['en', 'en', 'en']
True
TestSimplestCases.test_single_epoch_weak_transient
(self)
A weak (barely detected in blind extraction) transient appears at field centre in one image, then disappears entirely. Because it is a weak extraction, it will not be immediately marked as transient, but it will get flagged up after forced-fitting due to the variability search....
A weak (barely detected in blind extraction) transient appears at field centre in one image, then disappears entirely.
def test_single_epoch_weak_transient(self): """ A weak (barely detected in blind extraction) transient appears at field centre in one image, then disappears entirely. Because it is a weak extraction, it will not be immediately marked as transient, but it will get flagged up afte...
[ "def", "test_single_epoch_weak_transient", "(", "self", ")", ":", "im_params", "=", "self", ".", "im_params", "transient_src", "=", "db_subs", ".", "MockSource", "(", "template_extractedsource", "=", "db_subs", ".", "example_extractedsource_tuple", "(", "ra", "=", "...
[ 164, 4 ]
[ 221, 81 ]
python
en
['en', 'error', 'th']
False
TestSimplestCases.test_multi_epoch_source_flare_and_fade
(self)
A steady source (i.e. detected in first image) flares up, then fades and finally disappears.
A steady source (i.e. detected in first image) flares up, then fades and finally disappears.
def test_multi_epoch_source_flare_and_fade(self): """ A steady source (i.e. detected in first image) flares up, then fades and finally disappears. """ im_params = self.im_params transient_src = db_subs.MockSource( template_extractedsource=db_subs.example_extr...
[ "def", "test_multi_epoch_source_flare_and_fade", "(", "self", ")", ":", "im_params", "=", "self", ".", "im_params", "transient_src", "=", "db_subs", ".", "MockSource", "(", "template_extractedsource", "=", "db_subs", ".", "example_extractedsource_tuple", "(", "ra", "=...
[ 223, 4 ]
[ 312, 54 ]
python
en
['en', 'error', 'th']
False
TestDecreasingImageRMS.test_certain_transient
(self)
flux1 > (rms_max0*(det0+margin) --> Definite transient Nice and bright, must be new - mark it definite transient.
flux1 > (rms_max0*(det0+margin) --> Definite transient
def test_certain_transient(self): """ flux1 > (rms_max0*(det0+margin) --> Definite transient Nice and bright, must be new - mark it definite transient. """ img_params = self.img_params bright_transient = MockSource( example_extractedsource_tuple(ra=i...
[ "def", "test_certain_transient", "(", "self", ")", ":", "img_params", "=", "self", ".", "img_params", "bright_transient", "=", "MockSource", "(", "example_extractedsource_tuple", "(", "ra", "=", "img_params", "[", "0", "]", "[", "'centre_ra'", "]", ",", "dec", ...
[ 366, 4 ]
[ 405, 51 ]
python
en
['en', 'error', 'th']
False
TestDecreasingImageRMS.test_marginal_transient
(self)
( flux1 > (rms_min0*(det0 + margin) ) but ( flux1 < (rms_max0*(det0 + margin) ) --> Possible transient If it was in a region of rms_min, we would (almost certainly) have seen it in the first image. So new source --> Possible transient. But if it was in a region of rms_m...
( flux1 > (rms_min0*(det0 + margin) ) but ( flux1 < (rms_max0*(det0 + margin) ) --> Possible transient
def test_marginal_transient(self): """ ( flux1 > (rms_min0*(det0 + margin) ) but ( flux1 < (rms_max0*(det0 + margin) ) --> Possible transient If it was in a region of rms_min, we would (almost certainly) have seen it in the first image. So new source --> Possible transie...
[ "def", "test_marginal_transient", "(", "self", ")", ":", "img_params", "=", "self", ".", "img_params", "#Must pick flux value carefully to fire correct logic branch:", "marginal_transient_flux", "=", "self", ".", "reliably_detected_at_image_centre_flux", "marginal_transient", "="...
[ 407, 4 ]
[ 464, 78 ]
python
en
['en', 'error', 'th']
False
TestDecreasingImageRMS.test_probably_not_a_transient
(self)
( flux1 < (rms_min0*(det0 + margin) ) --> Probably not a transient NB even if avg_source_flux == rms_min0*det0 + epsilon we might not detect it in the first image, due to noise fluctuations. So we provide the user-tunable marginal_detection_thresh, to ignore...
( flux1 < (rms_min0*(det0 + margin) ) --> Probably not a transient
def test_probably_not_a_transient(self): """ ( flux1 < (rms_min0*(det0 + margin) ) --> Probably not a transient NB even if avg_source_flux == rms_min0*det0 + epsilon we might not detect it in the first image, due to noise fluctuations. So we provide the ...
[ "def", "test_probably_not_a_transient", "(", "self", ")", ":", "img_params", "=", "self", ".", "img_params", "img0", "=", "img_params", "[", "0", "]", "marginal_steady_src_flux", "=", "self", ".", "barely_detectable_flux", "# This time around, we just manually exclude the...
[ 467, 4 ]
[ 510, 44 ]
python
en
['en', 'error', 'th']
False
TestIncreasingImageRMS.test_null_detection_business_as_usual
(self)
If we do not blindly extract a steady source due to increased RMS, then we expect a null-detection forced-fit to be triggered. However, if the source properties are steady, this should not result in the source being identified as transient.
If we do not blindly extract a steady source due to increased RMS, then we expect a null-detection forced-fit to be triggered.
def test_null_detection_business_as_usual(self): """ If we do not blindly extract a steady source due to increased RMS, then we expect a null-detection forced-fit to be triggered. However, if the source properties are steady, this should not result in the source being identified...
[ "def", "test_null_detection_business_as_usual", "(", "self", ")", ":", "img0", "=", "self", ".", "img_params", "[", "0", "]", "steady_src_flux", "=", "self", ".", "barely_detectable_flux", "steady_src", "=", "MockSource", "(", "example_extractedsource_tuple", "(", "...
[ 554, 4 ]
[ 588, 43 ]
python
en
['en', 'error', 'th']
False
TestMultipleFrequencyBands.test_probably_not_a_transient
(self)
No source at 250MHz, but we detect a source at 50MHz. Not necessarily a transient. Should trivially ignore 250MHz data when looking at a new 50MHz source.
No source at 250MHz, but we detect a source at 50MHz. Not necessarily a transient. Should trivially ignore 250MHz data when looking at a new 50MHz source.
def test_probably_not_a_transient(self): """ No source at 250MHz, but we detect a source at 50MHz. Not necessarily a transient. Should trivially ignore 250MHz data when looking at a new 50MHz source. """ img_params = self.img_params img0 = img_params[0] ...
[ "def", "test_probably_not_a_transient", "(", "self", ")", ":", "img_params", "=", "self", ".", "img_params", "img0", "=", "img_params", "[", "0", "]", "# This time around, we just manually exclude the steady src from", "# the first image detections.", "steady_low_freq_src", "...
[ 641, 4 ]
[ 671, 44 ]
python
en
['en', 'error', 'th']
False
flux_gate_with_build_up
(year, flux_value=None, flux_gate_yr=None)
Default scalar flux gate with build up period
Default scalar flux gate with build up period
def flux_gate_with_build_up(year, flux_value=None, flux_gate_yr=None): """Default scalar flux gate with build up period""" fac = 1 - (flux_gate_yr - year) / flux_gate_yr return flux_value * utils.clip_scalar(fac, 0, 1)
[ "def", "flux_gate_with_build_up", "(", "year", ",", "flux_value", "=", "None", ",", "flux_gate_yr", "=", "None", ")", ":", "fac", "=", "1", "-", "(", "flux_gate_yr", "-", "year", ")", "/", "flux_gate_yr", "return", "flux_value", "*", "utils", ".", "clip_sc...
[ 1422, 0 ]
[ 1425, 52 ]
python
en
['en', 'en', 'en']
True
mass_redistribution_curve_huss
(height, bin_area, mb, glac_idx, glacier_delta_v)
Apply the mass redistribution curves from Huss and Hock (2015). This has to be followed by added logic which takes into consideration retreat and advance. Parameters ---------- height : np.ndarray Glacier elevation [m] from previous year for each elevation bin bin_area : np.ndarray ...
Apply the mass redistribution curves from Huss and Hock (2015).
def mass_redistribution_curve_huss(height, bin_area, mb, glac_idx, glacier_delta_v): """Apply the mass redistribution curves from Huss and Hock (2015). This has to be followed by added logic which takes into consideration retreat and advance. Parameters ---------- height : np.ndarray G...
[ "def", "mass_redistribution_curve_huss", "(", "height", ",", "bin_area", ",", "mb", ",", "glac_idx", ",", "glacier_delta_v", ")", ":", "# Apply mass redistribution curve", "if", "glac_idx", ".", "shape", "[", "0", "]", "<=", "3", ":", "# No need for a curve when gla...
[ 2447, 0 ]
[ 2510, 44 ]
python
en
['en', 'en', 'en']
True
Flowline.__init__
(self, line=None, dx=1, map_dx=None, surface_h=None, bed_h=None, rgi_id=None, water_level=None, gdir=None)
Initialize a Flowline Parameters ---------- line : :py:class:`shapely.geometry.LineString` the geometrical line of a :py:class:`oggm.Centerline` dx : float Grid spacing in pixel coordinates map_dx : float DEM grid spacing in meters su...
Initialize a Flowline
def __init__(self, line=None, dx=1, map_dx=None, surface_h=None, bed_h=None, rgi_id=None, water_level=None, gdir=None): """ Initialize a Flowline Parameters ---------- line : :py:class:`shapely.geometry.LineString` the geometrical line of a ...
[ "def", "__init__", "(", "self", ",", "line", "=", "None", ",", "dx", "=", "1", ",", "map_dx", "=", "None", ",", "surface_h", "=", "None", ",", "bed_h", "=", "None", ",", "rgi_id", "=", "None", ",", "water_level", "=", "None", ",", "gdir", "=", "N...
[ 52, 4 ]
[ 96, 34 ]
python
en
['en', 'pl', 'it']
False
Flowline.widths
(self)
Compute the widths out of H and shape
Compute the widths out of H and shape
def widths(self): """Compute the widths out of H and shape""" return self.widths_m / self.map_dx
[ "def", "widths", "(", "self", ")", ":", "return", "self", ".", "widths_m", "/", "self", ".", "map_dx" ]
[ 102, 4 ]
[ 104, 42 ]
python
en
['en', 'en', 'en']
True
Flowline.thick
(self)
Needed for overriding later
Needed for overriding later
def thick(self): """Needed for overriding later""" return self._thick
[ "def", "thick", "(", "self", ")", ":", "return", "self", ".", "_thick" ]
[ 107, 4 ]
[ 109, 26 ]
python
en
['en', 'en', 'en']
True
Flowline._add_attrs_to_dataset
(self, ds)
Add bed specific parameters.
Add bed specific parameters.
def _add_attrs_to_dataset(self, ds): """Add bed specific parameters.""" # This must be done by child classes raise NotImplementedError()
[ "def", "_add_attrs_to_dataset", "(", "self", ",", "ds", ")", ":", "# This must be done by child classes", "raise", "NotImplementedError", "(", ")" ]
[ 230, 4 ]
[ 233, 35 ]
python
en
['en', 'en', 'en']
True
Flowline.to_geometry_dataset
(self)
Makes an xarray Dataset out of the flowline. Useful only for geometry files (FileModel / restart files), therefore a bit cryptic regarding dimensions.
Makes an xarray Dataset out of the flowline.
def to_geometry_dataset(self): """Makes an xarray Dataset out of the flowline. Useful only for geometry files (FileModel / restart files), therefore a bit cryptic regarding dimensions. """ h = self.surface_h nx = len(h) ds = xr.Dataset() ds.coords['x'] =...
[ "def", "to_geometry_dataset", "(", "self", ")", ":", "h", "=", "self", ".", "surface_h", "nx", "=", "len", "(", "h", ")", "ds", "=", "xr", ".", "Dataset", "(", ")", "ds", ".", "coords", "[", "'x'", "]", "=", "np", ".", "arange", "(", "nx", ")",...
[ 235, 4 ]
[ 258, 17 ]
python
en
['en', 'en', 'en']
True
Flowline.to_diagnostics_dataset
(self)
Makes an xarray Dataset out of the flowline. Useful for run_until_and_store's flowline diagnostics data.
Makes an xarray Dataset out of the flowline.
def to_diagnostics_dataset(self): """Makes an xarray Dataset out of the flowline. Useful for run_until_and_store's flowline diagnostics data. """ h = self.bed_h nx = len(h) ds = xr.Dataset() ds.coords['dis_along_flowline'] = np.arange(nx) * self.map_dx * self.dx...
[ "def", "to_diagnostics_dataset", "(", "self", ")", ":", "h", "=", "self", ".", "bed_h", "nx", "=", "len", "(", "h", ")", "ds", "=", "xr", ".", "Dataset", "(", ")", "ds", ".", "coords", "[", "'dis_along_flowline'", "]", "=", "np", ".", "arange", "("...
[ 260, 4 ]
[ 289, 17 ]
python
en
['en', 'en', 'en']
True
ParabolicBedFlowline.__init__
(self, line=None, dx=None, map_dx=None, surface_h=None, bed_h=None, bed_shape=None, rgi_id=None, water_level=None, gdir=None)
Instantiate. Parameters ---------- line : :py:class:`shapely.geometry.LineString` the geometrical line of a :py:class:`oggm.Centerline`
Instantiate.
def __init__(self, line=None, dx=None, map_dx=None, surface_h=None, bed_h=None, bed_shape=None, rgi_id=None, water_level=None, gdir=None): """ Instantiate. Parameters ---------- line : :py:class:`shapely.geometry.LineString` the geometrical ...
[ "def", "__init__", "(", "self", ",", "line", "=", "None", ",", "dx", "=", "None", ",", "map_dx", "=", "None", ",", "surface_h", "=", "None", ",", "bed_h", "=", "None", ",", "bed_shape", "=", "None", ",", "rgi_id", "=", "None", ",", "water_level", "...
[ 296, 4 ]
[ 313, 34 ]
python
en
['en', 'nl', 'en']
False
ParabolicBedFlowline.widths_m
(self)
Compute the widths out of H and shape
Compute the widths out of H and shape
def widths_m(self): """Compute the widths out of H and shape""" return np.sqrt(4*self.thick/self.bed_shape)
[ "def", "widths_m", "(", "self", ")", ":", "return", "np", ".", "sqrt", "(", "4", "*", "self", ".", "thick", "/", "self", ".", "bed_shape", ")" ]
[ 316, 4 ]
[ 318, 51 ]
python
en
['en', 'en', 'en']
True
ParabolicBedFlowline.shape_str
(self)
The bed shape in text (for debug and other things)
The bed shape in text (for debug and other things)
def shape_str(self): """The bed shape in text (for debug and other things)""" return np.repeat('parabolic', self.nx)
[ "def", "shape_str", "(", "self", ")", ":", "return", "np", ".", "repeat", "(", "'parabolic'", ",", "self", ".", "nx", ")" ]
[ 329, 4 ]
[ 331, 46 ]
python
en
['en', 'en', 'en']
True
ParabolicBedFlowline._add_attrs_to_dataset
(self, ds)
Add bed specific parameters.
Add bed specific parameters.
def _add_attrs_to_dataset(self, ds): """Add bed specific parameters.""" ds['bed_shape'] = (['x'], self.bed_shape)
[ "def", "_add_attrs_to_dataset", "(", "self", ",", "ds", ")", ":", "ds", "[", "'bed_shape'", "]", "=", "(", "[", "'x'", "]", ",", "self", ".", "bed_shape", ")" ]
[ 333, 4 ]
[ 335, 49 ]
python
en
['en', 'en', 'en']
True
RectangularBedFlowline.__init__
(self, line=None, dx=None, map_dx=None, surface_h=None, bed_h=None, widths=None, rgi_id=None, water_level=None, gdir=None)
Instantiate. Parameters ---------- line : :py:class:`shapely.geometry.LineString` the geometrical line of a :py:class:`oggm.Centerline`
Instantiate.
def __init__(self, line=None, dx=None, map_dx=None, surface_h=None, bed_h=None, widths=None, rgi_id=None, water_level=None, gdir=None): """ Instantiate. Parameters ---------- line : :py:class:`shapely.geometry.LineString` the geometrical lin...
[ "def", "__init__", "(", "self", ",", "line", "=", "None", ",", "dx", "=", "None", ",", "map_dx", "=", "None", ",", "surface_h", "=", "None", ",", "bed_h", "=", "None", ",", "widths", "=", "None", ",", "rgi_id", "=", "None", ",", "water_level", "=",...
[ 343, 4 ]
[ 360, 29 ]
python
en
['en', 'nl', 'en']
False
RectangularBedFlowline.widths_m
(self)
Compute the widths out of H and shape
Compute the widths out of H and shape
def widths_m(self): """Compute the widths out of H and shape""" return self._widths * self.map_dx
[ "def", "widths_m", "(", "self", ")", ":", "return", "self", ".", "_widths", "*", "self", ".", "map_dx" ]
[ 363, 4 ]
[ 365, 41 ]
python
en
['en', 'en', 'en']
True
RectangularBedFlowline.shape_str
(self)
The bed shape in text (for debug and other things)
The bed shape in text (for debug and other things)
def shape_str(self): """The bed shape in text (for debug and other things)""" return np.repeat('rectangular', self.nx)
[ "def", "shape_str", "(", "self", ")", ":", "return", "np", ".", "repeat", "(", "'rectangular'", ",", "self", ".", "nx", ")" ]
[ 376, 4 ]
[ 378, 48 ]
python
en
['en', 'en', 'en']
True
RectangularBedFlowline._add_attrs_to_dataset
(self, ds)
Add bed specific parameters.
Add bed specific parameters.
def _add_attrs_to_dataset(self, ds): """Add bed specific parameters.""" ds['widths'] = (['x'], self._widths)
[ "def", "_add_attrs_to_dataset", "(", "self", ",", "ds", ")", ":", "ds", "[", "'widths'", "]", "=", "(", "[", "'x'", "]", ",", "self", ".", "_widths", ")" ]
[ 380, 4 ]
[ 382, 44 ]
python
en
['en', 'en', 'en']
True
TrapezoidalBedFlowline.__init__
(self, line=None, dx=None, map_dx=None, surface_h=None, bed_h=None, widths=None, lambdas=None, rgi_id=None, water_level=None, gdir=None)
Instantiate. Parameters ---------- line : :py:class:`shapely.geometry.LineString` the geometrical line of a :py:class:`oggm.Centerline`
Instantiate.
def __init__(self, line=None, dx=None, map_dx=None, surface_h=None, bed_h=None, widths=None, lambdas=None, rgi_id=None, water_level=None, gdir=None): """ Instantiate. Parameters ---------- line : :py:class:`shapely.geometry.LineString` the g...
[ "def", "__init__", "(", "self", ",", "line", "=", "None", ",", "dx", "=", "None", ",", "map_dx", "=", "None", ",", "surface_h", "=", "None", ",", "bed_h", "=", "None", ",", "widths", "=", "None", ",", "lambdas", "=", "None", ",", "rgi_id", "=", "...
[ 389, 4 ]
[ 412, 31 ]
python
en
['en', 'nl', 'en']
False
TrapezoidalBedFlowline.widths_m
(self)
Compute the widths out of H and shape
Compute the widths out of H and shape
def widths_m(self): """Compute the widths out of H and shape""" return self._w0_m + self._lambdas * self.thick
[ "def", "widths_m", "(", "self", ")", ":", "return", "self", ".", "_w0_m", "+", "self", ".", "_lambdas", "*", "self", ".", "thick" ]
[ 415, 4 ]
[ 417, 54 ]
python
en
['en', 'en', 'en']
True
TrapezoidalBedFlowline.shape_str
(self)
The bed shape in text (for debug and other things)
The bed shape in text (for debug and other things)
def shape_str(self): """The bed shape in text (for debug and other things)""" return np.repeat('trapezoid', self.nx)
[ "def", "shape_str", "(", "self", ")", ":", "return", "np", ".", "repeat", "(", "'trapezoid'", ",", "self", ".", "nx", ")" ]
[ 433, 4 ]
[ 435, 46 ]
python
en
['en', 'en', 'en']
True
TrapezoidalBedFlowline._add_attrs_to_dataset
(self, ds)
Add bed specific parameters.
Add bed specific parameters.
def _add_attrs_to_dataset(self, ds): """Add bed specific parameters.""" ds['widths'] = (['x'], self.widths) ds['lambdas'] = (['x'], self._lambdas)
[ "def", "_add_attrs_to_dataset", "(", "self", ",", "ds", ")", ":", "ds", "[", "'widths'", "]", "=", "(", "[", "'x'", "]", ",", "self", ".", "widths", ")", "ds", "[", "'lambdas'", "]", "=", "(", "[", "'x'", "]", ",", "self", ".", "_lambdas", ")" ]
[ 437, 4 ]
[ 440, 46 ]
python
en
['en', 'en', 'en']
True
MixedBedFlowline.__init__
(self, *, line=None, dx=None, map_dx=None, surface_h=None, bed_h=None, section=None, bed_shape=None, is_trapezoid=None, lambdas=None, widths_m=None, rgi_id=None, water_level=None, gdir=None)
Instantiate. Parameters ---------- line : :py:class:`shapely.geometry.LineString` the geometrical line of a :py:class:`oggm.Centerline`
Instantiate.
def __init__(self, *, line=None, dx=None, map_dx=None, surface_h=None, bed_h=None, section=None, bed_shape=None, is_trapezoid=None, lambdas=None, widths_m=None, rgi_id=None, water_level=None, gdir=None): """ Instantiate. Parameters ---------- ...
[ "def", "__init__", "(", "self", ",", "*", ",", "line", "=", "None", ",", "dx", "=", "None", ",", "map_dx", "=", "None", ",", "surface_h", "=", "None", ",", "bed_h", "=", "None", ",", "section", "=", "None", ",", "bed_shape", "=", "None", ",", "is...
[ 450, 4 ]
[ 512, 49 ]
python
en
['en', 'nl', 'en']
False
MixedBedFlowline.widths_m
(self)
Compute the widths out of H and shape
Compute the widths out of H and shape
def widths_m(self): """Compute the widths out of H and shape""" out = np.sqrt(4*self.thick/self.bed_shape) if self._do_trapeze: out[self._ptrap] = (self._w0_m[self._ptrap] + self._lambdas[self._ptrap] * self.thick[self._...
[ "def", "widths_m", "(", "self", ")", ":", "out", "=", "np", ".", "sqrt", "(", "4", "*", "self", ".", "thick", "/", "self", ".", "bed_shape", ")", "if", "self", ".", "_do_trapeze", ":", "out", "[", "self", ".", "_ptrap", "]", "=", "(", "self", "...
[ 515, 4 ]
[ 522, 18 ]
python
en
['en', 'en', 'en']
True
MixedBedFlowline.shape_str
(self)
The bed shape in text (for debug and other things)
The bed shape in text (for debug and other things)
def shape_str(self): """The bed shape in text (for debug and other things)""" out = np.repeat('rectangular', self.nx) out[~ self.is_trapezoid] = 'parabolic' out[self.is_trapezoid & ~ self.is_rectangular] = 'trapezoid' return out
[ "def", "shape_str", "(", "self", ")", ":", "out", "=", "np", ".", "repeat", "(", "'rectangular'", ",", "self", ".", "nx", ")", "out", "[", "~", "self", ".", "is_trapezoid", "]", "=", "'parabolic'", "out", "[", "self", ".", "is_trapezoid", "&", "~", ...
[ 546, 4 ]
[ 551, 18 ]
python
en
['en', 'en', 'en']
True
MixedBedFlowline._add_attrs_to_dataset
(self, ds)
Add bed specific parameters.
Add bed specific parameters.
def _add_attrs_to_dataset(self, ds): """Add bed specific parameters.""" ds['section'] = (['x'], self.section) ds['bed_shape'] = (['x'], self.bed_shape) ds['is_trapezoid'] = (['x'], self.is_trapezoid) ds['widths_m'] = (['x'], self._w0_m) ds['lambdas'] = (['x'], self._lamb...
[ "def", "_add_attrs_to_dataset", "(", "self", ",", "ds", ")", ":", "ds", "[", "'section'", "]", "=", "(", "[", "'x'", "]", ",", "self", ".", "section", ")", "ds", "[", "'bed_shape'", "]", "=", "(", "[", "'x'", "]", ",", "self", ".", "bed_shape", "...
[ 553, 4 ]
[ 560, 46 ]
python
en
['en', 'en', 'en']
True
FlowlineModel.__init__
(self, flowlines, mb_model=None, y0=0., glen_a=None, fs=None, inplace=False, smooth_trib_influx=True, is_tidewater=False, is_lake_terminating=False, mb_elev_feedback='annual', check_for_boundaries=None, water_level=None, required_model_steps='monthly')
Create a new flowline model from the flowlines and a MB model. Parameters ---------- flowlines : list a list of :py:class:`oggm.Flowline` instances, sorted by order mb_model : :py:class:`oggm.core.massbalance.MassBalanceModel` the MB model to use y0 : int...
Create a new flowline model from the flowlines and a MB model.
def __init__(self, flowlines, mb_model=None, y0=0., glen_a=None, fs=None, inplace=False, smooth_trib_influx=True, is_tidewater=False, is_lake_terminating=False, mb_elev_feedback='annual', check_for_boundaries=None, water_level=None, required_model_step...
[ "def", "__init__", "(", "self", ",", "flowlines", ",", "mb_model", "=", "None", ",", "y0", "=", "0.", ",", "glen_a", "=", "None", ",", "fs", "=", "None", ",", "inplace", "=", "False", ",", "smooth_trib_influx", "=", "True", ",", "is_tidewater", "=", ...
[ 566, 4 ]
[ 676, 67 ]
python
en
['en', 'en', 'en']
True
FlowlineModel.reset_y0
(self, y0)
Reset the initial model time
Reset the initial model time
def reset_y0(self, y0): """Reset the initial model time""" self.y0 = y0 self.t = 0
[ "def", "reset_y0", "(", "self", ",", "y0", ")", ":", "self", ".", "y0", "=", "y0", "self", ".", "t", "=", "0" ]
[ 699, 4 ]
[ 702, 18 ]
python
en
['en', 'en', 'en']
True
FlowlineModel.reset_flowlines
(self, flowlines, inplace=False, smooth_trib_influx=True)
Reset the initial model flowlines
Reset the initial model flowlines
def reset_flowlines(self, flowlines, inplace=False, smooth_trib_influx=True): """Reset the initial model flowlines""" if not inplace: flowlines = copy.deepcopy(flowlines) try: len(flowlines) except TypeError: flowlines = [flow...
[ "def", "reset_flowlines", "(", "self", ",", "flowlines", ",", "inplace", "=", "False", ",", "smooth_trib_influx", "=", "True", ")", ":", "if", "not", "inplace", ":", "flowlines", "=", "copy", ".", "deepcopy", "(", "flowlines", ")", "try", ":", "len", "("...
[ 704, 4 ]
[ 746, 42 ]
python
en
['en', 'en', 'en']
True
FlowlineModel.get_mb
(self, heights, year=None, fl_id=None, fls=None)
Get the mass balance at the requested height and time. Optimized so that no mb model call is necessary at each step.
Get the mass balance at the requested height and time.
def get_mb(self, heights, year=None, fl_id=None, fls=None): """Get the mass balance at the requested height and time. Optimized so that no mb model call is necessary at each step. """ # Do we even have to optimise? if self.mb_elev_feedback == 'always': return self._...
[ "def", "get_mb", "(", "self", ",", "heights", ",", "year", "=", "None", ",", "fl_id", "=", "None", ",", "fls", "=", "None", ")", ":", "# Do we even have to optimise?", "if", "self", ".", "mb_elev_feedback", "==", "'always'", ":", "return", "self", ".", "...
[ 788, 4 ]
[ 831, 42 ]
python
en
['en', 'en', 'en']
True
FlowlineModel.to_geometry_netcdf
(self, path)
Creates a netcdf group file storing the state of the model.
Creates a netcdf group file storing the state of the model.
def to_geometry_netcdf(self, path): """Creates a netcdf group file storing the state of the model.""" flows_to_id = [] for trib in self._tributary_indices: flows_to_id.append(trib[0] if trib[0] is not None else -1) ds = xr.Dataset() try: ds.attrs['descri...
[ "def", "to_geometry_netcdf", "(", "self", ",", "path", ")", ":", "flows_to_id", "=", "[", "]", "for", "trib", "in", "self", ".", "_tributary_indices", ":", "flows_to_id", ".", "append", "(", "trib", "[", "0", "]", "if", "trib", "[", "0", "]", "is", "...
[ 833, 4 ]
[ 853, 22 ]
python
en
['en', 'en', 'en']
True
FlowlineModel.check_domain_end
(self)
Returns False if the glacier reaches the domains bound.
Returns False if the glacier reaches the domains bound.
def check_domain_end(self): """Returns False if the glacier reaches the domains bound.""" return np.isclose(self.fls[-1].thick[-1], 0)
[ "def", "check_domain_end", "(", "self", ")", ":", "return", "np", ".", "isclose", "(", "self", ".", "fls", "[", "-", "1", "]", ".", "thick", "[", "-", "1", "]", ",", "0", ")" ]
[ 855, 4 ]
[ 857, 52 ]
python
en
['en', 'fr', 'en']
True
FlowlineModel.step
(self, dt)
Advance the numerical simulation of one single step. Important: the step dt is a maximum boundary that is *not* guaranteed to be met if dt is too large for the underlying numerical implementation. However, ``step(dt)`` should never cross the desired time step, i.e. if dt is small enough...
Advance the numerical simulation of one single step.
def step(self, dt): """Advance the numerical simulation of one single step. Important: the step dt is a maximum boundary that is *not* guaranteed to be met if dt is too large for the underlying numerical implementation. However, ``step(dt)`` should never cross the desired time s...
[ "def", "step", "(", "self", ",", "dt", ")", ":", "raise", "NotImplementedError" ]
[ 859, 4 ]
[ 881, 33 ]
python
en
['en', 'en', 'en']
True
FlowlineModel.run_until
(self, y1)
Runs the model from the current year up to a given year date y1. This function runs the model for the time difference y1-self.y0 If self.y0 has not been specified at some point, it is 0 and y1 will be the time span in years to run the model for. Parameters ---------- y1...
Runs the model from the current year up to a given year date y1.
def run_until(self, y1): """Runs the model from the current year up to a given year date y1. This function runs the model for the time difference y1-self.y0 If self.y0 has not been specified at some point, it is 0 and y1 will be the time span in years to run the model for. Para...
[ "def", "run_until", "(", "self", ",", "y1", ")", ":", "if", "self", ".", "required_model_steps", "==", "'monthly'", ":", "# We force timesteps to monthly frequencies for consistent results", "# among use cases (monthly or yearly output) and also to prevent", "# \"too large\" steps ...
[ 883, 4 ]
[ 925, 75 ]
python
en
['en', 'en', 'en']
True
FlowlineModel.run_until_and_store
(self, y1, diag_path=None, fl_diag_path=False, geom_path=False, store_monthly_step=None, stop_criterion=None, fixed_geometry_spinup_yr=None ...
Runs the model and returns intermediate steps in xarray datasets. This function repeatedly calls FlowlineModel.run_until for either monthly or yearly time steps up till the upper time boundary y1. Parameters ---------- y1 : int Upper time span for how long the model...
Runs the model and returns intermediate steps in xarray datasets.
def run_until_and_store(self, y1, diag_path=None, fl_diag_path=False, geom_path=False, store_monthly_step=None, stop_criterion=None, fixed_geometry_spin...
[ "def", "run_until_and_store", "(", "self", ",", "y1", ",", "diag_path", "=", "None", ",", "fl_diag_path", "=", "False", ",", "geom_path", "=", "False", ",", "store_monthly_step", "=", "None", ",", "stop_criterion", "=", "None", ",", "fixed_geometry_spinup_yr", ...
[ 927, 4 ]
[ 1394, 18 ]
python
en
['en', 'en', 'en']
True
FlowlineModel.run_until_equilibrium
(self, rate=0.001, ystep=5, max_ite=200)
Runs the model until an equilibrium state is reached. Be careful: This only works for CONSTANT (not time-dependant) mass-balance models. Otherwise the returned state will not be in equilibrium! Don't try to calculate an equilibrium state with a RandomMassBalance model!
Runs the model until an equilibrium state is reached.
def run_until_equilibrium(self, rate=0.001, ystep=5, max_ite=200): """ Runs the model until an equilibrium state is reached. Be careful: This only works for CONSTANT (not time-dependant) mass-balance models. Otherwise the returned state will not be in equilibrium! Don't try to c...
[ "def", "run_until_equilibrium", "(", "self", ",", "rate", "=", "0.001", ",", "ystep", "=", "5", ",", "max_ite", "=", "200", ")", ":", "ite", "=", "0", "was_close_zero", "=", "0", "t_rate", "=", "1", "while", "(", "t_rate", ">", "rate", ")", "and", ...
[ 1396, 4 ]
[ 1419, 59 ]
python
en
['en', 'en', 'en']
True
FluxBasedModel.__init__
(self, flowlines, mb_model=None, y0=0., glen_a=None, fs=0., inplace=False, fixed_dt=None, cfl_number=None, min_dt=None, flux_gate_thickness=None, flux_gate=None, flux_gate_build_up=100, do_kcalving=None, calving_k=None, calving_use_limiter=None, ...
Instantiate the model. Parameters ---------- flowlines : list the glacier flowlines mb_model : MassBalanceModel the mass-balance model y0 : int initial year of the simulation glen_a : float Glen's creep parameter fs...
Instantiate the model.
def __init__(self, flowlines, mb_model=None, y0=0., glen_a=None, fs=0., inplace=False, fixed_dt=None, cfl_number=None, min_dt=None, flux_gate_thickness=None, flux_gate=None, flux_gate_build_up=100, do_kcalving=None, calving_k=None, calving_use_limiter=...
[ "def", "__init__", "(", "self", ",", "flowlines", ",", "mb_model", "=", "None", ",", "y0", "=", "0.", ",", "glen_a", "=", "None", ",", "fs", "=", "0.", ",", "inplace", "=", "False", ",", "fixed_dt", "=", "None", ",", "cfl_number", "=", "None", ",",...
[ 1442, 4 ]
[ 1630, 49 ]
python
en
['en', 'nl', 'en']
True
FluxBasedModel.step
(self, dt)
Advance one step.
Advance one step.
def step(self, dt): """Advance one step.""" # Just a check to avoid useless computations if dt <= 0: raise InvalidParamsError('dt needs to be strictly positive') # Simple container mbs = [] # Loop over tributaries to determine the flux rate for fl_i...
[ "def", "step", "(", "self", ",", "dt", ")", ":", "# Just a check to avoid useless computations", "if", "dt", "<=", "0", ":", "raise", "InvalidParamsError", "(", "'dt needs to be strictly positive'", ")", "# Simple container", "mbs", "=", "[", "]", "# Loop over tributa...
[ 1632, 4 ]
[ 1858, 17 ]
python
en
['en', 'ig', 'en']
True
FluxBasedModel.get_diagnostics
(self, fl_id=-1)
Obtain model diagnostics in a pandas DataFrame. Velocities in OGGM's FluxBasedModel are sometimes subject to numerical instabilities. To deal with the issue, you can either set a smaller ``PARAMS['cfl_number']`` (e.g. 0.01) or smooth the output a bit, e.g. with ``df.rolling(5, center=Tr...
Obtain model diagnostics in a pandas DataFrame.
def get_diagnostics(self, fl_id=-1): """Obtain model diagnostics in a pandas DataFrame. Velocities in OGGM's FluxBasedModel are sometimes subject to numerical instabilities. To deal with the issue, you can either set a smaller ``PARAMS['cfl_number']`` (e.g. 0.01) or smooth the o...
[ "def", "get_diagnostics", "(", "self", ",", "fl_id", "=", "-", "1", ")", ":", "import", "pandas", "as", "pd", "fl", "=", "self", ".", "fls", "[", "fl_id", "]", "nx", "=", "fl", ".", "nx", "df", "=", "pd", ".", "DataFrame", "(", "index", "=", "f...
[ 1860, 4 ]
[ 1911, 17 ]
python
es
['es', 'fr', 'it']
False
MassConservationChecker.__init__
(self, flowlines, **kwargs)
Instantiate. Parameters ----------
Instantiate.
def __init__(self, flowlines, **kwargs): """ Instantiate. Parameters ---------- """ super(MassConservationChecker, self).__init__(flowlines, **kwargs) self.total_mass = 0.
[ "def", "__init__", "(", "self", ",", "flowlines", ",", "*", "*", "kwargs", ")", ":", "super", "(", "MassConservationChecker", ",", "self", ")", ".", "__init__", "(", "flowlines", ",", "*", "*", "kwargs", ")", "self", ".", "total_mass", "=", "0." ]
[ 1917, 4 ]
[ 1925, 28 ]
python
en
['en', 'nl', 'en']
False
KarthausModel.__init__
(self, flowlines, mb_model=None, y0=0., glen_a=None, fs=0., fixed_dt=None, min_dt=SEC_IN_DAY, max_dt=31*SEC_IN_DAY, inplace=False, **kwargs)
Instantiate. Parameters ----------
Instantiate.
def __init__(self, flowlines, mb_model=None, y0=0., glen_a=None, fs=0., fixed_dt=None, min_dt=SEC_IN_DAY, max_dt=31*SEC_IN_DAY, inplace=False, **kwargs): """ Instantiate. Parameters ---------- """ if len(flowlines) > 1: raise ValueE...
[ "def", "__init__", "(", "self", ",", "flowlines", ",", "mb_model", "=", "None", ",", "y0", "=", "0.", ",", "glen_a", "=", "None", ",", "fs", "=", "0.", ",", "fixed_dt", "=", "None", ",", "min_dt", "=", "SEC_IN_DAY", ",", "max_dt", "=", "31", "*", ...
[ 1953, 4 ]
[ 1973, 28 ]
python
en
['en', 'nl', 'en']
False
KarthausModel.step
(self, dt)
Advance one step.
Advance one step.
def step(self, dt): """Advance one step.""" # Just a check to avoid useless computations if dt <= 0: raise InvalidParamsError('dt needs to be strictly positive') # This is to guarantee a precise arrival on a specific date if asked min_dt = dt if dt < self.min_dt els...
[ "def", "step", "(", "self", ",", "dt", ")", ":", "# Just a check to avoid useless computations", "if", "dt", "<=", "0", ":", "raise", "InvalidParamsError", "(", "'dt needs to be strictly positive'", ")", "# This is to guarantee a precise arrival on a specific date if asked", ...
[ 1975, 4 ]
[ 2032, 17 ]
python
en
['en', 'ig', 'en']
True
FileModel.__init__
(self, path)
Instantiate. Parameters ----------
Instantiate.
def __init__(self, path): """ Instantiate. Parameters ---------- """ self.fls = glacier_from_netcdf(path) fl_tss = [] for flid, fl in enumerate(self.fls): with xr.open_dataset(path, group='fl_{}'.format(flid)) as ds: if flid == 0: ...
[ "def", "__init__", "(", "self", ",", "path", ")", ":", "self", ".", "fls", "=", "glacier_from_netcdf", "(", "path", ")", "fl_tss", "=", "[", "]", "for", "flid", ",", "fl", "in", "enumerate", "(", "self", ".", "fls", ")", ":", "with", "xr", ".", "...
[ 2038, 4 ]
[ 2089, 23 ]
python
en
['en', 'nl', 'en']
False
FileModel.reset_y0
(self, y0=None)
Reset the initial model time
Reset the initial model time
def reset_y0(self, y0=None): """Reset the initial model time""" if y0 is None: y0 = float(self.time[0]) self.y0 = y0 self.yr = y0 self._current_index = 0
[ "def", "reset_y0", "(", "self", ",", "y0", "=", "None", ")", ":", "if", "y0", "is", "None", ":", "y0", "=", "float", "(", "self", ".", "time", "[", "0", "]", ")", "self", ".", "y0", "=", "y0", "self", ".", "yr", "=", "y0", "self", ".", "_cu...
[ 2100, 4 ]
[ 2107, 31 ]
python
en
['en', 'en', 'en']
True
FileModel.run_until
(self, year=None, month=None)
Mimics the model's behavior. Is quite slow tbh.
Mimics the model's behavior.
def run_until(self, year=None, month=None): """Mimics the model's behavior. Is quite slow tbh. """ try: if month is not None: pok = np.nonzero((self.years == year) & (self.months == month))[0][0] else: pok = np.nonzero(self.time ==...
[ "def", "run_until", "(", "self", ",", "year", "=", "None", ",", "month", "=", "None", ")", ":", "try", ":", "if", "month", "is", "not", "None", ":", "pok", "=", "np", ".", "nonzero", "(", "(", "self", ".", "years", "==", "year", ")", "&", "(", ...
[ 2136, 4 ]
[ 2155, 69 ]
python
en
['en', 'ca', 'en']
True
FileModel.area_m2_ts
(self, rollmin=0)
rollmin is the number of years you want to smooth onto
rollmin is the number of years you want to smooth onto
def area_m2_ts(self, rollmin=0): """rollmin is the number of years you want to smooth onto""" sel = 0 for fl, fl_ts in zip(self.fls, self.fl_tss): widths = np.where(fl_ts['ts_section'] > 0., fl_ts['ts_width_m'], 0.) sel += widths.sum(axis=1) * fl.dx_meter sel = pd...
[ "def", "area_m2_ts", "(", "self", ",", "rollmin", "=", "0", ")", ":", "sel", "=", "0", "for", "fl", ",", "fl_ts", "in", "zip", "(", "self", ".", "fls", ",", "self", ".", "fl_tss", ")", ":", "widths", "=", "np", ".", "where", "(", "fl_ts", "[", ...
[ 2157, 4 ]
[ 2167, 18 ]
python
en
['en', 'en', 'en']
True
MassRedistributionCurveModel.__init__
(self, flowlines, mb_model=None, y0=0., is_tidewater=False, water_level=None, do_kcalving=None, calving_k=None, advance_method=1, **kwargs)
Instantiate the model. Parameters ---------- flowlines : list the glacier flowlines mb_model : MassBalanceModel the mass-balance model y0 : int initial year of the simulation advance_method : int different ways to handle p...
Instantiate the model.
def __init__(self, flowlines, mb_model=None, y0=0., is_tidewater=False, water_level=None, do_kcalving=None, calving_k=None, advance_method=1, **kwargs): """ Instantiate the model. Parameters ---------- flowlines : list ...
[ "def", "__init__", "(", "self", ",", "flowlines", ",", "mb_model", "=", "None", ",", "y0", "=", "0.", ",", "is_tidewater", "=", "False", ",", "water_level", "=", "None", ",", "do_kcalving", "=", "None", ",", "calving_k", "=", "None", ",", "advance_method...
[ 2198, 4 ]
[ 2248, 37 ]
python
en
['en', 'nl', 'en']
True
MassRedistributionCurveModel.step
(self, dt)
Advance one step. Here it should be one year
Advance one step. Here it should be one year
def step(self, dt): """Advance one step. Here it should be one year""" # Just a check to avoid useless computations if dt <= 0: raise InvalidParamsError('dt needs to be strictly positive') if dt > cfg.SEC_IN_YEAR: # This should not happen from how run_until is bu...
[ "def", "step", "(", "self", ",", "dt", ")", ":", "# Just a check to avoid useless computations", "if", "dt", "<=", "0", ":", "raise", "InvalidParamsError", "(", "'dt needs to be strictly positive'", ")", "if", "dt", ">", "cfg", ".", "SEC_IN_YEAR", ":", "# This sho...
[ 2250, 4 ]
[ 2444, 17 ]
python
en
['en', 'en', 'en']
True
start_rpc_server
( rpc_api: Any, self_hostname: str, daemon_port: uint16, rpc_port: uint16, stop_cb: Callable, root_path: Path, net_config, connect_to_daemon=True, )
Starts an HTTP server with the following RPC methods, to be used by local clients to query the node.
Starts an HTTP server with the following RPC methods, to be used by local clients to query the node.
async def start_rpc_server( rpc_api: Any, self_hostname: str, daemon_port: uint16, rpc_port: uint16, stop_cb: Callable, root_path: Path, net_config, connect_to_daemon=True, ): """ Starts an HTTP server with the following RPC methods, to be used by local clients to query the n...
[ "async", "def", "start_rpc_server", "(", "rpc_api", ":", "Any", ",", "self_hostname", ":", "str", ",", "daemon_port", ":", "uint16", ",", "rpc_port", ":", "uint16", ",", "stop_cb", ":", "Callable", ",", "root_path", ":", "Path", ",", "net_config", ",", "co...
[ 294, 0 ]
[ 344, 18 ]
python
en
['en', 'error', 'th']
False
RpcServer.stop_node
(self, request)
Shuts down the node.
Shuts down the node.
async def stop_node(self, request): """ Shuts down the node. """ if self.stop_cb is not None: self.stop_cb() return {}
[ "async", "def", "stop_node", "(", "self", ",", "request", ")", ":", "if", "self", ".", "stop_cb", "is", "not", "None", ":", "self", ".", "stop_cb", "(", ")", "return", "{", "}" ]
[ 174, 4 ]
[ 180, 17 ]
python
en
['en', 'error', 'th']
False
RpcServer.ws_api
(self, message)
This function gets called when new message is received via websocket.
This function gets called when new message is received via websocket.
async def ws_api(self, message): """ This function gets called when new message is received via websocket. """ command = message["command"] if message["ack"]: return None data = None if "data" in message: data = message["data"] if...
[ "async", "def", "ws_api", "(", "self", ",", "message", ")", ":", "command", "=", "message", "[", "\"command\"", "]", "if", "message", "[", "\"ack\"", "]", ":", "return", "None", "data", "=", "None", "if", "\"data\"", "in", "message", ":", "data", "=", ...
[ 182, 4 ]
[ 204, 54 ]
python
en
['en', 'error', 'th']
False
input_path
(string)
Checks to see if the string is a valid input path Returns the full path of the string if true, otherwise raise a custom exception.
Checks to see if the string is a valid input path Returns the full path of the string if true, otherwise raise a custom exception.
def input_path(string): ''' Checks to see if the string is a valid input path Returns the full path of the string if true, otherwise raise a custom exception. ''' # try and cast string to a string if it isn't already! if type(string) is not str: raise TypeError("The value...
[ "def", "input_path", "(", "string", ")", ":", "# try and cast string to a string if it isn't already!", "if", "type", "(", "string", ")", "is", "not", "str", ":", "raise", "TypeError", "(", "\"The value passed to input_path is not a string. \"", "\"value: %s, type: %s\"", "...
[ 23, 0 ]
[ 46, 45 ]
python
en
['en', 'en', 'en']
True
input_file
(string)
Checks to see if the string is a valid input file Returns the full path of the string if true, otherwise raise a custom exception.
Checks to see if the string is a valid input file Returns the full path of the string if true, otherwise raise a custom exception.
def input_file(string): ''' Checks to see if the string is a valid input file Returns the full path of the string if true, otherwise raise a custom exception. ''' # try and cast string to a string if it isn't already! if type(string) is not str: raise TypeError("The value...
[ "def", "input_file", "(", "string", ")", ":", "# try and cast string to a string if it isn't already!", "if", "type", "(", "string", ")", "is", "not", "str", ":", "raise", "TypeError", "(", "\"The value passed to input_file is not a string. \"", "\"value: %s, type: %s\"", "...
[ 48, 0 ]
[ 71, 45 ]
python
en
['en', 'en', 'en']
True
output_path
(string)
Checks to see if the string is a valid output path; makes it if not
Checks to see if the string is a valid output path; makes it if not
def output_path(string): ''' Checks to see if the string is a valid output path; makes it if not''' # try and cast string to a string if it isn't already! if type(string) is not str: raise TypeError("The value passed to output_path is not a string. " \ "value: %s, t...
[ "def", "output_path", "(", "string", ")", ":", "# try and cast string to a string if it isn't already!", "if", "type", "(", "string", ")", "is", "not", "str", ":", "raise", "TypeError", "(", "\"The value passed to output_path is not a string. \"", "\"value: %s, type: %s\"", ...
[ 73, 0 ]
[ 91, 16 ]
python
en
['en', 'en', 'en']
True
output_file
(string)
Checks to see if the the dir of the string is a valid output path If not, it makes it and then returns the absolute path for the file
Checks to see if the the dir of the string is a valid output path If not, it makes it and then returns the absolute path for the file
def output_file(string): ''' Checks to see if the the dir of the string is a valid output path If not, it makes it and then returns the absolute path for the file''' # try and cast string to a string if it isn't already! if type(string) is not str: raise TypeError("The value passe...
[ "def", "output_file", "(", "string", ")", ":", "# try and cast string to a string if it isn't already!", "if", "type", "(", "string", ")", "is", "not", "str", ":", "raise", "TypeError", "(", "\"The value passed to output_file is not a string. \"", "\"value: %s, type: %s\"", ...
[ 93, 0 ]
[ 115, 20 ]
python
en
['en', 'en', 'en']
True
XFrameOptionsMiddleware.get_xframe_options_value
(self, request, response)
Gets the value to set for the X_FRAME_OPTIONS header. By default this uses the value from the X_FRAME_OPTIONS Django settings. If not found in settings, defaults to 'SAMEORIGIN'. This method can be overridden if needed, allowing it to vary based on the request or response. ...
Gets the value to set for the X_FRAME_OPTIONS header.
def get_xframe_options_value(self, request, response): """ Gets the value to set for the X_FRAME_OPTIONS header. By default this uses the value from the X_FRAME_OPTIONS Django settings. If not found in settings, defaults to 'SAMEORIGIN'. This method can be overridden if needed,...
[ "def", "get_xframe_options_value", "(", "self", ",", "request", ",", "response", ")", ":", "return", "getattr", "(", "settings", ",", "'X_FRAME_OPTIONS'", ",", "'SAMEORIGIN'", ")", ".", "upper", "(", ")" ]
[ 42, 4 ]
[ 52, 73 ]
python
en
['en', 'error', 'th']
False
JMX.load
(self, original)
Load existing JMX file :param original: JMX file path :raise TaurusInternalException: in case of XML parsing error
Load existing JMX file
def load(self, original): """ Load existing JMX file :param original: JMX file path :raise TaurusInternalException: in case of XML parsing error """ try: self.tree = etree.ElementTree() self.tree.parse(original) except BaseException as exc...
[ "def", "load", "(", "self", ",", "original", ")", ":", "try", ":", "self", ".", "tree", "=", "etree", ".", "ElementTree", "(", ")", "self", ".", "tree", ".", "parse", "(", "original", ")", "except", "BaseException", "as", "exc", ":", "msg", "=", "\...
[ 104, 4 ]
[ 116, 64 ]
python
en
['en', 'error', 'th']
False
JMX.get
(self, selector)
Returns tree elements by CSS selector :type selector: str :return:
Returns tree elements by CSS selector
def get(self, selector): """ Returns tree elements by CSS selector :type selector: str :return: """ expression = GenericTranslator().css_to_xpath(selector) nodes = self.tree.xpath(expression) return nodes
[ "def", "get", "(", "self", ",", "selector", ")", ":", "expression", "=", "GenericTranslator", "(", ")", ".", "css_to_xpath", "(", "selector", ")", "nodes", "=", "self", ".", "tree", ".", "xpath", "(", "expression", ")", "return", "nodes" ]
[ 118, 4 ]
[ 127, 20 ]
python
en
['en', 'error', 'th']
False
JMX.append
(self, selector, node)
Add node to container specified by selector. If multiple nodes will match the selector, first of them will be used as container. :param selector: CSS selector for container :param node: Element instance to add :raise TaurusInternalException: if container was not found
Add node to container specified by selector. If multiple nodes will match the selector, first of them will be used as container.
def append(self, selector, node): """ Add node to container specified by selector. If multiple nodes will match the selector, first of them will be used as container. :param selector: CSS selector for container :param node: Element instance to add :raise TaurusInternalEx...
[ "def", "append", "(", "self", ",", "selector", ",", "node", ")", ":", "container", "=", "self", ".", "get", "(", "selector", ")", "if", "not", "len", "(", "container", ")", ":", "msg", "=", "\"Failed to find TestPlan node in file: %s\"", "raise", "TaurusInte...
[ 129, 4 ]
[ 143, 33 ]
python
en
['en', 'error', 'th']
False
JMX.save
(self, filename)
Save JMX into file :param filename:
Save JMX into file
def save(self, filename): """ Save JMX into file :param filename: """ self.log.debug("Saving JMX to: %s", filename) with open(filename, "wb") as fhd: self.tree.write(fhd, pretty_print=True, encoding="UTF-8", xml_declaration=True)
[ "def", "save", "(", "self", ",", "filename", ")", ":", "self", ".", "log", ".", "debug", "(", "\"Saving JMX to: %s\"", ",", "filename", ")", "with", "open", "(", "filename", ",", "\"wb\"", ")", "as", "fhd", ":", "self", ".", "tree", ".", "write", "("...
[ 145, 4 ]
[ 153, 91 ]
python
en
['en', 'error', 'th']
False
JMX._flag
(flag_name, bool_value)
Generates element for JMX flag node :param flag_name: :param bool_value: :return:
Generates element for JMX flag node
def _flag(flag_name, bool_value): """ Generates element for JMX flag node :param flag_name: :param bool_value: :return: """ elm = etree.Element(flag_name) elm.text = "true" if bool_value else "false" return elm
[ "def", "_flag", "(", "flag_name", ",", "bool_value", ")", ":", "elm", "=", "etree", ".", "Element", "(", "flag_name", ")", "elm", ".", "text", "=", "\"true\"", "if", "bool_value", "else", "\"false\"", "return", "elm" ]
[ 156, 4 ]
[ 166, 18 ]
python
en
['en', 'error', 'th']
False
JMX.__jtl_writer
(filename, label, flags)
Generates JTL writer :param filename: :return:
Generates JTL writer
def __jtl_writer(filename, label, flags): """ Generates JTL writer :param filename: :return: """ jtl = etree.Element("stringProp", {"name": "filename"}) jtl.text = filename name = etree.Element("name") name.text = "saveConfig" value = etr...
[ "def", "__jtl_writer", "(", "filename", ",", "label", ",", "flags", ")", ":", "jtl", "=", "etree", ".", "Element", "(", "\"stringProp\"", ",", "{", "\"name\"", ":", "\"filename\"", "}", ")", "jtl", ".", "text", "=", "filename", "name", "=", "etree", "....
[ 169, 4 ]
[ 196, 23 ]
python
en
['en', 'error', 'th']
False
JMX.new_kpi_listener
(filename, flag_overrides=None)
Generates listener for writing basic KPI data in CSV format :param filename: :return:
Generates listener for writing basic KPI data in CSV format
def new_kpi_listener(filename, flag_overrides=None): """ Generates listener for writing basic KPI data in CSV format :param filename: :return: """ defaults = { "xml": False, "fieldNames": True, "time": True, "timestamp": T...
[ "def", "new_kpi_listener", "(", "filename", ",", "flag_overrides", "=", "None", ")", ":", "defaults", "=", "{", "\"xml\"", ":", "False", ",", "\"fieldNames\"", ":", "True", ",", "\"time\"", ":", "True", ",", "\"timestamp\"", ":", "True", ",", "\"latency\"", ...
[ 199, 4 ]
[ 239, 62 ]
python
en
['en', 'error', 'th']
False
JMX.new_xml_listener
(filename, is_full, user_flags)
:param is_full: bool :param filename: str :param user_flags: BetterDict :return:
def new_xml_listener(filename, is_full, user_flags): """ :param is_full: bool :param filename: str :param user_flags: BetterDict :return: """ default_flags = { "xml": True, "fieldNames": True, "time": True, "timesta...
[ "def", "new_xml_listener", "(", "filename", ",", "is_full", ",", "user_flags", ")", ":", "default_flags", "=", "{", "\"xml\"", ":", "True", ",", "\"fieldNames\"", ":", "True", ",", "\"time\"", ":", "True", ",", "\"timestamp\"", ":", "True", ",", "\"latency\"...
[ 242, 4 ]
[ 284, 21 ]
python
en
['en', 'error', 'th']
False
JMX._get_arguments_panel
(name)
Generates ArgumentsPanel node :param name: :return:
Generates ArgumentsPanel node
def _get_arguments_panel(name): """ Generates ArgumentsPanel node :param name: :return: """ return etree.Element("elementProp", name=name, elementType="Arguments", guiclass="ArgumentsPanel", testclass="Arguments")
[ "def", "_get_arguments_panel", "(", "name", ")", ":", "return", "etree", ".", "Element", "(", "\"elementProp\"", ",", "name", "=", "name", ",", "elementType", "=", "\"Arguments\"", ",", "guiclass", "=", "\"ArgumentsPanel\"", ",", "testclass", "=", "\"Arguments\"...
[ 287, 4 ]
[ 295, 78 ]
python
en
['en', 'error', 'th']
False
JMX._get_http_request
(url, label, method, timeout, body, keepalive, files=(), encoding=None, follow_redirects=True, use_random_host_ip=False, host_ips=())
Generates HTTP request :type method: str :type label: str :type url: str :rtype: lxml.etree.Element
Generates HTTP request :type method: str :type label: str :type url: str :rtype: lxml.etree.Element
def _get_http_request(url, label, method, timeout, body, keepalive, files=(), encoding=None, follow_redirects=True, use_random_host_ip=False, host_ips=()): """ Generates HTTP request :type method: str :type label: str :type url: str :rtype: lxml....
[ "def", "_get_http_request", "(", "url", ",", "label", ",", "method", ",", "timeout", ",", "body", ",", "keepalive", ",", "files", "=", "(", ")", ",", "encoding", "=", "None", ",", "follow_redirects", "=", "True", ",", "use_random_host_ip", "=", "False", ...
[ 337, 4 ]
[ 390, 20 ]
python
en
['en', 'error', 'th']
False
JMX._element_prop
(name, element_type)
Generates element property node :param name: :param element_type: :return:
Generates element property node
def _element_prop(name, element_type): """ Generates element property node :param name: :param element_type: :return: """ res = etree.Element("elementProp", name=name, elementType=element_type) return res
[ "def", "_element_prop", "(", "name", ",", "element_type", ")", ":", "res", "=", "etree", ".", "Element", "(", "\"elementProp\"", ",", "name", "=", "name", ",", "elementType", "=", "element_type", ")", "return", "res" ]
[ 490, 4 ]
[ 499, 18 ]
python
en
['en', 'error', 'th']
False
JMX._collection_prop
(name)
Adds Collection prop :param name: :return:
Adds Collection prop :param name: :return:
def _collection_prop(name): """ Adds Collection prop :param name: :return: """ res = etree.Element("collectionProp", name=name) return res
[ "def", "_collection_prop", "(", "name", ")", ":", "res", "=", "etree", ".", "Element", "(", "\"collectionProp\"", ",", "name", "=", "name", ")", "return", "res" ]
[ 502, 4 ]
[ 509, 18 ]
python
en
['en', 'error', 'th']
False
JMX._string_prop
(name, value)
Generates string property node :param name: :param value: :return:
Generates string property node
def _string_prop(name, value): """ Generates string property node :param name: :param value: :return: """ res = etree.Element("stringProp", name=name) res.text = str(value) return res
[ "def", "_string_prop", "(", "name", ",", "value", ")", ":", "res", "=", "etree", ".", "Element", "(", "\"stringProp\"", ",", "name", "=", "name", ")", "res", ".", "text", "=", "str", "(", "value", ")", "return", "res" ]
[ 512, 4 ]
[ 522, 18 ]
python
en
['en', 'error', 'th']
False
JMX._long_prop
(name, value)
Generates long property node :param name: :param value: :return:
Generates long property node
def _long_prop(name, value): """ Generates long property node :param name: :param value: :return: """ res = etree.Element("longProp", name=name) res.text = str(value) return res
[ "def", "_long_prop", "(", "name", ",", "value", ")", ":", "res", "=", "etree", ".", "Element", "(", "\"longProp\"", ",", "name", "=", "name", ")", "res", ".", "text", "=", "str", "(", "value", ")", "return", "res" ]
[ 525, 4 ]
[ 535, 18 ]
python
en
['en', 'error', 'th']
False
JMX._bool_prop
(name, value)
Generates boolean property :param name: :param value: :return:
Generates boolean property
def _bool_prop(name, value): """ Generates boolean property :param name: :param value: :return: """ res = etree.Element("boolProp", name=name) res.text = 'true' if value else 'false' return res
[ "def", "_bool_prop", "(", "name", ",", "value", ")", ":", "res", "=", "etree", ".", "Element", "(", "\"boolProp\"", ",", "name", "=", "name", ")", "res", ".", "text", "=", "'true'", "if", "value", "else", "'false'", "return", "res" ]
[ 538, 4 ]
[ 548, 18 ]
python
en
['en', 'error', 'th']
False
JMX.int_prop
(name, value)
JMX int property :param name: :param value: :return:
JMX int property :param name: :param value: :return:
def int_prop(name, value): """ JMX int property :param name: :param value: :return: """ res = etree.Element("intProp", name=name) res.text = str(value) return res
[ "def", "int_prop", "(", "name", ",", "value", ")", ":", "res", "=", "etree", ".", "Element", "(", "\"intProp\"", ",", "name", "=", "name", ")", "res", ".", "text", "=", "str", "(", "value", ")", "return", "res" ]
[ 551, 4 ]
[ 560, 18 ]
python
en
['en', 'error', 'th']
False
JMX.get_thread_group
(concurrency=None, rampup=0, hold=0, iterations=None, testname="ThreadGroup", on_error="continue", thread_delay=False, scheduler_delay=None)
Generates ThreadGroup Expected values (by JMeter): ThreadGroup.num_threads (concurrency): int ThreadGroup.ramp_time (rampup): int ThreadGroup.scheduler (need to hold): boolean ThreadGroup.duration (rampup + hold): int LoopController.loops (it...
Generates ThreadGroup
def get_thread_group(concurrency=None, rampup=0, hold=0, iterations=None, testname="ThreadGroup", on_error="continue", thread_delay=False, scheduler_delay=None): """ Generates ThreadGroup Expected values (by JMeter): ThreadGroup.num_threads (concurrency): in...
[ "def", "get_thread_group", "(", "concurrency", "=", "None", ",", "rampup", "=", "0", ",", "hold", "=", "0", ",", "iterations", "=", "None", ",", "testname", "=", "\"ThreadGroup\"", ",", "on_error", "=", "\"continue\"", ",", "thread_delay", "=", "False", ",...
[ 563, 4 ]
[ 636, 18 ]
python
en
['en', 'error', 'th']
False
JMX.get_rps_shaper
(self)
:return: etree.Element
def get_rps_shaper(self): """ :return: etree.Element """ throughput_timer_element = etree.Element(self.THR_TIMER, guiclass=self.THR_TIMER + "Gui", testclass=self.THR_TIMER, ...
[ "def", "get_rps_shaper", "(", "self", ")", ":", "throughput_timer_element", "=", "etree", ".", "Element", "(", "self", ".", "THR_TIMER", ",", "guiclass", "=", "self", ".", "THR_TIMER", "+", "\"Gui\"", ",", "testclass", "=", "self", ".", "THR_TIMER", ",", "...
[ 638, 4 ]
[ 652, 39 ]
python
en
['en', 'error', 'th']
False
JMX.add_rps_shaper_schedule
(self, shaper_etree, start_rps, end_rps, duration)
Adds schedule to rps shaper Expected values (by JMeter): <first> ('start_rps'): float <second> ('end_rps'): float <third> ('duration'): int
Adds schedule to rps shaper
def add_rps_shaper_schedule(self, shaper_etree, start_rps, end_rps, duration): """ Adds schedule to rps shaper Expected values (by JMeter): <first> ('start_rps'): float <second> ('end_rps'): float <third> ('duration'): int """ shaper_collectio...
[ "def", "add_rps_shaper_schedule", "(", "self", ",", "shaper_etree", ",", "start_rps", ",", "end_rps", ",", "duration", ")", ":", "shaper_collection", "=", "shaper_etree", ".", "find", "(", "\".//collectionProp[@name='load_profile']\"", ")", "coll_prop", "=", "self", ...
[ 654, 4 ]
[ 671, 43 ]
python
en
['en', 'error', 'th']
False
JMX.get_set_var_action
(udv_dict, testname="Variables from Taurus")
:type testname: str :type udv_dict: dict[str,str] :rtype: etree.Element
:type testname: str :type udv_dict: dict[str,str] :rtype: etree.Element
def get_set_var_action(udv_dict, testname="Variables from Taurus"): """ :type testname: str :type udv_dict: dict[str,str] :rtype: etree.Element """ udv_element = etree.Element(JMX.SET_VAR_ACTION, guiclass=JMX.SET_VAR_ACTION + "Gui", te...
[ "def", "get_set_var_action", "(", "udv_dict", ",", "testname", "=", "\"Variables from Taurus\"", ")", ":", "udv_element", "=", "etree", ".", "Element", "(", "JMX", ".", "SET_VAR_ACTION", ",", "guiclass", "=", "JMX", ".", "SET_VAR_ACTION", "+", "\"Gui\"", ",", ...
[ 674, 4 ]
[ 700, 26 ]
python
en
['en', 'error', 'th']
False
JMX.add_user_def_vars_elements
(udv_dict, testname="Variables from Taurus")
:type testname: str :type udv_dict: dict[str,str] :rtype: etree.Element
:type testname: str :type udv_dict: dict[str,str] :rtype: etree.Element
def add_user_def_vars_elements(udv_dict, testname="Variables from Taurus"): """ :type testname: str :type udv_dict: dict[str,str] :rtype: etree.Element """ udv_element = etree.Element("Arguments", guiclass="ArgumentsPanel", testclass="Arguments", ...
[ "def", "add_user_def_vars_elements", "(", "udv_dict", ",", "testname", "=", "\"Variables from Taurus\"", ")", ":", "udv_element", "=", "etree", ".", "Element", "(", "\"Arguments\"", ",", "guiclass", "=", "\"ArgumentsPanel\"", ",", "testclass", "=", "\"Arguments\"", ...
[ 703, 4 ]
[ 727, 26 ]
python
en
['en', 'error', 'th']
False
JMX.get_concurrency_thread_group
(concurrency=None, rampup=0, hold=0, steps=None, on_error="continue", testname="ConcurrencyThreadGroup", iterations="")
Generates ConcurrencyThreadGroup Expected values (by JMeter): Targetlevel (concurrency): int RampUp (rampup): float Steps (steps): boolean Hold (hold): float :return: etree element, Concurrency Thread Group
Generates ConcurrencyThreadGroup
def get_concurrency_thread_group(concurrency=None, rampup=0, hold=0, steps=None, on_error="continue", testname="ConcurrencyThreadGroup", iterations=""): """ Generates ConcurrencyThreadGroup Expected values (by JMeter): Targetlevel (concurrency): ...
[ "def", "get_concurrency_thread_group", "(", "concurrency", "=", "None", ",", "rampup", "=", "0", ",", "hold", "=", "0", ",", "steps", "=", "None", ",", "on_error", "=", "\"continue\"", ",", "testname", "=", "\"ConcurrencyThreadGroup\"", ",", "iterations", "=",...
[ 730, 4 ]
[ 774, 39 ]
python
en
['en', 'error', 'th']
False
JMX.get_dns_cache_mgr
()
Adds dns cache element with defaults parameters :return:
Adds dns cache element with defaults parameters
def get_dns_cache_mgr(): """ Adds dns cache element with defaults parameters :return: """ dns_element = etree.Element("DNSCacheManager", guiclass="DNSCachePanel", testclass="DNSCacheManager", testname="DNS Cache Manager") dns_element.a...
[ "def", "get_dns_cache_mgr", "(", ")", ":", "dns_element", "=", "etree", ".", "Element", "(", "\"DNSCacheManager\"", ",", "guiclass", "=", "\"DNSCachePanel\"", ",", "testclass", "=", "\"DNSCacheManager\"", ",", "testname", "=", "\"DNS Cache Manager\"", ")", "dns_elem...
[ 777, 4 ]
[ 788, 26 ]
python
en
['en', 'error', 'th']
False
JMX._get_header_mgr
(hdict)
:type hdict: dict[str,str] :rtype: lxml.etree.Element
def _get_header_mgr(hdict): """ :type hdict: dict[str,str] :rtype: lxml.etree.Element """ mgr = etree.Element("HeaderManager", guiclass="HeaderPanel", testclass="HeaderManager", testname="Headers") coll_prop = etree.Element("collectionProp", name="HeaderManager.headers"...
[ "def", "_get_header_mgr", "(", "hdict", ")", ":", "mgr", "=", "etree", ".", "Element", "(", "\"HeaderManager\"", ",", "guiclass", "=", "\"HeaderPanel\"", ",", "testclass", "=", "\"HeaderManager\"", ",", "testname", "=", "\"Headers\"", ")", "coll_prop", "=", "e...
[ 791, 4 ]
[ 806, 18 ]
python
en
['en', 'error', 'th']
False
JMX._get_cache_mgr
()
:rtype: lxml.etree.Element
:rtype: lxml.etree.Element
def _get_cache_mgr(): """ :rtype: lxml.etree.Element """ mgr = etree.Element("CacheManager", guiclass="CacheManagerGui", testclass="CacheManager", testname="Cache") mgr.append(JMX._bool_prop("clearEachIteration", True)) mgr.append(JMX._bool_prop("useExpires", True)) ...
[ "def", "_get_cache_mgr", "(", ")", ":", "mgr", "=", "etree", ".", "Element", "(", "\"CacheManager\"", ",", "guiclass", "=", "\"CacheManagerGui\"", ",", "testclass", "=", "\"CacheManager\"", ",", "testname", "=", "\"Cache\"", ")", "mgr", ".", "append", "(", "...
[ 809, 4 ]
[ 816, 18 ]
python
en
['en', 'error', 'th']
False
JMX._get_cookie_mgr
(scenario=None)
:rtype: lxml.etree.Element
:rtype: lxml.etree.Element
def _get_cookie_mgr(scenario=None): """ :rtype: lxml.etree.Element """ mgr = etree.Element("CookieManager", guiclass="CookiePanel", testclass="CookieManager", testname="Cookies") mgr.append(JMX._bool_prop("CookieManager.clearEachIteration", False)) mgr.append(JMX._string_...
[ "def", "_get_cookie_mgr", "(", "scenario", "=", "None", ")", ":", "mgr", "=", "etree", ".", "Element", "(", "\"CookieManager\"", ",", "guiclass", "=", "\"CookiePanel\"", ",", "testclass", "=", "\"CookieManager\"", ",", "testname", "=", "\"Cookies\"", ")", "mgr...
[ 819, 4 ]
[ 858, 18 ]
python
en
['en', 'error', 'th']
False
JMX._get_http_defaults
(default_address=None, timeout=None, retrieve_resources=None, concurrent_pool_size=4, content_encoding=None, resources_regex=None)
:rtype: lxml.etree.Element
:rtype: lxml.etree.Element
def _get_http_defaults(default_address=None, timeout=None, retrieve_resources=None, concurrent_pool_size=4, content_encoding=None, resources_regex=None): """ :rtype: lxml.etree.Element """ cfg = etree.Element("ConfigTestElement", guiclass="HttpDefaultsGui", ...
[ "def", "_get_http_defaults", "(", "default_address", "=", "None", ",", "timeout", "=", "None", ",", "retrieve_resources", "=", "None", ",", "concurrent_pool_size", "=", "4", ",", "content_encoding", "=", "None", ",", "resources_regex", "=", "None", ")", ":", "...
[ 861, 4 ]
[ 905, 18 ]
python
en
['en', 'error', 'th']
False
JMX._get_dur_assertion
(timeout)
:type timeout: int :return:
def _get_dur_assertion(timeout): """ :type timeout: int :return: """ element = etree.Element("DurationAssertion", guiclass="DurationAssertionGui", testclass="DurationAssertion", testname="Timeout Check") element.append(JMX._string_prop("Du...
[ "def", "_get_dur_assertion", "(", "timeout", ")", ":", "element", "=", "etree", ".", "Element", "(", "\"DurationAssertion\"", ",", "guiclass", "=", "\"DurationAssertionGui\"", ",", "testclass", "=", "\"DurationAssertion\"", ",", "testname", "=", "\"Timeout Check\"", ...
[ 908, 4 ]
[ 917, 22 ]
python
en
['en', 'error', 'th']
False
JMX._get_extractor
(varname, headers, regexp, template, match_no, default='NOT_FOUND', scope='', from_var='')
:type varname: str :type regexp: str :type template: str|int :type match_no: int :type default: str :type scope: str :type from_var: str :rtype: lxml.etree.Element
:type varname: str :type regexp: str :type template: str|int :type match_no: int :type default: str :type scope: str :type from_var: str :rtype: lxml.etree.Element
def _get_extractor(varname, headers, regexp, template, match_no, default='NOT_FOUND', scope='', from_var=''): """ :type varname: str :type regexp: str :type template: str|int :type match_no: int :type default: str :type scope: str :type from_var: str ...
[ "def", "_get_extractor", "(", "varname", ",", "headers", ",", "regexp", ",", "template", ",", "match_no", ",", "default", "=", "'NOT_FOUND'", ",", "scope", "=", "''", ",", "from_var", "=", "''", ")", ":", "if", "isinstance", "(", "template", ",", "int", ...
[ 951, 4 ]
[ 983, 22 ]
python
en
['en', 'error', 'th']
False
JMX._get_boundary_extractor
(varname, subject, left, right, match_no, defvalue='NOT_FOUND', scope='', from_var='')
:type varname: str :type regexp: str :type template: str|int :type match_no: int :type default: str :type scope: str :type from_var: str :rtype: lxml.etree.Element
:type varname: str :type regexp: str :type template: str|int :type match_no: int :type default: str :type scope: str :type from_var: str :rtype: lxml.etree.Element
def _get_boundary_extractor(varname, subject, left, right, match_no, defvalue='NOT_FOUND', scope='', from_var=''): """ :type varname: str :type regexp: str :type template: str|int :type match_no: int :type default: str :type scope: str :type from_var: str ...
[ "def", "_get_boundary_extractor", "(", "varname", ",", "subject", ",", "left", ",", "right", ",", "match_no", ",", "defvalue", "=", "'NOT_FOUND'", ",", "scope", "=", "''", ",", "from_var", "=", "''", ")", ":", "subjects", "=", "{", "'body'", ":", "'false...
[ 986, 4 ]
[ 1019, 22 ]
python
en
['en', 'error', 'th']
False
JMX._get_jquerycss_extractor
(varname, selector, attribute, match_no, default="NOT_FOUND", scope='', from_var='')
:type varname: str :type regexp: str :type match_no: int :type default: str :type scope: str :type from_var: str :rtype: lxml.etree.Element
:type varname: str :type regexp: str :type match_no: int :type default: str :type scope: str :type from_var: str :rtype: lxml.etree.Element
def _get_jquerycss_extractor(varname, selector, attribute, match_no, default="NOT_FOUND", scope='', from_var=''): """ :type varname: str :type regexp: str :type match_no: int :type default: str :type scope: str :type from_var: str :rtype: lxml.etree.Elemen...
[ "def", "_get_jquerycss_extractor", "(", "varname", ",", "selector", ",", "attribute", ",", "match_no", ",", "default", "=", "\"NOT_FOUND\"", ",", "scope", "=", "''", ",", "from_var", "=", "''", ")", ":", "element", "=", "etree", ".", "Element", "(", "\"Htm...
[ 1022, 4 ]
[ 1041, 22 ]
python
en
['en', 'error', 'th']
False
JMX._get_json_extractor
(varname, jsonpath, default='NOT_FOUND', from_variable=None)
:type varname: str :type default: str :rtype: lxml.etree.Element
:type varname: str :type default: str :rtype: lxml.etree.Element
def _get_json_extractor(varname, jsonpath, default='NOT_FOUND', from_variable=None): """ :type varname: str :type default: str :rtype: lxml.etree.Element """ package = "com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor" element = etree.Element("%s.JSONPathEx...
[ "def", "_get_json_extractor", "(", "varname", ",", "jsonpath", ",", "default", "=", "'NOT_FOUND'", ",", "from_variable", "=", "None", ")", ":", "package", "=", "\"com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor\"", "element", "=", "etree", ".", "Element", "(",...
[ 1044, 4 ]
[ 1061, 22 ]
python
en
['en', 'error', 'th']
False
JMX._get_internal_json_extractor
(varname, jsonpath, default, scope, from_variable, match_no, concat)
:type varname: str :type default: str :rtype: lxml.etree.Element
:type varname: str :type default: str :rtype: lxml.etree.Element
def _get_internal_json_extractor(varname, jsonpath, default, scope, from_variable, match_no, concat): """ :type varname: str :type default: str :rtype: lxml.etree.Element """ package = "JSONPostProcessor" element = etree.Element(package, ...
[ "def", "_get_internal_json_extractor", "(", "varname", ",", "jsonpath", ",", "default", ",", "scope", ",", "from_variable", ",", "match_no", ",", "concat", ")", ":", "package", "=", "\"JSONPostProcessor\"", "element", "=", "etree", ".", "Element", "(", "package"...
[ 1073, 4 ]
[ 1096, 22 ]
python
en
['en', 'error', 'th']
False
JMX._get_json_path_assertion
(jsonpath, expected_value, json_validation, expect_null, invert, regexp=True)
:type jsonpath: str :type expected_value: str :type json_validation: bool :type expect_null: bool :type invert: bool :type regexp: bool :return: lxml.etree.Element
:type jsonpath: str :type expected_value: str :type json_validation: bool :type expect_null: bool :type invert: bool :type regexp: bool :return: lxml.etree.Element
def _get_json_path_assertion(jsonpath, expected_value, json_validation, expect_null, invert, regexp=True): """ :type jsonpath: str :type expected_value: str :type json_validation: bool :type expect_null: bool :type invert: bool :type regexp: bool :return: ...
[ "def", "_get_json_path_assertion", "(", "jsonpath", ",", "expected_value", ",", "json_validation", ",", "expect_null", ",", "invert", ",", "regexp", "=", "True", ")", ":", "package", "=", "\"com.atlantbh.jmeter.plugins.jsonutils.jsonpathassertion\"", "element", "=", "et...
[ 1099, 4 ]
[ 1121, 22 ]
python
en
['en', 'error', 'th']
False
JMX._get_xpath_extractor
(varname, xpath, default, validate_xml, ignore_whitespace, match_no, use_namespaces, use_tolerant_parser, scope, from_var)
:type varname: str :type xpath: str :type default: str :type validate_xml: bool :type ignore_whitespace: bool :type use_tolerant_parser: bool :type scope: str :type from_var: str :rtype: lxml.etree.Element
:type varname: str :type xpath: str :type default: str :type validate_xml: bool :type ignore_whitespace: bool :type use_tolerant_parser: bool :type scope: str :type from_var: str :rtype: lxml.etree.Element
def _get_xpath_extractor(varname, xpath, default, validate_xml, ignore_whitespace, match_no, use_namespaces, use_tolerant_parser, scope, from_var): """ :type varname: str :type xpath: str :type default: str :type validate_xml: bool :type ignor...
[ "def", "_get_xpath_extractor", "(", "varname", ",", "xpath", ",", "default", ",", "validate_xml", ",", "ignore_whitespace", ",", "match_no", ",", "use_namespaces", ",", "use_tolerant_parser", ",", "scope", ",", "from_var", ")", ":", "element", "=", "etree", ".",...
[ 1124, 4 ]
[ 1152, 22 ]
python
en
['en', 'error', 'th']
False
JMX._get_xpath_assertion
(xpath, validate_xml, ignore_whitespace, use_tolerant_parser, invert)
:type xpath: str :type validate_xml: bool :type ignore_whitespace: bool :type use_tolerant_parser: bool :return: lxml.etree.Element
:type xpath: str :type validate_xml: bool :type ignore_whitespace: bool :type use_tolerant_parser: bool :return: lxml.etree.Element
def _get_xpath_assertion(xpath, validate_xml, ignore_whitespace, use_tolerant_parser, invert): """ :type xpath: str :type validate_xml: bool :type ignore_whitespace: bool :type use_tolerant_parser: bool :return: lxml.etree.Element """ element = etree.Eleme...
[ "def", "_get_xpath_assertion", "(", "xpath", ",", "validate_xml", ",", "ignore_whitespace", ",", "use_tolerant_parser", ",", "invert", ")", ":", "element", "=", "etree", ".", "Element", "(", "\"XPathAssertion\"", ",", "guiclass", "=", "\"XPathAssertionGui\"", ",", ...
[ 1155, 4 ]
[ 1174, 22 ]
python
en
['en', 'error', 'th']
False
JMX._get_resp_assertion
(field, contains, is_regexp, is_invert, assume_success=False)
:type field: str :type contains: list[str] :type is_regexp: bool :type is_invert: bool :rtype: lxml.etree.Element
def _get_resp_assertion(field, contains, is_regexp, is_invert, assume_success=False): """ :type field: str :type contains: list[str] :type is_regexp: bool :type is_invert: bool :rtype: lxml.etree.Element """ tname = "Assert %s %s" % ("hasn't" if is_inver...
[ "def", "_get_resp_assertion", "(", "field", ",", "contains", ",", "is_regexp", ",", "is_invert", ",", "assume_success", "=", "False", ")", ":", "tname", "=", "\"Assert %s %s\"", "%", "(", "\"hasn't\"", "if", "is_invert", "else", "\"has\"", ",", "\"[\"", "+", ...
[ 1177, 4 ]
[ 1217, 22 ]
python
en
['en', 'error', 'th']
False
JMX._get_csv_config
(path, delimiter, loop, variable_names, is_quoted)
:type path: str :type delimiter: str :type is_quoted: bool :type loop: bool :type variable_names: string :return:
def _get_csv_config(path, delimiter, loop, variable_names, is_quoted): """ :type path: str :type delimiter: str :type is_quoted: bool :type loop: bool :type variable_names: string :return: """ element = etree.Element("CSVDataSet", guiclass="TestBe...
[ "def", "_get_csv_config", "(", "path", ",", "delimiter", ",", "loop", ",", "variable_names", ",", "is_quoted", ")", ":", "element", "=", "etree", ".", "Element", "(", "\"CSVDataSet\"", ",", "guiclass", "=", "\"TestBeanGUI\"", ",", "testclass", "=", "\"CSVDataS...
[ 1237, 4 ]
[ 1256, 22 ]
python
en
['en', 'error', 'th']
False