This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os.path | |
| import re | |
| from pathlib import Path | |
| from packaging.version import parse as Version, InvalidVersion | |
| root = Path() | |
| package_list = [p.as_posix() for p in root.iterdir()] | |
| filtered_package_list = [p for p in package_list if p.startswith("azure-mgmt-") and not p.endswith("nspkg")] | |
| def extract_version(package_name): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try: | |
| from virtual_machine_py3 import VirtualMachine | |
| except (SyntaxError, ImportError): # Catch SyntaxError if Py2 or ImportError if we decide to build wheel for Py2 without py3 files. | |
| from virtual_machine import VirtualMachine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| import pytest | |
| @pytest.mark.asyncio | |
| async def test(): | |
| iterator = iter([]) | |
| return await asyncio.get_event_loop().run_in_executor( | |
| None, | |
| next, | |
| iterator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| import time | |
| from azure.mgmt.compute.v2017_12_01 import ComputeManagementClient | |
| from devtools_testutils.mgmt_settings_real import SUBSCRIPTION_ID, get_credentials | |
| async def test_vm_images_async(client): | |
| result = [] | |
| result_list = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from enum import Enum | |
| import importlib | |
| import inspect | |
| import logging | |
| from pathlib import Path | |
| import pkgutil | |
| import shutil | |
| import sys | |
| import tempfile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import sys | |
| def find_rp(provider_name, providers): | |
| for entry in providers: | |
| if entry["namespace"].lower() == provider_name.lower(): | |
| return entry | |
| def find_resource_type(provider_object, resource_type_name): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from functools import wraps | |
| from six import add_metaclass | |
| class MetaCount(type): | |
| def __new__(cls, *args, **kwargs): | |
| obj = super(MetaCount, cls).__new__(cls, *args, **kwargs) | |
| obj.read_count = 0 | |
| if hasattr(obj, 'read'): | |
| original_read = obj.read | |
| @wraps(original_read) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class _SansIOAsyncHTTPPolicyRunner(AsyncHTTPPolicy[HTTPRequestType, AsyncHTTPResponseType]): #pylint: disable=unsubscriptable-object | |
| """Async implementation of the SansIO policy. | |
| Modifies the request and sends to the next policy in the chain. | |
| :param policy: A SansIO policy. | |
| :type policy: ~azure.core.pipeline.policies.SansIOHTTPPolicy | |
| """ | |
| def __init__(self, policy: SansIOHTTPPolicy) -> None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask, request | |
| from flask_restful import Resource, Api | |
| from azure.appconfiguration import AzureAppConfigurationClient | |
| app = Flask(__name__) | |
| api = Api(app) | |
| class Config(Resource): | |
| def __init__(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from azure.identity import ClientSecretCredential | |
| from azure.mgmt.storage import StorageManagementClient | |
| def get_credentials_identity(): | |
| subscription_id = os.environ.get( | |
| 'AZURE_SUBSCRIPTION_ID', | |
| '11111111-1111-1111-1111-111111111111') # your Azure Subscription Id | |
| credentials = ClientSecretCredential( | |
| client_id=os.environ['AZURE_CLIENT_ID'], |