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 |
|---|---|---|---|---|---|---|---|---|---|
68b7cb9992dba3bd90edc7cd1c50a6890357d88409b441b8598c9ea2905a55e7 | @pytest.mark.parametrize('so', [2, 3, 4, 5])
def test_fd_indices(self, so):
'\n Test that shifted derivative have Integer offset after indexification.\n '
grid = Grid((10,))
x = grid.dimensions[0]
x0 = (x + (0.5 * x.spacing))
u = Function(name='u', grid=grid, space_order=so)
dx = i... | Test that shifted derivative have Integer offset after indexification. | tests/test_derivatives.py | test_fd_indices | felipeaugustogudes/devito | 204 | python | @pytest.mark.parametrize('so', [2, 3, 4, 5])
def test_fd_indices(self, so):
'\n \n '
grid = Grid((10,))
x = grid.dimensions[0]
x0 = (x + (0.5 * x.spacing))
u = Function(name='u', grid=grid, space_order=so)
dx = indexify(u.dx(x0=x0).evaluate)
for f in retrieve_indexed(dx):
... | @pytest.mark.parametrize('so', [2, 3, 4, 5])
def test_fd_indices(self, so):
'\n \n '
grid = Grid((10,))
x = grid.dimensions[0]
x0 = (x + (0.5 * x.spacing))
u = Function(name='u', grid=grid, space_order=so)
dx = indexify(u.dx(x0=x0).evaluate)
for f in retrieve_indexed(dx):
... |
71f61ff80801ce27fbf574bbae8fa455138ff8b4b51c4c7a7bde8b2dd5ca4fe8 | @pytest.mark.parametrize('SymbolType, dim', [(Function, x), (Function, y), (TimeFunction, x), (TimeFunction, y), (TimeFunction, t)])
def test_stencil_derivative(self, SymbolType, dim):
'Test symbolic behaviour when expanding stencil derivatives'
i = dim(self.grid)
u = SymbolType(name='u', grid=self.grid)
... | Test symbolic behaviour when expanding stencil derivatives | tests/test_derivatives.py | test_stencil_derivative | felipeaugustogudes/devito | 204 | python | @pytest.mark.parametrize('SymbolType, dim', [(Function, x), (Function, y), (TimeFunction, x), (TimeFunction, y), (TimeFunction, t)])
def test_stencil_derivative(self, SymbolType, dim):
i = dim(self.grid)
u = SymbolType(name='u', grid=self.grid)
u.data[:] = 66.6
di = u.diff(i)
dii = u.diff(i, i)... | @pytest.mark.parametrize('SymbolType, dim', [(Function, x), (Function, y), (TimeFunction, x), (TimeFunction, y), (TimeFunction, t)])
def test_stencil_derivative(self, SymbolType, dim):
i = dim(self.grid)
u = SymbolType(name='u', grid=self.grid)
u.data[:] = 66.6
di = u.diff(i)
dii = u.diff(i, i)... |
d8670bbd20435c342075e455859b0ecadf578b874cc4f06174f1ef48e54fd960 | @pytest.mark.parametrize('SymbolType, derivative, dim', [(Function, 'dx2', 3), (Function, 'dy2', 3), (TimeFunction, 'dx2', 3), (TimeFunction, 'dy2', 3), (TimeFunction, 'dt', 2)])
def test_preformed_derivatives(self, SymbolType, derivative, dim):
'Test the stencil expressions provided by devito objects'
u = Symb... | Test the stencil expressions provided by devito objects | tests/test_derivatives.py | test_preformed_derivatives | felipeaugustogudes/devito | 204 | python | @pytest.mark.parametrize('SymbolType, derivative, dim', [(Function, 'dx2', 3), (Function, 'dy2', 3), (TimeFunction, 'dx2', 3), (TimeFunction, 'dy2', 3), (TimeFunction, 'dt', 2)])
def test_preformed_derivatives(self, SymbolType, derivative, dim):
u = SymbolType(name='u', grid=self.grid, time_order=2, space_orde... | @pytest.mark.parametrize('SymbolType, derivative, dim', [(Function, 'dx2', 3), (Function, 'dy2', 3), (TimeFunction, 'dx2', 3), (TimeFunction, 'dy2', 3), (TimeFunction, 'dt', 2)])
def test_preformed_derivatives(self, SymbolType, derivative, dim):
u = SymbolType(name='u', grid=self.grid, time_order=2, space_orde... |
c1ed21a70b0729f05c8184d6a80c4e6a57fcaf4dd89821fb1588d6c0525542fa | @pytest.mark.parametrize('derivative, dim', [('dx', x), ('dy', y), ('dz', z)])
@pytest.mark.parametrize('order', [1, 2, 4, 6, 8, 10, 12, 14, 16])
def test_derivatives_space(self, derivative, dim, order):
'Test first derivative expressions against native sympy'
dim = dim(self.grid)
u = TimeFunction(name='u',... | Test first derivative expressions against native sympy | tests/test_derivatives.py | test_derivatives_space | felipeaugustogudes/devito | 204 | python | @pytest.mark.parametrize('derivative, dim', [('dx', x), ('dy', y), ('dz', z)])
@pytest.mark.parametrize('order', [1, 2, 4, 6, 8, 10, 12, 14, 16])
def test_derivatives_space(self, derivative, dim, order):
dim = dim(self.grid)
u = TimeFunction(name='u', grid=self.grid, time_order=2, space_order=order)
ex... | @pytest.mark.parametrize('derivative, dim', [('dx', x), ('dy', y), ('dz', z)])
@pytest.mark.parametrize('order', [1, 2, 4, 6, 8, 10, 12, 14, 16])
def test_derivatives_space(self, derivative, dim, order):
dim = dim(self.grid)
u = TimeFunction(name='u', grid=self.grid, time_order=2, space_order=order)
ex... |
221fe578d64b2e6227a1fa324912cbdc92cb729143a0bcab8557056223ffcd44 | @pytest.mark.parametrize('derivative, dim', [('dx2', x), ('dy2', y), ('dz2', z)])
@pytest.mark.parametrize('order', [2, 4, 6, 8, 10, 12, 14, 16])
def test_second_derivatives_space(self, derivative, dim, order):
'\n Test second derivative expressions against native sympy.\n '
dim = dim(self.grid)
... | Test second derivative expressions against native sympy. | tests/test_derivatives.py | test_second_derivatives_space | felipeaugustogudes/devito | 204 | python | @pytest.mark.parametrize('derivative, dim', [('dx2', x), ('dy2', y), ('dz2', z)])
@pytest.mark.parametrize('order', [2, 4, 6, 8, 10, 12, 14, 16])
def test_second_derivatives_space(self, derivative, dim, order):
'\n \n '
dim = dim(self.grid)
u = TimeFunction(name='u', grid=self.grid, time_order... | @pytest.mark.parametrize('derivative, dim', [('dx2', x), ('dy2', y), ('dz2', z)])
@pytest.mark.parametrize('order', [2, 4, 6, 8, 10, 12, 14, 16])
def test_second_derivatives_space(self, derivative, dim, order):
'\n \n '
dim = dim(self.grid)
u = TimeFunction(name='u', grid=self.grid, time_order... |
830c753f63a905185ef08ce0c9010dfba8df7c412b561c0032a0c37c694b02d2 | @pytest.mark.parametrize('space_order', [2, 4, 6, 8, 10, 12, 14, 16, 18, 20])
@pytest.mark.parametrize('derivative', ['dx', 'dxl', 'dxr', 'dx2'])
def test_fd_space(self, derivative, space_order):
'\n This test compares the discrete finite-difference scheme against polynomials\n For a given order p, th... | This test compares the discrete finite-difference scheme against polynomials
For a given order p, the finite difference scheme should
be exact for polynomials of order p. | tests/test_derivatives.py | test_fd_space | felipeaugustogudes/devito | 204 | python | @pytest.mark.parametrize('space_order', [2, 4, 6, 8, 10, 12, 14, 16, 18, 20])
@pytest.mark.parametrize('derivative', ['dx', 'dxl', 'dxr', 'dx2'])
def test_fd_space(self, derivative, space_order):
'\n This test compares the discrete finite-difference scheme against polynomials\n For a given order p, th... | @pytest.mark.parametrize('space_order', [2, 4, 6, 8, 10, 12, 14, 16, 18, 20])
@pytest.mark.parametrize('derivative', ['dx', 'dxl', 'dxr', 'dx2'])
def test_fd_space(self, derivative, space_order):
'\n This test compares the discrete finite-difference scheme against polynomials\n For a given order p, th... |
dd023cfefaf520be94d98f23a0ed1f46b080bfad0640f466f0f0ef94147477f0 | @pytest.mark.parametrize('space_order', [2, 4, 6, 8, 10, 12, 14, 16, 18, 20])
@pytest.mark.parametrize('stagger', [centered, left, right])
def test_fd_space_staggered(self, space_order, stagger):
'\n This test compares the discrete finite-difference scheme against polynomials\n For a given order p, th... | This test compares the discrete finite-difference scheme against polynomials
For a given order p, the finite difference scheme should
be exact for polynomials of order p | tests/test_derivatives.py | test_fd_space_staggered | felipeaugustogudes/devito | 204 | python | @pytest.mark.parametrize('space_order', [2, 4, 6, 8, 10, 12, 14, 16, 18, 20])
@pytest.mark.parametrize('stagger', [centered, left, right])
def test_fd_space_staggered(self, space_order, stagger):
'\n This test compares the discrete finite-difference scheme against polynomials\n For a given order p, th... | @pytest.mark.parametrize('space_order', [2, 4, 6, 8, 10, 12, 14, 16, 18, 20])
@pytest.mark.parametrize('stagger', [centered, left, right])
def test_fd_space_staggered(self, space_order, stagger):
'\n This test compares the discrete finite-difference scheme against polynomials\n For a given order p, th... |
c26b3c3620dcdfe22900ed0df8591cd84791d9532a3ae194855a588cc1da194f | def test_new_x0_eval_at(self):
'\n Make sure that explicitly set x0 does not get overwritten by eval_at.\n '
grid = Grid((10,))
x = grid.dimensions[0]
u = Function(name='u', grid=grid, space_order=2)
v = Function(name='v', grid=grid, space_order=2)
assert (u.dx(x0=(x - (x.spacing /... | Make sure that explicitly set x0 does not get overwritten by eval_at. | tests/test_derivatives.py | test_new_x0_eval_at | felipeaugustogudes/devito | 204 | python | def test_new_x0_eval_at(self):
'\n \n '
grid = Grid((10,))
x = grid.dimensions[0]
u = Function(name='u', grid=grid, space_order=2)
v = Function(name='v', grid=grid, space_order=2)
assert (u.dx(x0=(x - (x.spacing / 2)))._eval_at(v).x0 == {x: (x - (x.spacing / 2))}) | def test_new_x0_eval_at(self):
'\n \n '
grid = Grid((10,))
x = grid.dimensions[0]
u = Function(name='u', grid=grid, space_order=2)
v = Function(name='v', grid=grid, space_order=2)
assert (u.dx(x0=(x - (x.spacing / 2)))._eval_at(v).x0 == {x: (x - (x.spacing / 2))})<|docstring|>Make ... |
df8e2897b168f4dd74aa9fc8e3b1a44a69a01810b6d3dc363110efba3b6bff70 | def test_subsampled_fd(self):
'\n Test that the symbolic interface is working for space subsampled\n functions.\n '
nt = 19
grid = Grid(shape=(12, 12), extent=(11, 11))
u = TimeFunction(name='u', grid=grid, save=nt, space_order=2)
assert (grid.time_dim in u.indices)
dims = t... | Test that the symbolic interface is working for space subsampled
functions. | tests/test_derivatives.py | test_subsampled_fd | felipeaugustogudes/devito | 204 | python | def test_subsampled_fd(self):
'\n Test that the symbolic interface is working for space subsampled\n functions.\n '
nt = 19
grid = Grid(shape=(12, 12), extent=(11, 11))
u = TimeFunction(name='u', grid=grid, save=nt, space_order=2)
assert (grid.time_dim in u.indices)
dims = t... | def test_subsampled_fd(self):
'\n Test that the symbolic interface is working for space subsampled\n functions.\n '
nt = 19
grid = Grid(shape=(12, 12), extent=(11, 11))
u = TimeFunction(name='u', grid=grid, save=nt, space_order=2)
assert (grid.time_dim in u.indices)
dims = t... |
908e58961bb5734e1d3e27562098aea949856664944d9e96f666ff9daedc478f | @pytest.mark.parametrize('so', [2, 5, 8])
def test_all_shortcuts(self, so):
'\n Test that verify that all fd shortcuts are functional.\n '
grid = Grid(shape=(10, 10, 10))
f = Function(name='f', grid=grid, space_order=so)
g = TimeFunction(name='g', grid=grid, space_order=so)
for fd in f... | Test that verify that all fd shortcuts are functional. | tests/test_derivatives.py | test_all_shortcuts | felipeaugustogudes/devito | 204 | python | @pytest.mark.parametrize('so', [2, 5, 8])
def test_all_shortcuts(self, so):
'\n \n '
grid = Grid(shape=(10, 10, 10))
f = Function(name='f', grid=grid, space_order=so)
g = TimeFunction(name='g', grid=grid, space_order=so)
for fd in f._fd:
assert getattr(f, fd)
for fd in g._f... | @pytest.mark.parametrize('so', [2, 5, 8])
def test_all_shortcuts(self, so):
'\n \n '
grid = Grid(shape=(10, 10, 10))
f = Function(name='f', grid=grid, space_order=so)
g = TimeFunction(name='g', grid=grid, space_order=so)
for fd in f._fd:
assert getattr(f, fd)
for fd in g._f... |
f1c690b3eb83afd810d6d3b9fc4bde537c26969c3a065e6c0b0d744933c17f1d | def __init__(self, resp, decode_type='utf-8'):
'\n get data from ResultSet\n '
self._decode_type = decode_type
self._resp = resp
self._data_set_wrapper = None
if (self._resp.data is not None):
self._data_set_wrapper = DataSetWrapper(resp.data, self._decode_type) | get data from ResultSet | python/nebula2/data/ResultSet.py | __init__ | taeb3/nebula-clients | 15 | python | def __init__(self, resp, decode_type='utf-8'):
'\n \n '
self._decode_type = decode_type
self._resp = resp
self._data_set_wrapper = None
if (self._resp.data is not None):
self._data_set_wrapper = DataSetWrapper(resp.data, self._decode_type) | def __init__(self, resp, decode_type='utf-8'):
'\n \n '
self._decode_type = decode_type
self._resp = resp
self._data_set_wrapper = None
if (self._resp.data is not None):
self._data_set_wrapper = DataSetWrapper(resp.data, self._decode_type)<|docstring|>get data from ResultSet<|e... |
57d324efdf7d560826691846caef381f6068987464f1fd7ad8735aff5328590a | def latency(self):
'\n unit us\n '
return self._resp.latency_in_us | unit us | python/nebula2/data/ResultSet.py | latency | taeb3/nebula-clients | 15 | python | def latency(self):
'\n \n '
return self._resp.latency_in_us | def latency(self):
'\n \n '
return self._resp.latency_in_us<|docstring|>unit us<|endoftext|> |
be92a8129d8e910759ce91072a60d073408b9bb83d47230280cb221d01e52d5f | def keys(self):
'\n get colNames\n '
if (self._data_set_wrapper is None):
return []
return self._data_set_wrapper.get_col_names() | get colNames | python/nebula2/data/ResultSet.py | keys | taeb3/nebula-clients | 15 | python | def keys(self):
'\n \n '
if (self._data_set_wrapper is None):
return []
return self._data_set_wrapper.get_col_names() | def keys(self):
'\n \n '
if (self._data_set_wrapper is None):
return []
return self._data_set_wrapper.get_col_names()<|docstring|>get colNames<|endoftext|> |
e52423be80aa647a92495f1c19a51b7901d3a89fe2cda7f5578ff018ea70d045 | def row_size(self):
'\n get one row size\n '
if (self._data_set_wrapper is None):
return 0
return len(self._data_set_wrapper.get_rows()) | get one row size | python/nebula2/data/ResultSet.py | row_size | taeb3/nebula-clients | 15 | python | def row_size(self):
'\n \n '
if (self._data_set_wrapper is None):
return 0
return len(self._data_set_wrapper.get_rows()) | def row_size(self):
'\n \n '
if (self._data_set_wrapper is None):
return 0
return len(self._data_set_wrapper.get_rows())<|docstring|>get one row size<|endoftext|> |
d95d64110d217f5445e726ce9541cedfaa0cb7473b566e455e6cbde6a537e22f | def col_size(self):
'\n get one col size\n '
if (self._data_set_wrapper is None):
return 0
return len(self._data_set_wrapper.get_col_names()) | get one col size | python/nebula2/data/ResultSet.py | col_size | taeb3/nebula-clients | 15 | python | def col_size(self):
'\n \n '
if (self._data_set_wrapper is None):
return 0
return len(self._data_set_wrapper.get_col_names()) | def col_size(self):
'\n \n '
if (self._data_set_wrapper is None):
return 0
return len(self._data_set_wrapper.get_col_names())<|docstring|>get one col size<|endoftext|> |
dbdc9cccb93da470c5c29f7fcac6f8e8f91e5705dde127b5c654a52c526736ac | def get_row_types(self):
'\n Get row types\n :param empty\n :return: list<int>\n ttypes.Value.__EMPTY__ = 0\n ttypes.Value.NVAL = 1\n ttypes.Value.BVAL = 2\n ttypes.Value.IVAL = 3\n ttypes.Value.FVAL = 4\n ttypes.Value.SVAL = 5\n tt... | Get row types
:param empty
:return: list<int>
ttypes.Value.__EMPTY__ = 0
ttypes.Value.NVAL = 1
ttypes.Value.BVAL = 2
ttypes.Value.IVAL = 3
ttypes.Value.FVAL = 4
ttypes.Value.SVAL = 5
ttypes.Value.DVAL = 6
ttypes.Value.TVAL = 7
ttypes.Value.DTVAL = 8
ttypes.Value.VVAL = 9
ttypes.Value.EVAL = 10
t... | python/nebula2/data/ResultSet.py | get_row_types | taeb3/nebula-clients | 15 | python | def get_row_types(self):
'\n Get row types\n :param empty\n :return: list<int>\n ttypes.Value.__EMPTY__ = 0\n ttypes.Value.NVAL = 1\n ttypes.Value.BVAL = 2\n ttypes.Value.IVAL = 3\n ttypes.Value.FVAL = 4\n ttypes.Value.SVAL = 5\n tt... | def get_row_types(self):
'\n Get row types\n :param empty\n :return: list<int>\n ttypes.Value.__EMPTY__ = 0\n ttypes.Value.NVAL = 1\n ttypes.Value.BVAL = 2\n ttypes.Value.IVAL = 3\n ttypes.Value.FVAL = 4\n ttypes.Value.SVAL = 5\n tt... |
72dfcff4fb50374735105fcf6646d905a23a7f98130c8305ab9369227bbb691b | def row_values(self, row_index):
'\n Get row values\n :param index: the Record index\n :return: list<ValueWrapper>\n '
if (self._data_set_wrapper is None):
return []
return self._data_set_wrapper.row_values(row_index) | Get row values
:param index: the Record index
:return: list<ValueWrapper> | python/nebula2/data/ResultSet.py | row_values | taeb3/nebula-clients | 15 | python | def row_values(self, row_index):
'\n Get row values\n :param index: the Record index\n :return: list<ValueWrapper>\n '
if (self._data_set_wrapper is None):
return []
return self._data_set_wrapper.row_values(row_index) | def row_values(self, row_index):
'\n Get row values\n :param index: the Record index\n :return: list<ValueWrapper>\n '
if (self._data_set_wrapper is None):
return []
return self._data_set_wrapper.row_values(row_index)<|docstring|>Get row values
:param index: the Record in... |
eb7d9d0fa1594eeb7f709256f06b6c9dc35924e432ff8b4994fb3e2910c20ed8 | def column_values(self, key):
'\n get column values\n :param key: the col name\n :return: list<ValueWrapper>\n '
if (self._data_set_wrapper is None):
return []
return self._data_set_wrapper.column_values(key) | get column values
:param key: the col name
:return: list<ValueWrapper> | python/nebula2/data/ResultSet.py | column_values | taeb3/nebula-clients | 15 | python | def column_values(self, key):
'\n get column values\n :param key: the col name\n :return: list<ValueWrapper>\n '
if (self._data_set_wrapper is None):
return []
return self._data_set_wrapper.column_values(key) | def column_values(self, key):
'\n get column values\n :param key: the col name\n :return: list<ValueWrapper>\n '
if (self._data_set_wrapper is None):
return []
return self._data_set_wrapper.column_values(key)<|docstring|>get column values
:param key: the col name
:return:... |
ff59138696e13017cfe5fc80a523f80ab96dab9826197512bbc47dbb33d924f8 | def rows(self):
'\n get all rows\n :param key: empty\n :return: list<Row>\n '
if (self._data_set_wrapper is None):
return []
return self._data_set_wrapper.get_rows() | get all rows
:param key: empty
:return: list<Row> | python/nebula2/data/ResultSet.py | rows | taeb3/nebula-clients | 15 | python | def rows(self):
'\n get all rows\n :param key: empty\n :return: list<Row>\n '
if (self._data_set_wrapper is None):
return []
return self._data_set_wrapper.get_rows() | def rows(self):
'\n get all rows\n :param key: empty\n :return: list<Row>\n '
if (self._data_set_wrapper is None):
return []
return self._data_set_wrapper.get_rows()<|docstring|>get all rows
:param key: empty
:return: list<Row><|endoftext|> |
ca9501c93273f4bcac82aa66d92c1399a86cb14e0a1cf9381d16243fd8b0a249 | @pytest.fixture
def clean_server(initialize_test_dir):
'\n Put testing server in a defined state: only minimal metadata (instruments)\n and records present\n '
config = json.load(open(SERVER_CONFIG_YAML, 'r'))
redproj = redcap.Project(config['api_url'], config['api_token'], lazy=True)
default_d... | Put testing server in a defined state: only minimal metadata (instruments)
and records present | redcap_bridge/test_redcap/test_server_interface.py | clean_server | killianrochet/DigLabTools | 2 | python | @pytest.fixture
def clean_server(initialize_test_dir):
'\n Put testing server in a defined state: only minimal metadata (instruments)\n and records present\n '
config = json.load(open(SERVER_CONFIG_YAML, 'r'))
redproj = redcap.Project(config['api_url'], config['api_token'], lazy=True)
default_d... | @pytest.fixture
def clean_server(initialize_test_dir):
'\n Put testing server in a defined state: only minimal metadata (instruments)\n and records present\n '
config = json.load(open(SERVER_CONFIG_YAML, 'r'))
redproj = redcap.Project(config['api_url'], config['api_token'], lazy=True)
default_d... |
032da9ff25c933bcb194df46adb74db4ac2fa56c3d0002e72f6060d87cb15e7a | def test_upload_datadict(clean_server, initialize_test_dir):
'\n Test uploading a survey definition (datadict) csv to the server\n '
metadata_csv = ((test_directory / 'testfiles') / 'metadata.csv')
res = upload_datadict(metadata_csv, SERVER_CONFIG_YAML)
with open(metadata_csv) as f:
lines ... | Test uploading a survey definition (datadict) csv to the server | redcap_bridge/test_redcap/test_server_interface.py | test_upload_datadict | killianrochet/DigLabTools | 2 | python | def test_upload_datadict(clean_server, initialize_test_dir):
'\n \n '
metadata_csv = ((test_directory / 'testfiles') / 'metadata.csv')
res = upload_datadict(metadata_csv, SERVER_CONFIG_YAML)
with open(metadata_csv) as f:
lines = f.readlines()
exp = (len(lines) - 1)
assert (exp ... | def test_upload_datadict(clean_server, initialize_test_dir):
'\n \n '
metadata_csv = ((test_directory / 'testfiles') / 'metadata.csv')
res = upload_datadict(metadata_csv, SERVER_CONFIG_YAML)
with open(metadata_csv) as f:
lines = f.readlines()
exp = (len(lines) - 1)
assert (exp ... |
3d467f9c5a79a2eea9eb58b382f5bbc085713643c8e8a33db26156828125a8ef | def test_upload_records(clean_server, initialize_test_dir):
'\n Test upload of records to the server\n\n TODO: Finally this test should test the corresponding redcap_bridge\n `upload_records` method instead of pycap itself\n '
config = json.load(open(SERVER_CONFIG_YAML, 'r'))
redproj = redcap.Pr... | Test upload of records to the server
TODO: Finally this test should test the corresponding redcap_bridge
`upload_records` method instead of pycap itself | redcap_bridge/test_redcap/test_server_interface.py | test_upload_records | killianrochet/DigLabTools | 2 | python | def test_upload_records(clean_server, initialize_test_dir):
'\n Test upload of records to the server\n\n TODO: Finally this test should test the corresponding redcap_bridge\n `upload_records` method instead of pycap itself\n '
config = json.load(open(SERVER_CONFIG_YAML, 'r'))
redproj = redcap.Pr... | def test_upload_records(clean_server, initialize_test_dir):
'\n Test upload of records to the server\n\n TODO: Finally this test should test the corresponding redcap_bridge\n `upload_records` method instead of pycap itself\n '
config = json.load(open(SERVER_CONFIG_YAML, 'r'))
redproj = redcap.Pr... |
2df0251ee9c2e0ace78e54584455d40820d04be852fcb831d6ccf8d3029743ec | def test_download_records(clean_server, initialize_test_dir):
'\n Download datadict from server and compare to previously uploaded datadict\n '
original_metadata_csv = ((test_directory / 'testfiles') / 'metadata.csv')
upload_datadict(original_metadata_csv, SERVER_CONFIG_YAML)
downloaded_metadata_c... | Download datadict from server and compare to previously uploaded datadict | redcap_bridge/test_redcap/test_server_interface.py | test_download_records | killianrochet/DigLabTools | 2 | python | def test_download_records(clean_server, initialize_test_dir):
'\n \n '
original_metadata_csv = ((test_directory / 'testfiles') / 'metadata.csv')
upload_datadict(original_metadata_csv, SERVER_CONFIG_YAML)
downloaded_metadata_csv = ((test_directory / 'testfiles') / 'metadata_downloaded.csv')
dow... | def test_download_records(clean_server, initialize_test_dir):
'\n \n '
original_metadata_csv = ((test_directory / 'testfiles') / 'metadata.csv')
upload_datadict(original_metadata_csv, SERVER_CONFIG_YAML)
downloaded_metadata_csv = ((test_directory / 'testfiles') / 'metadata_downloaded.csv')
dow... |
02a30c0926f14ec92a4be728c45318a0a9b5dbd18b049df233716d4487465230 | def get_initializer(initializer_seed=42.0):
'Creates a `tf.initializers.glorot_normal` with the given seed.\n Args:\n initializer_seed: int, initializer seed.\n Returns:\n GlorotNormal initializer with seed = `initializer_seed`.\n '
return tf.keras.initializers.GlorotNormal(seed=initializ... | Creates a `tf.initializers.glorot_normal` with the given seed.
Args:
initializer_seed: int, initializer seed.
Returns:
GlorotNormal initializer with seed = `initializer_seed`. | models/vocoder.py | get_initializer | Z-yq/TensorflowTTS | 50 | python | def get_initializer(initializer_seed=42.0):
'Creates a `tf.initializers.glorot_normal` with the given seed.\n Args:\n initializer_seed: int, initializer seed.\n Returns:\n GlorotNormal initializer with seed = `initializer_seed`.\n '
return tf.keras.initializers.GlorotNormal(seed=initializ... | def get_initializer(initializer_seed=42.0):
'Creates a `tf.initializers.glorot_normal` with the given seed.\n Args:\n initializer_seed: int, initializer seed.\n Returns:\n GlorotNormal initializer with seed = `initializer_seed`.\n '
return tf.keras.initializers.GlorotNormal(seed=initializ... |
660092e7f31d61db19e83683c73551a2f17f721505f4625317b5b4dd8e155e2a | def __init__(self, input_feature='raw', num_mels=80, out_channels=80, kernel_size=7, filters=1024, use_bias=True, hop_size=0.016, sample_rate=8000, stack_kernel_size=3, stacks=5, nonlinear_activation='LeakyReLU', nonlinear_activation_params={'alpha': 0.2}, padding_type='REFLECT', use_final_nolinear_activation=True, is_... | Init parameters for MelGAN Generator model. | models/vocoder.py | __init__ | Z-yq/TensorflowTTS | 50 | python | def __init__(self, input_feature='raw', num_mels=80, out_channels=80, kernel_size=7, filters=1024, use_bias=True, hop_size=0.016, sample_rate=8000, stack_kernel_size=3, stacks=5, nonlinear_activation='LeakyReLU', nonlinear_activation_params={'alpha': 0.2}, padding_type='REFLECT', use_final_nolinear_activation=True, is_... | def __init__(self, input_feature='raw', num_mels=80, out_channels=80, kernel_size=7, filters=1024, use_bias=True, hop_size=0.016, sample_rate=8000, stack_kernel_size=3, stacks=5, nonlinear_activation='LeakyReLU', nonlinear_activation_params={'alpha': 0.2}, padding_type='REFLECT', use_final_nolinear_activation=True, is_... |
93de186098f39a1bceabf428567ca8f0f90ca7705711df569f00f8f7350531ff | def __init__(self, dis_out_channels=1, dis_scales=3, dis_downsample_pooling='AveragePooling1D', dis_downsample_pooling_params={'pool_size': 4, 'strides': 2}, dis_kernel_sizes=[5, 3], dis_filters=32, dis_max_downsample_filters=1024, dis_use_bias=True, dis_downsample_scales=[2, 2, 2, 2], dis_nonlinear_activation='LeakyRe... | Init parameters for MelGAN Discriminator model. | models/vocoder.py | __init__ | Z-yq/TensorflowTTS | 50 | python | def __init__(self, dis_out_channels=1, dis_scales=3, dis_downsample_pooling='AveragePooling1D', dis_downsample_pooling_params={'pool_size': 4, 'strides': 2}, dis_kernel_sizes=[5, 3], dis_filters=32, dis_max_downsample_filters=1024, dis_use_bias=True, dis_downsample_scales=[2, 2, 2, 2], dis_nonlinear_activation='LeakyRe... | def __init__(self, dis_out_channels=1, dis_scales=3, dis_downsample_pooling='AveragePooling1D', dis_downsample_pooling_params={'pool_size': 4, 'strides': 2}, dis_kernel_sizes=[5, 3], dis_filters=32, dis_max_downsample_filters=1024, dis_use_bias=True, dis_downsample_scales=[2, 2, 2, 2], dis_nonlinear_activation='LeakyRe... |
6402d9fc5e9d175d6682df7898edc2885d829ac5958c18b8ee3307c50a64b625 | def __init__(self, config, **kwargs):
'Initialize TFMelGANGenerator module.\n Args:\n config: config object of Melgan generator.\n '
super(TFMultiWindowGenerator, self).__init__(**kwargs)
assert (config.filters >= np.prod(config.upsample_scales))
assert ((config.filters % (2 ** ... | Initialize TFMelGANGenerator module.
Args:
config: config object of Melgan generator. | models/vocoder.py | __init__ | Z-yq/TensorflowTTS | 50 | python | def __init__(self, config, **kwargs):
'Initialize TFMelGANGenerator module.\n Args:\n config: config object of Melgan generator.\n '
super(TFMultiWindowGenerator, self).__init__(**kwargs)
assert (config.filters >= np.prod(config.upsample_scales))
assert ((config.filters % (2 ** ... | def __init__(self, config, **kwargs):
'Initialize TFMelGANGenerator module.\n Args:\n config: config object of Melgan generator.\n '
super(TFMultiWindowGenerator, self).__init__(**kwargs)
assert (config.filters >= np.prod(config.upsample_scales))
assert ((config.filters % (2 ** ... |
803195b0435414255c2631d2072f376c220f2e9e89c3f7f2eca22987e6717e51 | def __init__(self, padding_size, padding_type='REFLECT', **kwargs):
'Initialize TFReflectionPad1d module.\n\n Args:\n padding_size (int)\n padding_type (str) ("CONSTANT", "REFLECT", or "SYMMETRIC". Default is "REFLECT")\n '
super().__init__(**kwargs)
self.padding_size = p... | Initialize TFReflectionPad1d module.
Args:
padding_size (int)
padding_type (str) ("CONSTANT", "REFLECT", or "SYMMETRIC". Default is "REFLECT") | models/vocoder.py | __init__ | Z-yq/TensorflowTTS | 50 | python | def __init__(self, padding_size, padding_type='REFLECT', **kwargs):
'Initialize TFReflectionPad1d module.\n\n Args:\n padding_size (int)\n padding_type (str) ("CONSTANT", "REFLECT", or "SYMMETRIC". Default is "REFLECT")\n '
super().__init__(**kwargs)
self.padding_size = p... | def __init__(self, padding_size, padding_type='REFLECT', **kwargs):
'Initialize TFReflectionPad1d module.\n\n Args:\n padding_size (int)\n padding_type (str) ("CONSTANT", "REFLECT", or "SYMMETRIC". Default is "REFLECT")\n '
super().__init__(**kwargs)
self.padding_size = p... |
3c74acd0416578c7b33ffb759c5d99a85fa986326ccca7c8314d1167cfd1f99f | def call(self, x):
'Calculate forward propagation.\n Args:\n x (Tensor): Input tensor (B, T, C).\n Returns:\n Tensor: Padded tensor (B, T + 2 * padding_size, C).\n '
return tf.pad(x, [[0, 0], [self.padding_size, self.padding_size], [0, 0]], self.padding_type) | Calculate forward propagation.
Args:
x (Tensor): Input tensor (B, T, C).
Returns:
Tensor: Padded tensor (B, T + 2 * padding_size, C). | models/vocoder.py | call | Z-yq/TensorflowTTS | 50 | python | def call(self, x):
'Calculate forward propagation.\n Args:\n x (Tensor): Input tensor (B, T, C).\n Returns:\n Tensor: Padded tensor (B, T + 2 * padding_size, C).\n '
return tf.pad(x, [[0, 0], [self.padding_size, self.padding_size], [0, 0]], self.padding_type) | def call(self, x):
'Calculate forward propagation.\n Args:\n x (Tensor): Input tensor (B, T, C).\n Returns:\n Tensor: Padded tensor (B, T + 2 * padding_size, C).\n '
return tf.pad(x, [[0, 0], [self.padding_size, self.padding_size], [0, 0]], self.padding_type)<|docstrin... |
9f117eb18f11adb35165e00fdb7d8f235e0fc492c962f0fa5b2a39fefc4591b2 | def __init__(self, filters, kernel_size, strides, padding, is_weight_norm, initializer_seed, **kwargs):
'Initialize TFConvTranspose1d( module.\n Args:\n filters (int): Number of filters.\n kernel_size (int): kernel size.\n strides (int): Stride width.\n padding (st... | Initialize TFConvTranspose1d( module.
Args:
filters (int): Number of filters.
kernel_size (int): kernel size.
strides (int): Stride width.
padding (str): Padding type ("same" or "valid"). | models/vocoder.py | __init__ | Z-yq/TensorflowTTS | 50 | python | def __init__(self, filters, kernel_size, strides, padding, is_weight_norm, initializer_seed, **kwargs):
'Initialize TFConvTranspose1d( module.\n Args:\n filters (int): Number of filters.\n kernel_size (int): kernel size.\n strides (int): Stride width.\n padding (st... | def __init__(self, filters, kernel_size, strides, padding, is_weight_norm, initializer_seed, **kwargs):
'Initialize TFConvTranspose1d( module.\n Args:\n filters (int): Number of filters.\n kernel_size (int): kernel size.\n strides (int): Stride width.\n padding (st... |
691d7e7cc461e055cb8042bc8c75f254f20014cc70e76563c97ef1adda19cb8c | def call(self, x):
"Calculate forward propagation.\n Args:\n x (Tensor): Input tensor (B, T, C).\n Returns:\n Tensor: Output tensor (B, T', C').\n "
x = self.conv1(x)
x = self.up(x)
x = self.conv2(x)
return x | Calculate forward propagation.
Args:
x (Tensor): Input tensor (B, T, C).
Returns:
Tensor: Output tensor (B, T', C'). | models/vocoder.py | call | Z-yq/TensorflowTTS | 50 | python | def call(self, x):
"Calculate forward propagation.\n Args:\n x (Tensor): Input tensor (B, T, C).\n Returns:\n Tensor: Output tensor (B, T', C').\n "
x = self.conv1(x)
x = self.up(x)
x = self.conv2(x)
return x | def call(self, x):
"Calculate forward propagation.\n Args:\n x (Tensor): Input tensor (B, T, C).\n Returns:\n Tensor: Output tensor (B, T', C').\n "
x = self.conv1(x)
x = self.up(x)
x = self.conv2(x)
return x<|docstring|>Calculate forward propagation.
Args:... |
9509d1d6ce8e2c226ece017ebcc44bfaa6fc576fa21d47387f6c045df5d69022 | def __init__(self, filters, kernel_size, strides, padding, is_weight_norm, initializer_seed, **kwargs):
'Initialize TFConvTranspose1d( module.\n Args:\n filters (int): Number of filters.\n kernel_size (int): kernel size.\n strides (int): Stride width.\n padding (st... | Initialize TFConvTranspose1d( module.
Args:
filters (int): Number of filters.
kernel_size (int): kernel size.
strides (int): Stride width.
padding (str): Padding type ("same" or "valid"). | models/vocoder.py | __init__ | Z-yq/TensorflowTTS | 50 | python | def __init__(self, filters, kernel_size, strides, padding, is_weight_norm, initializer_seed, **kwargs):
'Initialize TFConvTranspose1d( module.\n Args:\n filters (int): Number of filters.\n kernel_size (int): kernel size.\n strides (int): Stride width.\n padding (st... | def __init__(self, filters, kernel_size, strides, padding, is_weight_norm, initializer_seed, **kwargs):
'Initialize TFConvTranspose1d( module.\n Args:\n filters (int): Number of filters.\n kernel_size (int): kernel size.\n strides (int): Stride width.\n padding (st... |
2f78426e3294b86e62c7c3c33e393c7e880c3b5d7e9c9e2b0b9e5effd813318a | def call(self, x):
"Calculate forward propagation.\n Args:\n x (Tensor): Input tensor (B, T, C).\n Returns:\n Tensor: Output tensor (B, T', C').\n "
x = tf.expand_dims(x, 2)
x = self.conv1d_transpose(x)
x = tf.squeeze(x, 2)
return x | Calculate forward propagation.
Args:
x (Tensor): Input tensor (B, T, C).
Returns:
Tensor: Output tensor (B, T', C'). | models/vocoder.py | call | Z-yq/TensorflowTTS | 50 | python | def call(self, x):
"Calculate forward propagation.\n Args:\n x (Tensor): Input tensor (B, T, C).\n Returns:\n Tensor: Output tensor (B, T', C').\n "
x = tf.expand_dims(x, 2)
x = self.conv1d_transpose(x)
x = tf.squeeze(x, 2)
return x | def call(self, x):
"Calculate forward propagation.\n Args:\n x (Tensor): Input tensor (B, T, C).\n Returns:\n Tensor: Output tensor (B, T', C').\n "
x = tf.expand_dims(x, 2)
x = self.conv1d_transpose(x)
x = tf.squeeze(x, 2)
return x<|docstring|>Calculate fo... |
74fceb30e50580e804dae3aee79796b4460d1feb1db41bc9fb9ddb19d87e68b2 | def __init__(self, kernel_size, filters, dilation_rate, use_bias, nonlinear_activation, nonlinear_activation_params, is_weight_norm, initializer_seed, **kwargs):
'Initialize TFResidualStack module.\n Args:\n kernel_size (int): Kernel size.\n filters (int): Number of filters.\n ... | Initialize TFResidualStack module.
Args:
kernel_size (int): Kernel size.
filters (int): Number of filters.
dilation_rate (int): Dilation rate.
use_bias (bool): Whether to add bias parameter in convolution layers.
nonlinear_activation (str): Activation function module name.
nonlinear_activation_p... | models/vocoder.py | __init__ | Z-yq/TensorflowTTS | 50 | python | def __init__(self, kernel_size, filters, dilation_rate, use_bias, nonlinear_activation, nonlinear_activation_params, is_weight_norm, initializer_seed, **kwargs):
'Initialize TFResidualStack module.\n Args:\n kernel_size (int): Kernel size.\n filters (int): Number of filters.\n ... | def __init__(self, kernel_size, filters, dilation_rate, use_bias, nonlinear_activation, nonlinear_activation_params, is_weight_norm, initializer_seed, **kwargs):
'Initialize TFResidualStack module.\n Args:\n kernel_size (int): Kernel size.\n filters (int): Number of filters.\n ... |
2f0cdfbd573989b4098e69c95b18d98b87f0d0306b9b278286c32df281b4c6b9 | def call(self, x):
'Calculate forward propagation.\n Args:\n x (Tensor): Input tensor (B, T, C).\n Returns:\n Tensor: Output tensor (B, T, C).\n '
_x = tf.identity(x)
for layer in self.blocks:
_x = layer(_x)
shortcut = self.shortcut(x)
return (short... | Calculate forward propagation.
Args:
x (Tensor): Input tensor (B, T, C).
Returns:
Tensor: Output tensor (B, T, C). | models/vocoder.py | call | Z-yq/TensorflowTTS | 50 | python | def call(self, x):
'Calculate forward propagation.\n Args:\n x (Tensor): Input tensor (B, T, C).\n Returns:\n Tensor: Output tensor (B, T, C).\n '
_x = tf.identity(x)
for layer in self.blocks:
_x = layer(_x)
shortcut = self.shortcut(x)
return (short... | def call(self, x):
'Calculate forward propagation.\n Args:\n x (Tensor): Input tensor (B, T, C).\n Returns:\n Tensor: Output tensor (B, T, C).\n '
_x = tf.identity(x)
for layer in self.blocks:
_x = layer(_x)
shortcut = self.shortcut(x)
return (short... |
d0da2c60d96978f7c2dad3d4ff81ea33ae5d6a007e1f929dd3216fe7bb6ff62f | def __init__(self, config, **kwargs):
'Initialize TFMelGANGenerator module.\n Args:\n config: config object of Melgan generator.\n '
super().__init__(**kwargs)
assert (config.filters >= np.prod(config.upsample_scales))
assert ((config.filters % (2 ** len(config.upsample_scales))... | Initialize TFMelGANGenerator module.
Args:
config: config object of Melgan generator. | models/vocoder.py | __init__ | Z-yq/TensorflowTTS | 50 | python | def __init__(self, config, **kwargs):
'Initialize TFMelGANGenerator module.\n Args:\n config: config object of Melgan generator.\n '
super().__init__(**kwargs)
assert (config.filters >= np.prod(config.upsample_scales))
assert ((config.filters % (2 ** len(config.upsample_scales))... | def __init__(self, config, **kwargs):
'Initialize TFMelGANGenerator module.\n Args:\n config: config object of Melgan generator.\n '
super().__init__(**kwargs)
assert (config.filters >= np.prod(config.upsample_scales))
assert ((config.filters % (2 ** len(config.upsample_scales))... |
e3a7259182e338768cf6c5e1a2e8bb8732eb17a4f91884941493a70b7a100c35 | def call(self, c):
'Calculate forward propagation.\n Args:\n c (Tensor): Input tensor (B, T, channels)\n Returns:\n Tensor: Output tensor (B, T ** prod(upsample_scales), out_channels)\n '
x = self.melgan(c)
return x | Calculate forward propagation.
Args:
c (Tensor): Input tensor (B, T, channels)
Returns:
Tensor: Output tensor (B, T ** prod(upsample_scales), out_channels) | models/vocoder.py | call | Z-yq/TensorflowTTS | 50 | python | def call(self, c):
'Calculate forward propagation.\n Args:\n c (Tensor): Input tensor (B, T, channels)\n Returns:\n Tensor: Output tensor (B, T ** prod(upsample_scales), out_channels)\n '
x = self.melgan(c)
return x | def call(self, c):
'Calculate forward propagation.\n Args:\n c (Tensor): Input tensor (B, T, channels)\n Returns:\n Tensor: Output tensor (B, T ** prod(upsample_scales), out_channels)\n '
x = self.melgan(c)
return x<|docstring|>Calculate forward propagation.
Args:
... |
36a1508b4e78dc956475e9d9382c04c17231fcebb859226662049026d1f8fb57 | def _build(self):
'Build model by passing fake input.'
fake_mels = tf.random.uniform(shape=[1, 200, self.config.num_mels], dtype=tf.float32)
self(fake_mels) | Build model by passing fake input. | models/vocoder.py | _build | Z-yq/TensorflowTTS | 50 | python | def _build(self):
fake_mels = tf.random.uniform(shape=[1, 200, self.config.num_mels], dtype=tf.float32)
self(fake_mels) | def _build(self):
fake_mels = tf.random.uniform(shape=[1, 200, self.config.num_mels], dtype=tf.float32)
self(fake_mels)<|docstring|>Build model by passing fake input.<|endoftext|> |
93c53d9b7c0cb009fac236dbc5781c870177e574aff22bf986c9fa0153567939 | def __init__(self, config, **kwargs):
'Initilize MelGAN discriminator module.\n Args:\n out_channels (int): Number of output channels.\n kernel_sizes (list): List of two kernel sizes. The prod will be used for the first conv layer,\n and the first and the second kernel si... | Initilize MelGAN discriminator module.
Args:
out_channels (int): Number of output channels.
kernel_sizes (list): List of two kernel sizes. The prod will be used for the first conv layer,
and the first and the second kernel sizes will be used for the last two layers.
For example if kernel_sizes =... | models/vocoder.py | __init__ | Z-yq/TensorflowTTS | 50 | python | def __init__(self, config, **kwargs):
'Initilize MelGAN discriminator module.\n Args:\n out_channels (int): Number of output channels.\n kernel_sizes (list): List of two kernel sizes. The prod will be used for the first conv layer,\n and the first and the second kernel si... | def __init__(self, config, **kwargs):
'Initilize MelGAN discriminator module.\n Args:\n out_channels (int): Number of output channels.\n kernel_sizes (list): List of two kernel sizes. The prod will be used for the first conv layer,\n and the first and the second kernel si... |
796bc2613de6b78bcd83230888b6f93c5a060f94ab32c1058b5d10ea3294c59d | def call(self, x):
'Calculate forward propagation.\n Args:\n x (Tensor): Input noise signal (B, T, 1).\n Returns:\n List: List of output tensors of each layer.\n '
outs = []
for f in self.disciminator:
x = f(x)
outs += [x]
return outs | Calculate forward propagation.
Args:
x (Tensor): Input noise signal (B, T, 1).
Returns:
List: List of output tensors of each layer. | models/vocoder.py | call | Z-yq/TensorflowTTS | 50 | python | def call(self, x):
'Calculate forward propagation.\n Args:\n x (Tensor): Input noise signal (B, T, 1).\n Returns:\n List: List of output tensors of each layer.\n '
outs = []
for f in self.disciminator:
x = f(x)
outs += [x]
return outs | def call(self, x):
'Calculate forward propagation.\n Args:\n x (Tensor): Input noise signal (B, T, 1).\n Returns:\n List: List of output tensors of each layer.\n '
outs = []
for f in self.disciminator:
x = f(x)
outs += [x]
return outs<|docstring... |
e5cac4a78b385e2092aa71b4757f9954a813ecfff7a3be9124ade776535cc1c2 | def _apply_weightnorm(self, list_layers):
'Try apply weightnorm for all layer in list_layers.'
for i in range(len(list_layers)):
try:
layer_name = list_layers[i].name.lower()
if (('conv1d' in layer_name) or ('dense' in layer_name)):
list_layers[i] = WeightNormaliz... | Try apply weightnorm for all layer in list_layers. | models/vocoder.py | _apply_weightnorm | Z-yq/TensorflowTTS | 50 | python | def _apply_weightnorm(self, list_layers):
for i in range(len(list_layers)):
try:
layer_name = list_layers[i].name.lower()
if (('conv1d' in layer_name) or ('dense' in layer_name)):
list_layers[i] = WeightNormalization(list_layers[i])
except Exception:
... | def _apply_weightnorm(self, list_layers):
for i in range(len(list_layers)):
try:
layer_name = list_layers[i].name.lower()
if (('conv1d' in layer_name) or ('dense' in layer_name)):
list_layers[i] = WeightNormalization(list_layers[i])
except Exception:
... |
373b8e6833fec62ab4abd4a6c617bd7e2c55b36cbcf67a96ddec278ae32d1a05 | def __init__(self, config, **kwargs):
'Initilize MelGAN multi-scale discriminator module.\n Args:\n config: config object for melgan discriminator\n '
super().__init__(**kwargs)
self.discriminator = []
for i in range(config.scales):
self.discriminator += [TFMelGANDiscrim... | Initilize MelGAN multi-scale discriminator module.
Args:
config: config object for melgan discriminator | models/vocoder.py | __init__ | Z-yq/TensorflowTTS | 50 | python | def __init__(self, config, **kwargs):
'Initilize MelGAN multi-scale discriminator module.\n Args:\n config: config object for melgan discriminator\n '
super().__init__(**kwargs)
self.discriminator = []
for i in range(config.scales):
self.discriminator += [TFMelGANDiscrim... | def __init__(self, config, **kwargs):
'Initilize MelGAN multi-scale discriminator module.\n Args:\n config: config object for melgan discriminator\n '
super().__init__(**kwargs)
self.discriminator = []
for i in range(config.scales):
self.discriminator += [TFMelGANDiscrim... |
65ef2866cb628a43624ab4d7c3f626c9a47bc52ed4710d01106a445b24841dd0 | def _build(self):
'Build model by passing fake input.'
fake_mels = tf.random.uniform(shape=[1, 1600, 1], dtype=tf.float32)
self(fake_mels) | Build model by passing fake input. | models/vocoder.py | _build | Z-yq/TensorflowTTS | 50 | python | def _build(self):
fake_mels = tf.random.uniform(shape=[1, 1600, 1], dtype=tf.float32)
self(fake_mels) | def _build(self):
fake_mels = tf.random.uniform(shape=[1, 1600, 1], dtype=tf.float32)
self(fake_mels)<|docstring|>Build model by passing fake input.<|endoftext|> |
74fb52f2007d2435f6d941d67d62a6c43ed2ab9990cfcb55358ff31034966f81 | def call(self, x, **kwargs):
'Calculate forward propagation.\n Args:\n x (Tensor): Input noise signal (B, T, 1).\n Returns:\n List: List of list of each discriminator outputs, which consists of each layer output tensors.\n '
outs = []
for f in self.discriminator:
... | Calculate forward propagation.
Args:
x (Tensor): Input noise signal (B, T, 1).
Returns:
List: List of list of each discriminator outputs, which consists of each layer output tensors. | models/vocoder.py | call | Z-yq/TensorflowTTS | 50 | python | def call(self, x, **kwargs):
'Calculate forward propagation.\n Args:\n x (Tensor): Input noise signal (B, T, 1).\n Returns:\n List: List of list of each discriminator outputs, which consists of each layer output tensors.\n '
outs = []
for f in self.discriminator:
... | def call(self, x, **kwargs):
'Calculate forward propagation.\n Args:\n x (Tensor): Input noise signal (B, T, 1).\n Returns:\n List: List of list of each discriminator outputs, which consists of each layer output tensors.\n '
outs = []
for f in self.discriminator:
... |
09d61b03c772775aef96c65e23e71702efa41355f4bbeb4f101c9ab6f2820646 | def handleGenericPacket(self, event):
'Decode the usbmuxd header.'
muxHeader = Struct.Group(None, Struct.UInt32BE('protocol'), Struct.UInt32BE('length'))
data = muxHeader.decode(event.data)
description = 'iPhone usbmuxd: '
if (muxHeader.length is None):
description += 'ERROR'
else:
... | Decode the usbmuxd header. | VUsbTools/Decoders/iPhone.py | handleGenericPacket | scanlime/vusb-analyzer | 34 | python | def handleGenericPacket(self, event):
muxHeader = Struct.Group(None, Struct.UInt32BE('protocol'), Struct.UInt32BE('length'))
data = muxHeader.decode(event.data)
description = 'iPhone usbmuxd: '
if (muxHeader.length is None):
description += 'ERROR'
else:
self.remainingLength = (m... | def handleGenericPacket(self, event):
muxHeader = Struct.Group(None, Struct.UInt32BE('protocol'), Struct.UInt32BE('length'))
data = muxHeader.decode(event.data)
description = 'iPhone usbmuxd: '
if (muxHeader.length is None):
description += 'ERROR'
else:
self.remainingLength = (m... |
c79b03757304c085c164d9ce29f055d33d868f6ac1da8105fa406811f5b77a98 | def handleTCP(self, event, data, datalen):
'Decode an IPPROTO_TCP packet header, and log the payload.'
datalen -= 20
tcpHeader = Struct.Group(None, Struct.UInt16BEHex('source'), Struct.UInt16BEHex('dest'), Struct.UInt32BE('seq'), Struct.UInt32BE('ack_seq'), Struct.UInt16BEHex('flags'), Struct.UInt16BE('wind... | Decode an IPPROTO_TCP packet header, and log the payload. | VUsbTools/Decoders/iPhone.py | handleTCP | scanlime/vusb-analyzer | 34 | python | def handleTCP(self, event, data, datalen):
datalen -= 20
tcpHeader = Struct.Group(None, Struct.UInt16BEHex('source'), Struct.UInt16BEHex('dest'), Struct.UInt32BE('seq'), Struct.UInt32BE('ack_seq'), Struct.UInt16BEHex('flags'), Struct.UInt16BE('window'), Struct.UInt16BEHex('checksum'), Struct.UInt16BEHex('u... | def handleTCP(self, event, data, datalen):
datalen -= 20
tcpHeader = Struct.Group(None, Struct.UInt16BEHex('source'), Struct.UInt16BEHex('dest'), Struct.UInt32BE('seq'), Struct.UInt32BE('ack_seq'), Struct.UInt16BEHex('flags'), Struct.UInt16BE('window'), Struct.UInt16BEHex('checksum'), Struct.UInt16BEHex('u... |
e13701137a6002151667b7141652ca6e61f96fc2f62ad89c357b4f4df7726e28 | def port_lockdownd(self, event, data, datalen):
'Handle lockdownd packets. These form a stream, which may or\n may not line up with the underlying USB packets. Each\n lockdownd packet is an XML plist, prefixed with a 32-bit\n length.\n '
summary = []
self.lockdownBuff... | Handle lockdownd packets. These form a stream, which may or
may not line up with the underlying USB packets. Each
lockdownd packet is an XML plist, prefixed with a 32-bit
length. | VUsbTools/Decoders/iPhone.py | port_lockdownd | scanlime/vusb-analyzer | 34 | python | def port_lockdownd(self, event, data, datalen):
'Handle lockdownd packets. These form a stream, which may or\n may not line up with the underlying USB packets. Each\n lockdownd packet is an XML plist, prefixed with a 32-bit\n length.\n '
summary = []
self.lockdownBuff... | def port_lockdownd(self, event, data, datalen):
'Handle lockdownd packets. These form a stream, which may or\n may not line up with the underlying USB packets. Each\n lockdownd packet is an XML plist, prefixed with a 32-bit\n length.\n '
summary = []
self.lockdownBuff... |
2fdc6082a405d51e536295ed0d43afb4aba8307410ec0387ea9cf42367548218 | def fetch_n_load_dataset(dataset_url=DATASET_URL, dataset_path=DATASET_PATH):
'\n\t\tFetches and load dataset.\n\n\t\t:param dataset_url: The dataset url\n\t\t:type dataset_url: { The URl of dataset as variable}\n\t\t:param dataset_path: The dataset path\n\t\t:type dataset_path: { PATH d... | Fetches and load dataset.
:param dataset_url: The dataset url
:type dataset_url: { The URl of dataset as variable}
:param dataset_path: The dataset path
:type dataset_path: { PATH details for the dataset as the var}
:returns: The file at a particular file location .
:rtype: { return_... | LinearRegression.py | fetch_n_load_dataset | ausaafnabi/Machine-Learning-Projects | 1 | python | def fetch_n_load_dataset(dataset_url=DATASET_URL, dataset_path=DATASET_PATH):
'\n\t\tFetches and load dataset.\n\n\t\t:param dataset_url: The dataset url\n\t\t:type dataset_url: { The URl of dataset as variable}\n\t\t:param dataset_path: The dataset path\n\t\t:type dataset_path: { PATH d... | def fetch_n_load_dataset(dataset_url=DATASET_URL, dataset_path=DATASET_PATH):
'\n\t\tFetches and load dataset.\n\n\t\t:param dataset_url: The dataset url\n\t\t:type dataset_url: { The URl of dataset as variable}\n\t\t:param dataset_path: The dataset path\n\t\t:type dataset_path: { PATH d... |
71c239b3a0fa008c3442212829368e4c7db9892b2632a4bd9578e5e7bc454029 | def scan_resource_conf(self, conf):
'\n Looks for ViewerProtocolPolicy configuration at cloudfront distributions:\n https://www.terraform.io/docs/providers/aws/r/cloudfront_distribution.html#viewer_protocol_policy\n :param conf: cloudfront configuration\n :return: <CheckResult>\n... | Looks for ViewerProtocolPolicy configuration at cloudfront distributions:
https://www.terraform.io/docs/providers/aws/r/cloudfront_distribution.html#viewer_protocol_policy
:param conf: cloudfront configuration
:return: <CheckResult> | checkov/terraform/checks/resource/aws/CloudfrontDistributionEncryption.py | scan_resource_conf | tophersmith/checkov | 4,013 | python | def scan_resource_conf(self, conf):
'\n Looks for ViewerProtocolPolicy configuration at cloudfront distributions:\n https://www.terraform.io/docs/providers/aws/r/cloudfront_distribution.html#viewer_protocol_policy\n :param conf: cloudfront configuration\n :return: <CheckResult>\n... | def scan_resource_conf(self, conf):
'\n Looks for ViewerProtocolPolicy configuration at cloudfront distributions:\n https://www.terraform.io/docs/providers/aws/r/cloudfront_distribution.html#viewer_protocol_policy\n :param conf: cloudfront configuration\n :return: <CheckResult>\n... |
d676db0ec5935629d8e8b3d14155458bf02ab48b72993550adb7d6fa661539ce | @alias(func_alias='ext', _type='COMMON')
def run():
'\n extension\n\n Lists installed extensions.\n '
loaded_ext = gget('webshell.loaded_ext', namespace='webshell')
print()
if isinstance(loaded_ext, list):
print(color.magenta('Extension ---> \n'))
for line in loaded_ext:
... | extension
Lists installed extensions. | doughnuts/webshell_plugins/extension.py | run | MorouU/Doughnuts | 5 | python | @alias(func_alias='ext', _type='COMMON')
def run():
'\n extension\n\n Lists installed extensions.\n '
loaded_ext = gget('webshell.loaded_ext', namespace='webshell')
print()
if isinstance(loaded_ext, list):
print(color.magenta('Extension ---> \n'))
for line in loaded_ext:
... | @alias(func_alias='ext', _type='COMMON')
def run():
'\n extension\n\n Lists installed extensions.\n '
loaded_ext = gget('webshell.loaded_ext', namespace='webshell')
print()
if isinstance(loaded_ext, list):
print(color.magenta('Extension ---> \n'))
for line in loaded_ext:
... |
611932430ecac333e3cbeef981d8780e2218e7b4647b2e6fdf2550eb5e18f7fc | def chunks(l, n):
'\n Yield successive n-sized chunks from l.\n '
for i in range(0, len(l), n):
(yield l[i:(i + n)]) | Yield successive n-sized chunks from l. | source/training/dataset.py | chunks | Hunter8moon/h8m2 | 0 | python | def chunks(l, n):
'\n \n '
for i in range(0, len(l), n):
(yield l[i:(i + n)]) | def chunks(l, n):
'\n \n '
for i in range(0, len(l), n):
(yield l[i:(i + n)])<|docstring|>Yield successive n-sized chunks from l.<|endoftext|> |
bf8162e9e4531f101e38eb6a9a5896f4eb85f210f85e61ddc69734a9a55c23d8 | def load_batch(self, files, batch_size, augment=True):
'\n Returns an random sample of images of length batch_size from the filenames.\n '
batch_size = min(batch_size, len(files))
files = random.sample(files, batch_size)
w = self.shape[0]
h = self.shape[1]
images = []
for file ... | Returns an random sample of images of length batch_size from the filenames. | source/training/dataset.py | load_batch | Hunter8moon/h8m2 | 0 | python | def load_batch(self, files, batch_size, augment=True):
'\n \n '
batch_size = min(batch_size, len(files))
files = random.sample(files, batch_size)
w = self.shape[0]
h = self.shape[1]
images = []
for file in files:
img = ImageUtil.file_to_array(file, w, h, augment=augment... | def load_batch(self, files, batch_size, augment=True):
'\n \n '
batch_size = min(batch_size, len(files))
files = random.sample(files, batch_size)
w = self.shape[0]
h = self.shape[1]
images = []
for file in files:
img = ImageUtil.file_to_array(file, w, h, augment=augment... |
dd1642c0c8acca829fe85c98273a19fc9844959a698306df3ef168198a4bcb89 | def partition_files(self, batch_size):
'\n Shuffles the files and partitions them into chunks of length batch_size.\n Returns a list of pairs (a_files, b_files).\n '
random.shuffle(self.files_trainA)
random.shuffle(self.files_trainB)
a_files = chunks(self.files_trainA, batch_size)
... | Shuffles the files and partitions them into chunks of length batch_size.
Returns a list of pairs (a_files, b_files). | source/training/dataset.py | partition_files | Hunter8moon/h8m2 | 0 | python | def partition_files(self, batch_size):
'\n Shuffles the files and partitions them into chunks of length batch_size.\n Returns a list of pairs (a_files, b_files).\n '
random.shuffle(self.files_trainA)
random.shuffle(self.files_trainB)
a_files = chunks(self.files_trainA, batch_size)
... | def partition_files(self, batch_size):
'\n Shuffles the files and partitions them into chunks of length batch_size.\n Returns a list of pairs (a_files, b_files).\n '
random.shuffle(self.files_trainA)
random.shuffle(self.files_trainB)
a_files = chunks(self.files_trainA, batch_size)
... |
7ef05c291c9cf26464156a485d25990005dfdaf27b51cece4387f15b37d3ff74 | def get_ordering(self, request):
'\n Returns a sequence defining the default ordering for results in the\n list view.\n '
if (not self.ordering):
return (self.sort_order_field,)
elif (self.sort_order_field not in self.ordering):
return ((self.sort_order_field,) + tuple(s... | Returns a sequence defining the default ordering for results in the
list view. | wagtailorderable/modeladmin/mixins.py | get_ordering | kausaltech/wagtail-orderable | 0 | python | def get_ordering(self, request):
'\n Returns a sequence defining the default ordering for results in the\n list view.\n '
if (not self.ordering):
return (self.sort_order_field,)
elif (self.sort_order_field not in self.ordering):
return ((self.sort_order_field,) + tuple(s... | def get_ordering(self, request):
'\n Returns a sequence defining the default ordering for results in the\n list view.\n '
if (not self.ordering):
return (self.sort_order_field,)
elif (self.sort_order_field not in self.ordering):
return ((self.sort_order_field,) + tuple(s... |
f60aa2f14d5870303f02b9c3cebef139946093a0e6b8d1eac0ea67f212031a1e | def get_list_display(self, request):
'Add `index_order` as the first column to results'
list_display = list(super().get_list_display(request))
if (self.sort_order_field in list_display):
list_display.remove(self.sort_order_field)
return ('index_order', *list_display) | Add `index_order` as the first column to results | wagtailorderable/modeladmin/mixins.py | get_list_display | kausaltech/wagtail-orderable | 0 | python | def get_list_display(self, request):
list_display = list(super().get_list_display(request))
if (self.sort_order_field in list_display):
list_display.remove(self.sort_order_field)
return ('index_order', *list_display) | def get_list_display(self, request):
list_display = list(super().get_list_display(request))
if (self.sort_order_field in list_display):
list_display.remove(self.sort_order_field)
return ('index_order', *list_display)<|docstring|>Add `index_order` as the first column to results<|endoftext|> |
cd3279f0fbe6e8bb0cb93d283f8beb6901df5bb178a90097e2cdcdc05d5e4ff5 | def get_list_display_add_buttons(self, request):
"\n If `list_display_add_buttons` isn't set, ensure the buttons are not\n added to the `index_order` column.\n "
col_field_name = super(OrderableMixin, self).get_list_display_add_buttons(request)
if (col_field_name == 'index_order'):
... | If `list_display_add_buttons` isn't set, ensure the buttons are not
added to the `index_order` column. | wagtailorderable/modeladmin/mixins.py | get_list_display_add_buttons | kausaltech/wagtail-orderable | 0 | python | def get_list_display_add_buttons(self, request):
"\n If `list_display_add_buttons` isn't set, ensure the buttons are not\n added to the `index_order` column.\n "
col_field_name = super(OrderableMixin, self).get_list_display_add_buttons(request)
if (col_field_name == 'index_order'):
... | def get_list_display_add_buttons(self, request):
"\n If `list_display_add_buttons` isn't set, ensure the buttons are not\n added to the `index_order` column.\n "
col_field_name = super(OrderableMixin, self).get_list_display_add_buttons(request)
if (col_field_name == 'index_order'):
... |
be630a51176d170e7127fa8000c716e8002f0e79865fea3a117fe4d91b0f6a80 | def get_extra_attrs_for_field_col(self, obj, field_name):
'\n Add data attributes to the `index_order` column that can be picked\n up via JS. The width attribute helps the column remain at a fixed size\n while dragging and the title is used for generating a success message\n on completio... | Add data attributes to the `index_order` column that can be picked
up via JS. The width attribute helps the column remain at a fixed size
while dragging and the title is used for generating a success message
on completion reorder completion. | wagtailorderable/modeladmin/mixins.py | get_extra_attrs_for_field_col | kausaltech/wagtail-orderable | 0 | python | def get_extra_attrs_for_field_col(self, obj, field_name):
'\n Add data attributes to the `index_order` column that can be picked\n up via JS. The width attribute helps the column remain at a fixed size\n while dragging and the title is used for generating a success message\n on completio... | def get_extra_attrs_for_field_col(self, obj, field_name):
'\n Add data attributes to the `index_order` column that can be picked\n up via JS. The width attribute helps the column remain at a fixed size\n while dragging and the title is used for generating a success message\n on completio... |
3d53ef704ef4cd928d84476226e234b9527ee30517493130538af82ee17bcb67 | def get_extra_class_names_for_field_col(self, obj, field_name):
'\n Add the `visible-on-drag` class to certain columns\n '
classnames = super(OrderableMixin, self).get_extra_class_names_for_field_col(obj, field_name)
if (field_name in ('index_order', self.list_display[0], 'admin_thumb', (self.... | Add the `visible-on-drag` class to certain columns | wagtailorderable/modeladmin/mixins.py | get_extra_class_names_for_field_col | kausaltech/wagtail-orderable | 0 | python | def get_extra_class_names_for_field_col(self, obj, field_name):
'\n \n '
classnames = super(OrderableMixin, self).get_extra_class_names_for_field_col(obj, field_name)
if (field_name in ('index_order', self.list_display[0], 'admin_thumb', (self.list_display_add_buttons or ))):
classname... | def get_extra_class_names_for_field_col(self, obj, field_name):
'\n \n '
classnames = super(OrderableMixin, self).get_extra_class_names_for_field_col(obj, field_name)
if (field_name in ('index_order', self.list_display[0], 'admin_thumb', (self.list_display_add_buttons or ))):
classname... |
87045f84fcd43c0393c65fd76954d0b1639d58042f9b012300790b747c804571 | @transaction.atomic
def reorder_view(self, request, instance_pk):
'\n Very simple view functionality for updating the `sort_order` values\n for objects after a row has been dragged to a new position.\n '
self.fix_duplicate_positions(request)
obj_to_move = get_object_or_404(self.model, p... | Very simple view functionality for updating the `sort_order` values
for objects after a row has been dragged to a new position. | wagtailorderable/modeladmin/mixins.py | reorder_view | kausaltech/wagtail-orderable | 0 | python | @transaction.atomic
def reorder_view(self, request, instance_pk):
'\n Very simple view functionality for updating the `sort_order` values\n for objects after a row has been dragged to a new position.\n '
self.fix_duplicate_positions(request)
obj_to_move = get_object_or_404(self.model, p... | @transaction.atomic
def reorder_view(self, request, instance_pk):
'\n Very simple view functionality for updating the `sort_order` values\n for objects after a row has been dragged to a new position.\n '
self.fix_duplicate_positions(request)
obj_to_move = get_object_or_404(self.model, p... |
32124167380a0274196e726465aca24171406c576fb601137f24bdcd20aba070 | @transaction.atomic
def fix_duplicate_positions(self, request):
'\n Low level function which updates each element to have sequential sort_order values\n if the database contains any duplicate values (gaps are ok).\n '
qs = self.get_filtered_queryset(request)
first_duplicate = qs.values(... | Low level function which updates each element to have sequential sort_order values
if the database contains any duplicate values (gaps are ok). | wagtailorderable/modeladmin/mixins.py | fix_duplicate_positions | kausaltech/wagtail-orderable | 0 | python | @transaction.atomic
def fix_duplicate_positions(self, request):
'\n Low level function which updates each element to have sequential sort_order values\n if the database contains any duplicate values (gaps are ok).\n '
qs = self.get_filtered_queryset(request)
first_duplicate = qs.values(... | @transaction.atomic
def fix_duplicate_positions(self, request):
'\n Low level function which updates each element to have sequential sort_order values\n if the database contains any duplicate values (gaps are ok).\n '
qs = self.get_filtered_queryset(request)
first_duplicate = qs.values(... |
87472880a7e61a1e0112d4ab35f38e1747e1a82abeaded2240ff5b8703d3b67b | def index_order(self, obj):
'Content for the `index_order` column'
return mark_safe(('<div class="handle icon icon-grip text-replace ui-sortable-handle">%s</div>' % _('Drag'))) | Content for the `index_order` column | wagtailorderable/modeladmin/mixins.py | index_order | kausaltech/wagtail-orderable | 0 | python | def index_order(self, obj):
return mark_safe(('<div class="handle icon icon-grip text-replace ui-sortable-handle">%s</div>' % _('Drag'))) | def index_order(self, obj):
return mark_safe(('<div class="handle icon icon-grip text-replace ui-sortable-handle">%s</div>' % _('Drag')))<|docstring|>Content for the `index_order` column<|endoftext|> |
c3c719bfcf41952c12ef412bcc154150c851d82eb6408e6ff70e4c7e63224b2e | def all_but(candidates: List[int], *used: int) -> List[int]:
'Return items in candidates that are not in used.'
leftovers = set(candidates).difference(used)
if (not leftovers):
raise NoChoices()
return [c for c in candidates if (c in leftovers)] | Return items in candidates that are not in used. | python/kenken.py | all_but | drewcsillag/chooser | 0 | python | def all_but(candidates: List[int], *used: int) -> List[int]:
leftovers = set(candidates).difference(used)
if (not leftovers):
raise NoChoices()
return [c for c in candidates if (c in leftovers)] | def all_but(candidates: List[int], *used: int) -> List[int]:
leftovers = set(candidates).difference(used)
if (not leftovers):
raise NoChoices()
return [c for c in candidates if (c in leftovers)]<|docstring|>Return items in candidates that are not in used.<|endoftext|> |
15daa36e98dab129c93cc27b806209c5a29a58eb75b5c6d2ed58346031a0c078 | def add_choice(row: List[int], c: Chooser, *used: int) -> None:
'Choose a item from [1-4] excluding ones that have been used already)\n and append it to row.'
row.append(c.choose(all_but(ONE_TO_FOUR, *used))) | Choose a item from [1-4] excluding ones that have been used already)
and append it to row. | python/kenken.py | add_choice | drewcsillag/chooser | 0 | python | def add_choice(row: List[int], c: Chooser, *used: int) -> None:
'Choose a item from [1-4] excluding ones that have been used already)\n and append it to row.'
row.append(c.choose(all_but(ONE_TO_FOUR, *used))) | def add_choice(row: List[int], c: Chooser, *used: int) -> None:
'Choose a item from [1-4] excluding ones that have been used already)\n and append it to row.'
row.append(c.choose(all_but(ONE_TO_FOUR, *used)))<|docstring|>Choose a item from [1-4] excluding ones that have been used already)
and append it to ro... |
825292fa4c7072257a4bcdb38f5a6af04f9184bd0e94b33f63043ca2e52883c5 | @property
def pty(self):
' The :class:`deployer.pseudo_terminal.Pty` of this console. '
return self._pty | The :class:`deployer.pseudo_terminal.Pty` of this console. | deployer/console.py | pty | nikhilrane1992/python-deployer | 39 | python | @property
def pty(self):
' '
return self._pty | @property
def pty(self):
' '
return self._pty<|docstring|>The :class:`deployer.pseudo_terminal.Pty` of this console.<|endoftext|> |
3e7c85b96180ff205ef07f100e246966cdfbe728eaabde5fae6bcd09e67fbcc2 | @property
def is_interactive(self):
"\n When ``False`` don't ask for input and choose the default options when\n possible.\n "
return self._pty.interactive | When ``False`` don't ask for input and choose the default options when
possible. | deployer/console.py | is_interactive | nikhilrane1992/python-deployer | 39 | python | @property
def is_interactive(self):
"\n When ``False`` don't ask for input and choose the default options when\n possible.\n "
return self._pty.interactive | @property
def is_interactive(self):
"\n When ``False`` don't ask for input and choose the default options when\n possible.\n "
return self._pty.interactive<|docstring|>When ``False`` don't ask for input and choose the default options when
possible.<|endoftext|> |
9f6fd69d410f74fe6b7b5a201144b47d929c7f2490b7bcb3ec97e2cec464882f | def input(self, label, is_password=False, answers=None, default=None):
'\n Ask for plain text input. (Similar to raw_input.)\n\n :param is_password: Show stars instead of the actual user input.\n :type is_password: bool\n :param answers: A list of the accepted answers or None.\n :... | Ask for plain text input. (Similar to raw_input.)
:param is_password: Show stars instead of the actual user input.
:type is_password: bool
:param answers: A list of the accepted answers or None.
:param default: Default answer. | deployer/console.py | input | nikhilrane1992/python-deployer | 39 | python | def input(self, label, is_password=False, answers=None, default=None):
'\n Ask for plain text input. (Similar to raw_input.)\n\n :param is_password: Show stars instead of the actual user input.\n :type is_password: bool\n :param answers: A list of the accepted answers or None.\n :... | def input(self, label, is_password=False, answers=None, default=None):
'\n Ask for plain text input. (Similar to raw_input.)\n\n :param is_password: Show stars instead of the actual user input.\n :type is_password: bool\n :param answers: A list of the accepted answers or None.\n :... |
3e39be3ee0f8a5891931c0466de0859bc625fe58e062de5d24926ee9d04b988d | def choice(self, question, options, allow_random=False, default=None):
"\n :param options: List of (name, value) tuples.\n :type options: list\n :param allow_random: If ``True``, the default option becomes 'choose random'.\n :type allow_random: bool\n "
if (len(options) == 0):... | :param options: List of (name, value) tuples.
:type options: list
:param allow_random: If ``True``, the default option becomes 'choose random'.
:type allow_random: bool | deployer/console.py | choice | nikhilrane1992/python-deployer | 39 | python | def choice(self, question, options, allow_random=False, default=None):
"\n :param options: List of (name, value) tuples.\n :type options: list\n :param allow_random: If ``True``, the default option becomes 'choose random'.\n :type allow_random: bool\n "
if (len(options) == 0):... | def choice(self, question, options, allow_random=False, default=None):
"\n :param options: List of (name, value) tuples.\n :type options: list\n :param allow_random: If ``True``, the default option becomes 'choose random'.\n :type allow_random: bool\n "
if (len(options) == 0):... |
01fc1ca29f05a0ddc100c5f15513d0f16883f19e866d53c6e9439cca6e8fff1f | def confirm(self, question, default=None):
"\n Print this yes/no question, and return ``True`` when the user answers\n 'Yes'.\n "
answer = 'invalid'
if (default is not None):
assert isinstance(default, bool)
default = ('y' if default else 'n')
while (answer not in ('... | Print this yes/no question, and return ``True`` when the user answers
'Yes'. | deployer/console.py | confirm | nikhilrane1992/python-deployer | 39 | python | def confirm(self, question, default=None):
"\n Print this yes/no question, and return ``True`` when the user answers\n 'Yes'.\n "
answer = 'invalid'
if (default is not None):
assert isinstance(default, bool)
default = ('y' if default else 'n')
while (answer not in ('... | def confirm(self, question, default=None):
"\n Print this yes/no question, and return ``True`` when the user answers\n 'Yes'.\n "
answer = 'invalid'
if (default is not None):
assert isinstance(default, bool)
default = ('y' if default else 'n')
while (answer not in ('... |
ca954a558acfd423e00b1696c31fbd22bbaf29d3308509f79026e8fa118489cb | def select_node(self, root_node, prompt='Select a node', filter=None):
'\n Show autocompletion for node selection.\n '
from deployer.cli import ExitCLILoop, Handler, HandlerType, CLInterface
class NodeHandler(Handler):
def __init__(self, node):
self.node = node
@... | Show autocompletion for node selection. | deployer/console.py | select_node | nikhilrane1992/python-deployer | 39 | python | def select_node(self, root_node, prompt='Select a node', filter=None):
'\n \n '
from deployer.cli import ExitCLILoop, Handler, HandlerType, CLInterface
class NodeHandler(Handler):
def __init__(self, node):
self.node = node
@property
def is_leaf(self):
... | def select_node(self, root_node, prompt='Select a node', filter=None):
'\n \n '
from deployer.cli import ExitCLILoop, Handler, HandlerType, CLInterface
class NodeHandler(Handler):
def __init__(self, node):
self.node = node
@property
def is_leaf(self):
... |
8928c003a1d65781f01e9e331487ae67ef66fe41ae46b2f9921cbccbe0614a85 | def select_node_isolation(self, node):
'\n Ask for a host, from a list of hosts.\n '
from deployer.inspection import Inspector
from deployer.node import IsolationIdentifierType
options = [(' '.join([('%s (%s)' % (h.slug, h.address)) for h in hosts]), node) for (hosts, node) in Inspector(no... | Ask for a host, from a list of hosts. | deployer/console.py | select_node_isolation | nikhilrane1992/python-deployer | 39 | python | def select_node_isolation(self, node):
'\n \n '
from deployer.inspection import Inspector
from deployer.node import IsolationIdentifierType
options = [(' '.join([('%s (%s)' % (h.slug, h.address)) for h in hosts]), node) for (hosts, node) in Inspector(node).iter_isolations(identifier_type=I... | def select_node_isolation(self, node):
'\n \n '
from deployer.inspection import Inspector
from deployer.node import IsolationIdentifierType
options = [(' '.join([('%s (%s)' % (h.slug, h.address)) for h in hosts]), node) for (hosts, node) in Inspector(node).iter_isolations(identifier_type=I... |
1e93e074e41c5dc34362293bdca960f2076c55dad5bbcfd695d6cd1e5a59062e | def lesspipe(self, line_iterator):
'\n Paginator for output. This will print one page at a time. When the user\n presses a key, the next page is printed. ``Ctrl-c`` or ``q`` will quit\n the paginator.\n\n :param line_iterator: A generator function that yields lines (without\n ... | Paginator for output. This will print one page at a time. When the user
presses a key, the next page is printed. ``Ctrl-c`` or ``q`` will quit
the paginator.
:param line_iterator: A generator function that yields lines (without
trailing newline) | deployer/console.py | lesspipe | nikhilrane1992/python-deployer | 39 | python | def lesspipe(self, line_iterator):
'\n Paginator for output. This will print one page at a time. When the user\n presses a key, the next page is printed. ``Ctrl-c`` or ``q`` will quit\n the paginator.\n\n :param line_iterator: A generator function that yields lines (without\n ... | def lesspipe(self, line_iterator):
'\n Paginator for output. This will print one page at a time. When the user\n presses a key, the next page is printed. ``Ctrl-c`` or ``q`` will quit\n the paginator.\n\n :param line_iterator: A generator function that yields lines (without\n ... |
280e9e879f72a7c102957e2e608cd32b9fd0bf96ee0e8da30f82c082bf48f08c | def in_columns(self, item_iterator, margin_left=0):
'\n :param item_iterator: An iterable, which yields either ``basestring``\n instances, or (colored_item, length) tuples.\n '
def get_length(item):
return (len(item) if isinstance(item, basestring) else item[1... | :param item_iterator: An iterable, which yields either ``basestring``
instances, or (colored_item, length) tuples. | deployer/console.py | in_columns | nikhilrane1992/python-deployer | 39 | python | def in_columns(self, item_iterator, margin_left=0):
'\n :param item_iterator: An iterable, which yields either ``basestring``\n instances, or (colored_item, length) tuples.\n '
def get_length(item):
return (len(item) if isinstance(item, basestring) else item[1... | def in_columns(self, item_iterator, margin_left=0):
'\n :param item_iterator: An iterable, which yields either ``basestring``\n instances, or (colored_item, length) tuples.\n '
def get_length(item):
return (len(item) if isinstance(item, basestring) else item[1... |
e1db62528c18a7a7e767181bcf3500ed9fcc92415e5884afcd9ebb42541160ca | def warning(self, text):
'\n Print a warning.\n '
stdout = self._pty.stdout
stdout.write(colored('*** ', 'yellow'))
stdout.write(colored('WARNING: ', 'red'))
stdout.write(colored(text, 'red', attrs=['bold']))
stdout.write(colored(' ***\n', 'yellow'))
stdout.flush() | Print a warning. | deployer/console.py | warning | nikhilrane1992/python-deployer | 39 | python | def warning(self, text):
'\n \n '
stdout = self._pty.stdout
stdout.write(colored('*** ', 'yellow'))
stdout.write(colored('WARNING: ', 'red'))
stdout.write(colored(text, 'red', attrs=['bold']))
stdout.write(colored(' ***\n', 'yellow'))
stdout.flush() | def warning(self, text):
'\n \n '
stdout = self._pty.stdout
stdout.write(colored('*** ', 'yellow'))
stdout.write(colored('WARNING: ', 'red'))
stdout.write(colored(text, 'red', attrs=['bold']))
stdout.write(colored(' ***\n', 'yellow'))
stdout.flush()<|docstring|>Print a warning.... |
32611680ae64bc631b77e4a1ee5e8c3b1d7f32b3b54fb8526c55e927b52dc197 | def progress_bar(self, message, expected=None, clear_on_finish=False, format_str=None):
"\n Display a progress bar. This returns a Python context manager.\n Call the next() method to increase the counter.\n\n ::\n\n with console.progress_bar('Looking for nodes') as p:\n ... | Display a progress bar. This returns a Python context manager.
Call the next() method to increase the counter.
::
with console.progress_bar('Looking for nodes') as p:
for i in range(0, 1000):
p.next()
...
:returns: :class:`ProgressBar` instance.
:param message: Text label of the p... | deployer/console.py | progress_bar | nikhilrane1992/python-deployer | 39 | python | def progress_bar(self, message, expected=None, clear_on_finish=False, format_str=None):
"\n Display a progress bar. This returns a Python context manager.\n Call the next() method to increase the counter.\n\n ::\n\n with console.progress_bar('Looking for nodes') as p:\n ... | def progress_bar(self, message, expected=None, clear_on_finish=False, format_str=None):
"\n Display a progress bar. This returns a Python context manager.\n Call the next() method to increase the counter.\n\n ::\n\n with console.progress_bar('Looking for nodes') as p:\n ... |
943021c75eadd70864d0b13009f8b8015d9776aeb396174c405bae47a8933a7f | def progress_bar_with_steps(self, message, steps, format_str=None):
'\n Display a progress bar with steps.\n\n ::\n\n steps = ProgressBarSteps({\n 1: "Resolving address",\n 2: "Create transport",\n 3: "Get remote key",\n 4: "Authen... | Display a progress bar with steps.
::
steps = ProgressBarSteps({
1: "Resolving address",
2: "Create transport",
3: "Get remote key",
4: "Authenticating" })
with console.progress_bar_with_steps('Connecting to SSH server', steps=steps) as p:
...
p.set_progress(1)... | deployer/console.py | progress_bar_with_steps | nikhilrane1992/python-deployer | 39 | python | def progress_bar_with_steps(self, message, steps, format_str=None):
'\n Display a progress bar with steps.\n\n ::\n\n steps = ProgressBarSteps({\n 1: "Resolving address",\n 2: "Create transport",\n 3: "Get remote key",\n 4: "Authen... | def progress_bar_with_steps(self, message, steps, format_str=None):
'\n Display a progress bar with steps.\n\n ::\n\n steps = ProgressBarSteps({\n 1: "Resolving address",\n 2: "Create transport",\n 3: "Get remote key",\n 4: "Authen... |
9578c27d84ffa11e5ef3de644431c9888ac4f8afa2f80bf2f73d059a96eedab1 | def next(self):
'\n Increment progress bar counter.\n '
self.set_progress((self.counter + 1), rewrite=False) | Increment progress bar counter. | deployer/console.py | next | nikhilrane1992/python-deployer | 39 | python | def next(self):
'\n \n '
self.set_progress((self.counter + 1), rewrite=False) | def next(self):
'\n \n '
self.set_progress((self.counter + 1), rewrite=False)<|docstring|>Increment progress bar counter.<|endoftext|> |
613234cfbdd1208273432f608763be8c839fb79c307838675be4fc965864d18b | def set_progress(self, value, rewrite=True):
'\n Set counter to this value.\n\n :param rewrite: Always redraw the progress bar.\n :type rewrite: bool\n '
self.counter = value
delta = (((datetime.now() - self._last_print).microseconds / 1000) / 1000.0)
if (rewrite or (delta > ... | Set counter to this value.
:param rewrite: Always redraw the progress bar.
:type rewrite: bool | deployer/console.py | set_progress | nikhilrane1992/python-deployer | 39 | python | def set_progress(self, value, rewrite=True):
'\n Set counter to this value.\n\n :param rewrite: Always redraw the progress bar.\n :type rewrite: bool\n '
self.counter = value
delta = (((datetime.now() - self._last_print).microseconds / 1000) / 1000.0)
if (rewrite or (delta > ... | def set_progress(self, value, rewrite=True):
'\n Set counter to this value.\n\n :param rewrite: Always redraw the progress bar.\n :type rewrite: bool\n '
self.counter = value
delta = (((datetime.now() - self._last_print).microseconds / 1000) / 1000.0)
if (rewrite or (delta > ... |
cbf462601754f46041265c3833c14a8a823b6f5cb8d3f4af609875f2a02fa2fe | @expectedFlakeyLinux('llvm.org/pr19310')
@expectedFailureFreeBSD('llvm.org/pr19310')
@skipIfRemote
@dwarf_test
def test_attach_continue_interrupt_detach(self):
'Test attach/continue/interrupt/detach'
self.buildDwarf()
self.process_attach_continue_interrupt_detach() | Test attach/continue/interrupt/detach | 3.7.0/lldb-3.7.0.src/test/functionalities/attach_resume/TestAttachResume.py | test_attach_continue_interrupt_detach | androm3da/clang_sles | 3 | python | @expectedFlakeyLinux('llvm.org/pr19310')
@expectedFailureFreeBSD('llvm.org/pr19310')
@skipIfRemote
@dwarf_test
def test_attach_continue_interrupt_detach(self):
self.buildDwarf()
self.process_attach_continue_interrupt_detach() | @expectedFlakeyLinux('llvm.org/pr19310')
@expectedFailureFreeBSD('llvm.org/pr19310')
@skipIfRemote
@dwarf_test
def test_attach_continue_interrupt_detach(self):
self.buildDwarf()
self.process_attach_continue_interrupt_detach()<|docstring|>Test attach/continue/interrupt/detach<|endoftext|> |
e4f25eb652f4257762914a4034286d0027966d707074ac20d6e668a8613dee26 | @expectedFlakeyLinux('llvm.org/pr19478')
@skipIfRemote
def process_attach_continue_interrupt_detach(self):
'Test attach/continue/interrupt/detach'
exe = os.path.join(os.getcwd(), exe_name)
popen = self.spawnSubprocess(exe)
self.addTearDownHook(self.cleanupSubprocesses)
self.runCmd(('process attach -... | Test attach/continue/interrupt/detach | 3.7.0/lldb-3.7.0.src/test/functionalities/attach_resume/TestAttachResume.py | process_attach_continue_interrupt_detach | androm3da/clang_sles | 3 | python | @expectedFlakeyLinux('llvm.org/pr19478')
@skipIfRemote
def process_attach_continue_interrupt_detach(self):
exe = os.path.join(os.getcwd(), exe_name)
popen = self.spawnSubprocess(exe)
self.addTearDownHook(self.cleanupSubprocesses)
self.runCmd(('process attach -p ' + str(popen.pid)))
self._state ... | @expectedFlakeyLinux('llvm.org/pr19478')
@skipIfRemote
def process_attach_continue_interrupt_detach(self):
exe = os.path.join(os.getcwd(), exe_name)
popen = self.spawnSubprocess(exe)
self.addTearDownHook(self.cleanupSubprocesses)
self.runCmd(('process attach -p ' + str(popen.pid)))
self._state ... |
eda25b0741b257ef1b45142f7211967bc15f2f3fe5134e6577cf5d0fdfce4908 | def read(*paths):
'Build a file path from *paths* and return the contents.'
with open(os.path.join(*paths), 'r') as f:
return f.read() | Build a file path from *paths* and return the contents. | setup.py | read | tmr232/rage | 0 | python | def read(*paths):
with open(os.path.join(*paths), 'r') as f:
return f.read() | def read(*paths):
with open(os.path.join(*paths), 'r') as f:
return f.read()<|docstring|>Build a file path from *paths* and return the contents.<|endoftext|> |
5de948b68a571a37544dca591707dca99e050882fca83d7484a26f31e4a1a975 | def format_eval_input_for_neg(user_item_dict, neg_user_list):
'Eval input data for negative samples'
user_list = []
item_list = []
label_list = []
for user_id in neg_user_list:
cur_item_list = user_item_dict[user_id]
l_cur_item_list = len(cur_item_list)
for i in range(l_cur_i... | Eval input data for negative samples | papers/DiffNet++/eval.py | format_eval_input_for_neg | mindspore-ai/contrib | 2 | python | def format_eval_input_for_neg(user_item_dict, neg_user_list):
user_list = []
item_list = []
label_list = []
for user_id in neg_user_list:
cur_item_list = user_item_dict[user_id]
l_cur_item_list = len(cur_item_list)
for i in range(l_cur_item_list):
user_list.appen... | def format_eval_input_for_neg(user_item_dict, neg_user_list):
user_list = []
item_list = []
label_list = []
for user_id in neg_user_list:
cur_item_list = user_item_dict[user_id]
l_cur_item_list = len(cur_item_list)
for i in range(l_cur_item_list):
user_list.appen... |
c646d2caf41ea9c2a68d742face4917597ef455f3c37bae008a6254d06bfef7f | def get_hr_ndcg(index_dict, pos_prediction_input, neg_prediction_input, topk):
'Get Hit HR and NDCG results'
hr_list = []
ndcg_list = []
for idx in range(len(eval_user_list)):
user = eval_user_list[idx]
cur_user_pos_prediction = pos_prediction_input.asnumpy()[index_dict[user]]
cu... | Get Hit HR and NDCG results | papers/DiffNet++/eval.py | get_hr_ndcg | mindspore-ai/contrib | 2 | python | def get_hr_ndcg(index_dict, pos_prediction_input, neg_prediction_input, topk):
hr_list = []
ndcg_list = []
for idx in range(len(eval_user_list)):
user = eval_user_list[idx]
cur_user_pos_prediction = pos_prediction_input.asnumpy()[index_dict[user]]
cur_user_neg_prediction = neg_p... | def get_hr_ndcg(index_dict, pos_prediction_input, neg_prediction_input, topk):
hr_list = []
ndcg_list = []
for idx in range(len(eval_user_list)):
user = eval_user_list[idx]
cur_user_pos_prediction = pos_prediction_input.asnumpy()[index_dict[user]]
cur_user_neg_prediction = neg_p... |
e963a051f138f5219d02a94742eeecc77525a3d4c58334ac7436133a4d586c1e | def __init__(self, env: gym.Env, env_info: ConfigDict, hyper_params: ConfigDict, learner_cfg: ConfigDict, log_cfg: ConfigDict, is_test: bool, load_from: str, is_render: bool, render_after: int, is_log: bool, save_period: int, episode_num: int, max_episode_steps: int, interim_test_num: int):
'Initialize.'
Agent.... | Initialize. | rl_algorithms/sac/agent.py | __init__ | medipixel/rl_algorithms | 466 | python | def __init__(self, env: gym.Env, env_info: ConfigDict, hyper_params: ConfigDict, learner_cfg: ConfigDict, log_cfg: ConfigDict, is_test: bool, load_from: str, is_render: bool, render_after: int, is_log: bool, save_period: int, episode_num: int, max_episode_steps: int, interim_test_num: int):
Agent.__init__(self... | def __init__(self, env: gym.Env, env_info: ConfigDict, hyper_params: ConfigDict, learner_cfg: ConfigDict, log_cfg: ConfigDict, is_test: bool, load_from: str, is_render: bool, render_after: int, is_log: bool, save_period: int, episode_num: int, max_episode_steps: int, interim_test_num: int):
Agent.__init__(self... |
96b8933dc2cd7e948a0ae77577341fd71d199feccfafc74f4e5787af76bc454d | def _initialize(self):
'Initialize non-common things.'
if (not self.is_test):
self.memory = ReplayBuffer(self.hyper_params.buffer_size, self.hyper_params.batch_size)
build_args = dict(hyper_params=self.hyper_params, log_cfg=self.log_cfg, env_name=self.env_info.name, state_size=self.env_info.observat... | Initialize non-common things. | rl_algorithms/sac/agent.py | _initialize | medipixel/rl_algorithms | 466 | python | def _initialize(self):
if (not self.is_test):
self.memory = ReplayBuffer(self.hyper_params.buffer_size, self.hyper_params.batch_size)
build_args = dict(hyper_params=self.hyper_params, log_cfg=self.log_cfg, env_name=self.env_info.name, state_size=self.env_info.observation_space.shape, output_size=se... | def _initialize(self):
if (not self.is_test):
self.memory = ReplayBuffer(self.hyper_params.buffer_size, self.hyper_params.batch_size)
build_args = dict(hyper_params=self.hyper_params, log_cfg=self.log_cfg, env_name=self.env_info.name, state_size=self.env_info.observation_space.shape, output_size=se... |
456f6b36428f25a3f20c97051c0af04a6c4a1bad7f56b00d11b07c64a68ed675 | def select_action(self, state: np.ndarray) -> np.ndarray:
'Select an action from the input space.'
self.curr_state = state
state = self._preprocess_state(state)
if ((self.total_step < self.hyper_params.initial_random_action) and (not self.is_test)):
return np.array(self.env.action_space.sample()... | Select an action from the input space. | rl_algorithms/sac/agent.py | select_action | medipixel/rl_algorithms | 466 | python | def select_action(self, state: np.ndarray) -> np.ndarray:
self.curr_state = state
state = self._preprocess_state(state)
if ((self.total_step < self.hyper_params.initial_random_action) and (not self.is_test)):
return np.array(self.env.action_space.sample())
with torch.no_grad():
if s... | def select_action(self, state: np.ndarray) -> np.ndarray:
self.curr_state = state
state = self._preprocess_state(state)
if ((self.total_step < self.hyper_params.initial_random_action) and (not self.is_test)):
return np.array(self.env.action_space.sample())
with torch.no_grad():
if s... |
5352d92f1a55278bfb3cacd123e57e84c1b7c688ceb4592c8d7d56726842d5f6 | def _preprocess_state(self, state: np.ndarray) -> torch.Tensor:
'Preprocess state so that actor selects an action.'
state = numpy2floattensor(state, self.learner.device)
return state | Preprocess state so that actor selects an action. | rl_algorithms/sac/agent.py | _preprocess_state | medipixel/rl_algorithms | 466 | python | def _preprocess_state(self, state: np.ndarray) -> torch.Tensor:
state = numpy2floattensor(state, self.learner.device)
return state | def _preprocess_state(self, state: np.ndarray) -> torch.Tensor:
state = numpy2floattensor(state, self.learner.device)
return state<|docstring|>Preprocess state so that actor selects an action.<|endoftext|> |
2d51bf532ab79d8a5dfebc39f654c4ee249c974ad2cc9f2aadd53cddb88c9118 | def step(self, action: np.ndarray) -> Tuple[(np.ndarray, np.float64, bool, dict)]:
'Take an action and return the response of the env.'
(next_state, reward, done, info) = self.env.step(action)
if (not self.is_test):
done_bool = (False if (self.episode_step == self.max_episode_steps) else done)
... | Take an action and return the response of the env. | rl_algorithms/sac/agent.py | step | medipixel/rl_algorithms | 466 | python | def step(self, action: np.ndarray) -> Tuple[(np.ndarray, np.float64, bool, dict)]:
(next_state, reward, done, info) = self.env.step(action)
if (not self.is_test):
done_bool = (False if (self.episode_step == self.max_episode_steps) else done)
transition = (self.curr_state, action, reward, ne... | def step(self, action: np.ndarray) -> Tuple[(np.ndarray, np.float64, bool, dict)]:
(next_state, reward, done, info) = self.env.step(action)
if (not self.is_test):
done_bool = (False if (self.episode_step == self.max_episode_steps) else done)
transition = (self.curr_state, action, reward, ne... |
b20c1b8a71e34f4b76f54985c26f43f0a638f622756b7fa1e0dae32e0bafeaf5 | def _add_transition_to_memory(self, transition: Tuple[(np.ndarray, ...)]):
'Add 1 step and n step transitions to memory.'
self.memory.add(transition) | Add 1 step and n step transitions to memory. | rl_algorithms/sac/agent.py | _add_transition_to_memory | medipixel/rl_algorithms | 466 | python | def _add_transition_to_memory(self, transition: Tuple[(np.ndarray, ...)]):
self.memory.add(transition) | def _add_transition_to_memory(self, transition: Tuple[(np.ndarray, ...)]):
self.memory.add(transition)<|docstring|>Add 1 step and n step transitions to memory.<|endoftext|> |
ae9f4e3a7f353bc1e8354dccadb0644c163c10adee16bddabb48e7155a4bb205 | def write_log(self, log_value: tuple):
'Write log about loss and score'
(i, loss, score, policy_update_freq, avg_time_cost) = log_value
total_loss = loss.sum()
print(('[INFO] episode %d, episode_step %d, total step %d, total score: %d\ntotal loss: %.3f actor_loss: %.3f qf_1_loss: %.3f qf_2_loss: %.3f vf... | Write log about loss and score | rl_algorithms/sac/agent.py | write_log | medipixel/rl_algorithms | 466 | python | def write_log(self, log_value: tuple):
(i, loss, score, policy_update_freq, avg_time_cost) = log_value
total_loss = loss.sum()
print(('[INFO] episode %d, episode_step %d, total step %d, total score: %d\ntotal loss: %.3f actor_loss: %.3f qf_1_loss: %.3f qf_2_loss: %.3f vf_loss: %.3f alpha_loss: %.3f (sp... | def write_log(self, log_value: tuple):
(i, loss, score, policy_update_freq, avg_time_cost) = log_value
total_loss = loss.sum()
print(('[INFO] episode %d, episode_step %d, total step %d, total score: %d\ntotal loss: %.3f actor_loss: %.3f qf_1_loss: %.3f qf_2_loss: %.3f vf_loss: %.3f alpha_loss: %.3f (sp... |
6bb5763ea77c03354ec87c6ab391d97d32a0c8b8a9b39926249cb8e12c1e76d8 | def pretrain(self):
'Pretraining steps.'
pass | Pretraining steps. | rl_algorithms/sac/agent.py | pretrain | medipixel/rl_algorithms | 466 | python | def pretrain(self):
pass | def pretrain(self):
pass<|docstring|>Pretraining steps.<|endoftext|> |
c9b7511e125c38bf1db22ab43bb200d3f35d06e3fd957d84eb3b5a36bc638b67 | def train(self):
'Train the agent.'
if self.is_log:
self.set_wandb()
self.pretrain()
for self.i_episode in range(1, (self.episode_num + 1)):
state = self.env.reset()
done = False
score = 0
self.episode_step = 0
loss_episode = list()
t_begin = time.... | Train the agent. | rl_algorithms/sac/agent.py | train | medipixel/rl_algorithms | 466 | python | def train(self):
if self.is_log:
self.set_wandb()
self.pretrain()
for self.i_episode in range(1, (self.episode_num + 1)):
state = self.env.reset()
done = False
score = 0
self.episode_step = 0
loss_episode = list()
t_begin = time.time()
whi... | def train(self):
if self.is_log:
self.set_wandb()
self.pretrain()
for self.i_episode in range(1, (self.episode_num + 1)):
state = self.env.reset()
done = False
score = 0
self.episode_step = 0
loss_episode = list()
t_begin = time.time()
whi... |
7f444e7dda666ab4bef5e94045a542baa396872201124ab2d245d1ffeacf26ec | def residual(self, q0, qend, dt, fSDC, feval, **kwargs):
'Return the residual of *fSDC*.'
f = np.empty(((self.nnodes,) + feval.shape), dtype=fSDC.dtype)
ff = f.reshape((self.nnodes, feval.size))
for m in range(self.nnodes):
f[m] = fSDC[(0, m)]
for p in range(1, fSDC.shape[0]):
... | Return the residual of *fSDC*. | pfasst/sdc.py | residual | memmett/PyPFASST | 6 | python | def residual(self, q0, qend, dt, fSDC, feval, **kwargs):
f = np.empty(((self.nnodes,) + feval.shape), dtype=fSDC.dtype)
ff = f.reshape((self.nnodes, feval.size))
for m in range(self.nnodes):
f[m] = fSDC[(0, m)]
for p in range(1, fSDC.shape[0]):
f[m] += fSDC[(p, m)]
int_f... | def residual(self, q0, qend, dt, fSDC, feval, **kwargs):
f = np.empty(((self.nnodes,) + feval.shape), dtype=fSDC.dtype)
ff = f.reshape((self.nnodes, feval.size))
for m in range(self.nnodes):
f[m] = fSDC[(0, m)]
for p in range(1, fSDC.shape[0]):
f[m] += fSDC[(p, m)]
int_f... |
62ee179388b21eae9d3133877ba356ff19baa259d36efaf97abaf16be9b8a8aa | def sweep(self, *args, **kwargs):
'Perform one SDC sweep.\n\n **This method should be overridden.**\n '
raise NotImplementedError() | Perform one SDC sweep.
**This method should be overridden.** | pfasst/sdc.py | sweep | memmett/PyPFASST | 6 | python | def sweep(self, *args, **kwargs):
'Perform one SDC sweep.\n\n **This method should be overridden.**\n '
raise NotImplementedError() | def sweep(self, *args, **kwargs):
'Perform one SDC sweep.\n\n **This method should be overridden.**\n '
raise NotImplementedError()<|docstring|>Perform one SDC sweep.
**This method should be overridden.**<|endoftext|> |
2c12485e6f7ff5dcb5383738ed083811b533c6cc073b9145bd4a9aa7c4f391f9 | def evaluate(self, *args, **kwargs):
'Evaluate.\n\n **This method should be overridden.**\n '
raise NotImplementedError() | Evaluate.
**This method should be overridden.** | pfasst/sdc.py | evaluate | memmett/PyPFASST | 6 | python | def evaluate(self, *args, **kwargs):
'Evaluate.\n\n **This method should be overridden.**\n '
raise NotImplementedError() | def evaluate(self, *args, **kwargs):
'Evaluate.\n\n **This method should be overridden.**\n '
raise NotImplementedError()<|docstring|>Evaluate.
**This method should be overridden.**<|endoftext|> |
4e0500c796638303615cb161a4a4421f2bfab391c91f4eaec3f5128942ff5f0a | def MakePupil(D_eval, side_len, N):
'\n Create a pupil at the receiver plane to evaluate the structure function that accounts for receiver sampling effects\n\n :param D_eval: the diameter of the pupil in meters\n :param side_len: the sidelength of the receiver plane in meters\n :param N: the number of d... | Create a pupil at the receiver plane to evaluate the structure function that accounts for receiver sampling effects
:param D_eval: the diameter of the pupil in meters
:param side_len: the sidelength of the receiver plane in meters
:param N: the number of discrete intervals at the receiver
:return: a pupil function tha... | sim_evaluation_module.py | MakePupil | gregbad/WavePy | 0 | python | def MakePupil(D_eval, side_len, N):
'\n Create a pupil at the receiver plane to evaluate the structure function that accounts for receiver sampling effects\n\n :param D_eval: the diameter of the pupil in meters\n :param side_len: the sidelength of the receiver plane in meters\n :param N: the number of d... | def MakePupil(D_eval, side_len, N):
'\n Create a pupil at the receiver plane to evaluate the structure function that accounts for receiver sampling effects\n\n :param D_eval: the diameter of the pupil in meters\n :param side_len: the sidelength of the receiver plane in meters\n :param N: the number of d... |
2f7033f5322177e0d9ed63edefb680a31f9231cd6daf9d425ea7ac7eb3032bed | def structure_function_over_time(report_filename, sim_result_directory, D_receiver_pupil=None):
'\n Evaluate the accuracy of the turbulence simulation by computing the structure function at the receiver plane using\n a mutual coherence function approach. Note: This will only be accurate over many different si... | Evaluate the accuracy of the turbulence simulation by computing the structure function at the receiver plane using
a mutual coherence function approach. Note: This will only be accurate over many different simulations and some
disagreement should be expected over a single turbulence simulation
:param report_filename: ... | sim_evaluation_module.py | structure_function_over_time | gregbad/WavePy | 0 | python | def structure_function_over_time(report_filename, sim_result_directory, D_receiver_pupil=None):
'\n Evaluate the accuracy of the turbulence simulation by computing the structure function at the receiver plane using\n a mutual coherence function approach. Note: This will only be accurate over many different si... | def structure_function_over_time(report_filename, sim_result_directory, D_receiver_pupil=None):
'\n Evaluate the accuracy of the turbulence simulation by computing the structure function at the receiver plane using\n a mutual coherence function approach. Note: This will only be accurate over many different si... |
78b19657c31d8fcff1490169bc2ab19f6aefdf448d314558e705f1ceea623b30 | def evaluate_phase_structure_function_accuracy(input_N, input_dx, input_cn2, num_screen_draws=20, input_propdist=3000.0, input_wave=1e-06, input_num_subharmonics=5, input_L0=1000.0, input_n_screen_sim=4):
'\n Generate many different phase screens for a simulation setup and compare the statistical structure funci... | Generate many different phase screens for a simulation setup and compare the statistical structure funciton of the
phase screen to theoretical fits for a
:param input_N: N for the simulation
:param input_dx: sampling at the source plane for the simulation
:param input_cn2: the turbulence of the simulation
:param num_s... | sim_evaluation_module.py | evaluate_phase_structure_function_accuracy | gregbad/WavePy | 0 | python | def evaluate_phase_structure_function_accuracy(input_N, input_dx, input_cn2, num_screen_draws=20, input_propdist=3000.0, input_wave=1e-06, input_num_subharmonics=5, input_L0=1000.0, input_n_screen_sim=4):
'\n Generate many different phase screens for a simulation setup and compare the statistical structure funci... | def evaluate_phase_structure_function_accuracy(input_N, input_dx, input_cn2, num_screen_draws=20, input_propdist=3000.0, input_wave=1e-06, input_num_subharmonics=5, input_L0=1000.0, input_n_screen_sim=4):
'\n Generate many different phase screens for a simulation setup and compare the statistical structure funci... |
ecacab65c84f9c685e1600a94b708a9939134358119111aae8d83f70132ae00f | def evaluate_phase_structure_function_accuracy_postprocess(report_filename, sim_result_directory):
'\n Evaluate the phase structure function accuracy on a series of phase screens that were generated for the purpose of\n running a turbulence time series simulation\n\n Note: I have never had much confidence ... | Evaluate the phase structure function accuracy on a series of phase screens that were generated for the purpose of
running a turbulence time series simulation
Note: I have never had much confidence in this metric, as the scaling of the phase screens greatly affects the
accuracy of the results
:param report_file... | sim_evaluation_module.py | evaluate_phase_structure_function_accuracy_postprocess | gregbad/WavePy | 0 | python | def evaluate_phase_structure_function_accuracy_postprocess(report_filename, sim_result_directory):
'\n Evaluate the phase structure function accuracy on a series of phase screens that were generated for the purpose of\n running a turbulence time series simulation\n\n Note: I have never had much confidence ... | def evaluate_phase_structure_function_accuracy_postprocess(report_filename, sim_result_directory):
'\n Evaluate the phase structure function accuracy on a series of phase screens that were generated for the purpose of\n running a turbulence time series simulation\n\n Note: I have never had much confidence ... |
aa1538f259affa829662a9a4cfc8d9ca62fa873cd48a07f7d7c2365b77205d28 | def evaluate_PSD_accuracy(report_filename, sim_result_directory, min_max_freq=[1, 100], nsamples_psd=250):
'\n Evaluate the PSD of a series of phase screens from a turbulence evolved simulation\n\n :param report_filename: the filename including path for the output report of the turbulence simulation\n :par... | Evaluate the PSD of a series of phase screens from a turbulence evolved simulation
:param report_filename: the filename including path for the output report of the turbulence simulation
:param sim_result_directory: the directory in which the turbulence output simulation files over the timesteps have
... | sim_evaluation_module.py | evaluate_PSD_accuracy | gregbad/WavePy | 0 | python | def evaluate_PSD_accuracy(report_filename, sim_result_directory, min_max_freq=[1, 100], nsamples_psd=250):
'\n Evaluate the PSD of a series of phase screens from a turbulence evolved simulation\n\n :param report_filename: the filename including path for the output report of the turbulence simulation\n :par... | def evaluate_PSD_accuracy(report_filename, sim_result_directory, min_max_freq=[1, 100], nsamples_psd=250):
'\n Evaluate the PSD of a series of phase screens from a turbulence evolved simulation\n\n :param report_filename: the filename including path for the output report of the turbulence simulation\n :par... |
29a3eff471c0e6b16b2b27e6bee7a82058707b2d4375be530a997564bfeb9606 | @pytest.mark.serial
def test_delete_zone_success(shared_zone_test_context):
'\n Test deleting a zone\n '
client = shared_zone_test_context.ok_vinyldns_client
result_zone = None
try:
zone_name = f'one-time{shared_zone_test_context.partition_id}'
zone = {'name': zone_name, 'email': '... | Test deleting a zone | modules/api/src/test/functional/tests/zones/delete_zone_test.py | test_delete_zone_success | Jay07GIT/vinyldns | 0 | python | @pytest.mark.serial
def test_delete_zone_success(shared_zone_test_context):
'\n \n '
client = shared_zone_test_context.ok_vinyldns_client
result_zone = None
try:
zone_name = f'one-time{shared_zone_test_context.partition_id}'
zone = {'name': zone_name, 'email': 'example@example.com'... | @pytest.mark.serial
def test_delete_zone_success(shared_zone_test_context):
'\n \n '
client = shared_zone_test_context.ok_vinyldns_client
result_zone = None
try:
zone_name = f'one-time{shared_zone_test_context.partition_id}'
zone = {'name': zone_name, 'email': 'example@example.com'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.