repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
gbowerman/azurerm
azurerm/computerp.py
list_vmss
def list_vmss(access_token, subscription_id, resource_group): '''List VM Scale Sets in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. Returns: HTT...
python
def list_vmss(access_token, subscription_id, resource_group): '''List VM Scale Sets in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. Returns: HTT...
List VM Scale Sets in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. Returns: HTTP response. JSON body of a list of scale set model views.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L655-L671
gbowerman/azurerm
azurerm/computerp.py
list_vmss_skus
def list_vmss_skus(access_token, subscription_id, resource_group, vmss_name): '''List the VM skus available for a VM Scale Set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. ...
python
def list_vmss_skus(access_token, subscription_id, resource_group, vmss_name): '''List the VM skus available for a VM Scale Set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. ...
List the VM skus available for a VM Scale Set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. Returns: H...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L674-L692
gbowerman/azurerm
azurerm/computerp.py
list_vmss_sub
def list_vmss_sub(access_token, subscription_id): '''List VM Scale Sets in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of VM scale sets. ''' endpoint = ''.join(...
python
def list_vmss_sub(access_token, subscription_id): '''List VM Scale Sets in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of VM scale sets. ''' endpoint = ''.join(...
List VM Scale Sets in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of VM scale sets.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L695-L709
gbowerman/azurerm
azurerm/computerp.py
list_vmss_vm_instance_view_pg
def list_vmss_vm_instance_view_pg(access_token, subscription_id, resource_group, vmss_name, link=None): '''Gets one page of a paginated list of scale set VM instance views. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azu...
python
def list_vmss_vm_instance_view_pg(access_token, subscription_id, resource_group, vmss_name, link=None): '''Gets one page of a paginated list of scale set VM instance views. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azu...
Gets one page of a paginated list of scale set VM instance views. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L733-L756
gbowerman/azurerm
azurerm/computerp.py
poweroff_vmss
def poweroff_vmss(access_token, subscription_id, resource_group, vmss_name): '''Power off all the VMs in a virtual machine scale set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group na...
python
def poweroff_vmss(access_token, subscription_id, resource_group, vmss_name): '''Power off all the VMs in a virtual machine scale set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group na...
Power off all the VMs in a virtual machine scale set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. Returns: ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L780-L798
gbowerman/azurerm
azurerm/computerp.py
poweroff_vmss_vms
def poweroff_vmss_vms(access_token, subscription_id, resource_group, vmss_name, instance_ids): '''Poweroff all the VMs in a virtual machine scale set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure ...
python
def poweroff_vmss_vms(access_token, subscription_id, resource_group, vmss_name, instance_ids): '''Poweroff all the VMs in a virtual machine scale set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure ...
Poweroff all the VMs in a virtual machine scale set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. instance_...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L801-L820
gbowerman/azurerm
azurerm/computerp.py
put_vmss
def put_vmss(access_token, subscription_id, resource_group, vmss_name, vmss_body): '''Put VMSS body. Can be used to create or update a scale set. E.g. call get_vmss(), make changes to the body, call put_vmss(). Args: access_token (str): A valid Azure authentication token. subscription_...
python
def put_vmss(access_token, subscription_id, resource_group, vmss_name, vmss_body): '''Put VMSS body. Can be used to create or update a scale set. E.g. call get_vmss(), make changes to the body, call put_vmss(). Args: access_token (str): A valid Azure authentication token. subscription_...
Put VMSS body. Can be used to create or update a scale set. E.g. call get_vmss(), make changes to the body, call put_vmss(). Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L823-L845
gbowerman/azurerm
azurerm/computerp.py
put_vmss_vm
def put_vmss_vm(access_token, subscription_id, resource_group, vmss_name, vm_id, vm_body): '''Update a VMSS VM. E.g. add/remove a data disk from a specifc VM in a scale set (preview). Note: Only currently enabled for Azure Canary regions. Args: access_token (str): A valid Azure authentication to...
python
def put_vmss_vm(access_token, subscription_id, resource_group, vmss_name, vm_id, vm_body): '''Update a VMSS VM. E.g. add/remove a data disk from a specifc VM in a scale set (preview). Note: Only currently enabled for Azure Canary regions. Args: access_token (str): A valid Azure authentication to...
Update a VMSS VM. E.g. add/remove a data disk from a specifc VM in a scale set (preview). Note: Only currently enabled for Azure Canary regions. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure res...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L848-L870
gbowerman/azurerm
azurerm/computerp.py
scale_vmss
def scale_vmss(access_token, subscription_id, resource_group, vmss_name, capacity): '''Change the instance count of an existing VM Scale Set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource ...
python
def scale_vmss(access_token, subscription_id, resource_group, vmss_name, capacity): '''Change the instance count of an existing VM Scale Set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource ...
Change the instance count of an existing VM Scale Set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of the virtual machine scale set. capacit...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L960-L978
gbowerman/azurerm
azurerm/computerp.py
start_vm
def start_vm(access_token, subscription_id, resource_group, vm_name): '''Start a virtual machine. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vm_name (str): Name of t...
python
def start_vm(access_token, subscription_id, resource_group, vm_name): '''Start a virtual machine. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vm_name (str): Name of t...
Start a virtual machine. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vm_name (str): Name of the virtual machine. Returns: HTTP response.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L981-L1000
gbowerman/azurerm
azurerm/computerp.py
update_vm
def update_vm(access_token, subscription_id, resource_group, vm_name, body): '''Update a virtual machine with a new JSON body. E.g. do a GET, change something, call this. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource...
python
def update_vm(access_token, subscription_id, resource_group, vm_name, body): '''Update a virtual machine with a new JSON body. E.g. do a GET, change something, call this. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource...
Update a virtual machine with a new JSON body. E.g. do a GET, change something, call this. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vm_name (str): Name of the virtual ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L1111-L1129
gbowerman/azurerm
azurerm/computerp.py
update_vmss
def update_vmss(access_token, subscription_id, resource_group, vmss_name, body): '''Update a VMSS with a new JSON body. E.g. do a GET, change something, call this. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group ...
python
def update_vmss(access_token, subscription_id, resource_group, vmss_name, body): '''Update a VMSS with a new JSON body. E.g. do a GET, change something, call this. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group ...
Update a VMSS with a new JSON body. E.g. do a GET, change something, call this. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vm_name (str): Name of the virtual machine. ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/computerp.py#L1132-L1150
gbowerman/azurerm
examples/vmssupgrade.py
get_vm_ids_by_ud
def get_vm_ids_by_ud(access_token, subscription_id, resource_group, vmssname, updatedomain): '''look at VMSS VM instance view to get VM IDs by UD''' instance_viewlist = azurerm.list_vmss_vm_instance_view(access_token, subscription_id, resource_group, vm...
python
def get_vm_ids_by_ud(access_token, subscription_id, resource_group, vmssname, updatedomain): '''look at VMSS VM instance view to get VM IDs by UD''' instance_viewlist = azurerm.list_vmss_vm_instance_view(access_token, subscription_id, resource_group, vm...
look at VMSS VM instance view to get VM IDs by UD
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/vmssupgrade.py#L10-L24
gbowerman/azurerm
examples/vmssupgrade.py
main
def main(): '''main routine''' # create parser arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--vmssname', '-s', required=True, action='store', help='VM Scale Set name') arg_parser.add_argument('--resourcegroup', '-r', required=True, ...
python
def main(): '''main routine''' # create parser arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--vmssname', '-s', required=True, action='store', help='VM Scale Set name') arg_parser.add_argument('--resourcegroup', '-r', required=True, ...
main routine
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/vmssupgrade.py#L27-L196
gbowerman/azurerm
azurerm/graphfns.py
get_graph_token_from_msi
def get_graph_token_from_msi(): '''get a Microsoft Graph access token using Azure Cloud Shell's MSI_ENDPOINT. Notes: The auth token returned by this function is not an Azure auth token. Use it for querying the Microsoft Graph API. This function only works in an Azure cloud shell or...
python
def get_graph_token_from_msi(): '''get a Microsoft Graph access token using Azure Cloud Shell's MSI_ENDPOINT. Notes: The auth token returned by this function is not an Azure auth token. Use it for querying the Microsoft Graph API. This function only works in an Azure cloud shell or...
get a Microsoft Graph access token using Azure Cloud Shell's MSI_ENDPOINT. Notes: The auth token returned by this function is not an Azure auth token. Use it for querying the Microsoft Graph API. This function only works in an Azure cloud shell or virtual machine. Returns: ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/graphfns.py#L11-L30
gbowerman/azurerm
azurerm/graphfns.py
get_object_id_from_graph
def get_object_id_from_graph(access_token=None): '''Return the object ID for the Graph user who owns the access token. Args: access_token (str): A Microsoft Graph access token. (Not an Azure access token.) If not provided, attempt to get it from MSI_ENDPOINT. Returns: ...
python
def get_object_id_from_graph(access_token=None): '''Return the object ID for the Graph user who owns the access token. Args: access_token (str): A Microsoft Graph access token. (Not an Azure access token.) If not provided, attempt to get it from MSI_ENDPOINT. Returns: ...
Return the object ID for the Graph user who owns the access token. Args: access_token (str): A Microsoft Graph access token. (Not an Azure access token.) If not provided, attempt to get it from MSI_ENDPOINT. Returns: An object ID string for a user or service princip...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/graphfns.py#L33-L49
gbowerman/azurerm
azurerm/subfns.py
get_subscription_from_cli
def get_subscription_from_cli(name=None): '''Get the default, or named, subscription id from CLI's local cache. Args: name (str): Optional subscription name. If this is set, the subscription id of the named subscription is returned from the CLI cache if present. If not set, the subscription ...
python
def get_subscription_from_cli(name=None): '''Get the default, or named, subscription id from CLI's local cache. Args: name (str): Optional subscription name. If this is set, the subscription id of the named subscription is returned from the CLI cache if present. If not set, the subscription ...
Get the default, or named, subscription id from CLI's local cache. Args: name (str): Optional subscription name. If this is set, the subscription id of the named subscription is returned from the CLI cache if present. If not set, the subscription id of the default subscription is retu...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/subfns.py#L10-L36
gbowerman/azurerm
azurerm/subfns.py
list_locations
def list_locations(access_token, subscription_id): '''List available locations for a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON list of locations. ''' endpoint = ''.j...
python
def list_locations(access_token, subscription_id): '''List available locations for a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON list of locations. ''' endpoint = ''.j...
List available locations for a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON list of locations.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/subfns.py#L39-L52
gbowerman/azurerm
examples/deploytemplate.py
main
def main(): '''Main routine.''' # validate command line arguments argparser = argparse.ArgumentParser() argparser.add_argument('--uri', '-u', required=True, action='store', help='Template URI') argparser.add_argument('--params', '-f', required=True, ...
python
def main(): '''Main routine.''' # validate command line arguments argparser = argparse.ArgumentParser() argparser.add_argument('--uri', '-u', required=True, action='store', help='Template URI') argparser.add_argument('--params', '-f', required=True, ...
Main routine.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/deploytemplate.py#L14-L131
gbowerman/azurerm
azurerm/cosmosdbrp.py
create_cosmosdb_account
def create_cosmosdb_account(access_token, subscription_id, rgname, account_name, location, cosmosdb_kind): '''Create a new Cosmos DB account in the named resource group, with the named location. Args: access_token (str): A valid Azure authentication token. subscripti...
python
def create_cosmosdb_account(access_token, subscription_id, rgname, account_name, location, cosmosdb_kind): '''Create a new Cosmos DB account in the named resource group, with the named location. Args: access_token (str): A valid Azure authentication token. subscripti...
Create a new Cosmos DB account in the named resource group, with the named location. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. account_name (str): Name of the new Cosmos DB acc...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/cosmosdbrp.py#L8-L35
gbowerman/azurerm
azurerm/cosmosdbrp.py
get_cosmosdb_account_keys
def get_cosmosdb_account_keys(access_token, subscription_id, rgname, account_name): '''Get the access keys for the specified Cosmos DB account. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group ...
python
def get_cosmosdb_account_keys(access_token, subscription_id, rgname, account_name): '''Get the access keys for the specified Cosmos DB account. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group ...
Get the access keys for the specified Cosmos DB account. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. account_name (str): Name of the Cosmos DB account. Returns: HTTP...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/cosmosdbrp.py#L38-L56
gbowerman/azurerm
azurerm/keyvault.py
create_keyvault
def create_keyvault(access_token, subscription_id, rgname, vault_name, location, template_deployment=True, tenant_id=None, object_id=None): '''Create a new key vault in the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (s...
python
def create_keyvault(access_token, subscription_id, rgname, vault_name, location, template_deployment=True, tenant_id=None, object_id=None): '''Create a new key vault in the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (s...
Create a new key vault in the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. vault_name (str): Name of the new key vault. location (str): Azure data ce...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/keyvault.py#L9-L56
gbowerman/azurerm
azurerm/keyvault.py
delete_keyvault
def delete_keyvault(access_token, subscription_id, rgname, vault_name): '''Deletes a key vault in the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. vault_...
python
def delete_keyvault(access_token, subscription_id, rgname, vault_name): '''Deletes a key vault in the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. vault_...
Deletes a key vault in the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. vault_name (str): Name of the new key vault. Returns: HTTP response. 200...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/keyvault.py#L59-L76
gbowerman/azurerm
azurerm/keyvault.py
get_keyvault
def get_keyvault(access_token, subscription_id, rgname, vault_name): '''Gets details about the named key vault. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. vault_name (str): ...
python
def get_keyvault(access_token, subscription_id, rgname, vault_name): '''Gets details about the named key vault. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. vault_name (str): ...
Gets details about the named key vault. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. vault_name (str): Name of the key vault. Returns: HTTP response. JSON body of key...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/keyvault.py#L79-L96
gbowerman/azurerm
azurerm/keyvault.py
list_keyvaults
def list_keyvaults(access_token, subscription_id, rgname): '''Lists key vaults in the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP res...
python
def list_keyvaults(access_token, subscription_id, rgname): '''Lists key vaults in the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP res...
Lists key vaults in the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP response. 200 OK.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/keyvault.py#L99-L115
gbowerman/azurerm
azurerm/keyvault.py
list_keyvaults_sub
def list_keyvaults_sub(access_token, subscription_id): '''Lists key vaults belonging to this subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. 200 OK. ''' endpoint = ''.join([get...
python
def list_keyvaults_sub(access_token, subscription_id): '''Lists key vaults belonging to this subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. 200 OK. ''' endpoint = ''.join([get...
Lists key vaults belonging to this subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. 200 OK.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/keyvault.py#L118-L132
gbowerman/azurerm
azurerm/keyvault.py
set_keyvault_secret
def set_keyvault_secret(access_token, vault_uri, secret_name, secret_value): '''Adds a secret to a key vault using the key vault URI. Creates a new version if the secret already exists. Args: access_token (str): A valid Azure authentication token. vault_uri (str): Vault URI e.g. https:/...
python
def set_keyvault_secret(access_token, vault_uri, secret_name, secret_value): '''Adds a secret to a key vault using the key vault URI. Creates a new version if the secret already exists. Args: access_token (str): A valid Azure authentication token. vault_uri (str): Vault URI e.g. https:/...
Adds a secret to a key vault using the key vault URI. Creates a new version if the secret already exists. Args: access_token (str): A valid Azure authentication token. vault_uri (str): Vault URI e.g. https://myvault.vault.azure.net. secret_name (str): Name of the secret to add. ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/keyvault.py#L135-L166
gbowerman/azurerm
azurerm/keyvault.py
delete_keyvault_secret
def delete_keyvault_secret(access_token, vault_uri, secret_name): '''Deletes a secret from a key vault using the key vault URI. Args: access_token (str): A valid Azure authentication token. vault_uri (str): Vault URI e.g. https://myvault.azure.net. secret_name (str): Name of the secret...
python
def delete_keyvault_secret(access_token, vault_uri, secret_name): '''Deletes a secret from a key vault using the key vault URI. Args: access_token (str): A valid Azure authentication token. vault_uri (str): Vault URI e.g. https://myvault.azure.net. secret_name (str): Name of the secret...
Deletes a secret from a key vault using the key vault URI. Args: access_token (str): A valid Azure authentication token. vault_uri (str): Vault URI e.g. https://myvault.azure.net. secret_name (str): Name of the secret to add. Returns: HTTP response. 200 OK.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/keyvault.py#L169-L183
gbowerman/azurerm
azurerm/insightsrp.py
create_autoscale_rule
def create_autoscale_rule(subscription_id, resource_group, vmss_name, metric_name, operator, threshold, direction, change_count, time_grain='PT1M', time_window='PT5M', cool_down='PT1M'): '''Create a new autoscale rule - pass the output in a list to create_autoscal...
python
def create_autoscale_rule(subscription_id, resource_group, vmss_name, metric_name, operator, threshold, direction, change_count, time_grain='PT1M', time_window='PT5M', cool_down='PT1M'): '''Create a new autoscale rule - pass the output in a list to create_autoscal...
Create a new autoscale rule - pass the output in a list to create_autoscale_setting(). Args: subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. vmss_name (str): Name of scale set to apply scale events to. metric_name (str): Name of metric ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/insightsrp.py#L8-L46
gbowerman/azurerm
azurerm/insightsrp.py
create_autoscale_setting
def create_autoscale_setting(access_token, subscription_id, resource_group, setting_name, vmss_name, location, minval, maxval, default, autoscale_rules, notify=None): '''Create a new autoscale setting for a scale set. Args: access_token (str): A...
python
def create_autoscale_setting(access_token, subscription_id, resource_group, setting_name, vmss_name, location, minval, maxval, default, autoscale_rules, notify=None): '''Create a new autoscale setting for a scale set. Args: access_token (str): A...
Create a new autoscale setting for a scale set. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. setting_name (str): Name of the autoscale setting. vmss_name (str): Na...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/insightsrp.py#L49-L97
gbowerman/azurerm
azurerm/insightsrp.py
list_autoscale_settings
def list_autoscale_settings(access_token, subscription_id): '''List the autoscale settings in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of autoscale settings. '''...
python
def list_autoscale_settings(access_token, subscription_id): '''List the autoscale settings in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of autoscale settings. '''...
List the autoscale settings in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON body of autoscale settings.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/insightsrp.py#L100-L114
gbowerman/azurerm
azurerm/insightsrp.py
list_insights_components
def list_insights_components(access_token, subscription_id, resource_group): '''List the Microsoft Insights components in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource gr...
python
def list_insights_components(access_token, subscription_id, resource_group): '''List the Microsoft Insights components in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource gr...
List the Microsoft Insights components in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. Returns: HTTP response. JSON body of components.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/insightsrp.py#L117-L133
gbowerman/azurerm
azurerm/insightsrp.py
list_metric_defs_for_resource
def list_metric_defs_for_resource(access_token, subscription_id, resource_group, resource_provider, resource_type, resource_name): '''List the monitoring metric definitions for a resource. Args: access_token (str): A valid Azure authentication token. subscripti...
python
def list_metric_defs_for_resource(access_token, subscription_id, resource_group, resource_provider, resource_type, resource_name): '''List the monitoring metric definitions for a resource. Args: access_token (str): A valid Azure authentication token. subscripti...
List the monitoring metric definitions for a resource. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. resource_provider (str): Type of resource provider. resource_ty...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/insightsrp.py#L136-L159
gbowerman/azurerm
azurerm/insightsrp.py
get_metrics_for_resource
def get_metrics_for_resource(access_token, subscription_id, resource_group, resource_provider, resource_type, resource_name): '''Get the monitoring metrics for a resource. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure sub...
python
def get_metrics_for_resource(access_token, subscription_id, resource_group, resource_provider, resource_type, resource_name): '''Get the monitoring metrics for a resource. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure sub...
Get the monitoring metrics for a resource. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. resource_type (str): Type of resource. resource_name (str): Name of resourc...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/insightsrp.py#L162-L184
gbowerman/azurerm
azurerm/insightsrp.py
get_events_for_subscription
def get_events_for_subscription(access_token, subscription_id, start_timestamp): '''Get the insights evens for a subsctipion since the specific timestamp. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. start_timestamp (str): t...
python
def get_events_for_subscription(access_token, subscription_id, start_timestamp): '''Get the insights evens for a subsctipion since the specific timestamp. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. start_timestamp (str): t...
Get the insights evens for a subsctipion since the specific timestamp. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. start_timestamp (str): timestamp to get events from. E.g. '2017-05-01T00:00:00.0000000Z'. Returns: H...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/insightsrp.py#L187-L202
gbowerman/azurerm
examples/create_vm.py
main
def main(): '''Main routine.''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--name', '-n', required=True, action='store', help='Name') arg_parser.add_argument('--rgname', '-g', required=True, action='store', help='Res...
python
def main(): '''Main routine.''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--name', '-n', required=True, action='store', help='Name') arg_parser.add_argument('--rgname', '-g', required=True, action='store', help='Res...
Main routine.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/create_vm.py#L10-L121
gbowerman/azurerm
examples/list_vms.py
main
def main(): '''Main routine.''' # Load Azure app defaults try: with open('azurermconfig.json') as config_file: config_data = json.load(config_file) except FileNotFoundError: sys.exit('Error: Expecting azurermconfig.json in current folder') tenant_id = config_data['tenant...
python
def main(): '''Main routine.''' # Load Azure app defaults try: with open('azurermconfig.json') as config_file: config_data = json.load(config_file) except FileNotFoundError: sys.exit('Error: Expecting azurermconfig.json in current folder') tenant_id = config_data['tenant...
Main routine.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/list_vms.py#L8-L37
gbowerman/azurerm
azurerm/templates.py
deploy_template
def deploy_template(access_token, subscription_id, resource_group, deployment_name, template, parameters): '''Deploy a template referenced by a JSON string, with parameters as a JSON string. Args: access_token (str): A valid Azure authentication token. subscription_id (str):...
python
def deploy_template(access_token, subscription_id, resource_group, deployment_name, template, parameters): '''Deploy a template referenced by a JSON string, with parameters as a JSON string. Args: access_token (str): A valid Azure authentication token. subscription_id (str):...
Deploy a template referenced by a JSON string, with parameters as a JSON string. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. deployment_name (str): A name you give to the...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/templates.py#L7-L32
gbowerman/azurerm
azurerm/templates.py
deploy_template_uri
def deploy_template_uri(access_token, subscription_id, resource_group, deployment_name, template_uri, parameters): '''Deploy a template referenced by a URI, with parameters as a JSON string. Args: access_token (str): A valid Azure authentication token. subscription_id (s...
python
def deploy_template_uri(access_token, subscription_id, resource_group, deployment_name, template_uri, parameters): '''Deploy a template referenced by a URI, with parameters as a JSON string. Args: access_token (str): A valid Azure authentication token. subscription_id (s...
Deploy a template referenced by a URI, with parameters as a JSON string. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. deployment_name (str): A name you give to the deploym...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/templates.py#L35-L60
gbowerman/azurerm
azurerm/templates.py
deploy_template_uri_param_uri
def deploy_template_uri_param_uri(access_token, subscription_id, resource_group, deployment_name, template_uri, parameters_uri): '''Deploy a template with both template and parameters referenced by URIs. Args: access_token (str): A valid Azure authentication token. ...
python
def deploy_template_uri_param_uri(access_token, subscription_id, resource_group, deployment_name, template_uri, parameters_uri): '''Deploy a template with both template and parameters referenced by URIs. Args: access_token (str): A valid Azure authentication token. ...
Deploy a template with both template and parameters referenced by URIs. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. deployment_name (str): A name you give to the deployme...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/templates.py#L63-L88
gbowerman/azurerm
examples/vmssdisk_cliauth.py
attach_model
def attach_model(subscription, rgname, vmssvm_model, diskname, lun): '''Attach a data disk to a VMSS VM model''' disk_id = '/subscriptions/' + subscription + '/resourceGroups/' + rgname + \ '/providers/Microsoft.Compute/disks/' + diskname disk_model = {'lun': lun, 'createOption': 'Attach', 'caching'...
python
def attach_model(subscription, rgname, vmssvm_model, diskname, lun): '''Attach a data disk to a VMSS VM model''' disk_id = '/subscriptions/' + subscription + '/resourceGroups/' + rgname + \ '/providers/Microsoft.Compute/disks/' + diskname disk_model = {'lun': lun, 'createOption': 'Attach', 'caching'...
Attach a data disk to a VMSS VM model
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/vmssdisk_cliauth.py#L9-L17
gbowerman/azurerm
examples/vmssdisk_cliauth.py
detach_model
def detach_model(vmssvm_model, lun): '''Detach a data disk from a VMSS VM model''' data_disks = vmssvm_model['properties']['storageProfile']['dataDisks'] data_disks[:] = [disk for disk in data_disks if disk.get('lun') != lun] vmssvm_model['properties']['storageProfile']['dataDisks'] = data_disks ret...
python
def detach_model(vmssvm_model, lun): '''Detach a data disk from a VMSS VM model''' data_disks = vmssvm_model['properties']['storageProfile']['dataDisks'] data_disks[:] = [disk for disk in data_disks if disk.get('lun') != lun] vmssvm_model['properties']['storageProfile']['dataDisks'] = data_disks ret...
Detach a data disk from a VMSS VM model
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/vmssdisk_cliauth.py#L20-L25
gbowerman/azurerm
examples/vmssdisk_cliauth.py
main
def main(): '''Main routine.''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--vmssname', '-n', required=True, action='store', help='Scale set name') arg_parser.add_argument('--rgname', '-g', required=True, action='sto...
python
def main(): '''Main routine.''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--vmssname', '-n', required=True, action='store', help='Scale set name') arg_parser.add_argument('--rgname', '-g', required=True, action='sto...
Main routine.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/vmssdisk_cliauth.py#L28-L82
gbowerman/azurerm
azurerm/adalfns.py
get_access_token
def get_access_token(tenant_id, application_id, application_secret): '''get an Azure access token using the adal library. Args: tenant_id (str): Tenant id of the user's account. application_id (str): Application id of a Service Principal account. application_secret (str): Application se...
python
def get_access_token(tenant_id, application_id, application_secret): '''get an Azure access token using the adal library. Args: tenant_id (str): Tenant id of the user's account. application_id (str): Application id of a Service Principal account. application_secret (str): Application se...
get an Azure access token using the adal library. Args: tenant_id (str): Tenant id of the user's account. application_id (str): Application id of a Service Principal account. application_secret (str): Application secret (password) of the Service Principal account. Returns: An A...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/adalfns.py#L13-L28
gbowerman/azurerm
azurerm/adalfns.py
get_access_token_from_cli
def get_access_token_from_cli(): '''Get an Azure authentication token from CLI's cache. Will only work if CLI local cache has an unexpired auth token (i.e. you ran 'az login' recently), or if you are running in Azure Cloud Shell (aka cloud console) Returns: An Azure authentication token st...
python
def get_access_token_from_cli(): '''Get an Azure authentication token from CLI's cache. Will only work if CLI local cache has an unexpired auth token (i.e. you ran 'az login' recently), or if you are running in Azure Cloud Shell (aka cloud console) Returns: An Azure authentication token st...
Get an Azure authentication token from CLI's cache. Will only work if CLI local cache has an unexpired auth token (i.e. you ran 'az login' recently), or if you are running in Azure Cloud Shell (aka cloud console) Returns: An Azure authentication token string.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/adalfns.py#L31-L105
gbowerman/azurerm
examples/list_vm_images.py
main
def main(): '''Main routine.''' # Load Azure app defaults try: with open('azurermconfig.json') as config_file: config_data = json.load(config_file) except FileNotFoundError: sys.exit('Error: Expecting azurermconfig.json in current folder') tenant_id = config_data['tenant...
python
def main(): '''Main routine.''' # Load Azure app defaults try: with open('azurermconfig.json') as config_file: config_data = json.load(config_file) except FileNotFoundError: sys.exit('Error: Expecting azurermconfig.json in current folder') tenant_id = config_data['tenant...
Main routine.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/list_vm_images.py#L8-L36
gbowerman/azurerm
azurerm/vmimages.py
list_offers
def list_offers(access_token, subscription_id, location, publisher): '''List available VM image offers from a publisher. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. location (str): Azure data center location. E.g. westus. ...
python
def list_offers(access_token, subscription_id, location, publisher): '''List available VM image offers from a publisher. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. location (str): Azure data center location. E.g. westus. ...
List available VM image offers from a publisher. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. location (str): Azure data center location. E.g. westus. publisher (str): Publisher name, e.g. Canonical. Returns: ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/vmimages.py#L7-L25
gbowerman/azurerm
azurerm/vmimages.py
list_skus
def list_skus(access_token, subscription_id, location, publisher, offer): '''List available VM image skus for a publisher offer. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. location (str): Azure data center location. E.g. w...
python
def list_skus(access_token, subscription_id, location, publisher, offer): '''List available VM image skus for a publisher offer. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. location (str): Azure data center location. E.g. w...
List available VM image skus for a publisher offer. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. location (str): Azure data center location. E.g. westus. publisher (str): VM image publisher. E.g. MicrosoftWindowsServer. ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/vmimages.py#L47-L67
gbowerman/azurerm
azurerm/vmimages.py
list_sku_versions
def list_sku_versions(access_token, subscription_id, location, publisher, offer, sku): '''List available versions for a given publisher's sku. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. location (str): Azure data center lo...
python
def list_sku_versions(access_token, subscription_id, location, publisher, offer, sku): '''List available versions for a given publisher's sku. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. location (str): Azure data center lo...
List available versions for a given publisher's sku. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. location (str): Azure data center location. E.g. westus. publisher (str): VM image publisher. E.g. MicrosoftWindowsServer....
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/vmimages.py#L70-L92
gbowerman/azurerm
examples/vmssvmdisk.py
main
def main(): '''Main routine.''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--vmssname', '-n', required=True, action='store', help='Scale set name') arg_parser.add_argument('--rgname', '-g', required=True, action='sto...
python
def main(): '''Main routine.''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--vmssname', '-n', required=True, action='store', help='Scale set name') arg_parser.add_argument('--rgname', '-g', required=True, action='sto...
Main routine.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/vmssvmdisk.py#L27-L90
gbowerman/azurerm
examples/jumpbox.py
main
def main(): '''Main routine.''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--vmname', '-n', required=True, action='store', help='Name') arg_parser.add_argument('--rgname', '-g', required=True, action='store', help='R...
python
def main(): '''Main routine.''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--vmname', '-n', required=True, action='store', help='Name') arg_parser.add_argument('--rgname', '-g', required=True, action='store', help='R...
Main routine.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/jumpbox.py#L12-L245
gbowerman/azurerm
examples/insights_metrics.py
main
def main(): '''Main routine.''' # process arguments if len(sys.argv) < 3: usage() rgname = sys.argv[1] vmss = sys.argv[2] # Load Azure app defaults try: with open('azurermconfig.json') as config_file: config_data = json.load(config_file) except FileNotFound...
python
def main(): '''Main routine.''' # process arguments if len(sys.argv) < 3: usage() rgname = sys.argv[1] vmss = sys.argv[2] # Load Azure app defaults try: with open('azurermconfig.json') as config_file: config_data = json.load(config_file) except FileNotFound...
Main routine.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/insights_metrics.py#L12-L48
gbowerman/azurerm
examples/list_vmss_pips.py
main
def main(): '''main reoutine''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--vmssname', '-n', required=True, action='store', help='VMSS Name') arg_parser.add_argument('--rgname', '-g', required=True, ...
python
def main(): '''main reoutine''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument('--vmssname', '-n', required=True, action='store', help='VMSS Name') arg_parser.add_argument('--rgname', '-g', required=True, ...
main reoutine
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/list_vmss_pips.py#L10-L51
gbowerman/azurerm
examples/list_rgs.py
main
def main(): '''Main routine.''' # if in Azure cloud shell, authenticate using the MSI endpoint if 'ACC_CLOUD' in os.environ and 'MSI_ENDPOINT' in os.environ: access_token = azurerm.get_access_token_from_cli() subscription_id = azurerm.get_subscription_from_cli() else: # load service prin...
python
def main(): '''Main routine.''' # if in Azure cloud shell, authenticate using the MSI endpoint if 'ACC_CLOUD' in os.environ and 'MSI_ENDPOINT' in os.environ: access_token = azurerm.get_access_token_from_cli() subscription_id = azurerm.get_subscription_from_cli() else: # load service prin...
Main routine.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/list_rgs.py#L8-L36
gbowerman/azurerm
azurerm/container.py
create_container_definition
def create_container_definition(container_name, image, port=80, cpu=1.0, memgb=1.5, environment=None): '''Makes a python dictionary of container properties. Args: container_name: The name of the container. image (str): Container image string. E.g. nginx. ...
python
def create_container_definition(container_name, image, port=80, cpu=1.0, memgb=1.5, environment=None): '''Makes a python dictionary of container properties. Args: container_name: The name of the container. image (str): Container image string. E.g. nginx. ...
Makes a python dictionary of container properties. Args: container_name: The name of the container. image (str): Container image string. E.g. nginx. port (int): TCP port number. E.g. 8080. cpu (float): Amount of CPU to allocate to container. E.g. 1.0. memgb (float): Memory i...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/container.py#L7-L33
gbowerman/azurerm
azurerm/container.py
create_container_instance_group
def create_container_instance_group(access_token, subscription_id, resource_group, container_group_name, container_list, location, ostype='Linux', port=80, iptype='public'): '''Create a new container group with a list of containers specifified ...
python
def create_container_instance_group(access_token, subscription_id, resource_group, container_group_name, container_list, location, ostype='Linux', port=80, iptype='public'): '''Create a new container group with a list of containers specifified ...
Create a new container group with a list of containers specifified by container_list. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. container_group_name (str): Name of cont...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/container.py#L36-L72
gbowerman/azurerm
azurerm/container.py
delete_container_instance_group
def delete_container_instance_group(access_token, subscription_id, resource_group, container_group_name): '''Delete a container group from a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscriptio...
python
def delete_container_instance_group(access_token, subscription_id, resource_group, container_group_name): '''Delete a container group from a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscriptio...
Delete a container group from a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. container_group_name (str): Name of container instance group. Returns: ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/container.py#L75-L94
gbowerman/azurerm
azurerm/container.py
get_container_instance_group
def get_container_instance_group(access_token, subscription_id, resource_group, container_group_name): '''Get the JSON definition of a container group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. ...
python
def get_container_instance_group(access_token, subscription_id, resource_group, container_group_name): '''Get the JSON definition of a container group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. ...
Get the JSON definition of a container group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. container_group_name (str): Name of container instance group. Returns: ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/container.py#L97-L116
gbowerman/azurerm
azurerm/container.py
get_container_instance_logs
def get_container_instance_logs(access_token, subscription_id, resource_group, container_group_name, container_name=None): '''Get the container logs for containers in a container group. Args: access_token (str): A valid Azure authentication token. subscription_id...
python
def get_container_instance_logs(access_token, subscription_id, resource_group, container_group_name, container_name=None): '''Get the container logs for containers in a container group. Args: access_token (str): A valid Azure authentication token. subscription_id...
Get the container logs for containers in a container group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. container_group_name (str): Name of container instance group. ...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/container.py#L119-L141
gbowerman/azurerm
azurerm/container.py
list_container_instance_groups
def list_container_instance_groups(access_token, subscription_id, resource_group): '''List the container groups in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group nam...
python
def list_container_instance_groups(access_token, subscription_id, resource_group): '''List the container groups in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group nam...
List the container groups in a resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. resource_group (str): Azure resource group name. Returns: HTTP response. JSON list of container groups and their properties...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/container.py#L144-L160
gbowerman/azurerm
azurerm/container.py
list_container_instance_groups_sub
def list_container_instance_groups_sub(access_token, subscription_id): '''List the container groups in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON list of container groups a...
python
def list_container_instance_groups_sub(access_token, subscription_id): '''List the container groups in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON list of container groups a...
List the container groups in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. JSON list of container groups and their properties.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/container.py#L163-L177
gbowerman/azurerm
azurerm/resourcegroups.py
create_resource_group
def create_resource_group(access_token, subscription_id, rgname, location): '''Create a resource group in the specified location. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. ...
python
def create_resource_group(access_token, subscription_id, rgname, location): '''Create a resource group in the specified location. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. ...
Create a resource group in the specified location. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. location (str): Azure data center location. E.g. westus. Returns: HTTP...
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/resourcegroups.py#L7-L25
gbowerman/azurerm
azurerm/resourcegroups.py
delete_resource_group
def delete_resource_group(access_token, subscription_id, rgname): '''Delete the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP response....
python
def delete_resource_group(access_token, subscription_id, rgname): '''Delete the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP response....
Delete the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP response.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/resourcegroups.py#L28-L43
gbowerman/azurerm
azurerm/resourcegroups.py
export_template
def export_template(access_token, subscription_id, rgname): '''Capture the specified resource group as a template Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HT...
python
def export_template(access_token, subscription_id, rgname): '''Capture the specified resource group as a template Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HT...
Capture the specified resource group as a template Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP response. JSON body.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/resourcegroups.py#L46-L64
gbowerman/azurerm
azurerm/resourcegroups.py
get_resource_group
def get_resource_group(access_token, subscription_id, rgname): '''Get details about the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP r...
python
def get_resource_group(access_token, subscription_id, rgname): '''Get details about the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP r...
Get details about the named resource group. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. rgname (str): Azure resource group name. Returns: HTTP response. JSON body.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/resourcegroups.py#L67-L82
gbowerman/azurerm
azurerm/resourcegroups.py
list_resource_groups
def list_resource_groups(access_token, subscription_id): '''List the resource groups in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. ''' endpoint = ''.join([get_rm_endpoin...
python
def list_resource_groups(access_token, subscription_id): '''List the resource groups in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response. ''' endpoint = ''.join([get_rm_endpoin...
List the resource groups in a subscription. Args: access_token (str): A valid Azure authentication token. subscription_id (str): Azure subscription id. Returns: HTTP response.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/resourcegroups.py#L103-L117
gbowerman/azurerm
examples/get_vmss_rolling_cloudshell.py
main
def main(): '''Main routine.''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument( '--vmssname', '-n', required=True, action='store', help='VMSS Name') arg_parser.add_argument('--rgname', '-g', required=True, action='store', ...
python
def main(): '''Main routine.''' # validate command line arguments arg_parser = argparse.ArgumentParser() arg_parser.add_argument( '--vmssname', '-n', required=True, action='store', help='VMSS Name') arg_parser.add_argument('--rgname', '-g', required=True, action='store', ...
Main routine.
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/examples/get_vmss_rolling_cloudshell.py#L9-L39
byteweaver/django-coupons
coupons/south_migrations/0005_coupon_users.py
Migration.forwards
def forwards(self, orm): "Write your forwards methods here." # Note: Don't use "from appname.models import ModelName". # Use orm.ModelName to refer to models in this application, # and orm['appname.ModelName'] for models in other applications. for coupon in orm['coupons.Coupon']...
python
def forwards(self, orm): "Write your forwards methods here." # Note: Don't use "from appname.models import ModelName". # Use orm.ModelName to refer to models in this application, # and orm['appname.ModelName'] for models in other applications. for coupon in orm['coupons.Coupon']...
Write your forwards methods here.
https://github.com/byteweaver/django-coupons/blob/27e15403b6aa99997a9e5239949b4c462c0ed2c2/coupons/south_migrations/0005_coupon_users.py#L9-L20
paylogic/pip-accel
pip_accel/caches/__init__.py
CacheManager.get
def get(self, requirement): """ Get a distribution archive from any of the available caches. :param requirement: A :class:`.Requirement` object. :returns: The absolute pathname of a local file or :data:`None` when the distribution archive is missing from all available ...
python
def get(self, requirement): """ Get a distribution archive from any of the available caches. :param requirement: A :class:`.Requirement` object. :returns: The absolute pathname of a local file or :data:`None` when the distribution archive is missing from all available ...
Get a distribution archive from any of the available caches. :param requirement: A :class:`.Requirement` object. :returns: The absolute pathname of a local file or :data:`None` when the distribution archive is missing from all available caches.
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/caches/__init__.py#L159-L178
paylogic/pip-accel
pip_accel/caches/__init__.py
CacheManager.put
def put(self, requirement, handle): """ Store a distribution archive in all of the available caches. :param requirement: A :class:`.Requirement` object. :param handle: A file-like object that provides access to the distribution archive. """ filenam...
python
def put(self, requirement, handle): """ Store a distribution archive in all of the available caches. :param requirement: A :class:`.Requirement` object. :param handle: A file-like object that provides access to the distribution archive. """ filenam...
Store a distribution archive in all of the available caches. :param requirement: A :class:`.Requirement` object. :param handle: A file-like object that provides access to the distribution archive.
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/caches/__init__.py#L180-L198
paylogic/pip-accel
pip_accel/caches/__init__.py
CacheManager.generate_filename
def generate_filename(self, requirement): """ Generate a distribution archive filename for a package. :param requirement: A :class:`.Requirement` object. :returns: The filename of the distribution archive (a string) including a single leading directory component to ind...
python
def generate_filename(self, requirement): """ Generate a distribution archive filename for a package. :param requirement: A :class:`.Requirement` object. :returns: The filename of the distribution archive (a string) including a single leading directory component to ind...
Generate a distribution archive filename for a package. :param requirement: A :class:`.Requirement` object. :returns: The filename of the distribution archive (a string) including a single leading directory component to indicate the cache format revision.
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/caches/__init__.py#L200-L211
paylogic/pip-accel
pip_accel/deps/__init__.py
SystemPackageManager.install_dependencies
def install_dependencies(self, requirement): """ Install missing dependencies for the given requirement. :param requirement: A :class:`.Requirement` object. :returns: :data:`True` when missing system packages were installed, :data:`False` otherwise. :raises: :e...
python
def install_dependencies(self, requirement): """ Install missing dependencies for the given requirement. :param requirement: A :class:`.Requirement` object. :returns: :data:`True` when missing system packages were installed, :data:`False` otherwise. :raises: :e...
Install missing dependencies for the given requirement. :param requirement: A :class:`.Requirement` object. :returns: :data:`True` when missing system packages were installed, :data:`False` otherwise. :raises: :exc:`.DependencyInstallationRefused` when automatic ...
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/deps/__init__.py#L84-L144
paylogic/pip-accel
pip_accel/deps/__init__.py
SystemPackageManager.find_missing_dependencies
def find_missing_dependencies(self, requirement): """ Find missing dependencies of a Python package. :param requirement: A :class:`.Requirement` object. :returns: A list of strings with system package names. """ known_dependencies = self.find_known_dependencies(requireme...
python
def find_missing_dependencies(self, requirement): """ Find missing dependencies of a Python package. :param requirement: A :class:`.Requirement` object. :returns: A list of strings with system package names. """ known_dependencies = self.find_known_dependencies(requireme...
Find missing dependencies of a Python package. :param requirement: A :class:`.Requirement` object. :returns: A list of strings with system package names.
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/deps/__init__.py#L146-L164
paylogic/pip-accel
pip_accel/deps/__init__.py
SystemPackageManager.find_known_dependencies
def find_known_dependencies(self, requirement): """ Find the known dependencies of a Python package. :param requirement: A :class:`.Requirement` object. :returns: A list of strings with system package names. """ logger.info("Checking for known dependencies of %s ..", req...
python
def find_known_dependencies(self, requirement): """ Find the known dependencies of a Python package. :param requirement: A :class:`.Requirement` object. :returns: A list of strings with system package names. """ logger.info("Checking for known dependencies of %s ..", req...
Find the known dependencies of a Python package. :param requirement: A :class:`.Requirement` object. :returns: A list of strings with system package names.
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/deps/__init__.py#L166-L180
paylogic/pip-accel
pip_accel/deps/__init__.py
SystemPackageManager.find_installed_packages
def find_installed_packages(self): """ Find the installed system packages. :returns: A list of strings with system package names. :raises: :exc:`.SystemDependencyError` when the command to list the installed system packages fails. """ list_command = subp...
python
def find_installed_packages(self): """ Find the installed system packages. :returns: A list of strings with system package names. :raises: :exc:`.SystemDependencyError` when the command to list the installed system packages fails. """ list_command = subp...
Find the installed system packages. :returns: A list of strings with system package names. :raises: :exc:`.SystemDependencyError` when the command to list the installed system packages fails.
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/deps/__init__.py#L182-L197
paylogic/pip-accel
pip_accel/deps/__init__.py
SystemPackageManager.installation_refused
def installation_refused(self, requirement, missing_dependencies, reason): """ Raise :exc:`.DependencyInstallationRefused` with a user friendly message. :param requirement: A :class:`.Requirement` object. :param missing_dependencies: A list of strings with missing dependencies. ...
python
def installation_refused(self, requirement, missing_dependencies, reason): """ Raise :exc:`.DependencyInstallationRefused` with a user friendly message. :param requirement: A :class:`.Requirement` object. :param missing_dependencies: A list of strings with missing dependencies. ...
Raise :exc:`.DependencyInstallationRefused` with a user friendly message. :param requirement: A :class:`.Requirement` object. :param missing_dependencies: A list of strings with missing dependencies. :param reason: The reason why installation was refused (a string).
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/deps/__init__.py#L199-L214
paylogic/pip-accel
pip_accel/deps/__init__.py
SystemPackageManager.confirm_installation
def confirm_installation(self, requirement, missing_dependencies, install_command): """ Ask the operator's permission to install missing system packages. :param requirement: A :class:`.Requirement` object. :param missing_dependencies: A list of strings with missing dependencies. ...
python
def confirm_installation(self, requirement, missing_dependencies, install_command): """ Ask the operator's permission to install missing system packages. :param requirement: A :class:`.Requirement` object. :param missing_dependencies: A list of strings with missing dependencies. ...
Ask the operator's permission to install missing system packages. :param requirement: A :class:`.Requirement` object. :param missing_dependencies: A list of strings with missing dependencies. :param install_command: A list of strings with the command line needed ...
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/deps/__init__.py#L216-L235
paylogic/pip-accel
pip_accel/utils.py
compact
def compact(text, **kw): """ Compact whitespace in a string and format any keyword arguments into the string. :param text: The text to compact (a string). :param kw: Any keyword arguments to apply using :func:`str.format()`. :returns: The compacted, formatted string. The whitespace compaction ...
python
def compact(text, **kw): """ Compact whitespace in a string and format any keyword arguments into the string. :param text: The text to compact (a string). :param kw: Any keyword arguments to apply using :func:`str.format()`. :returns: The compacted, formatted string. The whitespace compaction ...
Compact whitespace in a string and format any keyword arguments into the string. :param text: The text to compact (a string). :param kw: Any keyword arguments to apply using :func:`str.format()`. :returns: The compacted, formatted string. The whitespace compaction preserves paragraphs.
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/utils.py#L41-L51
paylogic/pip-accel
pip_accel/utils.py
expand_path
def expand_path(pathname): """ Expand the home directory in a pathname based on the effective user id. :param pathname: A pathname that may start with ``~/``, indicating the path should be interpreted as being relative to the home directory of the current (effectiv...
python
def expand_path(pathname): """ Expand the home directory in a pathname based on the effective user id. :param pathname: A pathname that may start with ``~/``, indicating the path should be interpreted as being relative to the home directory of the current (effectiv...
Expand the home directory in a pathname based on the effective user id. :param pathname: A pathname that may start with ``~/``, indicating the path should be interpreted as being relative to the home directory of the current (effective) user. :returns: The (modified) p...
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/utils.py#L54-L77
paylogic/pip-accel
pip_accel/utils.py
find_home_directory
def find_home_directory(): """ Look up the home directory of the effective user id. :returns: The pathname of the home directory (a string). .. note:: On Windows this uses the ``%APPDATA%`` environment variable (if available) and otherwise falls back to ``~/Application Data``. """ ...
python
def find_home_directory(): """ Look up the home directory of the effective user id. :returns: The pathname of the home directory (a string). .. note:: On Windows this uses the ``%APPDATA%`` environment variable (if available) and otherwise falls back to ``~/Application Data``. """ ...
Look up the home directory of the effective user id. :returns: The pathname of the home directory (a string). .. note:: On Windows this uses the ``%APPDATA%`` environment variable (if available) and otherwise falls back to ``~/Application Data``.
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/utils.py#L90-L110
paylogic/pip-accel
pip_accel/utils.py
makedirs
def makedirs(path, mode=0o777): """ Create a directory if it doesn't already exist (keeping concurrency in mind). :param path: The pathname of the directory to create (a string). :param mode: The mode to apply to newly created directories (an integer, defaults to the octal number ``077...
python
def makedirs(path, mode=0o777): """ Create a directory if it doesn't already exist (keeping concurrency in mind). :param path: The pathname of the directory to create (a string). :param mode: The mode to apply to newly created directories (an integer, defaults to the octal number ``077...
Create a directory if it doesn't already exist (keeping concurrency in mind). :param path: The pathname of the directory to create (a string). :param mode: The mode to apply to newly created directories (an integer, defaults to the octal number ``0777``). :returns: :data:`True` when the di...
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/utils.py#L141-L162
paylogic/pip-accel
pip_accel/utils.py
same_directories
def same_directories(path1, path2): """ Check if two pathnames refer to the same directory. :param path1: The first pathname (a string). :param path2: The second pathname (a string). :returns: :data:`True` if both pathnames refer to the same directory, :data:`False` otherwise. """...
python
def same_directories(path1, path2): """ Check if two pathnames refer to the same directory. :param path1: The first pathname (a string). :param path2: The second pathname (a string). :returns: :data:`True` if both pathnames refer to the same directory, :data:`False` otherwise. """...
Check if two pathnames refer to the same directory. :param path1: The first pathname (a string). :param path2: The second pathname (a string). :returns: :data:`True` if both pathnames refer to the same directory, :data:`False` otherwise.
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/utils.py#L165-L181
paylogic/pip-accel
pip_accel/utils.py
hash_files
def hash_files(method, *files): """ Calculate the hexadecimal digest of one or more local files. :param method: The hash method (a string, given to :func:`hashlib.new()`). :param files: The pathname(s) of file(s) to hash (zero or more strings). :returns: The calculated hex digest (a string). ""...
python
def hash_files(method, *files): """ Calculate the hexadecimal digest of one or more local files. :param method: The hash method (a string, given to :func:`hashlib.new()`). :param files: The pathname(s) of file(s) to hash (zero or more strings). :returns: The calculated hex digest (a string). ""...
Calculate the hexadecimal digest of one or more local files. :param method: The hash method (a string, given to :func:`hashlib.new()`). :param files: The pathname(s) of file(s) to hash (zero or more strings). :returns: The calculated hex digest (a string).
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/utils.py#L184-L200
paylogic/pip-accel
pip_accel/utils.py
replace_file
def replace_file(src, dst): """ Overwrite a file (in an atomic fashion when possible). :param src: The pathname of the source file (a string). :param dst: The pathname of the destination file (a string). """ # Try os.replace() which was introduced in Python 3.3 # (this should work on POSIX ...
python
def replace_file(src, dst): """ Overwrite a file (in an atomic fashion when possible). :param src: The pathname of the source file (a string). :param dst: The pathname of the destination file (a string). """ # Try os.replace() which was introduced in Python 3.3 # (this should work on POSIX ...
Overwrite a file (in an atomic fashion when possible). :param src: The pathname of the source file (a string). :param dst: The pathname of the destination file (a string).
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/utils.py#L203-L228
paylogic/pip-accel
pip_accel/utils.py
requirement_is_installed
def requirement_is_installed(expr): """ Check whether a requirement is installed. :param expr: A requirement specification similar to those used in pip requirement files (a string). :returns: :data:`True` if the requirement is available (installed), :data:`False` otherwis...
python
def requirement_is_installed(expr): """ Check whether a requirement is installed. :param expr: A requirement specification similar to those used in pip requirement files (a string). :returns: :data:`True` if the requirement is available (installed), :data:`False` otherwis...
Check whether a requirement is installed. :param expr: A requirement specification similar to those used in pip requirement files (a string). :returns: :data:`True` if the requirement is available (installed), :data:`False` otherwise.
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/utils.py#L263-L277
paylogic/pip-accel
pip_accel/utils.py
uninstall
def uninstall(*package_names): """ Uninstall one or more packages using the Python equivalent of ``pip uninstall --yes``. The package(s) to uninstall must be installed, otherwise pip will raise an ``UninstallationError``. You can check for installed packages using :func:`is_installed()`. :para...
python
def uninstall(*package_names): """ Uninstall one or more packages using the Python equivalent of ``pip uninstall --yes``. The package(s) to uninstall must be installed, otherwise pip will raise an ``UninstallationError``. You can check for installed packages using :func:`is_installed()`. :para...
Uninstall one or more packages using the Python equivalent of ``pip uninstall --yes``. The package(s) to uninstall must be installed, otherwise pip will raise an ``UninstallationError``. You can check for installed packages using :func:`is_installed()`. :param package_names: The names of one or more P...
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/utils.py#L290-L302
paylogic/pip-accel
pip_accel/utils.py
match_option
def match_option(argument, short_option, long_option): """ Match a command line argument against a short and long option. :param argument: The command line argument (a string). :param short_option: The short option (a string). :param long_option: The long option (a string). :returns: :data:`Tru...
python
def match_option(argument, short_option, long_option): """ Match a command line argument against a short and long option. :param argument: The command line argument (a string). :param short_option: The short option (a string). :param long_option: The long option (a string). :returns: :data:`Tru...
Match a command line argument against a short and long option. :param argument: The command line argument (a string). :param short_option: The short option (a string). :param long_option: The long option (a string). :returns: :data:`True` if the argument matches, :data:`False` otherwise.
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/utils.py#L305-L314
paylogic/pip-accel
pip_accel/utils.py
match_option_with_value
def match_option_with_value(arguments, option, value): """ Check if a list of command line options contains an option with a value. :param arguments: The command line arguments (a list of strings). :param option: The long option (a string). :param value: The expected value (a string). :returns:...
python
def match_option_with_value(arguments, option, value): """ Check if a list of command line options contains an option with a value. :param arguments: The command line arguments (a list of strings). :param option: The long option (a string). :param value: The expected value (a string). :returns:...
Check if a list of command line options contains an option with a value. :param arguments: The command line arguments (a list of strings). :param option: The long option (a string). :param value: The expected value (a string). :returns: :data:`True` if the command line contains the option/value pair, ...
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/utils.py#L327-L338
paylogic/pip-accel
pip_accel/utils.py
contains_sublist
def contains_sublist(lst, sublst): """ Check if one list contains the items from another list (in the same order). :param lst: The main list. :param sublist: The sublist to check for. :returns: :data:`True` if the main list contains the items from the sublist in the same order, :data:...
python
def contains_sublist(lst, sublst): """ Check if one list contains the items from another list (in the same order). :param lst: The main list. :param sublist: The sublist to check for. :returns: :data:`True` if the main list contains the items from the sublist in the same order, :data:...
Check if one list contains the items from another list (in the same order). :param lst: The main list. :param sublist: The sublist to check for. :returns: :data:`True` if the main list contains the items from the sublist in the same order, :data:`False` otherwise. Based on `this StackOve...
https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/utils.py#L341-L353
eyurtsev/fcsparser
fcsparser/api.py
fromfile
def fromfile(file, dtype, count, *args, **kwargs): """Wrapper around np.fromfile to support any file-like object.""" try: return numpy.fromfile(file, dtype=dtype, count=count, *args, **kwargs) except (TypeError, IOError): return numpy.frombuffer(file.read(count * numpy.dtype(dtype).itemsize)...
python
def fromfile(file, dtype, count, *args, **kwargs): """Wrapper around np.fromfile to support any file-like object.""" try: return numpy.fromfile(file, dtype=dtype, count=count, *args, **kwargs) except (TypeError, IOError): return numpy.frombuffer(file.read(count * numpy.dtype(dtype).itemsize)...
Wrapper around np.fromfile to support any file-like object.
https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L29-L35
eyurtsev/fcsparser
fcsparser/api.py
parse
def parse(path, meta_data_only=False, compensate=False, channel_naming='$PnS', reformat_meta=False, data_set=0, dtype='float32', encoding="utf-8"): """Parse an fcs file at the location specified by the path. Parameters ---------- path: str Path of .fcs file meta_data_only: bool ...
python
def parse(path, meta_data_only=False, compensate=False, channel_naming='$PnS', reformat_meta=False, data_set=0, dtype='float32', encoding="utf-8"): """Parse an fcs file at the location specified by the path. Parameters ---------- path: str Path of .fcs file meta_data_only: bool ...
Parse an fcs file at the location specified by the path. Parameters ---------- path: str Path of .fcs file meta_data_only: bool If True, the parse_fcs only returns the meta_data (the TEXT segment of the FCS file) output_format: 'DataFrame' | 'ndarray' If set to 'DataFrame' t...
https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L499-L573
eyurtsev/fcsparser
fcsparser/api.py
FCSParser.load_file
def load_file(self, file_handle, data_set=0, read_data=True): """Load the requested parts of the file into memory.""" file_handle.seek(0, 2) self._file_size = file_handle.tell() file_handle.seek(0) data_segments = 0 # seek the correct data set in fcs nextdata_offs...
python
def load_file(self, file_handle, data_set=0, read_data=True): """Load the requested parts of the file into memory.""" file_handle.seek(0, 2) self._file_size = file_handle.tell() file_handle.seek(0) data_segments = 0 # seek the correct data set in fcs nextdata_offs...
Load the requested parts of the file into memory.
https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L113-L136
eyurtsev/fcsparser
fcsparser/api.py
FCSParser.from_data
def from_data(cls, data): """Load an FCS file from a bytes-like object. Args: data: buffer containing contents of an FCS file. Returns: FCSParser instance with data loaded """ obj = cls() with contextlib.closing(BytesIO(data)) as file_handle: ...
python
def from_data(cls, data): """Load an FCS file from a bytes-like object. Args: data: buffer containing contents of an FCS file. Returns: FCSParser instance with data loaded """ obj = cls() with contextlib.closing(BytesIO(data)) as file_handle: ...
Load an FCS file from a bytes-like object. Args: data: buffer containing contents of an FCS file. Returns: FCSParser instance with data loaded
https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L139-L151
eyurtsev/fcsparser
fcsparser/api.py
FCSParser.read_header
def read_header(self, file_handle, nextdata_offset=0): """Read the header of the FCS file. The header specifies where the annotation, data and analysis are located inside the binary file. Args: file_handle: buffer containing FCS file. nextdata_offset: byte offse...
python
def read_header(self, file_handle, nextdata_offset=0): """Read the header of the FCS file. The header specifies where the annotation, data and analysis are located inside the binary file. Args: file_handle: buffer containing FCS file. nextdata_offset: byte offse...
Read the header of the FCS file. The header specifies where the annotation, data and analysis are located inside the binary file. Args: file_handle: buffer containing FCS file. nextdata_offset: byte offset of a set header from file start specified by $NEXTDATA
https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L153-L195
eyurtsev/fcsparser
fcsparser/api.py
FCSParser._extract_text_dict
def _extract_text_dict(self, raw_text): """Parse the TEXT segment of the FCS file into a python dictionary.""" delimiter = raw_text[0] if raw_text[-1] != delimiter: raw_text = raw_text.strip() if raw_text[-1] != delimiter: msg = (u'The first two character...
python
def _extract_text_dict(self, raw_text): """Parse the TEXT segment of the FCS file into a python dictionary.""" delimiter = raw_text[0] if raw_text[-1] != delimiter: raw_text = raw_text.strip() if raw_text[-1] != delimiter: msg = (u'The first two character...
Parse the TEXT segment of the FCS file into a python dictionary.
https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L197-L224
eyurtsev/fcsparser
fcsparser/api.py
FCSParser.read_text
def read_text(self, file_handle): """Parse the TEXT segment of the FCS file. The TEXT segment contains meta data associated with the FCS file. Converting all meta keywords to lower case. """ header = self.annotation['__header__'] # For convenience ##### # Read ...
python
def read_text(self, file_handle): """Parse the TEXT segment of the FCS file. The TEXT segment contains meta data associated with the FCS file. Converting all meta keywords to lower case. """ header = self.annotation['__header__'] # For convenience ##### # Read ...
Parse the TEXT segment of the FCS file. The TEXT segment contains meta data associated with the FCS file. Converting all meta keywords to lower case.
https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L226-L293
eyurtsev/fcsparser
fcsparser/api.py
FCSParser.read_analysis
def read_analysis(self, file_handle): """Read the ANALYSIS segment of the FCS file and store it in self.analysis. Warning: This has never been tested with an actual fcs file that contains an analysis segment. Args: file_handle: buffer containing FCS data """ ...
python
def read_analysis(self, file_handle): """Read the ANALYSIS segment of the FCS file and store it in self.analysis. Warning: This has never been tested with an actual fcs file that contains an analysis segment. Args: file_handle: buffer containing FCS data """ ...
Read the ANALYSIS segment of the FCS file and store it in self.analysis. Warning: This has never been tested with an actual fcs file that contains an analysis segment. Args: file_handle: buffer containing FCS data
https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L295-L310
eyurtsev/fcsparser
fcsparser/api.py
FCSParser._verify_assumptions
def _verify_assumptions(self): """Verify that all assumptions made by the parser hold.""" text = self.annotation keys = text.keys() if '$MODE' not in text or text['$MODE'] != 'L': raise ParserFeatureNotImplementedError(u'Mode not implemented') if '$P0B' in keys: ...
python
def _verify_assumptions(self): """Verify that all assumptions made by the parser hold.""" text = self.annotation keys = text.keys() if '$MODE' not in text or text['$MODE'] != 'L': raise ParserFeatureNotImplementedError(u'Mode not implemented') if '$P0B' in keys: ...
Verify that all assumptions made by the parser hold.
https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L312-L325
eyurtsev/fcsparser
fcsparser/api.py
FCSParser.get_channel_names
def get_channel_names(self): """Get list of channel names. Raises a warning if the names are not unique.""" names_s, names_n = self.channel_names_s, self.channel_names_n # Figure out which channel names to use if self._channel_naming == '$PnS': channel_names, channel_names_a...
python
def get_channel_names(self): """Get list of channel names. Raises a warning if the names are not unique.""" names_s, names_n = self.channel_names_s, self.channel_names_n # Figure out which channel names to use if self._channel_naming == '$PnS': channel_names, channel_names_a...
Get list of channel names. Raises a warning if the names are not unique.
https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L327-L353
eyurtsev/fcsparser
fcsparser/api.py
FCSParser.read_data
def read_data(self, file_handle): """Read the DATA segment of the FCS file.""" self._verify_assumptions() text = self.annotation if (self._data_start > self._file_size) or (self._data_end > self._file_size): raise ValueError(u'The FCS file "{}" is corrupted. Part of the data...
python
def read_data(self, file_handle): """Read the DATA segment of the FCS file.""" self._verify_assumptions() text = self.annotation if (self._data_start > self._file_size) or (self._data_end > self._file_size): raise ValueError(u'The FCS file "{}" is corrupted. Part of the data...
Read the DATA segment of the FCS file.
https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L355-L433