function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def test_update_manifest_properties(self, containerregistry_endpoint): repo = self.get_resource_name("repo") tag = self.get_resource_name("tag") self.import_image(containerregistry_endpoint, HELLO_WORLD, ["{}:{}".format(repo, tag)]) client = self.create_registry_client(containerregistry_endpoint) properties = client.get_manifest_properties(repo, tag) properties.can_delete = False properties.can_read = False properties.can_write = False properties.can_list = False received = client.update_manifest_properties(repo, tag, properties) assert received.can_delete == properties.can_delete assert received.can_read == properties.can_read assert received.can_write == properties.can_write assert received.can_list == properties.can_list properties.can_delete = True properties.can_read = True properties.can_write = True properties.can_list = True received = client.update_manifest_properties(repo, tag, properties) assert received.can_delete == True assert received.can_read == True assert received.can_write == True assert received.can_list == True
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_update_manifest_properties_kwargs(self, containerregistry_endpoint): repo = self.get_resource_name("repo") tag = self.get_resource_name("tag") self.import_image(containerregistry_endpoint, HELLO_WORLD, ["{}:{}".format(repo, tag)]) client = self.create_registry_client(containerregistry_endpoint) properties = client.get_manifest_properties(repo, tag) received = client.update_manifest_properties(repo, tag, can_delete=False) assert received.can_delete == False received = client.update_manifest_properties(repo, tag, can_read=False) assert received.can_read == False received = client.update_manifest_properties(repo, tag, can_write=False) assert received.can_write == False received = client.update_manifest_properties(repo, tag, can_list=False) assert received.can_list == False received = client.update_manifest_properties( repo, tag, can_delete=True, can_read=True, can_write=True, can_list=True ) assert received.can_delete == True assert received.can_read == True assert received.can_write == True assert received.can_list == True
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_get_tag_properties(self, containerregistry_endpoint): repo = self.get_resource_name("repo") tag = self.get_resource_name("tag") self.import_image(containerregistry_endpoint, HELLO_WORLD, ["{}:{}".format(repo, tag)]) client = self.create_registry_client(containerregistry_endpoint) properties = client.get_tag_properties(repo, tag) assert isinstance(properties, ArtifactTagProperties) assert properties.name == tag
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_get_tag_properties_does_not_exist(self, containerregistry_endpoint): client = self.create_registry_client(containerregistry_endpoint) with pytest.raises(ResourceNotFoundError): client.get_tag_properties("Nonexistent", "Nonexistent")
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_update_tag_properties(self, containerregistry_endpoint): repo = self.get_resource_name("repo") tag = self.get_resource_name("tag") self.import_image(containerregistry_endpoint, HELLO_WORLD, ["{}:{}".format(repo, tag)]) client = self.create_registry_client(containerregistry_endpoint) properties = client.get_tag_properties(repo, tag) properties.can_delete = False properties.can_read = False properties.can_write = False properties.can_list = False received = client.update_tag_properties(repo, tag, properties) assert received.can_delete == properties.can_delete assert received.can_read == properties.can_read assert received.can_write == properties.can_write assert received.can_list == properties.can_list properties.can_delete = True properties.can_read = True properties.can_write = True properties.can_list = True received = client.update_tag_properties(repo, tag, properties) assert received.can_delete == True assert received.can_read == True assert received.can_write == True assert received.can_list == True
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_update_tag_properties_kwargs(self, containerregistry_endpoint): repo = self.get_resource_name("repo") tag = self.get_resource_name("tag") self.import_image(containerregistry_endpoint, HELLO_WORLD, ["{}:{}".format(repo, tag)]) client = self.create_registry_client(containerregistry_endpoint) properties = client.get_tag_properties(repo, tag) received = client.update_tag_properties(repo, tag, can_delete=False) assert received.can_delete == False received = client.update_tag_properties(repo, tag, can_read=False) assert received.can_read == False received = client.update_tag_properties(repo, tag, can_write=False) assert received.can_write == False received = client.update_tag_properties(repo, tag, can_list=False) assert received.can_list == False received = client.update_tag_properties( repo, tag, can_delete=True, can_read=True, can_write=True, can_list=True ) assert received.can_delete == True assert received.can_read == True assert received.can_write == True assert received.can_list == True
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_list_tag_properties(self, containerregistry_endpoint): repo = self.get_resource_name("repo") tag = self.get_resource_name("tag") tags = ["{}:{}".format(repo, tag + str(i)) for i in range(4)] self.import_image(containerregistry_endpoint, HELLO_WORLD, tags) client = self.create_registry_client(containerregistry_endpoint) count = 0 for tag in client.list_tag_properties(repo): assert "{}:{}".format(repo, tag.name) in tags count += 1 assert count == 4
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_list_tag_properties_order_descending(self, containerregistry_endpoint): repo = self.get_resource_name("repo") tag = self.get_resource_name("tag") tags = ["{}:{}".format(repo, tag + str(i)) for i in range(4)] self.import_image(containerregistry_endpoint, HELLO_WORLD, tags) client = self.create_registry_client(containerregistry_endpoint) prev_last_updated_on = None count = 0 for tag in client.list_tag_properties(repo, order_by=ArtifactTagOrder.LAST_UPDATED_ON_DESCENDING): assert "{}:{}".format(repo, tag.name) in tags if prev_last_updated_on: assert tag.last_updated_on < prev_last_updated_on prev_last_updated_on = tag.last_updated_on count += 1 assert count == 4 prev_last_updated_on = None count = 0 for tag in client.list_tag_properties(repo, order_by="timedesc"): assert "{}:{}".format(repo, tag.name) in tags if prev_last_updated_on: assert tag.last_updated_on < prev_last_updated_on prev_last_updated_on = tag.last_updated_on count += 1 assert count == 4
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_list_tag_properties_order_ascending(self, containerregistry_endpoint): repo = self.get_resource_name("repo") tag = self.get_resource_name("tag") tags = ["{}:{}".format(repo, tag + str(i)) for i in range(4)] self.import_image(containerregistry_endpoint, HELLO_WORLD, tags) client = self.create_registry_client(containerregistry_endpoint) prev_last_updated_on = None count = 0 for tag in client.list_tag_properties(repo, order_by=ArtifactTagOrder.LAST_UPDATED_ON_ASCENDING): assert "{}:{}".format(repo, tag.name) in tags if prev_last_updated_on: assert tag.last_updated_on > prev_last_updated_on prev_last_updated_on = tag.last_updated_on count += 1 assert count == 4 prev_last_updated_on = None count = 0 for tag in client.list_tag_properties(repo, order_by="timeasc"): assert "{}:{}".format(repo, tag.name) in tags if prev_last_updated_on: assert tag.last_updated_on > prev_last_updated_on prev_last_updated_on = tag.last_updated_on count += 1 assert count == 4
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_delete_tag(self, containerregistry_endpoint): repo = self.get_resource_name("repo") tag = self.get_resource_name("tag") tags = ["{}:{}".format(repo, tag + str(i)) for i in range(4)] self.import_image(containerregistry_endpoint, HELLO_WORLD, tags) client = self.create_registry_client(containerregistry_endpoint) client.delete_tag(repo, tag + str(0)) count = 0 for tag in client.list_tag_properties(repo): assert "{}:{}".format(repo, tag.name) in tags[1:] count += 1 assert count == 3
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_delete_tag_does_not_exist(self, containerregistry_endpoint): client = self.create_registry_client(containerregistry_endpoint) client.delete_tag(DOES_NOT_EXIST, DOES_NOT_EXIST)
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_delete_manifest(self, containerregistry_endpoint): repo = self.get_resource_name("repo") tag = self.get_resource_name("tag") self.import_image(containerregistry_endpoint, HELLO_WORLD, ["{}:{}".format(repo, tag)]) client = self.create_registry_client(containerregistry_endpoint) client.delete_manifest(repo, tag) self.sleep(10) with pytest.raises(ResourceNotFoundError): client.get_manifest_properties(repo, tag)
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_delete_manifest_does_not_exist(self, containerregistry_endpoint): repo = self.get_resource_name("repo") tag = self.get_resource_name("tag") self.import_image(containerregistry_endpoint, HELLO_WORLD, ["{}:{}".format(repo, tag)]) client = self.create_registry_client(containerregistry_endpoint) manifest = client.get_manifest_properties(repo, tag) digest = manifest.digest digest = digest[:-10] + u"a" * 10 client.delete_manifest(repo, digest)
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_expiration_time_parsing(self, containerregistry_endpoint): from azure.containerregistry._authentication_policy import ContainerRegistryChallengePolicy client = self.create_registry_client(containerregistry_endpoint) for repo in client.list_repository_names(): pass for policy in client._client._client._pipeline._impl_policies: if isinstance(policy, ContainerRegistryChallengePolicy): policy._exchange_client._expiration_time = 0 break count = 0 for repo in client.list_repository_names(): count += 1 assert count >= 1
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_construct_container_registry_client(self, containerregistry_endpoint): authority = get_authority(containerregistry_endpoint) credential = self.get_credential(authority) client = ContainerRegistryClient(endpoint=containerregistry_endpoint, credential=credential, audience="https://microsoft.com") with pytest.raises(ClientAuthenticationError): properties = client.get_repository_properties(HELLO_WORLD) with pytest.raises(ValueError): client = ContainerRegistryClient(endpoint=containerregistry_endpoint, credential=credential)
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_set_api_version(self, containerregistry_endpoint): client = self.create_registry_client(containerregistry_endpoint) assert client._client._config.api_version == "2021-07-01"
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def __init__(self, client, config, serializer, deserializer) -> None: self._client = client self._serialize = serializer self._deserialize = deserializer self._config = config
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {})
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): deserialized = self._deserialize('SecurityRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list( self, resource_group_name: str, network_security_group_name: str, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkSecurityGroupName': self._serialize.url("network_security_group_name", network_security_group_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] request = self._client.get(url, query_parameters, header_parameters) return request
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def color(self): """ The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen - A list or array of any of the above Returns ------- str|numpy.ndarray """ return self["color"]
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def color(self, val): self["color"] = val
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def colorsrc(self): """ Sets the source reference on Chart Studio Cloud for color .
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def colorsrc(self, val): self["colorsrc"] = val
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def family(self): """ HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren't available on the system. The Chart Studio Cloud (at https://chart- studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include "Arial", "Balto", "Courier New", "Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans Narrow", "Raleway", "Times New Roman".
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def family(self, val): self["family"] = val
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def familysrc(self): """ Sets the source reference on Chart Studio Cloud for family .
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def familysrc(self, val): self["familysrc"] = val
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def size(self): """ The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] - A tuple, list, or one-dimensional numpy array of the above Returns ------- int|float|numpy.ndarray """ return self["size"]
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def size(self, val): self["size"] = val
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def sizesrc(self): """ Sets the source reference on Chart Studio Cloud for size .
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def sizesrc(self, val): self["sizesrc"] = val
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def _prop_descriptions(self): return """\ color colorsrc Sets the source reference on Chart Studio Cloud for color . family HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren't available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on- premise) generates images on a server, where only a select number of fonts are installed and supported. These include "Arial", "Balto", "Courier New", "Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans Narrow", "Raleway", "Times New Roman". familysrc Sets the source reference on Chart Studio Cloud for family . size sizesrc Sets the source reference on Chart Studio Cloud for size . """
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def time_formatter(seconds): return "%d:%.2d:%.2d" % (seconds // 3600, seconds % 3600 // 60, seconds % 60)
ultmaster/eoj3
[ 161, 29, 161, 27, 1489228488 ]
def test_func(self): if self.privileged: return True return self.contest.access_level > 0
ultmaster/eoj3
[ 161, 29, 161, 27, 1489228488 ]
def get_context_data(self, **kwargs): data = super(ContestProblemDetail, self).get_context_data(**kwargs) data['contest_problem'] = get_object_or_404(ContestProblem, identifier=self.kwargs.get('pid'), contest=self.contest) data['problem'] = data['contest_problem'].problem # submit part data['lang_choices'] = list(filter(lambda k: k[0] in self.contest.supported_language_list, LANG_CHOICE)) # if self.request.user.is_authenticated: # data['attempt_left'] = settings.SUBMISSION_ATTEMPT_LIMIT - self.contest.submission_set.filter( # author=self.request.user, # problem_id=data['contest_problem'].problem_id).count() # if self.contest.status != 0: # data['attempt_left'] = settings.SUBMISSION_ATTEMPT_LIMIT return data
ultmaster/eoj3
[ 161, 29, 161, 27, 1489228488 ]
def get(self, request, *args, **kwargs): if not self.contest.pdf_statement: raise Http404 return HttpResponse(self.contest.pdf_statement.read(), content_type="application/pdf")
ultmaster/eoj3
[ 161, 29, 161, 27, 1489228488 ]
def post(self, request, cid): if not request.user.is_authenticated: messages.error(request, "请先登录。") else: invitation_code = request.POST.get('code', '') try: invitation = ContestInvitation.objects.get(code=invitation_code) add_participant_with_invitation(cid, invitation.pk, request.user) messages.success(request, "你已成功加入。") except ContestInvitation.DoesNotExist: messages.error(request, "邀请码有误。") return HttpResponseRedirect(reverse('contest:dashboard', kwargs={'cid': cid}))
ultmaster/eoj3
[ 161, 29, 161, 27, 1489228488 ]
def post(self, request, cid): if not request.user.is_authenticated: messages.error(request, "请先登录。") else: contest = get_object_or_404(Contest, pk=cid) if contest.access_level == 30 and contest.status == -1: with transaction.atomic(): if not contest.contestparticipant_set.filter(user=request.user).exists(): contest.contestparticipant_set.get_or_create(user=request.user) else: contest.contestparticipant_set.filter(user=request.user).delete() return HttpResponseRedirect(reverse('contest:dashboard', kwargs={'cid': cid}))
ultmaster/eoj3
[ 161, 29, 161, 27, 1489228488 ]
def get_queryset(self): user = self.request.user if self.request.user.is_authenticated else None return Contest.objects.get_status_list(show_all=is_admin_or_root(self.request.user), filter_user=user, contest_type=0)
ultmaster/eoj3
[ 161, 29, 161, 27, 1489228488 ]
def get_queryset(self): user = self.request.user if self.request.user.is_authenticated else None return Contest.objects.get_status_list(show_all=is_admin_or_root(self.request.user), filter_user=user, sorting_by_id=True, contest_type=1)
ultmaster/eoj3
[ 161, 29, 161, 27, 1489228488 ]
def dispatch(self, request, *args, **kwargs): q = request.GET.get('q', '') if request.GET.get('full'): self.full = True elif q.isdigit(): self.user = get_object_or_404(User, pk=q) self.full = False elif request.user.is_authenticated: self.user = request.user self.full = False else: self.full = True return super().dispatch(request, *args, **kwargs)
ultmaster/eoj3
[ 161, 29, 161, 27, 1489228488 ]
def get_context_data(self, **kwargs): # pylint: disable=arguments-differ data = super().get_context_data(**kwargs) data['full'] = self.full if not self.full: data['query_user'] = self.user data['max_rating'], data['min_rating'] = 2000, 1000 data['rating_list'] = ContestUserRating.objects.select_related('contest').filter(user=self.user) if data['rating_list']: data['max_rating'] = max(data['max_rating'], max(map(lambda x: x.rating, data['rating_list']))) data['min_rating'] = min(data['min_rating'], max(map(lambda x: x.rating, data['rating_list']))) return data
ultmaster/eoj3
[ 161, 29, 161, 27, 1489228488 ]
def test_func(self): return self.vp_available
ultmaster/eoj3
[ 161, 29, 161, 27, 1489228488 ]
def __init__(self, name): self.name = name self.connections_made = 0 self.data = [] self.connection_errors = [] self.expected_received = 0 self.expected = 0 self.connected = asyncio.Future() self.closed = asyncio.Future()
madedotcom/photon-pump
[ 49, 10, 49, 30, 1493299344 ]
def data_received(self, data): print("%s: data received" % self.name) self.data.append(data) if self.expectation and not self.expectation.done(): self.expected_received += len(data) if self.expected_received >= self.expected: self.expectation.set_result(None)
madedotcom/photon-pump
[ 49, 10, 49, 30, 1493299344 ]
def expect(self, count): self.expected_received = 0 self.expected = count self.expectation = asyncio.Future() return self.expectation
madedotcom/photon-pump
[ 49, 10, 49, 30, 1493299344 ]
def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer self._config = config
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list_monitored_resources.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.post(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] request = self._client.get(url, query_parameters, header_parameters) return request
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list_by_subscription( self, **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] request = self._client.get(url, query_parameters, header_parameters) return request
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list_by_resource_group( self, resource_group_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] request = self._client.get(url, query_parameters, header_parameters) return request
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get( self, resource_group_name, # type: str monitor_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def _create_initial( self, resource_group_name, # type: str monitor_name, # type: str body=None, # type: Optional["_models.LogzMonitorResource"] **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def begin_create( self, resource_group_name, # type: str monitor_name, # type: str body=None, # type: Optional["_models.LogzMonitorResource"] **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): deserialized = self._deserialize('LogzMonitorResource', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def update( self, resource_group_name, # type: str monitor_name, # type: str body=None, # type: Optional["_models.LogzMonitorResourceUpdateParameters"] **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def _delete_initial( self, resource_group_name, # type: str monitor_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def begin_delete( self, resource_group_name, # type: str monitor_name, # type: str **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {})
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list_user_roles( self, resource_group_name, # type: str monitor_name, # type: str body=None, # type: Optional["_models.UserRoleRequest"] **kwargs # type: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list_user_roles.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), 'monitorName': self._serialize.url("monitor_name", monitor_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') body_content_kwargs = {} # type: Dict[str, Any] if body is not None: body_content = self._serialize.body(body, 'UserRoleRequest') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) else: url = next_link query_parameters = {} # type: Dict[str, Any] body_content_kwargs = {} # type: Dict[str, Any] if body is not None: body_content = self._serialize.body(body, 'UserRoleRequest') else: body_content = None body_content_kwargs['content'] = body_content request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) return request
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def __init__(self, dm, config, name): self.omConf = {} for k in ['parentDevice', 'transform']: if k in config: self.omConf[k] = config.pop(k) DAQGeneric.__init__(self, dm, config, name) OptomechDevice.__init__(self, dm, config, name)
acq4/acq4
[ 51, 39, 51, 31, 1385049034 ]
def __init__( self, credential: "AsyncTokenCredential", **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def _configure( self, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def build_list_request( **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer self._config = config
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list( self, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): if not next_link:
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def extract_data(pipeline_response): deserialized = self._deserialize("ComputeOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) return None, iter(list_of_elem)
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def __init__(self, client, config, serializer, deserializer) -> None: self._client = client self._serialize = serializer self._deserialize = deserializer self._config = config
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {})
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def get_long_running_output(pipeline_response): deserialized = self._deserialize('SecurityRule', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def list( self, resource_group_name: str, network_security_group_name: str, **kwargs: Any
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def prepare_request(next_link=None): # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') if not next_link: # Construct URL url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'networkSecurityGroupName': self._serialize.url("network_security_group_name", network_security_group_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] request = self._client.get(url, query_parameters, header_parameters) return request
Azure/azure-sdk-for-python
[ 3526, 2256, 3526, 986, 1335285972 ]
def test_basic(self): test_file = os.path.join(sandbox, "test_SourceClip.aaf") f = aaf.open(None, 't') source_mob = f.create.SourceMob() f.storage.add_mob(source_mob) slot = source_mob.add_nil_ref(1, 100, "picture", "25/1") source_ref = aaf.util.SourceRef() source_ref.mob_id = source_mob.mobID source_ref.slot_id = slot.slotID source_ref.start_time = 10 #source_ref. source_clip = f.create.SourceClip("picture", 10, source_ref) assert source_clip.source_ref.mob_id == source_mob.mobID print(source_clip.source_ref.slot_id) assert source_clip.source_ref.slot_id == slot.slotID s = str(source_clip.source_ref) #slot = source_clip.resolve_slot() assert source_clip.start_time == 10 source_clip.start_time = 5 assert source_clip.start_time == 5 # this wont reslove unless sourclip is actually added to file #assert source_clip.resolve_ref() == source_mob
markreidvfx/pyaaf
[ 46, 8, 46, 14, 1377887118 ]
def fuzzy_time(time): """Formats a `datetime.time` object relative to the current time.""" dt = time_to_date(time) return fuzzy_date(dt)
tjcsl/ion
[ 89, 57, 89, 90, 1408078781 ]
def time_to_date(time): """Returns a `datetime.datetime` object from a `datetime.time` object using the current date.""" return datetime.combine(timezone.localdate(), time)
tjcsl/ion
[ 89, 57, 89, 90, 1408078781 ]
def __init__(self, endpoint, pub_queue): from glob import glob from laniakea.localconfig import LocalConfig from laniakea.msgstream import keyfile_read_verify_key self._socket = None self._ctx = zmq.Context.instance() self._pub_queue = pub_queue self._endpoint = endpoint self._trusted_keys = {} # TODO: Implement auto-reloading of valid keys list if directory changes for keyfname in glob(os.path.join(LocalConfig().trusted_curve_keys_dir, '*')): signer_id, verify_key = keyfile_read_verify_key(keyfname) if signer_id and verify_key: self._trusted_keys[signer_id] = verify_key
tanglu-org/laniakea
[ 20, 8, 20, 1, 1465596960 ]
def my_finish(self): if not self.wfile.closed: try: self.wfile.flush() except socket.error: # A final socket error may have occurred here, such as # the local error ECONNABORTED. pass try: self.wfile.close() self.rfile.close() except socket.error: pass
tidalf/plugin.audio.qobuz
[ 15, 8, 15, 17, 1325448354 ]
def is_empty(obj): if obj is None: return True if isinstance(obj, basestring): if obj == '': return True return False
tidalf/plugin.audio.qobuz
[ 15, 8, 15, 17, 1325448354 ]
def is_service_enable(): return config.app.registry.get('enable_scan_feature', to='bool')
tidalf/plugin.audio.qobuz
[ 15, 8, 15, 17, 1325448354 ]
def shutdown_request(): if monitor.abortRequested: shutdown_server() return None
tidalf/plugin.audio.qobuz
[ 15, 8, 15, 17, 1325448354 ]
def __init__(self, port=33574): threading.Thread.__init__(self) self.daemon = True self.port = port self.running = False self.threaded = True self.processes = 2 self.alive = True
tidalf/plugin.audio.qobuz
[ 15, 8, 15, 17, 1325448354 ]
def run(self): while self.alive: if not is_authentication_set(): gui.notify_warn('Authentication not set', 'You need to enter credentials') elif not user.logged: if not api.login( username=qobuzApp.registry.get('username'), password=qobuzApp.registry.get('password')): gui.notify_warn('Login failed', 'Invalid credentials') else: try: application.run(port=self.port, threaded=True, processes=0, debug=False, use_reloader=False, use_debugger=False, use_evalex=True, passthrough_errors=False) except Exception as e: logger.error('KooliService port: %s Error: %s', self.port, e) raise e time.sleep(1)
tidalf/plugin.audio.qobuz
[ 15, 8, 15, 17, 1325448354 ]
def __init__(self, dbfile, page_rows=100): self.dbfile = dbfile self.page_rows = page_rows self.conn = sqlite3.connect(self.dbfile) self.conn.row_factory = sqlite3.Row cursor = self.conn.cursor() cursor.execute( "CREATE TABLE IF NOT EXISTS messages " "(timestamp TEXT, message TEXT);" ) cursor.execute( "CREATE INDEX IF NOT EXISTS messages_timestamp_idx " "ON messages (timestamp);" ) self.conn.commit()
ant9000/websup
[ 2, 1, 2, 1, 1421744113 ]
def count(self): cursor = self.conn.cursor() n = cursor.execute("SELECT COUNT(*) FROM messages").fetchone()[0] return n
ant9000/websup
[ 2, 1, 2, 1, 1421744113 ]
def empty_reduce(rank, device_list, output, source=0): pass
acopar/crow
[ 6, 3, 6, 1, 1488876595 ]
def __init__(self, text_to_speech): self.is_speaking = False self.text_to_speech = text_to_speech
rdmilligan/SaltwashAR
[ 146, 59, 146, 4, 1447704189 ]
def __init__(self): self.__mapping_starts = [] super(Composer, self).__init__()
gitterHQ/ansible
[ 1, 3, 1, 1, 1394046789 ]
def __init__(self, params): super(Windows2012ServerMemory, self).__init__(params)
SekoiaLab/Fastir_Collector
[ 486, 136, 486, 11, 1445591906 ]
def csv_all_modules_opened_files(self): super(Windows2012ServerMemory, self)._csv_all_modules_opened_files()
SekoiaLab/Fastir_Collector
[ 486, 136, 486, 11, 1445591906 ]
def test_flip_bits_in_single_byte(): for i in range(0, 256): assert bit_manipulators.flip_bits_in_single_byte(i) == (255 - i)
guardicore/monkey
[ 6098, 725, 6098, 196, 1440919371 ]
def __init__(self, lock_name): message = 'Failed to acquire lock: {}'.format(lock_name) super(ConcurrentModificationError, self).__init__(self, message)
sio2project/filetracker
[ 7, 12, 7, 1, 1346586491 ]