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 |
|---|---|---|---|---|---|---|---|---|---|
a682ce6fb14335ce79cb06f303e7980caf9ec1a8ce71b71daafa3dda947313c4 | def p_factor_ID(p):
'factor : ID'
p[0] = s.Id('<factor>', [], p[1]) | factor : ID | parser.py | p_factor_ID | FaruNL/compiler-2 | 0 | python | def p_factor_ID(p):
p[0] = s.Id('<factor>', [], p[1]) | def p_factor_ID(p):
p[0] = s.Id('<factor>', [], p[1])<|docstring|>factor : ID<|endoftext|> |
adbd15f95cddbb91b9f7ac88dd75dbb9f2eb02522dde8cbd8f99c70058bace0e | def p_factor_NUMBER(p):
'factor : NUMBER'
p[0] = s.Number('<factor>', [], p[1]) | factor : NUMBER | parser.py | p_factor_NUMBER | FaruNL/compiler-2 | 0 | python | def p_factor_NUMBER(p):
p[0] = s.Number('<factor>', [], p[1]) | def p_factor_NUMBER(p):
p[0] = s.Number('<factor>', [], p[1])<|docstring|>factor : NUMBER<|endoftext|> |
e296b2b09c65b6cbe2bef8249658ba88223d40a48cf4feb51b0ba88fde8644d2 | def p_factor_GROUP(p):
'factor : LPAREN expression RPAREN'
p[0] = s.Group('group_expression', [p[2]]) | factor : LPAREN expression RPAREN | parser.py | p_factor_GROUP | FaruNL/compiler-2 | 0 | python | def p_factor_GROUP(p):
p[0] = s.Group('group_expression', [p[2]]) | def p_factor_GROUP(p):
p[0] = s.Group('group_expression', [p[2]])<|docstring|>factor : LPAREN expression RPAREN<|endoftext|> |
b46e3188d2d042b3d99b8b28c7cdbda261c2a0867533ed9b829a5211d1045a2c | def p_empty(p):
'empty :'
pass | empty : | parser.py | p_empty | FaruNL/compiler-2 | 0 | python | def p_empty(p):
pass | def p_empty(p):
pass<|docstring|>empty :<|endoftext|> |
1814a0c699d4a715ad9803463e8b1a393c9d2eebc064bd3fb9ee8d53ec114a0d | def create_empty_iod(self):
'Creates and empty IOD with the required DICOM tags but no values\n Parameters\n ----------\n '
super().create_empty_iod()
self.copy_required_dicom_attributes(Dataset(), include_optional=True) | Creates and empty IOD with the required DICOM tags but no values
Parameters
---------- | pydicomutils/IODs/CSPS.py | create_empty_iod | sectra-medical/pydicomutils | 8 | python | def create_empty_iod(self):
'Creates and empty IOD with the required DICOM tags but no values\n Parameters\n ----------\n '
super().create_empty_iod()
self.copy_required_dicom_attributes(Dataset(), include_optional=True) | def create_empty_iod(self):
'Creates and empty IOD with the required DICOM tags but no values\n Parameters\n ----------\n '
super().create_empty_iod()
self.copy_required_dicom_attributes(Dataset(), include_optional=True)<|docstring|>Creates and empty IOD with the required DICOM tags but... |
ccc84ecd472f24cd2a789fd84398879096b306c3001c2f2c95bf32df02c3606f | def copy_required_dicom_attributes(self, dataset_to_copy_from, include_iod_specific=True, include_optional=False):
'Copies required DICOM attributes from provided dataset\n Parameters\n ----------\n dataset_to_copy_from : Dataset to copy DICOM attributes from\n include_iod_specific : Inc... | Copies required DICOM attributes from provided dataset
Parameters
----------
dataset_to_copy_from : Dataset to copy DICOM attributes from
include_iod_specific : Include IOD specific DICOM attributes in copy (True)
include_optional : Include optional DICOM attributes in copy (False) | pydicomutils/IODs/CSPS.py | copy_required_dicom_attributes | sectra-medical/pydicomutils | 8 | python | def copy_required_dicom_attributes(self, dataset_to_copy_from, include_iod_specific=True, include_optional=False):
'Copies required DICOM attributes from provided dataset\n Parameters\n ----------\n dataset_to_copy_from : Dataset to copy DICOM attributes from\n include_iod_specific : Inc... | def copy_required_dicom_attributes(self, dataset_to_copy_from, include_iod_specific=True, include_optional=False):
'Copies required DICOM attributes from provided dataset\n Parameters\n ----------\n dataset_to_copy_from : Dataset to copy DICOM attributes from\n include_iod_specific : Inc... |
566ae396fa640cb3d9b1b4ca6398e8214bc432beb4b73ef3cf14581e3d7c7aaf | def initiate(self, referenced_dcm_files=None):
'Initiate the IOD by setting some dummy values for required attributes\n \n Keyword Arguments:\n referenced_dcm_files {[dcm_file1, dcm_file2, ...]} -- List of file paths (default: {None})\n '
super().initiate()
if referenced_dcm_... | Initiate the IOD by setting some dummy values for required attributes
Keyword Arguments:
referenced_dcm_files {[dcm_file1, dcm_file2, ...]} -- List of file paths (default: {None}) | pydicomutils/IODs/CSPS.py | initiate | sectra-medical/pydicomutils | 8 | python | def initiate(self, referenced_dcm_files=None):
'Initiate the IOD by setting some dummy values for required attributes\n \n Keyword Arguments:\n referenced_dcm_files {[dcm_file1, dcm_file2, ...]} -- List of file paths (default: {None})\n '
super().initiate()
if referenced_dcm_... | def initiate(self, referenced_dcm_files=None):
'Initiate the IOD by setting some dummy values for required attributes\n \n Keyword Arguments:\n referenced_dcm_files {[dcm_file1, dcm_file2, ...]} -- List of file paths (default: {None})\n '
super().initiate()
if referenced_dcm_... |
416732ae403dc8e0dc82c66b8fc5f9471a76ab9a6fad2270b4a2acd48281f5f1 | def add_graphical_layer(self, layer_name, layer_order, recommended_grayscale_value=None, recommended_cielab_value=None, layer_description=None):
'Add graphical layer\n \n Arguments:\n layer_name {str} -- Name of layer\n layer_order {int} -- Order of layer\n \n Keywo... | Add graphical layer
Arguments:
layer_name {str} -- Name of layer
layer_order {int} -- Order of layer
Keyword Arguments:
recommended_grayscale_value {[type]} -- [description] (default: {None})
recommended_cielab_value {[type]} -- [description] (default: {None})
layer_description {[type]} -- [descri... | pydicomutils/IODs/CSPS.py | add_graphical_layer | sectra-medical/pydicomutils | 8 | python | def add_graphical_layer(self, layer_name, layer_order, recommended_grayscale_value=None, recommended_cielab_value=None, layer_description=None):
'Add graphical layer\n \n Arguments:\n layer_name {str} -- Name of layer\n layer_order {int} -- Order of layer\n \n Keywo... | def add_graphical_layer(self, layer_name, layer_order, recommended_grayscale_value=None, recommended_cielab_value=None, layer_description=None):
'Add graphical layer\n \n Arguments:\n layer_name {str} -- Name of layer\n layer_order {int} -- Order of layer\n \n Keywo... |
0ed395b6ae61621e5f77ada4270631fd31e1405964e67bd1ab68a22464930118 | def add_graphic_object(self, referenced_dcm_file, layer_name, graphic_data, graphic_type, graphic_filled=None, cielab_value=None, shadow_style=None, line_thickness=None):
'Add graphical object\n \n Arguments:\n referenced_dcm_file {[type]} -- [description]\n layer_name {[type]} -... | Add graphical object
Arguments:
referenced_dcm_file {[type]} -- [description]
layer_name {[type]} -- [description]
graphic_data {[type]} -- [description]
graphic_type {[type]} -- [description]
Keyword Arguments:
graphic_filled {[type]} -- [description] (default: {None})
cielab_value {[type]} -... | pydicomutils/IODs/CSPS.py | add_graphic_object | sectra-medical/pydicomutils | 8 | python | def add_graphic_object(self, referenced_dcm_file, layer_name, graphic_data, graphic_type, graphic_filled=None, cielab_value=None, shadow_style=None, line_thickness=None):
'Add graphical object\n \n Arguments:\n referenced_dcm_file {[type]} -- [description]\n layer_name {[type]} -... | def add_graphic_object(self, referenced_dcm_file, layer_name, graphic_data, graphic_type, graphic_filled=None, cielab_value=None, shadow_style=None, line_thickness=None):
'Add graphical object\n \n Arguments:\n referenced_dcm_file {[type]} -- [description]\n layer_name {[type]} -... |
a23cc90b0bcd4574e2457cf35dbaa155b1af893885d0d3e54c03223262427fd0 | def add_text_object(self, referenced_dcm_file, layer_name, text_value, anchor_point, cielab_value=None, shadow_style=None):
'Add text object\n \n Arguments:\n referenced_dcm_file {[type]} -- [description]\n layer_name {[type]} -- [description]\n text_value {[type]} -- ... | Add text object
Arguments:
referenced_dcm_file {[type]} -- [description]
layer_name {[type]} -- [description]
text_value {[type]} -- [description]
anchor_point {[type]} -- [description]
Keyword Arguments:
cielab_value {[type]} -- [description] (default: {None})
shadow_style {[type]} -- [descri... | pydicomutils/IODs/CSPS.py | add_text_object | sectra-medical/pydicomutils | 8 | python | def add_text_object(self, referenced_dcm_file, layer_name, text_value, anchor_point, cielab_value=None, shadow_style=None):
'Add text object\n \n Arguments:\n referenced_dcm_file {[type]} -- [description]\n layer_name {[type]} -- [description]\n text_value {[type]} -- ... | def add_text_object(self, referenced_dcm_file, layer_name, text_value, anchor_point, cielab_value=None, shadow_style=None):
'Add text object\n \n Arguments:\n referenced_dcm_file {[type]} -- [description]\n layer_name {[type]} -- [description]\n text_value {[type]} -- ... |
1a6d03dd0e70bf0d81b87a0ed9c3290eee3f38566fa927121fa11f7826130e3c | def draw_to(self, fig: plt.Figure, ax: plt.Axes) -> Tuple[(plt.Figure, plt.Axes)]:
'Stylize a plot by adding the curve metadata.\n\n Args:\n fig: Plot figure.\n ax: Plot axes.\n\n Returns:\n The updated figure and axes of the plot.\n '
if (self.x_dim is not ... | Stylize a plot by adding the curve metadata.
Args:
fig: Plot figure.
ax: Plot axes.
Returns:
The updated figure and axes of the plot. | performance_curves/curve.py | draw_to | erp12/performance-curves | 0 | python | def draw_to(self, fig: plt.Figure, ax: plt.Axes) -> Tuple[(plt.Figure, plt.Axes)]:
'Stylize a plot by adding the curve metadata.\n\n Args:\n fig: Plot figure.\n ax: Plot axes.\n\n Returns:\n The updated figure and axes of the plot.\n '
if (self.x_dim is not ... | def draw_to(self, fig: plt.Figure, ax: plt.Axes) -> Tuple[(plt.Figure, plt.Axes)]:
'Stylize a plot by adding the curve metadata.\n\n Args:\n fig: Plot figure.\n ax: Plot axes.\n\n Returns:\n The updated figure and axes of the plot.\n '
if (self.x_dim is not ... |
35a5bc93d2375098cecc4a74f66162439bd0beaf14edf1f192c541525c21b354 | def __init__(self, x: np.ndarray, y: np.ndarray, meta: Optional[CurveMeta]=None):
'Instantiate a `Curve`.\n\n Args:\n x: Array of values for the x-dimension.\n y: Array of values for the y-dimension. Should correspond to `x` position-wise.\n meta: Optional curve metadata.\n ... | Instantiate a `Curve`.
Args:
x: Array of values for the x-dimension.
y: Array of values for the y-dimension. Should correspond to `x` position-wise.
meta: Optional curve metadata. | performance_curves/curve.py | __init__ | erp12/performance-curves | 0 | python | def __init__(self, x: np.ndarray, y: np.ndarray, meta: Optional[CurveMeta]=None):
'Instantiate a `Curve`.\n\n Args:\n x: Array of values for the x-dimension.\n y: Array of values for the y-dimension. Should correspond to `x` position-wise.\n meta: Optional curve metadata.\n ... | def __init__(self, x: np.ndarray, y: np.ndarray, meta: Optional[CurveMeta]=None):
'Instantiate a `Curve`.\n\n Args:\n x: Array of values for the x-dimension.\n y: Array of values for the y-dimension. Should correspond to `x` position-wise.\n meta: Optional curve metadata.\n ... |
89b4b69a00745c222d1529b9dd056043da947dd1aad599719c675adea01ad358 | @property
def arrays(self) -> SynchronizedArrays:
'The underlying arrays that make up the points of the curve.'
return SynchronizedArrays(arrays={'x': self.x, 'y': self.y}) | The underlying arrays that make up the points of the curve. | performance_curves/curve.py | arrays | erp12/performance-curves | 0 | python | @property
def arrays(self) -> SynchronizedArrays:
return SynchronizedArrays(arrays={'x': self.x, 'y': self.y}) | @property
def arrays(self) -> SynchronizedArrays:
return SynchronizedArrays(arrays={'x': self.x, 'y': self.y})<|docstring|>The underlying arrays that make up the points of the curve.<|endoftext|> |
feb76ecf06e2dc99ea297d3a4ca7fd054de3268e6fd0e8cb71a30f0a8a49389f | def draw_line(self, fig: plt.Figure, ax: plt.Axes, **kwargs) -> Tuple[(plt.Figure, plt.Axes)]:
'Draw the curve as a line on the given plot.\n\n @todo Add links to matplotlib documentation for the style overrides.\n @todo Should this method be public or private?\n\n Args:\n fig: The f... | Draw the curve as a line on the given plot.
@todo Add links to matplotlib documentation for the style overrides.
@todo Should this method be public or private?
Args:
fig: The figure of the plot.
ax: The axes of the plot.
**kwargs: Additional plotting options to pass to `.plot` of matplotlib.
Returns:
... | performance_curves/curve.py | draw_line | erp12/performance-curves | 0 | python | def draw_line(self, fig: plt.Figure, ax: plt.Axes, **kwargs) -> Tuple[(plt.Figure, plt.Axes)]:
'Draw the curve as a line on the given plot.\n\n @todo Add links to matplotlib documentation for the style overrides.\n @todo Should this method be public or private?\n\n Args:\n fig: The f... | def draw_line(self, fig: plt.Figure, ax: plt.Axes, **kwargs) -> Tuple[(plt.Figure, plt.Axes)]:
'Draw the curve as a line on the given plot.\n\n @todo Add links to matplotlib documentation for the style overrides.\n @todo Should this method be public or private?\n\n Args:\n fig: The f... |
d6533bd18202b6858defa6f411c31bea13089dc12061b365a2bda4c4d2ebdfdb | def draw_to(self, fig: plt.Figure, ax: plt.Axes) -> Tuple[(plt.Figure, plt.Axes)]:
'Draws the curve on the given plot.'
return self.draw_line(fig, ax) | Draws the curve on the given plot. | performance_curves/curve.py | draw_to | erp12/performance-curves | 0 | python | def draw_to(self, fig: plt.Figure, ax: plt.Axes) -> Tuple[(plt.Figure, plt.Axes)]:
return self.draw_line(fig, ax) | def draw_to(self, fig: plt.Figure, ax: plt.Axes) -> Tuple[(plt.Figure, plt.Axes)]:
return self.draw_line(fig, ax)<|docstring|>Draws the curve on the given plot.<|endoftext|> |
75f69afdabb0624a3f86f33d2db39186a3ae15e50a63f9cfc3724cd05f4d05a6 | def plot(self) -> Tuple[(plt.Figure, plt.Axes)]:
'Create a new plot with the curve on it.'
(fig, ax) = plt.subplots()
if (self.meta is not None):
(fig, ax) = self.meta.draw_to(fig, ax)
return self.draw_to(fig, ax) | Create a new plot with the curve on it. | performance_curves/curve.py | plot | erp12/performance-curves | 0 | python | def plot(self) -> Tuple[(plt.Figure, plt.Axes)]:
(fig, ax) = plt.subplots()
if (self.meta is not None):
(fig, ax) = self.meta.draw_to(fig, ax)
return self.draw_to(fig, ax) | def plot(self) -> Tuple[(plt.Figure, plt.Axes)]:
(fig, ax) = plt.subplots()
if (self.meta is not None):
(fig, ax) = self.meta.draw_to(fig, ax)
return self.draw_to(fig, ax)<|docstring|>Create a new plot with the curve on it.<|endoftext|> |
5f9a16ee9f2ff274fe5d4b661c3fcff62b6923064f0f9a5f0031ab5442eabdfe | def with_meta(self, meta: CurveMeta) -> 'Curve':
'A new `Curve` with the same data and new metadata.'
return Curve(self.x, self.y, meta) | A new `Curve` with the same data and new metadata. | performance_curves/curve.py | with_meta | erp12/performance-curves | 0 | python | def with_meta(self, meta: CurveMeta) -> 'Curve':
return Curve(self.x, self.y, meta) | def with_meta(self, meta: CurveMeta) -> 'Curve':
return Curve(self.x, self.y, meta)<|docstring|>A new `Curve` with the same data and new metadata.<|endoftext|> |
4d741e7c2e3150123adbff7e3b3431209d14dd3426888296880ec231b1f7de2f | def without_meta(self) -> 'Curve':
'A new `Curve` with the same data and no metadata.'
return Curve(self.x, self.y) | A new `Curve` with the same data and no metadata. | performance_curves/curve.py | without_meta | erp12/performance-curves | 0 | python | def without_meta(self) -> 'Curve':
return Curve(self.x, self.y) | def without_meta(self) -> 'Curve':
return Curve(self.x, self.y)<|docstring|>A new `Curve` with the same data and no metadata.<|endoftext|> |
146e61f04aeb921c79dba8c8360643659859b62af7d72ae1789b01d0f6943ff1 | def x_cutoff(self, y_limit: float, is_upper_limit: bool=False, find_min_x: bool=False) -> float:
'Finds the x-dimension value of the closest data point to the given y-limit.'
pred = (le if is_upper_limit else ge)
selector = (np.min if find_min_x else np.max)
return selector(self.arrays.filter('y', (lamb... | Finds the x-dimension value of the closest data point to the given y-limit. | performance_curves/curve.py | x_cutoff | erp12/performance-curves | 0 | python | def x_cutoff(self, y_limit: float, is_upper_limit: bool=False, find_min_x: bool=False) -> float:
pred = (le if is_upper_limit else ge)
selector = (np.min if find_min_x else np.max)
return selector(self.arrays.filter('y', (lambda a: pred(a, y_limit)))['x']) | def x_cutoff(self, y_limit: float, is_upper_limit: bool=False, find_min_x: bool=False) -> float:
pred = (le if is_upper_limit else ge)
selector = (np.min if find_min_x else np.max)
return selector(self.arrays.filter('y', (lambda a: pred(a, y_limit)))['x'])<|docstring|>Finds the x-dimension value of the... |
0a4a4e3a7b51c022a0f45376e99e6eb71566a13a8566e1da84ce4ed2097d4e37 | def __init__(self, curves: Iterable[Curve], *, kind_overrides: Optional[Mapping[(Any, Mapping[(str, Any)])]]=None, curve_overrides: Optional[Mapping[(Any, Mapping[(str, Any)])]]=None):
'Instantiate a `Curves` object from a collection of `Curve` objects and some optional style overrides.\n\n @todo Add links t... | Instantiate a `Curves` object from a collection of `Curve` objects and some optional style overrides.
@todo Add links to matplotlib documentation for the style overrides.
Args:
curves: The `Curve` objects.
kind_overrides: Plot style overrides to apply to curves based their `kind`.
curve_overrides: Plot st... | performance_curves/curve.py | __init__ | erp12/performance-curves | 0 | python | def __init__(self, curves: Iterable[Curve], *, kind_overrides: Optional[Mapping[(Any, Mapping[(str, Any)])]]=None, curve_overrides: Optional[Mapping[(Any, Mapping[(str, Any)])]]=None):
'Instantiate a `Curves` object from a collection of `Curve` objects and some optional style overrides.\n\n @todo Add links t... | def __init__(self, curves: Iterable[Curve], *, kind_overrides: Optional[Mapping[(Any, Mapping[(str, Any)])]]=None, curve_overrides: Optional[Mapping[(Any, Mapping[(str, Any)])]]=None):
'Instantiate a `Curves` object from a collection of `Curve` objects and some optional style overrides.\n\n @todo Add links t... |
91f0c3cf8c236900974c525d4c4a91a1dbc631fca2e99d586f48260edc1e216d | def plot(self) -> Tuple[(plt.Figure, plt.Axes)]:
'Create a new plot that shows all curves.'
x_labs: Set[str] = set()
y_labs: Set[str] = set()
(fig, ax) = plt.subplots()
for curve in self.curves:
overrides: Dict[(str, Any)] = {}
meta = curve.meta
if (meta is not None):
... | Create a new plot that shows all curves. | performance_curves/curve.py | plot | erp12/performance-curves | 0 | python | def plot(self) -> Tuple[(plt.Figure, plt.Axes)]:
x_labs: Set[str] = set()
y_labs: Set[str] = set()
(fig, ax) = plt.subplots()
for curve in self.curves:
overrides: Dict[(str, Any)] = {}
meta = curve.meta
if (meta is not None):
overrides.update(self.kind_overrides.... | def plot(self) -> Tuple[(plt.Figure, plt.Axes)]:
x_labs: Set[str] = set()
y_labs: Set[str] = set()
(fig, ax) = plt.subplots()
for curve in self.curves:
overrides: Dict[(str, Any)] = {}
meta = curve.meta
if (meta is not None):
overrides.update(self.kind_overrides.... |
07a1a30b0847949393d8ae32fa8fe1f2a67b183309b812d28b52a6d8e5be18a1 | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_onboarding_doc(self):
'\n This test starts the beat and checks that the onboarding doc has been published to ES\n '
self.wait_until((lambda : self.es.indices.exists(self.index_name)))
self.es.indices.refresh(index=self.index_... | This test starts the beat and checks that the onboarding doc has been published to ES | tests/system/test_integration.py | test_onboarding_doc | KOTungseth/apm-server | 2 | python | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_onboarding_doc(self):
'\n \n '
self.wait_until((lambda : self.es.indices.exists(self.index_name)))
self.es.indices.refresh(index=self.index_name)
self.wait_until((lambda : (self.es.count(index=self.index_name)['count'] ==... | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_onboarding_doc(self):
'\n \n '
self.wait_until((lambda : self.es.indices.exists(self.index_name)))
self.es.indices.refresh(index=self.index_name)
self.wait_until((lambda : (self.es.count(index=self.index_name)['count'] ==... |
0505bf6d5e9d2e4b052ef8b04aee6d75701c547081cc863472b5aa2fe58310bb | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_load_docs_with_template_and_add_transaction(self):
'\n This test starts the beat with a loaded template and sends transaction data to elasticsearch.\n It verifies that all data make it into ES, means data is compatible with the templ... | This test starts the beat with a loaded template and sends transaction data to elasticsearch.
It verifies that all data make it into ES, means data is compatible with the template
and data are in expected format. | tests/system/test_integration.py | test_load_docs_with_template_and_add_transaction | KOTungseth/apm-server | 2 | python | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_load_docs_with_template_and_add_transaction(self):
'\n This test starts the beat with a loaded template and sends transaction data to elasticsearch.\n It verifies that all data make it into ES, means data is compatible with the templ... | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_load_docs_with_template_and_add_transaction(self):
'\n This test starts the beat with a loaded template and sends transaction data to elasticsearch.\n It verifies that all data make it into ES, means data is compatible with the templ... |
f7fde6d29cdc362912259f40fcd91f8b82863b2d444687f9712873f07a64a9d3 | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_load_docs_with_template_and_add_error(self):
'\n This test starts the beat with a loaded template and sends error data to elasticsearch.\n It verifies that all data make it into ES means data is compatible with the template.\n ... | This test starts the beat with a loaded template and sends error data to elasticsearch.
It verifies that all data make it into ES means data is compatible with the template. | tests/system/test_integration.py | test_load_docs_with_template_and_add_error | KOTungseth/apm-server | 2 | python | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_load_docs_with_template_and_add_error(self):
'\n This test starts the beat with a loaded template and sends error data to elasticsearch.\n It verifies that all data make it into ES means data is compatible with the template.\n ... | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_load_docs_with_template_and_add_error(self):
'\n This test starts the beat with a loaded template and sends error data to elasticsearch.\n It verifies that all data make it into ES means data is compatible with the template.\n ... |
5e4e3de5033af842dbef90efd3804f4c99dd2b74159113e9b0bad822ab051078 | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_expvar_exists(self):
'expvar disabled, should 404'
r = self.get_debug_vars()
assert (r.status_code == 404), r.status_code | expvar disabled, should 404 | tests/system/test_integration.py | test_expvar_exists | KOTungseth/apm-server | 2 | python | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_expvar_exists(self):
r = self.get_debug_vars()
assert (r.status_code == 404), r.status_code | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_expvar_exists(self):
r = self.get_debug_vars()
assert (r.status_code == 404), r.status_code<|docstring|>expvar disabled, should 404<|endoftext|> |
3e92a3b63ac5442aa03509c28f2ddf0d7531045b0cbdeb36e49c5c9bf849658b | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_expvar_exists(self):
'expvar enabled, should 200'
r = self.get_debug_vars()
assert (r.status_code == 200), r.status_code | expvar enabled, should 200 | tests/system/test_integration.py | test_expvar_exists | KOTungseth/apm-server | 2 | python | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_expvar_exists(self):
r = self.get_debug_vars()
assert (r.status_code == 200), r.status_code | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_expvar_exists(self):
r = self.get_debug_vars()
assert (r.status_code == 200), r.status_code<|docstring|>expvar enabled, should 200<|endoftext|> |
3e92a3b63ac5442aa03509c28f2ddf0d7531045b0cbdeb36e49c5c9bf849658b | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_expvar_exists(self):
'expvar enabled, should 200'
r = self.get_debug_vars()
assert (r.status_code == 200), r.status_code | expvar enabled, should 200 | tests/system/test_integration.py | test_expvar_exists | KOTungseth/apm-server | 2 | python | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_expvar_exists(self):
r = self.get_debug_vars()
assert (r.status_code == 200), r.status_code | @unittest.skipUnless(INTEGRATION_TESTS, 'integration test')
def test_expvar_exists(self):
r = self.get_debug_vars()
assert (r.status_code == 200), r.status_code<|docstring|>expvar enabled, should 200<|endoftext|> |
539d1f7d5241bb96e2f9158271b7b8fb10a75e94c17ad4a610e584a8dae6fb42 | def ParseArgs():
'\n 参数解析\n :return: option args\n '
parser = optparse.OptionParser()
parser.add_option('-f', '--file', type='string', dest='filename', help='Specify the Config file', default='setting.ini')
parser.add_option('-n', '--node', type='string', dest='node', help='Specify the the name... | 参数解析
:return: option args | korok.py | ParseArgs | spiolynn/log-processing | 3 | python | def ParseArgs():
'\n 参数解析\n :return: option args\n '
parser = optparse.OptionParser()
parser.add_option('-f', '--file', type='string', dest='filename', help='Specify the Config file', default='setting.ini')
parser.add_option('-n', '--node', type='string', dest='node', help='Specify the the name... | def ParseArgs():
'\n 参数解析\n :return: option args\n '
parser = optparse.OptionParser()
parser.add_option('-f', '--file', type='string', dest='filename', help='Specify the Config file', default='setting.ini')
parser.add_option('-n', '--node', type='string', dest='node', help='Specify the the name... |
a2dddf0cdddf419d78b5a144f738b974d024464865dacf7dbdc2c89037972df6 | def Run(self):
'\n 启动\n :return:\n '
success = 0
failure = 0
ret = 0
sections = self.ConParser.sections()
section = self.Options.section
args = self.Args
if (section in sections):
try:
action = self.ConParser.get(section, 'action')
except ... | 启动
:return: | korok.py | Run | spiolynn/log-processing | 3 | python | def Run(self):
'\n 启动\n :return:\n '
success = 0
failure = 0
ret = 0
sections = self.ConParser.sections()
section = self.Options.section
args = self.Args
if (section in sections):
try:
action = self.ConParser.get(section, 'action')
except ... | def Run(self):
'\n 启动\n :return:\n '
success = 0
failure = 0
ret = 0
sections = self.ConParser.sections()
section = self.Options.section
args = self.Args
if (section in sections):
try:
action = self.ConParser.get(section, 'action')
except ... |
29543be9b8ca8b2dbc5472633fec74645de2afc283dcd66bd8aa23168c8eee53 | def Zip_Month(self, section):
'\n :param section:\n # section need parameter\n # src 源目录\n # dst 目标目录\n # pattern 正则匹配\n # mtime 修改时间\n # timestamp bool 加时间标签\n # reserve 是否递归\n '
print('zip_by_month')
_month = self.nowMonth()
try:
... | :param section:
# section need parameter
# src 源目录
# dst 目标目录
# pattern 正则匹配
# mtime 修改时间
# timestamp bool 加时间标签
# reserve 是否递归 | korok.py | Zip_Month | spiolynn/log-processing | 3 | python | def Zip_Month(self, section):
'\n :param section:\n # section need parameter\n # src 源目录\n # dst 目标目录\n # pattern 正则匹配\n # mtime 修改时间\n # timestamp bool 加时间标签\n # reserve 是否递归\n '
print('zip_by_month')
_month = self.nowMonth()
try:
... | def Zip_Month(self, section):
'\n :param section:\n # section need parameter\n # src 源目录\n # dst 目标目录\n # pattern 正则匹配\n # mtime 修改时间\n # timestamp bool 加时间标签\n # reserve 是否递归\n '
print('zip_by_month')
_month = self.nowMonth()
try:
... |
0cf0095334c650eb5ea6811465bbf6709e7c6deb2a533f50e9d65ca5d4901538 | def Zip(self, section):
'\n :param section:\n # section need parameter\n # src 源目录\n # dst 目标目录\n # pattern 正则匹配\n # mtime 修改时间\n # timestamp bool 加时间标签\n # reserve 是否递归\n '
print('zip')
try:
srclist = self.ConParser.get(section, 's... | :param section:
# section need parameter
# src 源目录
# dst 目标目录
# pattern 正则匹配
# mtime 修改时间
# timestamp bool 加时间标签
# reserve 是否递归 | korok.py | Zip | spiolynn/log-processing | 3 | python | def Zip(self, section):
'\n :param section:\n # section need parameter\n # src 源目录\n # dst 目标目录\n # pattern 正则匹配\n # mtime 修改时间\n # timestamp bool 加时间标签\n # reserve 是否递归\n '
print('zip')
try:
srclist = self.ConParser.get(section, 's... | def Zip(self, section):
'\n :param section:\n # section need parameter\n # src 源目录\n # dst 目标目录\n # pattern 正则匹配\n # mtime 修改时间\n # timestamp bool 加时间标签\n # reserve 是否递归\n '
print('zip')
try:
srclist = self.ConParser.get(section, 's... |
4ba858edd5aa29ba0d9debaae724c491aba76697287f04c8652a30a52d3921d4 | def get_pool(name='default', thread_count=1):
'Get (and initialize) a Thread pool.\n\n If thread_count is 0, then None is returned.\n\n If the thread pool had already been initialized, thread_count will\n be ignored.\n '
if (not thread_count):
return None
with _init_lock:
pool = ... | Get (and initialize) a Thread pool.
If thread_count is 0, then None is returned.
If the thread pool had already been initialized, thread_count will
be ignored. | webapp/graphite/worker_pool/pool.py | get_pool | cthiel42/graphite-web | 4,281 | python | def get_pool(name='default', thread_count=1):
'Get (and initialize) a Thread pool.\n\n If thread_count is 0, then None is returned.\n\n If the thread pool had already been initialized, thread_count will\n be ignored.\n '
if (not thread_count):
return None
with _init_lock:
pool = ... | def get_pool(name='default', thread_count=1):
'Get (and initialize) a Thread pool.\n\n If thread_count is 0, then None is returned.\n\n If the thread pool had already been initialized, thread_count will\n be ignored.\n '
if (not thread_count):
return None
with _init_lock:
pool = ... |
57e5688e407c13ced5fc0658e63bbdc14a1fc040c88006ef84850d8df0f7edd6 | def pool_exec(pool, jobs, timeout):
'Execute a list of jobs, yielding each one as it completes.\n\n If a pool is specified then the jobs will be executed asynchronously,\n otherwise they are executed in order.\n\n If not all jobs have been executed after the specified timeout a\n PoolTimeoutError will b... | Execute a list of jobs, yielding each one as it completes.
If a pool is specified then the jobs will be executed asynchronously,
otherwise they are executed in order.
If not all jobs have been executed after the specified timeout a
PoolTimeoutError will be raised. When operating synchronously the
timeout is checked b... | webapp/graphite/worker_pool/pool.py | pool_exec | cthiel42/graphite-web | 4,281 | python | def pool_exec(pool, jobs, timeout):
'Execute a list of jobs, yielding each one as it completes.\n\n If a pool is specified then the jobs will be executed asynchronously,\n otherwise they are executed in order.\n\n If not all jobs have been executed after the specified timeout a\n PoolTimeoutError will b... | def pool_exec(pool, jobs, timeout):
'Execute a list of jobs, yielding each one as it completes.\n\n If a pool is specified then the jobs will be executed asynchronously,\n otherwise they are executed in order.\n\n If not all jobs have been executed after the specified timeout a\n PoolTimeoutError will b... |
fe4f00650030abbd6329c61c2083976e412669b1ed2b3531167e88a5e6489e44 | def learn(images, algo, code_length=8, num_encoder_layers='auto', num_decoder_layers='auto', epochs=10, batch_size=16, optimizer='adam', learning_rate=0.001, loss_function='mse', metrics=['mse'], samples_for_code_statistics=64):
" This function train model based on passed data and argumenents to generate realastic ... | This function train model based on passed data and argumenents to generate realastic looking images
**Parameters**
images : list
Images to be passed to learning functions, has shape [N, (2D or 3D)], where N is number of samples and 2D and 3D denotes image size
algo : str
Algorithm to be used to learn image ... | gimmick/distributer.py | learn | pankajr141/gimmick | 0 | python | def learn(images, algo, code_length=8, num_encoder_layers='auto', num_decoder_layers='auto', epochs=10, batch_size=16, optimizer='adam', learning_rate=0.001, loss_function='mse', metrics=['mse'], samples_for_code_statistics=64):
" This function train model based on passed data and argumenents to generate realastic ... | def learn(images, algo, code_length=8, num_encoder_layers='auto', num_decoder_layers='auto', epochs=10, batch_size=16, optimizer='adam', learning_rate=0.001, loss_function='mse', metrics=['mse'], samples_for_code_statistics=64):
" This function train model based on passed data and argumenents to generate realastic ... |
1f098c8eaf3b810df0306f0f06dcdcb85c63186ec8526d22a2b020b2db858cea | @pytest.mark.parametrize('precision', [np.float32, np.float64])
@pytest.mark.parametrize('input_type', ['numpy'])
def test_stationarity(precision, input_type):
'Test the kpss stationarity check.\n Note: this test is intended to test the Python wrapper.\n Another more exhaustive test is part of the C++ unit te... | Test the kpss stationarity check.
Note: this test is intended to test the Python wrapper.
Another more exhaustive test is part of the C++ unit tests. | python/cuml/test/test_stationarity.py | test_stationarity | asony03/cuml | 1 | python | @pytest.mark.parametrize('precision', [np.float32, np.float64])
@pytest.mark.parametrize('input_type', ['numpy'])
def test_stationarity(precision, input_type):
'Test the kpss stationarity check.\n Note: this test is intended to test the Python wrapper.\n Another more exhaustive test is part of the C++ unit te... | @pytest.mark.parametrize('precision', [np.float32, np.float64])
@pytest.mark.parametrize('input_type', ['numpy'])
def test_stationarity(precision, input_type):
'Test the kpss stationarity check.\n Note: this test is intended to test the Python wrapper.\n Another more exhaustive test is part of the C++ unit te... |
1e507ea32dd6824a196c354d371884917a4678c9edeb0f9b7b0b2dd3cf49e8ae | def get() -> flask.Response:
'\n Get the default seed.\n\n Returns:\n The default seed or a server error.\n\n '
try:
return flask.Response(seed.get_seed().get(name=config.get_env().default_seed_name), status=200, mimetype='text/plain')
except seed.exceptions.SeedNotFoundError as exc:... | Get the default seed.
Returns:
The default seed or a server error. | api/library/seed.py | get | open-alchemy/Editor | 0 | python | def get() -> flask.Response:
'\n Get the default seed.\n\n Returns:\n The default seed or a server error.\n\n '
try:
return flask.Response(seed.get_seed().get(name=config.get_env().default_seed_name), status=200, mimetype='text/plain')
except seed.exceptions.SeedNotFoundError as exc:... | def get() -> flask.Response:
'\n Get the default seed.\n\n Returns:\n The default seed or a server error.\n\n '
try:
return flask.Response(seed.get_seed().get(name=config.get_env().default_seed_name), status=200, mimetype='text/plain')
except seed.exceptions.SeedNotFoundError as exc:... |
05afe3c7e6e8ce0e7055ae9125941cbfeb71fde0c1b2db185b4b3a068c42b365 | def get_root(ast) -> int:
'get root node index'
for (idx, node) in ast.items():
if (node['parent'] is None):
return idx | get root node index | dataset/py150/utils/ast/child_value.py | get_root | CGCL-codes/naturalcc | 71 | python | def get_root(ast) -> int:
for (idx, node) in ast.items():
if (node['parent'] is None):
return idx | def get_root(ast) -> int:
for (idx, node) in ast.items():
if (node['parent'] is None):
return idx<|docstring|>get root node index<|endoftext|> |
d32098a317f7215ba8762ed811bca83b543e20f0e4ffae73c3f5074328033fa1 | def reset_indices(ast):
"rename ast tree's node indices with consecutive indices"
if (sorted(list(ast.keys())) == list(range(len(ast)))):
return ast
_idx = 0
def _dfs(idx, _parent_idx):
nonlocal _idx
(_new_idx, _idx) = (f'_{_idx}', (_idx + 1))
node = ast.pop(idx)
... | rename ast tree's node indices with consecutive indices | dataset/py150/utils/ast/child_value.py | reset_indices | CGCL-codes/naturalcc | 71 | python | def reset_indices(ast):
if (sorted(list(ast.keys())) == list(range(len(ast)))):
return ast
_idx = 0
def _dfs(idx, _parent_idx):
nonlocal _idx
(_new_idx, _idx) = (f'_{_idx}', (_idx + 1))
node = ast.pop(idx)
ast[_new_idx] = node
if (node['parent'] is None)... | def reset_indices(ast):
if (sorted(list(ast.keys())) == list(range(len(ast)))):
return ast
_idx = 0
def _dfs(idx, _parent_idx):
nonlocal _idx
(_new_idx, _idx) = (f'_{_idx}', (_idx + 1))
node = ast.pop(idx)
ast[_new_idx] = node
if (node['parent'] is None)... |
df951b01144b43c7c025956c00f81c40048865dc33c65edac396e2e160e1702f | def ast2sbt(ast, idx):
'\n build structure-based traversal SBT tree\n ref: Deep Code Comment Generation\n '
idx = str(idx)
if ('value' in ast[idx]):
token = [ast[idx]['type'], ast[idx]['value']]
seq = [SBT_LEFT_PARENTHESE, token, SBT_RIGHT_PARENTHESE, token]
else:
token ... | build structure-based traversal SBT tree
ref: Deep Code Comment Generation | dataset/py150/utils/ast/child_value.py | ast2sbt | CGCL-codes/naturalcc | 71 | python | def ast2sbt(ast, idx):
'\n build structure-based traversal SBT tree\n ref: Deep Code Comment Generation\n '
idx = str(idx)
if ('value' in ast[idx]):
token = [ast[idx]['type'], ast[idx]['value']]
seq = [SBT_LEFT_PARENTHESE, token, SBT_RIGHT_PARENTHESE, token]
else:
token ... | def ast2sbt(ast, idx):
'\n build structure-based traversal SBT tree\n ref: Deep Code Comment Generation\n '
idx = str(idx)
if ('value' in ast[idx]):
token = [ast[idx]['type'], ast[idx]['value']]
seq = [SBT_LEFT_PARENTHESE, token, SBT_RIGHT_PARENTHESE, token]
else:
token ... |
82c92a613d9cecd47d9760f009b3242bdefa48d5da324aa92b433aea3830cfb0 | @property
def parent_snapshot_name(self):
"\n The name of the snapshot in\n 'parent-volume-name' serving\n as the parent of this clone.\n "
return self._parent_snapshot_name | The name of the snapshot in
'parent-volume-name' serving
as the parent of this clone. | generated-libraries/python/netapp/volume/clone_parent_info.py | parent_snapshot_name | radekg/netapp-ontap-lib-get | 2 | python | @property
def parent_snapshot_name(self):
"\n The name of the snapshot in\n 'parent-volume-name' serving\n as the parent of this clone.\n "
return self._parent_snapshot_name | @property
def parent_snapshot_name(self):
"\n The name of the snapshot in\n 'parent-volume-name' serving\n as the parent of this clone.\n "
return self._parent_snapshot_name<|docstring|>The name of the snapshot in
'parent-volume-name' serving
as the parent of this clone.<|endoftext|> |
072c963a786a7c9ac9f1dcc1d4f2b6623f3e34e6fed026076d95ba0384dcf3b5 | @property
def parent_volume_name(self):
'\n The name of the flexible\n volume serving as the\n parent of this clone.\n '
return self._parent_volume_name | The name of the flexible
volume serving as the
parent of this clone. | generated-libraries/python/netapp/volume/clone_parent_info.py | parent_volume_name | radekg/netapp-ontap-lib-get | 2 | python | @property
def parent_volume_name(self):
'\n The name of the flexible\n volume serving as the\n parent of this clone.\n '
return self._parent_volume_name | @property
def parent_volume_name(self):
'\n The name of the flexible\n volume serving as the\n parent of this clone.\n '
return self._parent_volume_name<|docstring|>The name of the flexible
volume serving as the
parent of this clone.<|endoftext|> |
aa06b5b23efaeb95dd1534c85fc6edf88a5a839055b8a89b1ad3f15d776f3d5d | def _get_item_by_idx(self, iterator, idx):
'Get the idx-th item of the iterator'
size = len(self)
idx = operator.index(idx)
if (not ((- size) <= idx < size)):
raise IndexError('index {} is out of range'.format(idx))
idx %= size
return next(islice(iterator, idx, None)) | Get the idx-th item of the iterator | python/oneflow/nn/utils/container.py | _get_item_by_idx | felixhao28/oneflow | 3,285 | python | def _get_item_by_idx(self, iterator, idx):
size = len(self)
idx = operator.index(idx)
if (not ((- size) <= idx < size)):
raise IndexError('index {} is out of range'.format(idx))
idx %= size
return next(islice(iterator, idx, None)) | def _get_item_by_idx(self, iterator, idx):
size = len(self)
idx = operator.index(idx)
if (not ((- size) <= idx < size)):
raise IndexError('index {} is out of range'.format(idx))
idx %= size
return next(islice(iterator, idx, None))<|docstring|>Get the idx-th item of the iterator<|endofte... |
d1d611624f2e35f98c910dc5e33d5a8429213f291e0abbe7b195ab4b86a19bca | def _get_abs_string_index(self, idx):
'Get the absolute index for the list of modules'
idx = operator.index(idx)
if (not ((- len(self)) <= idx < len(self))):
raise IndexError('index {} is out of range'.format(idx))
if (idx < 0):
idx += len(self)
return str(idx) | Get the absolute index for the list of modules | python/oneflow/nn/utils/container.py | _get_abs_string_index | felixhao28/oneflow | 3,285 | python | def _get_abs_string_index(self, idx):
idx = operator.index(idx)
if (not ((- len(self)) <= idx < len(self))):
raise IndexError('index {} is out of range'.format(idx))
if (idx < 0):
idx += len(self)
return str(idx) | def _get_abs_string_index(self, idx):
idx = operator.index(idx)
if (not ((- len(self)) <= idx < len(self))):
raise IndexError('index {} is out of range'.format(idx))
if (idx < 0):
idx += len(self)
return str(idx)<|docstring|>Get the absolute index for the list of modules<|endoftext|... |
9a94d63355557420b5ba1fe4b40df3b8f35c24b6d36af49f6d7169645de57e47 | def insert(self, index: int, module: T) -> None:
'Insert a given module before a given index in the list.\n \n Arguments:\n index (int): index to insert.\n module (nn.Module): module to insert\n '
for i in range(len(self._modules), index, (- 1)):
se... | Insert a given module before a given index in the list.
Arguments:
index (int): index to insert.
module (nn.Module): module to insert | python/oneflow/nn/utils/container.py | insert | felixhao28/oneflow | 3,285 | python | def insert(self, index: int, module: T) -> None:
'Insert a given module before a given index in the list.\n \n Arguments:\n index (int): index to insert.\n module (nn.Module): module to insert\n '
for i in range(len(self._modules), index, (- 1)):
se... | def insert(self, index: int, module: T) -> None:
'Insert a given module before a given index in the list.\n \n Arguments:\n index (int): index to insert.\n module (nn.Module): module to insert\n '
for i in range(len(self._modules), index, (- 1)):
se... |
9e8cac899471c19ab80b0fcce3875fc80bb0be3c1901da31261479310bc4a174 | def append(self: T, module: T) -> T:
'Appends a given module to the end of the list.\n \n Arguments:\n module (nn.Module): module to append\n '
self.add_module(str(len(self)), module)
return self | Appends a given module to the end of the list.
Arguments:
module (nn.Module): module to append | python/oneflow/nn/utils/container.py | append | felixhao28/oneflow | 3,285 | python | def append(self: T, module: T) -> T:
'Appends a given module to the end of the list.\n \n Arguments:\n module (nn.Module): module to append\n '
self.add_module(str(len(self)), module)
return self | def append(self: T, module: T) -> T:
'Appends a given module to the end of the list.\n \n Arguments:\n module (nn.Module): module to append\n '
self.add_module(str(len(self)), module)
return self<|docstring|>Appends a given module to the end of the list.
Arguments:
... |
abe83d1ee8979c341fdfe880fcaa917a9370b70d4487a05aa09098bc54a9f817 | def extend(self: T, modules: Iterable[Module]) -> T:
'Appends modules from a Python iterable to the end of the list.\n \n Arguments:\n modules (iterable): iterable of modules to append\n '
if (not isinstance(modules, collections.abc.Iterable)):
raise TypeError(('M... | Appends modules from a Python iterable to the end of the list.
Arguments:
modules (iterable): iterable of modules to append | python/oneflow/nn/utils/container.py | extend | felixhao28/oneflow | 3,285 | python | def extend(self: T, modules: Iterable[Module]) -> T:
'Appends modules from a Python iterable to the end of the list.\n \n Arguments:\n modules (iterable): iterable of modules to append\n '
if (not isinstance(modules, collections.abc.Iterable)):
raise TypeError(('M... | def extend(self: T, modules: Iterable[Module]) -> T:
'Appends modules from a Python iterable to the end of the list.\n \n Arguments:\n modules (iterable): iterable of modules to append\n '
if (not isinstance(modules, collections.abc.Iterable)):
raise TypeError(('M... |
2167ef2582afc5809068d1e05035f28db7ffb54255457826e27361a6c736028a | def clear(self) -> None:
'Remove all items from the ModuleDict.\n '
self._modules.clear() | Remove all items from the ModuleDict. | python/oneflow/nn/utils/container.py | clear | felixhao28/oneflow | 3,285 | python | def clear(self) -> None:
'\n '
self._modules.clear() | def clear(self) -> None:
'\n '
self._modules.clear()<|docstring|>Remove all items from the ModuleDict.<|endoftext|> |
94c7e5da6079ad5a2cd7d9e774be30857758006b1279cf6277b4792ee0e327c1 | def pop(self, key: str) -> T:
'Remove key from the ModuleDict and return its module.\n \n Arguments:\n key (string): key to pop from the ModuleDict\n '
v = self[key]
del self[key]
return v | Remove key from the ModuleDict and return its module.
Arguments:
key (string): key to pop from the ModuleDict | python/oneflow/nn/utils/container.py | pop | felixhao28/oneflow | 3,285 | python | def pop(self, key: str) -> T:
'Remove key from the ModuleDict and return its module.\n \n Arguments:\n key (string): key to pop from the ModuleDict\n '
v = self[key]
del self[key]
return v | def pop(self, key: str) -> T:
'Remove key from the ModuleDict and return its module.\n \n Arguments:\n key (string): key to pop from the ModuleDict\n '
v = self[key]
del self[key]
return v<|docstring|>Remove key from the ModuleDict and return its module.
Argument... |
1c18bf231b1b539720b6920fc4df63dd9c4b2add72c03115ddd498e195dc6b55 | def keys(self) -> Iterable[str]:
'Return an iterable of the ModuleDict keys.\n '
return self._modules.keys() | Return an iterable of the ModuleDict keys. | python/oneflow/nn/utils/container.py | keys | felixhao28/oneflow | 3,285 | python | def keys(self) -> Iterable[str]:
'\n '
return self._modules.keys() | def keys(self) -> Iterable[str]:
'\n '
return self._modules.keys()<|docstring|>Return an iterable of the ModuleDict keys.<|endoftext|> |
ef01aee898ca24fcb794a420e3821684fb7ee28d36bdf27a7b6314b3d8723267 | def items(self) -> Iterable[Tuple[(str, T)]]:
'Return an iterable of the ModuleDict key/value pairs.\n '
return self._modules.items() | Return an iterable of the ModuleDict key/value pairs. | python/oneflow/nn/utils/container.py | items | felixhao28/oneflow | 3,285 | python | def items(self) -> Iterable[Tuple[(str, T)]]:
'\n '
return self._modules.items() | def items(self) -> Iterable[Tuple[(str, T)]]:
'\n '
return self._modules.items()<|docstring|>Return an iterable of the ModuleDict key/value pairs.<|endoftext|> |
906a4ba222119f9f510e333a4b48c6036e4f4d24457b018b1854c2243cf3f327 | def values(self) -> Iterable[T]:
'Return an iterable of the ModuleDict values.\n '
return self._modules.values() | Return an iterable of the ModuleDict values. | python/oneflow/nn/utils/container.py | values | felixhao28/oneflow | 3,285 | python | def values(self) -> Iterable[T]:
'\n '
return self._modules.values() | def values(self) -> Iterable[T]:
'\n '
return self._modules.values()<|docstring|>Return an iterable of the ModuleDict values.<|endoftext|> |
d1d611624f2e35f98c910dc5e33d5a8429213f291e0abbe7b195ab4b86a19bca | def _get_abs_string_index(self, idx):
'Get the absolute index for the list of modules'
idx = operator.index(idx)
if (not ((- len(self)) <= idx < len(self))):
raise IndexError('index {} is out of range'.format(idx))
if (idx < 0):
idx += len(self)
return str(idx) | Get the absolute index for the list of modules | python/oneflow/nn/utils/container.py | _get_abs_string_index | felixhao28/oneflow | 3,285 | python | def _get_abs_string_index(self, idx):
idx = operator.index(idx)
if (not ((- len(self)) <= idx < len(self))):
raise IndexError('index {} is out of range'.format(idx))
if (idx < 0):
idx += len(self)
return str(idx) | def _get_abs_string_index(self, idx):
idx = operator.index(idx)
if (not ((- len(self)) <= idx < len(self))):
raise IndexError('index {} is out of range'.format(idx))
if (idx < 0):
idx += len(self)
return str(idx)<|docstring|>Get the absolute index for the list of modules<|endoftext|... |
e4983d1593a3e84bb74bd2734143f9a4bae2d9c809ce84e36a412a24525cc6c7 | def append(self: T, parameter) -> T:
'Appends a given parameter at the end of the list.\n \n Arguments:\n \n parameter (nn.Parameter): parameter to append\n '
self.register_parameter(str(len(self)), parameter)
return self | Appends a given parameter at the end of the list.
Arguments:
parameter (nn.Parameter): parameter to append | python/oneflow/nn/utils/container.py | append | felixhao28/oneflow | 3,285 | python | def append(self: T, parameter) -> T:
'Appends a given parameter at the end of the list.\n \n Arguments:\n \n parameter (nn.Parameter): parameter to append\n '
self.register_parameter(str(len(self)), parameter)
return self | def append(self: T, parameter) -> T:
'Appends a given parameter at the end of the list.\n \n Arguments:\n \n parameter (nn.Parameter): parameter to append\n '
self.register_parameter(str(len(self)), parameter)
return self<|docstring|>Appends a given parameter at th... |
d4eaeee48b4855b598cc736dbe484ffd9dda9bcffd47a96eea907dbf883df686 | def extend(self: T, parameters) -> T:
'Appends parameters from a Python iterable to the end of the list.\n \n Arguments:\n \n parameters (iterable): iterable of parameters to append\n '
if (not isinstance(parameters, collections.abc.Iterable)):
raise TypeError(... | Appends parameters from a Python iterable to the end of the list.
Arguments:
parameters (iterable): iterable of parameters to append | python/oneflow/nn/utils/container.py | extend | felixhao28/oneflow | 3,285 | python | def extend(self: T, parameters) -> T:
'Appends parameters from a Python iterable to the end of the list.\n \n Arguments:\n \n parameters (iterable): iterable of parameters to append\n '
if (not isinstance(parameters, collections.abc.Iterable)):
raise TypeError(... | def extend(self: T, parameters) -> T:
'Appends parameters from a Python iterable to the end of the list.\n \n Arguments:\n \n parameters (iterable): iterable of parameters to append\n '
if (not isinstance(parameters, collections.abc.Iterable)):
raise TypeError(... |
b23163e575b2c6e46e4b19cbd3343bd0642d11b8181febba10fb6cb1a7e4dc3c | def clear(self) -> None:
'Remove all items from the ParameterDict.\n '
self._parameters.clear() | Remove all items from the ParameterDict. | python/oneflow/nn/utils/container.py | clear | felixhao28/oneflow | 3,285 | python | def clear(self) -> None:
'\n '
self._parameters.clear() | def clear(self) -> None:
'\n '
self._parameters.clear()<|docstring|>Remove all items from the ParameterDict.<|endoftext|> |
a819f764d4475fc8be63307a7faa3cb673e71683bbeeedf61b60880d4ae8fba9 | def pop(self, key: str):
'Remove key from the ParameterDict and return its parameter.\n \n Args:\n \n key (string): key to pop from the ParameterDict\n '
v = self[key]
del self[key]
return v | Remove key from the ParameterDict and return its parameter.
Args:
key (string): key to pop from the ParameterDict | python/oneflow/nn/utils/container.py | pop | felixhao28/oneflow | 3,285 | python | def pop(self, key: str):
'Remove key from the ParameterDict and return its parameter.\n \n Args:\n \n key (string): key to pop from the ParameterDict\n '
v = self[key]
del self[key]
return v | def pop(self, key: str):
'Remove key from the ParameterDict and return its parameter.\n \n Args:\n \n key (string): key to pop from the ParameterDict\n '
v = self[key]
del self[key]
return v<|docstring|>Remove key from the ParameterDict and return its parameter... |
5a392282944d29b143b450276d0c942349844ce474e0cafed489c3f3e9b00a69 | def keys(self) -> Iterable[str]:
'Return an iterable of the ParameterDict keys.\n '
return self._parameters.keys() | Return an iterable of the ParameterDict keys. | python/oneflow/nn/utils/container.py | keys | felixhao28/oneflow | 3,285 | python | def keys(self) -> Iterable[str]:
'\n '
return self._parameters.keys() | def keys(self) -> Iterable[str]:
'\n '
return self._parameters.keys()<|docstring|>Return an iterable of the ParameterDict keys.<|endoftext|> |
f5bea9c8698c06af8a47e203fd1680a64c49168c48c674a32a5e6ffe68d0fc54 | def items(self):
'Return an iterable of the ParameterDict key/value pairs.\n '
return self._parameters.items() | Return an iterable of the ParameterDict key/value pairs. | python/oneflow/nn/utils/container.py | items | felixhao28/oneflow | 3,285 | python | def items(self):
'\n '
return self._parameters.items() | def items(self):
'\n '
return self._parameters.items()<|docstring|>Return an iterable of the ParameterDict key/value pairs.<|endoftext|> |
177bb480abda333432809e2b23427d026f7c373c26a082428307e3b18e09599d | def values(self):
'Return an iterable of the ParameterDict values.\n '
return self._parameters.values() | Return an iterable of the ParameterDict values. | python/oneflow/nn/utils/container.py | values | felixhao28/oneflow | 3,285 | python | def values(self):
'\n '
return self._parameters.values() | def values(self):
'\n '
return self._parameters.values()<|docstring|>Return an iterable of the ParameterDict values.<|endoftext|> |
1e34e349f453c12edf100c834599b9121312ad310fb5b17543cd23008f667e4d | def update(self, parameters) -> None:
'Update the :class:`~flow.nn.ParameterDict` with the key-value pairs from a\n mapping or an iterable, overwriting existing keys.\n \n .. note::\n If :attr:`parameters` is an ``OrderedDict``, a :class:`~flow.nn.ParameterDict`, or\n ... | Update the :class:`~flow.nn.ParameterDict` with the key-value pairs from a
mapping or an iterable, overwriting existing keys.
.. note::
If :attr:`parameters` is an ``OrderedDict``, a :class:`~flow.nn.ParameterDict`, or
an iterable of key-value pairs, the order of new elements in it is preserved.
Args:
par... | python/oneflow/nn/utils/container.py | update | felixhao28/oneflow | 3,285 | python | def update(self, parameters) -> None:
'Update the :class:`~flow.nn.ParameterDict` with the key-value pairs from a\n mapping or an iterable, overwriting existing keys.\n \n .. note::\n If :attr:`parameters` is an ``OrderedDict``, a :class:`~flow.nn.ParameterDict`, or\n ... | def update(self, parameters) -> None:
'Update the :class:`~flow.nn.ParameterDict` with the key-value pairs from a\n mapping or an iterable, overwriting existing keys.\n \n .. note::\n If :attr:`parameters` is an ``OrderedDict``, a :class:`~flow.nn.ParameterDict`, or\n ... |
9d39422ccd18c5be04bf57eb195ead89621a27aeac5cf420a873f5c7a2e46176 | def setUp(self):
'\n Initializes a unit test\n '
locs = locals()
globs = globals()
globs['__builtins__']['quit'] = self.doquit
globs['__builtins__']['print'] = self.doprint
self._test = __import__('introcs.testcase', globs, locs)
self.clear() | Initializes a unit test | tests/test_testcase.py | setUp | WalkerWhite/introcs-python | 1 | python | def setUp(self):
'\n \n '
locs = locals()
globs = globals()
globs['__builtins__']['quit'] = self.doquit
globs['__builtins__']['print'] = self.doprint
self._test = __import__('introcs.testcase', globs, locs)
self.clear() | def setUp(self):
'\n \n '
locs = locals()
globs = globals()
globs['__builtins__']['quit'] = self.doquit
globs['__builtins__']['print'] = self.doprint
self._test = __import__('introcs.testcase', globs, locs)
self.clear()<|docstring|>Initializes a unit test<|endoftext|> |
917a3003a270c1a5794ad616e94d4cadf39890dfcc3e787372765b7c69a45c25 | def tearDown(self):
'\n Completes a unit test\n '
globs = globals()
globs['__builtins__']['quit'] = display
globs['__builtins__']['print'] = thequit
self._test = None | Completes a unit test | tests/test_testcase.py | tearDown | WalkerWhite/introcs-python | 1 | python | def tearDown(self):
'\n \n '
globs = globals()
globs['__builtins__']['quit'] = display
globs['__builtins__']['print'] = thequit
self._test = None | def tearDown(self):
'\n \n '
globs = globals()
globs['__builtins__']['quit'] = display
globs['__builtins__']['print'] = thequit
self._test = None<|docstring|>Completes a unit test<|endoftext|> |
f5f6404401056a96a4a269cf6307c0fa253411dcc3a6bd033456da96e1bb64b7 | def doquit(self):
'\n Performs a faux application quit\n '
self._quit = True | Performs a faux application quit | tests/test_testcase.py | doquit | WalkerWhite/introcs-python | 1 | python | def doquit(self):
'\n \n '
self._quit = True | def doquit(self):
'\n \n '
self._quit = True<|docstring|>Performs a faux application quit<|endoftext|> |
5ee1c346707822a68fb91fd12aa0889d2816ed5f357bed49407582e8abd9c5f3 | def isquit(self):
'\n Returns true if the assert quit the program.\n '
return self._quit | Returns true if the assert quit the program. | tests/test_testcase.py | isquit | WalkerWhite/introcs-python | 1 | python | def isquit(self):
'\n \n '
return self._quit | def isquit(self):
'\n \n '
return self._quit<|docstring|>Returns true if the assert quit the program.<|endoftext|> |
246fb5071ea805e45ad8346f4dbf3d2410873dd505aeaf7df83ab6f961889114 | def doprint(self, *objects, sep=' ', end='\n', file=None, flush=False):
'\n Captures a print statement to an internal attribute for recording.\n '
from io import StringIO
outs = StringIO()
display(*objects, sep=sep, end=end, file=outs, flush=flush)
self._outp.append(outs.getvalue())
... | Captures a print statement to an internal attribute for recording. | tests/test_testcase.py | doprint | WalkerWhite/introcs-python | 1 | python | def doprint(self, *objects, sep=' ', end='\n', file=None, flush=False):
'\n \n '
from io import StringIO
outs = StringIO()
display(*objects, sep=sep, end=end, file=outs, flush=flush)
self._outp.append(outs.getvalue())
outs.close() | def doprint(self, *objects, sep=' ', end='\n', file=None, flush=False):
'\n \n '
from io import StringIO
outs = StringIO()
display(*objects, sep=sep, end=end, file=outs, flush=flush)
self._outp.append(outs.getvalue())
outs.close()<|docstring|>Captures a print statement to an intern... |
f180d29f54cebf608ac858a144ab796fdcd7865aad82a45e83f764a08678de76 | def getprint(self):
'\n Returns the attributes recorded form print statements.\n '
return self._outp | Returns the attributes recorded form print statements. | tests/test_testcase.py | getprint | WalkerWhite/introcs-python | 1 | python | def getprint(self):
'\n \n '
return self._outp | def getprint(self):
'\n \n '
return self._outp<|docstring|>Returns the attributes recorded form print statements.<|endoftext|> |
a1cb250ea6f25871b19cec95ea8d50560c38a60a13c4c243aab55110bc403e1c | def clear(self):
'\n Resets the recording of any assert messages.\n '
self._quit = False
self._outp = [] | Resets the recording of any assert messages. | tests/test_testcase.py | clear | WalkerWhite/introcs-python | 1 | python | def clear(self):
'\n \n '
self._quit = False
self._outp = [] | def clear(self):
'\n \n '
self._quit = False
self._outp = []<|docstring|>Resets the recording of any assert messages.<|endoftext|> |
8aa94cbf7ddab5366c1b75bc8b622a4fa7c85052d6154dbb204ce9d99dfa3235 | def test03_quit(self):
'\n Tests the quit command and interception.\n '
def invoke():
self._test.quit_with_error('Hello world!')
invoke()
self.assertTrue(self.isquit())
self.assertEqual(self._outp[0].strip(), 'Hello world!')
self.assertEqual(self._outp[1][:7], 'Line 85')
... | Tests the quit command and interception. | tests/test_testcase.py | test03_quit | WalkerWhite/introcs-python | 1 | python | def test03_quit(self):
'\n \n '
def invoke():
self._test.quit_with_error('Hello world!')
invoke()
self.assertTrue(self.isquit())
self.assertEqual(self._outp[0].strip(), 'Hello world!')
self.assertEqual(self._outp[1][:7], 'Line 85')
self.clear() | def test03_quit(self):
'\n \n '
def invoke():
self._test.quit_with_error('Hello world!')
invoke()
self.assertTrue(self.isquit())
self.assertEqual(self._outp[0].strip(), 'Hello world!')
self.assertEqual(self._outp[1][:7], 'Line 85')
self.clear()<|docstring|>Tests the qu... |
c72dfca9fcf3518956eac5d0365e2f7a4bf2b01de0711a9280775cac101f5668 | def test04_asserts_basic(self):
'\n Tests the basic unit test asserts.\n '
self._test.assert_equals(1, 1)
self.assertFalse(self.isquit())
self.clear()
self._test.assert_equals(1, 2)
self.assertTrue(self.isquit())
self.assertEqual(self._outp[0].strip(), 'assert_equals: expected ... | Tests the basic unit test asserts. | tests/test_testcase.py | test04_asserts_basic | WalkerWhite/introcs-python | 1 | python | def test04_asserts_basic(self):
'\n \n '
self._test.assert_equals(1, 1)
self.assertFalse(self.isquit())
self.clear()
self._test.assert_equals(1, 2)
self.assertTrue(self.isquit())
self.assertEqual(self._outp[0].strip(), 'assert_equals: expected 1 but instead got 2')
self.ass... | def test04_asserts_basic(self):
'\n \n '
self._test.assert_equals(1, 1)
self.assertFalse(self.isquit())
self.clear()
self._test.assert_equals(1, 2)
self.assertTrue(self.isquit())
self.assertEqual(self._outp[0].strip(), 'assert_equals: expected 1 but instead got 2')
self.ass... |
89abbf8be7ac5de4a27365494a271cc14ce6ea4a44948290a4c6916ef3c8dcba | def test05_asserts_floats(self):
'\n Tests the float unit test asserts.\n '
self._test.assert_floats_equal(1.0000001, 1.0000002)
self.assertFalse(self.isquit())
self.clear()
self._test.assert_floats_equal('a', 1)
self.assertTrue(self.isquit())
self.assertEqual(self._outp[0].str... | Tests the float unit test asserts. | tests/test_testcase.py | test05_asserts_floats | WalkerWhite/introcs-python | 1 | python | def test05_asserts_floats(self):
'\n \n '
self._test.assert_floats_equal(1.0000001, 1.0000002)
self.assertFalse(self.isquit())
self.clear()
self._test.assert_floats_equal('a', 1)
self.assertTrue(self.isquit())
self.assertEqual(self._outp[0].strip(), "assert_floats_equal: first ... | def test05_asserts_floats(self):
'\n \n '
self._test.assert_floats_equal(1.0000001, 1.0000002)
self.assertFalse(self.isquit())
self.clear()
self._test.assert_floats_equal('a', 1)
self.assertTrue(self.isquit())
self.assertEqual(self._outp[0].strip(), "assert_floats_equal: first ... |
c28d0c0d1e5a1b8c7cb6bb0254400aeed6712c2f1b27036be18fc61b54747f4a | def test06_asserts_error(self):
'\n Tests the enforcement assertion\n '
def func1(s):
assert (type(s) == str)
assert (s != '')
return s[0]
def func2(s):
if (type(s) != str):
raise TypeError()
if (s == ''):
raise ValueError(1, 3)... | Tests the enforcement assertion | tests/test_testcase.py | test06_asserts_error | WalkerWhite/introcs-python | 1 | python | def test06_asserts_error(self):
'\n \n '
def func1(s):
assert (type(s) == str)
assert (s != )
return s[0]
def func2(s):
if (type(s) != str):
raise TypeError()
if (s == ):
raise ValueError(1, 3)
return s[0]
def func3... | def test06_asserts_error(self):
'\n \n '
def func1(s):
assert (type(s) == str)
assert (s != )
return s[0]
def func2(s):
if (type(s) != str):
raise TypeError()
if (s == ):
raise ValueError(1, 3)
return s[0]
def func3... |
35ca173a296083b44fc0769d7855581715779dbf9d302ba5c82b783ed03efbd4 | def test07_messages(self):
'\n Tests the custom assert messages\n '
message = 'Test1'
self._test.assert_equals(1, 2, message)
self.assertTrue(self.isquit())
self.assertEqual(self._outp[0].strip(), message)
self.clear()
message = 'Test2'
self._test.assert_not_equals(1, 1, me... | Tests the custom assert messages | tests/test_testcase.py | test07_messages | WalkerWhite/introcs-python | 1 | python | def test07_messages(self):
'\n \n '
message = 'Test1'
self._test.assert_equals(1, 2, message)
self.assertTrue(self.isquit())
self.assertEqual(self._outp[0].strip(), message)
self.clear()
message = 'Test2'
self._test.assert_not_equals(1, 1, message)
self.assertTrue(self.... | def test07_messages(self):
'\n \n '
message = 'Test1'
self._test.assert_equals(1, 2, message)
self.assertTrue(self.isquit())
self.assertEqual(self._outp[0].strip(), message)
self.clear()
message = 'Test2'
self._test.assert_not_equals(1, 1, message)
self.assertTrue(self.... |
f1115d1f905e2359379b20cde9daea6fe2576b8e2bc06b2689990796692b1b12 | def test01_checks(self):
'\n Tests the type checks.\n '
self.assertTrue(self._test.isint(1.0))
self.assertTrue(self._test.isint(1))
self.assertTrue(self._test.isint('1'))
self.assertFalse(self._test.isint('1.0'))
self.assertFalse(self._test.isint('1e1'))
self.assertFalse(self._... | Tests the type checks. | tests/test_testcase.py | test01_checks | WalkerWhite/introcs-python | 1 | python | def test01_checks(self):
'\n \n '
self.assertTrue(self._test.isint(1.0))
self.assertTrue(self._test.isint(1))
self.assertTrue(self._test.isint('1'))
self.assertFalse(self._test.isint('1.0'))
self.assertFalse(self._test.isint('1e1'))
self.assertFalse(self._test.isint('e1'))
... | def test01_checks(self):
'\n \n '
self.assertTrue(self._test.isint(1.0))
self.assertTrue(self._test.isint(1))
self.assertTrue(self._test.isint('1'))
self.assertFalse(self._test.isint('1.0'))
self.assertFalse(self._test.isint('1e1'))
self.assertFalse(self._test.isint('e1'))
... |
2f0697e4eca206073ff761e01f4c923859b3f1faa1dea577d27dc1ec60f654d8 | def test02_compares(self):
'\n Tests the float comparisons.\n '
self.assertTrue(self._test.isclose(1, 1.000001))
self.assertFalse(self._test.isclose(1, 1.001))
self.assertEqual(self._test.isclose((1, 2), (1.000001, 2.001)), [True, False])
self.assertEqual(self._test.isclose((1, 2), (1.... | Tests the float comparisons. | tests/test_testcase.py | test02_compares | WalkerWhite/introcs-python | 1 | python | def test02_compares(self):
'\n \n '
self.assertTrue(self._test.isclose(1, 1.000001))
self.assertFalse(self._test.isclose(1, 1.001))
self.assertEqual(self._test.isclose((1, 2), (1.000001, 2.001)), [True, False])
self.assertEqual(self._test.isclose((1, 2), (1.001, 2.000001)), [False, Tru... | def test02_compares(self):
'\n \n '
self.assertTrue(self._test.isclose(1, 1.000001))
self.assertFalse(self._test.isclose(1, 1.001))
self.assertEqual(self._test.isclose((1, 2), (1.000001, 2.001)), [True, False])
self.assertEqual(self._test.isclose((1, 2), (1.001, 2.000001)), [False, Tru... |
23bea7478276143e0ff01863595a27779cccb9a314c69f37951ccd560196a51b | def step(self, action):
' Run environment for one timestep.\n\n Parameters:\n action(np.ndarray): Numpy array of shape (num_agents,3) containing the\n commands for each car. Each command is of the shape (steer, gas, brake).\n '
if hasattr(self, 'state'):
self.prev... | Run environment for one timestep.
Parameters:
action(np.ndarray): Numpy array of shape (num_agents,3) containing the
commands for each car. Each command is of the shape (steer, gas, brake). | gym_multi_car_racing/multi_car_racing.py | step | ParsaVahidi/Deep-Reinforcent-Learning-for-openAI-car-racing-game | 0 | python | def step(self, action):
' Run environment for one timestep.\n\n Parameters:\n action(np.ndarray): Numpy array of shape (num_agents,3) containing the\n commands for each car. Each command is of the shape (steer, gas, brake).\n '
if hasattr(self, 'state'):
self.prev... | def step(self, action):
' Run environment for one timestep.\n\n Parameters:\n action(np.ndarray): Numpy array of shape (num_agents,3) containing the\n commands for each car. Each command is of the shape (steer, gas, brake).\n '
if hasattr(self, 'state'):
self.prev... |
37d5c39b6c9d927ffc2c864c48c69fce799efd013da0827465d477ada4010fb4 | def get_feat(self, car_id):
'\n Given a car ID, this function will return the corresponding\n 32 features as follows:\n pos: position of the car (2x1)\n car_angle: angle of the var (1x1)\n angle_diff: angle diff between next tile and the angle of the car (1x1)\n driving_on_... | Given a car ID, this function will return the corresponding
32 features as follows:
pos: position of the car (2x1)
car_angle: angle of the var (1x1)
angle_diff: angle diff between next tile and the angle of the car (1x1)
driving_on_grass: whether we are on grass or track (1x1)
driving_backward: whether we are going for... | gym_multi_car_racing/multi_car_racing.py | get_feat | ParsaVahidi/Deep-Reinforcent-Learning-for-openAI-car-racing-game | 0 | python | def get_feat(self, car_id):
'\n Given a car ID, this function will return the corresponding\n 32 features as follows:\n pos: position of the car (2x1)\n car_angle: angle of the var (1x1)\n angle_diff: angle diff between next tile and the angle of the car (1x1)\n driving_on_... | def get_feat(self, car_id):
'\n Given a car ID, this function will return the corresponding\n 32 features as follows:\n pos: position of the car (2x1)\n car_angle: angle of the var (1x1)\n angle_diff: angle diff between next tile and the angle of the car (1x1)\n driving_on_... |
468c949f943f0d8e4c44d4d0fc3f967bc1654331d58734bc283368f743d2a558 | def _render_window(self, car_id, mode):
' Performs the actual rendering for each car individually.\n\n Parameters:\n car_id(int): Numerical id of car for which the corresponding window\n will be rendered.\n mode(str): Rendering mode.\n '
if (self.viewer[car_id]... | Performs the actual rendering for each car individually.
Parameters:
car_id(int): Numerical id of car for which the corresponding window
will be rendered.
mode(str): Rendering mode. | gym_multi_car_racing/multi_car_racing.py | _render_window | ParsaVahidi/Deep-Reinforcent-Learning-for-openAI-car-racing-game | 0 | python | def _render_window(self, car_id, mode):
' Performs the actual rendering for each car individually.\n\n Parameters:\n car_id(int): Numerical id of car for which the corresponding window\n will be rendered.\n mode(str): Rendering mode.\n '
if (self.viewer[car_id]... | def _render_window(self, car_id, mode):
' Performs the actual rendering for each car individually.\n\n Parameters:\n car_id(int): Numerical id of car for which the corresponding window\n will be rendered.\n mode(str): Rendering mode.\n '
if (self.viewer[car_id]... |
a975f629de68616d327bfe9bd585fabb2b38ee1ce4d96cb3aa3b27fddbb9af75 | def __init__(self, csv_filename: str, country_curr_codes, euro_rates, input_dir=_default_input_dir):
'\n Create instance of AirportAtlas comprising dictionary of Airport objects.\n \n Default is empty dictionary.\n Dictionary values must be Airport objects.\n Set csv_filename para... | Create instance of AirportAtlas comprising dictionary of Airport objects.
Default is empty dictionary.
Dictionary values must be Airport objects.
Set csv_filename parameter to construct dictionary from the csv | flight_plan/airports.py | __init__ | crotty-d/flight-plan | 0 | python | def __init__(self, csv_filename: str, country_curr_codes, euro_rates, input_dir=_default_input_dir):
'\n Create instance of AirportAtlas comprising dictionary of Airport objects.\n \n Default is empty dictionary.\n Dictionary values must be Airport objects.\n Set csv_filename para... | def __init__(self, csv_filename: str, country_curr_codes, euro_rates, input_dir=_default_input_dir):
'\n Create instance of AirportAtlas comprising dictionary of Airport objects.\n \n Default is empty dictionary.\n Dictionary values must be Airport objects.\n Set csv_filename para... |
9f1fb838b142ed933f1e7fd1c2c6eb2628be652ecac1316312d035c528513c7b | def load_data(self, csv_filename: str, input_dir):
'Load data from CSV file'
try:
with open(os.path.join(input_dir, csv_filename), 'rt', encoding='utf8') as f:
reader = csv.reader(f)
for line in reader:
self._airports_dict[line[4]] = Airport(line[4], line[2], line... | Load data from CSV file | flight_plan/airports.py | load_data | crotty-d/flight-plan | 0 | python | def load_data(self, csv_filename: str, input_dir):
try:
with open(os.path.join(input_dir, csv_filename), 'rt', encoding='utf8') as f:
reader = csv.reader(f)
for line in reader:
self._airports_dict[line[4]] = Airport(line[4], line[2], line[3], line[6], line[7])
... | def load_data(self, csv_filename: str, input_dir):
try:
with open(os.path.join(input_dir, csv_filename), 'rt', encoding='utf8') as f:
reader = csv.reader(f)
for line in reader:
self._airports_dict[line[4]] = Airport(line[4], line[2], line[3], line[6], line[7])
... |
97d6df669a79679bebbf382e11c7a4991323e35226eb1cef18bd6f7b4fcc0208 | def get_dict(self):
'Return dictionary of Airport objects for all airports in atlas'
return self._airports_dict | Return dictionary of Airport objects for all airports in atlas | flight_plan/airports.py | get_dict | crotty-d/flight-plan | 0 | python | def get_dict(self):
return self._airports_dict | def get_dict(self):
return self._airports_dict<|docstring|>Return dictionary of Airport objects for all airports in atlas<|endoftext|> |
f54c1c6831b2e18e15fdecd7a2ed2fc2f41ce73c291d22f5d944fff71bdc913e | def get_airport(self, airport_code: str):
'Return Airport instance specified in airport code parameter'
return self._airports_dict[airport_code] | Return Airport instance specified in airport code parameter | flight_plan/airports.py | get_airport | crotty-d/flight-plan | 0 | python | def get_airport(self, airport_code: str):
return self._airports_dict[airport_code] | def get_airport(self, airport_code: str):
return self._airports_dict[airport_code]<|docstring|>Return Airport instance specified in airport code parameter<|endoftext|> |
53ac21f038c1c81be0907ab178188db094403c81e697ebb06adb70bf74d82a08 | def great_circle_distance(self, latitude1, longitude1, latitude2, longitude2):
'\n Return the distance between two sets of geographical coordinates as a float.\n \n All parameters are floats.\n '
R_EARTH = 6371
theta1 = ((longitude1 * (2 * pi)) / 360)
theta2 = ((longitude2 * ... | Return the distance between two sets of geographical coordinates as a float.
All parameters are floats. | flight_plan/airports.py | great_circle_distance | crotty-d/flight-plan | 0 | python | def great_circle_distance(self, latitude1, longitude1, latitude2, longitude2):
'\n Return the distance between two sets of geographical coordinates as a float.\n \n All parameters are floats.\n '
R_EARTH = 6371
theta1 = ((longitude1 * (2 * pi)) / 360)
theta2 = ((longitude2 * ... | def great_circle_distance(self, latitude1, longitude1, latitude2, longitude2):
'\n Return the distance between two sets of geographical coordinates as a float.\n \n All parameters are floats.\n '
R_EARTH = 6371
theta1 = ((longitude1 * (2 * pi)) / 360)
theta2 = ((longitude2 * ... |
e2b96dbff30ef1a2effdd0b2008c598743b2f43244c62bb86582dbcc69bc6ece | def distance_between_airports(self, airport_code1, airport_code2):
'\n Return the distance between two airports as a float.\n '
airport1 = self._airports_dict[airport_code1]
airport2 = self._airports_dict[airport_code2]
coordinates = (airport1.get_latitude(), airport1.get_longitude(), airp... | Return the distance between two airports as a float. | flight_plan/airports.py | distance_between_airports | crotty-d/flight-plan | 0 | python | def distance_between_airports(self, airport_code1, airport_code2):
'\n \n '
airport1 = self._airports_dict[airport_code1]
airport2 = self._airports_dict[airport_code2]
coordinates = (airport1.get_latitude(), airport1.get_longitude(), airport2.get_latitude(), airport2.get_longitude())
d... | def distance_between_airports(self, airport_code1, airport_code2):
'\n \n '
airport1 = self._airports_dict[airport_code1]
airport2 = self._airports_dict[airport_code2]
coordinates = (airport1.get_latitude(), airport1.get_longitude(), airport2.get_latitude(), airport2.get_longitude())
d... |
7e9ece490f277f1cad9fa00b812a9f713befb7e2a71ca903243aa76a38998657 | def airport_euro_rate(self, airport_code):
'\n Return the euro exchange rate at the given airport\n '
airport = self._airports_dict[airport_code]
country = airport.get_country()
currency_code = self._country_curr_codes.get_code(country)
exch_rate = self._euro_rates.get_rate(currency_co... | Return the euro exchange rate at the given airport | flight_plan/airports.py | airport_euro_rate | crotty-d/flight-plan | 0 | python | def airport_euro_rate(self, airport_code):
'\n \n '
airport = self._airports_dict[airport_code]
country = airport.get_country()
currency_code = self._country_curr_codes.get_code(country)
exch_rate = self._euro_rates.get_rate(currency_code)
return exch_rate | def airport_euro_rate(self, airport_code):
'\n \n '
airport = self._airports_dict[airport_code]
country = airport.get_country()
currency_code = self._country_curr_codes.get_code(country)
exch_rate = self._euro_rates.get_rate(currency_code)
return exch_rate<|docstring|>Return the eu... |
e36690b2b91330ad0ad7dc871705667180bc711592f6f720793ecb84cc07074c | def cost_between_airports(self, distance, exch_rate):
'\n Return the distance between two airports as a float.\n '
return (distance * exch_rate) | Return the distance between two airports as a float. | flight_plan/airports.py | cost_between_airports | crotty-d/flight-plan | 0 | python | def cost_between_airports(self, distance, exch_rate):
'\n \n '
return (distance * exch_rate) | def cost_between_airports(self, distance, exch_rate):
'\n \n '
return (distance * exch_rate)<|docstring|>Return the distance between two airports as a float.<|endoftext|> |
ebada3e7d3587a558178477b625d8f8a4dd09e664d159ccb09b42aebef1c8b13 | def _rescale(val: Sequence[float], low: float, high: float) -> List[float]:
'\n Rescales a list of confidence value between 0 and 1 to an interval [low,\n high].\n\n Args:\n val (float): List of values in interval (0,1)\n low (float): Lower bound of rescaling interval\n high (float): U... | Rescales a list of confidence value between 0 and 1 to an interval [low,
high].
Args:
val (float): List of values in interval (0,1)
low (float): Lower bound of rescaling interval
high (float): Upper bound of rescaling interval
Returns:
Rescaled value (float). | kraken/serialization.py | _rescale | tbaptista/kraken | 1 | python | def _rescale(val: Sequence[float], low: float, high: float) -> List[float]:
'\n Rescales a list of confidence value between 0 and 1 to an interval [low,\n high].\n\n Args:\n val (float): List of values in interval (0,1)\n low (float): Lower bound of rescaling interval\n high (float): U... | def _rescale(val: Sequence[float], low: float, high: float) -> List[float]:
'\n Rescales a list of confidence value between 0 and 1 to an interval [low,\n high].\n\n Args:\n val (float): List of values in interval (0,1)\n low (float): Lower bound of rescaling interval\n high (float): U... |
28241b0af64e9858265e332be3821bac73ef931a93d992291a62362f0887a8b1 | def max_bbox(boxes: Iterable[Tuple[(int, int, int, int)]]) -> Tuple[(int, int, int, int)]:
'\n Calculates the minimal bounding box containing all boxes contained in an\n iterator.\n\n Args:\n boxes (iterator): An iterator returning tuples of the format (x0, y0,\n x1, y1)\n ... | Calculates the minimal bounding box containing all boxes contained in an
iterator.
Args:
boxes (iterator): An iterator returning tuples of the format (x0, y0,
x1, y1)
Returns:
A box covering all bounding boxes in the input argument | kraken/serialization.py | max_bbox | tbaptista/kraken | 1 | python | def max_bbox(boxes: Iterable[Tuple[(int, int, int, int)]]) -> Tuple[(int, int, int, int)]:
'\n Calculates the minimal bounding box containing all boxes contained in an\n iterator.\n\n Args:\n boxes (iterator): An iterator returning tuples of the format (x0, y0,\n x1, y1)\n ... | def max_bbox(boxes: Iterable[Tuple[(int, int, int, int)]]) -> Tuple[(int, int, int, int)]:
'\n Calculates the minimal bounding box containing all boxes contained in an\n iterator.\n\n Args:\n boxes (iterator): An iterator returning tuples of the format (x0, y0,\n x1, y1)\n ... |
36715a80951c5a16fdfd11b1ae3642ce06723d914054ecd0bcc1f646d936ca92 | def serialize(records: Sequence[ocr_record], image_name: str=None, image_size: Tuple[(int, int)]=(0, 0), writing_mode: str='horizontal-tb', scripts: Optional[Iterable[str]]=None, template: str='hocr') -> str:
"\n Serializes a list of ocr_records into an output document.\n\n Serializes a list of predictions an... | Serializes a list of ocr_records into an output document.
Serializes a list of predictions and their corresponding positions by doing
some hOCR-specific preprocessing and then renders them through one of
several jinja2 templates.
Note: Empty records are ignored for serialization purposes.
Args:
records (iterable... | kraken/serialization.py | serialize | tbaptista/kraken | 1 | python | def serialize(records: Sequence[ocr_record], image_name: str=None, image_size: Tuple[(int, int)]=(0, 0), writing_mode: str='horizontal-tb', scripts: Optional[Iterable[str]]=None, template: str='hocr') -> str:
"\n Serializes a list of ocr_records into an output document.\n\n Serializes a list of predictions an... | def serialize(records: Sequence[ocr_record], image_name: str=None, image_size: Tuple[(int, int)]=(0, 0), writing_mode: str='horizontal-tb', scripts: Optional[Iterable[str]]=None, template: str='hocr') -> str:
"\n Serializes a list of ocr_records into an output document.\n\n Serializes a list of predictions an... |
5ac9d149738567e08e1244a634ffead320cca8e585f20c1aa2be64382b8e34cf | def render_report(model: str, chars: int, errors: int, char_confusions: Counter, scripts: Counter, insertions: Counter, deletions: int, substitutions: Counter) -> str:
'\n Renders an accuracy report.\n\n Args:\n model (str): Model name.\n errors (int): Number of errors on test set.\n char... | Renders an accuracy report.
Args:
model (str): Model name.
errors (int): Number of errors on test set.
char_confusions (dict): Dictionary mapping a tuple (gt, pred) to a
number of occurrences.
scripts (dict): Dictionary counting character per script.
insertions (dict): D... | kraken/serialization.py | render_report | tbaptista/kraken | 1 | python | def render_report(model: str, chars: int, errors: int, char_confusions: Counter, scripts: Counter, insertions: Counter, deletions: int, substitutions: Counter) -> str:
'\n Renders an accuracy report.\n\n Args:\n model (str): Model name.\n errors (int): Number of errors on test set.\n char... | def render_report(model: str, chars: int, errors: int, char_confusions: Counter, scripts: Counter, insertions: Counter, deletions: int, substitutions: Counter) -> str:
'\n Renders an accuracy report.\n\n Args:\n model (str): Model name.\n errors (int): Number of errors on test set.\n char... |
b7248e8a2d02f93c9e1525f9d6202c248239addc6fffb26a80d0beb5c2f6ccfd | @property
def sid(self):
'An alphanumeric string identifying this resource.\n :rtype: str\n '
return self._sid | An alphanumeric string identifying this resource.
:rtype: str | zang/domain/bna_lookup.py | sid | engasm89/zangasm | 1 | python | @property
def sid(self):
'An alphanumeric string identifying this resource.\n :rtype: str\n '
return self._sid | @property
def sid(self):
'An alphanumeric string identifying this resource.\n :rtype: str\n '
return self._sid<|docstring|>An alphanumeric string identifying this resource.
:rtype: str<|endoftext|> |
8d7d6961e9c3fbe18c3f2f7ba056721ba9b3bba0d933d1e414939a91b4cdd485 | @property
def accountSid(self):
'An alphanumeric string identifying the account this lookup\n occurred through.\n :rtype: str\n '
return self._account_sid | An alphanumeric string identifying the account this lookup
occurred through.
:rtype: str | zang/domain/bna_lookup.py | accountSid | engasm89/zangasm | 1 | python | @property
def accountSid(self):
'An alphanumeric string identifying the account this lookup\n occurred through.\n :rtype: str\n '
return self._account_sid | @property
def accountSid(self):
'An alphanumeric string identifying the account this lookup\n occurred through.\n :rtype: str\n '
return self._account_sid<|docstring|>An alphanumeric string identifying the account this lookup
occurred through.
:rtype: str<|endoftext|> |
0aeade4b58d802f0d9360c21c95bc6ffb4093aebd015885fe2a118bc008fb120 | @property
def dateCreated(self):
'The date the lookup resource was created.\n :rtype: date\n '
return self._date_created | The date the lookup resource was created.
:rtype: date | zang/domain/bna_lookup.py | dateCreated | engasm89/zangasm | 1 | python | @property
def dateCreated(self):
'The date the lookup resource was created.\n :rtype: date\n '
return self._date_created | @property
def dateCreated(self):
'The date the lookup resource was created.\n :rtype: date\n '
return self._date_created<|docstring|>The date the lookup resource was created.
:rtype: date<|endoftext|> |
440bc1920e6c32fed8f1289951555055d28dffbf7575881e40ca89df4ee4e0e3 | @property
def dateUpdated(self):
'The date the lookup resource was last updated.\n :rtype: date\n '
return self._date_updated | The date the lookup resource was last updated.
:rtype: date | zang/domain/bna_lookup.py | dateUpdated | engasm89/zangasm | 1 | python | @property
def dateUpdated(self):
'The date the lookup resource was last updated.\n :rtype: date\n '
return self._date_updated | @property
def dateUpdated(self):
'The date the lookup resource was last updated.\n :rtype: date\n '
return self._date_updated<|docstring|>The date the lookup resource was last updated.
:rtype: date<|endoftext|> |
37733449c5ee20ab1b994ac2303353039b0e627db1336b95c642744aac1176a5 | @property
def phoneNumber(self):
'The phone number the lookup was performed on.\n :rtype: str\n '
return self._phone_number | The phone number the lookup was performed on.
:rtype: str | zang/domain/bna_lookup.py | phoneNumber | engasm89/zangasm | 1 | python | @property
def phoneNumber(self):
'The phone number the lookup was performed on.\n :rtype: str\n '
return self._phone_number | @property
def phoneNumber(self):
'The phone number the lookup was performed on.\n :rtype: str\n '
return self._phone_number<|docstring|>The phone number the lookup was performed on.
:rtype: str<|endoftext|> |
5d23371e4c50152baa5a1f29bf0da56b7133e8cfc337bc03adf7d4aa9f4ef86c | @property
def firstName(self):
'The first name of the individual associated with this phone number.\n :rtype: str\n '
return self._first_name | The first name of the individual associated with this phone number.
:rtype: str | zang/domain/bna_lookup.py | firstName | engasm89/zangasm | 1 | python | @property
def firstName(self):
'The first name of the individual associated with this phone number.\n :rtype: str\n '
return self._first_name | @property
def firstName(self):
'The first name of the individual associated with this phone number.\n :rtype: str\n '
return self._first_name<|docstring|>The first name of the individual associated with this phone number.
:rtype: str<|endoftext|> |
a649bb63f2f33179afce6c01d4b6014253961434d932e366dabf0754891942af | @property
def lastName(self):
'The last name of the individual associated with this phone number.\n :rtype: str\n '
return self._last_name | The last name of the individual associated with this phone number.
:rtype: str | zang/domain/bna_lookup.py | lastName | engasm89/zangasm | 1 | python | @property
def lastName(self):
'The last name of the individual associated with this phone number.\n :rtype: str\n '
return self._last_name | @property
def lastName(self):
'The last name of the individual associated with this phone number.\n :rtype: str\n '
return self._last_name<|docstring|>The last name of the individual associated with this phone number.
:rtype: str<|endoftext|> |
546f12b9e4c30e1310c99ea0217128117738b6d7ce2c159a1c9a0bcc6cd86ab5 | @property
def address(self):
'The address associated with this phone number.\n :rtype: str\n '
return self._address | The address associated with this phone number.
:rtype: str | zang/domain/bna_lookup.py | address | engasm89/zangasm | 1 | python | @property
def address(self):
'The address associated with this phone number.\n :rtype: str\n '
return self._address | @property
def address(self):
'The address associated with this phone number.\n :rtype: str\n '
return self._address<|docstring|>The address associated with this phone number.
:rtype: str<|endoftext|> |
ca8f7eeb00edf9433f6c47808fa40cc359262715cc26cfaeb884afb354e0a58d | @property
def city(self):
'The city associated with this phone number.\n :rtype: str\n '
return self._city | The city associated with this phone number.
:rtype: str | zang/domain/bna_lookup.py | city | engasm89/zangasm | 1 | python | @property
def city(self):
'The city associated with this phone number.\n :rtype: str\n '
return self._city | @property
def city(self):
'The city associated with this phone number.\n :rtype: str\n '
return self._city<|docstring|>The city associated with this phone number.
:rtype: str<|endoftext|> |
d500372c9c44f3439e4f79545af11c478177a86e87a6bccdeb8a8438a3f78036 | @property
def state(self):
'The US state associated with this phone number.\n :rtype: str\n '
return self._state | The US state associated with this phone number.
:rtype: str | zang/domain/bna_lookup.py | state | engasm89/zangasm | 1 | python | @property
def state(self):
'The US state associated with this phone number.\n :rtype: str\n '
return self._state | @property
def state(self):
'The US state associated with this phone number.\n :rtype: str\n '
return self._state<|docstring|>The US state associated with this phone number.
:rtype: str<|endoftext|> |
3f7036456bc0b723e43798b9dd1998007a0c648dfaaa5a52ee10ff7ed9f94746 | @property
def zipCode(self):
'The zip code associated with this phone number.\n :rtype: str\n '
return self._zip_code | The zip code associated with this phone number.
:rtype: str | zang/domain/bna_lookup.py | zipCode | engasm89/zangasm | 1 | python | @property
def zipCode(self):
'The zip code associated with this phone number.\n :rtype: str\n '
return self._zip_code | @property
def zipCode(self):
'The zip code associated with this phone number.\n :rtype: str\n '
return self._zip_code<|docstring|>The zip code associated with this phone number.
:rtype: str<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.