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 |
|---|---|---|---|---|---|---|---|---|---|
bf14931d763cc2da8061def2584cf1a3948be1dc6eb529452662c4b1d0d4b234 | def load_config(additional_paths: typing.List[str]=[]) -> typing.Dict:
"\n Searches the current working directory and `additional_paths` for a loadable\n module named `config.py`. If a file is found and has a global variable named\n 'PRESALYTICS', the dictionary contained in the 'PRESALYTICS' is returned.... | Searches the current working directory and `additional_paths` for a loadable
module named `config.py`. If a file is found and has a global variable named
'PRESALYTICS', the dictionary contained in the 'PRESALYTICS' is returned.
*Note*: A environment variable called `autodiscover_paths` is automatically
loaded into th... | presalytics/lib/config_loader.py | load_config | presalytics/python-client | 4 | python | def load_config(additional_paths: typing.List[str]=[]) -> typing.Dict:
"\n Searches the current working directory and `additional_paths` for a loadable\n module named `config.py`. If a file is found and has a global variable named\n 'PRESALYTICS', the dictionary contained in the 'PRESALYTICS' is returned.... | def load_config(additional_paths: typing.List[str]=[]) -> typing.Dict:
"\n Searches the current working directory and `additional_paths` for a loadable\n module named `config.py`. If a file is found and has a global variable named\n 'PRESALYTICS', the dictionary contained in the 'PRESALYTICS' is returned.... |
7b9b2aa17706a687602fbd3c6f53f87d67f29c9cffd715ed425ede93d4750718 | def test_global_avg_pool_module(self):
'\n Tests the global average pool module with fixed 4-d test tensors\n '
base_tensor = torch.Tensor([[2, 1], [3, 0]])
all_init = []
for i in range((- 2), 3):
all_init.append(torch.add(base_tensor, i))
init_tensor = torch.stack(all_init, di... | Tests the global average pool module with fixed 4-d test tensors | test/test_nn.py | test_global_avg_pool_module | youben11/CrypTen | 2 | python | def test_global_avg_pool_module(self):
'\n \n '
base_tensor = torch.Tensor([[2, 1], [3, 0]])
all_init = []
for i in range((- 2), 3):
all_init.append(torch.add(base_tensor, i))
init_tensor = torch.stack(all_init, dim=2)
init_tensor = init_tensor.unsqueeze((- 1))
referenc... | def test_global_avg_pool_module(self):
'\n \n '
base_tensor = torch.Tensor([[2, 1], [3, 0]])
all_init = []
for i in range((- 2), 3):
all_init.append(torch.add(base_tensor, i))
init_tensor = torch.stack(all_init, dim=2)
init_tensor = init_tensor.unsqueeze((- 1))
referenc... |
38046427c74a05fc1e87859756e8ee42e5f737f95218795fdcb09b611337cf4d | def test_dropout_module(self):
'Tests the dropout module'
input_size = [3, 3, 3]
prob_list = [(0.2 * x) for x in range(1, 5)]
for module_name in ['Dropout', 'Dropout2d', 'Dropout3d']:
for prob in prob_list:
for wrap in [True, False]:
input = get_random_test_tensor(siz... | Tests the dropout module | test/test_nn.py | test_dropout_module | youben11/CrypTen | 2 | python | def test_dropout_module(self):
input_size = [3, 3, 3]
prob_list = [(0.2 * x) for x in range(1, 5)]
for module_name in ['Dropout', 'Dropout2d', 'Dropout3d']:
for prob in prob_list:
for wrap in [True, False]:
input = get_random_test_tensor(size=input_size, is_float=Tru... | def test_dropout_module(self):
input_size = [3, 3, 3]
prob_list = [(0.2 * x) for x in range(1, 5)]
for module_name in ['Dropout', 'Dropout2d', 'Dropout3d']:
for prob in prob_list:
for wrap in [True, False]:
input = get_random_test_tensor(size=input_size, is_float=Tru... |
518467dff0d3737c61ceadb153bf7a1dc86be071543585ab0c1f216c1fe316e9 | def test_non_pytorch_modules(self):
'\n Tests all non-container Modules in crypten.nn that do not have\n equivalent modules in PyTorch.\n '
no_input_modules = ['Constant']
binary_modules = ['Add', 'Sub', 'Concat']
ex_zero_modules = []
module_args = {'Add': (), 'Concat': (0,), 'C... | Tests all non-container Modules in crypten.nn that do not have
equivalent modules in PyTorch. | test/test_nn.py | test_non_pytorch_modules | youben11/CrypTen | 2 | python | def test_non_pytorch_modules(self):
'\n Tests all non-container Modules in crypten.nn that do not have\n equivalent modules in PyTorch.\n '
no_input_modules = ['Constant']
binary_modules = ['Add', 'Sub', 'Concat']
ex_zero_modules = []
module_args = {'Add': (), 'Concat': (0,), 'C... | def test_non_pytorch_modules(self):
'\n Tests all non-container Modules in crypten.nn that do not have\n equivalent modules in PyTorch.\n '
no_input_modules = ['Constant']
binary_modules = ['Add', 'Sub', 'Concat']
ex_zero_modules = []
module_args = {'Add': (), 'Concat': (0,), 'C... |
1db3c09bb6a761e1fabfff4d6937db95b49a30d5eb5ef0d6d64caa2e8bf6de5b | def test_pytorch_modules(self):
'\n Tests all non-container Modules in crypten.nn that have equivalent\n modules in PyTorch.\n '
module_args = {'AdaptiveAvgPool2d': (2,), 'AvgPool2d': (2,), 'ConstantPad1d': (3, 1.0), 'ConstantPad2d': (2, 2.0), 'ConstantPad3d': (1, 0.0), 'Conv2d': (3, 6, 5),... | Tests all non-container Modules in crypten.nn that have equivalent
modules in PyTorch. | test/test_nn.py | test_pytorch_modules | youben11/CrypTen | 2 | python | def test_pytorch_modules(self):
'\n Tests all non-container Modules in crypten.nn that have equivalent\n modules in PyTorch.\n '
module_args = {'AdaptiveAvgPool2d': (2,), 'AvgPool2d': (2,), 'ConstantPad1d': (3, 1.0), 'ConstantPad2d': (2, 2.0), 'ConstantPad3d': (1, 0.0), 'Conv2d': (3, 6, 5),... | def test_pytorch_modules(self):
'\n Tests all non-container Modules in crypten.nn that have equivalent\n modules in PyTorch.\n '
module_args = {'AdaptiveAvgPool2d': (2,), 'AvgPool2d': (2,), 'ConstantPad1d': (3, 1.0), 'ConstantPad2d': (2, 2.0), 'ConstantPad3d': (1, 0.0), 'Conv2d': (3, 6, 5),... |
8c5c1804559f8471c41c82698da7939ab686e818ceb32fabfd4b050770665d32 | def test_sequential(self):
'\n Tests crypten.nn.Sequential module.\n '
for num_layers in range(1, 6):
for wrap in [True, False]:
input_size = (3, 10)
output_size = (input_size[0], (input_size[1] - num_layers))
layer_idx = range(input_size[1], output_size... | Tests crypten.nn.Sequential module. | test/test_nn.py | test_sequential | youben11/CrypTen | 2 | python | def test_sequential(self):
'\n \n '
for num_layers in range(1, 6):
for wrap in [True, False]:
input_size = (3, 10)
output_size = (input_size[0], (input_size[1] - num_layers))
layer_idx = range(input_size[1], output_size[1], (- 1))
module_list... | def test_sequential(self):
'\n \n '
for num_layers in range(1, 6):
for wrap in [True, False]:
input_size = (3, 10)
output_size = (input_size[0], (input_size[1] - num_layers))
layer_idx = range(input_size[1], output_size[1], (- 1))
module_list... |
1dc6010c88183f60029314c8bd878759172d20347ea013d15924302c92d1b4a9 | def test_graph(self):
'\n Tests crypten.nn.Graph module.\n '
for wrap in [True, False]:
input_size = (3, 10)
input = get_random_test_tensor(size=input_size, is_float=True)
encr_input = crypten.cryptensor(input)
if wrap:
encr_input = AutogradCrypTensor(en... | Tests crypten.nn.Graph module. | test/test_nn.py | test_graph | youben11/CrypTen | 2 | python | def test_graph(self):
'\n \n '
for wrap in [True, False]:
input_size = (3, 10)
input = get_random_test_tensor(size=input_size, is_float=True)
encr_input = crypten.cryptensor(input)
if wrap:
encr_input = AutogradCrypTensor(encr_input)
graph = cryp... | def test_graph(self):
'\n \n '
for wrap in [True, False]:
input_size = (3, 10)
input = get_random_test_tensor(size=input_size, is_float=True)
encr_input = crypten.cryptensor(input)
if wrap:
encr_input = AutogradCrypTensor(encr_input)
graph = cryp... |
634ae4313d5ee6c554be40352037b3c350db2d9d90fc6126301fe8ad1ed884a1 | def test_losses(self):
'\n Tests all Losses implemented in crypten.nn.\n '
input = (get_random_test_tensor(max_value=0.999, is_float=True).abs() + 0.001)
target = (get_random_test_tensor(max_value=0.999, is_float=True).abs() + 0.001)
encrypted_input = crypten.cryptensor(input)
encrypte... | Tests all Losses implemented in crypten.nn. | test/test_nn.py | test_losses | youben11/CrypTen | 2 | python | def test_losses(self):
'\n \n '
input = (get_random_test_tensor(max_value=0.999, is_float=True).abs() + 0.001)
target = (get_random_test_tensor(max_value=0.999, is_float=True).abs() + 0.001)
encrypted_input = crypten.cryptensor(input)
encrypted_target = crypten.cryptensor(target)
f... | def test_losses(self):
'\n \n '
input = (get_random_test_tensor(max_value=0.999, is_float=True).abs() + 0.001)
target = (get_random_test_tensor(max_value=0.999, is_float=True).abs() + 0.001)
encrypted_input = crypten.cryptensor(input)
encrypted_target = crypten.cryptensor(target)
f... |
7cab97b929a049564bbb96b3252321bf11f1a1f33b08549c7ce62dbe482817ef | def test_getattr_setattr(self):
'Tests the __getattr__ and __setattr__ functions'
tensor1 = get_random_test_tensor(size=(3, 3), is_float=True)
tensor2 = get_random_test_tensor(size=(3, 3), is_float=True)
class ExampleNet(crypten.nn.Module):
def __init__(self):
super(ExampleNet, sel... | Tests the __getattr__ and __setattr__ functions | test/test_nn.py | test_getattr_setattr | youben11/CrypTen | 2 | python | def test_getattr_setattr(self):
tensor1 = get_random_test_tensor(size=(3, 3), is_float=True)
tensor2 = get_random_test_tensor(size=(3, 3), is_float=True)
class ExampleNet(crypten.nn.Module):
def __init__(self):
super(ExampleNet, self).__init__()
self.fc1 = crypten.nn.L... | def test_getattr_setattr(self):
tensor1 = get_random_test_tensor(size=(3, 3), is_float=True)
tensor2 = get_random_test_tensor(size=(3, 3), is_float=True)
class ExampleNet(crypten.nn.Module):
def __init__(self):
super(ExampleNet, self).__init__()
self.fc1 = crypten.nn.L... |
877176cfd54364a58e77f63d7064d0aaa61851442fcc6980b695e5cfde32c119 | def test_training(self):
'\n Tests training of simple model in crypten.nn.\n '
learning_rate = 0.1
(batch_size, num_inputs, num_intermediate, num_outputs) = (8, 10, 5, 1)
model = crypten.nn.Sequential([crypten.nn.Linear(num_inputs, num_intermediate), crypten.nn.ReLU(), crypten.nn.Linear(nu... | Tests training of simple model in crypten.nn. | test/test_nn.py | test_training | youben11/CrypTen | 2 | python | def test_training(self):
'\n \n '
learning_rate = 0.1
(batch_size, num_inputs, num_intermediate, num_outputs) = (8, 10, 5, 1)
model = crypten.nn.Sequential([crypten.nn.Linear(num_inputs, num_intermediate), crypten.nn.ReLU(), crypten.nn.Linear(num_intermediate, num_outputs)])
model.trai... | def test_training(self):
'\n \n '
learning_rate = 0.1
(batch_size, num_inputs, num_intermediate, num_outputs) = (8, 10, 5, 1)
model = crypten.nn.Sequential([crypten.nn.Linear(num_inputs, num_intermediate), crypten.nn.ReLU(), crypten.nn.Linear(num_intermediate, num_outputs)])
model.trai... |
c498b1a7f55d5fa717d81f1fcda944acae461d818d5110cfeef6aa9522d73aaf | def test_custom_module_training(self):
'Tests training CrypTen models created directly using the crypten.nn.Module'
BATCH_SIZE = 32
NUM_FEATURES = 3
class ExampleNet(crypten.nn.Module):
def __init__(self):
super(ExampleNet, self).__init__()
self.fc1 = crypten.nn.Linear(... | Tests training CrypTen models created directly using the crypten.nn.Module | test/test_nn.py | test_custom_module_training | youben11/CrypTen | 2 | python | def test_custom_module_training(self):
BATCH_SIZE = 32
NUM_FEATURES = 3
class ExampleNet(crypten.nn.Module):
def __init__(self):
super(ExampleNet, self).__init__()
self.fc1 = crypten.nn.Linear(NUM_FEATURES, BATCH_SIZE)
self.fc2 = crypten.nn.Linear(BATCH_SIZ... | def test_custom_module_training(self):
BATCH_SIZE = 32
NUM_FEATURES = 3
class ExampleNet(crypten.nn.Module):
def __init__(self):
super(ExampleNet, self).__init__()
self.fc1 = crypten.nn.Linear(NUM_FEATURES, BATCH_SIZE)
self.fc2 = crypten.nn.Linear(BATCH_SIZ... |
75896f2000603640a2074cb22b00d92334a0d4ef401a45db1d7c67091f4a57bb | def test_from_pytorch_training(self):
'Tests the from_pytorch code path for training CrypTen models'
import torch.nn as nn
import torch.nn.functional as F
class ExampleNet(nn.Module):
def __init__(self):
super(ExampleNet, self).__init__()
self.conv1 = nn.Conv2d(1, 16, k... | Tests the from_pytorch code path for training CrypTen models | test/test_nn.py | test_from_pytorch_training | youben11/CrypTen | 2 | python | def test_from_pytorch_training(self):
import torch.nn as nn
import torch.nn.functional as F
class ExampleNet(nn.Module):
def __init__(self):
super(ExampleNet, self).__init__()
self.conv1 = nn.Conv2d(1, 16, kernel_size=5, padding=1)
self.fc1 = nn.Linear(((16... | def test_from_pytorch_training(self):
import torch.nn as nn
import torch.nn.functional as F
class ExampleNet(nn.Module):
def __init__(self):
super(ExampleNet, self).__init__()
self.conv1 = nn.Conv2d(1, 16, kernel_size=5, padding=1)
self.fc1 = nn.Linear(((16... |
f9acb577fee3ea08965a4ce018452a89e5c706c2d5915ac22b81f048a8cd6eca | def test_batchnorm_module(self):
'Test module correctly sets and updates running stats'
batchnorm_fn_and_size = (('BatchNorm1d', (500, 10, 3)), ('BatchNorm2d', (600, 7, 4, 20)), ('BatchNorm3d', (800, 5, 4, 8, 15)))
for (batchnorm_fn, size) in batchnorm_fn_and_size:
for is_trainning in (True, False):... | Test module correctly sets and updates running stats | test/test_nn.py | test_batchnorm_module | youben11/CrypTen | 2 | python | def test_batchnorm_module(self):
batchnorm_fn_and_size = (('BatchNorm1d', (500, 10, 3)), ('BatchNorm2d', (600, 7, 4, 20)), ('BatchNorm3d', (800, 5, 4, 8, 15)))
for (batchnorm_fn, size) in batchnorm_fn_and_size:
for is_trainning in (True, False):
tensor = get_random_test_tensor(size=size... | def test_batchnorm_module(self):
batchnorm_fn_and_size = (('BatchNorm1d', (500, 10, 3)), ('BatchNorm2d', (600, 7, 4, 20)), ('BatchNorm3d', (800, 5, 4, 8, 15)))
for (batchnorm_fn, size) in batchnorm_fn_and_size:
for is_trainning in (True, False):
tensor = get_random_test_tensor(size=size... |
5be02682d0908b0a16d18ff87abf7f4005cfcded237aa55afb9208e5510e8dcf | def __init__(self, log_level=10):
'\n Use log_level=10 for Debug and log_level=20 for info\n '
self._logger = logging.getLogger(__class__.__name__)
self._logger.setLevel(log_level) | Use log_level=10 for Debug and log_level=20 for info | cli/tools/__init__.py | __init__ | Dilshod070/mlmltool | 0 | python | def __init__(self, log_level=10):
'\n \n '
self._logger = logging.getLogger(__class__.__name__)
self._logger.setLevel(log_level) | def __init__(self, log_level=10):
'\n \n '
self._logger = logging.getLogger(__class__.__name__)
self._logger.setLevel(log_level)<|docstring|>Use log_level=10 for Debug and log_level=20 for info<|endoftext|> |
59d220bbfaf2473c7d641f61fc4ef5e50a32437735baa8f8fce6d884faf26634 | def _run_command(self, command: str, *args, wait: bool=True):
'\n Runs shell command\n :param command: shell command\n :param args: arguments for shell command\n :param wait: whether to run sync or async\n '
self._logger.info(([command] + list(args)))
proc = subprocess.Pop... | Runs shell command
:param command: shell command
:param args: arguments for shell command
:param wait: whether to run sync or async | cli/tools/__init__.py | _run_command | Dilshod070/mlmltool | 0 | python | def _run_command(self, command: str, *args, wait: bool=True):
'\n Runs shell command\n :param command: shell command\n :param args: arguments for shell command\n :param wait: whether to run sync or async\n '
self._logger.info(([command] + list(args)))
proc = subprocess.Pop... | def _run_command(self, command: str, *args, wait: bool=True):
'\n Runs shell command\n :param command: shell command\n :param args: arguments for shell command\n :param wait: whether to run sync or async\n '
self._logger.info(([command] + list(args)))
proc = subprocess.Pop... |
84e71010f4a7c2e66d31aa2725f877ec9c1b4e35bc7b81a3ee2464567b2d0b03 | def __init__(self, channel=None, latitude=None, longitude=None, qos=None, _configuration=None):
'CellSiteChannel - a model defined in Swagger'
if (_configuration is None):
_configuration = Configuration()
self._configuration = _configuration
self._channel = None
self._latitude = None
sel... | CellSiteChannel - a model defined in Swagger | Wigle/python-client/swagger_client/models/cell_site_channel.py | __init__ | BillReyor/SSIDprobeCollector | 1 | python | def __init__(self, channel=None, latitude=None, longitude=None, qos=None, _configuration=None):
if (_configuration is None):
_configuration = Configuration()
self._configuration = _configuration
self._channel = None
self._latitude = None
self._longitude = None
self._qos = None
s... | def __init__(self, channel=None, latitude=None, longitude=None, qos=None, _configuration=None):
if (_configuration is None):
_configuration = Configuration()
self._configuration = _configuration
self._channel = None
self._latitude = None
self._longitude = None
self._qos = None
s... |
1efd083b7a06cc2b5801a5e6e02f01da757a7b7be123415a27d3c197fca94634 | @property
def channel(self):
'Gets the channel of this CellSiteChannel. # noqa: E501\n\n\n :return: The channel of this CellSiteChannel. # noqa: E501\n :rtype: int\n '
return self._channel | Gets the channel of this CellSiteChannel. # noqa: E501
:return: The channel of this CellSiteChannel. # noqa: E501
:rtype: int | Wigle/python-client/swagger_client/models/cell_site_channel.py | channel | BillReyor/SSIDprobeCollector | 1 | python | @property
def channel(self):
'Gets the channel of this CellSiteChannel. # noqa: E501\n\n\n :return: The channel of this CellSiteChannel. # noqa: E501\n :rtype: int\n '
return self._channel | @property
def channel(self):
'Gets the channel of this CellSiteChannel. # noqa: E501\n\n\n :return: The channel of this CellSiteChannel. # noqa: E501\n :rtype: int\n '
return self._channel<|docstring|>Gets the channel of this CellSiteChannel. # noqa: E501
:return: The channel of this C... |
9eb30a3369cf6a94d04a0c92a8e4a485e9abf1a3f5c4177230e3c30bb5a3d845 | @channel.setter
def channel(self, channel):
'Sets the channel of this CellSiteChannel.\n\n\n :param channel: The channel of this CellSiteChannel. # noqa: E501\n :type: int\n '
self._channel = channel | Sets the channel of this CellSiteChannel.
:param channel: The channel of this CellSiteChannel. # noqa: E501
:type: int | Wigle/python-client/swagger_client/models/cell_site_channel.py | channel | BillReyor/SSIDprobeCollector | 1 | python | @channel.setter
def channel(self, channel):
'Sets the channel of this CellSiteChannel.\n\n\n :param channel: The channel of this CellSiteChannel. # noqa: E501\n :type: int\n '
self._channel = channel | @channel.setter
def channel(self, channel):
'Sets the channel of this CellSiteChannel.\n\n\n :param channel: The channel of this CellSiteChannel. # noqa: E501\n :type: int\n '
self._channel = channel<|docstring|>Sets the channel of this CellSiteChannel.
:param channel: The channel of thi... |
0152a4d2ac029637983aad71c44ba8ed67181aeeca8df32928afd3a80b300073 | @property
def latitude(self):
'Gets the latitude of this CellSiteChannel. # noqa: E501\n\n\n :return: The latitude of this CellSiteChannel. # noqa: E501\n :rtype: float\n '
return self._latitude | Gets the latitude of this CellSiteChannel. # noqa: E501
:return: The latitude of this CellSiteChannel. # noqa: E501
:rtype: float | Wigle/python-client/swagger_client/models/cell_site_channel.py | latitude | BillReyor/SSIDprobeCollector | 1 | python | @property
def latitude(self):
'Gets the latitude of this CellSiteChannel. # noqa: E501\n\n\n :return: The latitude of this CellSiteChannel. # noqa: E501\n :rtype: float\n '
return self._latitude | @property
def latitude(self):
'Gets the latitude of this CellSiteChannel. # noqa: E501\n\n\n :return: The latitude of this CellSiteChannel. # noqa: E501\n :rtype: float\n '
return self._latitude<|docstring|>Gets the latitude of this CellSiteChannel. # noqa: E501
:return: The latitude o... |
fccff7cd1ee9ba688b7f12f8b97001b3ff25322867fb42c39e41691b43904907 | @latitude.setter
def latitude(self, latitude):
'Sets the latitude of this CellSiteChannel.\n\n\n :param latitude: The latitude of this CellSiteChannel. # noqa: E501\n :type: float\n '
self._latitude = latitude | Sets the latitude of this CellSiteChannel.
:param latitude: The latitude of this CellSiteChannel. # noqa: E501
:type: float | Wigle/python-client/swagger_client/models/cell_site_channel.py | latitude | BillReyor/SSIDprobeCollector | 1 | python | @latitude.setter
def latitude(self, latitude):
'Sets the latitude of this CellSiteChannel.\n\n\n :param latitude: The latitude of this CellSiteChannel. # noqa: E501\n :type: float\n '
self._latitude = latitude | @latitude.setter
def latitude(self, latitude):
'Sets the latitude of this CellSiteChannel.\n\n\n :param latitude: The latitude of this CellSiteChannel. # noqa: E501\n :type: float\n '
self._latitude = latitude<|docstring|>Sets the latitude of this CellSiteChannel.
:param latitude: The la... |
63374f30f58bc94fb2386de19ae52b212a8ee8fad14c2b98b34f24805d653227 | @property
def longitude(self):
'Gets the longitude of this CellSiteChannel. # noqa: E501\n\n\n :return: The longitude of this CellSiteChannel. # noqa: E501\n :rtype: float\n '
return self._longitude | Gets the longitude of this CellSiteChannel. # noqa: E501
:return: The longitude of this CellSiteChannel. # noqa: E501
:rtype: float | Wigle/python-client/swagger_client/models/cell_site_channel.py | longitude | BillReyor/SSIDprobeCollector | 1 | python | @property
def longitude(self):
'Gets the longitude of this CellSiteChannel. # noqa: E501\n\n\n :return: The longitude of this CellSiteChannel. # noqa: E501\n :rtype: float\n '
return self._longitude | @property
def longitude(self):
'Gets the longitude of this CellSiteChannel. # noqa: E501\n\n\n :return: The longitude of this CellSiteChannel. # noqa: E501\n :rtype: float\n '
return self._longitude<|docstring|>Gets the longitude of this CellSiteChannel. # noqa: E501
:return: The longi... |
8f3297441f1b239dfd51d94022960ce8ce992da623b96439c49073509096ba76 | @longitude.setter
def longitude(self, longitude):
'Sets the longitude of this CellSiteChannel.\n\n\n :param longitude: The longitude of this CellSiteChannel. # noqa: E501\n :type: float\n '
self._longitude = longitude | Sets the longitude of this CellSiteChannel.
:param longitude: The longitude of this CellSiteChannel. # noqa: E501
:type: float | Wigle/python-client/swagger_client/models/cell_site_channel.py | longitude | BillReyor/SSIDprobeCollector | 1 | python | @longitude.setter
def longitude(self, longitude):
'Sets the longitude of this CellSiteChannel.\n\n\n :param longitude: The longitude of this CellSiteChannel. # noqa: E501\n :type: float\n '
self._longitude = longitude | @longitude.setter
def longitude(self, longitude):
'Sets the longitude of this CellSiteChannel.\n\n\n :param longitude: The longitude of this CellSiteChannel. # noqa: E501\n :type: float\n '
self._longitude = longitude<|docstring|>Sets the longitude of this CellSiteChannel.
:param longitu... |
a8ada354ffadb746d06cb7867a07a9945636b21b859545916b2ca1344b01de7c | @property
def qos(self):
'Gets the qos of this CellSiteChannel. # noqa: E501\n\n\n :return: The qos of this CellSiteChannel. # noqa: E501\n :rtype: int\n '
return self._qos | Gets the qos of this CellSiteChannel. # noqa: E501
:return: The qos of this CellSiteChannel. # noqa: E501
:rtype: int | Wigle/python-client/swagger_client/models/cell_site_channel.py | qos | BillReyor/SSIDprobeCollector | 1 | python | @property
def qos(self):
'Gets the qos of this CellSiteChannel. # noqa: E501\n\n\n :return: The qos of this CellSiteChannel. # noqa: E501\n :rtype: int\n '
return self._qos | @property
def qos(self):
'Gets the qos of this CellSiteChannel. # noqa: E501\n\n\n :return: The qos of this CellSiteChannel. # noqa: E501\n :rtype: int\n '
return self._qos<|docstring|>Gets the qos of this CellSiteChannel. # noqa: E501
:return: The qos of this CellSiteChannel. # noqa:... |
ad96be938a1b576cb0e1871d071cafdc1f94205ab12f90a616f6230fc122ab18 | @qos.setter
def qos(self, qos):
'Sets the qos of this CellSiteChannel.\n\n\n :param qos: The qos of this CellSiteChannel. # noqa: E501\n :type: int\n '
self._qos = qos | Sets the qos of this CellSiteChannel.
:param qos: The qos of this CellSiteChannel. # noqa: E501
:type: int | Wigle/python-client/swagger_client/models/cell_site_channel.py | qos | BillReyor/SSIDprobeCollector | 1 | python | @qos.setter
def qos(self, qos):
'Sets the qos of this CellSiteChannel.\n\n\n :param qos: The qos of this CellSiteChannel. # noqa: E501\n :type: int\n '
self._qos = qos | @qos.setter
def qos(self, qos):
'Sets the qos of this CellSiteChannel.\n\n\n :param qos: The qos of this CellSiteChannel. # noqa: E501\n :type: int\n '
self._qos = qos<|docstring|>Sets the qos of this CellSiteChannel.
:param qos: The qos of this CellSiteChannel. # noqa: E501
:type: int<... |
efd746c332d5a2ee3d490dffd5287a3b799d8a97580a25ccb938a65caf8b4c29 | def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | Returns the model properties as a dict | Wigle/python-client/swagger_client/models/cell_site_channel.py | to_dict | BillReyor/SSIDprobeCollector | 1 | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
cbb19eaa2fc8a113d9e32f924ef280a7e97563f8915f94f65dab438997af2e99 | def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | Returns the string representation of the model | Wigle/python-client/swagger_client/models/cell_site_channel.py | to_str | BillReyor/SSIDprobeCollector | 1 | python | def to_str(self):
return pprint.pformat(self.to_dict()) | def to_str(self):
return pprint.pformat(self.to_dict())<|docstring|>Returns the string representation of the model<|endoftext|> |
772243a2c2b3261a9b954d07aaf295e3c1242a579a495e2d6a5679c677861703 | def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | For `print` and `pprint` | Wigle/python-client/swagger_client/models/cell_site_channel.py | __repr__ | BillReyor/SSIDprobeCollector | 1 | python | def __repr__(self):
return self.to_str() | def __repr__(self):
return self.to_str()<|docstring|>For `print` and `pprint`<|endoftext|> |
8065b5258c674b1f83c6aa2f6599da00cbeda3bc604db8f97ed697474982334a | def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, CellSiteChannel)):
return False
return (self.to_dict() == other.to_dict()) | Returns true if both objects are equal | Wigle/python-client/swagger_client/models/cell_site_channel.py | __eq__ | BillReyor/SSIDprobeCollector | 1 | python | def __eq__(self, other):
if (not isinstance(other, CellSiteChannel)):
return False
return (self.to_dict() == other.to_dict()) | def __eq__(self, other):
if (not isinstance(other, CellSiteChannel)):
return False
return (self.to_dict() == other.to_dict())<|docstring|>Returns true if both objects are equal<|endoftext|> |
b3f9de9f2c79ba4213a6bfcfa63588bc31e5910ea0563db072ed9185bec8f191 | def __ne__(self, other):
'Returns true if both objects are not equal'
if (not isinstance(other, CellSiteChannel)):
return True
return (self.to_dict() != other.to_dict()) | Returns true if both objects are not equal | Wigle/python-client/swagger_client/models/cell_site_channel.py | __ne__ | BillReyor/SSIDprobeCollector | 1 | python | def __ne__(self, other):
if (not isinstance(other, CellSiteChannel)):
return True
return (self.to_dict() != other.to_dict()) | def __ne__(self, other):
if (not isinstance(other, CellSiteChannel)):
return True
return (self.to_dict() != other.to_dict())<|docstring|>Returns true if both objects are not equal<|endoftext|> |
8e5bf121d375f16923a9a6322dd450088b66ed5dd3d1e8d6fc20f23016020402 | def eval_masks(args, model, dataset, root):
'Evaluate masks to produce mAP (and PSNR) scores.'
root = os.path.join(root, 'masks')
os.makedirs(root)
maskloader = MaskLoader(dataset=dataset)
image_ids = evaluation.utils.sample_linear(dataset.img_ids_test, args.masks_n_samples)[0]
results = evaluat... | Evaluate masks to produce mAP (and PSNR) scores. | evaluate.py | eval_masks | dichotomies/NeuralDiff | 5 | python | def eval_masks(args, model, dataset, root):
root = os.path.join(root, 'masks')
os.makedirs(root)
maskloader = MaskLoader(dataset=dataset)
image_ids = evaluation.utils.sample_linear(dataset.img_ids_test, args.masks_n_samples)[0]
results = evaluation.evaluate(dataset, model, maskloader, vis_i=1, ... | def eval_masks(args, model, dataset, root):
root = os.path.join(root, 'masks')
os.makedirs(root)
maskloader = MaskLoader(dataset=dataset)
image_ids = evaluation.utils.sample_linear(dataset.img_ids_test, args.masks_n_samples)[0]
results = evaluation.evaluate(dataset, model, maskloader, vis_i=1, ... |
2981229e35774246cac4bcef4b5a10e7179c2d90c626bedd56c9a791b1d70256 | def eval_masks_average(args):
'Calculate average of `eval_masks` results for all 10 scenes.'
scores = []
for vid in VIDEO_IDS:
path_metrics = os.path.join('results', args.exp, vid, 'masks', 'metrics.txt')
with open(f'results/rel/{vid}/masks/metrics.txt') as f:
lines = f.readlines... | Calculate average of `eval_masks` results for all 10 scenes. | evaluate.py | eval_masks_average | dichotomies/NeuralDiff | 5 | python | def eval_masks_average(args):
scores = []
for vid in VIDEO_IDS:
path_metrics = os.path.join('results', args.exp, vid, 'masks', 'metrics.txt')
with open(f'results/rel/{vid}/masks/metrics.txt') as f:
lines = f.readlines()
(score_map, score_psnr) = [float(s) for s in li... | def eval_masks_average(args):
scores = []
for vid in VIDEO_IDS:
path_metrics = os.path.join('results', args.exp, vid, 'masks', 'metrics.txt')
with open(f'results/rel/{vid}/masks/metrics.txt') as f:
lines = f.readlines()
(score_map, score_psnr) = [float(s) for s in li... |
9025447ef7eb4f7008af3c9bdf19720d02cd0199b95689a1ffdf62ae1d81b48c | def render_video(args, model, dataset, root, save_cache=False):
'Render a summary video like shown on the project page.'
root = os.path.join(root, 'summary')
os.makedirs(root)
sid = SAMPLE_IDS[args.vid]
top = evaluation.video.render(dataset, model, n_images=args.summary_n_samples)
bot = evaluati... | Render a summary video like shown on the project page. | evaluate.py | render_video | dichotomies/NeuralDiff | 5 | python | def render_video(args, model, dataset, root, save_cache=False):
root = os.path.join(root, 'summary')
os.makedirs(root)
sid = SAMPLE_IDS[args.vid]
top = evaluation.video.render(dataset, model, n_images=args.summary_n_samples)
bot = evaluation.video.render(dataset, model, sid, n_images=args.summa... | def render_video(args, model, dataset, root, save_cache=False):
root = os.path.join(root, 'summary')
os.makedirs(root)
sid = SAMPLE_IDS[args.vid]
top = evaluation.video.render(dataset, model, n_images=args.summary_n_samples)
bot = evaluation.video.render(dataset, model, sid, n_images=args.summa... |
38142ea211dc3abe71f7c17079765d4fd43b783e989b4e61065057d91b04ffd7 | def check_none(val, default):
'Check an input for if it is None, and if so return a default object.\n\n Parameters\n ----------\n val : collection object or None\n An object to check whether is None.\n default : collection object\n What to defaul to if `val` is None.\n\n Returns\n --... | Check an input for if it is None, and if so return a default object.
Parameters
----------
val : collection object or None
An object to check whether is None.
default : collection object
What to defaul to if `val` is None.
Returns
-------
collection object
Either the original input item, or the default in... | lisc/urls/utils.py | check_none | ryanhammonds/lisc | 1 | python | def check_none(val, default):
'Check an input for if it is None, and if so return a default object.\n\n Parameters\n ----------\n val : collection object or None\n An object to check whether is None.\n default : collection object\n What to defaul to if `val` is None.\n\n Returns\n --... | def check_none(val, default):
'Check an input for if it is None, and if so return a default object.\n\n Parameters\n ----------\n val : collection object or None\n An object to check whether is None.\n default : collection object\n What to defaul to if `val` is None.\n\n Returns\n --... |
8713c22df238354c48105a16406afa99ad65ff6ede3c2b86e100d571ecd90e71 | def prepend(string, prefix):
'Append something to the beginning of another string.\n\n Parameters\n ----------\n string : str\n String to prepend to.\n prefix : str\n String to add to the beginning.\n\n Returns\n -------\n str\n String with the addition to the beginning.\n\... | Append something to the beginning of another string.
Parameters
----------
string : str
String to prepend to.
prefix : str
String to add to the beginning.
Returns
-------
str
String with the addition to the beginning.
Notes
-----
This function deals with empty inputs, and returns an empty string in that ... | lisc/urls/utils.py | prepend | ryanhammonds/lisc | 1 | python | def prepend(string, prefix):
'Append something to the beginning of another string.\n\n Parameters\n ----------\n string : str\n String to prepend to.\n prefix : str\n String to add to the beginning.\n\n Returns\n -------\n str\n String with the addition to the beginning.\n\... | def prepend(string, prefix):
'Append something to the beginning of another string.\n\n Parameters\n ----------\n string : str\n String to prepend to.\n prefix : str\n String to add to the beginning.\n\n Returns\n -------\n str\n String with the addition to the beginning.\n\... |
4a46560074a7b6218e96dc9a54010e5ef2a27f7ffdf26526966b6cc4fac82792 | def make_segments(segments):
'Make the segments portion of a URL.\n\n Parameters\n ----------\n segments : list of str\n Segments to use to create the segments string for a URL.\n\n Returns\n -------\n str\n Segments for a URL.\n '
return prepend('/'.join(segments), '/') | Make the segments portion of a URL.
Parameters
----------
segments : list of str
Segments to use to create the segments string for a URL.
Returns
-------
str
Segments for a URL. | lisc/urls/utils.py | make_segments | ryanhammonds/lisc | 1 | python | def make_segments(segments):
'Make the segments portion of a URL.\n\n Parameters\n ----------\n segments : list of str\n Segments to use to create the segments string for a URL.\n\n Returns\n -------\n str\n Segments for a URL.\n '
return prepend('/'.join(segments), '/') | def make_segments(segments):
'Make the segments portion of a URL.\n\n Parameters\n ----------\n segments : list of str\n Segments to use to create the segments string for a URL.\n\n Returns\n -------\n str\n Segments for a URL.\n '
return prepend('/'.join(segments), '/')<|docs... |
49827c99f46937d9e3e814080b27fd892ccc7a5af9e8895a8fca99c995c24e17 | def make_settings(settings, prefix='?'):
'Make the settings portion of a URL.\n\n Parameters\n ----------\n settings : dict\n Settings to use to create the settings string for a URL.\n prefix : str\n String to add to the beginning.\n\n Returns\n -------\n str\n Setting for ... | Make the settings portion of a URL.
Parameters
----------
settings : dict
Settings to use to create the settings string for a URL.
prefix : str
String to add to the beginning.
Returns
-------
str
Setting for a URL. | lisc/urls/utils.py | make_settings | ryanhammonds/lisc | 1 | python | def make_settings(settings, prefix='?'):
'Make the settings portion of a URL.\n\n Parameters\n ----------\n settings : dict\n Settings to use to create the settings string for a URL.\n prefix : str\n String to add to the beginning.\n\n Returns\n -------\n str\n Setting for ... | def make_settings(settings, prefix='?'):
'Make the settings portion of a URL.\n\n Parameters\n ----------\n settings : dict\n Settings to use to create the settings string for a URL.\n prefix : str\n String to add to the beginning.\n\n Returns\n -------\n str\n Setting for ... |
af8886982bb75e97d3d125c607cbc3d8b1cfd3ea849c083223750df616e39f4a | def _compute_attention(attention_mechanism, cell_output, attention_state, attention_layer, prev_max_attentions):
'Computes the attention and alignments for a given attention_mechanism.'
(alignments, next_attention_state, max_attentions) = attention_mechanism(cell_output, state=attention_state, prev_max_attentio... | Computes the attention and alignments for a given attention_mechanism. | tacotron/models/attention.py | _compute_attention | huangdou123/huangdou | 2,154 | python | def _compute_attention(attention_mechanism, cell_output, attention_state, attention_layer, prev_max_attentions):
(alignments, next_attention_state, max_attentions) = attention_mechanism(cell_output, state=attention_state, prev_max_attentions=prev_max_attentions)
expanded_alignments = array_ops.expand_dims(... | def _compute_attention(attention_mechanism, cell_output, attention_state, attention_layer, prev_max_attentions):
(alignments, next_attention_state, max_attentions) = attention_mechanism(cell_output, state=attention_state, prev_max_attentions=prev_max_attentions)
expanded_alignments = array_ops.expand_dims(... |
84e642753a35621d5fdf7106053b78adc012201037b3dce3666b59cbc8a9d82e | def _location_sensitive_score(W_query, W_fil, W_keys):
"Impelements Bahdanau-style (cumulative) scoring function.\n\tThis attention is described in:\n\t\tJ. K. Chorowski, D. Bahdanau, D. Serdyuk, K. Cho, and Y. Ben-\n\t gio, “Attention-based models for speech recognition,” in Ad-\n\t vances in Neural Information ... | Impelements Bahdanau-style (cumulative) scoring function.
This attention is described in:
J. K. Chorowski, D. Bahdanau, D. Serdyuk, K. Cho, and Y. Ben-
gio, “Attention-based models for speech recognition,” in Ad-
vances in Neural Information Processing Systems, 2015, pp.
577–585.
########################... | tacotron/models/attention.py | _location_sensitive_score | huangdou123/huangdou | 2,154 | python | def _location_sensitive_score(W_query, W_fil, W_keys):
"Impelements Bahdanau-style (cumulative) scoring function.\n\tThis attention is described in:\n\t\tJ. K. Chorowski, D. Bahdanau, D. Serdyuk, K. Cho, and Y. Ben-\n\t gio, “Attention-based models for speech recognition,” in Ad-\n\t vances in Neural Information ... | def _location_sensitive_score(W_query, W_fil, W_keys):
"Impelements Bahdanau-style (cumulative) scoring function.\n\tThis attention is described in:\n\t\tJ. K. Chorowski, D. Bahdanau, D. Serdyuk, K. Cho, and Y. Ben-\n\t gio, “Attention-based models for speech recognition,” in Ad-\n\t vances in Neural Information ... |
01ce2e0db624b3d54e64dd3832729985860aac8cbaec07009b5d1af0bd8925a1 | def _smoothing_normalization(e):
'Applies a smoothing normalization function instead of softmax\n\tIntroduced in:\n\t\tJ. K. Chorowski, D. Bahdanau, D. Serdyuk, K. Cho, and Y. Ben-\n\t gio, “Attention-based models for speech recognition,” in Ad-\n\t vances in Neural Information Processing Systems, 2015, pp.\n\t ... | Applies a smoothing normalization function instead of softmax
Introduced in:
J. K. Chorowski, D. Bahdanau, D. Serdyuk, K. Cho, and Y. Ben-
gio, “Attention-based models for speech recognition,” in Ad-
vances in Neural Information Processing Systems, 2015, pp.
577–585.
#####################################... | tacotron/models/attention.py | _smoothing_normalization | huangdou123/huangdou | 2,154 | python | def _smoothing_normalization(e):
'Applies a smoothing normalization function instead of softmax\n\tIntroduced in:\n\t\tJ. K. Chorowski, D. Bahdanau, D. Serdyuk, K. Cho, and Y. Ben-\n\t gio, “Attention-based models for speech recognition,” in Ad-\n\t vances in Neural Information Processing Systems, 2015, pp.\n\t ... | def _smoothing_normalization(e):
'Applies a smoothing normalization function instead of softmax\n\tIntroduced in:\n\t\tJ. K. Chorowski, D. Bahdanau, D. Serdyuk, K. Cho, and Y. Ben-\n\t gio, “Attention-based models for speech recognition,” in Ad-\n\t vances in Neural Information Processing Systems, 2015, pp.\n\t ... |
b3df7a47f97f9e017dc0324cdb81a6551ac87278867448e3bba710463d753d6a | def __init__(self, num_units, memory, hparams, is_training, mask_encoder=True, memory_sequence_length=None, smoothing=False, cumulate_weights=True, name='LocationSensitiveAttention'):
"Construct the Attention mechanism.\n\t\tArgs:\n\t\t\tnum_units: The depth of the query mechanism.\n\t\t\tmemory: The memory to quer... | Construct the Attention mechanism.
Args:
num_units: The depth of the query mechanism.
memory: The memory to query; usually the output of an RNN encoder. This
tensor should be shaped `[batch_size, max_time, ...]`.
mask_encoder (optional): Boolean, whether to mask encoder paddings... | tacotron/models/attention.py | __init__ | huangdou123/huangdou | 2,154 | python | def __init__(self, num_units, memory, hparams, is_training, mask_encoder=True, memory_sequence_length=None, smoothing=False, cumulate_weights=True, name='LocationSensitiveAttention'):
"Construct the Attention mechanism.\n\t\tArgs:\n\t\t\tnum_units: The depth of the query mechanism.\n\t\t\tmemory: The memory to quer... | def __init__(self, num_units, memory, hparams, is_training, mask_encoder=True, memory_sequence_length=None, smoothing=False, cumulate_weights=True, name='LocationSensitiveAttention'):
"Construct the Attention mechanism.\n\t\tArgs:\n\t\t\tnum_units: The depth of the query mechanism.\n\t\t\tmemory: The memory to quer... |
e8e952b117bc3a20b91e545899411936232f1a088033dadb40de61f7e4b9b154 | def __call__(self, query, state, prev_max_attentions):
"Score the query based on the keys and values.\n\t\tArgs:\n\t\t\tquery: Tensor of dtype matching `self.values` and shape\n\t\t\t\t`[batch_size, query_depth]`.\n\t\t\tstate (previous alignments): Tensor of dtype matching `self.values` and shape\n\t\t\t\t`[batch_... | Score the query based on the keys and values.
Args:
query: Tensor of dtype matching `self.values` and shape
`[batch_size, query_depth]`.
state (previous alignments): Tensor of dtype matching `self.values` and shape
`[batch_size, alignments_size]`
(`alignme... | tacotron/models/attention.py | __call__ | huangdou123/huangdou | 2,154 | python | def __call__(self, query, state, prev_max_attentions):
"Score the query based on the keys and values.\n\t\tArgs:\n\t\t\tquery: Tensor of dtype matching `self.values` and shape\n\t\t\t\t`[batch_size, query_depth]`.\n\t\t\tstate (previous alignments): Tensor of dtype matching `self.values` and shape\n\t\t\t\t`[batch_... | def __call__(self, query, state, prev_max_attentions):
"Score the query based on the keys and values.\n\t\tArgs:\n\t\t\tquery: Tensor of dtype matching `self.values` and shape\n\t\t\t\t`[batch_size, query_depth]`.\n\t\t\tstate (previous alignments): Tensor of dtype matching `self.values` and shape\n\t\t\t\t`[batch_... |
402f434b1c982001ee1d2aeaf7fc7475b6df415451d56bd85e27bf5d619b01a0 | def __init__(self, *, id_: Optional[FhirId]=None, meta: Optional[Meta]=None, implicitRules: Optional[FhirUri]=None, language: Optional[CommonLanguagesCode]=None, text: Optional[Narrative]=None, contained: Optional[FhirList[ResourceContainer]]=None, extension: Optional[FhirList[ExtensionBase]]=None, modifierExtension: O... | The RiskEvidenceSynthesis resource describes the likelihood of an outcome in a
population plus exposure state where the risk estimate is derived from a
combination of research studies.
If the element is present, it must have either a @value, an @id, or extensions
:param id_: The logical id of the resource, as ... | spark_auto_mapper_fhir/resources/risk_evidence_synthesis.py | __init__ | icanbwell/SparkAutoMapper.FHIR | 1 | python | def __init__(self, *, id_: Optional[FhirId]=None, meta: Optional[Meta]=None, implicitRules: Optional[FhirUri]=None, language: Optional[CommonLanguagesCode]=None, text: Optional[Narrative]=None, contained: Optional[FhirList[ResourceContainer]]=None, extension: Optional[FhirList[ExtensionBase]]=None, modifierExtension: O... | def __init__(self, *, id_: Optional[FhirId]=None, meta: Optional[Meta]=None, implicitRules: Optional[FhirUri]=None, language: Optional[CommonLanguagesCode]=None, text: Optional[Narrative]=None, contained: Optional[FhirList[ResourceContainer]]=None, extension: Optional[FhirList[ExtensionBase]]=None, modifierExtension: O... |
93aa22867e4422b26821cbbf9a334815f6366ff45424c6a3aab9c132ab4042d9 | def key_from_ireq(ireq: InstallRequirement) -> str:
'Get a standardized key for an InstallRequirement.'
if ((ireq.req is None) and (ireq.link is not None)):
return str(ireq.link)
else:
return key_from_req(ireq.req) | Get a standardized key for an InstallRequirement. | piptools/utils.py | key_from_ireq | ssiano/pip-tools | 2 | python | def key_from_ireq(ireq: InstallRequirement) -> str:
if ((ireq.req is None) and (ireq.link is not None)):
return str(ireq.link)
else:
return key_from_req(ireq.req) | def key_from_ireq(ireq: InstallRequirement) -> str:
if ((ireq.req is None) and (ireq.link is not None)):
return str(ireq.link)
else:
return key_from_req(ireq.req)<|docstring|>Get a standardized key for an InstallRequirement.<|endoftext|> |
1c99efb7a56979e9ff6de0741d131a2b190c221949019b40103eb39bb59796bc | def key_from_req(req: InstallRequirement) -> str:
"Get an all-lowercase version of the requirement's name."
if hasattr(req, 'key'):
key = req.key
else:
key = req.name
assert isinstance(key, str)
key = key.replace('_', '-').lower()
return key | Get an all-lowercase version of the requirement's name. | piptools/utils.py | key_from_req | ssiano/pip-tools | 2 | python | def key_from_req(req: InstallRequirement) -> str:
if hasattr(req, 'key'):
key = req.key
else:
key = req.name
assert isinstance(key, str)
key = key.replace('_', '-').lower()
return key | def key_from_req(req: InstallRequirement) -> str:
if hasattr(req, 'key'):
key = req.key
else:
key = req.name
assert isinstance(key, str)
key = key.replace('_', '-').lower()
return key<|docstring|>Get an all-lowercase version of the requirement's name.<|endoftext|> |
a97405221d3298816ece024f9f8d2719ce882bd8419ae3e7dab476afc32326f4 | def is_url_requirement(ireq: InstallRequirement) -> bool:
'\n Return True if requirement was specified as a path or URL.\n ireq.original_link will have been set by InstallRequirement.__init__\n '
return bool(ireq.original_link) | Return True if requirement was specified as a path or URL.
ireq.original_link will have been set by InstallRequirement.__init__ | piptools/utils.py | is_url_requirement | ssiano/pip-tools | 2 | python | def is_url_requirement(ireq: InstallRequirement) -> bool:
'\n Return True if requirement was specified as a path or URL.\n ireq.original_link will have been set by InstallRequirement.__init__\n '
return bool(ireq.original_link) | def is_url_requirement(ireq: InstallRequirement) -> bool:
'\n Return True if requirement was specified as a path or URL.\n ireq.original_link will have been set by InstallRequirement.__init__\n '
return bool(ireq.original_link)<|docstring|>Return True if requirement was specified as a path or URL.
ireq... |
90e1300d9ba7ef928759b6a6cf298446f8d36b0c3fa344eae23f1705f5d639cc | def format_requirement(ireq: InstallRequirement, marker: Optional[Marker]=None, hashes: Optional[Set[str]]=None) -> str:
'\n Generic formatter for pretty printing InstallRequirements to the terminal\n in a less verbose way than using its `__str__` method.\n '
if ireq.editable:
line = f'-e {ireq... | Generic formatter for pretty printing InstallRequirements to the terminal
in a less verbose way than using its `__str__` method. | piptools/utils.py | format_requirement | ssiano/pip-tools | 2 | python | def format_requirement(ireq: InstallRequirement, marker: Optional[Marker]=None, hashes: Optional[Set[str]]=None) -> str:
'\n Generic formatter for pretty printing InstallRequirements to the terminal\n in a less verbose way than using its `__str__` method.\n '
if ireq.editable:
line = f'-e {ireq... | def format_requirement(ireq: InstallRequirement, marker: Optional[Marker]=None, hashes: Optional[Set[str]]=None) -> str:
'\n Generic formatter for pretty printing InstallRequirements to the terminal\n in a less verbose way than using its `__str__` method.\n '
if ireq.editable:
line = f'-e {ireq... |
3081c1402b147cd0f26a025073914281fd4d53d8a49473c93af5783dce0402dd | def format_specifier(ireq: InstallRequirement) -> str:
'\n Generic formatter for pretty printing the specifier part of\n InstallRequirements to the terminal.\n '
specs = (ireq.specifier if (ireq.req is not None) else SpecifierSet())
specs = sorted(specs, key=(lambda x: x.version))
return (','.j... | Generic formatter for pretty printing the specifier part of
InstallRequirements to the terminal. | piptools/utils.py | format_specifier | ssiano/pip-tools | 2 | python | def format_specifier(ireq: InstallRequirement) -> str:
'\n Generic formatter for pretty printing the specifier part of\n InstallRequirements to the terminal.\n '
specs = (ireq.specifier if (ireq.req is not None) else SpecifierSet())
specs = sorted(specs, key=(lambda x: x.version))
return (','.j... | def format_specifier(ireq: InstallRequirement) -> str:
'\n Generic formatter for pretty printing the specifier part of\n InstallRequirements to the terminal.\n '
specs = (ireq.specifier if (ireq.req is not None) else SpecifierSet())
specs = sorted(specs, key=(lambda x: x.version))
return (','.j... |
d1d31a9d5ea879150e8f17aadfacde138fdbfe9afa175c8995ce299975b80141 | def is_pinned_requirement(ireq: InstallRequirement) -> bool:
'\n Returns whether an InstallRequirement is a "pinned" requirement.\n\n An InstallRequirement is considered pinned if:\n\n - Is not editable\n - It has exactly one specifier\n - That specifier is "=="\n - The version does not contain a ... | Returns whether an InstallRequirement is a "pinned" requirement.
An InstallRequirement is considered pinned if:
- Is not editable
- It has exactly one specifier
- That specifier is "=="
- The version does not contain a wildcard
Examples:
django==1.8 # pinned
django>1.8 # NOT pinned
django~=1.8 # N... | piptools/utils.py | is_pinned_requirement | ssiano/pip-tools | 2 | python | def is_pinned_requirement(ireq: InstallRequirement) -> bool:
'\n Returns whether an InstallRequirement is a "pinned" requirement.\n\n An InstallRequirement is considered pinned if:\n\n - Is not editable\n - It has exactly one specifier\n - That specifier is "=="\n - The version does not contain a ... | def is_pinned_requirement(ireq: InstallRequirement) -> bool:
'\n Returns whether an InstallRequirement is a "pinned" requirement.\n\n An InstallRequirement is considered pinned if:\n\n - Is not editable\n - It has exactly one specifier\n - That specifier is "=="\n - The version does not contain a ... |
adb22cf621ec0d1f3024bd86b08154e8f6caf84defb6f2e58f7d0398fc5523fd | def as_tuple(ireq: InstallRequirement) -> Tuple[(str, str, Tuple[(str, ...)])]:
'\n Pulls out the (name: str, version:str, extras:(str)) tuple from\n the pinned InstallRequirement.\n '
if (not is_pinned_requirement(ireq)):
raise TypeError(f'Expected a pinned InstallRequirement, got {ireq}')
... | Pulls out the (name: str, version:str, extras:(str)) tuple from
the pinned InstallRequirement. | piptools/utils.py | as_tuple | ssiano/pip-tools | 2 | python | def as_tuple(ireq: InstallRequirement) -> Tuple[(str, str, Tuple[(str, ...)])]:
'\n Pulls out the (name: str, version:str, extras:(str)) tuple from\n the pinned InstallRequirement.\n '
if (not is_pinned_requirement(ireq)):
raise TypeError(f'Expected a pinned InstallRequirement, got {ireq}')
... | def as_tuple(ireq: InstallRequirement) -> Tuple[(str, str, Tuple[(str, ...)])]:
'\n Pulls out the (name: str, version:str, extras:(str)) tuple from\n the pinned InstallRequirement.\n '
if (not is_pinned_requirement(ireq)):
raise TypeError(f'Expected a pinned InstallRequirement, got {ireq}')
... |
7c396ab1ad8b640b66ae76ce7bd82ce8a948aaf8a768cedd5390acf34b62c7e4 | def flat_map(fn: Callable[([_T], Iterable[_S])], collection: Iterable[_T]) -> Iterator[_S]:
'Map a function over a collection and flatten the result by one-level'
return itertools.chain.from_iterable(map(fn, collection)) | Map a function over a collection and flatten the result by one-level | piptools/utils.py | flat_map | ssiano/pip-tools | 2 | python | def flat_map(fn: Callable[([_T], Iterable[_S])], collection: Iterable[_T]) -> Iterator[_S]:
return itertools.chain.from_iterable(map(fn, collection)) | def flat_map(fn: Callable[([_T], Iterable[_S])], collection: Iterable[_T]) -> Iterator[_S]:
return itertools.chain.from_iterable(map(fn, collection))<|docstring|>Map a function over a collection and flatten the result by one-level<|endoftext|> |
ebb3df47efba3d47e0ec42559d7e4045a6a590e665fd7ab323c586d180384e2b | def lookup_table_from_tuples(values: Iterable[Tuple[(_KT, _VT)]]) -> Dict[(_KT, Set[_VT])]:
'\n Builds a dict-based lookup table (index) elegantly.\n '
lut: Dict[(_KT, Set[_VT])] = collections.defaultdict(set)
for (k, v) in values:
lut[k].add(v)
return dict(lut) | Builds a dict-based lookup table (index) elegantly. | piptools/utils.py | lookup_table_from_tuples | ssiano/pip-tools | 2 | python | def lookup_table_from_tuples(values: Iterable[Tuple[(_KT, _VT)]]) -> Dict[(_KT, Set[_VT])]:
'\n \n '
lut: Dict[(_KT, Set[_VT])] = collections.defaultdict(set)
for (k, v) in values:
lut[k].add(v)
return dict(lut) | def lookup_table_from_tuples(values: Iterable[Tuple[(_KT, _VT)]]) -> Dict[(_KT, Set[_VT])]:
'\n \n '
lut: Dict[(_KT, Set[_VT])] = collections.defaultdict(set)
for (k, v) in values:
lut[k].add(v)
return dict(lut)<|docstring|>Builds a dict-based lookup table (index) elegantly.<|endoftext|> |
51d79129fed6b69c8b90bf2a9a4c3d0de5c032e7bd499434ab842761ea368a0b | def lookup_table(values: Iterable[_VT], key: Callable[([_VT], _KT)]) -> Dict[(_KT, Set[_VT])]:
'\n Builds a dict-based lookup table (index) elegantly.\n '
return lookup_table_from_tuples(((key(v), v) for v in values)) | Builds a dict-based lookup table (index) elegantly. | piptools/utils.py | lookup_table | ssiano/pip-tools | 2 | python | def lookup_table(values: Iterable[_VT], key: Callable[([_VT], _KT)]) -> Dict[(_KT, Set[_VT])]:
'\n \n '
return lookup_table_from_tuples(((key(v), v) for v in values)) | def lookup_table(values: Iterable[_VT], key: Callable[([_VT], _KT)]) -> Dict[(_KT, Set[_VT])]:
'\n \n '
return lookup_table_from_tuples(((key(v), v) for v in values))<|docstring|>Builds a dict-based lookup table (index) elegantly.<|endoftext|> |
eb90a70998efba68ab3467a36a0275abda25e3f4c5b69970f3794f86b349c751 | def dedup(iterable: Iterable[_T]) -> Iterable[_T]:
'Deduplicate an iterable object like iter(set(iterable)) but\n order-preserved.\n '
return iter(dict.fromkeys(iterable)) | Deduplicate an iterable object like iter(set(iterable)) but
order-preserved. | piptools/utils.py | dedup | ssiano/pip-tools | 2 | python | def dedup(iterable: Iterable[_T]) -> Iterable[_T]:
'Deduplicate an iterable object like iter(set(iterable)) but\n order-preserved.\n '
return iter(dict.fromkeys(iterable)) | def dedup(iterable: Iterable[_T]) -> Iterable[_T]:
'Deduplicate an iterable object like iter(set(iterable)) but\n order-preserved.\n '
return iter(dict.fromkeys(iterable))<|docstring|>Deduplicate an iterable object like iter(set(iterable)) but
order-preserved.<|endoftext|> |
93eb8f07c9fa97dac2b18a73de9d3cdb0bfbeb522797c617f5403a680df77e42 | def drop_extras(ireq: InstallRequirement) -> None:
'Remove "extra" markers (PEP-508) from requirement.'
if (ireq.markers is None):
return
ireq.markers._markers = _drop_extras(ireq.markers._markers)
if (not ireq.markers._markers):
ireq.markers = None | Remove "extra" markers (PEP-508) from requirement. | piptools/utils.py | drop_extras | ssiano/pip-tools | 2 | python | def drop_extras(ireq: InstallRequirement) -> None:
if (ireq.markers is None):
return
ireq.markers._markers = _drop_extras(ireq.markers._markers)
if (not ireq.markers._markers):
ireq.markers = None | def drop_extras(ireq: InstallRequirement) -> None:
if (ireq.markers is None):
return
ireq.markers._markers = _drop_extras(ireq.markers._markers)
if (not ireq.markers._markers):
ireq.markers = None<|docstring|>Remove "extra" markers (PEP-508) from requirement.<|endoftext|> |
9333f707ad6b3b49bdeb91badac6cfa2103d486fe2a5d6fc990489a175cd4ddd | def get_hashes_from_ireq(ireq: InstallRequirement) -> Set[str]:
'\n Given an InstallRequirement, return a set of string hashes in the format\n "{algorithm}:{hash}". Return an empty set if there are no hashes in the\n requirement options.\n '
result = set()
for (algorithm, hexdigests) in ireq.has... | Given an InstallRequirement, return a set of string hashes in the format
"{algorithm}:{hash}". Return an empty set if there are no hashes in the
requirement options. | piptools/utils.py | get_hashes_from_ireq | ssiano/pip-tools | 2 | python | def get_hashes_from_ireq(ireq: InstallRequirement) -> Set[str]:
'\n Given an InstallRequirement, return a set of string hashes in the format\n "{algorithm}:{hash}". Return an empty set if there are no hashes in the\n requirement options.\n '
result = set()
for (algorithm, hexdigests) in ireq.has... | def get_hashes_from_ireq(ireq: InstallRequirement) -> Set[str]:
'\n Given an InstallRequirement, return a set of string hashes in the format\n "{algorithm}:{hash}". Return an empty set if there are no hashes in the\n requirement options.\n '
result = set()
for (algorithm, hexdigests) in ireq.has... |
bb931e9eb0dc729b267c7d5edd26e58e71cbb63e392013aa37fc5131a464ce16 | def get_compile_command(click_ctx: click.Context) -> str:
"\n Returns a normalized compile command depending on cli context.\n\n The command will be normalized by:\n - expanding options short to long\n - removing values that are already default\n - sorting the arguments\n - removin... | Returns a normalized compile command depending on cli context.
The command will be normalized by:
- expanding options short to long
- removing values that are already default
- sorting the arguments
- removing one-off arguments like '--upgrade'
- removing arguments that don't change build behaviour... | piptools/utils.py | get_compile_command | ssiano/pip-tools | 2 | python | def get_compile_command(click_ctx: click.Context) -> str:
"\n Returns a normalized compile command depending on cli context.\n\n The command will be normalized by:\n - expanding options short to long\n - removing values that are already default\n - sorting the arguments\n - removin... | def get_compile_command(click_ctx: click.Context) -> str:
"\n Returns a normalized compile command depending on cli context.\n\n The command will be normalized by:\n - expanding options short to long\n - removing values that are already default\n - sorting the arguments\n - removin... |
7d3cf7f7ba7f8778d823e6fcac2f6a18cd241cd616a9fd4481c32f8e25978419 | def get_required_pip_specification() -> SpecifierSet:
'\n Returns pip version specifier requested by current pip-tools installation.\n '
project_dist = get_distribution('pip-tools')
requirement = next((r for r in project_dist.requires() if (r.name == 'pip')), None)
assert (requirement is not None)... | Returns pip version specifier requested by current pip-tools installation. | piptools/utils.py | get_required_pip_specification | ssiano/pip-tools | 2 | python | def get_required_pip_specification() -> SpecifierSet:
'\n \n '
project_dist = get_distribution('pip-tools')
requirement = next((r for r in project_dist.requires() if (r.name == 'pip')), None)
assert (requirement is not None), "'pip' is expected to be in the list of pip-tools requirements"
retu... | def get_required_pip_specification() -> SpecifierSet:
'\n \n '
project_dist = get_distribution('pip-tools')
requirement = next((r for r in project_dist.requires() if (r.name == 'pip')), None)
assert (requirement is not None), "'pip' is expected to be in the list of pip-tools requirements"
retu... |
e2ff1c72c89952e81b3a941bedd8886b3131a041d010795a11d4b913ee854014 | def get_pip_version_for_python_executable(python_executable: str) -> Version:
'\n Returns pip version for the given python executable.\n '
str_version = run_python_snippet(python_executable, 'import pip;print(pip.__version__)')
return Version(str_version) | Returns pip version for the given python executable. | piptools/utils.py | get_pip_version_for_python_executable | ssiano/pip-tools | 2 | python | def get_pip_version_for_python_executable(python_executable: str) -> Version:
'\n \n '
str_version = run_python_snippet(python_executable, 'import pip;print(pip.__version__)')
return Version(str_version) | def get_pip_version_for_python_executable(python_executable: str) -> Version:
'\n \n '
str_version = run_python_snippet(python_executable, 'import pip;print(pip.__version__)')
return Version(str_version)<|docstring|>Returns pip version for the given python executable.<|endoftext|> |
c6952a921947229508ed97fabab35845d1b74bb3cb9def8188d76d82870e0099 | def get_sys_path_for_python_executable(python_executable: str) -> List[str]:
'\n Returns sys.path list for the given python executable.\n '
result = run_python_snippet(python_executable, 'import sys;import json;print(json.dumps(sys.path))')
paths = json.loads(result)
assert isinstance(paths, list)... | Returns sys.path list for the given python executable. | piptools/utils.py | get_sys_path_for_python_executable | ssiano/pip-tools | 2 | python | def get_sys_path_for_python_executable(python_executable: str) -> List[str]:
'\n \n '
result = run_python_snippet(python_executable, 'import sys;import json;print(json.dumps(sys.path))')
paths = json.loads(result)
assert isinstance(paths, list)
assert all((isinstance(i, str) for i in paths))
... | def get_sys_path_for_python_executable(python_executable: str) -> List[str]:
'\n \n '
result = run_python_snippet(python_executable, 'import sys;import json;print(json.dumps(sys.path))')
paths = json.loads(result)
assert isinstance(paths, list)
assert all((isinstance(i, str) for i in paths))
... |
7729409e782a067b2dff2bfb338b9091bf86203ad8384008bb78145e56e04e3c | def update_metadata(manuscript: BnF) -> None:
'\n Update /m-k-manuscript-data/metadata/entry_metadata.csv with the current manuscript. Create a Pandas DataFrame\n indexed by entry. Create data columns, and remove the column that contains the entry objects. Save File.\n\n Input:\n manuscript -- Python object o... | Update /m-k-manuscript-data/metadata/entry_metadata.csv with the current manuscript. Create a Pandas DataFrame
indexed by entry. Create data columns, and remove the column that contains the entry objects. Save File.
Input:
manuscript -- Python object of the manuscript defined in digital_manuscript.py
Output:
None | ronikaufman_sp21_semantic-visualizations/update.py | update_metadata | cu-mkp/sandbox-projects | 0 | python | def update_metadata(manuscript: BnF) -> None:
'\n Update /m-k-manuscript-data/metadata/entry_metadata.csv with the current manuscript. Create a Pandas DataFrame\n indexed by entry. Create data columns, and remove the column that contains the entry objects. Save File.\n\n Input:\n manuscript -- Python object o... | def update_metadata(manuscript: BnF) -> None:
'\n Update /m-k-manuscript-data/metadata/entry_metadata.csv with the current manuscript. Create a Pandas DataFrame\n indexed by entry. Create data columns, and remove the column that contains the entry objects. Save File.\n\n Input:\n manuscript -- Python object o... |
3bb2610ab679e9b49b7479da2610eed1cf8d83fa30352d3a44f4a8959c928ed7 | def update_entries(manuscript: BnF) -> None:
'\n Update /m-k-manuscript-data/entries/ with the current manuscript from /ms-xml/. For each version, delete all existing\n entries. Regenerate folio text entry by entry, and save the file.\n\n Input:\n manuscript -- Python object of the manuscript defined in digit... | Update /m-k-manuscript-data/entries/ with the current manuscript from /ms-xml/. For each version, delete all existing
entries. Regenerate folio text entry by entry, and save the file.
Input:
manuscript -- Python object of the manuscript defined in digital_manuscript.py
Output:
None | ronikaufman_sp21_semantic-visualizations/update.py | update_entries | cu-mkp/sandbox-projects | 0 | python | def update_entries(manuscript: BnF) -> None:
'\n Update /m-k-manuscript-data/entries/ with the current manuscript from /ms-xml/. For each version, delete all existing\n entries. Regenerate folio text entry by entry, and save the file.\n\n Input:\n manuscript -- Python object of the manuscript defined in digit... | def update_entries(manuscript: BnF) -> None:
'\n Update /m-k-manuscript-data/entries/ with the current manuscript from /ms-xml/. For each version, delete all existing\n entries. Regenerate folio text entry by entry, and save the file.\n\n Input:\n manuscript -- Python object of the manuscript defined in digit... |
d63517e6089f147a7a846881c31bc0c68b07fd13977bc152a2c9ea97dd2aefd8 | def update_all_folios(manuscript: BnF) -> None:
'\n Update /m-k-manuscript-data/allFolios/ with the current manuscript from /ms-xml/.\n\n Input:\n manuscript -- Python object of the manuscript defined in digital_manuscript.py\n Output:\n None\n '
for b in [True, False]:
for version in versions... | Update /m-k-manuscript-data/allFolios/ with the current manuscript from /ms-xml/.
Input:
manuscript -- Python object of the manuscript defined in digital_manuscript.py
Output:
None | ronikaufman_sp21_semantic-visualizations/update.py | update_all_folios | cu-mkp/sandbox-projects | 0 | python | def update_all_folios(manuscript: BnF) -> None:
'\n Update /m-k-manuscript-data/allFolios/ with the current manuscript from /ms-xml/.\n\n Input:\n manuscript -- Python object of the manuscript defined in digital_manuscript.py\n Output:\n None\n '
for b in [True, False]:
for version in versions... | def update_all_folios(manuscript: BnF) -> None:
'\n Update /m-k-manuscript-data/allFolios/ with the current manuscript from /ms-xml/.\n\n Input:\n manuscript -- Python object of the manuscript defined in digital_manuscript.py\n Output:\n None\n '
for b in [True, False]:
for version in versions... |
b9fb38fd24ca2e4955fa8ec811f1a4ab43991d058b817de663677901a5c328e6 | def update_time():
' Extract timestamp at the top of this file and update it. '
now_str = str(datetime.now()).split(' ')[0]
lines = []
with open('./update.py', 'r') as f:
lines = f.read().split('\n')
lines[0] = f'# Last Updated | {now_str}'
f = open('./update.py', 'w')
f.write('\... | Extract timestamp at the top of this file and update it. | ronikaufman_sp21_semantic-visualizations/update.py | update_time | cu-mkp/sandbox-projects | 0 | python | def update_time():
' '
now_str = str(datetime.now()).split(' ')[0]
lines = []
with open('./update.py', 'r') as f:
lines = f.read().split('\n')
lines[0] = f'# Last Updated | {now_str}'
f = open('./update.py', 'w')
f.write('\n'.join(lines))
f.close | def update_time():
' '
now_str = str(datetime.now()).split(' ')[0]
lines = []
with open('./update.py', 'r') as f:
lines = f.read().split('\n')
lines[0] = f'# Last Updated | {now_str}'
f = open('./update.py', 'w')
f.write('\n'.join(lines))
f.close<|docstring|>Extract timestam... |
f3565e334dca84ecd02cbf305aca284b4aa7d2502129706d70cc28a0f7284878 | def main():
"\n testing to see how the assignment's datafile is organized:\n zip,eiaid,utility_name,state,service_type,ownership,comm_rate,ind_rate,res_rate\n zip = [0]\n name = [2]\n state = [3]\n comm_rate = [6]\n "
cumulative_rate_sum = 0
num_of_rates = 0
file_to_use = '/home/cs2... | testing to see how the assignment's datafile is organized:
zip,eiaid,utility_name,state,service_type,ownership,comm_rate,ind_rate,res_rate
zip = [0]
name = [2]
state = [3]
comm_rate = [6] | test02.py | main | Millwr1ght/cs-241 | 0 | python | def main():
"\n testing to see how the assignment's datafile is organized:\n zip,eiaid,utility_name,state,service_type,ownership,comm_rate,ind_rate,res_rate\n zip = [0]\n name = [2]\n state = [3]\n comm_rate = [6]\n "
cumulative_rate_sum = 0
num_of_rates = 0
file_to_use = '/home/cs2... | def main():
"\n testing to see how the assignment's datafile is organized:\n zip,eiaid,utility_name,state,service_type,ownership,comm_rate,ind_rate,res_rate\n zip = [0]\n name = [2]\n state = [3]\n comm_rate = [6]\n "
cumulative_rate_sum = 0
num_of_rates = 0
file_to_use = '/home/cs2... |
3941e7ac80fcea384bea4b1e551fedde66662e251de6c5e1d71f9fd4ebba089d | def parse_headers_and_body_with_django(headers, body):
'Parse `headers` and `body` with Django\'s :class:`MultiPartParser`.\n\n `MultiPartParser` is a curiously ugly and RFC non-compliant concoction.\n\n Amongst other things, it coerces all field names, field data, and\n filenames into Unicode strings usin... | Parse `headers` and `body` with Django's :class:`MultiPartParser`.
`MultiPartParser` is a curiously ugly and RFC non-compliant concoction.
Amongst other things, it coerces all field names, field data, and
filenames into Unicode strings using the "replace" error strategy, so be
warned that your data may be silently ma... | _modules/testing/django.py | parse_headers_and_body_with_django | Perceptyx/salt-formula-maas | 6 | python | def parse_headers_and_body_with_django(headers, body):
'Parse `headers` and `body` with Django\'s :class:`MultiPartParser`.\n\n `MultiPartParser` is a curiously ugly and RFC non-compliant concoction.\n\n Amongst other things, it coerces all field names, field data, and\n filenames into Unicode strings usin... | def parse_headers_and_body_with_django(headers, body):
'Parse `headers` and `body` with Django\'s :class:`MultiPartParser`.\n\n `MultiPartParser` is a curiously ugly and RFC non-compliant concoction.\n\n Amongst other things, it coerces all field names, field data, and\n filenames into Unicode strings usin... |
e00f12e978af185d363abfecfe940b067a128d5728e1e341d9513a5e2f5f416a | def parse_headers_and_body_with_mimer(headers, body):
"Use piston's Mimer functionality to handle the content.\n\n :return: The value of 'request.data' after using Piston's translate_mime on\n the input.\n "
from piston import emitters
ignore_unused(emitters)
from piston.utils import transl... | Use piston's Mimer functionality to handle the content.
:return: The value of 'request.data' after using Piston's translate_mime on
the input. | _modules/testing/django.py | parse_headers_and_body_with_mimer | Perceptyx/salt-formula-maas | 6 | python | def parse_headers_and_body_with_mimer(headers, body):
"Use piston's Mimer functionality to handle the content.\n\n :return: The value of 'request.data' after using Piston's translate_mime on\n the input.\n "
from piston import emitters
ignore_unused(emitters)
from piston.utils import transl... | def parse_headers_and_body_with_mimer(headers, body):
"Use piston's Mimer functionality to handle the content.\n\n :return: The value of 'request.data' after using Piston's translate_mime on\n the input.\n "
from piston import emitters
ignore_unused(emitters)
from piston.utils import transl... |
8287130fc609ec6b9d543947c9e3b890765e558c0e2fcf63320b090e0b9815d9 | def process(self, data):
'Plot one SHM data.'
obs = json.loads(data)['result']
nrow = obs['nrow']
ncol = obs['ncols']
lat_0 = obs['lat_0']
lon_0 = obs['lon_0']
dl = obs['cellsize']
data = np.array(obs['data'])
lat = (lat_0 + (np.arange(ncol) * dl))
lon = (lon_0 + (np.arange(nrow)... | Plot one SHM data. | tools/display_maps.py | process | MONICA-Project/sound-heat-map | 1 | python | def process(self, data):
obs = json.loads(data)['result']
nrow = obs['nrow']
ncol = obs['ncols']
lat_0 = obs['lat_0']
lon_0 = obs['lon_0']
dl = obs['cellsize']
data = np.array(obs['data'])
lat = (lat_0 + (np.arange(ncol) * dl))
lon = (lon_0 + (np.arange(nrow) * dl))
(x, y) =... | def process(self, data):
obs = json.loads(data)['result']
nrow = obs['nrow']
ncol = obs['ncols']
lat_0 = obs['lat_0']
lon_0 = obs['lon_0']
dl = obs['cellsize']
data = np.array(obs['data'])
lat = (lat_0 + (np.arange(ncol) * dl))
lon = (lon_0 + (np.arange(nrow) * dl))
(x, y) =... |
9affd8894602bb65f425a2806ad51ace80e2090fe27d678f73f5b2ea757112c3 | def get_files(start_path, a_type=None):
'\n Retrieves a list of directory and sub-directory files containing duplicate\n files. This function simply checks the file name and does not check the file\n size to determine if a copied file is a true copy.\n '
if isinstance(a_type, list):
if (len(... | Retrieves a list of directory and sub-directory files containing duplicate
files. This function simply checks the file name and does not check the file
size to determine if a copied file is a true copy. | deletion/functions.py | get_files | wrenzenzen/python-delete-folder-file-copies | 0 | python | def get_files(start_path, a_type=None):
'\n Retrieves a list of directory and sub-directory files containing duplicate\n files. This function simply checks the file name and does not check the file\n size to determine if a copied file is a true copy.\n '
if isinstance(a_type, list):
if (len(... | def get_files(start_path, a_type=None):
'\n Retrieves a list of directory and sub-directory files containing duplicate\n files. This function simply checks the file name and does not check the file\n size to determine if a copied file is a true copy.\n '
if isinstance(a_type, list):
if (len(... |
378ced0fda82d43a6c003834391a6cb53871aebe4a95992f3190b010687bb710 | def delete_files(removal_list) -> None:
'\n Deletes a list of files with a valid path \n '
print(f'Deleting ({len(removal_list)}) files')
for a_file in removal_list:
try:
os.remove(a_file)
print(a_file, '....deleted')
except:
print(a_file, '....could... | Deletes a list of files with a valid path | deletion/functions.py | delete_files | wrenzenzen/python-delete-folder-file-copies | 0 | python | def delete_files(removal_list) -> None:
'\n \n '
print(f'Deleting ({len(removal_list)}) files')
for a_file in removal_list:
try:
os.remove(a_file)
print(a_file, '....deleted')
except:
print(a_file, '....could not delete') | def delete_files(removal_list) -> None:
'\n \n '
print(f'Deleting ({len(removal_list)}) files')
for a_file in removal_list:
try:
os.remove(a_file)
print(a_file, '....deleted')
except:
print(a_file, '....could not delete')<|docstring|>Deletes a list ... |
e39a3f8fef0fe3e6aba08683b4a48eb7e73c022e6049f9f8486e4ef793af08a2 | def test_standard_prior_generator():
'Test standard prior generator.'
from mmrotate.core.anchor import build_prior_generator
anchor_generator_cfg = dict(type='RotatedAnchorGenerator', scales=[8], ratios=[0.5, 1.0, 2.0], strides=[4, 8])
anchor_generator = build_prior_generator(anchor_generator_cfg)
a... | Test standard prior generator. | tests/test_utils/test_ranchor.py | test_standard_prior_generator | liufeinuaa/mmrotate | 449 | python | def test_standard_prior_generator():
from mmrotate.core.anchor import build_prior_generator
anchor_generator_cfg = dict(type='RotatedAnchorGenerator', scales=[8], ratios=[0.5, 1.0, 2.0], strides=[4, 8])
anchor_generator = build_prior_generator(anchor_generator_cfg)
assert (anchor_generator.num_base... | def test_standard_prior_generator():
from mmrotate.core.anchor import build_prior_generator
anchor_generator_cfg = dict(type='RotatedAnchorGenerator', scales=[8], ratios=[0.5, 1.0, 2.0], strides=[4, 8])
anchor_generator = build_prior_generator(anchor_generator_cfg)
assert (anchor_generator.num_base... |
95e447eccf2944bed9692cff22ee6ded19c592a7eab170b97bb7baa0f3a20c30 | def test_strides():
'Test strides.'
from mmrotate.core import RotatedAnchorGenerator
self = RotatedAnchorGenerator([10], [1.0], [1.0], [10])
anchors = self.grid_priors([(2, 2)], device='cpu')
expected_anchors = torch.tensor([[0.0, 0.0, 10.0, 10.0, 0.0], [10.0, 0.0, 10.0, 10.0, 0.0], [0.0, 10.0, 10.0... | Test strides. | tests/test_utils/test_ranchor.py | test_strides | liufeinuaa/mmrotate | 449 | python | def test_strides():
from mmrotate.core import RotatedAnchorGenerator
self = RotatedAnchorGenerator([10], [1.0], [1.0], [10])
anchors = self.grid_priors([(2, 2)], device='cpu')
expected_anchors = torch.tensor([[0.0, 0.0, 10.0, 10.0, 0.0], [10.0, 0.0, 10.0, 10.0, 0.0], [0.0, 10.0, 10.0, 10.0, 0.0], [... | def test_strides():
from mmrotate.core import RotatedAnchorGenerator
self = RotatedAnchorGenerator([10], [1.0], [1.0], [10])
anchors = self.grid_priors([(2, 2)], device='cpu')
expected_anchors = torch.tensor([[0.0, 0.0, 10.0, 10.0, 0.0], [10.0, 0.0, 10.0, 10.0, 0.0], [0.0, 10.0, 10.0, 10.0, 0.0], [... |
a0d60bb3c102f67aa36308e1a7d024b4935c4053ee00520bc0d6726c41cc00bd | def __init__(self, delay_mean=100, delay_std_dev=10, min_delay=1, max_delay=500, reliability=0.9):
"\n Every message sent into the channel is sent individually to all the receiving processes.\n All units are in milliseconds\n :param delay_mean: mean delay for a message to reach from in end to o... | Every message sent into the channel is sent individually to all the receiving processes.
All units are in milliseconds
:param delay_mean: mean delay for a message to reach from in end to out end
:param delay_std_dev: variation in delay for a message to reach fro in end to out end
:param min_delay: guarantee that the de... | distalg/channel.py | __init__ | abinashmeher999/Distributed-Algorithms | 4 | python | def __init__(self, delay_mean=100, delay_std_dev=10, min_delay=1, max_delay=500, reliability=0.9):
"\n Every message sent into the channel is sent individually to all the receiving processes.\n All units are in milliseconds\n :param delay_mean: mean delay for a message to reach from in end to o... | def __init__(self, delay_mean=100, delay_std_dev=10, min_delay=1, max_delay=500, reliability=0.9):
"\n Every message sent into the channel is sent individually to all the receiving processes.\n All units are in milliseconds\n :param delay_mean: mean delay for a message to reach from in end to o... |
ee76a7f4da05eca157a9e2dc81f4b5fa4d947e4c1bd178eed30325c76edcd2a3 | async def __deliver(self, message):
'\n :param message: The Message object to be delivered\n :return:\n '
sample = random.random()
if (sample >= self.reliability):
return
self.in_transit.add(message)
delay_time = random.gauss(self.delay_mean, self.delay_std_dev)
clam... | :param message: The Message object to be delivered
:return: | distalg/channel.py | __deliver | abinashmeher999/Distributed-Algorithms | 4 | python | async def __deliver(self, message):
'\n :param message: The Message object to be delivered\n :return:\n '
sample = random.random()
if (sample >= self.reliability):
return
self.in_transit.add(message)
delay_time = random.gauss(self.delay_mean, self.delay_std_dev)
clam... | async def __deliver(self, message):
'\n :param message: The Message object to be delivered\n :return:\n '
sample = random.random()
if (sample >= self.reliability):
return
self.in_transit.add(message)
delay_time = random.gauss(self.delay_mean, self.delay_std_dev)
clam... |
d800211c9fbf15c2ab4454288e521ebc336a0af6fd11d9fde032700ca7173e10 | def test_expert(self):
'\n Test Expert difficulty (Tier 2)\n '
URL = 'http://127.0.0.1:8000/war/2'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 2)
self.assertEqual(war_info['difficulty'], 'Expert')
self.assertEqual(war_info['tier_multiplier'], '7.0')
s... | Test Expert difficulty (Tier 2) | uma/api/tests/test_war.py | test_expert | Rexians/uma | 3 | python | def test_expert(self):
'\n \n '
URL = 'http://127.0.0.1:8000/war/2'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 2)
self.assertEqual(war_info['difficulty'], 'Expert')
self.assertEqual(war_info['tier_multiplier'], '7.0')
self.assertEqual(war_info['tier_... | def test_expert(self):
'\n \n '
URL = 'http://127.0.0.1:8000/war/2'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 2)
self.assertEqual(war_info['difficulty'], 'Expert')
self.assertEqual(war_info['tier_multiplier'], '7.0')
self.assertEqual(war_info['tier_... |
1a7b73ab4db8d1a5b3c283e4185f68865a3df8a4edd75becef9a8791f84e04d0 | def test_challenger(self):
'\n Test Challenger difficulty (Tier 4)\n '
URL = 'http://127.0.0.1:8000/war/4'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 4)
self.assertEqual(war_info['difficulty'], 'Challenger')
self.assertEqual(war_info['tier_multiplier'], ... | Test Challenger difficulty (Tier 4) | uma/api/tests/test_war.py | test_challenger | Rexians/uma | 3 | python | def test_challenger(self):
'\n \n '
URL = 'http://127.0.0.1:8000/war/4'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 4)
self.assertEqual(war_info['difficulty'], 'Challenger')
self.assertEqual(war_info['tier_multiplier'], '4.5')
self.assertEqual(war_inf... | def test_challenger(self):
'\n \n '
URL = 'http://127.0.0.1:8000/war/4'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 4)
self.assertEqual(war_info['difficulty'], 'Challenger')
self.assertEqual(war_info['tier_multiplier'], '4.5')
self.assertEqual(war_inf... |
3e3435d9b4ce87d6590cc003dbd1679f9f185911e88054eef00fda7b3deacf33 | def test_hard(self):
'\n Test Hard difficulty (Tier 2)\n '
URL = 'http://127.0.0.1:8000/war/8'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 8)
self.assertEqual(war_info['difficulty'], 'Hard')
self.assertEqual(war_info['tier_multiplier'], '3.0')
self.as... | Test Hard difficulty (Tier 2) | uma/api/tests/test_war.py | test_hard | Rexians/uma | 3 | python | def test_hard(self):
'\n \n '
URL = 'http://127.0.0.1:8000/war/8'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 8)
self.assertEqual(war_info['difficulty'], 'Hard')
self.assertEqual(war_info['tier_multiplier'], '3.0')
self.assertEqual(war_info['tier_rank... | def test_hard(self):
'\n \n '
URL = 'http://127.0.0.1:8000/war/8'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 8)
self.assertEqual(war_info['difficulty'], 'Hard')
self.assertEqual(war_info['tier_multiplier'], '3.0')
self.assertEqual(war_info['tier_rank... |
53524ef7ae7351a976876f5ef10a07bc586034f0af2119e79c926b80cf7f2098 | def test_intermediate(self):
'\n Test Intermediate difficulty (Tier 10)\n '
URL = 'http://127.0.0.1:8000/war/10'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 10)
self.assertEqual(war_info['difficulty'], 'Intermediate')
self.assertEqual(war_info['tier_multi... | Test Intermediate difficulty (Tier 10) | uma/api/tests/test_war.py | test_intermediate | Rexians/uma | 3 | python | def test_intermediate(self):
'\n \n '
URL = 'http://127.0.0.1:8000/war/10'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 10)
self.assertEqual(war_info['difficulty'], 'Intermediate')
self.assertEqual(war_info['tier_multiplier'], '2.4')
self.assertEqual(w... | def test_intermediate(self):
'\n \n '
URL = 'http://127.0.0.1:8000/war/10'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 10)
self.assertEqual(war_info['difficulty'], 'Intermediate')
self.assertEqual(war_info['tier_multiplier'], '2.4')
self.assertEqual(w... |
3f7da2cbb80747931bbffa362ce3d60d3c7a79b0b58ec39f9fb131b730334295 | def test_normal(self):
'\n Test Normal difficulty (Tier 15)\n '
URL = 'http://127.0.0.1:8000/war/15'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 15)
self.assertEqual(war_info['difficulty'], 'Normal')
self.assertEqual(war_info['tier_multiplier'], '1.8')
... | Test Normal difficulty (Tier 15) | uma/api/tests/test_war.py | test_normal | Rexians/uma | 3 | python | def test_normal(self):
'\n \n '
URL = 'http://127.0.0.1:8000/war/15'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 15)
self.assertEqual(war_info['difficulty'], 'Normal')
self.assertEqual(war_info['tier_multiplier'], '1.8')
self.assertEqual(war_info['tie... | def test_normal(self):
'\n \n '
URL = 'http://127.0.0.1:8000/war/15'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 15)
self.assertEqual(war_info['difficulty'], 'Normal')
self.assertEqual(war_info['tier_multiplier'], '1.8')
self.assertEqual(war_info['tie... |
d66d29735aeae889e400c74a1010f7bf2b8ce4890601de25fb25dfe8f97f5d9c | def test_easy(self):
'\n Test Easy difficulty (Tier 21)\n '
URL = 'http://127.0.0.1:8000/war/21'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 21)
self.assertEqual(war_info['difficulty'], 'Easy')
self.assertEqual(war_info['tier_multiplier'], '1.1')
self... | Test Easy difficulty (Tier 21) | uma/api/tests/test_war.py | test_easy | Rexians/uma | 3 | python | def test_easy(self):
'\n \n '
URL = 'http://127.0.0.1:8000/war/21'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 21)
self.assertEqual(war_info['difficulty'], 'Easy')
self.assertEqual(war_info['tier_multiplier'], '1.1')
self.assertEqual(war_info['tier_ra... | def test_easy(self):
'\n \n '
URL = 'http://127.0.0.1:8000/war/21'
war_info = requests.get(URL).json()
self.assertEqual(war_info['tier'], 21)
self.assertEqual(war_info['difficulty'], 'Easy')
self.assertEqual(war_info['tier_multiplier'], '1.1')
self.assertEqual(war_info['tier_ra... |
dfca7081304d9f7ee121250001c72204d546e989d91bc28b7e7fd4b20a19adea | def break_words(stuff):
'This function will break up words for us.'
words = stuff.split(' ')
return words | This function will break up words for us. | Python/Learning/Language/test.py | break_words | prynix/learning-programming | 2 | python | def break_words(stuff):
words = stuff.split(' ')
return words | def break_words(stuff):
words = stuff.split(' ')
return words<|docstring|>This function will break up words for us.<|endoftext|> |
a6e1ee4f7d1a2f1a6dd45991cc6a984c31d5a336ea5a10fcae432c4895c5e829 | def sort_words(words):
'Sorts the words.'
return sorted(words) | Sorts the words. | Python/Learning/Language/test.py | sort_words | prynix/learning-programming | 2 | python | def sort_words(words):
return sorted(words) | def sort_words(words):
return sorted(words)<|docstring|>Sorts the words.<|endoftext|> |
c44259c17df95394c6b3624ec562efd8a7e3869d24066edcaa8ff91760722b3e | def print_first_word(words):
'Prints the first word after popping it off.'
word = words.pop(0)
print(word) | Prints the first word after popping it off. | Python/Learning/Language/test.py | print_first_word | prynix/learning-programming | 2 | python | def print_first_word(words):
word = words.pop(0)
print(word) | def print_first_word(words):
word = words.pop(0)
print(word)<|docstring|>Prints the first word after popping it off.<|endoftext|> |
56a89d52660c37cf5ce3a6b9e312eabb678a633846287bed0c22eda97a363bbb | def print_last_word(words):
'Prints the last word after popping it off.'
word = words.pop((- 1))
print(word) | Prints the last word after popping it off. | Python/Learning/Language/test.py | print_last_word | prynix/learning-programming | 2 | python | def print_last_word(words):
word = words.pop((- 1))
print(word) | def print_last_word(words):
word = words.pop((- 1))
print(word)<|docstring|>Prints the last word after popping it off.<|endoftext|> |
bcad118c4dbc01cee11c53f9fc6b12d2f5d8e9c9415041869f7d759679bc5231 | def sort_sentence(sentence):
'Takes in a full sentence and returns the sorted words.'
words = break_words(sentence)
return sort_words(words) | Takes in a full sentence and returns the sorted words. | Python/Learning/Language/test.py | sort_sentence | prynix/learning-programming | 2 | python | def sort_sentence(sentence):
words = break_words(sentence)
return sort_words(words) | def sort_sentence(sentence):
words = break_words(sentence)
return sort_words(words)<|docstring|>Takes in a full sentence and returns the sorted words.<|endoftext|> |
974a419d5234409764644af9b44a70547d1c22523eb9e2299e9e4337bfa5c9d8 | def print_first_and_last(sentence):
'Prints the first and last words of the sentence.'
words = break_words(sentence)
print_first_word(words)
print_last_word(words) | Prints the first and last words of the sentence. | Python/Learning/Language/test.py | print_first_and_last | prynix/learning-programming | 2 | python | def print_first_and_last(sentence):
words = break_words(sentence)
print_first_word(words)
print_last_word(words) | def print_first_and_last(sentence):
words = break_words(sentence)
print_first_word(words)
print_last_word(words)<|docstring|>Prints the first and last words of the sentence.<|endoftext|> |
8909126637d367924b2eb58284cbc5d742bf2871da805e634e2583a50de3bb8e | def print_first_and_last_sorted(sentence):
'Sorts the words then prints the first and last one.'
words = sort_sentence(sentence)
print_first_word(words)
print_last_word(words) | Sorts the words then prints the first and last one. | Python/Learning/Language/test.py | print_first_and_last_sorted | prynix/learning-programming | 2 | python | def print_first_and_last_sorted(sentence):
words = sort_sentence(sentence)
print_first_word(words)
print_last_word(words) | def print_first_and_last_sorted(sentence):
words = sort_sentence(sentence)
print_first_word(words)
print_last_word(words)<|docstring|>Sorts the words then prints the first and last one.<|endoftext|> |
21f26e0a2de48c40cae28ddf6758ee901ef47111b098d20955b07d18adc0d723 | def __getitem__(self, key):
"\n Make class['foo'] automatically filter for the parameter 'foo'\n Makes the model code much cleaner\n\n :param key: Parameter name\n :type key: str\n :return: `array` filtered after the parameter selected\n "
return self.temp_array.sel(par... | Make class['foo'] automatically filter for the parameter 'foo'
Makes the model code much cleaner
:param key: Parameter name
:type key: str
:return: `array` filtered after the parameter selected | carculator/inventory.py | __getitem__ | rena-nong/carculator | 1 | python | def __getitem__(self, key):
"\n Make class['foo'] automatically filter for the parameter 'foo'\n Makes the model code much cleaner\n\n :param key: Parameter name\n :type key: str\n :return: `array` filtered after the parameter selected\n "
return self.temp_array.sel(par... | def __getitem__(self, key):
"\n Make class['foo'] automatically filter for the parameter 'foo'\n Makes the model code much cleaner\n\n :param key: Parameter name\n :type key: str\n :return: `array` filtered after the parameter selected\n "
return self.temp_array.sel(par... |
e20b2b34cc737a0749a7432ed77839416e1318760028b61da27813ffe80ee0ad | def get_results_table(self, split, sensitivity=False):
'\n Format an xarray.DataArray array to receive the results.\n\n :param split: "components" or "impact categories". Split by impact categories only applicable when "endpoint" level is applied.\n :return: xarrray.DataArray\n '
if ... | Format an xarray.DataArray array to receive the results.
:param split: "components" or "impact categories". Split by impact categories only applicable when "endpoint" level is applied.
:return: xarrray.DataArray | carculator/inventory.py | get_results_table | rena-nong/carculator | 1 | python | def get_results_table(self, split, sensitivity=False):
'\n Format an xarray.DataArray array to receive the results.\n\n :param split: "components" or "impact categories". Split by impact categories only applicable when "endpoint" level is applied.\n :return: xarrray.DataArray\n '
if ... | def get_results_table(self, split, sensitivity=False):
'\n Format an xarray.DataArray array to receive the results.\n\n :param split: "components" or "impact categories". Split by impact categories only applicable when "endpoint" level is applied.\n :return: xarrray.DataArray\n '
if ... |
0ff7728556dd4a89237ad973a69723f3ba21f9044616f8238f7ebe919239ae6a | def get_split_indices(self):
'\n Return list of indices to split the results into categories.\n\n :return: list of indices\n :rtype: list\n '
filename = 'dict_split.csv'
filepath = (DATA_DIR / filename)
if (not filepath.is_file()):
raise FileNotFoundError('The diction... | Return list of indices to split the results into categories.
:return: list of indices
:rtype: list | carculator/inventory.py | get_split_indices | rena-nong/carculator | 1 | python | def get_split_indices(self):
'\n Return list of indices to split the results into categories.\n\n :return: list of indices\n :rtype: list\n '
filename = 'dict_split.csv'
filepath = (DATA_DIR / filename)
if (not filepath.is_file()):
raise FileNotFoundError('The diction... | def get_split_indices(self):
'\n Return list of indices to split the results into categories.\n\n :return: list of indices\n :rtype: list\n '
filename = 'dict_split.csv'
filepath = (DATA_DIR / filename)
if (not filepath.is_file()):
raise FileNotFoundError('The diction... |
97168e118b31e67d5710a94e3e81ec74ea9b826a3e85ba1752f684d881a388a8 | def get_A_matrix(self):
'\n Load the A matrix. The A matrix contains exchanges of products (rows) between activities (columns).\n\n :return: A matrix with three dimensions of shape (number of values, number of products, number of activities).\n :rtype: numpy.ndarray\n\n '
filename = ... | Load the A matrix. The A matrix contains exchanges of products (rows) between activities (columns).
:return: A matrix with three dimensions of shape (number of values, number of products, number of activities).
:rtype: numpy.ndarray | carculator/inventory.py | get_A_matrix | rena-nong/carculator | 1 | python | def get_A_matrix(self):
'\n Load the A matrix. The A matrix contains exchanges of products (rows) between activities (columns).\n\n :return: A matrix with three dimensions of shape (number of values, number of products, number of activities).\n :rtype: numpy.ndarray\n\n '
filename = ... | def get_A_matrix(self):
'\n Load the A matrix. The A matrix contains exchanges of products (rows) between activities (columns).\n\n :return: A matrix with three dimensions of shape (number of values, number of products, number of activities).\n :rtype: numpy.ndarray\n\n '
filename = ... |
5f108e7335838f6d700d366c9c29ad961ca5fb9583458104f8c7429245d22e49 | def get_B_matrix(self):
'\n Load the B matrix. The B matrix contains impact assessment figures for a give impact assessment method,\n per unit of activity. Its length column-wise equals the length of the A matrix row-wise.\n Its length row-wise equals the number of impact assessment methods.\n\... | Load the B matrix. The B matrix contains impact assessment figures for a give impact assessment method,
per unit of activity. Its length column-wise equals the length of the A matrix row-wise.
Its length row-wise equals the number of impact assessment methods.
:param method: only "recipe" and "ilcd" available at the m... | carculator/inventory.py | get_B_matrix | rena-nong/carculator | 1 | python | def get_B_matrix(self):
'\n Load the B matrix. The B matrix contains impact assessment figures for a give impact assessment method,\n per unit of activity. Its length column-wise equals the length of the A matrix row-wise.\n Its length row-wise equals the number of impact assessment methods.\n\... | def get_B_matrix(self):
'\n Load the B matrix. The B matrix contains impact assessment figures for a give impact assessment method,\n per unit of activity. Its length column-wise equals the length of the A matrix row-wise.\n Its length row-wise equals the number of impact assessment methods.\n\... |
6cd859343dcc5ace1c765037fad40ecb78e7c1aa97fd166de4736129543d5381 | def get_dict_input(self):
'\n Load a dictionary with tuple ("name of activity", "location", "unit", "reference product") as key, row/column\n indices as values.\n\n :return: dictionary with `label:index` pairs.\n :rtype: dict\n\n '
filename = 'dict_inputs_A_matrix.csv'
fil... | Load a dictionary with tuple ("name of activity", "location", "unit", "reference product") as key, row/column
indices as values.
:return: dictionary with `label:index` pairs.
:rtype: dict | carculator/inventory.py | get_dict_input | rena-nong/carculator | 1 | python | def get_dict_input(self):
'\n Load a dictionary with tuple ("name of activity", "location", "unit", "reference product") as key, row/column\n indices as values.\n\n :return: dictionary with `label:index` pairs.\n :rtype: dict\n\n '
filename = 'dict_inputs_A_matrix.csv'
fil... | def get_dict_input(self):
'\n Load a dictionary with tuple ("name of activity", "location", "unit", "reference product") as key, row/column\n indices as values.\n\n :return: dictionary with `label:index` pairs.\n :rtype: dict\n\n '
filename = 'dict_inputs_A_matrix.csv'
fil... |
a057e576b0fd85f23d0d5ae6e23388e566ba08b7ac2a4ca06adfc80617dac5e8 | def get_dict_impact_categories(self):
"\n Load a dictionary with available impact assessment methods as keys, and assessment level and categories as values.\n\n ..code-block:: python\n\n {'recipe': {'midpoint': ['freshwater ecotoxicity',\n 'human toxicity',... | Load a dictionary with available impact assessment methods as keys, and assessment level and categories as values.
..code-block:: python
{'recipe': {'midpoint': ['freshwater ecotoxicity',
'human toxicity',
'marine ecotoxicity',
'terr... | carculator/inventory.py | get_dict_impact_categories | rena-nong/carculator | 1 | python | def get_dict_impact_categories(self):
"\n Load a dictionary with available impact assessment methods as keys, and assessment level and categories as values.\n\n ..code-block:: python\n\n {'recipe': {'midpoint': ['freshwater ecotoxicity',\n 'human toxicity',... | def get_dict_impact_categories(self):
"\n Load a dictionary with available impact assessment methods as keys, and assessment level and categories as values.\n\n ..code-block:: python\n\n {'recipe': {'midpoint': ['freshwater ecotoxicity',\n 'human toxicity',... |
6c9546d26806f517049e2e4412f1fbe2d5b0444fac16a5bb6dd38bb21eb660be | def get_rev_dict_input(self):
'\n Reverse the self.inputs dictionary.\n\n :return: reversed dictionary\n :rtype: dict\n '
return {v: k for (k, v) in self.inputs.items()} | Reverse the self.inputs dictionary.
:return: reversed dictionary
:rtype: dict | carculator/inventory.py | get_rev_dict_input | rena-nong/carculator | 1 | python | def get_rev_dict_input(self):
'\n Reverse the self.inputs dictionary.\n\n :return: reversed dictionary\n :rtype: dict\n '
return {v: k for (k, v) in self.inputs.items()} | def get_rev_dict_input(self):
'\n Reverse the self.inputs dictionary.\n\n :return: reversed dictionary\n :rtype: dict\n '
return {v: k for (k, v) in self.inputs.items()}<|docstring|>Reverse the self.inputs dictionary.
:return: reversed dictionary
:rtype: dict<|endoftext|> |
21fa57095c8a5deb3e505b0fdecc68b64ff09217367a59fe61b65a61ab3f640e | def get_index_vehicle_from_array(self, items_to_look_for, items_to_look_for_also=None, method='or'):
'\n Return list of row/column indices of self.array of labels that contain the string defined in `items_to_look_for`.\n\n :param items_to_look_for: string to search for\n :return: list\n ... | Return list of row/column indices of self.array of labels that contain the string defined in `items_to_look_for`.
:param items_to_look_for: string to search for
:return: list | carculator/inventory.py | get_index_vehicle_from_array | rena-nong/carculator | 1 | python | def get_index_vehicle_from_array(self, items_to_look_for, items_to_look_for_also=None, method='or'):
'\n Return list of row/column indices of self.array of labels that contain the string defined in `items_to_look_for`.\n\n :param items_to_look_for: string to search for\n :return: list\n ... | def get_index_vehicle_from_array(self, items_to_look_for, items_to_look_for_also=None, method='or'):
'\n Return list of row/column indices of self.array of labels that contain the string defined in `items_to_look_for`.\n\n :param items_to_look_for: string to search for\n :return: list\n ... |
8047bec7133f47408b2e6754e250b4241a0f59c3d55976d84ed2f128900b451a | def get_index_of_flows(self, items_to_look_for, search_by='name'):
'\n Return list of row/column indices of self.A of labels that contain the string defined in `items_to_look_for`.\n\n :param items_to_look_for: string\n :param search_by: "name" or "compartment" (for elementary flows)\n :... | Return list of row/column indices of self.A of labels that contain the string defined in `items_to_look_for`.
:param items_to_look_for: string
:param search_by: "name" or "compartment" (for elementary flows)
:return: list of row/column indices
:rtype: list | carculator/inventory.py | get_index_of_flows | rena-nong/carculator | 1 | python | def get_index_of_flows(self, items_to_look_for, search_by='name'):
'\n Return list of row/column indices of self.A of labels that contain the string defined in `items_to_look_for`.\n\n :param items_to_look_for: string\n :param search_by: "name" or "compartment" (for elementary flows)\n :... | def get_index_of_flows(self, items_to_look_for, search_by='name'):
'\n Return list of row/column indices of self.A of labels that contain the string defined in `items_to_look_for`.\n\n :param items_to_look_for: string\n :param search_by: "name" or "compartment" (for elementary flows)\n :... |
e97092b7829916b6672548788742c53defe93ba94b53a5f68fd3747b5ae48c2d | def export_lci(self, presamples=True, ecoinvent_compatibility=True, ecoinvent_version='3.7', db_name='carculator db', forbidden_activities=None, create_vehicle_datasets=True):
'\n Export the inventory as a dictionary. Also return a list of arrays that contain pre-sampled random values if\n :meth:`stoc... | Export the inventory as a dictionary. Also return a list of arrays that contain pre-sampled random values if
:meth:`stochastic` of :class:`CarModel` class has been called.
:param presamples: boolean.
:param ecoinvent_compatibility: bool. If True, compatible with ecoinvent. If False, compatible with REMIND-ecoinvent.
:... | carculator/inventory.py | export_lci | rena-nong/carculator | 1 | python | def export_lci(self, presamples=True, ecoinvent_compatibility=True, ecoinvent_version='3.7', db_name='carculator db', forbidden_activities=None, create_vehicle_datasets=True):
'\n Export the inventory as a dictionary. Also return a list of arrays that contain pre-sampled random values if\n :meth:`stoc... | def export_lci(self, presamples=True, ecoinvent_compatibility=True, ecoinvent_version='3.7', db_name='carculator db', forbidden_activities=None, create_vehicle_datasets=True):
'\n Export the inventory as a dictionary. Also return a list of arrays that contain pre-sampled random values if\n :meth:`stoc... |
e25e4e6d027cab003e09a09fb081d30c99910ad5ab275881d6760f1066a7fdbe | def export_lci_to_bw(self, presamples=True, ecoinvent_compatibility=True, ecoinvent_version='3.7', db_name='carculator db', forbidden_activities=None, create_vehicle_datasets=True):
'\n Export the inventory as a `brightway2` bw2io.importers.base_lci.LCIImporter object\n with the inventory in the `data... | Export the inventory as a `brightway2` bw2io.importers.base_lci.LCIImporter object
with the inventory in the `data` attribute.
.. code-block:: python
# get the inventory
i, _ = ic.export_lci_to_bw()
# import it in a Brightway2 project
i.match_database('ecoinvent 3.6 cutoff', fields=('name', 'unit', '... | carculator/inventory.py | export_lci_to_bw | rena-nong/carculator | 1 | python | def export_lci_to_bw(self, presamples=True, ecoinvent_compatibility=True, ecoinvent_version='3.7', db_name='carculator db', forbidden_activities=None, create_vehicle_datasets=True):
'\n Export the inventory as a `brightway2` bw2io.importers.base_lci.LCIImporter object\n with the inventory in the `data... | def export_lci_to_bw(self, presamples=True, ecoinvent_compatibility=True, ecoinvent_version='3.7', db_name='carculator db', forbidden_activities=None, create_vehicle_datasets=True):
'\n Export the inventory as a `brightway2` bw2io.importers.base_lci.LCIImporter object\n with the inventory in the `data... |
886d27c3ca7b316bf75dec46dc1667c6dc89f716996c038b10db74f52d5c65f3 | def export_lci_to_excel(self, directory=None, ecoinvent_compatibility=True, ecoinvent_version='3.7', software_compatibility='brightway2', filename=None, forbidden_activities=None, create_vehicle_datasets=True, export_format='file'):
'\n Export the inventory as an Excel file (if the destination software is Br... | Export the inventory as an Excel file (if the destination software is Brightway2) or a CSV file (if the destination software is Simapro) file.
Also return the file path where the file is stored.
:param directory: directory where to save the file.
:type directory: str
:param ecoinvent_compatibility: If True, compatible... | carculator/inventory.py | export_lci_to_excel | rena-nong/carculator | 1 | python | def export_lci_to_excel(self, directory=None, ecoinvent_compatibility=True, ecoinvent_version='3.7', software_compatibility='brightway2', filename=None, forbidden_activities=None, create_vehicle_datasets=True, export_format='file'):
'\n Export the inventory as an Excel file (if the destination software is Br... | def export_lci_to_excel(self, directory=None, ecoinvent_compatibility=True, ecoinvent_version='3.7', software_compatibility='brightway2', filename=None, forbidden_activities=None, create_vehicle_datasets=True, export_format='file'):
'\n Export the inventory as an Excel file (if the destination software is Br... |
10ecc9b143fc48af8ff7ad6d02e3916d8413a71fc9ce904479de888172ad1c65 | def define_electricity_mix_for_fuel_prep(self):
'\n This function defines a fuel mix based either on user-defined mix, or on default mixes for a given country.\n The mix is calculated as the average mix, weighted by the distribution of annually driven kilometers.\n :return:\n '
try:
... | This function defines a fuel mix based either on user-defined mix, or on default mixes for a given country.
The mix is calculated as the average mix, weighted by the distribution of annually driven kilometers.
:return: | carculator/inventory.py | define_electricity_mix_for_fuel_prep | rena-nong/carculator | 1 | python | def define_electricity_mix_for_fuel_prep(self):
'\n This function defines a fuel mix based either on user-defined mix, or on default mixes for a given country.\n The mix is calculated as the average mix, weighted by the distribution of annually driven kilometers.\n :return:\n '
try:
... | def define_electricity_mix_for_fuel_prep(self):
'\n This function defines a fuel mix based either on user-defined mix, or on default mixes for a given country.\n The mix is calculated as the average mix, weighted by the distribution of annually driven kilometers.\n :return:\n '
try:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.