uid stringlengths 24 24 | split stringclasses 1
value | category stringclasses 2
values | content stringlengths 5 482k | signature stringlengths 1 14k | suffix stringlengths 1 482k | prefix stringlengths 9 14k | prefix_token_count int64 3 5.01k | prefix_token_budget int64 64 256 | element_token_count int64 1 292k | signature_token_count int64 1 5.01k | prefix_context_token_count int64 0 255 | repo stringlengths 7 112 | path stringlengths 4 208 | language stringclasses 1
value | name stringlengths 1 218 | qualname stringlengths 1 218 | start_line int64 1 26.7k | end_line int64 1 26.7k | signature_start_line int64 1 26.7k | signature_end_line int64 1 26.7k | source_hash stringlengths 40 40 | source_dataset stringclasses 1
value | source_split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
07e366f921d7e276339b1186 | train | class | @test_util.test_all_tf_execution_regimes
class SeasonalWithZeroMeanConstraintTest(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
return Seasonal(num_seasons=7,
num_steps_per_season=1,
observed_time_series=observed_time_series,
... | @test_util.test_all_tf_execution_regimes
class SeasonalWithZeroMeanConstraintTest(test_util.TestCase, _StsTestHarness):
| def _build_sts(self, observed_time_series=None):
return Seasonal(num_seasons=7,
num_steps_per_season=1,
observed_time_series=observed_time_series,
constrain_mean_effect_to_zero=True)
| .
return Seasonal(num_seasons=7,
num_steps_per_season=1,
observed_time_series=observed_time_series,
constrain_mean_effect_to_zero=False)
@test_util.test_all_tf_execution_regimes
class SeasonalWithZeroMeanConstraintTest(test_util.TestCase, _StsTestHarness):... | 64 | 64 | 76 | 27 | 37 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | SeasonalWithZeroMeanConstraintTest | SeasonalWithZeroMeanConstraintTest | 422 | 429 | 422 | 424 | f696916e07056c87844ebe7092b6cbc2bd6efb91 | bigcode/the-stack | train |
caff0225c875a44c15486ba6 | train | class | @test_util.test_all_tf_execution_regimes
class AutoregressiveTest(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
return Autoregressive(order=3, observed_time_series=observed_time_series)
| @test_util.test_all_tf_execution_regimes
class AutoregressiveTest(test_util.TestCase, _StsTestHarness):
| def _build_sts(self, observed_time_series=None):
return Autoregressive(order=3, observed_time_series=observed_time_series)
| s.Sum):
self.assertIsNotNone(sum_model.init_parameters['observed_time_series'])
self.assertIsNotNone(ledom_mus.init_parameters['observed_time_series'])
@test_util.test_all_tf_execution_regimes
class AutoregressiveTest(test_util.TestCase, _StsTestHarness):
| 63 | 64 | 56 | 25 | 38 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | AutoregressiveTest | AutoregressiveTest | 384 | 388 | 384 | 386 | 9fe6dc2d1a4836968d7cb509f6befff75be5333a | bigcode/the-stack | train |
8089dc102021b14d02afcb42 | train | class | @test_util.test_all_tf_execution_regimes
class DynamicLinearRegressionTest(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
max_timesteps = 100
num_features = 3
return DynamicLinearRegression(
design_matrix=np.random.randn(
max_timesteps, num_fea... | @test_util.test_all_tf_execution_regimes
class DynamicLinearRegressionTest(test_util.TestCase, _StsTestHarness):
| def _build_sts(self, observed_time_series=None):
max_timesteps = 100
num_features = 3
return DynamicLinearRegression(
design_matrix=np.random.randn(
max_timesteps, num_features).astype(np.float32),
observed_time_series=observed_time_series)
| max_timesteps, num_features).astype(np.float32),
weights_batch_shape=batch_shape)
return Sum(components=[regression],
observed_time_series=observed_time_series)
@test_util.test_all_tf_execution_regimes
class DynamicLinearRegressionTest(test_util.TestCase, _StsTestHarness):
| 64 | 64 | 89 | 25 | 39 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | DynamicLinearRegressionTest | DynamicLinearRegressionTest | 541 | 551 | 541 | 543 | af57696e9fdc2c1187cd602ec62324a6bc404e16 | bigcode/the-stack | train |
890599179079513f43485dff | train | class | @test_util.test_all_tf_execution_regimes
class SumTest(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
first_component = LocalLinearTrend(
observed_time_series=observed_time_series, name='first_component')
second_component = LocalLinearTrend(
observed_ti... | @test_util.test_all_tf_execution_regimes
class SumTest(test_util.TestCase, _StsTestHarness):
| def _build_sts(self, observed_time_series=None):
first_component = LocalLinearTrend(
observed_time_series=observed_time_series, name='first_component')
second_component = LocalLinearTrend(
observed_time_series=observed_time_series, name='second_component')
return Sum(
components=[f... | )
# The test harness doesn't like models with no parameters, so wrap with Sum.
return tfp.sts.Sum([smooth_seasonal],
observed_time_series=observed_time_series)
@test_util.test_all_tf_execution_regimes
class SumTest(test_util.TestCase, _StsTestHarness):
| 64 | 64 | 105 | 23 | 41 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | SumTest | SumTest | 475 | 485 | 475 | 477 | 8979339808c5af6df5131c195ac6ee04212ecf52 | bigcode/the-stack | train |
cf2de4ff566c4e5c18e4d6bd | train | class | @test_util.test_all_tf_execution_regimes
class SparseLinearRegressionTest(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
max_timesteps = 100
num_features = 3
# LinearRegression components don't currently take an `observed_time_series`
# argument, so they can't... | @test_util.test_all_tf_execution_regimes
class SparseLinearRegressionTest(test_util.TestCase, _StsTestHarness):
| def _build_sts(self, observed_time_series=None):
max_timesteps = 100
num_features = 3
# LinearRegression components don't currently take an `observed_time_series`
# argument, so they can't infer a prior batch shape. This means we have to
# manually set the batch shape expected by the tests.
b... | (
max_timesteps, num_features).astype(np.float32),
weights_prior=prior)
return Sum(components=[regression],
observed_time_series=observed_time_series)
@test_util.test_all_tf_execution_regimes
class SparseLinearRegressionTest(test_util.TestCase, _StsTestHarness):
| 64 | 64 | 209 | 25 | 39 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | SparseLinearRegressionTest | SparseLinearRegressionTest | 516 | 538 | 516 | 518 | b69dde3aed2bf97601f6bfa6f0e2e7045b16b8b4 | bigcode/the-stack | train |
f929af08a310c61c679b3b2a | train | class | @test_util.test_all_tf_execution_regimes
class StructuralTimeSeriesTestsStaticShape64(
_StructuralTimeSeriesTests, test_util.TestCase):
dtype = np.float64
use_static_shape = True
| @test_util.test_all_tf_execution_regimes
class StructuralTimeSeriesTestsStaticShape64(
_StructuralTimeSeriesTests, test_util.TestCase):
| dtype = np.float64
use_static_shape = True
| StructuralTimeSeriesTestsDynamicShape32(
_StructuralTimeSeriesTests, test_util.TestCase):
dtype = np.float32
use_static_shape = False
@test_util.test_all_tf_execution_regimes
class StructuralTimeSeriesTestsStaticShape64(
_StructuralTimeSeriesTests, test_util.TestCase):
| 64 | 64 | 44 | 30 | 33 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | StructuralTimeSeriesTestsStaticShape64 | StructuralTimeSeriesTestsStaticShape64 | 165 | 169 | 165 | 167 | 31c2610f13c8d2f778d13469604293fbc9c24e79 | bigcode/the-stack | train |
981e1dda983dbadd88e7ea74 | train | class | @test_util.test_all_tf_execution_regimes
class LocalLinearTrendTest(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
return LocalLinearTrend(observed_time_series=observed_time_series)
| @test_util.test_all_tf_execution_regimes
class LocalLinearTrendTest(test_util.TestCase, _StsTestHarness):
| def _build_sts(self, observed_time_series=None):
return LocalLinearTrend(observed_time_series=observed_time_series)
| Test(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
return LocalLevel(observed_time_series=observed_time_series)
@test_util.test_all_tf_execution_regimes
class LocalLinearTrendTest(test_util.TestCase, _StsTestHarness):
| 64 | 64 | 53 | 25 | 39 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | LocalLinearTrendTest | LocalLinearTrendTest | 398 | 402 | 398 | 400 | 4bf1d051a3587509d944c51d34e999cd5c1df315 | bigcode/the-stack | train |
e7a8f1e625f18a00f981e90e | train | class | class _StsTestHarness(object):
def test_state_space_model(self):
seed = test_util.test_seed_stream()
model = self._build_sts()
dummy_param_vals = [p.prior.sample(seed=seed()) for p in model.parameters]
initial_state_prior = tfd.MultivariateNormalDiag(
loc=-2. + tf.zeros([model.latent_size]),... | class _StsTestHarness(object):
| def test_state_space_model(self):
seed = test_util.test_seed_stream()
model = self._build_sts()
dummy_param_vals = [p.prior.sample(seed=seed()) for p in model.parameters]
initial_state_prior = tfd.MultivariateNormalDiag(
loc=-2. + tf.zeros([model.latent_size]),
scale_diag=3. * tf.ones... | dtype: optional `dtype`; if not specified, defaults to `self.dtype`.
Returns:
placeholder: a TensorFlow `placeholder` with default value given by the
provided `ndarray`, dtype given by `self.dtype`, and shape specified
statically only if `self.use_static_shape` is `True`.
"""
if dtype i... | 256 | 256 | 2,187 | 8 | 247 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | _StsTestHarness | _StsTestHarness | 172 | 381 | 172 | 173 | 8540473e723df6b0063c16813782fcc384bf5b66 | bigcode/the-stack | train |
1e75e10bcbfc292e599762ad | train | class | @test_util.test_all_tf_execution_regimes
class StructuralTimeSeriesTestsDynamicShape32(
_StructuralTimeSeriesTests, test_util.TestCase):
dtype = np.float32
use_static_shape = False
| @test_util.test_all_tf_execution_regimes
class StructuralTimeSeriesTestsDynamicShape32(
_StructuralTimeSeriesTests, test_util.TestCase):
| dtype = np.float32
use_static_shape = False
| StructuralTimeSeriesTestsStaticShape32(
_StructuralTimeSeriesTests, test_util.TestCase):
dtype = np.float32
use_static_shape = True
@test_util.test_all_tf_execution_regimes
class StructuralTimeSeriesTestsDynamicShape32(
_StructuralTimeSeriesTests, test_util.TestCase):
| 64 | 64 | 44 | 30 | 33 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | StructuralTimeSeriesTestsDynamicShape32 | StructuralTimeSeriesTestsDynamicShape32 | 158 | 162 | 158 | 160 | cf63ae8c4d14ee75255226619b4862e7c40660d5 | bigcode/the-stack | train |
bf71f2d7dd872e91572c9b92 | train | class | @test_util.test_all_tf_execution_regimes
class StructuralTimeSeriesTestsStaticShape32(
_StructuralTimeSeriesTests, test_util.TestCase):
dtype = np.float32
use_static_shape = True
| @test_util.test_all_tf_execution_regimes
class StructuralTimeSeriesTestsStaticShape32(
_StructuralTimeSeriesTests, test_util.TestCase):
| dtype = np.float32
use_static_shape = True
| ndarray = np.asarray(ndarray).astype(dtype)
return tf1.placeholder_with_default(
ndarray, shape=ndarray.shape if self.use_static_shape else None)
@test_util.test_all_tf_execution_regimes
class StructuralTimeSeriesTestsStaticShape32(
_StructuralTimeSeriesTests, test_util.TestCase):
| 64 | 64 | 44 | 30 | 34 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | StructuralTimeSeriesTestsStaticShape32 | StructuralTimeSeriesTestsStaticShape32 | 151 | 155 | 151 | 153 | 2f15722055d4c0b0bd8e262d10ae98739530d459 | bigcode/the-stack | train |
9a7216b4a2f8cac01266e350 | train | class | @test_util.test_all_tf_execution_regimes
class LinearRegressionTest(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
max_timesteps = 100
num_features = 3
prior = tfd.Sample(tfd.Laplace(0., 1.), sample_shape=[num_features])
# LinearRegression components don't cu... | @test_util.test_all_tf_execution_regimes
class LinearRegressionTest(test_util.TestCase, _StsTestHarness):
| def _build_sts(self, observed_time_series=None):
max_timesteps = 100
num_features = 3
prior = tfd.Sample(tfd.Laplace(0., 1.), sample_shape=[num_features])
# LinearRegression components don't currently take an `observed_time_series`
# argument, so they can't infer a prior batch shape. This means ... | name='first_component')
second_component = LocalLinearTrend(
observed_time_series=observed_time_series, name='second_component')
return Sum(
components=[first_component, second_component],
observed_time_series=observed_time_series)
@test_util.test_all_tf_execution_regimes
class LinearRe... | 75 | 75 | 250 | 24 | 51 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | LinearRegressionTest | LinearRegressionTest | 488 | 513 | 488 | 490 | da741d2fbb9bc772d285328ffd4d6d67b468ca87 | bigcode/the-stack | train |
5131bfbfc4ffaec026ecee99 | train | class | @test_util.test_all_tf_execution_regimes
class LocalLevelTest(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
return LocalLevel(observed_time_series=observed_time_series)
| @test_util.test_all_tf_execution_regimes
class LocalLevelTest(test_util.TestCase, _StsTestHarness):
| def _build_sts(self, observed_time_series=None):
return LocalLevel(observed_time_series=observed_time_series)
| .TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
return Autoregressive(order=3, observed_time_series=observed_time_series)
@test_util.test_all_tf_execution_regimes
class LocalLevelTest(test_util.TestCase, _StsTestHarness):
| 64 | 64 | 51 | 24 | 40 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | LocalLevelTest | LocalLevelTest | 391 | 395 | 391 | 393 | 4802b6587448307c425127588322c96405cdd076 | bigcode/the-stack | train |
c6f4f1c9e8535c9b8ba3e018 | train | class | @test_util.test_all_tf_execution_regimes
class SmoothSeasonalWithNoDriftTest(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
smooth_seasonal = SmoothSeasonal(period=42,
frequency_multipliers=[1, 2, 4],
... | @test_util.test_all_tf_execution_regimes
class SmoothSeasonalWithNoDriftTest(test_util.TestCase, _StsTestHarness):
| def _build_sts(self, observed_time_series=None):
smooth_seasonal = SmoothSeasonal(period=42,
frequency_multipliers=[1, 2, 4],
allow_drift=False,
observed_time_series=observed_time_series)
# The test ... | =None):
return SmoothSeasonal(period=42,
frequency_multipliers=[1, 2, 4],
observed_time_series=observed_time_series)
@test_util.test_all_tf_execution_regimes
class SmoothSeasonalWithNoDriftTest(test_util.TestCase, _StsTestHarness):
| 64 | 64 | 125 | 29 | 35 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | SmoothSeasonalWithNoDriftTest | SmoothSeasonalWithNoDriftTest | 462 | 472 | 462 | 464 | be715808781b3ac060f5a2772ca61c45dd83ad21 | bigcode/the-stack | train |
62b8839bbb99466f78d3bbdc | train | class | @test_util.test_all_tf_execution_regimes
class SemiLocalLinearTrendTest(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
return SemiLocalLinearTrend(observed_time_series=observed_time_series)
| @test_util.test_all_tf_execution_regimes
class SemiLocalLinearTrendTest(test_util.TestCase, _StsTestHarness):
| def _build_sts(self, observed_time_series=None):
return SemiLocalLinearTrend(observed_time_series=observed_time_series)
| _series=observed_time_series,
name='day_of_week')
return tfp.sts.Sum(components=[day_of_week],
observed_time_series=observed_time_series)
@test_util.test_all_tf_execution_regimes
class SemiLocalLinearTrendTest(test_util.TestCase, _StsTestHarness):
| 64 | 64 | 55 | 26 | 38 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | SemiLocalLinearTrendTest | SemiLocalLinearTrendTest | 446 | 450 | 446 | 448 | d919a36f3b55f3ad71b60fdf5d2a16554cd6ede2 | bigcode/the-stack | train |
f4c970441072cb25fb53ca45 | train | class | @test_util.test_all_tf_execution_regimes
class SeasonalTest(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
# Note that a Seasonal model with `num_steps_per_season > 1` would have
# deterministic dependence between timesteps, so evaluating `log_prob` of an
# arbitra... | @test_util.test_all_tf_execution_regimes
class SeasonalTest(test_util.TestCase, _StsTestHarness):
| def _build_sts(self, observed_time_series=None):
# Note that a Seasonal model with `num_steps_per_season > 1` would have
# deterministic dependence between timesteps, so evaluating `log_prob` of an
# arbitrary time series leads to Cholesky decomposition errors unless the
# model also includes an obser... | TrendTest(test_util.TestCase, _StsTestHarness):
def _build_sts(self, observed_time_series=None):
return LocalLinearTrend(observed_time_series=observed_time_series)
@test_util.test_all_tf_execution_regimes
class SeasonalTest(test_util.TestCase, _StsTestHarness):
| 64 | 64 | 182 | 23 | 41 | fearghus-moloco/probability | tensorflow_probability/python/sts/structural_time_series_test.py | Python | SeasonalTest | SeasonalTest | 405 | 419 | 405 | 407 | 4d27fd70deadf76c5ed834e453711934f79f3b5e | bigcode/the-stack | train |
83e7c2fee9d410c942fb332f | train | function | def _take_last_with_time(duration: typing.RelativeTime, scheduler: typing.Scheduler = None) -> Callable[[Observable], Observable]:
def take_last_with_time(source: Observable) -> Observable:
"""Returns elements within the specified duration from the end
of the observable source sequence.
Exa... | def _take_last_with_time(duration: typing.RelativeTime, scheduler: typing.Scheduler = None) -> Callable[[Observable], Observable]:
| def take_last_with_time(source: Observable) -> Observable:
"""Returns elements within the specified duration from the end
of the observable source sequence.
Example:
>>> res = take_last_with_time(source)
This operator accumulates a queue with a length enough to store
... | from typing import Callable
from rx.core import Observable, typing
from rx.concurrency import timeout_scheduler
def _take_last_with_time(duration: typing.RelativeTime, scheduler: typing.Scheduler = None) -> Callable[[Observable], Observable]:
| 48 | 104 | 348 | 27 | 20 | MichaelSchneeberger/RxPY | rx/core/operators/takelastwithtime.py | Python | _take_last_with_time | _take_last_with_time | 6 | 52 | 6 | 6 | b1d21b221d9b6b35d14dbef160a8e33c42c6b58f | bigcode/the-stack | train |
52f1f14763756de41242c854 | train | class | class AlipayOfflineMarketingVoucherCreateRequest(object):
def __init__(self, biz_model=None):
self._biz_model = biz_model
self._biz_content = None
self._version = "1.0"
self._terminal_type = None
self._terminal_info = None
self._prod_code = None
self._notify_... | class AlipayOfflineMarketingVoucherCreateRequest(object):
| def __init__(self, biz_model=None):
self._biz_model = biz_model
self._biz_content = None
self._version = "1.0"
self._terminal_type = None
self._terminal_info = None
self._prod_code = None
self._notify_url = None
self._return_url = None
self._ud... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AlipayOfflineMarketingVoucherCreateModel import AlipayOfflineMarketingVoucherCreateModel
class AlipayOfflineMarketingVouc... | 76 | 255 | 851 | 10 | 65 | articuly/alipay-sdk-python-all | alipay/aop/api/request/AlipayOfflineMarketingVoucherCreateRequest.py | Python | AlipayOfflineMarketingVoucherCreateRequest | AlipayOfflineMarketingVoucherCreateRequest | 12 | 144 | 12 | 13 | 20b244cc72bdfe21f005e443edf31dd285d98301 | bigcode/the-stack | train |
9dad88688af8eba321fb4456 | train | class | class DPNUnetFixed(DPNUnet):
def forward(self, input_x):
enc_results1 = []
enc_results2 = []
# pre disaster
x = input_x[:, :3, ...]
for stage in (self.encoder_stages if self.shared else self.encoder_stages1):
x = stage(x)
if isinstance(x, (list, tupl... | class DPNUnetFixed(DPNUnet):
| def forward(self, input_x):
enc_results1 = []
enc_results2 = []
# pre disaster
x = input_x[:, :3, ...]
for stage in (self.encoder_stages if self.shared else self.encoder_stages1):
x = stage(x)
if isinstance(x, (list, tuple)):
enc_result... | :
return nn.Sequential(*[b for k, b in encoder.blocks.items() if k.startswith('conv4_')])
elif layer == 4:
return nn.Sequential(*[b for k, b in encoder.blocks.items() if k.startswith('conv5_')])
@property
def first_layer_params_names(self):
return ['features.conv1_1.conv... | 92 | 92 | 308 | 12 | 80 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | DPNUnetFixed | DPNUnetFixed | 459 | 492 | 459 | 461 | aa909d8f5cd54fb49e3d3998ab3fa4a3d94266df | bigcode/the-stack | train |
104022708a0e0a111b950ea3 | train | class | class SEUnet(SiameseEncoderDecoder):
def __init__(self, seg_classes, backbone_arch='senet154', shared=False):
self.first_layer_stride_two = True
super().__init__(seg_classes, 3, backbone_arch, shared=shared)
def get_encoder(self, encoder, layer):
if layer == 0:
return encode... | class SEUnet(SiameseEncoderDecoder):
| def __init__(self, seg_classes, backbone_arch='senet154', shared=False):
self.first_layer_stride_two = True
super().__init__(seg_classes, 3, backbone_arch, shared=shared)
def get_encoder(self, encoder, layer):
if layer == 0:
return encoder.layer0
elif layer == 1:
... | 3:
return nn.Sequential(encoder.features.transition2, encoder.features.denseblock3)
elif layer == 4:
return nn.Sequential(encoder.features.transition3, encoder.features.denseblock4, encoder.features.norm5,
nn.ReLU())
class SEUnet(SiameseEncoderDecoder):
| 64 | 64 | 140 | 10 | 54 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | SEUnet | SEUnet | 517 | 534 | 517 | 517 | 85f85d624635bbf2448e0bacfe23379c358399a3 | bigcode/the-stack | train |
40977dde2e8d8d0809b5dfea | train | class | class BasicUpBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, activation=nn.ReLU, mode='nearest'):
super().__init__()
padding = int((kernel_size - 1) / 2) * 1
self.op = nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, padding=padding, dilation=1)
... | class BasicUpBlock(nn.Module):
| def __init__(self, in_channels, out_channels, kernel_size=3, activation=nn.ReLU, mode='nearest'):
super().__init__()
padding = int((kernel_size - 1) / 2) * 1
self.op = nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, padding=padding, dilation=1)
self.use_act = activation... | LU)
class ConvReLu3x3(BasicConvAct):
def __init__(self, in_channels, out_channels, dilation=1):
super().__init__(in_channels, out_channels, kernel_size=3, dilation=dilation, activation=nn.ReLU)
class BasicUpBlock(nn.Module):
| 64 | 64 | 164 | 7 | 57 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | BasicUpBlock | BasicUpBlock | 130 | 145 | 130 | 130 | ae90757587cf459142853bc56f4e250a4a9e5736 | bigcode/the-stack | train |
38af3b7e4da446a68a943c38 | train | class | class ConvBottleneck(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
self.seq = nn.Sequential(
nn.Conv2d(in_channels, out_channels, 3, padding=1),
nn.ReLU(inplace=True)
)
def forward(self, dec, enc):
x = torch.cat([dec, enc],... | class ConvBottleneck(nn.Module):
| def __init__(self, in_channels, out_channels):
super().__init__()
self.seq = nn.Sequential(
nn.Conv2d(in_channels, out_channels, 3, padding=1),
nn.ReLU(inplace=True)
)
def forward(self, dec, enc):
x = torch.cat([dec, enc], dim=1)
return self.seq(x... | _params(layers):
return sum((list(l.parameters()) for l in layers), [])
def get_slice(features, start, end):
if end == -1:
end = len(features)
return [features[i] for i in range(start, end)]
class ConvBottleneck(nn.Module):
| 63 | 64 | 89 | 8 | 55 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | ConvBottleneck | ConvBottleneck | 295 | 305 | 295 | 295 | 7217a12786a95423b814412db6030449906c8351 | bigcode/the-stack | train |
3b8695b836a24c9c0af7c409 | train | class | class AbstractModel(nn.Module):
def _initialize_weights(self):
for m in self.modules():
if isinstance(m, nn.Conv2d) or isinstance(m, nn.ConvTranspose2d):
m.weight.data = nn.init.kaiming_normal_(m.weight.data)
if m.bias is not None:
m.bias.data.... | class AbstractModel(nn.Module):
| def _initialize_weights(self):
for m in self.modules():
if isinstance(m, nn.Conv2d) or isinstance(m, nn.ConvTranspose2d):
m.weight.data = nn.init.kaiming_normal_(m.weight.data)
if m.bias is not None:
m.bias.data.zero_()
elif isinsta... | 2) * 1
self.op = nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, padding=padding, dilation=1)
self.use_act = activation is not None
self.mode = mode
if self.use_act:
self.act = activation()
def forward(self, x):
x = F.upsample(x, scale_factor=2, mo... | 118 | 118 | 395 | 6 | 111 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | AbstractModel | AbstractModel | 148 | 182 | 148 | 148 | c3b11b48625cbcab91851677b66ed6537be9dde7 | bigcode/the-stack | train |
3469d9656dd84d5123a42b9a | train | function | def _get_layers_params(layers):
return sum((list(l.parameters()) for l in layers), [])
| def _get_layers_params(layers):
| return sum((list(l.parameters()) for l in layers), [])
| ImplementedError
@property
def layers_except_first_params(self):
layers = get_slice(self.encoder_stages, 1, -1) + [self.bottlenecks, self.decoder_stages, self.final]
return _get_layers_params(layers)
def _get_layers_params(layers):
| 64 | 64 | 22 | 8 | 56 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | _get_layers_params | _get_layers_params | 285 | 286 | 285 | 285 | 242ebbb2949454ae90ca584c758b2e1a075c7d1c | bigcode/the-stack | train |
a62ceb09d1deacb449f2b91f | train | class | class ConvSCSEBottleneckNoBn(nn.Module):
def __init__(self, in_channels, out_channels, reduction=2, mode='concat'):
print("bottleneck ", in_channels, out_channels)
super().__init__()
self.seq = nn.Sequential(
nn.Conv2d(in_channels, out_channels, 3, padding=1),
nn.ReLU... | class ConvSCSEBottleneckNoBn(nn.Module):
| def __init__(self, in_channels, out_channels, reduction=2, mode='concat'):
print("bottleneck ", in_channels, out_channels)
super().__init__()
self.seq = nn.Sequential(
nn.Conv2d(in_channels, out_channels, 3, padding=1),
nn.ReLU(inplace=True),
SCSEModule(ou... | return encoder.layer2
elif layer == 3:
return encoder.layer3
elif layer == 4:
return encoder.layer4
@property
def first_layer_params_names(self):
return ['layer0.conv1']
class ConvSCSEBottleneckNoBn(nn.Module):
| 64 | 64 | 129 | 12 | 52 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | ConvSCSEBottleneckNoBn | ConvSCSEBottleneckNoBn | 365 | 377 | 365 | 365 | 0eddc31a0d62a758dd18699593d0147bce8efc58 | bigcode/the-stack | train |
35f9968f3dadbafeec3ec2ae | train | class | class Conv3x3(BasicConvAct):
def __init__(self, in_channels, out_channels, dilation=1):
super().__init__(in_channels, out_channels, kernel_size=3, dilation=dilation, activation=None)
| class Conv3x3(BasicConvAct):
| def __init__(self, in_channels, out_channels, dilation=1):
super().__init__(in_channels, out_channels, kernel_size=3, dilation=dilation, activation=None)
| x1(BasicConvAct):
def __init__(self, in_channels, out_channels, dilation=1, bias=True):
super().__init__(in_channels, out_channels, kernel_size=1, dilation=dilation, activation=None, bias=bias)
class Conv3x3(BasicConvAct):
| 64 | 64 | 50 | 10 | 54 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | Conv3x3 | Conv3x3 | 115 | 117 | 115 | 115 | 6252ae0f3d7ae29e80ac4570d200db9f07286080 | bigcode/the-stack | train |
7de40ae6e69b171f6fd44172 | train | class | class Conv1x1(BasicConvAct):
def __init__(self, in_channels, out_channels, dilation=1, bias=True):
super().__init__(in_channels, out_channels, kernel_size=1, dilation=dilation, activation=None, bias=bias)
| class Conv1x1(BasicConvAct):
| def __init__(self, in_channels, out_channels, dilation=1, bias=True):
super().__init__(in_channels, out_channels, kernel_size=1, dilation=dilation, activation=None, bias=bias)
| )
self.use_act = activation is not None
if self.use_act:
self.act = activation()
def forward(self, x):
x = self.op(x)
if self.use_act:
x = self.act(x)
return x
class Conv1x1(BasicConvAct):
| 64 | 64 | 57 | 10 | 53 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | Conv1x1 | Conv1x1 | 110 | 112 | 110 | 110 | b8959229fa754c2004f2f1917acf777b020edc78 | bigcode/the-stack | train |
7f7a2698fd6ee699c753ba71 | train | class | class ResneXt(SiameseEncoderDecoder):
def __init__(self, seg_classes, backbone_arch, shared=False):
self.first_layer_stride_two = True
super().__init__(seg_classes, 3, backbone_arch, shared=shared)
def get_encoder(self, encoder, layer):
if layer == 0:
return nn.Sequential(
... | class ResneXt(SiameseEncoderDecoder):
| def __init__(self, seg_classes, backbone_arch, shared=False):
self.first_layer_stride_two = True
super().__init__(seg_classes, 3, backbone_arch, shared=shared)
def get_encoder(self, encoder, layer):
if layer == 0:
return nn.Sequential(
encoder.conv1,
... | return nn.Sequential(
encoder.maxpool,
encoder.layer1)
elif layer == 2:
return encoder.layer2
elif layer == 3:
return encoder.layer3
elif layer == 4:
return encoder.layer4
class ResneXt(SiameseEncoderDecoder):
| 64 | 64 | 168 | 10 | 53 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | ResneXt | ResneXt | 403 | 427 | 403 | 403 | e6936131f67e55041ad81343e2f2d0228f7b8d48 | bigcode/the-stack | train |
47a4db3991a703ad16b70914 | train | class | class ConvReLu1x1(BasicConvAct):
def __init__(self, in_channels, out_channels, dilation=1):
super().__init__(in_channels, out_channels, kernel_size=1, dilation=dilation, activation=nn.ReLU)
| class ConvReLu1x1(BasicConvAct):
| def __init__(self, in_channels, out_channels, dilation=1):
super().__init__(in_channels, out_channels, kernel_size=1, dilation=dilation, activation=nn.ReLU)
| ias)
class Conv3x3(BasicConvAct):
def __init__(self, in_channels, out_channels, dilation=1):
super().__init__(in_channels, out_channels, kernel_size=3, dilation=dilation, activation=None)
class ConvReLu1x1(BasicConvAct):
| 64 | 64 | 55 | 12 | 52 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | ConvReLu1x1 | ConvReLu1x1 | 120 | 122 | 120 | 120 | b3774079d26061e03a23277704d0a0d5f11d268e | bigcode/the-stack | train |
4076b25cd24ad9adefc81f93 | train | class | class ConvReLu3x3(BasicConvAct):
def __init__(self, in_channels, out_channels, dilation=1):
super().__init__(in_channels, out_channels, kernel_size=3, dilation=dilation, activation=nn.ReLU)
| class ConvReLu3x3(BasicConvAct):
| def __init__(self, in_channels, out_channels, dilation=1):
super().__init__(in_channels, out_channels, kernel_size=3, dilation=dilation, activation=nn.ReLU)
| Lu1x1(BasicConvAct):
def __init__(self, in_channels, out_channels, dilation=1):
super().__init__(in_channels, out_channels, kernel_size=1, dilation=dilation, activation=nn.ReLU)
class ConvReLu3x3(BasicConvAct):
| 64 | 64 | 55 | 12 | 52 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | ConvReLu3x3 | ConvReLu3x3 | 125 | 127 | 125 | 125 | 1f59c51a6f33a052fbc9d031acd955981fd758b7 | bigcode/the-stack | train |
a1be1c8684c6f6b6f2662e13 | train | class | class Resnet(SiameseEncoderDecoder):
def __init__(self, seg_classes, backbone_arch):
self.first_layer_stride_two = True,
super().__init__(seg_classes, 3, backbone_arch)
def get_encoder(self, encoder, layer):
if layer == 0:
return nn.Sequential(
encoder.conv1,... | class Resnet(SiameseEncoderDecoder):
| def __init__(self, seg_classes, backbone_arch):
self.first_layer_stride_two = True,
super().__init__(seg_classes, 3, backbone_arch)
def get_encoder(self, encoder, layer):
if layer == 0:
return nn.Sequential(
encoder.conv1,
encoder.bn1,
... | 1),
nn.ReLU(inplace=True),
SCSEModule(out_channels, reduction=reduction, mode=mode)
)
def forward(self, dec, enc):
x = torch.cat([dec, enc], dim=1)
return self.seq(x)
class Resnet(SiameseEncoderDecoder):
| 64 | 64 | 142 | 9 | 55 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | Resnet | Resnet | 380 | 400 | 380 | 380 | a3157cc8fc6cd6841c92429ef9d635284b9f68c1 | bigcode/the-stack | train |
385eb28d6ec067300bd00823 | train | class | class UnetDecoderBlock(nn.Module):
def __init__(self, in_channels, middle_channels, out_channels):
super().__init__()
self.layer = nn.Sequential(
nn.Upsample(scale_factor=2),
nn.Conv2d(in_channels, out_channels, 3, padding=1),
nn.ReLU(inplace=True)
)
... | class UnetDecoderBlock(nn.Module):
| def __init__(self, in_channels, middle_channels, out_channels):
super().__init__()
self.layer = nn.Sequential(
nn.Upsample(scale_factor=2),
nn.Conv2d(in_channels, out_channels, 3, padding=1),
nn.ReLU(inplace=True)
)
def forward(self, x):
retur... | nn.Conv2d(in_channels, out_channels, 3, padding=1),
nn.ReLU(inplace=True)
)
def forward(self, dec, enc):
x = torch.cat([dec, enc], dim=1)
return self.seq(x)
class UnetDecoderBlock(nn.Module):
| 64 | 64 | 86 | 8 | 56 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | UnetDecoderBlock | UnetDecoderBlock | 308 | 318 | 308 | 308 | 65d4cc641484e2e2da9d517d95ea1a3548166ecf | bigcode/the-stack | train |
a90ed7c9ad83ec3ffb79b284 | train | class | class SCSeResneXt(SiameseEncoderDecoder):
def __init__(self, seg_classes, backbone_arch, reduction=2, mode='concat', num_channels=3, shared=False):
if not hasattr(self, 'bottleneck_type'):
self.bottleneck_type = partial(ConvSCSEBottleneckNoBn, reduction=reduction, mode=mode)
self.first_... | class SCSeResneXt(SiameseEncoderDecoder):
| def __init__(self, seg_classes, backbone_arch, reduction=2, mode='concat', num_channels=3, shared=False):
if not hasattr(self, 'bottleneck_type'):
self.bottleneck_type = partial(ConvSCSEBottleneckNoBn, reduction=reduction, mode=mode)
self.first_layer_stride_two = True
self.concat... | .cat([dec, enc], dim=1)
return self.seq(x)
class UnetDecoderBlock(nn.Module):
def __init__(self, in_channels, middle_channels, out_channels):
super().__init__()
self.layer = nn.Sequential(
nn.Upsample(scale_factor=2),
nn.Conv2d(in_channels, out_channels, 3, padding=... | 114 | 114 | 382 | 12 | 102 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | SCSeResneXt | SCSeResneXt | 321 | 362 | 321 | 322 | 6399d25b199d24f876cb13e4d8833fbe740c66aa | bigcode/the-stack | train |
c5e05205dc72f872631e5866 | train | class | class EfficientUnet(SiameseEncoderDecoder):
def __init__(self, seg_classes, backbone_arch='efficientnet-b2', shared=False):
self.first_layer_stride_two = True
self._stage_idxs = encoder_params[backbone_arch]['stage_idxs']
super().__init__(seg_classes, 3, backbone_arch, shared=shared)
de... | class EfficientUnet(SiameseEncoderDecoder):
| def __init__(self, seg_classes, backbone_arch='efficientnet-b2', shared=False):
self.first_layer_stride_two = True
self._stage_idxs = encoder_params[backbone_arch]['stage_idxs']
super().__init__(seg_classes, 3, backbone_arch, shared=shared)
def get_encoder(self, encoder, layer):
... | 3b,
encoder.conv2d_4a
)
elif layer == 2:
return nn.Sequential(
encoder.maxpool_5a,
encoder.mixed_5b,
encoder.repeat
)
elif layer == 3:
return nn.Sequential(
encoder.mixed_6a,
... | 187 | 187 | 624 | 10 | 177 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | EfficientUnet | EfficientUnet | 586 | 645 | 586 | 586 | 2b95f8c504126f42268e9120f65e7ddba79d0e92 | bigcode/the-stack | train |
d2793a146cb615f771880953 | train | class | class DensenetUnet(SiameseEncoderDecoder):
def __init__(self, seg_classes, backbone_arch='densenet161', shared=True):
self.first_layer_stride_two = True
super().__init__(seg_classes, 3, backbone_arch, shared=shared)
def get_encoder(self, encoder, layer):
if layer == 0:
retur... | class DensenetUnet(SiameseEncoderDecoder):
| def __init__(self, seg_classes, backbone_arch='densenet161', shared=True):
self.first_layer_stride_two = True
super().__init__(seg_classes, 3, backbone_arch, shared=shared)
def get_encoder(self, encoder, layer):
if layer == 0:
return nn.Sequential(
encoder.fe... | - 1], enc_results2[rev_idx - 1]], dim=1))
if self.first_layer_stride_two:
x = self.last_upsample(x)
x = self.dropout(x)
f = self.final(x)
return f
class DensenetUnet(SiameseEncoderDecoder):
| 66 | 66 | 220 | 12 | 53 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | DensenetUnet | DensenetUnet | 494 | 514 | 494 | 494 | 491b0ba1e95b97bff5c0ffc61b9279748ae31daf | bigcode/the-stack | train |
625a68c468eead96a2afd8d6 | train | class | class IRV2Unet(SiameseEncoderDecoder):
def __init__(self, seg_classes, backbone_arch='inceptionresnetv2', num_channels=3):
self.first_layer_stride_two = True
super().__init__(seg_classes, num_channels, backbone_arch)
for m in self.modules():
if isinstance(m, nn.Conv2d):
... | class IRV2Unet(SiameseEncoderDecoder):
| def __init__(self, seg_classes, backbone_arch='inceptionresnetv2', num_channels=3):
self.first_layer_stride_two = True
super().__init__(seg_classes, num_channels, backbone_arch)
for m in self.modules():
if isinstance(m, nn.Conv2d):
if m.kernel_size == (3, 3):
... | init__(seg_classes, 3, backbone_arch, shared=shared)
def get_encoder(self, encoder, layer):
if layer == 0:
return encoder.layer0
elif layer == 1:
return nn.Sequential(
encoder.pool,
encoder.layer1)
elif layer == 2:
return e... | 110 | 110 | 368 | 12 | 97 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | IRV2Unet | IRV2Unet | 537 | 583 | 537 | 537 | 83584b139d777f0e45332459e906f9f98a279e04 | bigcode/the-stack | train |
1fe152b043e566c6c46c64c3 | train | class | class SiameseEncoderDecoder(AbstractModel):
def __init__(self, num_classes, num_channels=3, encoder_name='resnet34', shared=False):
if not hasattr(self, 'first_layer_stride_two'):
self.first_layer_stride_two = False
if not hasattr(self, 'decoder_block'):
self.decoder_block = ... | class SiameseEncoderDecoder(AbstractModel):
| def __init__(self, num_classes, num_channels=3, encoder_name='resnet34', shared=False):
if not hasattr(self, 'first_layer_stride_two'):
self.first_layer_stride_two = False
if not hasattr(self, 'decoder_block'):
self.decoder_block = UnetDecoderBlock
if not hasattr(self... | 'state_dict' in pretrained_dict:
pretrained_dict = pretrained_dict['state_dict']
pretrained_dict = {k.replace("module.", ""): v for k, v in pretrained_dict.items()}
model_dict = model.state_dict()
pretrained_dict = {k: v for k, v in pretrained_dict.items() if k in model_dict}
... | 256 | 256 | 1,087 | 8 | 248 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | SiameseEncoderDecoder | SiameseEncoderDecoder | 185 | 282 | 185 | 185 | c41bbc62ef1735caa176d827873b613c8621b67d | bigcode/the-stack | train |
3480d1d421076b1be992fa5f | train | function | def get_slice(features, start, end):
if end == -1:
end = len(features)
return [features[i] for i in range(start, end)]
| def get_slice(features, start, end):
| if end == -1:
end = len(features)
return [features[i] for i in range(start, end)]
| , 1, -1) + [self.bottlenecks, self.decoder_stages, self.final]
return _get_layers_params(layers)
def _get_layers_params(layers):
return sum((list(l.parameters()) for l in layers), [])
def get_slice(features, start, end):
| 63 | 64 | 36 | 9 | 54 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | get_slice | get_slice | 289 | 292 | 289 | 289 | a0e5aa819427b08541f6364c0d7c2989ae01fcd9 | bigcode/the-stack | train |
30a736663a2c60e81cc800f9 | train | class | class BasicConvAct(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, dilation=1, activation=nn.ReLU, bias=True):
super().__init__()
padding = int((kernel_size - 1) / 2) * dilation
self.op = nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, padding=padding, ... | class BasicConvAct(nn.Module):
| def __init__(self, in_channels, out_channels, kernel_size=1, dilation=1, activation=nn.ReLU, bias=True):
super().__init__()
padding = int((kernel_size - 1) / 2) * dilation
self.op = nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, padding=padding, dilation=dilation,
... | 'decoder_filters': [48, 96, 192, 256],
'init_op': partial(EfficientNet.from_pretrained, "efficientnet-b4"),
'url': None},
}
import torch
from torch import nn
import torch.nn.functional as F
class BasicConvAct(nn.Module):
| 64 | 64 | 147 | 7 | 56 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | BasicConvAct | BasicConvAct | 93 | 107 | 93 | 93 | 51ee8b2427c11529190fbfd639381cdde6ef6df1 | bigcode/the-stack | train |
34ca26913241f80ed9b6d8c3 | train | class | class DPNUnet(SiameseEncoderDecoder):
def __init__(self, seg_classes, backbone_arch='dpn92', num_channels=3, shared=False):
self.first_layer_stride_two = True
super().__init__(seg_classes, num_channels, backbone_arch, shared=shared)
def get_encoder(self, encoder, layer):
if layer == 0:
... | class DPNUnet(SiameseEncoderDecoder):
| def __init__(self, seg_classes, backbone_arch='dpn92', num_channels=3, shared=False):
self.first_layer_stride_two = True
super().__init__(seg_classes, num_channels, backbone_arch, shared=shared)
def get_encoder(self, encoder, layer):
if layer == 0:
return nn.Sequential(
... | elif layer == 1:
return nn.Sequential(
encoder.maxpool,
encoder.layer1)
elif layer == 2:
return encoder.layer2
elif layer == 3:
return encoder.layer3
elif layer == 4:
return encoder.layer4
@property
... | 90 | 90 | 302 | 11 | 79 | maloyan/Roscosmos | src/models/siamese_unet.py | Python | DPNUnet | DPNUnet | 430 | 456 | 430 | 430 | f20f94c077e08fed3a66ff676ba22f886e87599f | bigcode/the-stack | train |
ef6c6a4393d57fa24f7a4178 | train | class | class GenericResource(Resource):
"""Resource information.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource ID
:vartype id: str
:ivar name: Resource name
:vartype name: str
:ivar type: Resource type
:vartype type: str
:pa... | class GenericResource(Resource):
| """Resource information.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource ID
:vartype id: str
:ivar name: Resource name
:vartype name: str
:ivar type: Resource type
:vartype type: str
:param location: Resource location
... | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 87 | 183 | 613 | 5 | 81 | Christina-Kang/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/generic_resource_py3.py | Python | GenericResource | GenericResource | 15 | 73 | 15 | 15 | 6570c8743904357636a0bcace4d9ea42824e8545 | bigcode/the-stack | train |
241b51f6cbec5648dad7f08f | train | class | class BackupTestCase(test.TestCase):
"""Test Case for backups."""
def setUp(self):
super(BackupTestCase, self).setUp()
vol_tmpdir = tempfile.mkdtemp()
self.flags(connection_type='fake',
volumes_dir=vol_tmpdir)
self.backup_mgr = \
importutils.import... | class BackupTestCase(test.TestCase):
| """Test Case for backups."""
def setUp(self):
super(BackupTestCase, self).setUp()
vol_tmpdir = tempfile.mkdtemp()
self.flags(connection_type='fake',
volumes_dir=vol_tmpdir)
self.backup_mgr = \
importutils.import_object(CONF.backup_manager)
... | # Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | 256 | 256 | 3,348 | 8 | 247 | hopem/cinder | cinder/tests/test_backup.py | Python | BackupTestCase | BackupTestCase | 42 | 420 | 42 | 42 | 35dd6dc7d81494af09f004659e4498fefa7953d7 | bigcode/the-stack | train |
bcfbc6f734fc501c5efc3cca | train | class | class FakeBackupException(Exception):
pass
| class FakeBackupException(Exception):
| pass
|
from cinder import exception
from cinder.openstack.common import importutils
from cinder.openstack.common import log as logging
from cinder.openstack.common import timeutils
from cinder import test
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
class FakeBackupException(Exception):
| 64 | 64 | 9 | 6 | 58 | hopem/cinder | cinder/tests/test_backup.py | Python | FakeBackupException | FakeBackupException | 38 | 39 | 38 | 38 | b93bb1ad108bf89c1a4f2fe93e02cc0b828d1eca | bigcode/the-stack | train |
a264da7b9b89e8ae8e26417b | train | class | class EnglishDatePeriodParserConfiguration(DatePeriodParserConfiguration):
@property
def date_extractor(self) -> DateTimeExtractor:
return self._date_extractor
@property
def date_parser(self) -> DateTimeParser:
return self._date_parser
@property
def duration_extractor(self) -> ... | class EnglishDatePeriodParserConfiguration(DatePeriodParserConfiguration):
@property
| def date_extractor(self) -> DateTimeExtractor:
return self._date_extractor
@property
def date_parser(self) -> DateTimeParser:
return self._date_parser
@property
def duration_extractor(self) -> DateTimeExtractor:
return self._duration_extractor
@property
def duratio... | from typing import Pattern, Dict
from recognizers_text.utilities import RegExpUtility
from ...resources.english_date_time import EnglishDateTime
from ..extractors import DateTimeExtractor
from ..parsers import DateTimeParser
from ..base_configs import BaseDateParserConfiguration
from ..base_dateperiod import DatePerio... | 83 | 256 | 2,179 | 15 | 67 | acblacktea/Recognizers-Text | Python/libraries/recognizers-date-time/recognizers_date_time/date_time/english/dateperiod_parser_config.py | Python | EnglishDatePeriodParserConfiguration | EnglishDatePeriodParserConfiguration | 10 | 258 | 10 | 11 | 99689b3cbd07b8af989b200b202ae156b9970ebc | bigcode/the-stack | train |
4f9bf9feb92fafd8a2a461eb | train | class | class HttpPostClientTransport(ClientTransport):
"""HTTP POST based client transport.
Requires :py:mod:`requests`. Submits messages to a server using the body of
an ``HTTP`` ``POST`` request. Replies are taken from the responses body.
:param endpoint: The URL to send ``POST`` data to.
:param post_m... | class HttpPostClientTransport(ClientTransport):
| """HTTP POST based client transport.
Requires :py:mod:`requests`. Submits messages to a server using the body of
an ``HTTP`` ``POST`` request. Replies are taken from the responses body.
:param endpoint: The URL to send ``POST`` data to.
:param post_method: allows to replace `requests.post` with an... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import six
import requests
import geventwebsocket as websocket
from . import ClientTransport
class HttpPostClientTransport(ClientTransport):
| 42 | 68 | 229 | 8 | 33 | yy18/raidenenv | lib/python2.7/site-packages/tinyrpc/transports/http.py | Python | HttpPostClientTransport | HttpPostClientTransport | 11 | 37 | 11 | 11 | 28293b5b34a1da839c443efd798f536473cba582 | bigcode/the-stack | train |
e48a1cb38d3a5d583fcb83ae | train | class | class HttpWebSocketClientTransport(ClientTransport):
"""HTTP WebSocket based client transport.
Requires :py:mod:`websocket-python`. Submits messages to a server using the body of
an ``HTTP`` ``WebSocket`` message. Replies are taken from the response of the websocket.
The connection is establish on the... | class HttpWebSocketClientTransport(ClientTransport):
| """HTTP WebSocket based client transport.
Requires :py:mod:`websocket-python`. Submits messages to a server using the body of
an ``HTTP`` ``WebSocket`` message. Replies are taken from the response of the websocket.
The connection is establish on the ``__init__`` because the protocol is connection orie... | post_method
def send_message(self, message, expect_reply=True):
if not isinstance(message, six.binary_type):
raise TypeError('str expected')
r = self.post(self.endpoint, data=message, **self.request_kwargs)
if expect_reply:
return r.content
class HttpWebSocketClie... | 69 | 69 | 231 | 9 | 59 | yy18/raidenenv | lib/python2.7/site-packages/tinyrpc/transports/http.py | Python | HttpWebSocketClientTransport | HttpWebSocketClientTransport | 40 | 67 | 40 | 40 | 2cecd061255602a905011765a84b88369871b944 | bigcode/the-stack | train |
96a92b7d16f83d509eade630 | train | function | @pytest.fixture(scope='session')
def session_config(request):
db_name = 'test_changes'
return {
'db_name': db_name,
# TODO(dcramer): redis db is shared
'redis_db': '9',
}
| @pytest.fixture(scope='session')
def session_config(request):
| db_name = 'test_changes'
return {
'db_name': db_name,
# TODO(dcramer): redis db is shared
'redis_db': '9',
}
| from alembic import command
from sqlalchemy import event
from sqlalchemy.orm import Session
alembic_cfg = Config(os.path.join(root, 'alembic.ini'))
from changes.config import create_app, db
from changes.storage.mock import FileStorageCache
@pytest.fixture(scope='session')
def session_config(request):
| 64 | 64 | 52 | 11 | 52 | bowlofstew/changes | conftest.py | Python | session_config | session_config | 20 | 28 | 20 | 21 | 3c4635a081b70768044b7f71207ba0b26e33b70a | bigcode/the-stack | train |
f2848f27a510e15a4320b4dc | train | function | @pytest.fixture(scope='session', autouse=True)
def setup_db(request, app, session_config):
db_name = session_config['db_name']
# 9.1 does not support --if-exists
if os.system("psql -l | grep '%s'" % db_name) == 0:
assert not os.system('dropdb %s' % db_name)
assert not os.system('createdb -E utf-... | @pytest.fixture(scope='session', autouse=True)
def setup_db(request, app, session_config):
| db_name = session_config['db_name']
# 9.1 does not support --if-exists
if os.system("psql -l | grep '%s'" % db_name) == 0:
assert not os.system('dropdb %s' % db_name)
assert not os.system('createdb -E utf-8 %s' % db_name)
command.upgrade(alembic_cfg, 'head')
@event.listens_for(Session,... | ',
SNAPSHOT_S3_BUCKET='snapshot-bucket'
)
app_context = app.test_request_context()
context = app_context.push()
# request.addfinalizer(app_context.pop)
return app
@pytest.fixture(scope='session', autouse=True)
def setup_db(request, app, session_config):
| 64 | 64 | 153 | 20 | 43 | bowlofstew/changes | conftest.py | Python | setup_db | setup_db | 59 | 72 | 59 | 60 | c87933f0122b23991eab1e5230fd919c39737114 | bigcode/the-stack | train |
4c5a21e400afa842309379c8 | train | function | @pytest.fixture(autouse=True)
def db_session(request):
request.addfinalizer(db.session.remove)
db.session.begin_nested()
| @pytest.fixture(autouse=True)
def db_session(request):
| request.addfinalizer(db.session.remove)
db.session.begin_nested()
| :
session.begin_nested()
# TODO: find a way to kill db connections so we can dropdob
# def teardown():
# os.system('dropdb %s' % db_name)
# request.addfinalizer(teardown)
@pytest.fixture(autouse=True)
def db_session(request):
| 64 | 64 | 27 | 12 | 52 | bowlofstew/changes | conftest.py | Python | db_session | db_session | 81 | 85 | 81 | 82 | 7f153adecd0221f7428542bd0c5ce3c040f2feaa | bigcode/the-stack | train |
41402b908dd252ac2a72308f | train | function | @pytest.fixture(autouse=True)
def redis_session(request, app):
import redis
conn = redis.from_url(app.config['REDIS_URL'])
conn.flushdb()
| @pytest.fixture(autouse=True)
def redis_session(request, app):
| import redis
conn = redis.from_url(app.config['REDIS_URL'])
conn.flushdb()
| # os.system('dropdb %s' % db_name)
# request.addfinalizer(teardown)
@pytest.fixture(autouse=True)
def db_session(request):
request.addfinalizer(db.session.remove)
db.session.begin_nested()
@pytest.fixture(autouse=True)
def redis_session(request, app):
| 64 | 64 | 36 | 14 | 50 | bowlofstew/changes | conftest.py | Python | redis_session | redis_session | 88 | 92 | 88 | 89 | f65bedee77dfa980444cf0214fe4fa913fc7ddc3 | bigcode/the-stack | train |
835564b414ef775989f08420 | train | function | def pytest_runtest_setup(item):
FileStorageCache.clear()
| def pytest_runtest_setup(item):
| FileStorageCache.clear()
| def db_session(request):
request.addfinalizer(db.session.remove)
db.session.begin_nested()
@pytest.fixture(autouse=True)
def redis_session(request, app):
import redis
conn = redis.from_url(app.config['REDIS_URL'])
conn.flushdb()
def pytest_runtest_setup(item):
| 64 | 64 | 14 | 8 | 56 | bowlofstew/changes | conftest.py | Python | pytest_runtest_setup | pytest_runtest_setup | 95 | 96 | 95 | 95 | 5062b79e2bc64ae2c97f5edd87eebb8bf57d3b9e | bigcode/the-stack | train |
bf648134ef3a917447e307a9 | train | function | @pytest.fixture(scope='session')
def app(request, session_config):
app = create_app(
_read_config=False,
TESTING=True,
SQLALCHEMY_DATABASE_URI='postgresql:///' + session_config['db_name'],
REDIS_URL='redis://localhost/' + session_config['redis_db'],
BASE_URI='http://example.c... | @pytest.fixture(scope='session')
def app(request, session_config):
| app = create_app(
_read_config=False,
TESTING=True,
SQLALCHEMY_DATABASE_URI='postgresql:///' + session_config['db_name'],
REDIS_URL='redis://localhost/' + session_config['redis_db'],
BASE_URI='http://example.com',
REPO_ROOT='/tmp',
GREEN_BUILD_URL='https://foo... | .storage.mock import FileStorageCache
@pytest.fixture(scope='session')
def session_config(request):
db_name = 'test_changes'
return {
'db_name': db_name,
# TODO(dcramer): redis db is shared
'redis_db': '9',
}
@pytest.fixture(scope='session')
def app(request, session_config):
| 72 | 72 | 243 | 13 | 59 | bowlofstew/changes | conftest.py | Python | app | app | 31 | 56 | 31 | 32 | 2c36e0a2ac1218865629873ce9e1480822e85a11 | bigcode/the-stack | train |
03a42cf3517c336e696494d9 | train | function | def parse_version_info(version_str):
"""Parse a version string into a tuple.
Args:
version_str (str): The version string.
Returns:
tuple[int | str]: The version info, e.g., "1.3.0" is parsed into
(1, 3, 0), and "2.0.0rc1" is parsed into (2, 0, 0, 'rc1').
"""
version_info... | def parse_version_info(version_str):
| """Parse a version string into a tuple.
Args:
version_str (str): The version string.
Returns:
tuple[int | str]: The version info, e.g., "1.3.0" is parsed into
(1, 3, 0), and "2.0.0rc1" is parsed into (2, 0, 0, 'rc1').
"""
version_info = []
for x in version_str.split(... | # Copyright (c) OpenMMLab. All rights reserved
__version__ = '0.23.0'
def parse_version_info(version_str):
| 32 | 64 | 173 | 7 | 25 | youqingxiaozhua/mmclassification | mmcls/version.py | Python | parse_version_info | parse_version_info | 6 | 23 | 6 | 6 | ee0a3c629f1163bcab0d57af16c6e79af9757142 | bigcode/the-stack | train |
6ff569f79d94f9cff8338b0a | train | function | def _assert_endpoint_tags_match(sagemaker_client, endpoint_name, tags):
endpoint_description = sagemaker_client.describe_endpoint(EndpointName=endpoint_name)
_assert_tags_match(sagemaker_client, endpoint_description["EndpointArn"], tags)
| def _assert_endpoint_tags_match(sagemaker_client, endpoint_name, tags):
| endpoint_description = sagemaker_client.describe_endpoint(EndpointName=endpoint_name)
_assert_tags_match(sagemaker_client, endpoint_description["EndpointArn"], tags)
| _assert_model_tags_match(sagemaker_client, model_name, tags):
model_description = sagemaker_client.describe_model(ModelName=model_name)
_assert_tags_match(sagemaker_client, model_description["ModelArn"], tags)
def _assert_endpoint_tags_match(sagemaker_client, endpoint_name, tags):
| 64 | 64 | 51 | 16 | 48 | aws-patlin/sagemaker-python-sdk | tests/integ/test_tf_script_mode.py | Python | _assert_endpoint_tags_match | _assert_endpoint_tags_match | 252 | 255 | 252 | 252 | 4199e964cec1623ef820f37e53159658d0ecbdda | bigcode/the-stack | train |
227f9b2ef9e0ea8424fb27e1 | train | function | def _assert_model_name_match(sagemaker_client, endpoint_config_name, model_name):
endpoint_config_description = sagemaker_client.describe_endpoint_config(
EndpointConfigName=endpoint_config_name
)
assert model_name == endpoint_config_description["ProductionVariants"][0]["ModelName"]
| def _assert_model_name_match(sagemaker_client, endpoint_config_name, model_name):
| endpoint_config_description = sagemaker_client.describe_endpoint_config(
EndpointConfigName=endpoint_config_name
)
assert model_name == endpoint_config_description["ProductionVariants"][0]["ModelName"]
| tags):
training_job_description = sagemaker_client.describe_training_job(
TrainingJobName=training_job_name
)
_assert_tags_match(sagemaker_client, training_job_description["TrainingJobArn"], tags)
def _assert_model_name_match(sagemaker_client, endpoint_config_name, model_name):
| 64 | 64 | 59 | 18 | 46 | aws-patlin/sagemaker-python-sdk | tests/integ/test_tf_script_mode.py | Python | _assert_model_name_match | _assert_model_name_match | 265 | 269 | 265 | 265 | df67e1c2ed6014b6d245ec78b98c4e880b23720a | bigcode/the-stack | train |
daf1d19692b6d0dcd9d1cdff | train | function | @pytest.mark.canary_quick
def test_mnist_distributed(sagemaker_session, instance_type, tf_full_version, py_version):
estimator = TensorFlow(
entry_point=SCRIPT,
role=ROLE,
train_instance_count=2,
train_instance_type=instance_type,
sagemaker_session=sagemaker_session,
... | @pytest.mark.canary_quick
def test_mnist_distributed(sagemaker_session, instance_type, tf_full_version, py_version):
| estimator = TensorFlow(
entry_point=SCRIPT,
role=ROLE,
train_instance_count=2,
train_instance_type=instance_type,
sagemaker_session=sagemaker_session,
py_version="py37",
script_mode=True,
framework_version=tf_full_version,
distributions=PARAMET... | =1,
instance_type="ml.c5.xlarge",
endpoint_name=endpoint_name,
entry_point=os.path.join(TFS_RESOURCE_PATH, "inference.py"),
)
@pytest.mark.canary_quick
def test_mnist_distributed(sagemaker_session, instance_type, tf_full_version, py_version):
| 66 | 66 | 223 | 28 | 38 | aws-patlin/sagemaker-python-sdk | tests/integ/test_tf_script_mode.py | Python | test_mnist_distributed | test_mnist_distributed | 134 | 157 | 134 | 135 | 409613d1d5f94b18e9e4499bd43a4d1d243f1f0f | bigcode/the-stack | train |
d3853e436b3e1428c9801866 | train | function | def _assert_training_job_tags_match(sagemaker_client, training_job_name, tags):
training_job_description = sagemaker_client.describe_training_job(
TrainingJobName=training_job_name
)
_assert_tags_match(sagemaker_client, training_job_description["TrainingJobArn"], tags)
| def _assert_training_job_tags_match(sagemaker_client, training_job_name, tags):
| training_job_description = sagemaker_client.describe_training_job(
TrainingJobName=training_job_name
)
_assert_tags_match(sagemaker_client, training_job_description["TrainingJobArn"], tags)
| _match(sagemaker_client, endpoint_name, tags):
endpoint_description = sagemaker_client.describe_endpoint(EndpointName=endpoint_name)
_assert_tags_match(sagemaker_client, endpoint_description["EndpointArn"], tags)
def _assert_training_job_tags_match(sagemaker_client, training_job_name, tags):
| 64 | 64 | 62 | 18 | 46 | aws-patlin/sagemaker-python-sdk | tests/integ/test_tf_script_mode.py | Python | _assert_training_job_tags_match | _assert_training_job_tags_match | 258 | 262 | 258 | 258 | 16f6fc4c376f5acc84cd513fb4418d55263d2896 | bigcode/the-stack | train |
3f24dcd2c124bec7ab575a44 | train | function | def test_server_side_encryption(sagemaker_session, tf_serving_version, py_version):
with kms_utils.bucket_with_encryption(sagemaker_session, ROLE) as (bucket_with_kms, kms_key):
output_path = os.path.join(
bucket_with_kms, "test-server-side-encryption", time.strftime("%y%m%d-%H%M")
)
... | def test_server_side_encryption(sagemaker_session, tf_serving_version, py_version):
| with kms_utils.bucket_with_encryption(sagemaker_session, ROLE) as (bucket_with_kms, kms_key):
output_path = os.path.join(
bucket_with_kms, "test-server-side-encryption", time.strftime("%y%m%d-%H%M")
)
estimator = TensorFlow(
entry_point="training.py",
sou... | ()
assert df.size > 0
expected_training_checkpoint_config = {
"S3Uri": checkpoint_s3_uri,
"LocalPath": checkpoint_local_path,
}
actual_training_checkpoint_config = sagemaker_session.sagemaker_client.describe_training_job(
TrainingJobName=training_job_name
)["CheckpointConfig... | 102 | 102 | 343 | 19 | 82 | aws-patlin/sagemaker-python-sdk | tests/integ/test_tf_script_mode.py | Python | test_server_side_encryption | test_server_side_encryption | 93 | 131 | 93 | 93 | 8fff2b6ca1879cd92d2ec529bfda69109b1b7b3c | bigcode/the-stack | train |
697c70166b5d10c4c9188a7f | train | function | def _assert_model_tags_match(sagemaker_client, model_name, tags):
model_description = sagemaker_client.describe_model(ModelName=model_name)
_assert_tags_match(sagemaker_client, model_description["ModelArn"], tags)
| def _assert_model_tags_match(sagemaker_client, model_name, tags):
| model_description = sagemaker_client.describe_model(ModelName=model_name)
_assert_tags_match(sagemaker_client, model_description["ModelArn"], tags)
| try_count, "Getting endpoint tags", seconds_to_sleep=30):
actual_tags = sagemaker_client.list_tags(ResourceArn=resource_arn)["Tags"]
if actual_tags:
break
assert actual_tags == tags
def _assert_model_tags_match(sagemaker_client, model_name, tags):
| 64 | 64 | 49 | 16 | 47 | aws-patlin/sagemaker-python-sdk | tests/integ/test_tf_script_mode.py | Python | _assert_model_tags_match | _assert_model_tags_match | 247 | 249 | 247 | 247 | d1cf8494e7f1896588ca6268e9bd555bfb1472ae | bigcode/the-stack | train |
d7659ac301573b6854ba69f4 | train | function | def test_mnist_with_checkpoint_config(
sagemaker_session, instance_type, tf_full_version, py_version
):
checkpoint_s3_uri = "s3://{}/checkpoints/tf-{}".format(
sagemaker_session.default_bucket(), sagemaker_timestamp()
)
checkpoint_local_path = "/test/checkpoint/path"
estimator = TensorFlow(
... | def test_mnist_with_checkpoint_config(
sagemaker_session, instance_type, tf_full_version, py_version
):
| checkpoint_s3_uri = "s3://{}/checkpoints/tf-{}".format(
sagemaker_session.default_bucket(), sagemaker_timestamp()
)
checkpoint_local_path = "/test/checkpoint/path"
estimator = TensorFlow(
entry_point=SCRIPT,
role="SageMakerRole",
train_instance_count=1,
train_inst... | , "mnist.py")
PARAMETER_SERVER_DISTRIBUTION = {"parameter_server": {"enabled": True}}
MPI_DISTRIBUTION = {"mpi": {"enabled": True}}
TAGS = [{"Key": "some-key", "Value": "some-value"}]
@pytest.fixture(scope="module")
def py_version(tf_full_version, tf_serving_version):
return "py37" if tf_full_version == tf_servin... | 122 | 122 | 408 | 25 | 96 | aws-patlin/sagemaker-python-sdk | tests/integ/test_tf_script_mode.py | Python | test_mnist_with_checkpoint_config | test_mnist_with_checkpoint_config | 48 | 90 | 48 | 50 | 1da0c9a16e88bda14807405c44edd9bd1b1159a3 | bigcode/the-stack | train |
17d5b2c1b8e38a22f48c8a71 | train | function | def test_deploy_with_input_handlers(
sagemaker_session, instance_type, tf_serving_version, py_version
):
estimator = TensorFlow(
entry_point="training.py",
source_dir=TFS_RESOURCE_PATH,
role=ROLE,
train_instance_count=1,
train_instance_type=instance_type,
py_versi... | def test_deploy_with_input_handlers(
sagemaker_session, instance_type, tf_serving_version, py_version
):
| estimator = TensorFlow(
entry_point="training.py",
source_dir=TFS_RESOURCE_PATH,
role=ROLE,
train_instance_count=1,
train_instance_type=instance_type,
py_version=py_version,
sagemaker_session=sagemaker_session,
script_mode=True,
framework_versi... | _client, predictor.endpoint, TAGS)
_assert_model_tags_match(sagemaker_session.sagemaker_client, model_name, TAGS)
_assert_model_name_match(sagemaker_session.sagemaker_client, endpoint_name, model_name)
def test_deploy_with_input_handlers(
sagemaker_session, instance_type, tf_serving_version, py_vers... | 76 | 76 | 256 | 26 | 50 | aws-patlin/sagemaker-python-sdk | tests/integ/test_tf_script_mode.py | Python | test_deploy_with_input_handlers | test_deploy_with_input_handlers | 202 | 234 | 202 | 204 | e103fcedcaa5f385abf3e6cf8ad6a43b1199e268 | bigcode/the-stack | train |
15662422534b6622b4088889 | train | function | @pytest.fixture(scope="module")
def py_version(tf_full_version, tf_serving_version):
return "py37" if tf_full_version == tf_serving_version else tests.integ.PYTHON_VERSION
| @pytest.fixture(scope="module")
def py_version(tf_full_version, tf_serving_version):
| return "py37" if tf_full_version == tf_serving_version else tests.integ.PYTHON_VERSION
| _DISTRIBUTION = {"parameter_server": {"enabled": True}}
MPI_DISTRIBUTION = {"mpi": {"enabled": True}}
TAGS = [{"Key": "some-key", "Value": "some-value"}]
@pytest.fixture(scope="module")
def py_version(tf_full_version, tf_serving_version):
| 64 | 64 | 42 | 18 | 46 | aws-patlin/sagemaker-python-sdk | tests/integ/test_tf_script_mode.py | Python | py_version | py_version | 43 | 45 | 43 | 44 | ddad25e29209bb46807341654b9b5c949eb5251e | bigcode/the-stack | train |
1a9750b1feaef4bb651bdecc | train | function | def test_mnist_async(sagemaker_session, cpu_instance_type, tf_full_version, py_version):
estimator = TensorFlow(
entry_point=SCRIPT,
role=ROLE,
train_instance_count=1,
train_instance_type="ml.c5.4xlarge",
py_version=tests.integ.PYTHON_VERSION,
sagemaker_session=sagema... | def test_mnist_async(sagemaker_session, cpu_instance_type, tf_full_version, py_version):
| estimator = TensorFlow(
entry_point=SCRIPT,
role=ROLE,
train_instance_count=1,
train_instance_type="ml.c5.4xlarge",
py_version=tests.integ.PYTHON_VERSION,
sagemaker_session=sagemaker_session,
script_mode=True,
# testing py-sdk functionality, no need to... | _PATH, "data"), key_prefix="scriptmode/distributed_mnist"
)
with tests.integ.timeout.timeout(minutes=tests.integ.TRAINING_DEFAULT_TIMEOUT_MINUTES):
estimator.fit(inputs=inputs, job_name=unique_name_from_base("test-tf-sm-distributed"))
assert_s3_files_exist(
sagemaker_session,
estima... | 122 | 122 | 408 | 21 | 101 | aws-patlin/sagemaker-python-sdk | tests/integ/test_tf_script_mode.py | Python | test_mnist_async | test_mnist_async | 160 | 199 | 160 | 160 | 0a65f873ffe24ec115ee7403bf68bb8b56e90ce8 | bigcode/the-stack | train |
200ff46f8f667723866e15db | train | function | def _assert_tags_match(sagemaker_client, resource_arn, tags, retry_count=15):
# endpoint and training tags might take minutes to propagate.
for _ in retries(retry_count, "Getting endpoint tags", seconds_to_sleep=30):
actual_tags = sagemaker_client.list_tags(ResourceArn=resource_arn)["Tags"]
if a... | def _assert_tags_match(sagemaker_client, resource_arn, tags, retry_count=15):
# endpoint and training tags might take minutes to propagate.
| for _ in retries(retry_count, "Getting endpoint tags", seconds_to_sleep=30):
actual_tags = sagemaker_client.list_tags(ResourceArn=resource_arn)["Tags"]
if actual_tags:
break
assert actual_tags == tags
| [4.0, 4.5, 6.0]}
result = predictor.predict(input_data)
assert expected_result == result
def _assert_tags_match(sagemaker_client, resource_arn, tags, retry_count=15):
# endpoint and training tags might take minutes to propagate.
| 64 | 64 | 87 | 33 | 30 | aws-patlin/sagemaker-python-sdk | tests/integ/test_tf_script_mode.py | Python | _assert_tags_match | _assert_tags_match | 237 | 244 | 237 | 238 | 4cc36a795d5bf49313714b41ecbeabafd00d32a5 | bigcode/the-stack | train |
5ab5e17489ac14af2056eb5a | train | class | class MyPolicy(tf_policy.TFPolicy):
def __init__(self, time_step_spec, net):
super(MyPolicy, self).__init__(
time_step_spec,
action_spec=tf.TensorSpec((None,), tf.float32))
self._net = net
def _action(self, time_step, policy_state=(), seed=None):
out, _ = self._net(time_step.observatio... | class MyPolicy(tf_policy.TFPolicy):
| def __init__(self, time_step_spec, net):
super(MyPolicy, self).__init__(
time_step_spec,
action_spec=tf.TensorSpec((None,), tf.float32))
self._net = net
def _action(self, time_step, policy_state=(), seed=None):
out, _ = self._net(time_step.observation)
out = tf.math.add(*tf.nest.fla... |
from tf_agents.specs import tensor_spec
from tf_agents.trajectories import policy_step
from tf_agents.trajectories import time_step as ts
from tf_agents.utils import common
from tf_agents.utils import test_utils
FLAGS = flags.FLAGS
class MyPolicy(tf_policy.TFPolicy):
| 64 | 64 | 108 | 9 | 54 | isabella232/agents | tf_agents/networks/nest_map_test.py | Python | MyPolicy | MyPolicy | 42 | 53 | 42 | 43 | 957097a214ab274f6bfe6233c4ff34c11ebc392c | bigcode/the-stack | train |
df4f279f33149220d35ae1d0 | train | class | class NestMapTest(test_utils.TestCase):
def setUp(self):
if not common.has_eager_been_enabled():
self.skipTest('Only supported in TF2.x.')
super(NestMapTest, self).setUp()
def testCreateAndCall(self):
net = sequential.Sequential([
nest_map.NestMap(
{'inp1': tf.keras.layers.De... | class NestMapTest(test_utils.TestCase):
| def setUp(self):
if not common.has_eager_been_enabled():
self.skipTest('Only supported in TF2.x.')
super(NestMapTest, self).setUp()
def testCreateAndCall(self):
net = sequential.Sequential([
nest_map.NestMap(
{'inp1': tf.keras.layers.Dense(8),
'inp2': sequential.S... | _map
from tf_agents.networks import sequential
from tf_agents.policies import policy_saver
from tf_agents.policies import tf_policy
from tf_agents.specs import tensor_spec
from tf_agents.trajectories import policy_step
from tf_agents.trajectories import time_step as ts
from tf_agents.utils import common
from tf_agents.... | 256 | 256 | 1,056 | 9 | 247 | isabella232/agents | tf_agents/networks/nest_map_test.py | Python | NestMapTest | NestMapTest | 64 | 175 | 64 | 65 | 526825998c7459fa49d0c9c7a730452dc0d6ac29 | bigcode/the-stack | train |
bd910cdc919ab4c95bc1f8a4 | train | class | class NestFlattenTest(test_utils.TestCase):
def testNestFlatten(self):
layer = nest_map.NestFlatten()
outputs = layer({'a': 1, 'b': 2})
self.assertEqual(self.evaluate(outputs), [1, 2])
| class NestFlattenTest(test_utils.TestCase):
| def testNestFlatten(self):
layer = nest_map.NestFlatten()
outputs = layer({'a': 1, 'b': 2})
self.assertEqual(self.evaluate(outputs), [1, 2])
| net
def _action(self, time_step, policy_state=(), seed=None):
out, _ = self._net(time_step.observation)
out = tf.math.add(*tf.nest.flatten(out))
return policy_step.PolicyStep(out, (), ())
class NestFlattenTest(test_utils.TestCase):
| 63 | 64 | 55 | 9 | 54 | isabella232/agents | tf_agents/networks/nest_map_test.py | Python | NestFlattenTest | NestFlattenTest | 56 | 61 | 56 | 57 | 210dc61765f9372761c72d0580b051a076ec7799 | bigcode/the-stack | train |
ab387befacdd76aa8ba218f8 | train | class | class DeployerFacade(Type):
name = 'Deployer'
version = 1
schema = {'definitions': {'APIHostPortsResult': {'additionalProperties': False,
'properties': {'servers': {'items': {'items': {'$ref': '#/definitions/HostPort'},
... | class DeployerFacade(Type):
| name = 'Deployer'
version = 1
schema = {'definitions': {'APIHostPortsResult': {'additionalProperties': False,
'properties': {'servers': {'items': {'items': {'$ref': '#/definitions/HostPort'},
... | is not None and not isinstance(args, (bytes, str, list)):
raise Exception("Expected args to be a Sequence, received: {}".format(type(args)))
# map input types to rpc msg
_params = dict()
msg = dict(type='CrossModelRelations',
request='WatchRelationUnits',
... | 256 | 256 | 2,982 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | DeployerFacade | DeployerFacade | 4,876 | 5,249 | 4,876 | 4,876 | 29c8a51859e94ab2a70380022124daaffc3d456d | bigcode/the-stack | train |
99414ea312795ce44b6290cc | train | class | class PayloadsHookContextFacade(Type):
name = 'PayloadsHookContext'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
... | class PayloadsHookContextFacade(Type):
| name = 'PayloadsHookContext'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | 'PayloadListResults': {'additionalProperties': False,
'properties': {'results': {'items': {'$ref': '#/definitions/Payload'},
'type': 'array'}},
'required': ['re... | 256 | 256 | 1,745 | 8 | 247 | hpidcock/python-libjuju | juju/client/_client1.py | Python | PayloadsHookContextFacade | PayloadsHookContextFacade | 8,907 | 9,107 | 8,907 | 8,907 | 2a584301db0414ad7cde1ce842ef7658b3e14fa8 | bigcode/the-stack | train |
ff42ca731704cae51e6eb995 | train | class | class CAASAgentFacade(Type):
name = 'CAASAgent'
version = 1
schema = {'definitions': {'CloudCredential': {'additionalProperties': False,
'properties': {'attrs': {'patternProperties': {'.*': {'type': 'string'}},
... | class CAASAgentFacade(Type):
| name = 'CAASAgent'
version = 1
schema = {'definitions': {'CloudCredential': {'additionalProperties': False,
'properties': {'attrs': {'patternProperties': {'.*': {'type': 'string'}},
'type': 'object... | items': {'$ref': '#/definitions/BundleChange'},
'type': 'array'},
'errors': {'items': {'type': 'string'},
'type': ... | 256 | 256 | 2,008 | 7 | 248 | hpidcock/python-libjuju | juju/client/_client1.py | Python | CAASAgentFacade | CAASAgentFacade | 644 | 884 | 644 | 644 | b3ae1a00a393c4bcb77dadb2e6a94c6313f1e58a | bigcode/the-stack | train |
8b9c2ec41f7b8853788a730f | train | class | class ApplicationScalerFacade(Type):
name = 'ApplicationScaler'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
... | class ApplicationScalerFacade(Type):
| name = 'ApplicationScaler'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | RelationsWatchResult'}},
'type': 'object'},
'Stop': {'type': 'object'}},
'type': 'object'}
@ReturnMapping(ApplicationRelationsWatchResult)
async def Next(self):
'''
Returns -> typing.Union[str, _ForwardRef('ApplicationRelationsChange')... | 203 | 203 | 678 | 6 | 196 | hpidcock/python-libjuju | juju/client/_client1.py | Python | ApplicationScalerFacade | ApplicationScalerFacade | 276 | 355 | 276 | 276 | 27a606c54ac9054163f24a858ac65cc218cf5e9c | bigcode/the-stack | train |
de9f39f59b062b5cda12b643 | train | class | class FirewallRulesFacade(Type):
name = 'FirewallRules'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additional... | class FirewallRulesFacade(Type):
| name = 'FirewallRules'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additionalProperties': True,
... | '#/definitions/NotifyWatchResult'}},
'type': 'object'}},
'type': 'object'}
@ReturnMapping(FanConfigResult)
async def FanConfig(self):
'''
Returns -> typing.Sequence[~FanConfigEntry]
'''
# map input types to rpc msg
... | 206 | 206 | 688 | 6 | 199 | hpidcock/python-libjuju | juju/client/_client1.py | Python | FirewallRulesFacade | FirewallRulesFacade | 5,467 | 5,546 | 5,467 | 5,467 | 215b3228f7ad3556f0719d9933c1715d0e52f37f | bigcode/the-stack | train |
c94092ac71eb26f29b52740e | train | class | class MigrationTargetFacade(Type):
name = 'MigrationTarget'
version = 1
schema = {'definitions': {'AdoptResourcesArgs': {'additionalProperties': False,
'properties': {'model-tag': {'type': 'string'},
'... | class MigrationTargetFacade(Type):
| name = 'MigrationTarget'
version = 1
schema = {'definitions': {'AdoptResourcesArgs': {'additionalProperties': False,
'properties': {'model-tag': {'type': 'string'},
'source-controller-version': {'$ref'... | ',
'attempt',
'phase',
'source-api-addrs',
'source-ca-cert',
... | 256 | 256 | 2,828 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | MigrationTargetFacade | MigrationTargetFacade | 7,807 | 8,141 | 7,807 | 7,807 | b0b551900b98c14af8de00b4d3222f9f5f4ef72e | bigcode/the-stack | train |
523eb3eb06b8dc0db4f6b2c9 | train | class | class MigrationStatusWatcherFacade(Type):
name = 'MigrationStatusWatcher'
version = 1
schema = {'definitions': {'MigrationStatus': {'additionalProperties': False,
'properties': {'attempt': {'type': 'integer'},
... | class MigrationStatusWatcherFacade(Type):
| name = 'MigrationStatusWatcher'
version = 1
schema = {'definitions': {'MigrationStatus': {'additionalProperties': False,
'properties': {'attempt': {'type': 'integer'},
'migration-id': {'type': 'string'},
... | params['phase'] = phase
_params['success'] = success
reply = await self.rpc(msg)
return reply
@ReturnMapping(NotifyWatchResult)
async def Watch(self):
'''
Returns -> typing.Union[str, _ForwardRef('Error')]
'''
# map input types to rpc msg
_par... | 120 | 120 | 400 | 7 | 112 | hpidcock/python-libjuju | juju/client/_client1.py | Python | MigrationStatusWatcherFacade | MigrationStatusWatcherFacade | 7,742 | 7,803 | 7,742 | 7,742 | 943a6492a0e6aae00a7572b290f39872dafa42c0 | bigcode/the-stack | train |
5f37462984282262c2ff4b9d | train | class | class MachineUndertakerFacade(Type):
name = 'MachineUndertaker'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
... | class MachineUndertakerFacade(Type):
| name = 'MachineUndertaker'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | ByReceiver]
'''
if entities is not None and not isinstance(entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg = dict(type='MachineActions',
... | 256 | 256 | 1,436 | 8 | 247 | hpidcock/python-libjuju | juju/client/_client1.py | Python | MachineUndertakerFacade | MachineUndertakerFacade | 6,372 | 6,528 | 6,372 | 6,372 | a8f3a0e333cfab21058e52397e3585ea7e58966b | bigcode/the-stack | train |
cf004a55d4037d45403269ad | train | class | class MigrationMinionFacade(Type):
name = 'MigrationMinion'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additi... | class MigrationMinionFacade(Type):
| name = 'MigrationMinion'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additionalProperties': True,
... | self.rpc(msg)
return reply
@ReturnMapping(NotifyWatchResult)
async def Watch(self):
'''
Returns -> typing.Union[str, _ForwardRef('Error')]
'''
# map input types to rpc msg
_params = dict()
msg = dict(type='MigrationMaster',
request... | 189 | 189 | 631 | 7 | 181 | hpidcock/python-libjuju | juju/client/_client1.py | Python | MigrationMinionFacade | MigrationMinionFacade | 7,661 | 7,738 | 7,661 | 7,661 | 95f01ea3367135a53f76ec86aa30504654c4db23 | bigcode/the-stack | train |
8b1a5d2ad5aebed4e6e4d284 | train | class | class ResourcesHookContextFacade(Type):
name = 'ResourcesHookContext'
version = 1
schema = {'definitions': {'CharmResource': {'additionalProperties': False,
'properties': {'description': {'type': 'string'},
'fin... | class ResourcesHookContextFacade(Type):
| name = 'ResourcesHookContext'
version = 1
schema = {'definitions': {'CharmResource': {'additionalProperties': False,
'properties': {'description': {'type': 'string'},
'fingerprint': {'items': {'type': 'integer'}... | request='AddPendingResources',
version=1,
params=_params)
_params['AddCharmWithAuthorization'] = addcharmwithauthorization
_params['Entity'] = entity
_params['channel'] = channel
_params['force'] = force
_params['macaroon']... | 256 | 256 | 983 | 7 | 248 | hpidcock/python-libjuju | juju/client/_client1.py | Python | ResourcesHookContextFacade | ResourcesHookContextFacade | 10,439 | 10,544 | 10,439 | 10,439 | 6ae9578d1a399fe6249234da8ac99896c194dd4c | bigcode/the-stack | train |
361605379e4c5e5cea33f766 | train | class | class FanConfigurerFacade(Type):
name = 'FanConfigurer'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additional... | class FanConfigurerFacade(Type):
| name = 'FanConfigurer'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additionalProperties': True,
... | (controllers)))
# map input types to rpc msg
_params = dict()
msg = dict(type='ExternalControllerUpdater',
request='SetExternalControllerInfo',
version=1,
params=_params)
_params['controllers'] = controllers
reply = await ... | 159 | 159 | 530 | 6 | 152 | hpidcock/python-libjuju | juju/client/_client1.py | Python | FanConfigurerFacade | FanConfigurerFacade | 5,396 | 5,463 | 5,396 | 5,396 | a74eef3a55b8c8fa14cb0ea31efe5fd34b344cb1 | bigcode/the-stack | train |
2f20d2ec73f7d1ea9994140d | train | class | class CrossControllerFacade(Type):
name = 'CrossController'
version = 1
schema = {'definitions': {'ControllerAPIInfoResult': {'additionalProperties': False,
'properties': {'addresses': {'items': {'type': 'string'},
... | class CrossControllerFacade(Type):
| name = 'CrossController'
version = 1
schema = {'definitions': {'ControllerAPIInfoResult': {'additionalProperties': False,
'properties': {'addresses': {'items': {'type': 'string'},
... | ': {'Params': {'$ref': '#/definitions/InvalidateCredentialArg'},
'Result': {'$ref': '#/definitions/ErrorResult'}},
'type': 'object'}},
'type': 'object'}
@ReturnMapping(ErrorResult)
async... | 182 | 182 | 607 | 6 | 175 | hpidcock/python-libjuju | juju/client/_client1.py | Python | CrossControllerFacade | CrossControllerFacade | 4,329 | 4,404 | 4,329 | 4,329 | 0f6f14524d89f42a3ab53a04104e374acd69bb8a | bigcode/the-stack | train |
28fce30e89c98500795dd654 | train | class | class SSHClientFacade(Type):
name = 'SSHClient'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type':... | class SSHClientFacade(Type):
| name = 'SSHClient'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | ~RetryStrategyResult]
'''
if entities is not None and not isinstance(entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg = dict(type='RetryStrategy... | 256 | 256 | 1,201 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | SSHClientFacade | SSHClientFacade | 10,650 | 10,788 | 10,650 | 10,650 | b3a55f92a389ab9d7d7359ad0bfcf2497606a5b3 | bigcode/the-stack | train |
46433e1aab1f09f7cb09a6b4 | train | class | class UndertakerFacade(Type):
name = 'Undertaker'
version = 1
schema = {'definitions': {'EntityStatusArgs': {'additionalProperties': False,
'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True,
... | class UndertakerFacade(Type):
| name = 'Undertaker'
version = 1
schema = {'definitions': {'EntityStatusArgs': {'additionalProperties': False,
'properties': {'data': {'patternProperties': {'.*': {'additionalProperties': True,
... | ref': '#/definitions/Error'},
'watcher-id': {'type': 'string'}},
'required': ['watcher-id'],
'type': 'object'}},
'properties': {'Next': {'properties': {'Result': {'$ref... | 256 | 256 | 1,648 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | UndertakerFacade | UndertakerFacade | 10,949 | 11,170 | 10,949 | 10,949 | b8f553ce80e33070daccee67277e454b62c6dfc9 | bigcode/the-stack | train |
f459c55f2eb1e2898b28704a | train | class | class UpgradeStepsFacade(Type):
name = 'UpgradeSteps'
version = 1
schema = {'definitions': {'Entity': {'additionalProperties': False,
'properties': {'tag': {'type': 'string'}},
'required': ['tag'],
'type': 'o... | class UpgradeStepsFacade(Type):
| name = 'UpgradeSteps'
version = 1
schema = {'definitions': {'Entity': {'additionalProperties': False,
'properties': {'tag': {'type': 'string'}},
'required': ['tag'],
'type': 'object'},
'E... | NotifyWatchResult]
'''
if entities is not None and not isinstance(entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg = dict(type='UpgradeSeries',
... | 113 | 113 | 379 | 6 | 106 | hpidcock/python-libjuju | juju/client/_client1.py | Python | UpgradeStepsFacade | UpgradeStepsFacade | 11,722 | 11,763 | 11,722 | 11,722 | 8a9ba68b1fe08790105e57212956367b8803fe4f | bigcode/the-stack | train |
12eb630e3d5c77965624281a | train | class | class RemoteRelationsWatcherFacade(Type):
name = 'RemoteRelationsWatcher'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'$ref': '#/definitions... | class RemoteRelationsWatcherFacade(Type):
| name = 'RemoteRelationsWatcher'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'$ref': '#/definitions/ErrorInfo'},
... | dict(type='RemoteRelations',
request='WatchRemoteApplicationRelations',
version=1,
params=_params)
_params['entities'] = entities
reply = await self.rpc(msg)
return reply
@ReturnMapping(StringsWatchResult)
async def WatchRemote... | 238 | 238 | 796 | 7 | 230 | hpidcock/python-libjuju | juju/client/_client1.py | Python | RemoteRelationsWatcherFacade | RemoteRelationsWatcherFacade | 10,119 | 10,208 | 10,119 | 10,119 | 941f3629be888b09e202f9bde23107e2ef62deb5 | bigcode/the-stack | train |
a7501b7fd1fe50ccc38735d4 | train | class | class RelationStatusWatcherFacade(Type):
name = 'RelationStatusWatcher'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.... | class RelationStatusWatcherFacade(Type):
| name = 'RelationStatusWatcher'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additionalProperties': True,
... | (NotifyWatchResults)
async def WatchForProxyConfigAndAPIHostPortChanges(self, entities=None):
'''
entities : typing.Sequence[~Entity]
Returns -> typing.Sequence[~NotifyWatchResult]
'''
if entities is not None and not isinstance(entities, (bytes, str, list)):
raise... | 159 | 159 | 530 | 7 | 151 | hpidcock/python-libjuju | juju/client/_client1.py | Python | RelationStatusWatcherFacade | RelationStatusWatcherFacade | 9,262 | 9,331 | 9,262 | 9,262 | ed437e5f9969e38aa153271a91a8f06a4bae0c0e | bigcode/the-stack | train |
577e465c7644dc5f757334ad | train | class | class HostKeyReporterFacade(Type):
name = 'HostKeyReporter'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additi... | class HostKeyReporterFacade(Type):
| name = 'HostKeyReporter'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additionalProperties': True,
... | )
reply = await self.rpc(msg)
return reply
@ReturnMapping(ErrorResults)
async def SetFirewallRules(self, args=None):
'''
args : typing.Sequence[~FirewallRule]
Returns -> typing.Sequence[~ErrorResult]
'''
if args is not None and not isinstance(args, (by... | 160 | 160 | 535 | 7 | 152 | hpidcock/python-libjuju | juju/client/_client1.py | Python | HostKeyReporterFacade | HostKeyReporterFacade | 5,550 | 5,603 | 5,550 | 5,550 | 61492a4bad8801bdd07c0bfdbf113ace0b9d9084 | bigcode/the-stack | train |
b6e3e6cd7c06b8432f39e784 | train | class | class SingularFacade(Type):
name = 'Singular'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': '... | class SingularFacade(Type):
| name = 'Singular'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | '''
if entities is not None and not isinstance(entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg = dict(type='SSHClient',
requ... | 252 | 252 | 840 | 5 | 246 | hpidcock/python-libjuju | juju/client/_client1.py | Python | SingularFacade | SingularFacade | 10,792 | 10,883 | 10,792 | 10,792 | 11c4621b5c8a185468ec755f50466ff6780a07d8 | bigcode/the-stack | train |
885330b9246a45f45591273a | train | class | class BundleFacade(Type):
name = 'Bundle'
version = 1
schema = {'definitions': {'BundleChange': {'additionalProperties': False,
'properties': {'args': {'items': {'additionalProperties': True,
't... | class BundleFacade(Type):
| name = 'Bundle'
version = 1
schema = {'definitions': {'BundleChange': {'additionalProperties': False,
'properties': {'args': {'items': {'additionalProperties': True,
'type': 'object'},
... | async def Restore(self, backup_id=None):
'''
backup_id : str
Returns -> None
'''
if backup_id is not None and not isinstance(backup_id, (bytes, str)):
raise Exception("Expected backup_id to be a str, received: {}".format(type(backup_id)))
# map input type... | 132 | 132 | 440 | 5 | 126 | hpidcock/python-libjuju | juju/client/_client1.py | Python | BundleFacade | BundleFacade | 591 | 640 | 591 | 591 | 2c6a749e5a74c29f758ad64e77da58c69065422d | bigcode/the-stack | train |
0c94860aec66e2b2b4694d08 | train | class | class ProxyUpdaterFacade(Type):
name = 'ProxyUpdater'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'... | class ProxyUpdaterFacade(Type):
| name = 'ProxyUpdater'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | _params = dict()
msg = dict(type='PayloadsHookContext',
request='Untrack',
version=1,
params=_params)
_params['entities'] = entities
reply = await self.rpc(msg)
return reply
class PingerFacade(Type):
name = 'Pinger'
ver... | 256 | 256 | 997 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | ProxyUpdaterFacade | ProxyUpdaterFacade | 9,156 | 9,258 | 9,156 | 9,156 | 6234ac948e48354f43f1a077556b5195eec16724 | bigcode/the-stack | train |
49cdaded79dd986700bf5006 | train | class | class ClientFacade(Type):
name = 'Client'
version = 1
schema = {'definitions': {'APIHostPortsResult': {'additionalProperties': False,
'properties': {'servers': {'items': {'items': {'$ref': '#/definitions/HostPort'},
... | class ClientFacade(Type):
| name = 'Client'
version = 1
schema = {'definitions': {'APIHostPortsResult': {'additionalProperties': False,
'properties': {'servers': {'items': {'items': {'$ref': '#/definitions/HostPort'},
... | '''
if entities is not None and not isinstance(entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg = dict(type='CAASUnitProvisioner',
r... | 256 | 256 | 12,275 | 5 | 250 | hpidcock/python-libjuju | juju/client/_client1.py | Python | ClientFacade | ClientFacade | 2,491 | 3,931 | 2,491 | 2,491 | 85179d49e8e9a01ff4360925ae5e188d3f375d3b | bigcode/the-stack | train |
453d12b2ac0fa4f2a4341b43 | train | class | class UpgradeSeriesFacade(Type):
name = 'UpgradeSeries'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
... | class UpgradeSeriesFacade(Type):
| name = 'UpgradeSeries'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | reply = await self.rpc(msg)
return reply
@ReturnMapping(ErrorResults)
async def SetAgentStatus(self, entities=None):
'''
entities : typing.Sequence[~EntityStatusArgs]
Returns -> typing.Sequence[~ErrorResult]
'''
if entities is not None and not isinstanc... | 256 | 256 | 3,525 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | UpgradeSeriesFacade | UpgradeSeriesFacade | 11,298 | 11,718 | 11,298 | 11,298 | 22b8aa1486c46bfb498822367f916a164206653c | bigcode/the-stack | train |
e780819a39ce483d6de3325f | train | class | class LifeFlagFacade(Type):
name = 'LifeFlag'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': '... | class LifeFlagFacade(Type):
| name = 'LifeFlag'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | , str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg = dict(type='KeyUpdater',
request='AuthorisedKeys',
version=1,
params=... | 238 | 238 | 796 | 6 | 231 | hpidcock/python-libjuju | juju/client/_client1.py | Python | LifeFlagFacade | LifeFlagFacade | 5,866 | 5,953 | 5,866 | 5,866 | c96f63edc73294a717410fd2d56e893eca46fe93 | bigcode/the-stack | train |
bc11ae120e3e74d33191df66 | train | class | class ModelUpgraderFacade(Type):
name = 'ModelUpgrader'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
... | class ModelUpgraderFacade(Type):
| name = 'ModelUpgrader'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | input types to rpc msg
_params = dict()
msg = dict(type='ModelGeneration',
request='HasActiveBranch',
version=1,
params=_params)
_params['branch'] = branch
reply = await self.rpc(msg)
return reply
@ReturnMapping(Err... | 256 | 256 | 1,760 | 7 | 248 | hpidcock/python-libjuju | juju/client/_client1.py | Python | ModelUpgraderFacade | ModelUpgraderFacade | 8,529 | 8,723 | 8,529 | 8,529 | 8c17281bfca82e924514ac8a71a2529818073912 | bigcode/the-stack | train |
fb5c2e1761f46f82a0bcce94 | train | class | class UpgraderFacade(Type):
name = 'Upgrader'
version = 1
schema = {'definitions': {'Binary': {'additionalProperties': False,
'properties': {'Arch': {'type': 'string'},
'Build': {'type': 'integer'},
... | class UpgraderFacade(Type):
| name = 'Upgrader'
version = 1
schema = {'definitions': {'Binary': {'additionalProperties': False,
'properties': {'Arch': {'type': 'string'},
'Build': {'type': 'integer'},
'Major'... | },
'required': ['message', 'code'],
'type': 'object'},
'ErrorResult': {'additionalProperties': False,
'properties': {'error': {'$ref': '#/definitions/Error'}},
'ty... | 256 | 256 | 1,877 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | UpgraderFacade | UpgraderFacade | 11,767 | 11,973 | 11,767 | 11,767 | 64eaa80caafb14160f09b2c9bd49938f78deb5f1 | bigcode/the-stack | train |
8c601de15c421592c20e3472 | train | class | class MigrationMasterFacade(Type):
name = 'MigrationMaster'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additi... | class MigrationMasterFacade(Type):
| name = 'MigrationMaster'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additionalProperties': True,
... | Returns -> typing.Sequence[~PhaseResult]
'''
if entities is not None and not isinstance(entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg... | 256 | 256 | 2,616 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | MigrationMasterFacade | MigrationMasterFacade | 7,300 | 7,657 | 7,300 | 7,300 | 27a9953fcfc17797c3e6edb09079aa0fcae49eef | bigcode/the-stack | train |
0ab5805b6a5f2f68a5393166 | train | class | class LogForwardingFacade(Type):
name = 'LogForwarding'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additional... | class LogForwardingFacade(Type):
| name = 'LogForwarding'
version = 1
schema = {'definitions': {'Error': {'additionalProperties': False,
'properties': {'code': {'type': 'string'},
'info': {'patternProperties': {'.*': {'additionalProperties': True,
... | Returns -> typing.Sequence[~LifeResult]
'''
if entities is not None and not isinstance(entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg = dict(... | 256 | 256 | 1,061 | 7 | 248 | hpidcock/python-libjuju | juju/client/_client1.py | Python | LogForwardingFacade | LogForwardingFacade | 5,957 | 6,063 | 5,957 | 5,957 | f23470ede8fa708e5221f43368e22553fb0a9c36 | bigcode/the-stack | train |
728dd0c24f0103dd304162f9 | train | class | class ApplicationRelationsWatcherFacade(Type):
name = 'ApplicationRelationsWatcher'
version = 1
schema = {'definitions': {'ApplicationRelationsChange': {'additionalProperties': False,
'properties': {'changed': {'items': {'$ref': '#/definitions/Relation... | class ApplicationRelationsWatcherFacade(Type):
| name = 'ApplicationRelationsWatcher'
version = 1
schema = {'definitions': {'ApplicationRelationsChange': {'additionalProperties': False,
'properties': {'changed': {'items': {'$ref': '#/definitions/RelationChange'},
... | Next': {'properties': {'Result': {'$ref': '#/definitions/AllWatcherNextResults'}},
'type': 'object'},
'Stop': {'type': 'object'}},
'type': 'object'}
@ReturnMapping(AllWatcherNextResults)
async def Next(self):
'''
Returns -> typing.Sequ... | 206 | 206 | 688 | 7 | 198 | hpidcock/python-libjuju | juju/client/_client1.py | Python | ApplicationRelationsWatcherFacade | ApplicationRelationsWatcherFacade | 192 | 272 | 192 | 192 | f840aff9d817edc37939655c1728b61ee0ec8f35 | bigcode/the-stack | train |
d6955eb6b6dfaea254a0babb | train | class | class MachineActionsFacade(Type):
name = 'MachineActions'
version = 1
schema = {'definitions': {'Action': {'additionalProperties': False,
'properties': {'name': {'type': 'string'},
'parameters': {'patternProperties': {'.*': {... | class MachineActionsFacade(Type):
| name = 'MachineActions'
version = 1
schema = {'definitions': {'Action': {'additionalProperties': False,
'properties': {'name': {'type': 'string'},
'parameters': {'patternProperties': {'.*': {'additionalProperties': True,
... | typing.Sequence[~StringResult]
'''
if entities is not None and not isinstance(entities, (bytes, str, list)):
raise Exception("Expected entities to be a Sequence, received: {}".format(type(entities)))
# map input types to rpc msg
_params = dict()
msg = dict(type='Log... | 256 | 256 | 1,930 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | MachineActionsFacade | MachineActionsFacade | 6,158 | 6,368 | 6,158 | 6,158 | a6cd639945f64de013f29be6713f64688b9f5278 | bigcode/the-stack | train |
bcf9bc9d67f2875ffebb1bc4 | train | class | class KeyUpdaterFacade(Type):
name = 'KeyUpdater'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type... | class KeyUpdaterFacade(Type):
| name = 'KeyUpdater'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | = dict(type='KeyManager',
request='ImportKeys',
version=1,
params=_params)
_params['ssh-keys'] = ssh_keys
_params['user'] = user
reply = await self.rpc(msg)
return reply
@ReturnMapping(StringsResults)
async def ListKeys... | 244 | 244 | 814 | 6 | 237 | hpidcock/python-libjuju | juju/client/_client1.py | Python | KeyUpdaterFacade | KeyUpdaterFacade | 5,775 | 5,862 | 5,775 | 5,775 | 2c535c351b9848b380c1e4362647171fbe8d010c | bigcode/the-stack | train |
434aa15e8977c19e6c393f92 | train | class | class LoggerFacade(Type):
name = 'Logger'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'arra... | class LoggerFacade(Type):
| name = 'Logger'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | (bytes, str, list)):
raise Exception("Expected ids to be a Sequence, received: {}".format(type(ids)))
# map input types to rpc msg
_params = dict()
msg = dict(type='LogForwarding',
request='GetLastSent',
version=1,
params=_pa... | 239 | 239 | 798 | 5 | 233 | hpidcock/python-libjuju | juju/client/_client1.py | Python | LoggerFacade | LoggerFacade | 6,067 | 6,154 | 6,067 | 6,067 | 9e80082b7a400cebf2f82162567cef8a93960f5e | bigcode/the-stack | train |
9f71aca737574fc760fe1825 | train | class | class KeyManagerFacade(Type):
name = 'KeyManager'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type... | class KeyManagerFacade(Type):
| name = 'KeyManager'
version = 1
schema = {'definitions': {'Entities': {'additionalProperties': False,
'properties': {'entities': {'items': {'$ref': '#/definitions/Entity'},
'type': 'array'}},
... | type': 'string'},
'type': 'array'},
'tag': {'type': 'string'}},
'required': ['tag', 'public-keys'],
'type': 'object'}},
'... | 256 | 256 | 1,490 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | KeyManagerFacade | KeyManagerFacade | 5,607 | 5,771 | 5,607 | 5,607 | de1b43bd7410ca74f0f17af2e5e3324daf806095 | bigcode/the-stack | train |
edc2e06be302c5e7dcda979f | train | class | class ModelGenerationFacade(Type):
name = 'ModelGeneration'
version = 1
schema = {'definitions': {'BoolResult': {'additionalProperties': False,
'properties': {'error': {'$ref': '#/definitions/Error'},
'result': {'type... | class ModelGenerationFacade(Type):
| name = 'ModelGeneration'
version = 1
schema = {'definitions': {'BoolResult': {'additionalProperties': False,
'properties': {'error': {'$ref': '#/definitions/Error'},
'result': {'type': 'boolean'}},
... | (type='ModelConfig',
request='SLALevel',
version=1,
params=_params)
reply = await self.rpc(msg)
return reply
@ReturnMapping(None)
async def SetSLALevel(self, modelslainfo=None, creds=None):
'''
modelslainfo : ModelSLAIn... | 256 | 256 | 1,831 | 6 | 249 | hpidcock/python-libjuju | juju/client/_client1.py | Python | ModelGenerationFacade | ModelGenerationFacade | 8,316 | 8,525 | 8,316 | 8,316 | 3a6aa95d735d27d7c040e3d3ab961197a82b3ed5 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.