partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
WeatherForecast.get_weather_forecast_days
Return the weather forecast for a given location. :: results = ws.get_weather_forecast_days(lat, long) for w in results['hits']: print w['start_datetime_local'] print w['reading_type'], w['reading_value'] For description of reading types: ...
predix/data/weather.py
def get_weather_forecast_days(self, latitude, longitude, days=1, frequency=1, reading_type=None): """ Return the weather forecast for a given location. :: results = ws.get_weather_forecast_days(lat, long) for w in results['hits']: print w['st...
def get_weather_forecast_days(self, latitude, longitude, days=1, frequency=1, reading_type=None): """ Return the weather forecast for a given location. :: results = ws.get_weather_forecast_days(lat, long) for w in results['hits']: print w['st...
[ "Return", "the", "weather", "forecast", "for", "a", "given", "location", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/weather.py#L36-L70
[ "def", "get_weather_forecast_days", "(", "self", ",", "latitude", ",", "longitude", ",", "days", "=", "1", ",", "frequency", "=", "1", ",", "reading_type", "=", "None", ")", ":", "params", "=", "{", "}", "# Can get data from NWS1 or NWS3 representing 1-hr and 3-hr...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
WeatherForecast.get_weather_forecast
Return the weather forecast for a given location for specific datetime specified in UTC format. :: results = ws.get_weather_forecast(lat, long, start, end) for w in results['hits']: print w['start_datetime_local'] print w['reading_type'], '=', w[...
predix/data/weather.py
def get_weather_forecast(self, latitude, longitude, start, end, frequency=1, reading_type=None): """ Return the weather forecast for a given location for specific datetime specified in UTC format. :: results = ws.get_weather_forecast(lat, long, start, end) ...
def get_weather_forecast(self, latitude, longitude, start, end, frequency=1, reading_type=None): """ Return the weather forecast for a given location for specific datetime specified in UTC format. :: results = ws.get_weather_forecast(lat, long, start, end) ...
[ "Return", "the", "weather", "forecast", "for", "a", "given", "location", "for", "specific", "datetime", "specified", "in", "UTC", "format", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/weather.py#L72-L108
[ "def", "get_weather_forecast", "(", "self", ",", "latitude", ",", "longitude", ",", "start", ",", "end", ",", "frequency", "=", "1", ",", "reading_type", "=", "None", ")", ":", "params", "=", "{", "}", "# Can get data from NWS1 or NWS3 representing 1-hr and 3-hr",...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
CloudFoundryService._generate_name
Can generate a name based on the space, service name and plan.
predix/admin/service.py
def _generate_name(self, space, service_name, plan_name): """ Can generate a name based on the space, service name and plan. """ return str.join('-', [space, service_name, plan_name]).lower()
def _generate_name(self, space, service_name, plan_name): """ Can generate a name based on the space, service name and plan. """ return str.join('-', [space, service_name, plan_name]).lower()
[ "Can", "generate", "a", "name", "based", "on", "the", "space", "service", "name", "and", "plan", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/service.py#L30-L34
[ "def", "_generate_name", "(", "self", ",", "space", ",", "service_name", ",", "plan_name", ")", ":", "return", "str", ".", "join", "(", "'-'", ",", "[", "space", ",", "service_name", ",", "plan_name", "]", ")", ".", "lower", "(", ")" ]
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
CloudFoundryService._get_config_path
Return a sensible configuration path for caching config settings.
predix/admin/service.py
def _get_config_path(self): """ Return a sensible configuration path for caching config settings. """ org = self.service.space.org.name space = self.service.space.name name = self.name return "~/.predix/%s/%s/%s.json" % (org, space, name)
def _get_config_path(self): """ Return a sensible configuration path for caching config settings. """ org = self.service.space.org.name space = self.service.space.name name = self.name return "~/.predix/%s/%s/%s.json" % (org, space, name)
[ "Return", "a", "sensible", "configuration", "path", "for", "caching", "config", "settings", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/service.py#L36-L45
[ "def", "_get_config_path", "(", "self", ")", ":", "org", "=", "self", ".", "service", ".", "space", ".", "org", ".", "name", "space", "=", "self", ".", "service", ".", "space", ".", "name", "name", "=", "self", ".", "name", "return", "\"~/.predix/%s/%s...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
CloudFoundryService._create_service
Create a Cloud Foundry service that has custom parameters.
predix/admin/service.py
def _create_service(self, parameters={}, **kwargs): """ Create a Cloud Foundry service that has custom parameters. """ logging.debug("_create_service()") logging.debug(str.join(',', [self.service_name, self.plan_name, self.name, str(parameters)])) return self...
def _create_service(self, parameters={}, **kwargs): """ Create a Cloud Foundry service that has custom parameters. """ logging.debug("_create_service()") logging.debug(str.join(',', [self.service_name, self.plan_name, self.name, str(parameters)])) return self...
[ "Create", "a", "Cloud", "Foundry", "service", "that", "has", "custom", "parameters", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/service.py#L47-L56
[ "def", "_create_service", "(", "self", ",", "parameters", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "logging", ".", "debug", "(", "\"_create_service()\"", ")", "logging", ".", "debug", "(", "str", ".", "join", "(", "','", ",", "[", "self", "....
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
CloudFoundryService._delete_service
Delete a Cloud Foundry service and any associations.
predix/admin/service.py
def _delete_service(self, service_only=False): """ Delete a Cloud Foundry service and any associations. """ logging.debug('_delete_service()') return self.service.delete_service(self.service_name)
def _delete_service(self, service_only=False): """ Delete a Cloud Foundry service and any associations. """ logging.debug('_delete_service()') return self.service.delete_service(self.service_name)
[ "Delete", "a", "Cloud", "Foundry", "service", "and", "any", "associations", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/service.py#L58-L63
[ "def", "_delete_service", "(", "self", ",", "service_only", "=", "False", ")", ":", "logging", ".", "debug", "(", "'_delete_service()'", ")", "return", "self", ".", "service", ".", "delete_service", "(", "self", ".", "service_name", ")" ]
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
CloudFoundryService._get_or_create_service_key
Get a service key or create one if needed.
predix/admin/service.py
def _get_or_create_service_key(self): """ Get a service key or create one if needed. """ keys = self.service._get_service_keys(self.name) for key in keys['resources']: if key['entity']['name'] == self.service_name: return self.service.get_service_key(s...
def _get_or_create_service_key(self): """ Get a service key or create one if needed. """ keys = self.service._get_service_keys(self.name) for key in keys['resources']: if key['entity']['name'] == self.service_name: return self.service.get_service_key(s...
[ "Get", "a", "service", "key", "or", "create", "one", "if", "needed", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/service.py#L65-L76
[ "def", "_get_or_create_service_key", "(", "self", ")", ":", "keys", "=", "self", ".", "service", ".", "_get_service_keys", "(", "self", ".", "name", ")", "for", "key", "in", "keys", "[", "'resources'", "]", ":", "if", "key", "[", "'entity'", "]", "[", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
CloudFoundryService._get_service_config
Will get configuration for the service from a service key.
predix/admin/service.py
def _get_service_config(self): """ Will get configuration for the service from a service key. """ key = self._get_or_create_service_key() config = {} config['service_key'] = [{'name': self.name}] config.update(key['entity']['credentials']) return config
def _get_service_config(self): """ Will get configuration for the service from a service key. """ key = self._get_or_create_service_key() config = {} config['service_key'] = [{'name': self.name}] config.update(key['entity']['credentials']) return config
[ "Will", "get", "configuration", "for", "the", "service", "from", "a", "service", "key", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/service.py#L78-L88
[ "def", "_get_service_config", "(", "self", ")", ":", "key", "=", "self", ".", "_get_or_create_service_key", "(", ")", "config", "=", "{", "}", "config", "[", "'service_key'", "]", "=", "[", "{", "'name'", ":", "self", ".", "name", "}", "]", "config", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
CloudFoundryService.create
Create the service.
predix/admin/service.py
def create(self, parameters={}, create_keys=True, **kwargs): """ Create the service. """ # Create the service cs = self._create_service(parameters=parameters, **kwargs) # Create the service key to get config details and # store in local cache file. if cre...
def create(self, parameters={}, create_keys=True, **kwargs): """ Create the service. """ # Create the service cs = self._create_service(parameters=parameters, **kwargs) # Create the service key to get config details and # store in local cache file. if cre...
[ "Create", "the", "service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/service.py#L96-L108
[ "def", "create", "(", "self", ",", "parameters", "=", "{", "}", ",", "create_keys", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# Create the service", "cs", "=", "self", ".", "_create_service", "(", "parameters", "=", "parameters", ",", "*", "*", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
PredixService._get_or_create_uaa
Returns a valid UAA instance for performing administrative functions on services.
predix/admin/service.py
def _get_or_create_uaa(self, uaa): """ Returns a valid UAA instance for performing administrative functions on services. """ if isinstance(uaa, predix.admin.uaa.UserAccountAuthentication): return uaa logging.debug("Initializing a new UAA") return pred...
def _get_or_create_uaa(self, uaa): """ Returns a valid UAA instance for performing administrative functions on services. """ if isinstance(uaa, predix.admin.uaa.UserAccountAuthentication): return uaa logging.debug("Initializing a new UAA") return pred...
[ "Returns", "a", "valid", "UAA", "instance", "for", "performing", "administrative", "functions", "on", "services", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/service.py#L124-L133
[ "def", "_get_or_create_uaa", "(", "self", ",", "uaa", ")", ":", "if", "isinstance", "(", "uaa", ",", "predix", ".", "admin", ".", "uaa", ".", "UserAccountAuthentication", ")", ":", "return", "uaa", "logging", ".", "debug", "(", "\"Initializing a new UAA\"", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
PredixService.create
Create an instance of the US Weather Forecast Service with typical starting settings.
predix/admin/service.py
def create(self, parameters={}, **kwargs): """ Create an instance of the US Weather Forecast Service with typical starting settings. """ # Add parameter during create for UAA issuer uri = self.uaa.service.settings.data['uri'] + '/oauth/token' parameters["trustedIs...
def create(self, parameters={}, **kwargs): """ Create an instance of the US Weather Forecast Service with typical starting settings. """ # Add parameter during create for UAA issuer uri = self.uaa.service.settings.data['uri'] + '/oauth/token' parameters["trustedIs...
[ "Create", "an", "instance", "of", "the", "US", "Weather", "Forecast", "Service", "with", "typical", "starting", "settings", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/service.py#L135-L143
[ "def", "create", "(", "self", ",", "parameters", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "# Add parameter during create for UAA issuer", "uri", "=", "self", ".", "uaa", ".", "service", ".", "settings", ".", "data", "[", "'uri'", "]", "+", "'/oa...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
EventHub.create
Create an instance of the Time Series Service with the typical starting settings.
predix/admin/eventhub.py
def create(self): """ Create an instance of the Time Series Service with the typical starting settings. """ self.service.create() os.environ[predix.config.get_env_key(self.use_class, 'host')] = self.get_eventhub_host() os.environ[predix.config.get_env_key(self.us...
def create(self): """ Create an instance of the Time Series Service with the typical starting settings. """ self.service.create() os.environ[predix.config.get_env_key(self.use_class, 'host')] = self.get_eventhub_host() os.environ[predix.config.get_env_key(self.us...
[ "Create", "an", "instance", "of", "the", "Time", "Series", "Service", "with", "the", "typical", "starting", "settings", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/eventhub.py#L28-L38
[ "def", "create", "(", "self", ")", ":", "self", ".", "service", ".", "create", "(", ")", "os", ".", "environ", "[", "predix", ".", "config", ".", "get_env_key", "(", "self", ".", "use_class", ",", "'host'", ")", "]", "=", "self", ".", "get_eventhub_h...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
EventHub.grant_client
Grant the given client id all the scopes and authorities needed to work with the eventhub service.
predix/admin/eventhub.py
def grant_client(self, client_id, publish=False, subscribe=False, publish_protocol=None, publish_topics=None, subscribe_topics=None, scope_prefix='predix-event-hub', **kwargs): """ Grant the given client id all the scopes and authorities needed to work with the eventhub serv...
def grant_client(self, client_id, publish=False, subscribe=False, publish_protocol=None, publish_topics=None, subscribe_topics=None, scope_prefix='predix-event-hub', **kwargs): """ Grant the given client id all the scopes and authorities needed to work with the eventhub serv...
[ "Grant", "the", "given", "client", "id", "all", "the", "scopes", "and", "authorities", "needed", "to", "work", "with", "the", "eventhub", "service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/eventhub.py#L40-L100
[ "def", "grant_client", "(", "self", ",", "client_id", ",", "publish", "=", "False", ",", "subscribe", "=", "False", ",", "publish_protocol", "=", "None", ",", "publish_topics", "=", "None", ",", "subscribe_topics", "=", "None", ",", "scope_prefix", "=", "'pr...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
EventHub.get_eventhub_host
returns the publish grpc endpoint for ingestion.
predix/admin/eventhub.py
def get_eventhub_host(self): """ returns the publish grpc endpoint for ingestion. """ for protocol in self.service.settings.data['publish']['protocol_details']: if protocol['protocol'] == 'grpc': return protocol['uri'][0:protocol['uri'].index(':')]
def get_eventhub_host(self): """ returns the publish grpc endpoint for ingestion. """ for protocol in self.service.settings.data['publish']['protocol_details']: if protocol['protocol'] == 'grpc': return protocol['uri'][0:protocol['uri'].index(':')]
[ "returns", "the", "publish", "grpc", "endpoint", "for", "ingestion", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/eventhub.py#L102-L108
[ "def", "get_eventhub_host", "(", "self", ")", ":", "for", "protocol", "in", "self", ".", "service", ".", "settings", ".", "data", "[", "'publish'", "]", "[", "'protocol_details'", "]", ":", "if", "protocol", "[", "'protocol'", "]", "==", "'grpc'", ":", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
EventHub.add_to_manifest
Add useful details to the manifest about this service so that it can be used in an application. :param manifest: An predix.admin.app.Manifest object instance that manages reading/writing manifest config for a cloud foundry app.
predix/admin/eventhub.py
def add_to_manifest(self, manifest): """ Add useful details to the manifest about this service so that it can be used in an application. :param manifest: An predix.admin.app.Manifest object instance that manages reading/writing manifest config for a cloud foundry...
def add_to_manifest(self, manifest): """ Add useful details to the manifest about this service so that it can be used in an application. :param manifest: An predix.admin.app.Manifest object instance that manages reading/writing manifest config for a cloud foundry...
[ "Add", "useful", "details", "to", "the", "manifest", "about", "this", "service", "so", "that", "it", "can", "be", "used", "in", "an", "application", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/eventhub.py#L133-L151
[ "def", "add_to_manifest", "(", "self", ",", "manifest", ")", ":", "# Add this service to list of services", "manifest", ".", "add_service", "(", "self", ".", "service", ".", "name", ")", "# Add environment variables", "manifest", ".", "add_env_var", "(", "predix", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
BlobStore._get_host
Returns the host address for an instance of Blob Store service from environment inspection.
predix/data/blobstore.py
def _get_host(self): """ Returns the host address for an instance of Blob Store service from environment inspection. """ if 'VCAP_SERVICES' in os.environ: services = json.loads(os.getenv('VCAP_SERVICES')) host = services['predix-blobstore'][0]['credentials...
def _get_host(self): """ Returns the host address for an instance of Blob Store service from environment inspection. """ if 'VCAP_SERVICES' in os.environ: services = json.loads(os.getenv('VCAP_SERVICES')) host = services['predix-blobstore'][0]['credentials...
[ "Returns", "the", "host", "address", "for", "an", "instance", "of", "Blob", "Store", "service", "from", "environment", "inspection", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/blobstore.py#L50-L65
[ "def", "_get_host", "(", "self", ")", ":", "if", "'VCAP_SERVICES'", "in", "os", ".", "environ", ":", "services", "=", "json", ".", "loads", "(", "os", ".", "getenv", "(", "'VCAP_SERVICES'", ")", ")", "host", "=", "services", "[", "'predix-blobstore'", "]...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
BlobStore._get_access_key_id
Returns the access key for an instance of Blob Store service from environment inspection.
predix/data/blobstore.py
def _get_access_key_id(self): """ Returns the access key for an instance of Blob Store service from environment inspection. """ if 'VCAP_SERVICES' in os.environ: services = json.loads(os.getenv('VCAP_SERVICES')) return services['predix-blobstore'][0]['cred...
def _get_access_key_id(self): """ Returns the access key for an instance of Blob Store service from environment inspection. """ if 'VCAP_SERVICES' in os.environ: services = json.loads(os.getenv('VCAP_SERVICES')) return services['predix-blobstore'][0]['cred...
[ "Returns", "the", "access", "key", "for", "an", "instance", "of", "Blob", "Store", "service", "from", "environment", "inspection", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/blobstore.py#L67-L76
[ "def", "_get_access_key_id", "(", "self", ")", ":", "if", "'VCAP_SERVICES'", "in", "os", ".", "environ", ":", "services", "=", "json", ".", "loads", "(", "os", ".", "getenv", "(", "'VCAP_SERVICES'", ")", ")", "return", "services", "[", "'predix-blobstore'", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
BlobStore.list_objects
This method is primarily for illustration and just calls the boto3 client implementation of list_objects but is a common task for first time Predix BlobStore users.
predix/data/blobstore.py
def list_objects(self, bucket_name=None, **kwargs): """ This method is primarily for illustration and just calls the boto3 client implementation of list_objects but is a common task for first time Predix BlobStore users. """ if not bucket_name: bucket_name = self.bucket_...
def list_objects(self, bucket_name=None, **kwargs): """ This method is primarily for illustration and just calls the boto3 client implementation of list_objects but is a common task for first time Predix BlobStore users. """ if not bucket_name: bucket_name = self.bucket_...
[ "This", "method", "is", "primarily", "for", "illustration", "and", "just", "calls", "the", "boto3", "client", "implementation", "of", "list_objects", "but", "is", "a", "common", "task", "for", "first", "time", "Predix", "BlobStore", "users", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/blobstore.py#L108-L115
[ "def", "list_objects", "(", "self", ",", "bucket_name", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "bucket_name", ":", "bucket_name", "=", "self", ".", "bucket_name", "return", "self", ".", "client", ".", "list_objects", "(", "Bucket", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
BlobStore.upload_file
This method is primarily for illustration and just calls the boto3 client implementation of upload_file but is a common task for first time Predix BlobStore users.
predix/data/blobstore.py
def upload_file(self, src_filepath, dest_filename=None, bucket_name=None, **kwargs): """ This method is primarily for illustration and just calls the boto3 client implementation of upload_file but is a common task for first time Predix BlobStore users. """ if...
def upload_file(self, src_filepath, dest_filename=None, bucket_name=None, **kwargs): """ This method is primarily for illustration and just calls the boto3 client implementation of upload_file but is a common task for first time Predix BlobStore users. """ if...
[ "This", "method", "is", "primarily", "for", "illustration", "and", "just", "calls", "the", "boto3", "client", "implementation", "of", "upload_file", "but", "is", "a", "common", "task", "for", "first", "time", "Predix", "BlobStore", "users", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/blobstore.py#L117-L127
[ "def", "upload_file", "(", "self", ",", "src_filepath", ",", "dest_filename", "=", "None", ",", "bucket_name", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "bucket_name", ":", "bucket_name", "=", "self", ".", "bucket_name", "if", "not", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Config._get_cloud_foundry_config
Reads the local cf CLI cache stored in the users home directory.
predix/admin/cf/config.py
def _get_cloud_foundry_config(self): """ Reads the local cf CLI cache stored in the users home directory. """ config = os.path.expanduser(self.config_file) if not os.path.exists(config): raise CloudFoundryLoginError('You must run `cf login` to authenticate') ...
def _get_cloud_foundry_config(self): """ Reads the local cf CLI cache stored in the users home directory. """ config = os.path.expanduser(self.config_file) if not os.path.exists(config): raise CloudFoundryLoginError('You must run `cf login` to authenticate') ...
[ "Reads", "the", "local", "cf", "CLI", "cache", "stored", "in", "the", "users", "home", "directory", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/config.py#L28-L38
[ "def", "_get_cloud_foundry_config", "(", "self", ")", ":", "config", "=", "os", ".", "path", ".", "expanduser", "(", "self", ".", "config_file", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "config", ")", ":", "raise", "CloudFoundryLoginError",...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Config.get_organization_guid
Returns the GUID for the organization currently targeted.
predix/admin/cf/config.py
def get_organization_guid(self): """ Returns the GUID for the organization currently targeted. """ if 'PREDIX_ORGANIZATION_GUID' in os.environ: return os.environ['PREDIX_ORGANIZATION_GUID'] else: info = self._get_organization_info() for key in ...
def get_organization_guid(self): """ Returns the GUID for the organization currently targeted. """ if 'PREDIX_ORGANIZATION_GUID' in os.environ: return os.environ['PREDIX_ORGANIZATION_GUID'] else: info = self._get_organization_info() for key in ...
[ "Returns", "the", "GUID", "for", "the", "organization", "currently", "targeted", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/config.py#L75-L86
[ "def", "get_organization_guid", "(", "self", ")", ":", "if", "'PREDIX_ORGANIZATION_GUID'", "in", "os", ".", "environ", ":", "return", "os", ".", "environ", "[", "'PREDIX_ORGANIZATION_GUID'", "]", "else", ":", "info", "=", "self", ".", "_get_organization_info", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Config.get_space_guid
Returns the GUID for the space currently targeted. Can be set by environment variable with PREDIX_SPACE_GUID. Can be determined by ~/.cf/config.json.
predix/admin/cf/config.py
def get_space_guid(self): """ Returns the GUID for the space currently targeted. Can be set by environment variable with PREDIX_SPACE_GUID. Can be determined by ~/.cf/config.json. """ if 'PREDIX_SPACE_GUID' in os.environ: return os.environ['PREDIX_SPACE_GUID'...
def get_space_guid(self): """ Returns the GUID for the space currently targeted. Can be set by environment variable with PREDIX_SPACE_GUID. Can be determined by ~/.cf/config.json. """ if 'PREDIX_SPACE_GUID' in os.environ: return os.environ['PREDIX_SPACE_GUID'...
[ "Returns", "the", "GUID", "for", "the", "space", "currently", "targeted", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/config.py#L103-L117
[ "def", "get_space_guid", "(", "self", ")", ":", "if", "'PREDIX_SPACE_GUID'", "in", "os", ".", "environ", ":", "return", "os", ".", "environ", "[", "'PREDIX_SPACE_GUID'", "]", "else", ":", "info", "=", "self", ".", "_get_space_info", "(", ")", "for", "key",...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
get_crypt_key
Get the user's PredixPy manifest key. Generate and store one if not yet generated.
predix/config.py
def get_crypt_key(key_path): """ Get the user's PredixPy manifest key. Generate and store one if not yet generated. """ key_path = os.path.expanduser(key_path) if os.path.exists(key_path): with open(key_path, 'r') as data: key = data.read() else: key = Fernet.gen...
def get_crypt_key(key_path): """ Get the user's PredixPy manifest key. Generate and store one if not yet generated. """ key_path = os.path.expanduser(key_path) if os.path.exists(key_path): with open(key_path, 'r') as data: key = data.read() else: key = Fernet.gen...
[ "Get", "the", "user", "s", "PredixPy", "manifest", "key", ".", "Generate", "and", "store", "one", "if", "not", "yet", "generated", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/config.py#L12-L26
[ "def", "get_crypt_key", "(", "key_path", ")", ":", "key_path", "=", "os", ".", "path", ".", "expanduser", "(", "key_path", ")", "if", "os", ".", "path", ".", "exists", "(", "key_path", ")", ":", "with", "open", "(", "key_path", ",", "'r'", ")", "as",...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
get_env_key
Return environment variable key to use for lookups within a namespace represented by the package name. For example, any varialbes for predix.security.uaa are stored as PREDIX_SECURITY_UAA_KEY
predix/config.py
def get_env_key(obj, key=None): """ Return environment variable key to use for lookups within a namespace represented by the package name. For example, any varialbes for predix.security.uaa are stored as PREDIX_SECURITY_UAA_KEY """ return str.join('_', [obj.__module__.replace('.','_').upper...
def get_env_key(obj, key=None): """ Return environment variable key to use for lookups within a namespace represented by the package name. For example, any varialbes for predix.security.uaa are stored as PREDIX_SECURITY_UAA_KEY """ return str.join('_', [obj.__module__.replace('.','_').upper...
[ "Return", "environment", "variable", "key", "to", "use", "for", "lookups", "within", "a", "namespace", "represented", "by", "the", "package", "name", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/config.py#L28-L37
[ "def", "get_env_key", "(", "obj", ",", "key", "=", "None", ")", ":", "return", "str", ".", "join", "(", "'_'", ",", "[", "obj", ".", "__module__", ".", "replace", "(", "'.'", ",", "'_'", ")", ".", "upper", "(", ")", ",", "key", ".", "upper", "(...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
get_env_value
Returns the environment variable value for the attribute of the given object. For example `get_env_value(predix.security.uaa, 'uri')` will return value of environment variable PREDIX_SECURITY_UAA_URI.
predix/config.py
def get_env_value(obj, attribute): """ Returns the environment variable value for the attribute of the given object. For example `get_env_value(predix.security.uaa, 'uri')` will return value of environment variable PREDIX_SECURITY_UAA_URI. """ varname = get_env_key(obj, attribute) var ...
def get_env_value(obj, attribute): """ Returns the environment variable value for the attribute of the given object. For example `get_env_value(predix.security.uaa, 'uri')` will return value of environment variable PREDIX_SECURITY_UAA_URI. """ varname = get_env_key(obj, attribute) var ...
[ "Returns", "the", "environment", "variable", "value", "for", "the", "attribute", "of", "the", "given", "object", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/config.py#L39-L53
[ "def", "get_env_value", "(", "obj", ",", "attribute", ")", ":", "varname", "=", "get_env_key", "(", "obj", ",", "attribute", ")", "var", "=", "os", ".", "environ", ".", "get", "(", "varname", ")", "if", "not", "var", ":", "raise", "ValueError", "(", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
set_env_value
Set the environment variable value for the attribute of the given object. For example, `set_env_value(predix.security.uaa, 'uri', 'http://...')` will set the environment variable PREDIX_SECURITY_UAA_URI to the given uri.
predix/config.py
def set_env_value(obj, attribute, value): """ Set the environment variable value for the attribute of the given object. For example, `set_env_value(predix.security.uaa, 'uri', 'http://...')` will set the environment variable PREDIX_SECURITY_UAA_URI to the given uri. """ varname = get_en...
def set_env_value(obj, attribute, value): """ Set the environment variable value for the attribute of the given object. For example, `set_env_value(predix.security.uaa, 'uri', 'http://...')` will set the environment variable PREDIX_SECURITY_UAA_URI to the given uri. """ varname = get_en...
[ "Set", "the", "environment", "variable", "value", "for", "the", "attribute", "of", "the", "given", "object", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/config.py#L55-L66
[ "def", "set_env_value", "(", "obj", ",", "attribute", ",", "value", ")", ":", "varname", "=", "get_env_key", "(", "obj", ",", "attribute", ")", "os", ".", "environ", "[", "varname", "]", "=", "value", "return", "varname" ]
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service.get_instance_guid
Returns the GUID for the service instance with the given name.
predix/admin/cf/services.py
def get_instance_guid(self, service_name): """ Returns the GUID for the service instance with the given name. """ summary = self.space.get_space_summary() for service in summary['services']: if service['name'] == service_name: return service['g...
def get_instance_guid(self, service_name): """ Returns the GUID for the service instance with the given name. """ summary = self.space.get_space_summary() for service in summary['services']: if service['name'] == service_name: return service['g...
[ "Returns", "the", "GUID", "for", "the", "service", "instance", "with", "the", "given", "name", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L31-L41
[ "def", "get_instance_guid", "(", "self", ",", "service_name", ")", ":", "summary", "=", "self", ".", "space", ".", "get_space_summary", "(", ")", "for", "service", "in", "summary", "[", "'services'", "]", ":", "if", "service", "[", "'name'", "]", "==", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service._get_service_bindings
Return the service bindings for the service instance.
predix/admin/cf/services.py
def _get_service_bindings(self, service_name): """ Return the service bindings for the service instance. """ instance = self.get_instance(service_name) return self.api.get(instance['service_bindings_url'])
def _get_service_bindings(self, service_name): """ Return the service bindings for the service instance. """ instance = self.get_instance(service_name) return self.api.get(instance['service_bindings_url'])
[ "Return", "the", "service", "bindings", "for", "the", "service", "instance", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L43-L48
[ "def", "_get_service_bindings", "(", "self", ",", "service_name", ")", ":", "instance", "=", "self", ".", "get_instance", "(", "service_name", ")", "return", "self", ".", "api", ".", "get", "(", "instance", "[", "'service_bindings_url'", "]", ")" ]
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service.delete_service_bindings
Remove service bindings to applications.
predix/admin/cf/services.py
def delete_service_bindings(self, service_name): """ Remove service bindings to applications. """ instance = self.get_instance(service_name) return self.api.delete(instance['service_bindings_url'])
def delete_service_bindings(self, service_name): """ Remove service bindings to applications. """ instance = self.get_instance(service_name) return self.api.delete(instance['service_bindings_url'])
[ "Remove", "service", "bindings", "to", "applications", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L50-L55
[ "def", "delete_service_bindings", "(", "self", ",", "service_name", ")", ":", "instance", "=", "self", ".", "get_instance", "(", "service_name", ")", "return", "self", ".", "api", ".", "delete", "(", "instance", "[", "'service_bindings_url'", "]", ")" ]
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service._get_service_keys
Return the service keys for the given service.
predix/admin/cf/services.py
def _get_service_keys(self, service_name): """ Return the service keys for the given service. """ guid = self.get_instance_guid(service_name) uri = "/v2/service_instances/%s/service_keys" % (guid) return self.api.get(uri)
def _get_service_keys(self, service_name): """ Return the service keys for the given service. """ guid = self.get_instance_guid(service_name) uri = "/v2/service_instances/%s/service_keys" % (guid) return self.api.get(uri)
[ "Return", "the", "service", "keys", "for", "the", "given", "service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L57-L63
[ "def", "_get_service_keys", "(", "self", ",", "service_name", ")", ":", "guid", "=", "self", ".", "get_instance_guid", "(", "service_name", ")", "uri", "=", "\"/v2/service_instances/%s/service_keys\"", "%", "(", "guid", ")", "return", "self", ".", "api", ".", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service.get_service_keys
Returns a flat list of the names of the service keys for the given service.
predix/admin/cf/services.py
def get_service_keys(self, service_name): """ Returns a flat list of the names of the service keys for the given service. """ keys = [] for key in self._get_service_keys(service_name)['resources']: keys.append(key['entity']['name']) return keys
def get_service_keys(self, service_name): """ Returns a flat list of the names of the service keys for the given service. """ keys = [] for key in self._get_service_keys(service_name)['resources']: keys.append(key['entity']['name']) return keys
[ "Returns", "a", "flat", "list", "of", "the", "names", "of", "the", "service", "keys", "for", "the", "given", "service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L65-L74
[ "def", "get_service_keys", "(", "self", ",", "service_name", ")", ":", "keys", "=", "[", "]", "for", "key", "in", "self", ".", "_get_service_keys", "(", "service_name", ")", "[", "'resources'", "]", ":", "keys", ".", "append", "(", "key", "[", "'entity'"...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service.get_service_key
Returns the service key details. Similar to `cf service-key`.
predix/admin/cf/services.py
def get_service_key(self, service_name, key_name): """ Returns the service key details. Similar to `cf service-key`. """ for key in self._get_service_keys(service_name)['resources']: if key_name == key['entity']['name']: guid = key['metadata']['guid']...
def get_service_key(self, service_name, key_name): """ Returns the service key details. Similar to `cf service-key`. """ for key in self._get_service_keys(service_name)['resources']: if key_name == key['entity']['name']: guid = key['metadata']['guid']...
[ "Returns", "the", "service", "key", "details", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L82-L95
[ "def", "get_service_key", "(", "self", ",", "service_name", ",", "key_name", ")", ":", "for", "key", "in", "self", ".", "_get_service_keys", "(", "service_name", ")", "[", "'resources'", "]", ":", "if", "key_name", "==", "key", "[", "'entity'", "]", "[", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service.create_service_key
Create a service key for the given service.
predix/admin/cf/services.py
def create_service_key(self, service_name, key_name): """ Create a service key for the given service. """ if self.has_key(service_name, key_name): logging.warning("Reusing existing service key %s" % (key_name)) return self.get_service_key(service_name, key_name) ...
def create_service_key(self, service_name, key_name): """ Create a service key for the given service. """ if self.has_key(service_name, key_name): logging.warning("Reusing existing service key %s" % (key_name)) return self.get_service_key(service_name, key_name) ...
[ "Create", "a", "service", "key", "for", "the", "given", "service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L97-L110
[ "def", "create_service_key", "(", "self", ",", "service_name", ",", "key_name", ")", ":", "if", "self", ".", "has_key", "(", "service_name", ",", "key_name", ")", ":", "logging", ".", "warning", "(", "\"Reusing existing service key %s\"", "%", "(", "key_name", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service.delete_service_key
Delete a service key for the given service.
predix/admin/cf/services.py
def delete_service_key(self, service_name, key_name): """ Delete a service key for the given service. """ key = self.get_service_key(service_name, key_name) logging.info("Deleting service key %s for service %s" % (key, service_name)) return self.api.delete(key['metadata']...
def delete_service_key(self, service_name, key_name): """ Delete a service key for the given service. """ key = self.get_service_key(service_name, key_name) logging.info("Deleting service key %s for service %s" % (key, service_name)) return self.api.delete(key['metadata']...
[ "Delete", "a", "service", "key", "for", "the", "given", "service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L112-L118
[ "def", "delete_service_key", "(", "self", ",", "service_name", ",", "key_name", ")", ":", "key", "=", "self", ".", "get_service_key", "(", "service_name", ",", "key_name", ")", "logging", ".", "info", "(", "\"Deleting service key %s for service %s\"", "%", "(", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service.get_instance
Retrieves a service instance with the given name.
predix/admin/cf/services.py
def get_instance(self, service_name): """ Retrieves a service instance with the given name. """ for resource in self.space._get_instances(): if resource['entity']['name'] == service_name: return resource['entity']
def get_instance(self, service_name): """ Retrieves a service instance with the given name. """ for resource in self.space._get_instances(): if resource['entity']['name'] == service_name: return resource['entity']
[ "Retrieves", "a", "service", "instance", "with", "the", "given", "name", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L120-L126
[ "def", "get_instance", "(", "self", ",", "service_name", ")", ":", "for", "resource", "in", "self", ".", "space", ".", "_get_instances", "(", ")", ":", "if", "resource", "[", "'entity'", "]", "[", "'name'", "]", "==", "service_name", ":", "return", "reso...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service.get_service_plan_for_service
Return the service plans available for a given service.
predix/admin/cf/services.py
def get_service_plan_for_service(self, service_name): """ Return the service plans available for a given service. """ services = self.get_services() for service in services['resources']: if service['entity']['label'] == service_name: response = self.ap...
def get_service_plan_for_service(self, service_name): """ Return the service plans available for a given service. """ services = self.get_services() for service in services['resources']: if service['entity']['label'] == service_name: response = self.ap...
[ "Return", "the", "service", "plans", "available", "for", "a", "given", "service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L134-L142
[ "def", "get_service_plan_for_service", "(", "self", ",", "service_name", ")", ":", "services", "=", "self", ".", "get_services", "(", ")", "for", "service", "in", "services", "[", "'resources'", "]", ":", "if", "service", "[", "'entity'", "]", "[", "'label'"...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service.get_service_plan_guid
Return the service plan GUID for the given service / plan.
predix/admin/cf/services.py
def get_service_plan_guid(self, service_name, plan_name): """ Return the service plan GUID for the given service / plan. """ for plan in self.get_service_plan_for_service(service_name): if plan['entity']['name'] == plan_name: return plan['metadata']['guid'] ...
def get_service_plan_guid(self, service_name, plan_name): """ Return the service plan GUID for the given service / plan. """ for plan in self.get_service_plan_for_service(service_name): if plan['entity']['name'] == plan_name: return plan['metadata']['guid'] ...
[ "Return", "the", "service", "plan", "GUID", "for", "the", "given", "service", "/", "plan", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L144-L152
[ "def", "get_service_plan_guid", "(", "self", ",", "service_name", ",", "plan_name", ")", ":", "for", "plan", "in", "self", ".", "get_service_plan_for_service", "(", "service_name", ")", ":", "if", "plan", "[", "'entity'", "]", "[", "'name'", "]", "==", "plan...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service.create_service
Create a service instance.
predix/admin/cf/services.py
def create_service(self, service_type, plan_name, service_name, params, async=False, **kwargs): """ Create a service instance. """ if self.space.has_service_with_name(service_name): logging.warning("Service already exists with that name.") return self....
def create_service(self, service_type, plan_name, service_name, params, async=False, **kwargs): """ Create a service instance. """ if self.space.has_service_with_name(service_name): logging.warning("Service already exists with that name.") return self....
[ "Create", "a", "service", "instance", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L154-L182
[ "def", "create_service", "(", "self", ",", "service_type", ",", "plan_name", ",", "service_name", ",", "params", ",", "async", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "space", ".", "has_service_with_name", "(", "service_name", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service.delete_service
Delete the service of the given name. It may fail if there are any service keys or app bindings. Use purge() if you want to delete it all.
predix/admin/cf/services.py
def delete_service(self, service_name, params=None): """ Delete the service of the given name. It may fail if there are any service keys or app bindings. Use purge() if you want to delete it all. """ if not self.space.has_service_with_name(service_name): log...
def delete_service(self, service_name, params=None): """ Delete the service of the given name. It may fail if there are any service keys or app bindings. Use purge() if you want to delete it all. """ if not self.space.has_service_with_name(service_name): log...
[ "Delete", "the", "service", "of", "the", "given", "name", ".", "It", "may", "fail", "if", "there", "are", "any", "service", "keys", "or", "app", "bindings", ".", "Use", "purge", "()", "if", "you", "want", "to", "delete", "it", "all", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/services.py#L184-L199
[ "def", "delete_service", "(", "self", ",", "service_name", ",", "params", "=", "None", ")", ":", "if", "not", "self", ".", "space", ".", "has_service_with_name", "(", "service_name", ")", ":", "logging", ".", "warning", "(", "\"Service not found so... succeeded?...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
TimeSeries._get_query_uri
Returns the URI endpoint for performing queries of a Predix Time Series instance from environment inspection.
predix/data/timeseries.py
def _get_query_uri(self): """ Returns the URI endpoint for performing queries of a Predix Time Series instance from environment inspection. """ if 'VCAP_SERVICES' in os.environ: services = json.loads(os.getenv('VCAP_SERVICES')) predix_timeseries = services...
def _get_query_uri(self): """ Returns the URI endpoint for performing queries of a Predix Time Series instance from environment inspection. """ if 'VCAP_SERVICES' in os.environ: services = json.loads(os.getenv('VCAP_SERVICES')) predix_timeseries = services...
[ "Returns", "the", "URI", "endpoint", "for", "performing", "queries", "of", "a", "Predix", "Time", "Series", "instance", "from", "environment", "inspection", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/timeseries.py#L73-L83
[ "def", "_get_query_uri", "(", "self", ")", ":", "if", "'VCAP_SERVICES'", "in", "os", ".", "environ", ":", "services", "=", "json", ".", "loads", "(", "os", ".", "getenv", "(", "'VCAP_SERVICES'", ")", ")", "predix_timeseries", "=", "services", "[", "'predix...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
TimeSeries._get_query_zone_id
Returns the ZoneId for performing queries of a Predix Time Series instance from environment inspection.
predix/data/timeseries.py
def _get_query_zone_id(self): """ Returns the ZoneId for performing queries of a Predix Time Series instance from environment inspection. """ if 'VCAP_SERVICES' in os.environ: services = json.loads(os.getenv('VCAP_SERVICES')) predix_timeseries = services['...
def _get_query_zone_id(self): """ Returns the ZoneId for performing queries of a Predix Time Series instance from environment inspection. """ if 'VCAP_SERVICES' in os.environ: services = json.loads(os.getenv('VCAP_SERVICES')) predix_timeseries = services['...
[ "Returns", "the", "ZoneId", "for", "performing", "queries", "of", "a", "Predix", "Time", "Series", "instance", "from", "environment", "inspection", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/timeseries.py#L85-L95
[ "def", "_get_query_zone_id", "(", "self", ")", ":", "if", "'VCAP_SERVICES'", "in", "os", ".", "environ", ":", "services", "=", "json", ".", "loads", "(", "os", ".", "getenv", "(", "'VCAP_SERVICES'", ")", ")", "predix_timeseries", "=", "services", "[", "'pr...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
TimeSeries._get_datapoints
Will make a direct REST call with the given json body payload to get datapoints.
predix/data/timeseries.py
def _get_datapoints(self, params): """ Will make a direct REST call with the given json body payload to get datapoints. """ url = self.query_uri + '/v1/datapoints' return self.service._get(url, params=params)
def _get_datapoints(self, params): """ Will make a direct REST call with the given json body payload to get datapoints. """ url = self.query_uri + '/v1/datapoints' return self.service._get(url, params=params)
[ "Will", "make", "a", "direct", "REST", "call", "with", "the", "given", "json", "body", "payload", "to", "get", "datapoints", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/timeseries.py#L171-L177
[ "def", "_get_datapoints", "(", "self", ",", "params", ")", ":", "url", "=", "self", ".", "query_uri", "+", "'/v1/datapoints'", "return", "self", ".", "service", ".", "_get", "(", "url", ",", "params", "=", "params", ")" ]
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
TimeSeries.get_values
Convenience method that for simple single tag queries will return just the values to be iterated on.
predix/data/timeseries.py
def get_values(self, *args, **kwargs): """ Convenience method that for simple single tag queries will return just the values to be iterated on. """ if isinstance(args[0], list): raise ValueError("Can only get_values() for a single tag.") response = self.get_d...
def get_values(self, *args, **kwargs): """ Convenience method that for simple single tag queries will return just the values to be iterated on. """ if isinstance(args[0], list): raise ValueError("Can only get_values() for a single tag.") response = self.get_d...
[ "Convenience", "method", "that", "for", "simple", "single", "tag", "queries", "will", "return", "just", "the", "values", "to", "be", "iterated", "on", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/timeseries.py#L183-L195
[ "def", "get_values", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "args", "[", "0", "]", ",", "list", ")", ":", "raise", "ValueError", "(", "\"Can only get_values() for a single tag.\"", ")", "response", "=", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
TimeSeries.get_datapoints
Returns all of the datapoints that match the given query. - tags: list or string identifying the name/tag (ie. "temp") - start: data after this, absolute or relative (ie. '1w-ago' or 1494015972386) - end: data before this value - order: ascending (asc) or d...
predix/data/timeseries.py
def get_datapoints(self, tags, start=None, end=None, order=None, limit=None, qualities=None, attributes=None, measurement=None, aggregations=None, post=False): """ Returns all of the datapoints that match the given query. - tags: list or string identifying the name/t...
def get_datapoints(self, tags, start=None, end=None, order=None, limit=None, qualities=None, attributes=None, measurement=None, aggregations=None, post=False): """ Returns all of the datapoints that match the given query. - tags: list or string identifying the name/t...
[ "Returns", "all", "of", "the", "datapoints", "that", "match", "the", "given", "query", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/timeseries.py#L209-L326
[ "def", "get_datapoints", "(", "self", ",", "tags", ",", "start", "=", "None", ",", "end", "=", "None", ",", "order", "=", "None", ",", "limit", "=", "None", ",", "qualities", "=", "None", ",", "attributes", "=", "None", ",", "measurement", "=", "None...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
TimeSeries._create_connection
Create a new websocket connection with proper headers.
predix/data/timeseries.py
def _create_connection(self): """ Create a new websocket connection with proper headers. """ logging.debug("Initializing new websocket connection.") headers = { 'Authorization': self.service._get_bearer_token(), 'Predix-Zone-Id': self.ingest_zone_id, ...
def _create_connection(self): """ Create a new websocket connection with proper headers. """ logging.debug("Initializing new websocket connection.") headers = { 'Authorization': self.service._get_bearer_token(), 'Predix-Zone-Id': self.ingest_zone_id, ...
[ "Create", "a", "new", "websocket", "connection", "with", "proper", "headers", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/timeseries.py#L367-L383
[ "def", "_create_connection", "(", "self", ")", ":", "logging", ".", "debug", "(", "\"Initializing new websocket connection.\"", ")", "headers", "=", "{", "'Authorization'", ":", "self", ".", "service", ".", "_get_bearer_token", "(", ")", ",", "'Predix-Zone-Id'", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
TimeSeries._get_websocket
Reuse existing connection or create a new connection.
predix/data/timeseries.py
def _get_websocket(self, reuse=True): """ Reuse existing connection or create a new connection. """ # Check if still connected if self.ws and reuse: if self.ws.connected: return self.ws logging.debug("Stale connection, reconnecting.") ...
def _get_websocket(self, reuse=True): """ Reuse existing connection or create a new connection. """ # Check if still connected if self.ws and reuse: if self.ws.connected: return self.ws logging.debug("Stale connection, reconnecting.") ...
[ "Reuse", "existing", "connection", "or", "create", "a", "new", "connection", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/timeseries.py#L385-L397
[ "def", "_get_websocket", "(", "self", ",", "reuse", "=", "True", ")", ":", "# Check if still connected", "if", "self", ".", "ws", "and", "reuse", ":", "if", "self", ".", "ws", ".", "connected", ":", "return", "self", ".", "ws", "logging", ".", "debug", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
TimeSeries._send_to_timeseries
Establish or reuse socket connection and send the given message to the timeseries service.
predix/data/timeseries.py
def _send_to_timeseries(self, message): """ Establish or reuse socket connection and send the given message to the timeseries service. """ logging.debug("MESSAGE=" + str(message)) result = None try: ws = self._get_websocket() ws.send(json....
def _send_to_timeseries(self, message): """ Establish or reuse socket connection and send the given message to the timeseries service. """ logging.debug("MESSAGE=" + str(message)) result = None try: ws = self._get_websocket() ws.send(json....
[ "Establish", "or", "reuse", "socket", "connection", "and", "send", "the", "given", "message", "to", "the", "timeseries", "service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/timeseries.py#L399-L420
[ "def", "_send_to_timeseries", "(", "self", ",", "message", ")", ":", "logging", ".", "debug", "(", "\"MESSAGE=\"", "+", "str", "(", "message", ")", ")", "result", "=", "None", "try", ":", "ws", "=", "self", ".", "_get_websocket", "(", ")", "ws", ".", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
TimeSeries.queue
To reduce network traffic, you can buffer datapoints and then flush() anything in the queue. :param name: the name / label / tag for sensor data :param value: the sensor reading or value to record :param quality: the quality value, use the constants BAD, GOOD, etc. (option...
predix/data/timeseries.py
def queue(self, name, value, quality=None, timestamp=None, attributes=None): """ To reduce network traffic, you can buffer datapoints and then flush() anything in the queue. :param name: the name / label / tag for sensor data :param value: the sensor reading or valu...
def queue(self, name, value, quality=None, timestamp=None, attributes=None): """ To reduce network traffic, you can buffer datapoints and then flush() anything in the queue. :param name: the name / label / tag for sensor data :param value: the sensor reading or valu...
[ "To", "reduce", "network", "traffic", "you", "can", "buffer", "datapoints", "and", "then", "flush", "()", "anything", "in", "the", "queue", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/timeseries.py#L422-L498
[ "def", "queue", "(", "self", ",", "name", ",", "value", ",", "quality", "=", "None", ",", "timestamp", "=", "None", ",", "attributes", "=", "None", ")", ":", "# Get timestamp first in case delay opening websocket connection", "# and it must have millisecond accuracy", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
TimeSeries.send
Can accept a name/tag and value to be queued and then send anything in the queue to the time series service. Optional parameters include setting quality, timestamp, or attributes. See spec for queue() for complete list of options. Example of sending a batch of values: que...
predix/data/timeseries.py
def send(self, name=None, value=None, **kwargs): """ Can accept a name/tag and value to be queued and then send anything in the queue to the time series service. Optional parameters include setting quality, timestamp, or attributes. See spec for queue() for complete list of opt...
def send(self, name=None, value=None, **kwargs): """ Can accept a name/tag and value to be queued and then send anything in the queue to the time series service. Optional parameters include setting quality, timestamp, or attributes. See spec for queue() for complete list of opt...
[ "Can", "accept", "a", "name", "/", "tag", "and", "value", "to", "be", "queued", "and", "then", "send", "anything", "in", "the", "queue", "to", "the", "time", "series", "service", ".", "Optional", "parameters", "include", "setting", "quality", "timestamp", ...
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/timeseries.py#L500-L534
[ "def", "send", "(", "self", ",", "name", "=", "None", ",", "value", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "name", "and", "value", ":", "self", ".", "queue", "(", "name", ",", "value", ",", "*", "*", "kwargs", ")", "timestamp", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
PostgreSQL.execute
This convenience method will execute the query passed in as is. For more complex functionality you may want to use the sqlalchemy engine directly, but this serves as an example implementation. :param select_query: SQL statement to execute that will identify the resultset of interes...
predix/data/dbaas.py
def execute(self, statement, *args, **kwargs): """ This convenience method will execute the query passed in as is. For more complex functionality you may want to use the sqlalchemy engine directly, but this serves as an example implementation. :param select_query: SQL statement...
def execute(self, statement, *args, **kwargs): """ This convenience method will execute the query passed in as is. For more complex functionality you may want to use the sqlalchemy engine directly, but this serves as an example implementation. :param select_query: SQL statement...
[ "This", "convenience", "method", "will", "execute", "the", "query", "passed", "in", "as", "is", ".", "For", "more", "complex", "functionality", "you", "may", "want", "to", "use", "the", "sqlalchemy", "engine", "directly", "but", "this", "serves", "as", "an",...
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/dbaas.py#L84-L96
[ "def", "execute", "(", "self", ",", "statement", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "self", ".", "engine", ".", "connect", "(", ")", "as", "conn", ":", "s", "=", "sqlalchemy", ".", "sql", ".", "text", "(", "statement", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Eventhub.shutdown
Shutdown the client, shutdown the sub clients and stop the health checker :return: None
predix/data/eventhub/client.py
def shutdown(self): """ Shutdown the client, shutdown the sub clients and stop the health checker :return: None """ self._run_health_checker = False if self.publisher is not None: self.publisher.shutdown() if self.subscriber is not None: s...
def shutdown(self): """ Shutdown the client, shutdown the sub clients and stop the health checker :return: None """ self._run_health_checker = False if self.publisher is not None: self.publisher.shutdown() if self.subscriber is not None: s...
[ "Shutdown", "the", "client", "shutdown", "the", "sub", "clients", "and", "stop", "the", "health", "checker", ":", "return", ":", "None" ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/eventhub/client.py#L49-L59
[ "def", "shutdown", "(", "self", ")", ":", "self", ".", "_run_health_checker", "=", "False", "if", "self", ".", "publisher", "is", "not", "None", ":", "self", ".", "publisher", ".", "shutdown", "(", ")", "if", "self", ".", "subscriber", "is", "not", "No...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Eventhub.get_service_env_value
Get a env variable as defined by the service admin :param key: the base of the key to use :return: the env if it exists
predix/data/eventhub/client.py
def get_service_env_value(self, key): """ Get a env variable as defined by the service admin :param key: the base of the key to use :return: the env if it exists """ service_key = predix.config.get_env_key(self, key) value = os.environ[service_key] if not ...
def get_service_env_value(self, key): """ Get a env variable as defined by the service admin :param key: the base of the key to use :return: the env if it exists """ service_key = predix.config.get_env_key(self, key) value = os.environ[service_key] if not ...
[ "Get", "a", "env", "variable", "as", "defined", "by", "the", "service", "admin", ":", "param", "key", ":", "the", "base", "of", "the", "key", "to", "use", ":", "return", ":", "the", "env", "if", "it", "exists" ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/eventhub/client.py#L75-L85
[ "def", "get_service_env_value", "(", "self", ",", "key", ")", ":", "service_key", "=", "predix", ".", "config", ".", "get_env_key", "(", "self", ",", "key", ")", "value", "=", "os", ".", "environ", "[", "service_key", "]", "if", "not", "value", ":", "r...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Eventhub._init_channel
build the grpc channel used for both publisher and subscriber :return: None
predix/data/eventhub/client.py
def _init_channel(self): """ build the grpc channel used for both publisher and subscriber :return: None """ host = self._get_host() port = self._get_grpc_port() if 'TLS_PEM_FILE' in os.environ: with open(os.environ['TLS_PEM_FILE'], mode='rb') as f: ...
def _init_channel(self): """ build the grpc channel used for both publisher and subscriber :return: None """ host = self._get_host() port = self._get_grpc_port() if 'TLS_PEM_FILE' in os.environ: with open(os.environ['TLS_PEM_FILE'], mode='rb') as f: ...
[ "build", "the", "grpc", "channel", "used", "for", "both", "publisher", "and", "subscriber", ":", "return", ":", "None" ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/eventhub/client.py#L87-L103
[ "def", "_init_channel", "(", "self", ")", ":", "host", "=", "self", ".", "_get_host", "(", ")", "port", "=", "self", ".", "_get_grpc_port", "(", ")", "if", "'TLS_PEM_FILE'", "in", "os", ".", "environ", ":", "with", "open", "(", "os", ".", "environ", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Eventhub._init_health_checker
start the health checker stub and start a thread to ping it every 30 seconds :return: None
predix/data/eventhub/client.py
def _init_health_checker(self): """ start the health checker stub and start a thread to ping it every 30 seconds :return: None """ stub = Health_pb2_grpc.HealthStub(channel=self._channel) self._health_check = stub.Check health_check_thread = threading.Thread(targe...
def _init_health_checker(self): """ start the health checker stub and start a thread to ping it every 30 seconds :return: None """ stub = Health_pb2_grpc.HealthStub(channel=self._channel) self._health_check = stub.Check health_check_thread = threading.Thread(targe...
[ "start", "the", "health", "checker", "stub", "and", "start", "a", "thread", "to", "ping", "it", "every", "30", "seconds", ":", "return", ":", "None" ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/eventhub/client.py#L105-L114
[ "def", "_init_health_checker", "(", "self", ")", ":", "stub", "=", "Health_pb2_grpc", ".", "HealthStub", "(", "channel", "=", "self", ".", "_channel", ")", "self", ".", "_health_check", "=", "stub", ".", "Check", "health_check_thread", "=", "threading", ".", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Eventhub._health_check_thread
Health checker thread that pings the service every 30 seconds :return: None
predix/data/eventhub/client.py
def _health_check_thread(self): """ Health checker thread that pings the service every 30 seconds :return: None """ while self._run_health_checker: response = self._health_check(Health_pb2.HealthCheckRequest(service='predix-event-hub.grpc.health')) logging...
def _health_check_thread(self): """ Health checker thread that pings the service every 30 seconds :return: None """ while self._run_health_checker: response = self._health_check(Health_pb2.HealthCheckRequest(service='predix-event-hub.grpc.health')) logging...
[ "Health", "checker", "thread", "that", "pings", "the", "service", "every", "30", "seconds", ":", "return", ":", "None" ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/eventhub/client.py#L116-L125
[ "def", "_health_check_thread", "(", "self", ")", ":", "while", "self", ".", "_run_health_checker", ":", "response", "=", "self", ".", "_health_check", "(", "Health_pb2", ".", "HealthCheckRequest", "(", "service", "=", "'predix-event-hub.grpc.health'", ")", ")", "l...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
create_temp_space
Create a new temporary cloud foundry space for a project.
predix/admin/cf/spaces.py
def create_temp_space(): """ Create a new temporary cloud foundry space for a project. """ # Truncating uuid to just take final 12 characters since space name # is used to name services and there is a 50 character limit on instance # names. # MAINT: hacky with possible collisions u...
def create_temp_space(): """ Create a new temporary cloud foundry space for a project. """ # Truncating uuid to just take final 12 characters since space name # is used to name services and there is a 50 character limit on instance # names. # MAINT: hacky with possible collisions u...
[ "Create", "a", "new", "temporary", "cloud", "foundry", "space", "for", "a", "project", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L11-L29
[ "def", "create_temp_space", "(", ")", ":", "# Truncating uuid to just take final 12 characters since space name", "# is used to name services and there is a 50 character limit on instance", "# names. ", "# MAINT: hacky with possible collisions", "unique_name", "=", "str", "(", "uuid", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Space._get_spaces
Get the marketplace services.
predix/admin/cf/spaces.py
def _get_spaces(self): """ Get the marketplace services. """ guid = self.api.config.get_organization_guid() uri = '/v2/organizations/%s/spaces' % (guid) return self.api.get(uri)
def _get_spaces(self): """ Get the marketplace services. """ guid = self.api.config.get_organization_guid() uri = '/v2/organizations/%s/spaces' % (guid) return self.api.get(uri)
[ "Get", "the", "marketplace", "services", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L46-L52
[ "def", "_get_spaces", "(", "self", ")", ":", "guid", "=", "self", ".", "api", ".", "config", ".", "get_organization_guid", "(", ")", "uri", "=", "'/v2/organizations/%s/spaces'", "%", "(", "guid", ")", "return", "self", ".", "api", ".", "get", "(", "uri",...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Space.target
Target the current space for any forthcoming Cloud Foundry operations.
predix/admin/cf/spaces.py
def target(self): """ Target the current space for any forthcoming Cloud Foundry operations. """ # MAINT: I don't like this, but will deal later os.environ['PREDIX_SPACE_GUID'] = self.guid os.environ['PREDIX_SPACE_NAME'] = self.name os.environ['PREDIX_ORGA...
def target(self): """ Target the current space for any forthcoming Cloud Foundry operations. """ # MAINT: I don't like this, but will deal later os.environ['PREDIX_SPACE_GUID'] = self.guid os.environ['PREDIX_SPACE_NAME'] = self.name os.environ['PREDIX_ORGA...
[ "Target", "the", "current", "space", "for", "any", "forthcoming", "Cloud", "Foundry", "operations", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L54-L63
[ "def", "target", "(", "self", ")", ":", "# MAINT: I don't like this, but will deal later", "os", ".", "environ", "[", "'PREDIX_SPACE_GUID'", "]", "=", "self", ".", "guid", "os", ".", "environ", "[", "'PREDIX_SPACE_NAME'", "]", "=", "self", ".", "name", "os", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Space.get_spaces
Return a flat list of the names for spaces in the organization.
predix/admin/cf/spaces.py
def get_spaces(self): """ Return a flat list of the names for spaces in the organization. """ self.spaces = [] for resource in self._get_spaces()['resources']: self.spaces.append(resource['entity']['name']) return self.spaces
def get_spaces(self): """ Return a flat list of the names for spaces in the organization. """ self.spaces = [] for resource in self._get_spaces()['resources']: self.spaces.append(resource['entity']['name']) return self.spaces
[ "Return", "a", "flat", "list", "of", "the", "names", "for", "spaces", "in", "the", "organization", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L65-L73
[ "def", "get_spaces", "(", "self", ")", ":", "self", ".", "spaces", "=", "[", "]", "for", "resource", "in", "self", ".", "_get_spaces", "(", ")", "[", "'resources'", "]", ":", "self", ".", "spaces", ".", "append", "(", "resource", "[", "'entity'", "]"...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Space.create_space
Create a new space with the given name in the current target organization.
predix/admin/cf/spaces.py
def create_space(self, space_name, add_users=True): """ Create a new space with the given name in the current target organization. """ body = { 'name': space_name, 'organization_guid': self.api.config.get_organization_guid() } # MAINT: may...
def create_space(self, space_name, add_users=True): """ Create a new space with the given name in the current target organization. """ body = { 'name': space_name, 'organization_guid': self.api.config.get_organization_guid() } # MAINT: may...
[ "Create", "a", "new", "space", "with", "the", "given", "name", "in", "the", "current", "target", "organization", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L83-L104
[ "def", "create_space", "(", "self", ",", "space_name", ",", "add_users", "=", "True", ")", ":", "body", "=", "{", "'name'", ":", "space_name", ",", "'organization_guid'", ":", "self", ".", "api", ".", "config", ".", "get_organization_guid", "(", ")", "}", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Space.delete_space
Delete the current space, or a space with the given name or guid.
predix/admin/cf/spaces.py
def delete_space(self, name=None, guid=None): """ Delete the current space, or a space with the given name or guid. """ if not guid: if name: spaces = self._get_spaces() for space in spaces['resources']: if space['e...
def delete_space(self, name=None, guid=None): """ Delete the current space, or a space with the given name or guid. """ if not guid: if name: spaces = self._get_spaces() for space in spaces['resources']: if space['e...
[ "Delete", "the", "current", "space", "or", "a", "space", "with", "the", "given", "name", "or", "guid", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L112-L133
[ "def", "delete_space", "(", "self", ",", "name", "=", "None", ",", "guid", "=", "None", ")", ":", "if", "not", "guid", ":", "if", "name", ":", "spaces", "=", "self", ".", "_get_spaces", "(", ")", "for", "space", "in", "spaces", "[", "'resources'", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Space.get_services
Returns a flat list of the service names available from the marketplace for this space.
predix/admin/cf/spaces.py
def get_services(self): """ Returns a flat list of the service names available from the marketplace for this space. """ services = [] for resource in self._get_services()['resources']: services.append(resource['entity']['label']) return services
def get_services(self): """ Returns a flat list of the service names available from the marketplace for this space. """ services = [] for resource in self._get_services()['resources']: services.append(resource['entity']['label']) return services
[ "Returns", "a", "flat", "list", "of", "the", "service", "names", "available", "from", "the", "marketplace", "for", "this", "space", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L177-L186
[ "def", "get_services", "(", "self", ")", ":", "services", "=", "[", "]", "for", "resource", "in", "self", ".", "_get_services", "(", ")", "[", "'resources'", "]", ":", "services", ".", "append", "(", "resource", "[", "'entity'", "]", "[", "'label'", "]...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Space._get_instances
Returns the service instances activated in this space.
predix/admin/cf/spaces.py
def _get_instances(self, page_number=None): """ Returns the service instances activated in this space. """ instances = [] uri = '/v2/spaces/%s/service_instances' % self.guid json_response = self.api.get(uri) instances += json_response['resources'] while js...
def _get_instances(self, page_number=None): """ Returns the service instances activated in this space. """ instances = [] uri = '/v2/spaces/%s/service_instances' % self.guid json_response = self.api.get(uri) instances += json_response['resources'] while js...
[ "Returns", "the", "service", "instances", "activated", "in", "this", "space", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L188-L200
[ "def", "_get_instances", "(", "self", ",", "page_number", "=", "None", ")", ":", "instances", "=", "[", "]", "uri", "=", "'/v2/spaces/%s/service_instances'", "%", "self", ".", "guid", "json_response", "=", "self", ".", "api", ".", "get", "(", "uri", ")", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Space.get_instances
Returns a flat list of the names of services created in this space.
predix/admin/cf/spaces.py
def get_instances(self): """ Returns a flat list of the names of services created in this space. """ services = [] for resource in self._get_instances(): services.append(resource['entity']['name']) return services
def get_instances(self): """ Returns a flat list of the names of services created in this space. """ services = [] for resource in self._get_instances(): services.append(resource['entity']['name']) return services
[ "Returns", "a", "flat", "list", "of", "the", "names", "of", "services", "created", "in", "this", "space", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L202-L211
[ "def", "get_instances", "(", "self", ")", ":", "services", "=", "[", "]", "for", "resource", "in", "self", ".", "_get_instances", "(", ")", ":", "services", ".", "append", "(", "resource", "[", "'entity'", "]", "[", "'name'", "]", ")", "return", "servi...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Space.has_service_of_type
Tests whether a service instance exists for the given service.
predix/admin/cf/spaces.py
def has_service_of_type(self, service_type): """ Tests whether a service instance exists for the given service. """ summary = self.get_space_summary() for instance in summary['services']: if 'service_plan' in instance: if service_type == instan...
def has_service_of_type(self, service_type): """ Tests whether a service instance exists for the given service. """ summary = self.get_space_summary() for instance in summary['services']: if 'service_plan' in instance: if service_type == instan...
[ "Tests", "whether", "a", "service", "instance", "exists", "for", "the", "given", "service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L220-L231
[ "def", "has_service_of_type", "(", "self", ",", "service_type", ")", ":", "summary", "=", "self", ".", "get_space_summary", "(", ")", "for", "instance", "in", "summary", "[", "'services'", "]", ":", "if", "'service_plan'", "in", "instance", ":", "if", "servi...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Space.purge
Remove all services and apps from the space. Will leave the space itself, call delete_space() if you want to remove that too. Similar to `cf delete-space -f <space-name>`.
predix/admin/cf/spaces.py
def purge(self): """ Remove all services and apps from the space. Will leave the space itself, call delete_space() if you want to remove that too. Similar to `cf delete-space -f <space-name>`. """ logging.warning("Purging all services from space %s" % ...
def purge(self): """ Remove all services and apps from the space. Will leave the space itself, call delete_space() if you want to remove that too. Similar to `cf delete-space -f <space-name>`. """ logging.warning("Purging all services from space %s" % ...
[ "Remove", "all", "services", "and", "apps", "from", "the", "space", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/spaces.py#L233-L251
[ "def", "purge", "(", "self", ")", ":", "logging", ".", "warning", "(", "\"Purging all services from space %s\"", "%", "(", "self", ".", "name", ")", ")", "service", "=", "predix", ".", "admin", ".", "cf", ".", "services", ".", "Service", "(", ")", "for",...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
PostgreSQL.create
Create an instance of the PostgreSQL service with the typical starting settings. :param max_wait: service is created asynchronously, so will only wait this number of seconds before giving up. :param allocated_storage: int for GBs to be allocated for storage :param encrypti...
predix/admin/dbaas.py
def create(self, max_wait=300, allocated_storage=None, encryption_at_rest=None, restore_to_time=None, **kwargs): """ Create an instance of the PostgreSQL service with the typical starting settings. :param max_wait: service is created asynchronously, so will only wait ...
def create(self, max_wait=300, allocated_storage=None, encryption_at_rest=None, restore_to_time=None, **kwargs): """ Create an instance of the PostgreSQL service with the typical starting settings. :param max_wait: service is created asynchronously, so will only wait ...
[ "Create", "an", "instance", "of", "the", "PostgreSQL", "service", "with", "the", "typical", "starting", "settings", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/dbaas.py#L43-L93
[ "def", "create", "(", "self", ",", "max_wait", "=", "300", ",", "allocated_storage", "=", "None", ",", "encryption_at_rest", "=", "None", ",", "restore_to_time", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# MAINT: Add these if there is demand for it and vali...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
PostgreSQL.add_to_manifest
Add useful details to the manifest about this service so that it can be used in an application. :param manifest: A predix.admin.app.Manifest object instance that manages reading/writing manifest config for a cloud foundry app.
predix/admin/dbaas.py
def add_to_manifest(self, manifest): """ Add useful details to the manifest about this service so that it can be used in an application. :param manifest: A predix.admin.app.Manifest object instance that manages reading/writing manifest config for a cloud foundry ...
def add_to_manifest(self, manifest): """ Add useful details to the manifest about this service so that it can be used in an application. :param manifest: A predix.admin.app.Manifest object instance that manages reading/writing manifest config for a cloud foundry ...
[ "Add", "useful", "details", "to", "the", "manifest", "about", "this", "service", "so", "that", "it", "can", "be", "used", "in", "an", "application", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/dbaas.py#L95-L121
[ "def", "add_to_manifest", "(", "self", ",", "manifest", ")", ":", "manifest", ".", "add_service", "(", "self", ".", "service", ".", "name", ")", "hostname", "=", "predix", ".", "config", ".", "get_env_key", "(", "self", ".", "use_class", ",", "'hostname'",...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
AnalyticsFramework.create
Create an instance of the Analytics Framework Service with the typical starting settings. If not provided, will reuse the runtime client for the ui as well.
predix/admin/analytics.py
def create(self, asset, timeseries, client_id, client_secret, ui_client_id=None, ui_client_secret=None): """ Create an instance of the Analytics Framework Service with the typical starting settings. If not provided, will reuse the runtime client for the ui as well. ...
def create(self, asset, timeseries, client_id, client_secret, ui_client_id=None, ui_client_secret=None): """ Create an instance of the Analytics Framework Service with the typical starting settings. If not provided, will reuse the runtime client for the ui as well. ...
[ "Create", "an", "instance", "of", "the", "Analytics", "Framework", "Service", "with", "the", "typical", "starting", "settings", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/analytics.py#L23-L47
[ "def", "create", "(", "self", ",", "asset", ",", "timeseries", ",", "client_id", ",", "client_secret", ",", "ui_client_id", "=", "None", ",", "ui_client_secret", "=", "None", ")", ":", "assert", "isinstance", "(", "asset", ",", "predix", ".", "admin", ".",...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Logging._find_service_name
For cloud operations there is support for multiple pools of resources dedicated to logstash. The service name as a result follows the pattern logstash-{n} where n is some number. We can find it from the service marketplace.
predix/admin/logstash.py
def _find_service_name(self): """ For cloud operations there is support for multiple pools of resources dedicated to logstash. The service name as a result follows the pattern logstash-{n} where n is some number. We can find it from the service marketplace. """ ...
def _find_service_name(self): """ For cloud operations there is support for multiple pools of resources dedicated to logstash. The service name as a result follows the pattern logstash-{n} where n is some number. We can find it from the service marketplace. """ ...
[ "For", "cloud", "operations", "there", "is", "support", "for", "multiple", "pools", "of", "resources", "dedicated", "to", "logstash", ".", "The", "service", "name", "as", "a", "result", "follows", "the", "pattern", "logstash", "-", "{", "n", "}", "where", ...
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/logstash.py#L27-L40
[ "def", "_find_service_name", "(", "self", ")", ":", "space", "=", "predix", ".", "admin", ".", "cf", ".", "spaces", ".", "Space", "(", ")", "services", "=", "space", ".", "get_services", "(", ")", "for", "service", "in", "services", ":", "if", "service...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Logging.add_to_manifest
Add to the manifest to make sure it is bound to the application.
predix/admin/logstash.py
def add_to_manifest(self, manifest): """ Add to the manifest to make sure it is bound to the application. """ manifest.add_service(self.service.name) manifest.write_manifest()
def add_to_manifest(self, manifest): """ Add to the manifest to make sure it is bound to the application. """ manifest.add_service(self.service.name) manifest.write_manifest()
[ "Add", "to", "the", "manifest", "to", "make", "sure", "it", "is", "bound", "to", "the", "application", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/logstash.py#L54-L60
[ "def", "add_to_manifest", "(", "self", ",", "manifest", ")", ":", "manifest", ".", "add_service", "(", "self", ".", "service", ".", "name", ")", "manifest", ".", "write_manifest", "(", ")" ]
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Asset._get_zone_id
Returns the Predix Zone Id for the service that is a required header in service calls.
predix/data/asset.py
def _get_zone_id(self): """ Returns the Predix Zone Id for the service that is a required header in service calls. """ if 'VCAP_SERVICES' in os.environ: services = json.loads(os.getenv('VCAP_SERVICES')) predix_asset = services['predix-asset'][0]['credentia...
def _get_zone_id(self): """ Returns the Predix Zone Id for the service that is a required header in service calls. """ if 'VCAP_SERVICES' in os.environ: services = json.loads(os.getenv('VCAP_SERVICES')) predix_asset = services['predix-asset'][0]['credentia...
[ "Returns", "the", "Predix", "Zone", "Id", "for", "the", "service", "that", "is", "a", "required", "header", "in", "service", "calls", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/asset.py#L39-L49
[ "def", "_get_zone_id", "(", "self", ")", ":", "if", "'VCAP_SERVICES'", "in", "os", ".", "environ", ":", "services", "=", "json", ".", "loads", "(", "os", ".", "getenv", "(", "'VCAP_SERVICES'", ")", ")", "predix_asset", "=", "services", "[", "'predix-asset'...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Asset.get_collections
Returns a flat list of the names of collections in the asset service. .. ['wind-turbines', 'jet-engines']
predix/data/asset.py
def get_collections(self): """ Returns a flat list of the names of collections in the asset service. .. ['wind-turbines', 'jet-engines'] """ collections = [] for result in self._get_collections(): collections.append(result['collection'])...
def get_collections(self): """ Returns a flat list of the names of collections in the asset service. .. ['wind-turbines', 'jet-engines'] """ collections = [] for result in self._get_collections(): collections.append(result['collection'])...
[ "Returns", "a", "flat", "list", "of", "the", "names", "of", "collections", "in", "the", "asset", "service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/asset.py#L70-L84
[ "def", "get_collections", "(", "self", ")", ":", "collections", "=", "[", "]", "for", "result", "in", "self", ".", "_get_collections", "(", ")", ":", "collections", ".", "append", "(", "result", "[", "'collection'", "]", ")", "return", "collections" ]
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Asset.get_collection
Returns a specific collection from the asset service with the given collection endpoint. Supports passing through parameters such as... - filters such as "name=Vesuvius" following GEL spec - fields such as "uri,description" comma delimited - page_size such as "100" (the default)
predix/data/asset.py
def get_collection(self, collection, filter=None, fields=None, page_size=None): """ Returns a specific collection from the asset service with the given collection endpoint. Supports passing through parameters such as... - filters such as "name=Vesuvius" following GEL...
def get_collection(self, collection, filter=None, fields=None, page_size=None): """ Returns a specific collection from the asset service with the given collection endpoint. Supports passing through parameters such as... - filters such as "name=Vesuvius" following GEL...
[ "Returns", "a", "specific", "collection", "from", "the", "asset", "service", "with", "the", "given", "collection", "endpoint", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/asset.py#L86-L107
[ "def", "get_collection", "(", "self", ",", "collection", ",", "filter", "=", "None", ",", "fields", "=", "None", ",", "page_size", "=", "None", ")", ":", "params", "=", "{", "}", "if", "filter", ":", "params", "[", "'filter'", "]", "=", "filter", "if...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Asset.create_guid
Returns a new guid for use in posting a new asset to a collection.
predix/data/asset.py
def create_guid(self, collection=None): """ Returns a new guid for use in posting a new asset to a collection. """ guid = str(uuid.uuid4()) if collection: return str.join('/', [collection, guid]) else: return guid
def create_guid(self, collection=None): """ Returns a new guid for use in posting a new asset to a collection. """ guid = str(uuid.uuid4()) if collection: return str.join('/', [collection, guid]) else: return guid
[ "Returns", "a", "new", "guid", "for", "use", "in", "posting", "a", "new", "asset", "to", "a", "collection", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/asset.py#L109-L117
[ "def", "create_guid", "(", "self", ",", "collection", "=", "None", ")", ":", "guid", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "if", "collection", ":", "return", "str", ".", "join", "(", "'/'", ",", "[", "collection", ",", "guid", "]", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Asset.post_collection
Creates a new collection. This is mostly just transport layer and passes collection and body along. It presumes the body already has generated. The collection is *not* expected to have the id.
predix/data/asset.py
def post_collection(self, collection, body): """ Creates a new collection. This is mostly just transport layer and passes collection and body along. It presumes the body already has generated. The collection is *not* expected to have the id. """ assert isinstan...
def post_collection(self, collection, body): """ Creates a new collection. This is mostly just transport layer and passes collection and body along. It presumes the body already has generated. The collection is *not* expected to have the id. """ assert isinstan...
[ "Creates", "a", "new", "collection", ".", "This", "is", "mostly", "just", "transport", "layer", "and", "passes", "collection", "and", "body", "along", ".", "It", "presumes", "the", "body", "already", "has", "generated", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/asset.py#L119-L130
[ "def", "post_collection", "(", "self", ",", "collection", ",", "body", ")", ":", "assert", "isinstance", "(", "body", ",", "(", "list", ")", ")", ",", "\"POST requires body to be a list\"", "assert", "collection", ".", "startswith", "(", "'/'", ")", ",", "\"...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Asset.put_collection
Updates an existing collection. The collection being updated *is* expected to include the id.
predix/data/asset.py
def put_collection(self, collection, body): """ Updates an existing collection. The collection being updated *is* expected to include the id. """ uri = self.uri + '/v1' + collection return self.service._put(uri, body)
def put_collection(self, collection, body): """ Updates an existing collection. The collection being updated *is* expected to include the id. """ uri = self.uri + '/v1' + collection return self.service._put(uri, body)
[ "Updates", "an", "existing", "collection", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/asset.py#L132-L140
[ "def", "put_collection", "(", "self", ",", "collection", ",", "body", ")", ":", "uri", "=", "self", ".", "uri", "+", "'/v1'", "+", "collection", "return", "self", ".", "service", ".", "_put", "(", "uri", ",", "body", ")" ]
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Asset.delete_collection
Deletes an existing collection. The collection being updated *is* expected to include the id.
predix/data/asset.py
def delete_collection(self, collection): """ Deletes an existing collection. The collection being updated *is* expected to include the id. """ uri = str.join('/', [self.uri, collection]) return self.service._delete(uri)
def delete_collection(self, collection): """ Deletes an existing collection. The collection being updated *is* expected to include the id. """ uri = str.join('/', [self.uri, collection]) return self.service._delete(uri)
[ "Deletes", "an", "existing", "collection", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/asset.py#L142-L149
[ "def", "delete_collection", "(", "self", ",", "collection", ")", ":", "uri", "=", "str", ".", "join", "(", "'/'", ",", "[", "self", ".", "uri", ",", "collection", "]", ")", "return", "self", ".", "service", ".", "_delete", "(", "uri", ")" ]
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Asset.patch_collection
Will make specific updates to a record based on JSON Patch documentation. https://tools.ietf.org/html/rfc6902 the format of changes is something like:: [{ 'op': 'add', 'path': '/newfield', 'value': 'just added' }]
predix/data/asset.py
def patch_collection(self, collection, changes): """ Will make specific updates to a record based on JSON Patch documentation. https://tools.ietf.org/html/rfc6902 the format of changes is something like:: [{ 'op': 'add', 'path': ...
def patch_collection(self, collection, changes): """ Will make specific updates to a record based on JSON Patch documentation. https://tools.ietf.org/html/rfc6902 the format of changes is something like:: [{ 'op': 'add', 'path': ...
[ "Will", "make", "specific", "updates", "to", "a", "record", "based", "on", "JSON", "Patch", "documentation", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/asset.py#L151-L168
[ "def", "patch_collection", "(", "self", ",", "collection", ",", "changes", ")", ":", "uri", "=", "str", ".", "join", "(", "'/'", ",", "[", "self", ".", "uri", ",", "collection", "]", ")", "return", "self", ".", "service", ".", "_patch", "(", "uri", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Asset.save
Save an asset collection to the service.
predix/data/asset.py
def save(self, collection): """ Save an asset collection to the service. """ assert isinstance(collection, predix.data.asset.AssetCollection), "Expected AssetCollection" collection.validate() self.put_collection(collection.uri, collection.__dict__)
def save(self, collection): """ Save an asset collection to the service. """ assert isinstance(collection, predix.data.asset.AssetCollection), "Expected AssetCollection" collection.validate() self.put_collection(collection.uri, collection.__dict__)
[ "Save", "an", "asset", "collection", "to", "the", "service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/asset.py#L212-L218
[ "def", "save", "(", "self", ",", "collection", ")", ":", "assert", "isinstance", "(", "collection", ",", "predix", ".", "data", ".", "asset", ".", "AssetCollection", ")", ",", "\"Expected AssetCollection\"", "collection", ".", "validate", "(", ")", "self", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.create_manifest_from_space
Populate a manifest file generated from details from the cloud foundry space environment.
predix/admin/app.py
def create_manifest_from_space(self): """ Populate a manifest file generated from details from the cloud foundry space environment. """ space = predix.admin.cf.spaces.Space() summary = space.get_space_summary() for instance in summary['services']: ser...
def create_manifest_from_space(self): """ Populate a manifest file generated from details from the cloud foundry space environment. """ space = predix.admin.cf.spaces.Space() summary = space.get_space_summary() for instance in summary['services']: ser...
[ "Populate", "a", "manifest", "file", "generated", "from", "details", "from", "the", "cloud", "foundry", "space", "environment", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L40-L58
[ "def", "create_manifest_from_space", "(", "self", ")", ":", "space", "=", "predix", ".", "admin", ".", "cf", ".", "spaces", ".", "Space", "(", ")", "summary", "=", "space", ".", "get_space_summary", "(", ")", "for", "instance", "in", "summary", "[", "'se...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.lock_to_org_space
Lock the manifest to the current organization and space regardless of Cloud Foundry target.
predix/admin/app.py
def lock_to_org_space(self): """ Lock the manifest to the current organization and space regardless of Cloud Foundry target. """ self.add_env_var('PREDIX_ORGANIZATION_GUID', self.space.org.guid) self.add_env_var('PREDIX_ORGANIZATION_NAME', self.space.org.name) sel...
def lock_to_org_space(self): """ Lock the manifest to the current organization and space regardless of Cloud Foundry target. """ self.add_env_var('PREDIX_ORGANIZATION_GUID', self.space.org.guid) self.add_env_var('PREDIX_ORGANIZATION_NAME', self.space.org.name) sel...
[ "Lock", "the", "manifest", "to", "the", "current", "organization", "and", "space", "regardless", "of", "Cloud", "Foundry", "target", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L60-L69
[ "def", "lock_to_org_space", "(", "self", ")", ":", "self", ".", "add_env_var", "(", "'PREDIX_ORGANIZATION_GUID'", ",", "self", ".", "space", ".", "org", ".", "guid", ")", "self", ".", "add_env_var", "(", "'PREDIX_ORGANIZATION_NAME'", ",", "self", ".", "space",...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.create_uaa
Creates an instance of UAA Service. :param admin_secret: The secret password for administering the service such as adding clients and users.
predix/admin/app.py
def create_uaa(self, admin_secret, **kwargs): """ Creates an instance of UAA Service. :param admin_secret: The secret password for administering the service such as adding clients and users. """ uaa = predix.admin.uaa.UserAccountAuthentication(**kwargs) if no...
def create_uaa(self, admin_secret, **kwargs): """ Creates an instance of UAA Service. :param admin_secret: The secret password for administering the service such as adding clients and users. """ uaa = predix.admin.uaa.UserAccountAuthentication(**kwargs) if no...
[ "Creates", "an", "instance", "of", "UAA", "Service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L71-L83
[ "def", "create_uaa", "(", "self", ",", "admin_secret", ",", "*", "*", "kwargs", ")", ":", "uaa", "=", "predix", ".", "admin", ".", "uaa", ".", "UserAccountAuthentication", "(", "*", "*", "kwargs", ")", "if", "not", "uaa", ".", "exists", "(", ")", ":"...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.create_client
Create a client and add it to the manifest. :param client_id: The client id used to authenticate as a client in UAA. :param client_secret: The secret password used by a client to authenticate and generate a UAA token. :param uaa: The UAA to create client with
predix/admin/app.py
def create_client(self, client_id=None, client_secret=None, uaa=None): """ Create a client and add it to the manifest. :param client_id: The client id used to authenticate as a client in UAA. :param client_secret: The secret password used by a client to authenti...
def create_client(self, client_id=None, client_secret=None, uaa=None): """ Create a client and add it to the manifest. :param client_id: The client id used to authenticate as a client in UAA. :param client_secret: The secret password used by a client to authenti...
[ "Create", "a", "client", "and", "add", "it", "to", "the", "manifest", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L85-L109
[ "def", "create_client", "(", "self", ",", "client_id", "=", "None", ",", "client_secret", "=", "None", ",", "uaa", "=", "None", ")", ":", "if", "not", "uaa", ":", "uaa", "=", "predix", ".", "admin", ".", "uaa", ".", "UserAccountAuthentication", "(", ")...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.create_timeseries
Creates an instance of the Time Series Service.
predix/admin/app.py
def create_timeseries(self, **kwargs): """ Creates an instance of the Time Series Service. """ ts = predix.admin.timeseries.TimeSeries(**kwargs) ts.create() client_id = self.get_client_id() if client_id: ts.grant_client(client_id) ts.add_to_m...
def create_timeseries(self, **kwargs): """ Creates an instance of the Time Series Service. """ ts = predix.admin.timeseries.TimeSeries(**kwargs) ts.create() client_id = self.get_client_id() if client_id: ts.grant_client(client_id) ts.add_to_m...
[ "Creates", "an", "instance", "of", "the", "Time", "Series", "Service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L111-L123
[ "def", "create_timeseries", "(", "self", ",", "*", "*", "kwargs", ")", ":", "ts", "=", "predix", ".", "admin", ".", "timeseries", ".", "TimeSeries", "(", "*", "*", "kwargs", ")", "ts", ".", "create", "(", ")", "client_id", "=", "self", ".", "get_clie...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.create_asset
Creates an instance of the Asset Service.
predix/admin/app.py
def create_asset(self, **kwargs): """ Creates an instance of the Asset Service. """ asset = predix.admin.asset.Asset(**kwargs) asset.create() client_id = self.get_client_id() if client_id: asset.grant_client(client_id) asset.add_to_manifest(s...
def create_asset(self, **kwargs): """ Creates an instance of the Asset Service. """ asset = predix.admin.asset.Asset(**kwargs) asset.create() client_id = self.get_client_id() if client_id: asset.grant_client(client_id) asset.add_to_manifest(s...
[ "Creates", "an", "instance", "of", "the", "Asset", "Service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L125-L137
[ "def", "create_asset", "(", "self", ",", "*", "*", "kwargs", ")", ":", "asset", "=", "predix", ".", "admin", ".", "asset", ".", "Asset", "(", "*", "*", "kwargs", ")", "asset", ".", "create", "(", ")", "client_id", "=", "self", ".", "get_client_id", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.create_acs
Creates an instance of the Asset Service.
predix/admin/app.py
def create_acs(self, **kwargs): """ Creates an instance of the Asset Service. """ acs = predix.admin.acs.AccessControl(**kwargs) acs.create() client_id = self.get_client_id() if client_id: acs.grant_client(client_id) acs.grant_client(client_i...
def create_acs(self, **kwargs): """ Creates an instance of the Asset Service. """ acs = predix.admin.acs.AccessControl(**kwargs) acs.create() client_id = self.get_client_id() if client_id: acs.grant_client(client_id) acs.grant_client(client_i...
[ "Creates", "an", "instance", "of", "the", "Asset", "Service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L139-L152
[ "def", "create_acs", "(", "self", ",", "*", "*", "kwargs", ")", ":", "acs", "=", "predix", ".", "admin", ".", "acs", ".", "AccessControl", "(", "*", "*", "kwargs", ")", "acs", ".", "create", "(", ")", "client_id", "=", "self", ".", "get_client_id", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.create_weather
Creates an instance of the Asset Service.
predix/admin/app.py
def create_weather(self, **kwargs): """ Creates an instance of the Asset Service. """ weather = predix.admin.weather.WeatherForecast(**kwargs) weather.create() client_id = self.get_client_id() if client_id: weather.grant_client(client_id) wea...
def create_weather(self, **kwargs): """ Creates an instance of the Asset Service. """ weather = predix.admin.weather.WeatherForecast(**kwargs) weather.create() client_id = self.get_client_id() if client_id: weather.grant_client(client_id) wea...
[ "Creates", "an", "instance", "of", "the", "Asset", "Service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L154-L167
[ "def", "create_weather", "(", "self", ",", "*", "*", "kwargs", ")", ":", "weather", "=", "predix", ".", "admin", ".", "weather", ".", "WeatherForecast", "(", "*", "*", "kwargs", ")", "weather", ".", "create", "(", ")", "client_id", "=", "self", ".", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.create_blobstore
Creates an instance of the BlobStore Service.
predix/admin/app.py
def create_blobstore(self, **kwargs): """ Creates an instance of the BlobStore Service. """ blobstore = predix.admin.blobstore.BlobStore(**kwargs) blobstore.create() blobstore.add_to_manifest(self) return blobstore
def create_blobstore(self, **kwargs): """ Creates an instance of the BlobStore Service. """ blobstore = predix.admin.blobstore.BlobStore(**kwargs) blobstore.create() blobstore.add_to_manifest(self) return blobstore
[ "Creates", "an", "instance", "of", "the", "BlobStore", "Service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L169-L177
[ "def", "create_blobstore", "(", "self", ",", "*", "*", "kwargs", ")", ":", "blobstore", "=", "predix", ".", "admin", ".", "blobstore", ".", "BlobStore", "(", "*", "*", "kwargs", ")", "blobstore", ".", "create", "(", ")", "blobstore", ".", "add_to_manifes...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.create_logstash
Creates an instance of the Logging Service.
predix/admin/app.py
def create_logstash(self, **kwargs): """ Creates an instance of the Logging Service. """ logstash = predix.admin.logstash.Logging(**kwargs) logstash.create() logstash.add_to_manifest(self) logging.info('Install Kibana-Me-Logs application by following GitHub instr...
def create_logstash(self, **kwargs): """ Creates an instance of the Logging Service. """ logstash = predix.admin.logstash.Logging(**kwargs) logstash.create() logstash.add_to_manifest(self) logging.info('Install Kibana-Me-Logs application by following GitHub instr...
[ "Creates", "an", "instance", "of", "the", "Logging", "Service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L179-L190
[ "def", "create_logstash", "(", "self", ",", "*", "*", "kwargs", ")", ":", "logstash", "=", "predix", ".", "admin", ".", "logstash", ".", "Logging", "(", "*", "*", "kwargs", ")", "logstash", ".", "create", "(", ")", "logstash", ".", "add_to_manifest", "...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.create_cache
Creates an instance of the Cache Service.
predix/admin/app.py
def create_cache(self, **kwargs): """ Creates an instance of the Cache Service. """ cache = predix.admin.cache.Cache(**kwargs) cache.create(**kwargs) cache.add_to_manifest(self) return cache
def create_cache(self, **kwargs): """ Creates an instance of the Cache Service. """ cache = predix.admin.cache.Cache(**kwargs) cache.create(**kwargs) cache.add_to_manifest(self) return cache
[ "Creates", "an", "instance", "of", "the", "Cache", "Service", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L192-L199
[ "def", "create_cache", "(", "self", ",", "*", "*", "kwargs", ")", ":", "cache", "=", "predix", ".", "admin", ".", "cache", ".", "Cache", "(", "*", "*", "kwargs", ")", "cache", ".", "create", "(", "*", "*", "kwargs", ")", "cache", ".", "add_to_manif...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.create_eventhub
todo make it so the client can be customised to publish/subscribe Creates an instance of eventhub service
predix/admin/app.py
def create_eventhub(self, **kwargs): """ todo make it so the client can be customised to publish/subscribe Creates an instance of eventhub service """ eventhub = predix.admin.eventhub.EventHub(**kwargs) eventhub.create() eventhub.add_to_manifest(self) even...
def create_eventhub(self, **kwargs): """ todo make it so the client can be customised to publish/subscribe Creates an instance of eventhub service """ eventhub = predix.admin.eventhub.EventHub(**kwargs) eventhub.create() eventhub.add_to_manifest(self) even...
[ "todo", "make", "it", "so", "the", "client", "can", "be", "customised", "to", "publish", "/", "subscribe", "Creates", "an", "instance", "of", "eventhub", "service" ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L209-L219
[ "def", "create_eventhub", "(", "self", ",", "*", "*", "kwargs", ")", ":", "eventhub", "=", "predix", ".", "admin", ".", "eventhub", ".", "EventHub", "(", "*", "*", "kwargs", ")", "eventhub", ".", "create", "(", ")", "eventhub", ".", "add_to_manifest", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Manifest.get_service_marketplace
Returns a list of service names. Can return all services, just those supported by PredixPy, or just those not yet supported by PredixPy. :param available: Return the services that are available in PredixPy. (Defaults to True) :param unavailable: Return the services that a...
predix/admin/app.py
def get_service_marketplace(self, available=True, unavailable=False, deprecated=False): """ Returns a list of service names. Can return all services, just those supported by PredixPy, or just those not yet supported by PredixPy. :param available: Return the services...
def get_service_marketplace(self, available=True, unavailable=False, deprecated=False): """ Returns a list of service names. Can return all services, just those supported by PredixPy, or just those not yet supported by PredixPy. :param available: Return the services...
[ "Returns", "a", "list", "of", "service", "names", ".", "Can", "return", "all", "services", "just", "those", "supported", "by", "PredixPy", "or", "just", "those", "not", "yet", "supported", "by", "PredixPy", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/app.py#L222-L250
[ "def", "get_service_marketplace", "(", "self", ",", "available", "=", "True", ",", "unavailable", "=", "False", ",", "deprecated", "=", "False", ")", ":", "supported", "=", "set", "(", "self", ".", "supported", ".", "keys", "(", ")", ")", "all_services", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service._auto_authenticate
If we are in an app context we can authenticate immediately.
predix/service.py
def _auto_authenticate(self): """ If we are in an app context we can authenticate immediately. """ client_id = predix.config.get_env_value(predix.app.Manifest, 'client_id') client_secret = predix.config.get_env_value(predix.app.Manifest, 'client_secret') if client_id and...
def _auto_authenticate(self): """ If we are in an app context we can authenticate immediately. """ client_id = predix.config.get_env_value(predix.app.Manifest, 'client_id') client_secret = predix.config.get_env_value(predix.app.Manifest, 'client_secret') if client_id and...
[ "If", "we", "are", "in", "an", "app", "context", "we", "can", "authenticate", "immediately", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/service.py#L29-L38
[ "def", "_auto_authenticate", "(", "self", ")", ":", "client_id", "=", "predix", ".", "config", ".", "get_env_value", "(", "predix", ".", "app", ".", "Manifest", ",", "'client_id'", ")", "client_secret", "=", "predix", ".", "config", ".", "get_env_value", "("...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service._get
Simple GET request for a given path.
predix/service.py
def _get(self, uri, params=None, headers=None): """ Simple GET request for a given path. """ if not headers: headers = self._get_headers() logging.debug("URI=" + str(uri)) logging.debug("HEADERS=" + str(headers)) response = self.session.get(uri, head...
def _get(self, uri, params=None, headers=None): """ Simple GET request for a given path. """ if not headers: headers = self._get_headers() logging.debug("URI=" + str(uri)) logging.debug("HEADERS=" + str(headers)) response = self.session.get(uri, head...
[ "Simple", "GET", "request", "for", "a", "given", "path", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/service.py#L58-L74
[ "def", "_get", "(", "self", ",", "uri", ",", "params", "=", "None", ",", "headers", "=", "None", ")", ":", "if", "not", "headers", ":", "headers", "=", "self", ".", "_get_headers", "(", ")", "logging", ".", "debug", "(", "\"URI=\"", "+", "str", "("...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service._post
Simple POST request for a given path.
predix/service.py
def _post(self, uri, data): """ Simple POST request for a given path. """ headers = self._get_headers() logging.debug("URI=" + str(uri)) logging.debug("BODY=" + json.dumps(data)) response = self.session.post(uri, headers=headers, data=json.dumps(...
def _post(self, uri, data): """ Simple POST request for a given path. """ headers = self._get_headers() logging.debug("URI=" + str(uri)) logging.debug("BODY=" + json.dumps(data)) response = self.session.post(uri, headers=headers, data=json.dumps(...
[ "Simple", "POST", "request", "for", "a", "given", "path", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/service.py#L76-L94
[ "def", "_post", "(", "self", ",", "uri", ",", "data", ")", ":", "headers", "=", "self", ".", "_get_headers", "(", ")", "logging", ".", "debug", "(", "\"URI=\"", "+", "str", "(", "uri", ")", ")", "logging", ".", "debug", "(", "\"BODY=\"", "+", "json...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service._put
Simple PUT operation for a given path.
predix/service.py
def _put(self, uri, data): """ Simple PUT operation for a given path. """ headers = self._get_headers() logging.debug("URI=" + str(uri)) logging.debug("BODY=" + json.dumps(data)) response = self.session.put(uri, headers=headers, data=json.dumps(d...
def _put(self, uri, data): """ Simple PUT operation for a given path. """ headers = self._get_headers() logging.debug("URI=" + str(uri)) logging.debug("BODY=" + json.dumps(data)) response = self.session.put(uri, headers=headers, data=json.dumps(d...
[ "Simple", "PUT", "operation", "for", "a", "given", "path", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/service.py#L96-L111
[ "def", "_put", "(", "self", ",", "uri", ",", "data", ")", ":", "headers", "=", "self", ".", "_get_headers", "(", ")", "logging", ".", "debug", "(", "\"URI=\"", "+", "str", "(", "uri", ")", ")", "logging", ".", "debug", "(", "\"BODY=\"", "+", "json"...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service._delete
Simple DELETE operation for a given path.
predix/service.py
def _delete(self, uri): """ Simple DELETE operation for a given path. """ headers = self._get_headers() response = self.session.delete(uri, headers=headers) # Will return a 204 on successful delete if response.status_code == 204: return response ...
def _delete(self, uri): """ Simple DELETE operation for a given path. """ headers = self._get_headers() response = self.session.delete(uri, headers=headers) # Will return a 204 on successful delete if response.status_code == 204: return response ...
[ "Simple", "DELETE", "operation", "for", "a", "given", "path", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/service.py#L113-L126
[ "def", "_delete", "(", "self", ",", "uri", ")", ":", "headers", "=", "self", ".", "_get_headers", "(", ")", "response", "=", "self", ".", "session", ".", "delete", "(", "uri", ",", "headers", "=", "headers", ")", "# Will return a 204 on successful delete", ...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
Service._patch
Simple PATCH operation for a given path. The body is expected to list operations to perform to update the data. Operations include: - add - remove - replace - move - copy - test [ { "op": "test", "path": "/a/...
predix/service.py
def _patch(self, uri, data): """ Simple PATCH operation for a given path. The body is expected to list operations to perform to update the data. Operations include: - add - remove - replace - move - copy - test ...
def _patch(self, uri, data): """ Simple PATCH operation for a given path. The body is expected to list operations to perform to update the data. Operations include: - add - remove - replace - move - copy - test ...
[ "Simple", "PATCH", "operation", "for", "a", "given", "path", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/service.py#L128-L154
[ "def", "_patch", "(", "self", ",", "uri", ",", "data", ")", ":", "headers", "=", "self", ".", "_get_headers", "(", ")", "response", "=", "self", ".", "session", ".", "patch", "(", "uri", ",", "headers", "=", "headers", ",", "data", "=", "json", "."...
a0cb34cf40f716229351bb6d90d6ecace958c81f
train
AccessControl._get_resource_uri
Returns the full path that uniquely identifies the resource endpoint.
predix/security/acs.py
def _get_resource_uri(self, guid=None): """ Returns the full path that uniquely identifies the resource endpoint. """ uri = self.uri + '/v1/resource' if guid: uri += '/' + urllib.quote_plus(guid) return uri
def _get_resource_uri(self, guid=None): """ Returns the full path that uniquely identifies the resource endpoint. """ uri = self.uri + '/v1/resource' if guid: uri += '/' + urllib.quote_plus(guid) return uri
[ "Returns", "the", "full", "path", "that", "uniquely", "identifies", "the", "resource", "endpoint", "." ]
PredixDev/predixpy
python
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/security/acs.py#L64-L72
[ "def", "_get_resource_uri", "(", "self", ",", "guid", "=", "None", ")", ":", "uri", "=", "self", ".", "uri", "+", "'/v1/resource'", "if", "guid", ":", "uri", "+=", "'/'", "+", "urllib", ".", "quote_plus", "(", "guid", ")", "return", "uri" ]
a0cb34cf40f716229351bb6d90d6ecace958c81f