body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
@property
@pulumi.getter(name='doNotRunExtensionsOnOverprovisionedVMs')
def do_not_run_extensions_on_overprovisioned_vms(self) -> Optional[bool]:
'\n When Overprovision is enabled, extensions are launched only on the requested number of VMs which are finally kept. This property will hence ensure that the ext... | -8,349,281,024,196,889,000 | When Overprovision is enabled, extensions are launched only on the requested number of VMs which are finally kept. This property will hence ensure that the extensions do not run on the extra overprovisioned VMs. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | do_not_run_extensions_on_overprovisioned_vms | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='doNotRunExtensionsOnOverprovisionedVMs')
def do_not_run_extensions_on_overprovisioned_vms(self) -> Optional[bool]:
'\n \n '
return pulumi.get(self, 'do_not_run_extensions_on_overprovisioned_vms') |
@property
@pulumi.getter(name='extendedLocation')
def extended_location(self) -> Optional['outputs.ExtendedLocationResponse']:
'\n The extended location of the Virtual Machine Scale Set.\n '
return pulumi.get(self, 'extended_location') | 8,015,889,040,813,705,000 | The extended location of the Virtual Machine Scale Set. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | extended_location | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='extendedLocation')
def extended_location(self) -> Optional['outputs.ExtendedLocationResponse']:
'\n \n '
return pulumi.get(self, 'extended_location') |
@property
@pulumi.getter(name='hostGroup')
def host_group(self) -> Optional['outputs.SubResourceResponse']:
'\n Specifies information about the dedicated host group that the virtual machine scale set resides in. <br><br>Minimum api-version: 2020-06-01.\n '
return pulumi.get(self, 'host_group') | -3,147,833,368,655,111,700 | Specifies information about the dedicated host group that the virtual machine scale set resides in. <br><br>Minimum api-version: 2020-06-01. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | host_group | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='hostGroup')
def host_group(self) -> Optional['outputs.SubResourceResponse']:
'\n \n '
return pulumi.get(self, 'host_group') |
@property
@pulumi.getter
def id(self) -> str:
'\n Resource Id\n '
return pulumi.get(self, 'id') | -8,273,823,637,222,696,000 | Resource Id | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | id | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def id(self) -> str:
'\n \n '
return pulumi.get(self, 'id') |
@property
@pulumi.getter
def identity(self) -> Optional['outputs.VirtualMachineScaleSetIdentityResponse']:
'\n The identity of the virtual machine scale set, if configured.\n '
return pulumi.get(self, 'identity') | -7,253,536,697,471,108,000 | The identity of the virtual machine scale set, if configured. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | identity | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def identity(self) -> Optional['outputs.VirtualMachineScaleSetIdentityResponse']:
'\n \n '
return pulumi.get(self, 'identity') |
@property
@pulumi.getter
def location(self) -> str:
'\n Resource location\n '
return pulumi.get(self, 'location') | -4,515,321,722,015,717,000 | Resource location | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | location | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def location(self) -> str:
'\n \n '
return pulumi.get(self, 'location') |
@property
@pulumi.getter
def name(self) -> str:
'\n Resource name\n '
return pulumi.get(self, 'name') | -7,148,411,979,540,616,000 | Resource name | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | name | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def name(self) -> str:
'\n \n '
return pulumi.get(self, 'name') |
@property
@pulumi.getter(name='orchestrationMode')
def orchestration_mode(self) -> Optional[str]:
'\n Specifies the orchestration mode for the virtual machine scale set.\n '
return pulumi.get(self, 'orchestration_mode') | -2,508,759,029,933,910,500 | Specifies the orchestration mode for the virtual machine scale set. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | orchestration_mode | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='orchestrationMode')
def orchestration_mode(self) -> Optional[str]:
'\n \n '
return pulumi.get(self, 'orchestration_mode') |
@property
@pulumi.getter
def overprovision(self) -> Optional[bool]:
'\n Specifies whether the Virtual Machine Scale Set should be overprovisioned.\n '
return pulumi.get(self, 'overprovision') | 2,195,097,157,299,520,800 | Specifies whether the Virtual Machine Scale Set should be overprovisioned. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | overprovision | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def overprovision(self) -> Optional[bool]:
'\n \n '
return pulumi.get(self, 'overprovision') |
@property
@pulumi.getter
def plan(self) -> Optional['outputs.PlanResponse']:
'\n Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmat... | -479,134,546,514,780,160 | Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click... | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | plan | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def plan(self) -> Optional['outputs.PlanResponse']:
'\n \n '
return pulumi.get(self, 'plan') |
@property
@pulumi.getter(name='platformFaultDomainCount')
def platform_fault_domain_count(self) -> Optional[int]:
'\n Fault Domain count for each placement group.\n '
return pulumi.get(self, 'platform_fault_domain_count') | 5,235,247,446,457,409,000 | Fault Domain count for each placement group. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | platform_fault_domain_count | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='platformFaultDomainCount')
def platform_fault_domain_count(self) -> Optional[int]:
'\n \n '
return pulumi.get(self, 'platform_fault_domain_count') |
@property
@pulumi.getter(name='provisioningState')
def provisioning_state(self) -> str:
'\n The provisioning state, which only appears in the response.\n '
return pulumi.get(self, 'provisioning_state') | 1,443,967,780,852,809,500 | The provisioning state, which only appears in the response. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | provisioning_state | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='provisioningState')
def provisioning_state(self) -> str:
'\n \n '
return pulumi.get(self, 'provisioning_state') |
@property
@pulumi.getter(name='proximityPlacementGroup')
def proximity_placement_group(self) -> Optional['outputs.SubResourceResponse']:
'\n Specifies information about the proximity placement group that the virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01.\n '
... | 7,432,910,305,572,225,000 | Specifies information about the proximity placement group that the virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | proximity_placement_group | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='proximityPlacementGroup')
def proximity_placement_group(self) -> Optional['outputs.SubResourceResponse']:
'\n \n '
return pulumi.get(self, 'proximity_placement_group') |
@property
@pulumi.getter(name='scaleInPolicy')
def scale_in_policy(self) -> Optional['outputs.ScaleInPolicyResponse']:
'\n Specifies the scale-in policy that decides which virtual machines are chosen for removal when a Virtual Machine Scale Set is scaled-in.\n '
return pulumi.get(self, 'scale_in_p... | 4,456,056,434,484,911,000 | Specifies the scale-in policy that decides which virtual machines are chosen for removal when a Virtual Machine Scale Set is scaled-in. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | scale_in_policy | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='scaleInPolicy')
def scale_in_policy(self) -> Optional['outputs.ScaleInPolicyResponse']:
'\n \n '
return pulumi.get(self, 'scale_in_policy') |
@property
@pulumi.getter(name='singlePlacementGroup')
def single_placement_group(self) -> Optional[bool]:
'\n When true this limits the scale set to a single placement group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if singlePlacementGroup... | 3,963,651,708,174,868,000 | When true this limits the scale set to a single placement group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to false. However, if singlePlacementGroup is false, it may not be modified to true. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | single_placement_group | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='singlePlacementGroup')
def single_placement_group(self) -> Optional[bool]:
'\n \n '
return pulumi.get(self, 'single_placement_group') |
@property
@pulumi.getter
def sku(self) -> Optional['outputs.SkuResponse']:
'\n The virtual machine scale set sku.\n '
return pulumi.get(self, 'sku') | 2,548,485,711,490,900,500 | The virtual machine scale set sku. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | sku | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def sku(self) -> Optional['outputs.SkuResponse']:
'\n \n '
return pulumi.get(self, 'sku') |
@property
@pulumi.getter
def tags(self) -> Optional[Mapping[(str, str)]]:
'\n Resource tags\n '
return pulumi.get(self, 'tags') | 8,393,960,893,387,821,000 | Resource tags | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | tags | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def tags(self) -> Optional[Mapping[(str, str)]]:
'\n \n '
return pulumi.get(self, 'tags') |
@property
@pulumi.getter
def type(self) -> str:
'\n Resource type\n '
return pulumi.get(self, 'type') | -6,187,931,065,480,752,000 | Resource type | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | type | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def type(self) -> str:
'\n \n '
return pulumi.get(self, 'type') |
@property
@pulumi.getter(name='uniqueId')
def unique_id(self) -> str:
'\n Specifies the ID which uniquely identifies a Virtual Machine Scale Set.\n '
return pulumi.get(self, 'unique_id') | -1,954,157,736,488,446,200 | Specifies the ID which uniquely identifies a Virtual Machine Scale Set. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | unique_id | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='uniqueId')
def unique_id(self) -> str:
'\n \n '
return pulumi.get(self, 'unique_id') |
@property
@pulumi.getter(name='upgradePolicy')
def upgrade_policy(self) -> Optional['outputs.UpgradePolicyResponse']:
'\n The upgrade policy.\n '
return pulumi.get(self, 'upgrade_policy') | -6,645,987,763,808,729,000 | The upgrade policy. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | upgrade_policy | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='upgradePolicy')
def upgrade_policy(self) -> Optional['outputs.UpgradePolicyResponse']:
'\n \n '
return pulumi.get(self, 'upgrade_policy') |
@property
@pulumi.getter(name='virtualMachineProfile')
def virtual_machine_profile(self) -> Optional['outputs.VirtualMachineScaleSetVMProfileResponse']:
'\n The virtual machine profile.\n '
return pulumi.get(self, 'virtual_machine_profile') | -8,157,252,936,889,690,000 | The virtual machine profile. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | virtual_machine_profile | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='virtualMachineProfile')
def virtual_machine_profile(self) -> Optional['outputs.VirtualMachineScaleSetVMProfileResponse']:
'\n \n '
return pulumi.get(self, 'virtual_machine_profile') |
@property
@pulumi.getter(name='zoneBalance')
def zone_balance(self) -> Optional[bool]:
'\n Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage.\n '
return pulumi.get(self, 'zone_balance') | 4,528,459,920,478,171,000 | Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage. | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | zone_balance | polivbr/pulumi-azure-native | python | @property
@pulumi.getter(name='zoneBalance')
def zone_balance(self) -> Optional[bool]:
'\n \n '
return pulumi.get(self, 'zone_balance') |
@property
@pulumi.getter
def zones(self) -> Optional[Sequence[str]]:
'\n The virtual machine scale set zones. NOTE: Availability zones can only be set when you create the scale set\n '
return pulumi.get(self, 'zones') | 6,225,819,024,639,591,000 | The virtual machine scale set zones. NOTE: Availability zones can only be set when you create the scale set | sdk/python/pulumi_azure_native/compute/get_virtual_machine_scale_set.py | zones | polivbr/pulumi-azure-native | python | @property
@pulumi.getter
def zones(self) -> Optional[Sequence[str]]:
'\n \n '
return pulumi.get(self, 'zones') |
@staticmethod
def _mocked_response(alpha_2, alpha_3, numeric, continent):
'Builds a mocked response for the patched country_iso_code function.'
response = mock.Mock()
response.alpha_2 = alpha_2
response.alpha_3 = alpha_3
response.numeric = numeric
response.continent = continent
return respon... | 3,662,101,305,375,710,700 | Builds a mocked response for the patched country_iso_code function. | nesta/packages/geo_utils/tests/test_geotools.py | _mocked_response | anniyanvr/nesta | python | @staticmethod
def _mocked_response(alpha_2, alpha_3, numeric, continent):
response = mock.Mock()
response.alpha_2 = alpha_2
response.alpha_3 = alpha_3
response.numeric = numeric
response.continent = continent
return response |
def test_collect_distribution(self):
'\n Test that emails are collected properly.\n '
test_emails = self.disti.collect_email_addresses()
self.assertEqual(len(test_emails), 2)
self.assertSetEqual(self.all_emails, set(test_emails)) | 5,870,409,709,118,060,000 | Test that emails are collected properly. | impression/tests/test_distribution.py | test_collect_distribution | gregschmit/django-impression | python | def test_collect_distribution(self):
'\n \n '
test_emails = self.disti.collect_email_addresses()
self.assertEqual(len(test_emails), 2)
self.assertSetEqual(self.all_emails, set(test_emails)) |
def test_collect_distribution_with_duplicates(self):
'\n Test that a distribution with duplicates to ensure it only collects each email\n once.\n '
test_emails = self.dupe_disti.collect_email_addresses()
self.assertEqual(len(test_emails), 2)
self.assertSetEqual(self.all_emails, set(... | 7,588,306,209,354,281,000 | Test that a distribution with duplicates to ensure it only collects each email
once. | impression/tests/test_distribution.py | test_collect_distribution_with_duplicates | gregschmit/django-impression | python | def test_collect_distribution_with_duplicates(self):
'\n Test that a distribution with duplicates to ensure it only collects each email\n once.\n '
test_emails = self.dupe_disti.collect_email_addresses()
self.assertEqual(len(test_emails), 2)
self.assertSetEqual(self.all_emails, set(... |
def test_collect_distribution_with_self_references(self):
'\n Test that a distribution with self references to ensure it only collects each\n email once, and without looping infinitely.\n '
test_emails = self.self_disti.collect_email_addresses()
self.assertEqual(len(test_emails), 1)
... | 7,214,400,685,393,205,000 | Test that a distribution with self references to ensure it only collects each
email once, and without looping infinitely. | impression/tests/test_distribution.py | test_collect_distribution_with_self_references | gregschmit/django-impression | python | def test_collect_distribution_with_self_references(self):
'\n Test that a distribution with self references to ensure it only collects each\n email once, and without looping infinitely.\n '
test_emails = self.self_disti.collect_email_addresses()
self.assertEqual(len(test_emails), 1)
... |
def test_collect_distribution_with_cyclic_references(self):
'\n Test that a distribution with cyclic references only collects each email once,\n and without looping infinitely.\n '
test_emails = self.cyclic_disti1.collect_email_addresses()
self.assertEqual(len(test_emails), 2)
self.... | -2,505,068,576,209,851,000 | Test that a distribution with cyclic references only collects each email once,
and without looping infinitely. | impression/tests/test_distribution.py | test_collect_distribution_with_cyclic_references | gregschmit/django-impression | python | def test_collect_distribution_with_cyclic_references(self):
'\n Test that a distribution with cyclic references only collects each email once,\n and without looping infinitely.\n '
test_emails = self.cyclic_disti1.collect_email_addresses()
self.assertEqual(len(test_emails), 2)
self.... |
def get_success(self, obj):
'\n Return ``None`` if the build is not finished.\n\n This is needed because ``default=True`` in the model field.\n '
if obj.finished:
return obj.success
return None | -4,690,954,269,013,599,000 | Return ``None`` if the build is not finished.
This is needed because ``default=True`` in the model field. | readthedocs/api/v3/serializers.py | get_success | Dithn/readthedocs.org | python | def get_success(self, obj):
'\n Return ``None`` if the build is not finished.\n\n This is needed because ``default=True`` in the model field.\n '
if obj.finished:
return obj.success
return None |
def plot_elpd(ax, models, pointwise_data, numvars, figsize, textsize, plot_kwargs, markersize, xlabels, coord_labels, xdata, threshold, backend_kwargs, show):
'Bokeh elpd plot.'
if (backend_kwargs is None):
backend_kwargs = {}
backend_kwargs = {**backend_kwarg_defaults(('dpi', 'plot.bokeh.figure.dpi... | 5,456,801,688,987,929,000 | Bokeh elpd plot. | arviz/plots/backends/bokeh/elpdplot.py | plot_elpd | Brahanyaa98/arviz | python | def plot_elpd(ax, models, pointwise_data, numvars, figsize, textsize, plot_kwargs, markersize, xlabels, coord_labels, xdata, threshold, backend_kwargs, show):
if (backend_kwargs is None):
backend_kwargs = {}
backend_kwargs = {**backend_kwarg_defaults(('dpi', 'plot.bokeh.figure.dpi')), **backend_kwa... |
def EVBMF(Y, sigma2=None, H=None):
'Implementation of the analytical solution to Empirical Variational\n Bayes Matrix Factorization.\n\n This function can be used to calculate the analytical solution to\n empirical VBMF.\n This is based on the paper and MatLab code by Nakajima et al.:\n "Glob... | 4,002,221,810,944,570,400 | Implementation of the analytical solution to Empirical Variational
Bayes Matrix Factorization.
This function can be used to calculate the analytical solution to
empirical VBMF.
This is based on the paper and MatLab code by Nakajima et al.:
"Global analytic solution of fully-observed variational Bayesian matrix... | src/transformers/adas.py | EVBMF | MathieuTuli/transformers | python | def EVBMF(Y, sigma2=None, H=None):
'Implementation of the analytical solution to Empirical Variational\n Bayes Matrix Factorization.\n\n This function can be used to calculate the analytical solution to\n empirical VBMF.\n This is based on the paper and MatLab code by Nakajima et al.:\n "Glob... |
def __init__(self, params, linear: bool=False) -> None:
'\n parameters: list of torch.nn.Module.parameters()\n '
self.params = params
self.history = list()
mask = list()
for (param_idx, param) in enumerate(params):
param_shape = param.shape
if (not linear):
... | 4,446,876,563,983,158,300 | parameters: list of torch.nn.Module.parameters() | src/transformers/adas.py | __init__ | MathieuTuli/transformers | python | def __init__(self, params, linear: bool=False) -> None:
'\n \n '
self.params = params
self.history = list()
mask = list()
for (param_idx, param) in enumerate(params):
param_shape = param.shape
if (not linear):
if (len(param_shape) != 4):
mask... |
def __call__(self) -> List[Tuple[(int, Union[(LayerMetrics, ConvLayerMetrics)])]]:
'\n Computes the knowledge gain (S) and mapping condition (condition)\n '
metrics: List[Tuple[(int, Union[(LayerMetrics, ConvLayerMetrics)])]] = list()
for (layer_index, layer) in enumerate(self.params):
... | 6,542,438,939,856,511,000 | Computes the knowledge gain (S) and mapping condition (condition) | src/transformers/adas.py | __call__ | MathieuTuli/transformers | python | def __call__(self) -> List[Tuple[(int, Union[(LayerMetrics, ConvLayerMetrics)])]]:
'\n \n '
metrics: List[Tuple[(int, Union[(LayerMetrics, ConvLayerMetrics)])]] = list()
for (layer_index, layer) in enumerate(self.params):
if (layer_index in self.mask):
metrics.append((layer... |
def step(self, closure: callable=None):
'Performs a single optimization step.\n\n Arguments:\n closure (callable, optional): A closure that reevaluates the model\n and returns the loss.\n '
loss = None
if (closure is not None):
loss = closure()
iteration_g... | -5,650,415,255,564,906,000 | Performs a single optimization step.
Arguments:
closure (callable, optional): A closure that reevaluates the model
and returns the loss. | src/transformers/adas.py | step | MathieuTuli/transformers | python | def step(self, closure: callable=None):
'Performs a single optimization step.\n\n Arguments:\n closure (callable, optional): A closure that reevaluates the model\n and returns the loss.\n '
loss = None
if (closure is not None):
loss = closure()
iteration_g... |
def clientServerUploadOptions(self, options, input=None, transmitname=None, server_kwargs=None):
'Fire up a client and a server and do an upload.'
root = '/tmp'
home = os.path.dirname(os.path.abspath(__file__))
filename = '640KBFILE'
input_path = os.path.join(home, filename)
if (not input):
... | 2,230,971,969,529,344,300 | Fire up a client and a server and do an upload. | t/test.py | clientServerUploadOptions | mapcollab/python-tftpy | python | def clientServerUploadOptions(self, options, input=None, transmitname=None, server_kwargs=None):
root = '/tmp'
home = os.path.dirname(os.path.abspath(__file__))
filename = '640KBFILE'
input_path = os.path.join(home, filename)
if (not input):
input = input_path
if transmitname:
... |
def clientServerDownloadOptions(self, options, output='/tmp/out'):
'Fire up a client and a server and do a download.'
root = os.path.dirname(os.path.abspath(__file__))
server = tftpy.TftpServer(root)
client = tftpy.TftpClient('localhost', 20001, options)
child_pid = os.fork()
if child_pid:
... | 1,382,451,886,181,627,400 | Fire up a client and a server and do a download. | t/test.py | clientServerDownloadOptions | mapcollab/python-tftpy | python | def clientServerDownloadOptions(self, options, output='/tmp/out'):
root = os.path.dirname(os.path.abspath(__file__))
server = tftpy.TftpServer(root)
client = tftpy.TftpClient('localhost', 20001, options)
child_pid = os.fork()
if child_pid:
try:
time.sleep(1)
clie... |
def __init__(self, *, host: str='googleads.googleapis.com', credentials: credentials.Credentials=None, credentials_file: str=None, scopes: Sequence[str]=None, channel: grpc.Channel=None, api_mtls_endpoint: str=None, client_cert_source: Callable[([], Tuple[(bytes, bytes)])]=None, ssl_channel_credentials: grpc.ChannelCre... | 5,966,026,779,169,955,000 | Instantiate the transport.
Args:
host (Optional[str]): The hostname to connect to.
credentials (Optional[google.auth.credentials.Credentials]): The
authorization credentials to attach to requests. These
credentials identify the application to the service; if none
are specified, the clie... | google/ads/googleads/v4/services/services/ad_group_service/transports/grpc.py | __init__ | batardo/google-ads-python | python | def __init__(self, *, host: str='googleads.googleapis.com', credentials: credentials.Credentials=None, credentials_file: str=None, scopes: Sequence[str]=None, channel: grpc.Channel=None, api_mtls_endpoint: str=None, client_cert_source: Callable[([], Tuple[(bytes, bytes)])]=None, ssl_channel_credentials: grpc.ChannelCre... |
@classmethod
def create_channel(cls, host: str='googleads.googleapis.com', credentials: credentials.Credentials=None, scopes: Optional[Sequence[str]]=None, **kwargs) -> grpc.Channel:
'Create and return a gRPC channel object.\n Args:\n address (Optionsl[str]): The host for the channel to use.\n ... | -5,144,630,308,523,399,000 | Create and return a gRPC channel object.
Args:
address (Optionsl[str]): The host for the channel to use.
credentials (Optional[~.Credentials]): The
authorization credentials to attach to requests. These
credentials identify this application to the service. If
none are specified, the clie... | google/ads/googleads/v4/services/services/ad_group_service/transports/grpc.py | create_channel | batardo/google-ads-python | python | @classmethod
def create_channel(cls, host: str='googleads.googleapis.com', credentials: credentials.Credentials=None, scopes: Optional[Sequence[str]]=None, **kwargs) -> grpc.Channel:
'Create and return a gRPC channel object.\n Args:\n address (Optionsl[str]): The host for the channel to use.\n ... |
@property
def grpc_channel(self) -> grpc.Channel:
'Return the channel designed to connect to this service.\n '
return self._grpc_channel | -1,956,682,971,687,930,400 | Return the channel designed to connect to this service. | google/ads/googleads/v4/services/services/ad_group_service/transports/grpc.py | grpc_channel | batardo/google-ads-python | python | @property
def grpc_channel(self) -> grpc.Channel:
'\n '
return self._grpc_channel |
@property
def get_ad_group(self) -> Callable[([ad_group_service.GetAdGroupRequest], ad_group.AdGroup)]:
'Return a callable for the get ad group method over gRPC.\n\n Returns the requested ad group in full detail.\n\n Returns:\n Callable[[~.GetAdGroupRequest],\n ~.AdGroup]... | -2,812,506,310,219,055,600 | Return a callable for the get ad group method over gRPC.
Returns the requested ad group in full detail.
Returns:
Callable[[~.GetAdGroupRequest],
~.AdGroup]:
A function that, when called, will call the underlying RPC
on the server. | google/ads/googleads/v4/services/services/ad_group_service/transports/grpc.py | get_ad_group | batardo/google-ads-python | python | @property
def get_ad_group(self) -> Callable[([ad_group_service.GetAdGroupRequest], ad_group.AdGroup)]:
'Return a callable for the get ad group method over gRPC.\n\n Returns the requested ad group in full detail.\n\n Returns:\n Callable[[~.GetAdGroupRequest],\n ~.AdGroup]... |
@property
def mutate_ad_groups(self) -> Callable[([ad_group_service.MutateAdGroupsRequest], ad_group_service.MutateAdGroupsResponse)]:
'Return a callable for the mutate ad groups method over gRPC.\n\n Creates, updates, or removes ad groups. Operation\n statuses are returned.\n\n Returns:\n ... | -8,380,430,057,967,699,000 | Return a callable for the mutate ad groups method over gRPC.
Creates, updates, or removes ad groups. Operation
statuses are returned.
Returns:
Callable[[~.MutateAdGroupsRequest],
~.MutateAdGroupsResponse]:
A function that, when called, will call the underlying RPC
on the server. | google/ads/googleads/v4/services/services/ad_group_service/transports/grpc.py | mutate_ad_groups | batardo/google-ads-python | python | @property
def mutate_ad_groups(self) -> Callable[([ad_group_service.MutateAdGroupsRequest], ad_group_service.MutateAdGroupsResponse)]:
'Return a callable for the mutate ad groups method over gRPC.\n\n Creates, updates, or removes ad groups. Operation\n statuses are returned.\n\n Returns:\n ... |
def build_batch_cells_update(spreadsheet_key, worksheet_id):
'Creates an empty cells feed for adding batch cell updates to.\n\n Call batch_set_cell on the resulting CellsFeed instance then send the batch\n request TODO: fill in\n\n Args:\n spreadsheet_key: The ID of the spreadsheet\n worksheet_id... | 810,300,953,523,937,000 | Creates an empty cells feed for adding batch cell updates to.
Call batch_set_cell on the resulting CellsFeed instance then send the batch
request TODO: fill in
Args:
spreadsheet_key: The ID of the spreadsheet
worksheet_id: | src/gdata/spreadsheets/data.py | build_batch_cells_update | BinaryMuse/gdata-python3 | python | def build_batch_cells_update(spreadsheet_key, worksheet_id):
'Creates an empty cells feed for adding batch cell updates to.\n\n Call batch_set_cell on the resulting CellsFeed instance then send the batch\n request TODO: fill in\n\n Args:\n spreadsheet_key: The ID of the spreadsheet\n worksheet_id... |
def get_spreadsheet_key(self):
'Extracts the spreadsheet key unique to this spreadsheet.'
return self.get_id().split('/')[(- 1)] | 1,261,120,473,276,283,000 | Extracts the spreadsheet key unique to this spreadsheet. | src/gdata/spreadsheets/data.py | get_spreadsheet_key | BinaryMuse/gdata-python3 | python | def get_spreadsheet_key(self):
return self.get_id().split('/')[(- 1)] |
def get_worksheet_id(self):
'The worksheet ID identifies this worksheet in its spreadsheet.'
return self.get_id().split('/')[(- 1)] | 2,508,608,035,589,404,000 | The worksheet ID identifies this worksheet in its spreadsheet. | src/gdata/spreadsheets/data.py | get_worksheet_id | BinaryMuse/gdata-python3 | python | def get_worksheet_id(self):
return self.get_id().split('/')[(- 1)] |
def get_value(self, column_name):
"Returns the displayed text for the desired column in this row.\n\n The formula or input which generated the displayed value is not accessible\n through the list feed, to see the user's input, use the cells feed.\n\n If a column is not present in this spreadshe... | 7,342,499,590,514,441,000 | Returns the displayed text for the desired column in this row.
The formula or input which generated the displayed value is not accessible
through the list feed, to see the user's input, use the cells feed.
If a column is not present in this spreadsheet, or there is no value
for a column in this row, this method will ... | src/gdata/spreadsheets/data.py | get_value | BinaryMuse/gdata-python3 | python | def get_value(self, column_name):
"Returns the displayed text for the desired column in this row.\n\n The formula or input which generated the displayed value is not accessible\n through the list feed, to see the user's input, use the cells feed.\n\n If a column is not present in this spreadshe... |
def set_value(self, column_name, value):
'Changes the value of cell in this row under the desired column name.\n\n Warning: if the cell contained a formula, it will be wiped out by setting\n the value using the list feed since the list feed only works with\n displayed values.\n\n No clie... | -3,940,375,273,505,523,700 | Changes the value of cell in this row under the desired column name.
Warning: if the cell contained a formula, it will be wiped out by setting
the value using the list feed since the list feed only works with
displayed values.
No client side checking is performed on the column_name, you need to
ensure that the column... | src/gdata/spreadsheets/data.py | set_value | BinaryMuse/gdata-python3 | python | def set_value(self, column_name, value):
'Changes the value of cell in this row under the desired column name.\n\n Warning: if the cell contained a formula, it will be wiped out by setting\n the value using the list feed since the list feed only works with\n displayed values.\n\n No clie... |
def to_dict(self):
'Converts this row to a mapping of column names to their values.'
result = {}
values = self.get_elements(namespace=GSX_NAMESPACE)
for item in values:
result[item._get_tag()] = item.text
return result | 6,996,222,690,848,394,000 | Converts this row to a mapping of column names to their values. | src/gdata/spreadsheets/data.py | to_dict | BinaryMuse/gdata-python3 | python | def to_dict(self):
result = {}
values = self.get_elements(namespace=GSX_NAMESPACE)
for item in values:
result[item._get_tag()] = item.text
return result |
def from_dict(self, values):
'Sets values for this row from the dictionary.\n\n Old values which are already in the entry will not be removed unless\n they are overwritten with new values from the dict.\n '
for (column, value) in values.items():
self.set_value(column, value) | 3,441,590,298,280,555,500 | Sets values for this row from the dictionary.
Old values which are already in the entry will not be removed unless
they are overwritten with new values from the dict. | src/gdata/spreadsheets/data.py | from_dict | BinaryMuse/gdata-python3 | python | def from_dict(self, values):
'Sets values for this row from the dictionary.\n\n Old values which are already in the entry will not be removed unless\n they are overwritten with new values from the dict.\n '
for (column, value) in values.items():
self.set_value(column, value) |
def add_set_cell(self, row, col, input_value):
'Adds a request to change the contents of a cell to this batch request.\n\n Args:\n row: int, The row number for this cell. Numbering starts at 1.\n col: int, The column number for this cell. Starts at 1.\n input_value: str, The desire... | 8,668,246,841,363,812,000 | Adds a request to change the contents of a cell to this batch request.
Args:
row: int, The row number for this cell. Numbering starts at 1.
col: int, The column number for this cell. Starts at 1.
input_value: str, The desired formula/content this cell should contain. | src/gdata/spreadsheets/data.py | add_set_cell | BinaryMuse/gdata-python3 | python | def add_set_cell(self, row, col, input_value):
'Adds a request to change the contents of a cell to this batch request.\n\n Args:\n row: int, The row number for this cell. Numbering starts at 1.\n col: int, The column number for this cell. Starts at 1.\n input_value: str, The desire... |
def print_array_to_excel(array, first_cell, ws, axis=2):
'\n Print an np array to excel using openpyxl\n :param array: np array\n :param first_cell: first cell to start dumping values in\n :param ws: worksheet reference. From openpyxl, ws=wb[sheetname]\n :param axis: to determine if the array is a co... | -598,473,824,827,451,600 | Print an np array to excel using openpyxl
:param array: np array
:param first_cell: first cell to start dumping values in
:param ws: worksheet reference. From openpyxl, ws=wb[sheetname]
:param axis: to determine if the array is a col vector (0), row vector (1), or 2d matrix (2) | gold nanocluster synthesis/own_package/others.py | print_array_to_excel | acceleratedmaterials/NUS_AMDworkshop | python | def print_array_to_excel(array, first_cell, ws, axis=2):
'\n Print an np array to excel using openpyxl\n :param array: np array\n :param first_cell: first cell to start dumping values in\n :param ws: worksheet reference. From openpyxl, ws=wb[sheetname]\n :param axis: to determine if the array is a co... |
def findMedianSortedArrays(self, nums1, nums2):
'\n :type nums1: List[int]\n :type nums2: List[int]\n :rtype: float\n '
m = len(nums1)
n = len(nums2)
def find_kth(nums1, nums2, index1, index2, k):
if (index1 >= len(nums1)):
return nums2[((index2 + k) - 1)... | 7,292,337,121,661,577,000 | :type nums1: List[int]
:type nums2: List[int]
:rtype: float | Codes/xiaohong2019/leetcode/4_median_of_two_sorted_arrays.py | findMedianSortedArrays | Buddy119/algorithm | python | def findMedianSortedArrays(self, nums1, nums2):
'\n :type nums1: List[int]\n :type nums2: List[int]\n :rtype: float\n '
m = len(nums1)
n = len(nums2)
def find_kth(nums1, nums2, index1, index2, k):
if (index1 >= len(nums1)):
return nums2[((index2 + k) - 1)... |
@bot.command()
@commands.is_owner()
async def prepare(ctx: commands.Context):
'Starts a persistent view.'
(await ctx.send("What's your favourite colour?", view=PersistentView())) | 5,189,294,021,437,334,000 | Starts a persistent view. | examples/views/persistent.py | prepare | Chromosomologist/disnake | python | @bot.command()
@commands.is_owner()
async def prepare(ctx: commands.Context):
(await ctx.send("What's your favourite colour?", view=PersistentView())) |
@property
def categories(self):
'Category names'
return self._meta['categories'] | -957,717,788,498,336,500 | Category names | seamseg/data/dataset.py | categories | 030Solutions/seamseg | python | @property
def categories(self):
return self._meta['categories'] |
@property
def num_categories(self):
'Number of categories'
return len(self.categories) | -8,312,312,894,611,809,000 | Number of categories | seamseg/data/dataset.py | num_categories | 030Solutions/seamseg | python | @property
def num_categories(self):
return len(self.categories) |
@property
def num_stuff(self):
'Number of "stuff" categories'
return self._meta['num_stuff'] | 8,253,697,926,380,450,000 | Number of "stuff" categories | seamseg/data/dataset.py | num_stuff | 030Solutions/seamseg | python | @property
def num_stuff(self):
return self._meta['num_stuff'] |
@property
def num_thing(self):
'Number of "thing" categories'
return (self.num_categories - self.num_stuff) | -8,476,085,295,398,408,000 | Number of "thing" categories | seamseg/data/dataset.py | num_thing | 030Solutions/seamseg | python | @property
def num_thing(self):
return (self.num_categories - self.num_stuff) |
@property
def original_ids(self):
'Original class id of each category'
return self._meta['original_ids'] | 8,745,717,664,375,170,000 | Original class id of each category | seamseg/data/dataset.py | original_ids | 030Solutions/seamseg | python | @property
def original_ids(self):
return self._meta['original_ids'] |
@property
def palette(self):
'Default palette to be used when color-coding semantic labels'
return np.array(self._meta['palette'], dtype=np.uint8) | -7,619,175,149,919,133,000 | Default palette to be used when color-coding semantic labels | seamseg/data/dataset.py | palette | 030Solutions/seamseg | python | @property
def palette(self):
return np.array(self._meta['palette'], dtype=np.uint8) |
@property
def img_sizes(self):
'Size of each image of the dataset'
return [img_desc['size'] for img_desc in self._images] | 3,391,114,829,995,243,500 | Size of each image of the dataset | seamseg/data/dataset.py | img_sizes | 030Solutions/seamseg | python | @property
def img_sizes(self):
return [img_desc['size'] for img_desc in self._images] |
@property
def img_categories(self):
'Categories present in each image of the dataset'
return [img_desc['cat'] for img_desc in self._images] | -1,921,090,118,317,093,600 | Categories present in each image of the dataset | seamseg/data/dataset.py | img_categories | 030Solutions/seamseg | python | @property
def img_categories(self):
return [img_desc['cat'] for img_desc in self._images] |
def get_raw_image(self, idx):
'Load a single, unmodified image with given id from the dataset'
img_file = path.join(self._img_dir, idx)
if path.exists((img_file + '.png')):
img_file = (img_file + '.png')
elif path.exists((img_file + '.jpg')):
img_file = (img_file + '.jpg')
else:
... | 4,054,153,896,457,395,700 | Load a single, unmodified image with given id from the dataset | seamseg/data/dataset.py | get_raw_image | 030Solutions/seamseg | python | def get_raw_image(self, idx):
img_file = path.join(self._img_dir, idx)
if path.exists((img_file + '.png')):
img_file = (img_file + '.png')
elif path.exists((img_file + '.jpg')):
img_file = (img_file + '.jpg')
else:
raise IOError('Cannot find any image for id {} in {}'.format... |
def get_image_desc(self, idx):
'Look up an image descriptor given the id'
matching = [img_desc for img_desc in self._images if (img_desc['id'] == idx)]
if (len(matching) == 1):
return matching[0]
else:
raise ValueError(('No image found with id %s' % idx)) | 3,199,198,709,214,985,700 | Look up an image descriptor given the id | seamseg/data/dataset.py | get_image_desc | 030Solutions/seamseg | python | def get_image_desc(self, idx):
matching = [img_desc for img_desc in self._images if (img_desc['id'] == idx)]
if (len(matching) == 1):
return matching[0]
else:
raise ValueError(('No image found with id %s' % idx)) |
@property
def img_sizes(self):
'Size of each image of the dataset'
return [img_desc['size'] for img_desc in self._images] | 3,391,114,829,995,243,500 | Size of each image of the dataset | seamseg/data/dataset.py | img_sizes | 030Solutions/seamseg | python | @property
def img_sizes(self):
return [img_desc['size'] for img_desc in self._images] |
def onMessage(self, message):
'Messages sent to the bot will arrive here. Command handling routing\n is done in this function.'
if (not isinstance(message.body, DomishElement)):
return None
text = unicode(message.body).encode('utf-8').strip()
(from_addr, _, _) = message['from'].partition(... | 7,766,323,072,201,223,000 | Messages sent to the bot will arrive here. Command handling routing
is done in this function. | vumi/transports/xmpp/xmpp.py | onMessage | rapidsms/vumi | python | def onMessage(self, message):
'Messages sent to the bot will arrive here. Command handling routing\n is done in this function.'
if (not isinstance(message.body, DomishElement)):
return None
text = unicode(message.body).encode('utf-8').strip()
(from_addr, _, _) = message['from'].partition(... |
def __new__(metacls, name, bases, namespace, **kwargs):
'Remove directives from the class namespace.\n\n It does not make sense to have some directives available after the\n class was created or even at the instance level (e.g. doing\n ``self.parameter([1, 2, 3])`` does not make sense). So here... | -2,115,828,187,254,994,700 | Remove directives from the class namespace.
It does not make sense to have some directives available after the
class was created or even at the instance level (e.g. doing
``self.parameter([1, 2, 3])`` does not make sense). So here, we
intercept those directives out of the namespace before the class is
constructed. | reframe/core/meta.py | __new__ | ChristopherBignamini/reframe | python | def __new__(metacls, name, bases, namespace, **kwargs):
'Remove directives from the class namespace.\n\n It does not make sense to have some directives available after the\n class was created or even at the instance level (e.g. doing\n ``self.parameter([1, 2, 3])`` does not make sense). So here... |
def __call__(cls, *args, **kwargs):
'Inject parameter and variable spaces during object construction.\n\n When a class is instantiated, this method intercepts the arguments\n associated to the parameter and variable spaces. This prevents both\n :func:`__new__` and :func:`__init__` methods from ... | -5,211,590,653,261,494,000 | Inject parameter and variable spaces during object construction.
When a class is instantiated, this method intercepts the arguments
associated to the parameter and variable spaces. This prevents both
:func:`__new__` and :func:`__init__` methods from ever seing these
arguments.
The parameter and variable spaces are in... | reframe/core/meta.py | __call__ | ChristopherBignamini/reframe | python | def __call__(cls, *args, **kwargs):
'Inject parameter and variable spaces during object construction.\n\n When a class is instantiated, this method intercepts the arguments\n associated to the parameter and variable spaces. This prevents both\n :func:`__new__` and :func:`__init__` methods from ... |
def __getattribute__(cls, name):
"Attribute lookup method for custom class attributes.\n\n ReFrame test variables are descriptors injected at the class level.\n If a variable descriptor has already been injected into the class,\n do not return the descriptor object and return the default value\... | -2,813,964,682,816,430,000 | Attribute lookup method for custom class attributes.
ReFrame test variables are descriptors injected at the class level.
If a variable descriptor has already been injected into the class,
do not return the descriptor object and return the default value
associated with that variable instead.
.. warning::
.. versio... | reframe/core/meta.py | __getattribute__ | ChristopherBignamini/reframe | python | def __getattribute__(cls, name):
"Attribute lookup method for custom class attributes.\n\n ReFrame test variables are descriptors injected at the class level.\n If a variable descriptor has already been injected into the class,\n do not return the descriptor object and return the default value\... |
def __getattr__(cls, name):
'Backup attribute lookup method into custom namespaces.\n\n Some ReFrame built-in types are stored under their own sub-namespaces.\n This method will perform an attribute lookup on these sub-namespaces\n if a call to the default :func:`__getattribute__` method fails ... | -5,505,047,425,900,703,000 | Backup attribute lookup method into custom namespaces.
Some ReFrame built-in types are stored under their own sub-namespaces.
This method will perform an attribute lookup on these sub-namespaces
if a call to the default :func:`__getattribute__` method fails to
retrieve the requested class attribute. | reframe/core/meta.py | __getattr__ | ChristopherBignamini/reframe | python | def __getattr__(cls, name):
'Backup attribute lookup method into custom namespaces.\n\n Some ReFrame built-in types are stored under their own sub-namespaces.\n This method will perform an attribute lookup on these sub-namespaces\n if a call to the default :func:`__getattribute__` method fails ... |
def setvar(cls, name, value):
"Set the value of a variable.\n\n :param name: The name of the variable.\n :param value: The value of the variable.\n\n :returns: :class:`True` if the variable was set.\n A variable will *not* be set, if it does not exist or when an\n attempt ... | 7,055,573,840,113,530,000 | Set the value of a variable.
:param name: The name of the variable.
:param value: The value of the variable.
:returns: :class:`True` if the variable was set.
A variable will *not* be set, if it does not exist or when an
attempt is made to set it with its underlying descriptor.
This happens during the vari... | reframe/core/meta.py | setvar | ChristopherBignamini/reframe | python | def setvar(cls, name, value):
"Set the value of a variable.\n\n :param name: The name of the variable.\n :param value: The value of the variable.\n\n :returns: :class:`True` if the variable was set.\n A variable will *not* be set, if it does not exist or when an\n attempt ... |
def __setattr__(cls, name, value):
"Handle the special treatment required for variables and parameters.\n\n A variable's default value can be updated when accessed as a regular\n class attribute. This behavior does not apply when the assigned value\n is a descriptor object. In that case, the ta... | -5,539,171,203,802,578,000 | Handle the special treatment required for variables and parameters.
A variable's default value can be updated when accessed as a regular
class attribute. This behavior does not apply when the assigned value
is a descriptor object. In that case, the task of setting the value is
delegated to the base :func:`__setattr__`... | reframe/core/meta.py | __setattr__ | ChristopherBignamini/reframe | python | def __setattr__(cls, name, value):
"Handle the special treatment required for variables and parameters.\n\n A variable's default value can be updated when accessed as a regular\n class attribute. This behavior does not apply when the assigned value\n is a descriptor object. In that case, the ta... |
@property
def param_space(cls):
' Make the parameter space available as read-only.'
return cls._rfm_param_space | 942,503,294,481,041,700 | Make the parameter space available as read-only. | reframe/core/meta.py | param_space | ChristopherBignamini/reframe | python | @property
def param_space(cls):
' '
return cls._rfm_param_space |
def is_abstract(cls):
'Check if the class is an abstract test.\n\n This is the case when some parameters are undefined, which results in\n the length of the parameter space being 0.\n\n :return: bool indicating whether the test has undefined parameters.\n\n :meta private:\n '
... | 9,123,215,739,712,699,000 | Check if the class is an abstract test.
This is the case when some parameters are undefined, which results in
the length of the parameter space being 0.
:return: bool indicating whether the test has undefined parameters.
:meta private: | reframe/core/meta.py | is_abstract | ChristopherBignamini/reframe | python | def is_abstract(cls):
'Check if the class is an abstract test.\n\n This is the case when some parameters are undefined, which results in\n the length of the parameter space being 0.\n\n :return: bool indicating whether the test has undefined parameters.\n\n :meta private:\n '
... |
def __getitem__(self, key):
'Expose and control access to the local namespaces.\n\n Variables may only be retrieved if their value has been previously\n set. Accessing a parameter in the class body is disallowed (the\n actual test parameter is set during the class instantiation).\n ... | 431,080,028,754,792,600 | Expose and control access to the local namespaces.
Variables may only be retrieved if their value has been previously
set. Accessing a parameter in the class body is disallowed (the
actual test parameter is set during the class instantiation). | reframe/core/meta.py | __getitem__ | ChristopherBignamini/reframe | python | def __getitem__(self, key):
'Expose and control access to the local namespaces.\n\n Variables may only be retrieved if their value has been previously\n set. Accessing a parameter in the class body is disallowed (the\n actual test parameter is set during the class instantiation).\n ... |
def reset(self, key):
'Reset an item to rerun it through the __setitem__ logic.'
self[key] = self[key] | 710,586,851,198,783,600 | Reset an item to rerun it through the __setitem__ logic. | reframe/core/meta.py | reset | ChristopherBignamini/reframe | python | def reset(self, key):
self[key] = self[key] |
def bind(fn, name=None):
'Directive to bind a free function to a class.\n\n See online docs for more information.\n\n .. note::\n Functions bound using this directive must be re-inspected after\n the class body execution has completed. This directive attaches\n ... | -3,430,508,932,960,869,000 | Directive to bind a free function to a class.
See online docs for more information.
.. note::
Functions bound using this directive must be re-inspected after
the class body execution has completed. This directive attaches
the external method into the class namespace and returns the
associated instance of ... | reframe/core/meta.py | bind | ChristopherBignamini/reframe | python | def bind(fn, name=None):
'Directive to bind a free function to a class.\n\n See online docs for more information.\n\n .. note::\n Functions bound using this directive must be re-inspected after\n the class body execution has completed. This directive attaches\n ... |
def final(fn):
'Indicate that a function is final and cannot be overridden.'
fn._rfm_final = True
return fn | -7,045,401,230,001,315,000 | Indicate that a function is final and cannot be overridden. | reframe/core/meta.py | final | ChristopherBignamini/reframe | python | def final(fn):
fn._rfm_final = True
return fn |
def run_before(stage):
'Decorator for attaching a test method to a given stage.\n\n See online docs for more information.\n '
return hooks.attach_to(('pre_' + stage)) | 7,346,210,348,767,370,000 | Decorator for attaching a test method to a given stage.
See online docs for more information. | reframe/core/meta.py | run_before | ChristopherBignamini/reframe | python | def run_before(stage):
'Decorator for attaching a test method to a given stage.\n\n See online docs for more information.\n '
return hooks.attach_to(('pre_' + stage)) |
def run_after(stage):
'Decorator for attaching a test method to a given stage.\n\n See online docs for more information.\n '
return hooks.attach_to(('post_' + stage)) | 5,219,522,190,465,508,000 | Decorator for attaching a test method to a given stage.
See online docs for more information. | reframe/core/meta.py | run_after | ChristopherBignamini/reframe | python | def run_after(stage):
'Decorator for attaching a test method to a given stage.\n\n See online docs for more information.\n '
return hooks.attach_to(('post_' + stage)) |
def sanity_function(fn):
"Mark a function as the test's sanity function.\n\n Decorated functions must be unary and they will be converted into\n deferred expressions.\n "
_def_fn = deferrable(fn)
setattr(_def_fn, '_rfm_sanity_fn', True)
return _def_fn | 800,883,873,856,133,400 | Mark a function as the test's sanity function.
Decorated functions must be unary and they will be converted into
deferred expressions. | reframe/core/meta.py | sanity_function | ChristopherBignamini/reframe | python | def sanity_function(fn):
"Mark a function as the test's sanity function.\n\n Decorated functions must be unary and they will be converted into\n deferred expressions.\n "
_def_fn = deferrable(fn)
setattr(_def_fn, '_rfm_sanity_fn', True)
return _def_fn |
def performance_function(units, *, perf_key=None):
'Decorate a function to extract a performance variable.\n\n The ``units`` argument indicates the units of the performance\n variable to be extracted.\n The ``perf_key`` optional arg will be used as the name of the\n perfo... | -1,649,085,680,087,831,600 | Decorate a function to extract a performance variable.
The ``units`` argument indicates the units of the performance
variable to be extracted.
The ``perf_key`` optional arg will be used as the name of the
performance variable. If not provided, the function name will
be used as the performance variable name. | reframe/core/meta.py | performance_function | ChristopherBignamini/reframe | python | def performance_function(units, *, perf_key=None):
'Decorate a function to extract a performance variable.\n\n The ``units`` argument indicates the units of the performance\n variable to be extracted.\n The ``perf_key`` optional arg will be used as the name of the\n perfo... |
def plot_ei(self, LAXIS, bconv, tconv, xbl, xbr, ybu, ybd, ilg):
'Plot mean Favrian internal energy stratification in the model'
if ((self.ig != 1) and (self.ig != 2)):
print(('ERROR(InternalEnergyEquation.py):' + self.errorGeometry(self.ig)))
sys.exit()
grd1 = self.xzn0
plt1 = self.fht_... | 4,726,730,710,213,819,000 | Plot mean Favrian internal energy stratification in the model | EQUATIONS/InternalEnergyEquation.py | plot_ei | mmicromegas/ransX | python | def plot_ei(self, LAXIS, bconv, tconv, xbl, xbr, ybu, ybd, ilg):
if ((self.ig != 1) and (self.ig != 2)):
print(('ERROR(InternalEnergyEquation.py):' + self.errorGeometry(self.ig)))
sys.exit()
grd1 = self.xzn0
plt1 = self.fht_ei
plt.figure(figsize=(7, 6))
plt.gca().yaxis.get_major... |
def plot_ei_equation(self, LAXIS, bconv, tconv, xbl, xbr, ybu, ybd, ilg):
'Plot internal energy equation in the model'
if ((self.ig != 1) and (self.ig != 2)):
print(('ERROR(InternalEnergyEquation.py):' + self.errorGeometry(self.ig)))
sys.exit()
grd1 = self.xzn0
lhs0 = self.minus_dt_dd_fh... | 6,408,376,364,074,986,000 | Plot internal energy equation in the model | EQUATIONS/InternalEnergyEquation.py | plot_ei_equation | mmicromegas/ransX | python | def plot_ei_equation(self, LAXIS, bconv, tconv, xbl, xbr, ybu, ybd, ilg):
if ((self.ig != 1) and (self.ig != 2)):
print(('ERROR(InternalEnergyEquation.py):' + self.errorGeometry(self.ig)))
sys.exit()
grd1 = self.xzn0
lhs0 = self.minus_dt_dd_fht_ei
lhs1 = self.minus_div_dd_fht_ux_fht... |
@classmethod
def is_requested_microversion_compatible(cls, max_version):
"Check the compatibility of selected request microversion\n\n This method will check if selected request microversion\n (cls.request_microversion) for test is compatible with respect\n to 'max_version'. Compatible means if... | -9,064,361,423,180,570,000 | Check the compatibility of selected request microversion
This method will check if selected request microversion
(cls.request_microversion) for test is compatible with respect
to 'max_version'. Compatible means if selected request microversion
is in the range(<=) of 'max_version'.
:param max_version: maximum microver... | tempest/api/compute/base.py | is_requested_microversion_compatible | AurelienLourot/tempest | python | @classmethod
def is_requested_microversion_compatible(cls, max_version):
"Check the compatibility of selected request microversion\n\n This method will check if selected request microversion\n (cls.request_microversion) for test is compatible with respect\n to 'max_version'. Compatible means if... |
@classmethod
def server_check_teardown(cls):
"Checks is the shared server clean enough for subsequent test.\n\n Method will delete the server when it's dirty.\n The setUp method is responsible for creating a new server.\n Exceptions raised in tearDown class are fails the test case,\n ... | -674,806,159,774,933,900 | Checks is the shared server clean enough for subsequent test.
Method will delete the server when it's dirty.
The setUp method is responsible for creating a new server.
Exceptions raised in tearDown class are fails the test case,
This method supposed to use only by tearDown methods, when
the shared server_id is stored ... | tempest/api/compute/base.py | server_check_teardown | AurelienLourot/tempest | python | @classmethod
def server_check_teardown(cls):
"Checks is the shared server clean enough for subsequent test.\n\n Method will delete the server when it's dirty.\n The setUp method is responsible for creating a new server.\n Exceptions raised in tearDown class are fails the test case,\n ... |
@classmethod
def create_test_server(cls, validatable=False, volume_backed=False, validation_resources=None, clients=None, **kwargs):
'Wrapper utility that returns a test server.\n\n This wrapper utility calls the common create test server and\n returns a test server. The purpose of this wrapper is to ... | 2,757,388,231,244,504,000 | Wrapper utility that returns a test server.
This wrapper utility calls the common create test server and
returns a test server. The purpose of this wrapper is to minimize
the impact on the code of the tests already using this
function.
:param validatable: Whether the server will be pingable or sshable.
:param volume_... | tempest/api/compute/base.py | create_test_server | AurelienLourot/tempest | python | @classmethod
def create_test_server(cls, validatable=False, volume_backed=False, validation_resources=None, clients=None, **kwargs):
'Wrapper utility that returns a test server.\n\n This wrapper utility calls the common create test server and\n returns a test server. The purpose of this wrapper is to ... |
def wait_for(self, condition):
'Repeatedly calls condition() until a timeout.'
start_time = int(time.time())
while True:
try:
condition()
except Exception:
pass
else:
return
if ((int(time.time()) - start_time) >= self.build_timeout):
... | 231,719,249,102,957,250 | Repeatedly calls condition() until a timeout. | tempest/api/compute/base.py | wait_for | AurelienLourot/tempest | python | def wait_for(self, condition):
start_time = int(time.time())
while True:
try:
condition()
except Exception:
pass
else:
return
if ((int(time.time()) - start_time) >= self.build_timeout):
condition()
return
ti... |
@classmethod
def create_image_from_server(cls, server_id, **kwargs):
'Wrapper utility that returns an image created from the server.\n\n If compute microversion >= 2.36, the returned image response will\n be from the image service API rather than the compute image proxy API.\n '
name = kwar... | -1,321,252,166,117,362,000 | Wrapper utility that returns an image created from the server.
If compute microversion >= 2.36, the returned image response will
be from the image service API rather than the compute image proxy API. | tempest/api/compute/base.py | create_image_from_server | AurelienLourot/tempest | python | @classmethod
def create_image_from_server(cls, server_id, **kwargs):
'Wrapper utility that returns an image created from the server.\n\n If compute microversion >= 2.36, the returned image response will\n be from the image service API rather than the compute image proxy API.\n '
name = kwar... |
@classmethod
def recreate_server(cls, server_id, validatable=False, **kwargs):
'Destroy an existing class level server and creates a new one\n\n Some test classes use a test server that can be used by multiple\n tests. This is done to optimise runtime and test load.\n If something goes wrong wi... | -3,965,829,209,142,081,000 | Destroy an existing class level server and creates a new one
Some test classes use a test server that can be used by multiple
tests. This is done to optimise runtime and test load.
If something goes wrong with the test server, it can be rebuilt
using this helper.
This helper can also be used for the initial provision... | tempest/api/compute/base.py | recreate_server | AurelienLourot/tempest | python | @classmethod
def recreate_server(cls, server_id, validatable=False, **kwargs):
'Destroy an existing class level server and creates a new one\n\n Some test classes use a test server that can be used by multiple\n tests. This is done to optimise runtime and test load.\n If something goes wrong wi... |
@classmethod
def delete_server(cls, server_id):
'Deletes an existing server and waits for it to be gone.'
try:
cls.servers_client.delete_server(server_id)
waiters.wait_for_server_termination(cls.servers_client, server_id)
except Exception:
LOG.exception('Failed to delete server %s', ... | 1,090,790,289,301,993,200 | Deletes an existing server and waits for it to be gone. | tempest/api/compute/base.py | delete_server | AurelienLourot/tempest | python | @classmethod
def delete_server(cls, server_id):
try:
cls.servers_client.delete_server(server_id)
waiters.wait_for_server_termination(cls.servers_client, server_id)
except Exception:
LOG.exception('Failed to delete server %s', server_id) |
def resize_server(self, server_id, new_flavor_id, **kwargs):
'resize and confirm_resize an server, waits for it to be ACTIVE.'
self.servers_client.resize_server(server_id, new_flavor_id, **kwargs)
waiters.wait_for_server_status(self.servers_client, server_id, 'VERIFY_RESIZE')
self.servers_client.confirm... | 8,273,950,907,388,383,000 | resize and confirm_resize an server, waits for it to be ACTIVE. | tempest/api/compute/base.py | resize_server | AurelienLourot/tempest | python | def resize_server(self, server_id, new_flavor_id, **kwargs):
self.servers_client.resize_server(server_id, new_flavor_id, **kwargs)
waiters.wait_for_server_status(self.servers_client, server_id, 'VERIFY_RESIZE')
self.servers_client.confirm_resize_server(server_id)
waiters.wait_for_server_status(self... |
@classmethod
def delete_volume(cls, volume_id):
'Deletes the given volume and waits for it to be gone.'
try:
cls.volumes_client.delete_volume(volume_id)
cls.volumes_client.wait_for_resource_deletion(volume_id)
except lib_exc.NotFound:
LOG.warning("Unable to delete volume '%s' since i... | -2,243,379,255,210,685,200 | Deletes the given volume and waits for it to be gone. | tempest/api/compute/base.py | delete_volume | AurelienLourot/tempest | python | @classmethod
def delete_volume(cls, volume_id):
try:
cls.volumes_client.delete_volume(volume_id)
cls.volumes_client.wait_for_resource_deletion(volume_id)
except lib_exc.NotFound:
LOG.warning("Unable to delete volume '%s' since it was not found. Maybe it was already deleted?", volume... |
@classmethod
def get_server_ip(cls, server, validation_resources=None):
"Get the server fixed or floating IP.\n\n Based on the configuration we're in, return a correct ip\n address for validating that a guest is up.\n\n :param server: The server dict as returned by the API\n :param valid... | -8,295,158,105,538,785,000 | Get the server fixed or floating IP.
Based on the configuration we're in, return a correct ip
address for validating that a guest is up.
:param server: The server dict as returned by the API
:param validation_resources: The dict of validation resources
provisioned for the server. | tempest/api/compute/base.py | get_server_ip | AurelienLourot/tempest | python | @classmethod
def get_server_ip(cls, server, validation_resources=None):
"Get the server fixed or floating IP.\n\n Based on the configuration we're in, return a correct ip\n address for validating that a guest is up.\n\n :param server: The server dict as returned by the API\n :param valid... |
@classmethod
def create_volume(cls, image_ref=None, **kwargs):
"Create a volume and wait for it to become 'available'.\n\n :param image_ref: Specify an image id to create a bootable volume.\n :param kwargs: other parameters to create volume.\n :returns: The available volume.\n "
if (... | 2,551,400,951,215,064,000 | Create a volume and wait for it to become 'available'.
:param image_ref: Specify an image id to create a bootable volume.
:param kwargs: other parameters to create volume.
:returns: The available volume. | tempest/api/compute/base.py | create_volume | AurelienLourot/tempest | python | @classmethod
def create_volume(cls, image_ref=None, **kwargs):
"Create a volume and wait for it to become 'available'.\n\n :param image_ref: Specify an image id to create a bootable volume.\n :param kwargs: other parameters to create volume.\n :returns: The available volume.\n "
if (... |
def _detach_volume(self, server, volume):
'Helper method to detach a volume.\n\n Ignores 404 responses if the volume or server do not exist, or the\n volume is already detached from the server.\n '
try:
volume = self.volumes_client.show_volume(volume['id'])['volume']
if (vol... | 1,405,029,417,197,140,700 | Helper method to detach a volume.
Ignores 404 responses if the volume or server do not exist, or the
volume is already detached from the server. | tempest/api/compute/base.py | _detach_volume | AurelienLourot/tempest | python | def _detach_volume(self, server, volume):
'Helper method to detach a volume.\n\n Ignores 404 responses if the volume or server do not exist, or the\n volume is already detached from the server.\n '
try:
volume = self.volumes_client.show_volume(volume['id'])['volume']
if (vol... |
def attach_volume(self, server, volume, device=None, tag=None):
"Attaches volume to server and waits for 'in-use' volume status.\n\n The volume will be detached when the test tears down.\n\n :param server: The server to which the volume will be attached.\n :param volume: The volume to attach.\n... | -6,207,551,653,731,612,000 | Attaches volume to server and waits for 'in-use' volume status.
The volume will be detached when the test tears down.
:param server: The server to which the volume will be attached.
:param volume: The volume to attach.
:param device: Optional mountpoint for the attached volume. Note that
this is not guaranteed fo... | tempest/api/compute/base.py | attach_volume | AurelienLourot/tempest | python | def attach_volume(self, server, volume, device=None, tag=None):
"Attaches volume to server and waits for 'in-use' volume status.\n\n The volume will be detached when the test tears down.\n\n :param server: The server to which the volume will be attached.\n :param volume: The volume to attach.\n... |
def assert_flavor_equal(self, flavor_id, server_flavor):
'Check whether server_flavor equals to flavor.\n\n :param flavor_id: flavor id\n :param server_flavor: flavor info returned by show_server.\n '
if server_flavor.get('id'):
msg = 'server flavor is not same as flavor!'
s... | -40,787,179,334,714,180 | Check whether server_flavor equals to flavor.
:param flavor_id: flavor id
:param server_flavor: flavor info returned by show_server. | tempest/api/compute/base.py | assert_flavor_equal | AurelienLourot/tempest | python | def assert_flavor_equal(self, flavor_id, server_flavor):
'Check whether server_flavor equals to flavor.\n\n :param flavor_id: flavor id\n :param server_flavor: flavor info returned by show_server.\n '
if server_flavor.get('id'):
msg = 'server flavor is not same as flavor!'
s... |
@api.route('/webhooks')
async def webhooks(req, resp):
'\n Handle incoming GitHub webhooks\n '
data = (await req.media())
eventid = req.headers.get('X-GitHub-Delivery')
event = req.headers.get('X-GitHub-Event')
if (not Subscriptions.is_listening_for(event)):
resp.text = f'Accepted, but... | -3,591,437,164,178,230,300 | Handle incoming GitHub webhooks | app/webhooks.py | webhooks | adnrs96/github | python | @api.route('/webhooks')
async def webhooks(req, resp):
'\n \n '
data = (await req.media())
eventid = req.headers.get('X-GitHub-Delivery')
event = req.headers.get('X-GitHub-Event')
if (not Subscriptions.is_listening_for(event)):
resp.text = f'Accepted, but not listening for {event} even... |
@classmethod
def list(cls, session, paginated=False, **params):
'This method is a generator which yields queue objects.\n\n This is almost the copy of list method of resource.Resource class.\n The only difference is the request header now includes `Client-ID`\n and `X-PROJECT-ID` fields which a... | 3,059,643,027,235,729,000 | This method is a generator which yields queue objects.
This is almost the copy of list method of resource.Resource class.
The only difference is the request header now includes `Client-ID`
and `X-PROJECT-ID` fields which are required by Zaqar v2 API. | openstack/message/v2/queue.py | list | TeutoNet/openstacksdk | python | @classmethod
def list(cls, session, paginated=False, **params):
'This method is a generator which yields queue objects.\n\n This is almost the copy of list method of resource.Resource class.\n The only difference is the request header now includes `Client-ID`\n and `X-PROJECT-ID` fields which a... |
def ComputeConvOutputShape(in_shape, t_stride, f_stride, outc=None, padding='SAME'):
"Computes output shape for convolution and pooling layers.\n\n If `in_shape` is a dynamic shape, the output will be Tensors, while if\n `in_shape` is a list of ints then the output will also be a list of ints.\n\n Args:\n in_... | 6,174,591,343,225,735,000 | Computes output shape for convolution and pooling layers.
If `in_shape` is a dynamic shape, the output will be Tensors, while if
`in_shape` is a list of ints then the output will also be a list of ints.
Args:
in_shape: A length 4 Tensor or list representing the input shape.
t_stride: The stride along the time dim... | lingvo/core/conv_layers_with_time_padding.py | ComputeConvOutputShape | zhoudoufu/lingvo | python | def ComputeConvOutputShape(in_shape, t_stride, f_stride, outc=None, padding='SAME'):
"Computes output shape for convolution and pooling layers.\n\n If `in_shape` is a dynamic shape, the output will be Tensors, while if\n `in_shape` is a list of ints then the output will also be a list of ints.\n\n Args:\n in_... |
def ComputeConvOutputPadding(paddings, window, stride, padding_algorithm='SAME'):
"Computes paddings for convolution and pooling output.\n\n out_padding[i] == 1 iff any in_padding corresponding to that output is 1.\n\n Args:\n paddings: The paddings tensor. It is expected to be of shape [batch, time].\n win... | -5,047,944,237,518,243,000 | Computes paddings for convolution and pooling output.
out_padding[i] == 1 iff any in_padding corresponding to that output is 1.
Args:
paddings: The paddings tensor. It is expected to be of shape [batch, time].
window: The size of the windows.
stride: The time-stride between adjacent windows.
padding_algorithm... | lingvo/core/conv_layers_with_time_padding.py | ComputeConvOutputPadding | zhoudoufu/lingvo | python | def ComputeConvOutputPadding(paddings, window, stride, padding_algorithm='SAME'):
"Computes paddings for convolution and pooling output.\n\n out_padding[i] == 1 iff any in_padding corresponding to that output is 1.\n\n Args:\n paddings: The paddings tensor. It is expected to be of shape [batch, time].\n win... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.