body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
62bab643c46b986a53bb5287e1cfb008cb137483535dae57e520b0c9aa4c1647
def __init__(self, company, username, password, base_url=None): '\n Initializes the connection using a company, username and password with API access\n\n :param company: Company\n :param username: Username\n :param password: Password\n :param base_url: Base URL if you have it already. Without it, init method will fetch it when you initialize the\n connection.\n ' self.username = ('%s\\%s' % (company, username)) self.password = password self.auth = requests.auth.HTTPBasicAuth(self.username, self.password) if (not base_url): self.base_url = self.get_base_url(self.auth) else: self.base_url = base_url
Initializes the connection using a company, username and password with API access :param company: Company :param username: Username :param password: Password :param base_url: Base URL if you have it already. Without it, init method will fetch it when you initialize the connection.
eloqua/eloqua.py
__init__
jnorton2/Eloqua
1
python
def __init__(self, company, username, password, base_url=None): '\n Initializes the connection using a company, username and password with API access\n\n :param company: Company\n :param username: Username\n :param password: Password\n :param base_url: Base URL if you have it already. Without it, init method will fetch it when you initialize the\n connection.\n ' self.username = ('%s\\%s' % (company, username)) self.password = password self.auth = requests.auth.HTTPBasicAuth(self.username, self.password) if (not base_url): self.base_url = self.get_base_url(self.auth) else: self.base_url = base_url
def __init__(self, company, username, password, base_url=None): '\n Initializes the connection using a company, username and password with API access\n\n :param company: Company\n :param username: Username\n :param password: Password\n :param base_url: Base URL if you have it already. Without it, init method will fetch it when you initialize the\n connection.\n ' self.username = ('%s\\%s' % (company, username)) self.password = password self.auth = requests.auth.HTTPBasicAuth(self.username, self.password) if (not base_url): self.base_url = self.get_base_url(self.auth) else: self.base_url = base_url<|docstring|>Initializes the connection using a company, username and password with API access :param company: Company :param username: Username :param password: Password :param base_url: Base URL if you have it already. Without it, init method will fetch it when you initialize the connection.<|endoftext|>
7246cf12993be90533b96f9899b32a9ecc4c174f7d3844206f318f7ffc01af08
@staticmethod def get_base_url(auth, login_url=DEFAULT_LOGIN_URL): '\n Gets the base_url if there is none defined\n\n :param auth: Authentication object\n :param login_url: Login url to use. Default is provided in paths.py\n :return: Returns the base url of the instance\n ' response = requests.get(login_url, auth=auth, headers={'accept': 'application/json'}) try: resp_json = response.json() base_url = resp_json['urls']['base'] return base_url except TypeError: raise EloquaConnectionException('Could not authenticate with eloqua. Please check credentials')
Gets the base_url if there is none defined :param auth: Authentication object :param login_url: Login url to use. Default is provided in paths.py :return: Returns the base url of the instance
eloqua/eloqua.py
get_base_url
jnorton2/Eloqua
1
python
@staticmethod def get_base_url(auth, login_url=DEFAULT_LOGIN_URL): '\n Gets the base_url if there is none defined\n\n :param auth: Authentication object\n :param login_url: Login url to use. Default is provided in paths.py\n :return: Returns the base url of the instance\n ' response = requests.get(login_url, auth=auth, headers={'accept': 'application/json'}) try: resp_json = response.json() base_url = resp_json['urls']['base'] return base_url except TypeError: raise EloquaConnectionException('Could not authenticate with eloqua. Please check credentials')
@staticmethod def get_base_url(auth, login_url=DEFAULT_LOGIN_URL): '\n Gets the base_url if there is none defined\n\n :param auth: Authentication object\n :param login_url: Login url to use. Default is provided in paths.py\n :return: Returns the base url of the instance\n ' response = requests.get(login_url, auth=auth, headers={'accept': 'application/json'}) try: resp_json = response.json() base_url = resp_json['urls']['base'] return base_url except TypeError: raise EloquaConnectionException('Could not authenticate with eloqua. Please check credentials')<|docstring|>Gets the base_url if there is none defined :param auth: Authentication object :param login_url: Login url to use. Default is provided in paths.py :return: Returns the base url of the instance<|endoftext|>
b2d3f0522913a4108a0d0d57a466a66a8216c4e56115d0d674a06f05161a2d2b
def request(self, path, http_method, data=None): '\n Does a raw eloqua request given a path and payload.\n\n :param path: API path. Ex: "/api/REST/2.0/assets/forms"\n :param http_method: Method to use. Ex: "POST", "GET", "PUT". Case does not matter\n :param data: Data to use in the request, parameters for get request, json for post\n\n :return: Returns the HTTP Response object from the request\n\n ' '' url = (self.base_url + path) logger.debug(('Request (%s) (%s) %s' % (http_method.lower(), path, ('with data' if data else 'without data')))) if (http_method.lower() == 'get'): response = requests.get(url, auth=self.auth, params=data) elif (http_method.lower() == 'post'): response = requests.post(url, auth=self.auth, json=data) elif (http_method.lower() == 'put'): response = requests.put(url, auth=self.auth, json=data) elif (http_method.lower() == 'delete'): response = requests.delete(url, auth=self.auth, params=data) else: raise EloquaInvalidUseageException(('Invalid request type %s' % http_method)) if (response.status_code == 404): raise EloquaRequestErrorNotFound(response) elif (response.status_code == 400): if (not response.content): response._content = ' !!!! No Content in the Error response from Eloqua !!!!\n If you are creating custom object data, this could be due to a field having the wrong data type (date, number)\n Eloqua is bad at telling us what the error is here.\n \n Helpful hints:\n -Dates need to be an integer value of a timestamp. Try using int(datetime.datetime.timestamp(some_date)) \n \n ' raise EloquaRequestError(response) elif (response.status_code > 300): raise EloquaRequestError(response) return response
Does a raw eloqua request given a path and payload. :param path: API path. Ex: "/api/REST/2.0/assets/forms" :param http_method: Method to use. Ex: "POST", "GET", "PUT". Case does not matter :param data: Data to use in the request, parameters for get request, json for post :return: Returns the HTTP Response object from the request
eloqua/eloqua.py
request
jnorton2/Eloqua
1
python
def request(self, path, http_method, data=None): '\n Does a raw eloqua request given a path and payload.\n\n :param path: API path. Ex: "/api/REST/2.0/assets/forms"\n :param http_method: Method to use. Ex: "POST", "GET", "PUT". Case does not matter\n :param data: Data to use in the request, parameters for get request, json for post\n\n :return: Returns the HTTP Response object from the request\n\n ' url = (self.base_url + path) logger.debug(('Request (%s) (%s) %s' % (http_method.lower(), path, ('with data' if data else 'without data')))) if (http_method.lower() == 'get'): response = requests.get(url, auth=self.auth, params=data) elif (http_method.lower() == 'post'): response = requests.post(url, auth=self.auth, json=data) elif (http_method.lower() == 'put'): response = requests.put(url, auth=self.auth, json=data) elif (http_method.lower() == 'delete'): response = requests.delete(url, auth=self.auth, params=data) else: raise EloquaInvalidUseageException(('Invalid request type %s' % http_method)) if (response.status_code == 404): raise EloquaRequestErrorNotFound(response) elif (response.status_code == 400): if (not response.content): response._content = ' !!!! No Content in the Error response from Eloqua !!!!\n If you are creating custom object data, this could be due to a field having the wrong data type (date, number)\n Eloqua is bad at telling us what the error is here.\n \n Helpful hints:\n -Dates need to be an integer value of a timestamp. Try using int(datetime.datetime.timestamp(some_date)) \n \n ' raise EloquaRequestError(response) elif (response.status_code > 300): raise EloquaRequestError(response) return response
def request(self, path, http_method, data=None): '\n Does a raw eloqua request given a path and payload.\n\n :param path: API path. Ex: "/api/REST/2.0/assets/forms"\n :param http_method: Method to use. Ex: "POST", "GET", "PUT". Case does not matter\n :param data: Data to use in the request, parameters for get request, json for post\n\n :return: Returns the HTTP Response object from the request\n\n ' url = (self.base_url + path) logger.debug(('Request (%s) (%s) %s' % (http_method.lower(), path, ('with data' if data else 'without data')))) if (http_method.lower() == 'get'): response = requests.get(url, auth=self.auth, params=data) elif (http_method.lower() == 'post'): response = requests.post(url, auth=self.auth, json=data) elif (http_method.lower() == 'put'): response = requests.put(url, auth=self.auth, json=data) elif (http_method.lower() == 'delete'): response = requests.delete(url, auth=self.auth, params=data) else: raise EloquaInvalidUseageException(('Invalid request type %s' % http_method)) if (response.status_code == 404): raise EloquaRequestErrorNotFound(response) elif (response.status_code == 400): if (not response.content): response._content = ' !!!! No Content in the Error response from Eloqua !!!!\n If you are creating custom object data, this could be due to a field having the wrong data type (date, number)\n Eloqua is bad at telling us what the error is here.\n \n Helpful hints:\n -Dates need to be an integer value of a timestamp. Try using int(datetime.datetime.timestamp(some_date)) \n \n ' raise EloquaRequestError(response) elif (response.status_code > 300): raise EloquaRequestError(response) return response<|docstring|>Does a raw eloqua request given a path and payload. :param path: API path. Ex: "/api/REST/2.0/assets/forms" :param http_method: Method to use. Ex: "POST", "GET", "PUT". Case does not matter :param data: Data to use in the request, parameters for get request, json for post :return: Returns the HTTP Response object from the request<|endoftext|>
0a26e6529159c6116da720d8deecf3de9e8dba84aa8b19e3562f21f211dfa55a
def generate_custom_object_code(self, custom_object_name=None, custom_object_id=None, class_name=None): '\n Generates the custom object class code given the name or id of the custom object and an optional class name\n\n :param custom_object_name: Name of the custom object to search for\n :param custom_object_id: Id of the custom object\n :param class_name: (optional) class name. Default will be the custom object name\n\n :return: code as a string for the custom object\n ' if custom_object_id: custom_object = self.get(CustomObject, asset_id=custom_object_id) else: custom_objects_with_name = self.get_list(CustomObject, {'search': ('name=%s' % custom_object_name), 'depth': 'complete'}) custom_object = custom_objects_with_name.data[0] code = self._generate_custom_object_class_code(custom_object.raw_data, class_name=class_name) return code
Generates the custom object class code given the name or id of the custom object and an optional class name :param custom_object_name: Name of the custom object to search for :param custom_object_id: Id of the custom object :param class_name: (optional) class name. Default will be the custom object name :return: code as a string for the custom object
eloqua/eloqua.py
generate_custom_object_code
jnorton2/Eloqua
1
python
def generate_custom_object_code(self, custom_object_name=None, custom_object_id=None, class_name=None): '\n Generates the custom object class code given the name or id of the custom object and an optional class name\n\n :param custom_object_name: Name of the custom object to search for\n :param custom_object_id: Id of the custom object\n :param class_name: (optional) class name. Default will be the custom object name\n\n :return: code as a string for the custom object\n ' if custom_object_id: custom_object = self.get(CustomObject, asset_id=custom_object_id) else: custom_objects_with_name = self.get_list(CustomObject, {'search': ('name=%s' % custom_object_name), 'depth': 'complete'}) custom_object = custom_objects_with_name.data[0] code = self._generate_custom_object_class_code(custom_object.raw_data, class_name=class_name) return code
def generate_custom_object_code(self, custom_object_name=None, custom_object_id=None, class_name=None): '\n Generates the custom object class code given the name or id of the custom object and an optional class name\n\n :param custom_object_name: Name of the custom object to search for\n :param custom_object_id: Id of the custom object\n :param class_name: (optional) class name. Default will be the custom object name\n\n :return: code as a string for the custom object\n ' if custom_object_id: custom_object = self.get(CustomObject, asset_id=custom_object_id) else: custom_objects_with_name = self.get_list(CustomObject, {'search': ('name=%s' % custom_object_name), 'depth': 'complete'}) custom_object = custom_objects_with_name.data[0] code = self._generate_custom_object_class_code(custom_object.raw_data, class_name=class_name) return code<|docstring|>Generates the custom object class code given the name or id of the custom object and an optional class name :param custom_object_name: Name of the custom object to search for :param custom_object_id: Id of the custom object :param class_name: (optional) class name. Default will be the custom object name :return: code as a string for the custom object<|endoftext|>
8a3a5df92a88b02b253c44241cc76dc0e01103297c99dfe27fff6f346be1698a
@classmethod def _generate_custom_object_class_code(cls, eloqua_response, class_name=None): '\n Generates the custom object class code given a custom object and a class name\n :param eloqua_response: Json response from eloqua for the custom object\n :param class_name: (optional) class name\n\n :return: the code for a python class for the Custom Object\n ' field_to_id_map = {} id_to_field_map = {} meta_fields = [] for field in eloqua_response.keys(): if (field != 'fields'): meta_fields.append(field) for field in eloqua_response['fields']: field_to_id_map[field['internalName']] = field['id'] id_to_field_map[field['id']] = field['internalName'] object_name = eloqua_response['name'] if (not class_name): class_name = object_name printable_fields_list = '' for field_name in field_to_id_map.keys(): printable_fields_list += ('\t%s = None\n' % field_name) rstring = ('class %s(%s):\n\tCDO_NAME = "%s"\n\tPARENT_ID = "%s"\n\tFIELDS = %s\n\tID_FIELD_MAP = %s\n\tMETA_FIELDS = %s \n%s\n ' % (class_name, CustomObjectModel.__name__, object_name, eloqua_response['id'], ('[%s]' % ', '.join((('"%s"' % x) for x in field_to_id_map.keys()))), json.dumps(id_to_field_map), json.dumps(meta_fields), printable_fields_list)) return rstring
Generates the custom object class code given a custom object and a class name :param eloqua_response: Json response from eloqua for the custom object :param class_name: (optional) class name :return: the code for a python class for the Custom Object
eloqua/eloqua.py
_generate_custom_object_class_code
jnorton2/Eloqua
1
python
@classmethod def _generate_custom_object_class_code(cls, eloqua_response, class_name=None): '\n Generates the custom object class code given a custom object and a class name\n :param eloqua_response: Json response from eloqua for the custom object\n :param class_name: (optional) class name\n\n :return: the code for a python class for the Custom Object\n ' field_to_id_map = {} id_to_field_map = {} meta_fields = [] for field in eloqua_response.keys(): if (field != 'fields'): meta_fields.append(field) for field in eloqua_response['fields']: field_to_id_map[field['internalName']] = field['id'] id_to_field_map[field['id']] = field['internalName'] object_name = eloqua_response['name'] if (not class_name): class_name = object_name printable_fields_list = for field_name in field_to_id_map.keys(): printable_fields_list += ('\t%s = None\n' % field_name) rstring = ('class %s(%s):\n\tCDO_NAME = "%s"\n\tPARENT_ID = "%s"\n\tFIELDS = %s\n\tID_FIELD_MAP = %s\n\tMETA_FIELDS = %s \n%s\n ' % (class_name, CustomObjectModel.__name__, object_name, eloqua_response['id'], ('[%s]' % ', '.join((('"%s"' % x) for x in field_to_id_map.keys()))), json.dumps(id_to_field_map), json.dumps(meta_fields), printable_fields_list)) return rstring
@classmethod def _generate_custom_object_class_code(cls, eloqua_response, class_name=None): '\n Generates the custom object class code given a custom object and a class name\n :param eloqua_response: Json response from eloqua for the custom object\n :param class_name: (optional) class name\n\n :return: the code for a python class for the Custom Object\n ' field_to_id_map = {} id_to_field_map = {} meta_fields = [] for field in eloqua_response.keys(): if (field != 'fields'): meta_fields.append(field) for field in eloqua_response['fields']: field_to_id_map[field['internalName']] = field['id'] id_to_field_map[field['id']] = field['internalName'] object_name = eloqua_response['name'] if (not class_name): class_name = object_name printable_fields_list = for field_name in field_to_id_map.keys(): printable_fields_list += ('\t%s = None\n' % field_name) rstring = ('class %s(%s):\n\tCDO_NAME = "%s"\n\tPARENT_ID = "%s"\n\tFIELDS = %s\n\tID_FIELD_MAP = %s\n\tMETA_FIELDS = %s \n%s\n ' % (class_name, CustomObjectModel.__name__, object_name, eloqua_response['id'], ('[%s]' % ', '.join((('"%s"' % x) for x in field_to_id_map.keys()))), json.dumps(id_to_field_map), json.dumps(meta_fields), printable_fields_list)) return rstring<|docstring|>Generates the custom object class code given a custom object and a class name :param eloqua_response: Json response from eloqua for the custom object :param class_name: (optional) class name :return: the code for a python class for the Custom Object<|endoftext|>
5f4581951262f9bd3df9732ff467ac037a18dfc4becfa16e5843771c3739b889
def get_custom_object_data(self, customObjectModel, record_id=None, query_params=None): '\n Fetches CDO records from eloqua provided a description of that data object. Can fetch 1 record if record id\n is provided.\n :param customObjectModel: CustomObjectModel for the object to be fetched (REQUIRED)\n :param record_id: single record id for single requests\n :param query_params: parameters included in a multi search request for example {"search" : "name=John", "count": 1}\n\n :return: The custom object data object or list of objects\n ' if (not issubclass(customObjectModel, CustomObjectModel)): raise EloquaInvalidUseageException('eloqua_custom_data_object must be a subclass of CustomObjectModel') if record_id: if query_params: logger.warning('calling EloquaConnection.get_custom_object_data() with a record_id and query params only returns the record with the record Id. IT DOES NOT USE THE QUERY PARAMS') resp = self.request(CUSTOM_OBJECT_DATA_GET_PATH.format(parent_id=customObjectModel.PARENT_ID, id=record_id), 'GET') return customObjectModel(resp) else: resp = self.request(CUSTOM_OBJECT_DATA_GET_LIST_PATH.format(parent_id=customObjectModel.PARENT_ID), 'GET', data=query_params) data = customObjectModel.from_list(resp) data_response = DataResponse(data=data, eloqua_response=resp) return data_response
Fetches CDO records from eloqua provided a description of that data object. Can fetch 1 record if record id is provided. :param customObjectModel: CustomObjectModel for the object to be fetched (REQUIRED) :param record_id: single record id for single requests :param query_params: parameters included in a multi search request for example {"search" : "name=John", "count": 1} :return: The custom object data object or list of objects
eloqua/eloqua.py
get_custom_object_data
jnorton2/Eloqua
1
python
def get_custom_object_data(self, customObjectModel, record_id=None, query_params=None): '\n Fetches CDO records from eloqua provided a description of that data object. Can fetch 1 record if record id\n is provided.\n :param customObjectModel: CustomObjectModel for the object to be fetched (REQUIRED)\n :param record_id: single record id for single requests\n :param query_params: parameters included in a multi search request for example {"search" : "name=John", "count": 1}\n\n :return: The custom object data object or list of objects\n ' if (not issubclass(customObjectModel, CustomObjectModel)): raise EloquaInvalidUseageException('eloqua_custom_data_object must be a subclass of CustomObjectModel') if record_id: if query_params: logger.warning('calling EloquaConnection.get_custom_object_data() with a record_id and query params only returns the record with the record Id. IT DOES NOT USE THE QUERY PARAMS') resp = self.request(CUSTOM_OBJECT_DATA_GET_PATH.format(parent_id=customObjectModel.PARENT_ID, id=record_id), 'GET') return customObjectModel(resp) else: resp = self.request(CUSTOM_OBJECT_DATA_GET_LIST_PATH.format(parent_id=customObjectModel.PARENT_ID), 'GET', data=query_params) data = customObjectModel.from_list(resp) data_response = DataResponse(data=data, eloqua_response=resp) return data_response
def get_custom_object_data(self, customObjectModel, record_id=None, query_params=None): '\n Fetches CDO records from eloqua provided a description of that data object. Can fetch 1 record if record id\n is provided.\n :param customObjectModel: CustomObjectModel for the object to be fetched (REQUIRED)\n :param record_id: single record id for single requests\n :param query_params: parameters included in a multi search request for example {"search" : "name=John", "count": 1}\n\n :return: The custom object data object or list of objects\n ' if (not issubclass(customObjectModel, CustomObjectModel)): raise EloquaInvalidUseageException('eloqua_custom_data_object must be a subclass of CustomObjectModel') if record_id: if query_params: logger.warning('calling EloquaConnection.get_custom_object_data() with a record_id and query params only returns the record with the record Id. IT DOES NOT USE THE QUERY PARAMS') resp = self.request(CUSTOM_OBJECT_DATA_GET_PATH.format(parent_id=customObjectModel.PARENT_ID, id=record_id), 'GET') return customObjectModel(resp) else: resp = self.request(CUSTOM_OBJECT_DATA_GET_LIST_PATH.format(parent_id=customObjectModel.PARENT_ID), 'GET', data=query_params) data = customObjectModel.from_list(resp) data_response = DataResponse(data=data, eloqua_response=resp) return data_response<|docstring|>Fetches CDO records from eloqua provided a description of that data object. Can fetch 1 record if record id is provided. :param customObjectModel: CustomObjectModel for the object to be fetched (REQUIRED) :param record_id: single record id for single requests :param query_params: parameters included in a multi search request for example {"search" : "name=John", "count": 1} :return: The custom object data object or list of objects<|endoftext|>
f0abe58fe1afb1aeb5ae06e1a7faa250d5d61dab17f14b07e3d2f38aea92d7d0
def get(self, objectClass, data_id, params={}): '\n Gets the object from eloqua using the objectClass as the type of object and the data id as the instance\n Includes the params in the request\n\n :param objectClass: An Asset class, CustomObjectModel etc\n :param data_id: Id string "501" for example\n :param params: (optional) additional parameters for the API request\n\n :return: An instance of the objectClass provided\n ' if issubclass(objectClass, Asset): resp = self.request(objectClass.get_path.format(id=data_id), 'GET', params) elif issubclass(objectClass, CustomObjectModel): params['depth'] = 'complete' resp = self.request(objectClass.get_path.format(parent_id=objectClass.PARENT_ID, id=data_id), 'GET', params) else: raise EloquaInvalidUseageException(('%s is not a valid class to use with this method' % objectClass)) return objectClass(resp)
Gets the object from eloqua using the objectClass as the type of object and the data id as the instance Includes the params in the request :param objectClass: An Asset class, CustomObjectModel etc :param data_id: Id string "501" for example :param params: (optional) additional parameters for the API request :return: An instance of the objectClass provided
eloqua/eloqua.py
get
jnorton2/Eloqua
1
python
def get(self, objectClass, data_id, params={}): '\n Gets the object from eloqua using the objectClass as the type of object and the data id as the instance\n Includes the params in the request\n\n :param objectClass: An Asset class, CustomObjectModel etc\n :param data_id: Id string "501" for example\n :param params: (optional) additional parameters for the API request\n\n :return: An instance of the objectClass provided\n ' if issubclass(objectClass, Asset): resp = self.request(objectClass.get_path.format(id=data_id), 'GET', params) elif issubclass(objectClass, CustomObjectModel): params['depth'] = 'complete' resp = self.request(objectClass.get_path.format(parent_id=objectClass.PARENT_ID, id=data_id), 'GET', params) else: raise EloquaInvalidUseageException(('%s is not a valid class to use with this method' % objectClass)) return objectClass(resp)
def get(self, objectClass, data_id, params={}): '\n Gets the object from eloqua using the objectClass as the type of object and the data id as the instance\n Includes the params in the request\n\n :param objectClass: An Asset class, CustomObjectModel etc\n :param data_id: Id string "501" for example\n :param params: (optional) additional parameters for the API request\n\n :return: An instance of the objectClass provided\n ' if issubclass(objectClass, Asset): resp = self.request(objectClass.get_path.format(id=data_id), 'GET', params) elif issubclass(objectClass, CustomObjectModel): params['depth'] = 'complete' resp = self.request(objectClass.get_path.format(parent_id=objectClass.PARENT_ID, id=data_id), 'GET', params) else: raise EloquaInvalidUseageException(('%s is not a valid class to use with this method' % objectClass)) return objectClass(resp)<|docstring|>Gets the object from eloqua using the objectClass as the type of object and the data id as the instance Includes the params in the request :param objectClass: An Asset class, CustomObjectModel etc :param data_id: Id string "501" for example :param params: (optional) additional parameters for the API request :return: An instance of the objectClass provided<|endoftext|>
fc977a9a1513c27eb67f55d22a337443d94067586f2468b6ca0026557f8b9eed
def get_list(self, objectClass, params=None): '\n Gets a list of Assets using the provided parameters for the API request\n\n :param objectClass: An Asset class, CustomObjectModel etc\n :param params: (optional) additional parameters for the API request\n\n :return: A DataResponse object\n ' if issubclass(objectClass, Asset): resp = self.request(objectClass.get_list_path, 'GET', params) elif issubclass(objectClass, CustomObjectModel): resp = self.request(objectClass.get_list_path.format(parent_id=objectClass.PARENT_ID), 'GET', params) else: raise EloquaInvalidUseageException(('%s is not a valid class to use with this method' % objectClass)) data = objectClass.from_list(resp) return DataResponse(data=data, eloqua_response=resp)
Gets a list of Assets using the provided parameters for the API request :param objectClass: An Asset class, CustomObjectModel etc :param params: (optional) additional parameters for the API request :return: A DataResponse object
eloqua/eloqua.py
get_list
jnorton2/Eloqua
1
python
def get_list(self, objectClass, params=None): '\n Gets a list of Assets using the provided parameters for the API request\n\n :param objectClass: An Asset class, CustomObjectModel etc\n :param params: (optional) additional parameters for the API request\n\n :return: A DataResponse object\n ' if issubclass(objectClass, Asset): resp = self.request(objectClass.get_list_path, 'GET', params) elif issubclass(objectClass, CustomObjectModel): resp = self.request(objectClass.get_list_path.format(parent_id=objectClass.PARENT_ID), 'GET', params) else: raise EloquaInvalidUseageException(('%s is not a valid class to use with this method' % objectClass)) data = objectClass.from_list(resp) return DataResponse(data=data, eloqua_response=resp)
def get_list(self, objectClass, params=None): '\n Gets a list of Assets using the provided parameters for the API request\n\n :param objectClass: An Asset class, CustomObjectModel etc\n :param params: (optional) additional parameters for the API request\n\n :return: A DataResponse object\n ' if issubclass(objectClass, Asset): resp = self.request(objectClass.get_list_path, 'GET', params) elif issubclass(objectClass, CustomObjectModel): resp = self.request(objectClass.get_list_path.format(parent_id=objectClass.PARENT_ID), 'GET', params) else: raise EloquaInvalidUseageException(('%s is not a valid class to use with this method' % objectClass)) data = objectClass.from_list(resp) return DataResponse(data=data, eloqua_response=resp)<|docstring|>Gets a list of Assets using the provided parameters for the API request :param objectClass: An Asset class, CustomObjectModel etc :param params: (optional) additional parameters for the API request :return: A DataResponse object<|endoftext|>
7f2dc8401cc199f0c437c72ebf0d22cce297f956a84426ca2f4a50d48f95da7a
def update(self, eloqua_object): '\n Updates an eloqua object\n\n :param eloqua_object: An instance of an Asset class or data object\n\n :return: Returns the response from eloqua\n ' if isinstance(eloqua_object, Asset): resp = self.request(eloqua_object.update_path.format(id=eloqua_object.id), 'PUT', data=eloqua_object.to_update_json()) elif isinstance(eloqua_object, CustomObjectModel): resp = self.request(eloqua_object.update_path.format(parent_id=eloqua_object.PARENT_ID, id=eloqua_object.id), 'PUT', data=eloqua_object.to_update_json()) else: raise EloquaInvalidUseageException(('%s is not a valid class to use with this method' % eloqua_object.__class__)) return resp
Updates an eloqua object :param eloqua_object: An instance of an Asset class or data object :return: Returns the response from eloqua
eloqua/eloqua.py
update
jnorton2/Eloqua
1
python
def update(self, eloqua_object): '\n Updates an eloqua object\n\n :param eloqua_object: An instance of an Asset class or data object\n\n :return: Returns the response from eloqua\n ' if isinstance(eloqua_object, Asset): resp = self.request(eloqua_object.update_path.format(id=eloqua_object.id), 'PUT', data=eloqua_object.to_update_json()) elif isinstance(eloqua_object, CustomObjectModel): resp = self.request(eloqua_object.update_path.format(parent_id=eloqua_object.PARENT_ID, id=eloqua_object.id), 'PUT', data=eloqua_object.to_update_json()) else: raise EloquaInvalidUseageException(('%s is not a valid class to use with this method' % eloqua_object.__class__)) return resp
def update(self, eloqua_object): '\n Updates an eloqua object\n\n :param eloqua_object: An instance of an Asset class or data object\n\n :return: Returns the response from eloqua\n ' if isinstance(eloqua_object, Asset): resp = self.request(eloqua_object.update_path.format(id=eloqua_object.id), 'PUT', data=eloqua_object.to_update_json()) elif isinstance(eloqua_object, CustomObjectModel): resp = self.request(eloqua_object.update_path.format(parent_id=eloqua_object.PARENT_ID, id=eloqua_object.id), 'PUT', data=eloqua_object.to_update_json()) else: raise EloquaInvalidUseageException(('%s is not a valid class to use with this method' % eloqua_object.__class__)) return resp<|docstring|>Updates an eloqua object :param eloqua_object: An instance of an Asset class or data object :return: Returns the response from eloqua<|endoftext|>
5e97279d7a4375c44fe105566997eb199265d4593080738d7fb5e4f041aeb66d
def delete(self, eloqua_object): '\n Deletes an eloqua object\n\n :param eloqua_object: An instance of an Asset class\n\n :return: Returns the response from eloqua\n ' if isinstance(eloqua_object, Asset): resp = self.request(eloqua_object.delete_path.format(id=eloqua_object.id), 'DELETE') elif isinstance(eloqua_object, CustomObjectModel): resp = self.request(eloqua_object.delete_path.format(parent_id=eloqua_object.PARENT_ID, id=eloqua_object.id), 'DELETE') return resp
Deletes an eloqua object :param eloqua_object: An instance of an Asset class :return: Returns the response from eloqua
eloqua/eloqua.py
delete
jnorton2/Eloqua
1
python
def delete(self, eloqua_object): '\n Deletes an eloqua object\n\n :param eloqua_object: An instance of an Asset class\n\n :return: Returns the response from eloqua\n ' if isinstance(eloqua_object, Asset): resp = self.request(eloqua_object.delete_path.format(id=eloqua_object.id), 'DELETE') elif isinstance(eloqua_object, CustomObjectModel): resp = self.request(eloqua_object.delete_path.format(parent_id=eloqua_object.PARENT_ID, id=eloqua_object.id), 'DELETE') return resp
def delete(self, eloqua_object): '\n Deletes an eloqua object\n\n :param eloqua_object: An instance of an Asset class\n\n :return: Returns the response from eloqua\n ' if isinstance(eloqua_object, Asset): resp = self.request(eloqua_object.delete_path.format(id=eloqua_object.id), 'DELETE') elif isinstance(eloqua_object, CustomObjectModel): resp = self.request(eloqua_object.delete_path.format(parent_id=eloqua_object.PARENT_ID, id=eloqua_object.id), 'DELETE') return resp<|docstring|>Deletes an eloqua object :param eloqua_object: An instance of an Asset class :return: Returns the response from eloqua<|endoftext|>
cec265c6e57c63aa07f7487dfda5d0543dcab2f2506ae2464fc0841cc7937e28
def create(self, eloqua_object): '\n Creates an eloqua object\n\n :param eloqua_object: An instance of an Eloqua Object like CustomObjectModel or Asset etc\n\n :return: Returns the response from eloqua\n ' if isinstance(eloqua_object, Asset): resp = self.request(eloqua_object.create_path, 'POST', eloqua_object.to_create_json()) elif isinstance(eloqua_object, CustomObjectModel): path = eloqua_object.create_path.format(parent_id=eloqua_object.PARENT_ID) data = eloqua_object.to_create_json() resp = self.request(path, 'POST', data) return eloqua_object.__class__(resp.json())
Creates an eloqua object :param eloqua_object: An instance of an Eloqua Object like CustomObjectModel or Asset etc :return: Returns the response from eloqua
eloqua/eloqua.py
create
jnorton2/Eloqua
1
python
def create(self, eloqua_object): '\n Creates an eloqua object\n\n :param eloqua_object: An instance of an Eloqua Object like CustomObjectModel or Asset etc\n\n :return: Returns the response from eloqua\n ' if isinstance(eloqua_object, Asset): resp = self.request(eloqua_object.create_path, 'POST', eloqua_object.to_create_json()) elif isinstance(eloqua_object, CustomObjectModel): path = eloqua_object.create_path.format(parent_id=eloqua_object.PARENT_ID) data = eloqua_object.to_create_json() resp = self.request(path, 'POST', data) return eloqua_object.__class__(resp.json())
def create(self, eloqua_object): '\n Creates an eloqua object\n\n :param eloqua_object: An instance of an Eloqua Object like CustomObjectModel or Asset etc\n\n :return: Returns the response from eloqua\n ' if isinstance(eloqua_object, Asset): resp = self.request(eloqua_object.create_path, 'POST', eloqua_object.to_create_json()) elif isinstance(eloqua_object, CustomObjectModel): path = eloqua_object.create_path.format(parent_id=eloqua_object.PARENT_ID) data = eloqua_object.to_create_json() resp = self.request(path, 'POST', data) return eloqua_object.__class__(resp.json())<|docstring|>Creates an eloqua object :param eloqua_object: An instance of an Eloqua Object like CustomObjectModel or Asset etc :return: Returns the response from eloqua<|endoftext|>
8bfee89938ee91891492da4df292bf927a9272fd0f655f30f932eb51372cf3b7
def get(self): 'Retrieve (and optionally filter) projects.\n ---\n operationId: get_entries\n parameters:\n - name: search\n in: query\n type: string\n description: string to search for in `title`, `description`, and `authors` using a MongoEngine/MongoDB text index. Provide a space-separated list to the search query parameter to search for multiple words. For more, see https://docs.mongodb.com/manual/text-search/.\n - name: mask\n in: query\n type: array\n items:\n type: string\n default: ["project", "title"]\n description: comma-separated list of fields to return (MongoDB syntax)\n responses:\n 200:\n description: list of projects\n schema:\n type: array\n items:\n $ref: \'#/definitions/ProjectsSchema\'\n ' mask = request.args.get('mask', 'project,title').split(',') objects = Projects.objects.only(*mask) search = request.args.get('search') entries = (objects.search_text(search) if search else objects.all()) return self.marshal(entries)
Retrieve (and optionally filter) projects. --- operationId: get_entries parameters: - name: search in: query type: string description: string to search for in `title`, `description`, and `authors` using a MongoEngine/MongoDB text index. Provide a space-separated list to the search query parameter to search for multiple words. For more, see https://docs.mongodb.com/manual/text-search/. - name: mask in: query type: array items: type: string default: ["project", "title"] description: comma-separated list of fields to return (MongoDB syntax) responses: 200: description: list of projects schema: type: array items: $ref: '#/definitions/ProjectsSchema'
mpcontribs-api/mpcontribs/api/projects/views.py
get
josuav1/MPContribs
1
python
def get(self): 'Retrieve (and optionally filter) projects.\n ---\n operationId: get_entries\n parameters:\n - name: search\n in: query\n type: string\n description: string to search for in `title`, `description`, and `authors` using a MongoEngine/MongoDB text index. Provide a space-separated list to the search query parameter to search for multiple words. For more, see https://docs.mongodb.com/manual/text-search/.\n - name: mask\n in: query\n type: array\n items:\n type: string\n default: ["project", "title"]\n description: comma-separated list of fields to return (MongoDB syntax)\n responses:\n 200:\n description: list of projects\n schema:\n type: array\n items:\n $ref: \'#/definitions/ProjectsSchema\'\n ' mask = request.args.get('mask', 'project,title').split(',') objects = Projects.objects.only(*mask) search = request.args.get('search') entries = (objects.search_text(search) if search else objects.all()) return self.marshal(entries)
def get(self): 'Retrieve (and optionally filter) projects.\n ---\n operationId: get_entries\n parameters:\n - name: search\n in: query\n type: string\n description: string to search for in `title`, `description`, and `authors` using a MongoEngine/MongoDB text index. Provide a space-separated list to the search query parameter to search for multiple words. For more, see https://docs.mongodb.com/manual/text-search/.\n - name: mask\n in: query\n type: array\n items:\n type: string\n default: ["project", "title"]\n description: comma-separated list of fields to return (MongoDB syntax)\n responses:\n 200:\n description: list of projects\n schema:\n type: array\n items:\n $ref: \'#/definitions/ProjectsSchema\'\n ' mask = request.args.get('mask', 'project,title').split(',') objects = Projects.objects.only(*mask) search = request.args.get('search') entries = (objects.search_text(search) if search else objects.all()) return self.marshal(entries)<|docstring|>Retrieve (and optionally filter) projects. --- operationId: get_entries parameters: - name: search in: query type: string description: string to search for in `title`, `description`, and `authors` using a MongoEngine/MongoDB text index. Provide a space-separated list to the search query parameter to search for multiple words. For more, see https://docs.mongodb.com/manual/text-search/. - name: mask in: query type: array items: type: string default: ["project", "title"] description: comma-separated list of fields to return (MongoDB syntax) responses: 200: description: list of projects schema: type: array items: $ref: '#/definitions/ProjectsSchema'<|endoftext|>
819f85d35fdbaa7e9736515be96a16f4ee4762e2c6deb5ce979a547eb9eefa11
def post(self): "Create a new project.\n Only MP staff can submit a new/non-existing project (or use POST\n endpoints in general). The staff member's email address will be set as\n the first readWrite entry in the permissions dict.\n " return NotImplemented()
Create a new project. Only MP staff can submit a new/non-existing project (or use POST endpoints in general). The staff member's email address will be set as the first readWrite entry in the permissions dict.
mpcontribs-api/mpcontribs/api/projects/views.py
post
josuav1/MPContribs
1
python
def post(self): "Create a new project.\n Only MP staff can submit a new/non-existing project (or use POST\n endpoints in general). The staff member's email address will be set as\n the first readWrite entry in the permissions dict.\n " return NotImplemented()
def post(self): "Create a new project.\n Only MP staff can submit a new/non-existing project (or use POST\n endpoints in general). The staff member's email address will be set as\n the first readWrite entry in the permissions dict.\n " return NotImplemented()<|docstring|>Create a new project. Only MP staff can submit a new/non-existing project (or use POST endpoints in general). The staff member's email address will be set as the first readWrite entry in the permissions dict.<|endoftext|>
a59afaba97ed09b1b69d1f6c5f6b570b775dd7f3374db2b18f3f9437d5d5b5ba
def get(self, project): 'Retrieve provenance info for a single project.\n ---\n operationId: get_entry\n parameters:\n - name: project\n in: path\n type: string\n pattern: \'^[a-zA-Z0-9_]{3,30}$\'\n required: true\n description: project name/slug\n - name: mask\n in: query\n type: array\n items:\n type: string\n default: ["title", "authors", "description", "urls"]\n description: comma-separated list of fields to return (MongoDB syntax)\n responses:\n 200:\n description: single project\n schema:\n $ref: \'#/definitions/ProjectsSchema\'\n ' mask_default = ','.join(['title', 'authors', 'description', 'urls']) mask = request.args.get('mask', mask_default).split(',') objects = Projects.objects.only(*mask) return self.marshal(objects.get(project=project))
Retrieve provenance info for a single project. --- operationId: get_entry parameters: - name: project in: path type: string pattern: '^[a-zA-Z0-9_]{3,30}$' required: true description: project name/slug - name: mask in: query type: array items: type: string default: ["title", "authors", "description", "urls"] description: comma-separated list of fields to return (MongoDB syntax) responses: 200: description: single project schema: $ref: '#/definitions/ProjectsSchema'
mpcontribs-api/mpcontribs/api/projects/views.py
get
josuav1/MPContribs
1
python
def get(self, project): 'Retrieve provenance info for a single project.\n ---\n operationId: get_entry\n parameters:\n - name: project\n in: path\n type: string\n pattern: \'^[a-zA-Z0-9_]{3,30}$\'\n required: true\n description: project name/slug\n - name: mask\n in: query\n type: array\n items:\n type: string\n default: ["title", "authors", "description", "urls"]\n description: comma-separated list of fields to return (MongoDB syntax)\n responses:\n 200:\n description: single project\n schema:\n $ref: \'#/definitions/ProjectsSchema\'\n ' mask_default = ','.join(['title', 'authors', 'description', 'urls']) mask = request.args.get('mask', mask_default).split(',') objects = Projects.objects.only(*mask) return self.marshal(objects.get(project=project))
def get(self, project): 'Retrieve provenance info for a single project.\n ---\n operationId: get_entry\n parameters:\n - name: project\n in: path\n type: string\n pattern: \'^[a-zA-Z0-9_]{3,30}$\'\n required: true\n description: project name/slug\n - name: mask\n in: query\n type: array\n items:\n type: string\n default: ["title", "authors", "description", "urls"]\n description: comma-separated list of fields to return (MongoDB syntax)\n responses:\n 200:\n description: single project\n schema:\n $ref: \'#/definitions/ProjectsSchema\'\n ' mask_default = ','.join(['title', 'authors', 'description', 'urls']) mask = request.args.get('mask', mask_default).split(',') objects = Projects.objects.only(*mask) return self.marshal(objects.get(project=project))<|docstring|>Retrieve provenance info for a single project. --- operationId: get_entry parameters: - name: project in: path type: string pattern: '^[a-zA-Z0-9_]{3,30}$' required: true description: project name/slug - name: mask in: query type: array items: type: string default: ["title", "authors", "description", "urls"] description: comma-separated list of fields to return (MongoDB syntax) responses: 200: description: single project schema: $ref: '#/definitions/ProjectsSchema'<|endoftext|>
4436e2d33af2bfd0d9b94ceb6e2bcdad6437539951f3dbb4ee781ac8116791a1
def put(self, project): "Replace a project's provenance entry" return NotImplemented()
Replace a project's provenance entry
mpcontribs-api/mpcontribs/api/projects/views.py
put
josuav1/MPContribs
1
python
def put(self, project): return NotImplemented()
def put(self, project): return NotImplemented()<|docstring|>Replace a project's provenance entry<|endoftext|>
3b24601146f02ad9541c6fec8af7cd9558e3043e6d2c69247c8156b0ffdb0b7e
def patch(self, project): "Partially update a project's provenance entry" return NotImplemented() schema = self.Schema(dump_only=('id', 'project')) schema.opts.model_build_obj = False payload = schema.load(request.json, partial=True) if payload.errors: return payload.errors if ('urls' in payload.data): urls = payload.data.pop('urls') payload.data.update(dict(((('urls__' + key), getattr(urls, key)) for key in urls))) for (key, url) in request.json.get('urls', {}).items(): payload.data[('urls__' + key)] = url return payload.data
Partially update a project's provenance entry
mpcontribs-api/mpcontribs/api/projects/views.py
patch
josuav1/MPContribs
1
python
def patch(self, project): return NotImplemented() schema = self.Schema(dump_only=('id', 'project')) schema.opts.model_build_obj = False payload = schema.load(request.json, partial=True) if payload.errors: return payload.errors if ('urls' in payload.data): urls = payload.data.pop('urls') payload.data.update(dict(((('urls__' + key), getattr(urls, key)) for key in urls))) for (key, url) in request.json.get('urls', {}).items(): payload.data[('urls__' + key)] = url return payload.data
def patch(self, project): return NotImplemented() schema = self.Schema(dump_only=('id', 'project')) schema.opts.model_build_obj = False payload = schema.load(request.json, partial=True) if payload.errors: return payload.errors if ('urls' in payload.data): urls = payload.data.pop('urls') payload.data.update(dict(((('urls__' + key), getattr(urls, key)) for key in urls))) for (key, url) in request.json.get('urls', {}).items(): payload.data[('urls__' + key)] = url return payload.data<|docstring|>Partially update a project's provenance entry<|endoftext|>
b8ebe5172ded3bba1b5468b14f6538a49e866e1edb1ed045dd02e258a04ee940
def delete(self, project): "Delete a project's provenance entry" return NotImplemented()
Delete a project's provenance entry
mpcontribs-api/mpcontribs/api/projects/views.py
delete
josuav1/MPContribs
1
python
def delete(self, project): return NotImplemented()
def delete(self, project): return NotImplemented()<|docstring|>Delete a project's provenance entry<|endoftext|>
cd21ca0060fffb40892c46dfda11ef91e1859cf0aa07462c020c566658b4f53a
def get(self, project): "Retrieve a table of contributions for a project.\n ---\n operationId: get_table\n parameters:\n - name: project\n in: path\n type: string\n pattern: '^[a-zA-Z0-9_]{3,30}$'\n required: true\n description: project name/slug\n - name: columns\n in: query\n type: array\n items:\n type: string\n description: comma-separated list of column names to tabulate\n - name: page\n in: query\n type: integer\n default: 1\n description: page to retrieve (in batches of `per_page`)\n - name: per_page\n in: query\n type: integer\n default: 20\n minimum: 2\n maximum: 20\n description: number of results to return per page\n - name: q\n in: query\n type: string\n description: substring to search for in first non-id column\n - name: order\n in: query\n type: string\n description: sort ascending or descending\n enum: [asc, desc]\n - name: sort_by\n in: query\n type: string\n description: column name to sort by\n responses:\n 200:\n description: Paginated table response in backgrid format (items = rows of table)\n schema:\n type: object\n properties:\n total_count:\n type: integer\n total_pages:\n type: integer\n page:\n type: integer\n last_page:\n type: integer\n per_page:\n type: integer\n items:\n type: array\n items:\n type: object\n " explorer = ('http://localhost:8080/explorer' if current_app.config['DEBUG'] else 'https://portal.mpcontribs.org/explorer') mp_site = 'https://materialsproject.org/materials' mask = ['content.data', 'content.structures', 'identifier'] search = request.args.get('q') page = int(request.args.get('page', 1)) PER_PAGE_MAX = current_app.config['PER_PAGE_MAX'] per_page = int(request.args.get('per_page', PER_PAGE_MAX)) per_page = (PER_PAGE_MAX if (per_page > PER_PAGE_MAX) else per_page) order = request.args.get('order') sort_by = request.args.get('sort_by', 'identifier') general_columns = ['identifier', 'id'] user_columns = request.args.get('columns', '').split(',') objects = Contributions.objects(project=project).only(*mask) sample = objects.first()['content']['data'] data_keys = sorted(list(((k.rsplit('.', 1)[0] if k.endswith('.display') else k) for (k, v) in nested_to_record(sample, sep='.').items() if ((not k.endswith('.value')) and (not k.endswith('.unit')))))) if (not data_keys): return {'total_count': 0, 'total_pages': 0, 'page': 1, 'last_page': 1, 'per_page': per_page, 'items': []} formula_key_exists = bool(('formula' in data_keys)) if formula_key_exists: general_columns.append('formula') else: search_key = data_keys[0].replace('.', '__') q1 = {f'content__data__{search_key}__exists': False} q2 = {f'content__data__{search_key}__type': 'object'} if (objects((Q(**q1) | Q(**q2))).count() < 1): general_columns.append(data_keys[0]) else: general_columns.append('formula') if (not user_columns[0]): if formula_key_exists: data_keys.remove('formula') user_columns = (data_keys if ('formula' in general_columns) else data_keys[1:]) units = [objects.distinct(f'content.data.{col}.unit') for col in user_columns] columns = (general_columns + [('{} [{}]'.format(col, units[idx][0]) if units[idx] else col) for (idx, col) in enumerate(user_columns)]) if (search is not None): kwargs = {f'content__data__{general_columns[(- 1)]}__exists': True, f'content__data__{general_columns[(- 1)]}__contains': search} objects = objects((Q(identifier__contains=search) | Q(**kwargs))) sort_by_key = sort_by if ((' ' in sort_by) and (sort_by[(- 1)] == ']')): sort_by = sort_by.split(' ')[0] sort_by_key = f'content.data.{sort_by}.value' elif (sort_by in columns[2:]): sort_by_key = f'content.data.{sort_by}' order_sign = ('-' if (order == 'desc') else '+') order_by = f'{order_sign}{sort_by_key}' objects = objects.order_by(order_by) items = [] for doc in objects.paginate(page=page, per_page=per_page).items: mp_id = doc['identifier'] contrib = nested_to_record(doc['content']['data'], sep='.') search_value = contrib.get(general_columns[(- 1)], mp_id).replace(' ', '') row = [f'{mp_site}/{mp_id}', f"{explorer}/{doc['id']}", search_value] for (idx, col) in enumerate(user_columns): cell = '' if ('CIF' in col): structures = doc['content']['structures'] if ('.' in col): sname = '.'.join(col.split('.')[:(- 1)]) for d in structures: if (d['name'] == sname): cell = f"{explorer}/{d['id']}.cif" break elif structures: cell = f"{explorer}/{structures[0]['id']}.cif" else: cell = contrib.get((col + '.value'), contrib.get(col, '')) row.append(str(cell)) items.append(dict(zip(columns, row))) total_count = objects.count() total_pages = int((total_count / per_page)) if (total_pages % per_page): total_pages += 1 return {'total_count': total_count, 'total_pages': total_pages, 'page': page, 'last_page': total_pages, 'per_page': per_page, 'items': items}
Retrieve a table of contributions for a project. --- operationId: get_table parameters: - name: project in: path type: string pattern: '^[a-zA-Z0-9_]{3,30}$' required: true description: project name/slug - name: columns in: query type: array items: type: string description: comma-separated list of column names to tabulate - name: page in: query type: integer default: 1 description: page to retrieve (in batches of `per_page`) - name: per_page in: query type: integer default: 20 minimum: 2 maximum: 20 description: number of results to return per page - name: q in: query type: string description: substring to search for in first non-id column - name: order in: query type: string description: sort ascending or descending enum: [asc, desc] - name: sort_by in: query type: string description: column name to sort by responses: 200: description: Paginated table response in backgrid format (items = rows of table) schema: type: object properties: total_count: type: integer total_pages: type: integer page: type: integer last_page: type: integer per_page: type: integer items: type: array items: type: object
mpcontribs-api/mpcontribs/api/projects/views.py
get
josuav1/MPContribs
1
python
def get(self, project): "Retrieve a table of contributions for a project.\n ---\n operationId: get_table\n parameters:\n - name: project\n in: path\n type: string\n pattern: '^[a-zA-Z0-9_]{3,30}$'\n required: true\n description: project name/slug\n - name: columns\n in: query\n type: array\n items:\n type: string\n description: comma-separated list of column names to tabulate\n - name: page\n in: query\n type: integer\n default: 1\n description: page to retrieve (in batches of `per_page`)\n - name: per_page\n in: query\n type: integer\n default: 20\n minimum: 2\n maximum: 20\n description: number of results to return per page\n - name: q\n in: query\n type: string\n description: substring to search for in first non-id column\n - name: order\n in: query\n type: string\n description: sort ascending or descending\n enum: [asc, desc]\n - name: sort_by\n in: query\n type: string\n description: column name to sort by\n responses:\n 200:\n description: Paginated table response in backgrid format (items = rows of table)\n schema:\n type: object\n properties:\n total_count:\n type: integer\n total_pages:\n type: integer\n page:\n type: integer\n last_page:\n type: integer\n per_page:\n type: integer\n items:\n type: array\n items:\n type: object\n " explorer = ('http://localhost:8080/explorer' if current_app.config['DEBUG'] else 'https://portal.mpcontribs.org/explorer') mp_site = 'https://materialsproject.org/materials' mask = ['content.data', 'content.structures', 'identifier'] search = request.args.get('q') page = int(request.args.get('page', 1)) PER_PAGE_MAX = current_app.config['PER_PAGE_MAX'] per_page = int(request.args.get('per_page', PER_PAGE_MAX)) per_page = (PER_PAGE_MAX if (per_page > PER_PAGE_MAX) else per_page) order = request.args.get('order') sort_by = request.args.get('sort_by', 'identifier') general_columns = ['identifier', 'id'] user_columns = request.args.get('columns', ).split(',') objects = Contributions.objects(project=project).only(*mask) sample = objects.first()['content']['data'] data_keys = sorted(list(((k.rsplit('.', 1)[0] if k.endswith('.display') else k) for (k, v) in nested_to_record(sample, sep='.').items() if ((not k.endswith('.value')) and (not k.endswith('.unit')))))) if (not data_keys): return {'total_count': 0, 'total_pages': 0, 'page': 1, 'last_page': 1, 'per_page': per_page, 'items': []} formula_key_exists = bool(('formula' in data_keys)) if formula_key_exists: general_columns.append('formula') else: search_key = data_keys[0].replace('.', '__') q1 = {f'content__data__{search_key}__exists': False} q2 = {f'content__data__{search_key}__type': 'object'} if (objects((Q(**q1) | Q(**q2))).count() < 1): general_columns.append(data_keys[0]) else: general_columns.append('formula') if (not user_columns[0]): if formula_key_exists: data_keys.remove('formula') user_columns = (data_keys if ('formula' in general_columns) else data_keys[1:]) units = [objects.distinct(f'content.data.{col}.unit') for col in user_columns] columns = (general_columns + [('{} [{}]'.format(col, units[idx][0]) if units[idx] else col) for (idx, col) in enumerate(user_columns)]) if (search is not None): kwargs = {f'content__data__{general_columns[(- 1)]}__exists': True, f'content__data__{general_columns[(- 1)]}__contains': search} objects = objects((Q(identifier__contains=search) | Q(**kwargs))) sort_by_key = sort_by if ((' ' in sort_by) and (sort_by[(- 1)] == ']')): sort_by = sort_by.split(' ')[0] sort_by_key = f'content.data.{sort_by}.value' elif (sort_by in columns[2:]): sort_by_key = f'content.data.{sort_by}' order_sign = ('-' if (order == 'desc') else '+') order_by = f'{order_sign}{sort_by_key}' objects = objects.order_by(order_by) items = [] for doc in objects.paginate(page=page, per_page=per_page).items: mp_id = doc['identifier'] contrib = nested_to_record(doc['content']['data'], sep='.') search_value = contrib.get(general_columns[(- 1)], mp_id).replace(' ', ) row = [f'{mp_site}/{mp_id}', f"{explorer}/{doc['id']}", search_value] for (idx, col) in enumerate(user_columns): cell = if ('CIF' in col): structures = doc['content']['structures'] if ('.' in col): sname = '.'.join(col.split('.')[:(- 1)]) for d in structures: if (d['name'] == sname): cell = f"{explorer}/{d['id']}.cif" break elif structures: cell = f"{explorer}/{structures[0]['id']}.cif" else: cell = contrib.get((col + '.value'), contrib.get(col, )) row.append(str(cell)) items.append(dict(zip(columns, row))) total_count = objects.count() total_pages = int((total_count / per_page)) if (total_pages % per_page): total_pages += 1 return {'total_count': total_count, 'total_pages': total_pages, 'page': page, 'last_page': total_pages, 'per_page': per_page, 'items': items}
def get(self, project): "Retrieve a table of contributions for a project.\n ---\n operationId: get_table\n parameters:\n - name: project\n in: path\n type: string\n pattern: '^[a-zA-Z0-9_]{3,30}$'\n required: true\n description: project name/slug\n - name: columns\n in: query\n type: array\n items:\n type: string\n description: comma-separated list of column names to tabulate\n - name: page\n in: query\n type: integer\n default: 1\n description: page to retrieve (in batches of `per_page`)\n - name: per_page\n in: query\n type: integer\n default: 20\n minimum: 2\n maximum: 20\n description: number of results to return per page\n - name: q\n in: query\n type: string\n description: substring to search for in first non-id column\n - name: order\n in: query\n type: string\n description: sort ascending or descending\n enum: [asc, desc]\n - name: sort_by\n in: query\n type: string\n description: column name to sort by\n responses:\n 200:\n description: Paginated table response in backgrid format (items = rows of table)\n schema:\n type: object\n properties:\n total_count:\n type: integer\n total_pages:\n type: integer\n page:\n type: integer\n last_page:\n type: integer\n per_page:\n type: integer\n items:\n type: array\n items:\n type: object\n " explorer = ('http://localhost:8080/explorer' if current_app.config['DEBUG'] else 'https://portal.mpcontribs.org/explorer') mp_site = 'https://materialsproject.org/materials' mask = ['content.data', 'content.structures', 'identifier'] search = request.args.get('q') page = int(request.args.get('page', 1)) PER_PAGE_MAX = current_app.config['PER_PAGE_MAX'] per_page = int(request.args.get('per_page', PER_PAGE_MAX)) per_page = (PER_PAGE_MAX if (per_page > PER_PAGE_MAX) else per_page) order = request.args.get('order') sort_by = request.args.get('sort_by', 'identifier') general_columns = ['identifier', 'id'] user_columns = request.args.get('columns', ).split(',') objects = Contributions.objects(project=project).only(*mask) sample = objects.first()['content']['data'] data_keys = sorted(list(((k.rsplit('.', 1)[0] if k.endswith('.display') else k) for (k, v) in nested_to_record(sample, sep='.').items() if ((not k.endswith('.value')) and (not k.endswith('.unit')))))) if (not data_keys): return {'total_count': 0, 'total_pages': 0, 'page': 1, 'last_page': 1, 'per_page': per_page, 'items': []} formula_key_exists = bool(('formula' in data_keys)) if formula_key_exists: general_columns.append('formula') else: search_key = data_keys[0].replace('.', '__') q1 = {f'content__data__{search_key}__exists': False} q2 = {f'content__data__{search_key}__type': 'object'} if (objects((Q(**q1) | Q(**q2))).count() < 1): general_columns.append(data_keys[0]) else: general_columns.append('formula') if (not user_columns[0]): if formula_key_exists: data_keys.remove('formula') user_columns = (data_keys if ('formula' in general_columns) else data_keys[1:]) units = [objects.distinct(f'content.data.{col}.unit') for col in user_columns] columns = (general_columns + [('{} [{}]'.format(col, units[idx][0]) if units[idx] else col) for (idx, col) in enumerate(user_columns)]) if (search is not None): kwargs = {f'content__data__{general_columns[(- 1)]}__exists': True, f'content__data__{general_columns[(- 1)]}__contains': search} objects = objects((Q(identifier__contains=search) | Q(**kwargs))) sort_by_key = sort_by if ((' ' in sort_by) and (sort_by[(- 1)] == ']')): sort_by = sort_by.split(' ')[0] sort_by_key = f'content.data.{sort_by}.value' elif (sort_by in columns[2:]): sort_by_key = f'content.data.{sort_by}' order_sign = ('-' if (order == 'desc') else '+') order_by = f'{order_sign}{sort_by_key}' objects = objects.order_by(order_by) items = [] for doc in objects.paginate(page=page, per_page=per_page).items: mp_id = doc['identifier'] contrib = nested_to_record(doc['content']['data'], sep='.') search_value = contrib.get(general_columns[(- 1)], mp_id).replace(' ', ) row = [f'{mp_site}/{mp_id}', f"{explorer}/{doc['id']}", search_value] for (idx, col) in enumerate(user_columns): cell = if ('CIF' in col): structures = doc['content']['structures'] if ('.' in col): sname = '.'.join(col.split('.')[:(- 1)]) for d in structures: if (d['name'] == sname): cell = f"{explorer}/{d['id']}.cif" break elif structures: cell = f"{explorer}/{structures[0]['id']}.cif" else: cell = contrib.get((col + '.value'), contrib.get(col, )) row.append(str(cell)) items.append(dict(zip(columns, row))) total_count = objects.count() total_pages = int((total_count / per_page)) if (total_pages % per_page): total_pages += 1 return {'total_count': total_count, 'total_pages': total_pages, 'page': page, 'last_page': total_pages, 'per_page': per_page, 'items': items}<|docstring|>Retrieve a table of contributions for a project. --- operationId: get_table parameters: - name: project in: path type: string pattern: '^[a-zA-Z0-9_]{3,30}$' required: true description: project name/slug - name: columns in: query type: array items: type: string description: comma-separated list of column names to tabulate - name: page in: query type: integer default: 1 description: page to retrieve (in batches of `per_page`) - name: per_page in: query type: integer default: 20 minimum: 2 maximum: 20 description: number of results to return per page - name: q in: query type: string description: substring to search for in first non-id column - name: order in: query type: string description: sort ascending or descending enum: [asc, desc] - name: sort_by in: query type: string description: column name to sort by responses: 200: description: Paginated table response in backgrid format (items = rows of table) schema: type: object properties: total_count: type: integer total_pages: type: integer page: type: integer last_page: type: integer per_page: type: integer items: type: array items: type: object<|endoftext|>
35d6c957582aa4a49093249f029453c4ae7f74fc4a6244e0a4ab7e05edbfdf26
def get(self, project): "Retrieve overview graph for a project.\n ---\n operationId: get_graph\n parameters:\n - name: project\n in: path\n type: string\n pattern: '^[a-zA-Z0-9_]{3,30}$'\n required: true\n description: project name/slug\n - name: columns\n in: query\n type: array\n items:\n type: string\n required: true\n description: comma-separated list of column names to plot (in MongoDB dot notation)\n - name: filters\n in: query\n type: array\n items:\n type: string\n description: list of `column__operator:value` filters with `column` in dot notation and `operator` in mongoengine format (http://docs.mongoengine.org/guide/querying.html#query-operators). `column` needs to be a valid field in `content.data`.\n - name: page\n in: query\n type: integer\n default: 1\n description: page to retrieve (in batches of `per_page`)\n - name: per_page\n in: query\n type: integer\n default: 200\n minimum: 2\n maximum: 200\n description: number of results to return per page\n responses:\n 200:\n description: x-y-data in plotly format\n schema:\n type: array\n items:\n type: object\n properties:\n x:\n type: array\n items:\n type: number\n y:\n type: array\n items:\n type: number\n " mask = ['content.data', 'identifier'] columns = request.args.get('columns').split(',') filters = request.args.get('filters', '').split(',') page = int(request.args.get('page', 1)) PER_PAGE_MAX = 200 per_page = int(request.args.get('per_page', PER_PAGE_MAX)) per_page = (PER_PAGE_MAX if (per_page > PER_PAGE_MAX) else per_page) with no_dereference(Contributions) as ContributionsDeref: objects = ContributionsDeref.objects(project=project).only(*mask) data = [{'x': [], 'y': [], 'text': []} for col in columns] if filters: query = {} for f in filters: if (('__' in f) and (':' in f)): (k, v) = f.split(':') (col, op) = k.rsplit('__', 1) col = col.replace('.', '__') key = f'content__data__{col}__value__{op}' query[key] = float(v) objects = objects(**query) for obj in objects.paginate(page=page, per_page=per_page).items: d = nested_to_record(obj['content']['data'], sep='.') if all(((f'{c}.display' in d.keys()) for c in columns)): for (idx, col) in enumerate(columns): val = d.get(f'{col}.display') if val: data[idx]['x'].append(obj.identifier) data[idx]['y'].append(val.split(' ')[0]) data[idx]['text'].append(str(obj.id)) return data
Retrieve overview graph for a project. --- operationId: get_graph parameters: - name: project in: path type: string pattern: '^[a-zA-Z0-9_]{3,30}$' required: true description: project name/slug - name: columns in: query type: array items: type: string required: true description: comma-separated list of column names to plot (in MongoDB dot notation) - name: filters in: query type: array items: type: string description: list of `column__operator:value` filters with `column` in dot notation and `operator` in mongoengine format (http://docs.mongoengine.org/guide/querying.html#query-operators). `column` needs to be a valid field in `content.data`. - name: page in: query type: integer default: 1 description: page to retrieve (in batches of `per_page`) - name: per_page in: query type: integer default: 200 minimum: 2 maximum: 200 description: number of results to return per page responses: 200: description: x-y-data in plotly format schema: type: array items: type: object properties: x: type: array items: type: number y: type: array items: type: number
mpcontribs-api/mpcontribs/api/projects/views.py
get
josuav1/MPContribs
1
python
def get(self, project): "Retrieve overview graph for a project.\n ---\n operationId: get_graph\n parameters:\n - name: project\n in: path\n type: string\n pattern: '^[a-zA-Z0-9_]{3,30}$'\n required: true\n description: project name/slug\n - name: columns\n in: query\n type: array\n items:\n type: string\n required: true\n description: comma-separated list of column names to plot (in MongoDB dot notation)\n - name: filters\n in: query\n type: array\n items:\n type: string\n description: list of `column__operator:value` filters with `column` in dot notation and `operator` in mongoengine format (http://docs.mongoengine.org/guide/querying.html#query-operators). `column` needs to be a valid field in `content.data`.\n - name: page\n in: query\n type: integer\n default: 1\n description: page to retrieve (in batches of `per_page`)\n - name: per_page\n in: query\n type: integer\n default: 200\n minimum: 2\n maximum: 200\n description: number of results to return per page\n responses:\n 200:\n description: x-y-data in plotly format\n schema:\n type: array\n items:\n type: object\n properties:\n x:\n type: array\n items:\n type: number\n y:\n type: array\n items:\n type: number\n " mask = ['content.data', 'identifier'] columns = request.args.get('columns').split(',') filters = request.args.get('filters', ).split(',') page = int(request.args.get('page', 1)) PER_PAGE_MAX = 200 per_page = int(request.args.get('per_page', PER_PAGE_MAX)) per_page = (PER_PAGE_MAX if (per_page > PER_PAGE_MAX) else per_page) with no_dereference(Contributions) as ContributionsDeref: objects = ContributionsDeref.objects(project=project).only(*mask) data = [{'x': [], 'y': [], 'text': []} for col in columns] if filters: query = {} for f in filters: if (('__' in f) and (':' in f)): (k, v) = f.split(':') (col, op) = k.rsplit('__', 1) col = col.replace('.', '__') key = f'content__data__{col}__value__{op}' query[key] = float(v) objects = objects(**query) for obj in objects.paginate(page=page, per_page=per_page).items: d = nested_to_record(obj['content']['data'], sep='.') if all(((f'{c}.display' in d.keys()) for c in columns)): for (idx, col) in enumerate(columns): val = d.get(f'{col}.display') if val: data[idx]['x'].append(obj.identifier) data[idx]['y'].append(val.split(' ')[0]) data[idx]['text'].append(str(obj.id)) return data
def get(self, project): "Retrieve overview graph for a project.\n ---\n operationId: get_graph\n parameters:\n - name: project\n in: path\n type: string\n pattern: '^[a-zA-Z0-9_]{3,30}$'\n required: true\n description: project name/slug\n - name: columns\n in: query\n type: array\n items:\n type: string\n required: true\n description: comma-separated list of column names to plot (in MongoDB dot notation)\n - name: filters\n in: query\n type: array\n items:\n type: string\n description: list of `column__operator:value` filters with `column` in dot notation and `operator` in mongoengine format (http://docs.mongoengine.org/guide/querying.html#query-operators). `column` needs to be a valid field in `content.data`.\n - name: page\n in: query\n type: integer\n default: 1\n description: page to retrieve (in batches of `per_page`)\n - name: per_page\n in: query\n type: integer\n default: 200\n minimum: 2\n maximum: 200\n description: number of results to return per page\n responses:\n 200:\n description: x-y-data in plotly format\n schema:\n type: array\n items:\n type: object\n properties:\n x:\n type: array\n items:\n type: number\n y:\n type: array\n items:\n type: number\n " mask = ['content.data', 'identifier'] columns = request.args.get('columns').split(',') filters = request.args.get('filters', ).split(',') page = int(request.args.get('page', 1)) PER_PAGE_MAX = 200 per_page = int(request.args.get('per_page', PER_PAGE_MAX)) per_page = (PER_PAGE_MAX if (per_page > PER_PAGE_MAX) else per_page) with no_dereference(Contributions) as ContributionsDeref: objects = ContributionsDeref.objects(project=project).only(*mask) data = [{'x': [], 'y': [], 'text': []} for col in columns] if filters: query = {} for f in filters: if (('__' in f) and (':' in f)): (k, v) = f.split(':') (col, op) = k.rsplit('__', 1) col = col.replace('.', '__') key = f'content__data__{col}__value__{op}' query[key] = float(v) objects = objects(**query) for obj in objects.paginate(page=page, per_page=per_page).items: d = nested_to_record(obj['content']['data'], sep='.') if all(((f'{c}.display' in d.keys()) for c in columns)): for (idx, col) in enumerate(columns): val = d.get(f'{col}.display') if val: data[idx]['x'].append(obj.identifier) data[idx]['y'].append(val.split(' ')[0]) data[idx]['text'].append(str(obj.id)) return data<|docstring|>Retrieve overview graph for a project. --- operationId: get_graph parameters: - name: project in: path type: string pattern: '^[a-zA-Z0-9_]{3,30}$' required: true description: project name/slug - name: columns in: query type: array items: type: string required: true description: comma-separated list of column names to plot (in MongoDB dot notation) - name: filters in: query type: array items: type: string description: list of `column__operator:value` filters with `column` in dot notation and `operator` in mongoengine format (http://docs.mongoengine.org/guide/querying.html#query-operators). `column` needs to be a valid field in `content.data`. - name: page in: query type: integer default: 1 description: page to retrieve (in batches of `per_page`) - name: per_page in: query type: integer default: 200 minimum: 2 maximum: 200 description: number of results to return per page responses: 200: description: x-y-data in plotly format schema: type: array items: type: object properties: x: type: array items: type: number y: type: array items: type: number<|endoftext|>
98c2f21bd4d105ee5cef9bde36a88980e5426a7c867cc9cb1940aafaf54a9285
def predict(self, src, src_len, label_encoder: 'LabelEncoder', override_src: Optional[List[str]]=None) -> torch.Tensor: ' Predicts value for a given tensor\n\n :param src: tensor(batch size x sentence_length)\n :param src_len: tensor(batch size)\n :param label_encoder: Encoder\n :return: Reversed Batch\n ' out = self(src, src_len, None, teacher_forcing_ratio=0) logits = torch.argmax(out, 2) return label_encoder.reverse_batch(logits, masked=(override_src or src), ignore=(self.pad_idx,))
Predicts value for a given tensor :param src: tensor(batch size x sentence_length) :param src_len: tensor(batch size) :param label_encoder: Encoder :return: Reversed Batch
boudams/model/linear.py
predict
matgille/boudams
5
python
def predict(self, src, src_len, label_encoder: 'LabelEncoder', override_src: Optional[List[str]]=None) -> torch.Tensor: ' Predicts value for a given tensor\n\n :param src: tensor(batch size x sentence_length)\n :param src_len: tensor(batch size)\n :param label_encoder: Encoder\n :return: Reversed Batch\n ' out = self(src, src_len, None, teacher_forcing_ratio=0) logits = torch.argmax(out, 2) return label_encoder.reverse_batch(logits, masked=(override_src or src), ignore=(self.pad_idx,))
def predict(self, src, src_len, label_encoder: 'LabelEncoder', override_src: Optional[List[str]]=None) -> torch.Tensor: ' Predicts value for a given tensor\n\n :param src: tensor(batch size x sentence_length)\n :param src_len: tensor(batch size)\n :param label_encoder: Encoder\n :return: Reversed Batch\n ' out = self(src, src_len, None, teacher_forcing_ratio=0) logits = torch.argmax(out, 2) return label_encoder.reverse_batch(logits, masked=(override_src or src), ignore=(self.pad_idx,))<|docstring|>Predicts value for a given tensor :param src: tensor(batch size x sentence_length) :param src_len: tensor(batch size) :param label_encoder: Encoder :return: Reversed Batch<|endoftext|>
5d9248a56e6e4e3d73b5e6d2b7f076ce402ce4def1c4a31064cba9e31bb5369f
def gradient(self, src, src_len, trg=None, scorer: 'Scorer'=None, criterion=None, evaluate: bool=False, **kwargs): '\n\n :param src: tensor(batch size x sentence length)\n :param src_len: tensor(batch_size)\n :param trg: tensor(batch_size x output_length)\n :param scorer: Scorer\n :param criterion: Loss System\n :param evaluate: Whether we are in eval mode\n :param kwargs:\n :return: tensor(batch_size x output_length)\n\n ' output = self(src, src_len, trg) scorer.register_batch(torch.argmax(output, 2), trg, src) loss = criterion(output.view((- 1), self.decoder.out_dim), trg.view((- 1))) return loss
:param src: tensor(batch size x sentence length) :param src_len: tensor(batch_size) :param trg: tensor(batch_size x output_length) :param scorer: Scorer :param criterion: Loss System :param evaluate: Whether we are in eval mode :param kwargs: :return: tensor(batch_size x output_length)
boudams/model/linear.py
gradient
matgille/boudams
5
python
def gradient(self, src, src_len, trg=None, scorer: 'Scorer'=None, criterion=None, evaluate: bool=False, **kwargs): '\n\n :param src: tensor(batch size x sentence length)\n :param src_len: tensor(batch_size)\n :param trg: tensor(batch_size x output_length)\n :param scorer: Scorer\n :param criterion: Loss System\n :param evaluate: Whether we are in eval mode\n :param kwargs:\n :return: tensor(batch_size x output_length)\n\n ' output = self(src, src_len, trg) scorer.register_batch(torch.argmax(output, 2), trg, src) loss = criterion(output.view((- 1), self.decoder.out_dim), trg.view((- 1))) return loss
def gradient(self, src, src_len, trg=None, scorer: 'Scorer'=None, criterion=None, evaluate: bool=False, **kwargs): '\n\n :param src: tensor(batch size x sentence length)\n :param src_len: tensor(batch_size)\n :param trg: tensor(batch_size x output_length)\n :param scorer: Scorer\n :param criterion: Loss System\n :param evaluate: Whether we are in eval mode\n :param kwargs:\n :return: tensor(batch_size x output_length)\n\n ' output = self(src, src_len, trg) scorer.register_batch(torch.argmax(output, 2), trg, src) loss = criterion(output.view((- 1), self.decoder.out_dim), trg.view((- 1))) return loss<|docstring|>:param src: tensor(batch size x sentence length) :param src_len: tensor(batch_size) :param trg: tensor(batch_size x output_length) :param scorer: Scorer :param criterion: Loss System :param evaluate: Whether we are in eval mode :param kwargs: :return: tensor(batch_size x output_length)<|endoftext|>
34ff0c70a9a96da973793a408bfbb4ae82e506d13bb3cc6b7850e045fcb7269f
def get_loss(self, preds, truths): '\n\n :param preds:\n :param truths:\n :return:\n ' return F.cross_entropy(preds.view((- 1), len(self.label_encoder)), truths.view((- 1)), weight=self.nll_weight, reduction='mean', ignore_index=self.label_encoder.get_pad())
:param preds: :param truths: :return:
boudams/model/linear.py
get_loss
matgille/boudams
5
python
def get_loss(self, preds, truths): '\n\n :param preds:\n :param truths:\n :return:\n ' return F.cross_entropy(preds.view((- 1), len(self.label_encoder)), truths.view((- 1)), weight=self.nll_weight, reduction='mean', ignore_index=self.label_encoder.get_pad())
def get_loss(self, preds, truths): '\n\n :param preds:\n :param truths:\n :return:\n ' return F.cross_entropy(preds.view((- 1), len(self.label_encoder)), truths.view((- 1)), weight=self.nll_weight, reduction='mean', ignore_index=self.label_encoder.get_pad())<|docstring|>:param preds: :param truths: :return:<|endoftext|>
5c2bb564f717aeb4efb3b67094491bdde152188a37f3ead86ce3176e75842e09
def guess_mimetype(resource_path): '\n Guesses the mimetype of a given resource.\n\n Args:\n resource_path: the path to a given resource.\n Returns:\n The mimetype string.\n ' mime = mimetypes.guess_type(resource_path)[0] if (mime is None): return 'application/octet-stream' return mime
Guesses the mimetype of a given resource. Args: resource_path: the path to a given resource. Returns: The mimetype string.
api/api/routes/autogen.py
guess_mimetype
nnamon/picoCTF-Platform-2
10
python
def guess_mimetype(resource_path): '\n Guesses the mimetype of a given resource.\n\n Args:\n resource_path: the path to a given resource.\n Returns:\n The mimetype string.\n ' mime = mimetypes.guess_type(resource_path)[0] if (mime is None): return 'application/octet-stream' return mime
def guess_mimetype(resource_path): '\n Guesses the mimetype of a given resource.\n\n Args:\n resource_path: the path to a given resource.\n Returns:\n The mimetype string.\n ' mime = mimetypes.guess_type(resource_path)[0] if (mime is None): return 'application/octet-stream' return mime<|docstring|>Guesses the mimetype of a given resource. Args: resource_path: the path to a given resource. Returns: The mimetype string.<|endoftext|>
92162a73cb9ea38e5ed6b374ac679022ff8d850b038062ca1e4e026a1a35fbc0
def check_for_setup_error(self): 'Verify that the volume for our folder exists.\n\n :raise: :py:exc:`LookupError`\n ' (pool_name, fs) = self._get_share_datasets(self.share) url = ('storage/pools/%s' % pool_name) if (not self.nef.get(url)): raise LookupError((_('Pool %s does not exist in Nexenta Store appliance') % pool_name)) url = ('storage/pools/%s/filesystems/%s' % (pool_name, fs)) if (not self.nef.get(url)): raise LookupError((_('filesystem %s does not exist in Nexenta Store appliance') % fs)) path = '/'.join([pool_name, fs]) shared = False response = self.nef.get('nas/nfs') for share in response['data']: if (share.get('filesystem') == path): shared = True break if (not shared): raise LookupError((_('Dataset %s is not shared in Nexenta Store appliance') % path))
Verify that the volume for our folder exists. :raise: :py:exc:`LookupError`
cinder/volume/drivers/nexenta/ns5/nfs.py
check_for_setup_error
pengMK/cinder
11
python
def check_for_setup_error(self): 'Verify that the volume for our folder exists.\n\n :raise: :py:exc:`LookupError`\n ' (pool_name, fs) = self._get_share_datasets(self.share) url = ('storage/pools/%s' % pool_name) if (not self.nef.get(url)): raise LookupError((_('Pool %s does not exist in Nexenta Store appliance') % pool_name)) url = ('storage/pools/%s/filesystems/%s' % (pool_name, fs)) if (not self.nef.get(url)): raise LookupError((_('filesystem %s does not exist in Nexenta Store appliance') % fs)) path = '/'.join([pool_name, fs]) shared = False response = self.nef.get('nas/nfs') for share in response['data']: if (share.get('filesystem') == path): shared = True break if (not shared): raise LookupError((_('Dataset %s is not shared in Nexenta Store appliance') % path))
def check_for_setup_error(self): 'Verify that the volume for our folder exists.\n\n :raise: :py:exc:`LookupError`\n ' (pool_name, fs) = self._get_share_datasets(self.share) url = ('storage/pools/%s' % pool_name) if (not self.nef.get(url)): raise LookupError((_('Pool %s does not exist in Nexenta Store appliance') % pool_name)) url = ('storage/pools/%s/filesystems/%s' % (pool_name, fs)) if (not self.nef.get(url)): raise LookupError((_('filesystem %s does not exist in Nexenta Store appliance') % fs)) path = '/'.join([pool_name, fs]) shared = False response = self.nef.get('nas/nfs') for share in response['data']: if (share.get('filesystem') == path): shared = True break if (not shared): raise LookupError((_('Dataset %s is not shared in Nexenta Store appliance') % path))<|docstring|>Verify that the volume for our folder exists. :raise: :py:exc:`LookupError`<|endoftext|>
f9a468e80bf307352ff3717443e9a0ac06e3f41617fd1ff7d7783ae1a60b56b1
def initialize_connection(self, volume, connector): 'Allow connection to connector and return connection info.\n\n :param volume: volume reference\n :param connector: connector reference\n ' data = {'export': volume['provider_location'], 'name': 'volume'} if (volume['provider_location'] in self.shares): data['options'] = self.shares[volume['provider_location']] return {'driver_volume_type': self.driver_volume_type, 'data': data}
Allow connection to connector and return connection info. :param volume: volume reference :param connector: connector reference
cinder/volume/drivers/nexenta/ns5/nfs.py
initialize_connection
pengMK/cinder
11
python
def initialize_connection(self, volume, connector): 'Allow connection to connector and return connection info.\n\n :param volume: volume reference\n :param connector: connector reference\n ' data = {'export': volume['provider_location'], 'name': 'volume'} if (volume['provider_location'] in self.shares): data['options'] = self.shares[volume['provider_location']] return {'driver_volume_type': self.driver_volume_type, 'data': data}
def initialize_connection(self, volume, connector): 'Allow connection to connector and return connection info.\n\n :param volume: volume reference\n :param connector: connector reference\n ' data = {'export': volume['provider_location'], 'name': 'volume'} if (volume['provider_location'] in self.shares): data['options'] = self.shares[volume['provider_location']] return {'driver_volume_type': self.driver_volume_type, 'data': data}<|docstring|>Allow connection to connector and return connection info. :param volume: volume reference :param connector: connector reference<|endoftext|>
1f8caf70d2a9af7c6312b758dc8acb7c0cefa7862bb12bff09f059a9455e0639
def create_volume(self, volume): 'Creates a volume.\n\n :param volume: volume reference\n :returns: provider_location update dict for database\n ' self._do_create_volume(volume) return {'provider_location': volume['provider_location']}
Creates a volume. :param volume: volume reference :returns: provider_location update dict for database
cinder/volume/drivers/nexenta/ns5/nfs.py
create_volume
pengMK/cinder
11
python
def create_volume(self, volume): 'Creates a volume.\n\n :param volume: volume reference\n :returns: provider_location update dict for database\n ' self._do_create_volume(volume) return {'provider_location': volume['provider_location']}
def create_volume(self, volume): 'Creates a volume.\n\n :param volume: volume reference\n :returns: provider_location update dict for database\n ' self._do_create_volume(volume) return {'provider_location': volume['provider_location']}<|docstring|>Creates a volume. :param volume: volume reference :returns: provider_location update dict for database<|endoftext|>
10abfbc824ce7f3569a1690107c6be7b3eb0f4f3377e7e30580e67e42faca8a4
def delete_volume(self, volume): 'Deletes a logical volume.\n\n :param volume: volume reference\n ' (pool, fs) = self._get_share_datasets(self.share) url = ('storage/pools/%(pool)s/filesystems/%(fs)s' % {'pool': pool, 'fs': '%2F'.join([fs, volume['name']])}) origin = self.nef.get(url).get('originalSnapshot') url = ('storage/pools/%(pool)s/filesystems/%(fs)s?snapshots=true' % {'pool': pool, 'fs': '%2F'.join([fs, volume['name']])}) try: self.nef.delete(url) except exception.NexentaException as exc: if ('Failed to destroy snapshot' in exc.args[0]): LOG.debug('Snapshot has dependent clones, skipping') else: raise try: if (origin and self._is_clone_snapshot_name(origin)): (path, snap) = origin.split('@') (pool, fs) = path.split('/', 1) snap_url = ('storage/pools/%(pool)s/filesystems/%(fs)s/snapshots/%(snap)s' % {'pool': pool, 'fs': fs, 'snap': snap}) self.nef.delete(snap_url) except exception.NexentaException as exc: if ('does not exist' in exc.args[0]): LOG.debug('Volume %s does not exist on appliance', '/'.join([pool, fs]))
Deletes a logical volume. :param volume: volume reference
cinder/volume/drivers/nexenta/ns5/nfs.py
delete_volume
pengMK/cinder
11
python
def delete_volume(self, volume): 'Deletes a logical volume.\n\n :param volume: volume reference\n ' (pool, fs) = self._get_share_datasets(self.share) url = ('storage/pools/%(pool)s/filesystems/%(fs)s' % {'pool': pool, 'fs': '%2F'.join([fs, volume['name']])}) origin = self.nef.get(url).get('originalSnapshot') url = ('storage/pools/%(pool)s/filesystems/%(fs)s?snapshots=true' % {'pool': pool, 'fs': '%2F'.join([fs, volume['name']])}) try: self.nef.delete(url) except exception.NexentaException as exc: if ('Failed to destroy snapshot' in exc.args[0]): LOG.debug('Snapshot has dependent clones, skipping') else: raise try: if (origin and self._is_clone_snapshot_name(origin)): (path, snap) = origin.split('@') (pool, fs) = path.split('/', 1) snap_url = ('storage/pools/%(pool)s/filesystems/%(fs)s/snapshots/%(snap)s' % {'pool': pool, 'fs': fs, 'snap': snap}) self.nef.delete(snap_url) except exception.NexentaException as exc: if ('does not exist' in exc.args[0]): LOG.debug('Volume %s does not exist on appliance', '/'.join([pool, fs]))
def delete_volume(self, volume): 'Deletes a logical volume.\n\n :param volume: volume reference\n ' (pool, fs) = self._get_share_datasets(self.share) url = ('storage/pools/%(pool)s/filesystems/%(fs)s' % {'pool': pool, 'fs': '%2F'.join([fs, volume['name']])}) origin = self.nef.get(url).get('originalSnapshot') url = ('storage/pools/%(pool)s/filesystems/%(fs)s?snapshots=true' % {'pool': pool, 'fs': '%2F'.join([fs, volume['name']])}) try: self.nef.delete(url) except exception.NexentaException as exc: if ('Failed to destroy snapshot' in exc.args[0]): LOG.debug('Snapshot has dependent clones, skipping') else: raise try: if (origin and self._is_clone_snapshot_name(origin)): (path, snap) = origin.split('@') (pool, fs) = path.split('/', 1) snap_url = ('storage/pools/%(pool)s/filesystems/%(fs)s/snapshots/%(snap)s' % {'pool': pool, 'fs': fs, 'snap': snap}) self.nef.delete(snap_url) except exception.NexentaException as exc: if ('does not exist' in exc.args[0]): LOG.debug('Volume %s does not exist on appliance', '/'.join([pool, fs]))<|docstring|>Deletes a logical volume. :param volume: volume reference<|endoftext|>
e2b45903a525868d42b3b424b6aa92e02f023f6fc47e297ceb8c0fbc7580f760
def create_snapshot(self, snapshot): 'Creates a snapshot.\n\n :param snapshot: snapshot reference\n ' volume = self._get_snapshot_volume(snapshot) (pool, fs) = self._get_share_datasets(self.share) url = ('storage/pools/%(pool)s/filesystems/%(fs)s/snapshots' % {'pool': pool, 'fs': '%2F'.join([fs, volume['name']])}) data = {'name': snapshot['name']} self.nef.post(url, data)
Creates a snapshot. :param snapshot: snapshot reference
cinder/volume/drivers/nexenta/ns5/nfs.py
create_snapshot
pengMK/cinder
11
python
def create_snapshot(self, snapshot): 'Creates a snapshot.\n\n :param snapshot: snapshot reference\n ' volume = self._get_snapshot_volume(snapshot) (pool, fs) = self._get_share_datasets(self.share) url = ('storage/pools/%(pool)s/filesystems/%(fs)s/snapshots' % {'pool': pool, 'fs': '%2F'.join([fs, volume['name']])}) data = {'name': snapshot['name']} self.nef.post(url, data)
def create_snapshot(self, snapshot): 'Creates a snapshot.\n\n :param snapshot: snapshot reference\n ' volume = self._get_snapshot_volume(snapshot) (pool, fs) = self._get_share_datasets(self.share) url = ('storage/pools/%(pool)s/filesystems/%(fs)s/snapshots' % {'pool': pool, 'fs': '%2F'.join([fs, volume['name']])}) data = {'name': snapshot['name']} self.nef.post(url, data)<|docstring|>Creates a snapshot. :param snapshot: snapshot reference<|endoftext|>
a3dbecdad05fc07782f58e5527bcc30bc606c09798a9661dbede38dbabc00565
def delete_snapshot(self, snapshot): 'Deletes a snapshot.\n\n :param snapshot: snapshot reference\n ' volume = self._get_snapshot_volume(snapshot) (pool, fs) = self._get_share_datasets(self.share) url = ('storage/pools/%(pool)s/filesystems/%(fs)s/snapshots/%(snap)s' % {'pool': pool, 'fs': '%2F'.join([fs, volume['name']]), 'snap': snapshot['name']}) try: self.nef.delete(url) except exception.NexentaException as exc: if ('EBUSY' is exc): LOG.warning(_LW('Could not delete snapshot %s - it has dependencies'), snapshot['name'])
Deletes a snapshot. :param snapshot: snapshot reference
cinder/volume/drivers/nexenta/ns5/nfs.py
delete_snapshot
pengMK/cinder
11
python
def delete_snapshot(self, snapshot): 'Deletes a snapshot.\n\n :param snapshot: snapshot reference\n ' volume = self._get_snapshot_volume(snapshot) (pool, fs) = self._get_share_datasets(self.share) url = ('storage/pools/%(pool)s/filesystems/%(fs)s/snapshots/%(snap)s' % {'pool': pool, 'fs': '%2F'.join([fs, volume['name']]), 'snap': snapshot['name']}) try: self.nef.delete(url) except exception.NexentaException as exc: if ('EBUSY' is exc): LOG.warning(_LW('Could not delete snapshot %s - it has dependencies'), snapshot['name'])
def delete_snapshot(self, snapshot): 'Deletes a snapshot.\n\n :param snapshot: snapshot reference\n ' volume = self._get_snapshot_volume(snapshot) (pool, fs) = self._get_share_datasets(self.share) url = ('storage/pools/%(pool)s/filesystems/%(fs)s/snapshots/%(snap)s' % {'pool': pool, 'fs': '%2F'.join([fs, volume['name']]), 'snap': snapshot['name']}) try: self.nef.delete(url) except exception.NexentaException as exc: if ('EBUSY' is exc): LOG.warning(_LW('Could not delete snapshot %s - it has dependencies'), snapshot['name'])<|docstring|>Deletes a snapshot. :param snapshot: snapshot reference<|endoftext|>
d2997d0e81f0f745010f6b23c6920d253ceab843f514a96ef08099ba4fc6f11e
def create_volume_from_snapshot(self, volume, snapshot): "Create new volume from other's snapshot on appliance.\n\n :param volume: reference of volume to be created\n :param snapshot: reference of source snapshot\n " snapshot_vol = self._get_snapshot_volume(snapshot) volume['provider_location'] = snapshot_vol['provider_location'] (pool, fs) = self._get_share_datasets(self.share) dataset_path = ('%s/%s' % (pool, fs)) url = ('storage/pools/%(pool)s/filesystems/%(fs)s/snapshots/%(snap)s/clone' % {'pool': pool, 'fs': '%2F'.join([fs, snapshot_vol['name']]), 'snap': snapshot['name']}) path = '/'.join([pool, fs, volume['name']]) data = {'targetPath': path} self.nef.post(url, data) path = '%2F'.join([pool, fs, volume['name']]) url = ('storage/filesystems/%s/promote' % path) self.nef.post(url) try: self._share_folder(fs, volume['name']) except exception.NexentaException: try: url = ('storage/pools/%(pool)s/filesystems/%(fs)s' % {'pool': pool, 'fs': volume['name']}) self.nef.delete(url) except exception.NexentaException: LOG.warning(_LW('Cannot destroy cloned filesystem: %(vol)s/%(filesystem)s'), {'vol': dataset_path, 'filesystem': volume['name']}) raise return {'provider_location': volume['provider_location']}
Create new volume from other's snapshot on appliance. :param volume: reference of volume to be created :param snapshot: reference of source snapshot
cinder/volume/drivers/nexenta/ns5/nfs.py
create_volume_from_snapshot
pengMK/cinder
11
python
def create_volume_from_snapshot(self, volume, snapshot): "Create new volume from other's snapshot on appliance.\n\n :param volume: reference of volume to be created\n :param snapshot: reference of source snapshot\n " snapshot_vol = self._get_snapshot_volume(snapshot) volume['provider_location'] = snapshot_vol['provider_location'] (pool, fs) = self._get_share_datasets(self.share) dataset_path = ('%s/%s' % (pool, fs)) url = ('storage/pools/%(pool)s/filesystems/%(fs)s/snapshots/%(snap)s/clone' % {'pool': pool, 'fs': '%2F'.join([fs, snapshot_vol['name']]), 'snap': snapshot['name']}) path = '/'.join([pool, fs, volume['name']]) data = {'targetPath': path} self.nef.post(url, data) path = '%2F'.join([pool, fs, volume['name']]) url = ('storage/filesystems/%s/promote' % path) self.nef.post(url) try: self._share_folder(fs, volume['name']) except exception.NexentaException: try: url = ('storage/pools/%(pool)s/filesystems/%(fs)s' % {'pool': pool, 'fs': volume['name']}) self.nef.delete(url) except exception.NexentaException: LOG.warning(_LW('Cannot destroy cloned filesystem: %(vol)s/%(filesystem)s'), {'vol': dataset_path, 'filesystem': volume['name']}) raise return {'provider_location': volume['provider_location']}
def create_volume_from_snapshot(self, volume, snapshot): "Create new volume from other's snapshot on appliance.\n\n :param volume: reference of volume to be created\n :param snapshot: reference of source snapshot\n " snapshot_vol = self._get_snapshot_volume(snapshot) volume['provider_location'] = snapshot_vol['provider_location'] (pool, fs) = self._get_share_datasets(self.share) dataset_path = ('%s/%s' % (pool, fs)) url = ('storage/pools/%(pool)s/filesystems/%(fs)s/snapshots/%(snap)s/clone' % {'pool': pool, 'fs': '%2F'.join([fs, snapshot_vol['name']]), 'snap': snapshot['name']}) path = '/'.join([pool, fs, volume['name']]) data = {'targetPath': path} self.nef.post(url, data) path = '%2F'.join([pool, fs, volume['name']]) url = ('storage/filesystems/%s/promote' % path) self.nef.post(url) try: self._share_folder(fs, volume['name']) except exception.NexentaException: try: url = ('storage/pools/%(pool)s/filesystems/%(fs)s' % {'pool': pool, 'fs': volume['name']}) self.nef.delete(url) except exception.NexentaException: LOG.warning(_LW('Cannot destroy cloned filesystem: %(vol)s/%(filesystem)s'), {'vol': dataset_path, 'filesystem': volume['name']}) raise return {'provider_location': volume['provider_location']}<|docstring|>Create new volume from other's snapshot on appliance. :param volume: reference of volume to be created :param snapshot: reference of source snapshot<|endoftext|>
b96da1f7888c23a1d67bf3741203fb374ff0f65ebfb437107e5fd5cf29cf1d4b
def create_cloned_volume(self, volume, src_vref): 'Creates a clone of the specified volume.\n\n :param volume: new volume reference\n :param src_vref: source volume reference\n ' LOG.info(_LI('Creating clone of volume: %s'), src_vref['id']) snapshot = {'volume_name': src_vref['name'], 'volume_id': src_vref['id'], 'name': self._get_clone_snapshot_name(volume)} self.create_snapshot(snapshot) try: return self.create_volume_from_snapshot(volume, snapshot) except exception.NexentaException: LOG.error(_LE('Volume creation failed, deleting created snapshot %(volume_name)s@%(name)s'), snapshot) try: self.delete_snapshot(snapshot) except (exception.NexentaException, exception.SnapshotIsBusy): LOG.warning(_LW('Failed to delete zfs snapshot %(volume_name)s@%(name)s'), snapshot) raise self.delete_snapshot(snapshot)
Creates a clone of the specified volume. :param volume: new volume reference :param src_vref: source volume reference
cinder/volume/drivers/nexenta/ns5/nfs.py
create_cloned_volume
pengMK/cinder
11
python
def create_cloned_volume(self, volume, src_vref): 'Creates a clone of the specified volume.\n\n :param volume: new volume reference\n :param src_vref: source volume reference\n ' LOG.info(_LI('Creating clone of volume: %s'), src_vref['id']) snapshot = {'volume_name': src_vref['name'], 'volume_id': src_vref['id'], 'name': self._get_clone_snapshot_name(volume)} self.create_snapshot(snapshot) try: return self.create_volume_from_snapshot(volume, snapshot) except exception.NexentaException: LOG.error(_LE('Volume creation failed, deleting created snapshot %(volume_name)s@%(name)s'), snapshot) try: self.delete_snapshot(snapshot) except (exception.NexentaException, exception.SnapshotIsBusy): LOG.warning(_LW('Failed to delete zfs snapshot %(volume_name)s@%(name)s'), snapshot) raise self.delete_snapshot(snapshot)
def create_cloned_volume(self, volume, src_vref): 'Creates a clone of the specified volume.\n\n :param volume: new volume reference\n :param src_vref: source volume reference\n ' LOG.info(_LI('Creating clone of volume: %s'), src_vref['id']) snapshot = {'volume_name': src_vref['name'], 'volume_id': src_vref['id'], 'name': self._get_clone_snapshot_name(volume)} self.create_snapshot(snapshot) try: return self.create_volume_from_snapshot(volume, snapshot) except exception.NexentaException: LOG.error(_LE('Volume creation failed, deleting created snapshot %(volume_name)s@%(name)s'), snapshot) try: self.delete_snapshot(snapshot) except (exception.NexentaException, exception.SnapshotIsBusy): LOG.warning(_LW('Failed to delete zfs snapshot %(volume_name)s@%(name)s'), snapshot) raise self.delete_snapshot(snapshot)<|docstring|>Creates a clone of the specified volume. :param volume: new volume reference :param src_vref: source volume reference<|endoftext|>
6b1d139a86f71b838765094637c86ff39b10fbfbb269617ff1289d05ccbb283e
def local_path(self, volume): 'Get volume path (mounted locally fs path) for given volume.\n\n :param volume: volume reference\n ' nfs_share = volume['provider_location'] return os.path.join(self._get_mount_point_for_share(nfs_share), 'volume')
Get volume path (mounted locally fs path) for given volume. :param volume: volume reference
cinder/volume/drivers/nexenta/ns5/nfs.py
local_path
pengMK/cinder
11
python
def local_path(self, volume): 'Get volume path (mounted locally fs path) for given volume.\n\n :param volume: volume reference\n ' nfs_share = volume['provider_location'] return os.path.join(self._get_mount_point_for_share(nfs_share), 'volume')
def local_path(self, volume): 'Get volume path (mounted locally fs path) for given volume.\n\n :param volume: volume reference\n ' nfs_share = volume['provider_location'] return os.path.join(self._get_mount_point_for_share(nfs_share), 'volume')<|docstring|>Get volume path (mounted locally fs path) for given volume. :param volume: volume reference<|endoftext|>
80d9e52166def49f325e96f263885742d9295aa35cdb21f42aa92d569d2aa342
def _get_mount_point_for_share(self, nfs_share): 'Returns path to mount point NFS share.\n\n :param nfs_share: example 172.18.194.100:/var/nfs\n ' nfs_share = nfs_share.encode('utf-8') return os.path.join(self.configuration.nexenta_mount_point_base, hashlib.md5(nfs_share).hexdigest())
Returns path to mount point NFS share. :param nfs_share: example 172.18.194.100:/var/nfs
cinder/volume/drivers/nexenta/ns5/nfs.py
_get_mount_point_for_share
pengMK/cinder
11
python
def _get_mount_point_for_share(self, nfs_share): 'Returns path to mount point NFS share.\n\n :param nfs_share: example 172.18.194.100:/var/nfs\n ' nfs_share = nfs_share.encode('utf-8') return os.path.join(self.configuration.nexenta_mount_point_base, hashlib.md5(nfs_share).hexdigest())
def _get_mount_point_for_share(self, nfs_share): 'Returns path to mount point NFS share.\n\n :param nfs_share: example 172.18.194.100:/var/nfs\n ' nfs_share = nfs_share.encode('utf-8') return os.path.join(self.configuration.nexenta_mount_point_base, hashlib.md5(nfs_share).hexdigest())<|docstring|>Returns path to mount point NFS share. :param nfs_share: example 172.18.194.100:/var/nfs<|endoftext|>
85e15414305d299fef026307247159d4611de238be2b98d1a372f9b193cb85dc
def _share_folder(self, path, filesystem): 'Share NFS filesystem on NexentaStor Appliance.\n\n :param nef: nef object\n :param path: path to parent filesystem\n :param filesystem: filesystem that needs to be shared\n ' pool = self.share.split('/')[0] LOG.debug('Creating ACL for filesystem %s on Nexenta Store', filesystem) url = ('storage/pools/%s/filesystems/%s/acl' % (pool, '%2F'.join([path.replace('/', '%2F'), filesystem]))) data = {'type': 'allow', 'principal': 'everyone@', 'permissions': ['list_directory', 'read_data', 'add_file', 'write_data', 'add_subdirectory', 'append_data', 'read_xattr', 'write_xattr', 'execute', 'delete_child', 'read_attributes', 'write_attributes', 'delete', 'read_acl', 'write_acl', 'write_owner', 'synchronize'], 'flags': ['file_inherit', 'dir_inherit']} self.nef.post(url, data) LOG.debug('Successfully shared filesystem %s', '/'.join([path, filesystem]))
Share NFS filesystem on NexentaStor Appliance. :param nef: nef object :param path: path to parent filesystem :param filesystem: filesystem that needs to be shared
cinder/volume/drivers/nexenta/ns5/nfs.py
_share_folder
pengMK/cinder
11
python
def _share_folder(self, path, filesystem): 'Share NFS filesystem on NexentaStor Appliance.\n\n :param nef: nef object\n :param path: path to parent filesystem\n :param filesystem: filesystem that needs to be shared\n ' pool = self.share.split('/')[0] LOG.debug('Creating ACL for filesystem %s on Nexenta Store', filesystem) url = ('storage/pools/%s/filesystems/%s/acl' % (pool, '%2F'.join([path.replace('/', '%2F'), filesystem]))) data = {'type': 'allow', 'principal': 'everyone@', 'permissions': ['list_directory', 'read_data', 'add_file', 'write_data', 'add_subdirectory', 'append_data', 'read_xattr', 'write_xattr', 'execute', 'delete_child', 'read_attributes', 'write_attributes', 'delete', 'read_acl', 'write_acl', 'write_owner', 'synchronize'], 'flags': ['file_inherit', 'dir_inherit']} self.nef.post(url, data) LOG.debug('Successfully shared filesystem %s', '/'.join([path, filesystem]))
def _share_folder(self, path, filesystem): 'Share NFS filesystem on NexentaStor Appliance.\n\n :param nef: nef object\n :param path: path to parent filesystem\n :param filesystem: filesystem that needs to be shared\n ' pool = self.share.split('/')[0] LOG.debug('Creating ACL for filesystem %s on Nexenta Store', filesystem) url = ('storage/pools/%s/filesystems/%s/acl' % (pool, '%2F'.join([path.replace('/', '%2F'), filesystem]))) data = {'type': 'allow', 'principal': 'everyone@', 'permissions': ['list_directory', 'read_data', 'add_file', 'write_data', 'add_subdirectory', 'append_data', 'read_xattr', 'write_xattr', 'execute', 'delete_child', 'read_attributes', 'write_attributes', 'delete', 'read_acl', 'write_acl', 'write_owner', 'synchronize'], 'flags': ['file_inherit', 'dir_inherit']} self.nef.post(url, data) LOG.debug('Successfully shared filesystem %s', '/'.join([path, filesystem]))<|docstring|>Share NFS filesystem on NexentaStor Appliance. :param nef: nef object :param path: path to parent filesystem :param filesystem: filesystem that needs to be shared<|endoftext|>
13045a6685a62da62851106cb46d3f6b9ecaccc6872f5133c04622236890c858
def _get_capacity_info(self, path): 'Calculate available space on the NFS share.\n\n :param path: example pool/nfs\n ' (pool, fs) = self._get_share_datasets(path) url = ('storage/pools/%s/filesystems/%s' % (pool, fs)) data = self.nef.get(url) total = utils.str2size(data['bytesAvailable']) allocated = utils.str2size(data['bytesUsed']) free = (total - allocated) return (total, free, allocated)
Calculate available space on the NFS share. :param path: example pool/nfs
cinder/volume/drivers/nexenta/ns5/nfs.py
_get_capacity_info
pengMK/cinder
11
python
def _get_capacity_info(self, path): 'Calculate available space on the NFS share.\n\n :param path: example pool/nfs\n ' (pool, fs) = self._get_share_datasets(path) url = ('storage/pools/%s/filesystems/%s' % (pool, fs)) data = self.nef.get(url) total = utils.str2size(data['bytesAvailable']) allocated = utils.str2size(data['bytesUsed']) free = (total - allocated) return (total, free, allocated)
def _get_capacity_info(self, path): 'Calculate available space on the NFS share.\n\n :param path: example pool/nfs\n ' (pool, fs) = self._get_share_datasets(path) url = ('storage/pools/%s/filesystems/%s' % (pool, fs)) data = self.nef.get(url) total = utils.str2size(data['bytesAvailable']) allocated = utils.str2size(data['bytesUsed']) free = (total - allocated) return (total, free, allocated)<|docstring|>Calculate available space on the NFS share. :param path: example pool/nfs<|endoftext|>
02f333902d6470ced27c288bc6ef0cebdc322dedc18ac0849fb039946602fa7e
def _get_clone_snapshot_name(self, volume): 'Return name for snapshot that will be used to clone the volume.' return ('cinder-clone-snapshot-%(id)s' % volume)
Return name for snapshot that will be used to clone the volume.
cinder/volume/drivers/nexenta/ns5/nfs.py
_get_clone_snapshot_name
pengMK/cinder
11
python
def _get_clone_snapshot_name(self, volume): return ('cinder-clone-snapshot-%(id)s' % volume)
def _get_clone_snapshot_name(self, volume): return ('cinder-clone-snapshot-%(id)s' % volume)<|docstring|>Return name for snapshot that will be used to clone the volume.<|endoftext|>
cee8b6e45cc645997ba60282ffcaa6ebf0b26f3797c0dd8002b726e4993430c3
def _is_clone_snapshot_name(self, snapshot): 'Check if snapshot is created for cloning.' name = snapshot.split('@')[(- 1)] return name.startswith('cinder-clone-snapshot-')
Check if snapshot is created for cloning.
cinder/volume/drivers/nexenta/ns5/nfs.py
_is_clone_snapshot_name
pengMK/cinder
11
python
def _is_clone_snapshot_name(self, snapshot): name = snapshot.split('@')[(- 1)] return name.startswith('cinder-clone-snapshot-')
def _is_clone_snapshot_name(self, snapshot): name = snapshot.split('@')[(- 1)] return name.startswith('cinder-clone-snapshot-')<|docstring|>Check if snapshot is created for cloning.<|endoftext|>
7c99a5a8d22d949e442c8cbe641c768084cf1a5564e9994bdd70309a85b17c10
def _update_volume_stats(self): 'Retrieve stats info for NexentaStor appliance.' LOG.debug('Updating volume stats') share = ':/'.join([self.nef_host, self.share]) (total, free, allocated) = self._get_capacity_info(self.share) total_space = utils.str2gib_size(total) free_space = utils.str2gib_size(free) location_info = ('%(driver)s:%(share)s' % {'driver': self.__class__.__name__, 'share': share}) self._stats = {'vendor_name': 'Nexenta', 'dedup': self.dataset_deduplication, 'compression': self.dataset_compression, 'description': self.dataset_description, 'nef_url': self.nef_host, 'driver_version': self.VERSION, 'storage_protocol': 'NFS', 'total_capacity_gb': total_space, 'free_capacity_gb': free_space, 'reserved_percentage': self.configuration.reserved_percentage, 'QoS_support': False, 'location_info': location_info, 'volume_backend_name': self.backend_name, 'nfs_mount_point_base': self.nfs_mount_point_base}
Retrieve stats info for NexentaStor appliance.
cinder/volume/drivers/nexenta/ns5/nfs.py
_update_volume_stats
pengMK/cinder
11
python
def _update_volume_stats(self): LOG.debug('Updating volume stats') share = ':/'.join([self.nef_host, self.share]) (total, free, allocated) = self._get_capacity_info(self.share) total_space = utils.str2gib_size(total) free_space = utils.str2gib_size(free) location_info = ('%(driver)s:%(share)s' % {'driver': self.__class__.__name__, 'share': share}) self._stats = {'vendor_name': 'Nexenta', 'dedup': self.dataset_deduplication, 'compression': self.dataset_compression, 'description': self.dataset_description, 'nef_url': self.nef_host, 'driver_version': self.VERSION, 'storage_protocol': 'NFS', 'total_capacity_gb': total_space, 'free_capacity_gb': free_space, 'reserved_percentage': self.configuration.reserved_percentage, 'QoS_support': False, 'location_info': location_info, 'volume_backend_name': self.backend_name, 'nfs_mount_point_base': self.nfs_mount_point_base}
def _update_volume_stats(self): LOG.debug('Updating volume stats') share = ':/'.join([self.nef_host, self.share]) (total, free, allocated) = self._get_capacity_info(self.share) total_space = utils.str2gib_size(total) free_space = utils.str2gib_size(free) location_info = ('%(driver)s:%(share)s' % {'driver': self.__class__.__name__, 'share': share}) self._stats = {'vendor_name': 'Nexenta', 'dedup': self.dataset_deduplication, 'compression': self.dataset_compression, 'description': self.dataset_description, 'nef_url': self.nef_host, 'driver_version': self.VERSION, 'storage_protocol': 'NFS', 'total_capacity_gb': total_space, 'free_capacity_gb': free_space, 'reserved_percentage': self.configuration.reserved_percentage, 'QoS_support': False, 'location_info': location_info, 'volume_backend_name': self.backend_name, 'nfs_mount_point_base': self.nfs_mount_point_base}<|docstring|>Retrieve stats info for NexentaStor appliance.<|endoftext|>
73d14d688b3769a54a167cc520a79b9af52ee9ca016af7f84f4aebd3e4f0198e
def __init__(self, params): "! Sets up the ODE solver\n @param params dict, the parameters used in the ODE solver\n\n <code>params['ode']</code> -- callable f: rhs=f(t,x,arg1), must provide\n\n <code>params['args']=None</code> -- the argment that will be used to call f\n\n <code>params['rtol']=1e-7</code> -- relative tolerance\n\n <code>params['type']='dopri5'</code> -- the type of integrator, 'dopri5' for RK45, 'dop853' for RK853\n " if ('ode' not in params.keys()): raise ValueError('Please specify the ODE to solve for the Integrator class') else: self.rhs = params['ode'] if ('type' not in params.keys()): params['type'] = 'dopri5' if (params['type'] not in ['dopri5', 'dop853']): raise ValueError('Please specify the correct type of RK solver, dopri5 for RK45, dop853 for RK853') if ('rtol' not in params.keys()): params['rtol'] = 1e-07 self.rtol = params['rtol'] if ('args' not in params.keys()): params['args'] = None self.args = params['args'] self.integrator = ode(self.rhs).set_integrator(params['type'], rtol=params['rtol']) super().__init__(params)
! Sets up the ODE solver @param params dict, the parameters used in the ODE solver <code>params['ode']</code> -- callable f: rhs=f(t,x,arg1), must provide <code>params['args']=None</code> -- the argment that will be used to call f <code>params['rtol']=1e-7</code> -- relative tolerance <code>params['type']='dopri5'</code> -- the type of integrator, 'dopri5' for RK45, 'dop853' for RK853
pyoculus/integrators/rk_integrator.py
__init__
mbkumar/pyoculus
4
python
def __init__(self, params): "! Sets up the ODE solver\n @param params dict, the parameters used in the ODE solver\n\n <code>params['ode']</code> -- callable f: rhs=f(t,x,arg1), must provide\n\n <code>params['args']=None</code> -- the argment that will be used to call f\n\n <code>params['rtol']=1e-7</code> -- relative tolerance\n\n <code>params['type']='dopri5'</code> -- the type of integrator, 'dopri5' for RK45, 'dop853' for RK853\n " if ('ode' not in params.keys()): raise ValueError('Please specify the ODE to solve for the Integrator class') else: self.rhs = params['ode'] if ('type' not in params.keys()): params['type'] = 'dopri5' if (params['type'] not in ['dopri5', 'dop853']): raise ValueError('Please specify the correct type of RK solver, dopri5 for RK45, dop853 for RK853') if ('rtol' not in params.keys()): params['rtol'] = 1e-07 self.rtol = params['rtol'] if ('args' not in params.keys()): params['args'] = None self.args = params['args'] self.integrator = ode(self.rhs).set_integrator(params['type'], rtol=params['rtol']) super().__init__(params)
def __init__(self, params): "! Sets up the ODE solver\n @param params dict, the parameters used in the ODE solver\n\n <code>params['ode']</code> -- callable f: rhs=f(t,x,arg1), must provide\n\n <code>params['args']=None</code> -- the argment that will be used to call f\n\n <code>params['rtol']=1e-7</code> -- relative tolerance\n\n <code>params['type']='dopri5'</code> -- the type of integrator, 'dopri5' for RK45, 'dop853' for RK853\n " if ('ode' not in params.keys()): raise ValueError('Please specify the ODE to solve for the Integrator class') else: self.rhs = params['ode'] if ('type' not in params.keys()): params['type'] = 'dopri5' if (params['type'] not in ['dopri5', 'dop853']): raise ValueError('Please specify the correct type of RK solver, dopri5 for RK45, dop853 for RK853') if ('rtol' not in params.keys()): params['rtol'] = 1e-07 self.rtol = params['rtol'] if ('args' not in params.keys()): params['args'] = None self.args = params['args'] self.integrator = ode(self.rhs).set_integrator(params['type'], rtol=params['rtol']) super().__init__(params)<|docstring|>! Sets up the ODE solver @param params dict, the parameters used in the ODE solver <code>params['ode']</code> -- callable f: rhs=f(t,x,arg1), must provide <code>params['args']=None</code> -- the argment that will be used to call f <code>params['rtol']=1e-7</code> -- relative tolerance <code>params['type']='dopri5'</code> -- the type of integrator, 'dopri5' for RK45, 'dop853' for RK853<|endoftext|>
cd44af5468ae7302edbaa0e5f871a40902a078e69edad96e028473deb01ba3a9
def set_initial_value(self, t, x): '! Sets up the initial value for the ODE solver\n @param t the start of time\n @param x the start of coordinates\n ' self.integrator.set_initial_value(x, t).set_f_params(self._params['args']) try: testoutput = self.rhs(t, x, self.args) except: print('ODE function not callable') raise super().set_initial_value(t, x)
! Sets up the initial value for the ODE solver @param t the start of time @param x the start of coordinates
pyoculus/integrators/rk_integrator.py
set_initial_value
mbkumar/pyoculus
4
python
def set_initial_value(self, t, x): '! Sets up the initial value for the ODE solver\n @param t the start of time\n @param x the start of coordinates\n ' self.integrator.set_initial_value(x, t).set_f_params(self._params['args']) try: testoutput = self.rhs(t, x, self.args) except: print('ODE function not callable') raise super().set_initial_value(t, x)
def set_initial_value(self, t, x): '! Sets up the initial value for the ODE solver\n @param t the start of time\n @param x the start of coordinates\n ' self.integrator.set_initial_value(x, t).set_f_params(self._params['args']) try: testoutput = self.rhs(t, x, self.args) except: print('ODE function not callable') raise super().set_initial_value(t, x)<|docstring|>! Sets up the initial value for the ODE solver @param t the start of time @param x the start of coordinates<|endoftext|>
b57152dbae4d31f801797167918009a07444dee375cd025b68b4cd22a4d6e8bf
def integrate(self, tend): '! Integrates the ODE until `tend`\n @param tend the target end time\n @returns the new value of x\n ' x_new = self.integrator.integrate(tend) if (not self.integrator.successful()): raise Exception('Integration failed') self.x = x_new self.t = tend return x_new
! Integrates the ODE until `tend` @param tend the target end time @returns the new value of x
pyoculus/integrators/rk_integrator.py
integrate
mbkumar/pyoculus
4
python
def integrate(self, tend): '! Integrates the ODE until `tend`\n @param tend the target end time\n @returns the new value of x\n ' x_new = self.integrator.integrate(tend) if (not self.integrator.successful()): raise Exception('Integration failed') self.x = x_new self.t = tend return x_new
def integrate(self, tend): '! Integrates the ODE until `tend`\n @param tend the target end time\n @returns the new value of x\n ' x_new = self.integrator.integrate(tend) if (not self.integrator.successful()): raise Exception('Integration failed') self.x = x_new self.t = tend return x_new<|docstring|>! Integrates the ODE until `tend` @param tend the target end time @returns the new value of x<|endoftext|>
bfda70bd387b83b823912f6b7b6bc79e604a7cec910379ee41d6fa7d19a88b8b
def copy(self): '! Returns a copy of self, to use if want to compute in parallel\n @returns a copy of self\n ' return RKIntegrator(self._params)
! Returns a copy of self, to use if want to compute in parallel @returns a copy of self
pyoculus/integrators/rk_integrator.py
copy
mbkumar/pyoculus
4
python
def copy(self): '! Returns a copy of self, to use if want to compute in parallel\n @returns a copy of self\n ' return RKIntegrator(self._params)
def copy(self): '! Returns a copy of self, to use if want to compute in parallel\n @returns a copy of self\n ' return RKIntegrator(self._params)<|docstring|>! Returns a copy of self, to use if want to compute in parallel @returns a copy of self<|endoftext|>
faeea7c3fc128c2968f00ee4c84015628041bbeccf55638588b4bff18088084c
def get_queryset(self): 'retrieves the posts for the authenticated user' return self.queryset.filter(user=self.request.user)
retrieves the posts for the authenticated user
app/timeline/views.py
get_queryset
redwanc12/Timeline-REST-API
1
python
def get_queryset(self): return self.queryset.filter(user=self.request.user)
def get_queryset(self): return self.queryset.filter(user=self.request.user)<|docstring|>retrieves the posts for the authenticated user<|endoftext|>
0f6310a384d9a217f534471dbc4388b8f7a6589267af795b62715031a7b8dee9
def perform_create(self, serializer): 'create a new recipe' serializer.save(user=self.request.user)
create a new recipe
app/timeline/views.py
perform_create
redwanc12/Timeline-REST-API
1
python
def perform_create(self, serializer): serializer.save(user=self.request.user)
def perform_create(self, serializer): serializer.save(user=self.request.user)<|docstring|>create a new recipe<|endoftext|>
273f31fec029cfab34ddf1384248543a80d1e5085ceeacaab424ce649db576aa
@action(methods=['POST'], detail=True, url_path='upload-image') def upload_image(self, request, pk=None): 'upload an image to a post' post = self.get_object() serializer = self.get_serializer(post, data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
upload an image to a post
app/timeline/views.py
upload_image
redwanc12/Timeline-REST-API
1
python
@action(methods=['POST'], detail=True, url_path='upload-image') def upload_image(self, request, pk=None): post = self.get_object() serializer = self.get_serializer(post, data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
@action(methods=['POST'], detail=True, url_path='upload-image') def upload_image(self, request, pk=None): post = self.get_object() serializer = self.get_serializer(post, data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_200_OK) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)<|docstring|>upload an image to a post<|endoftext|>
fef64caad0947a44e4068be90fafd9b3db401806effec2ca24bab6df7268a7a2
def set_from_config(self, config: PasswortButtonStrings): 'Setzt die Strings des Widgets auf die des dictionary' self.setToolTip(config.whats_this) self.setWhatsThis(config.whats_this) pass
Setzt die Strings des Widgets auf die des dictionary
PasswortFenster/__PasswortEingabeWidget/__PasswortShowButton.py
set_from_config
heureka-code/PasswortFenster
1
python
def set_from_config(self, config: PasswortButtonStrings): self.setToolTip(config.whats_this) self.setWhatsThis(config.whats_this) pass
def set_from_config(self, config: PasswortButtonStrings): self.setToolTip(config.whats_this) self.setWhatsThis(config.whats_this) pass<|docstring|>Setzt die Strings des Widgets auf die des dictionary<|endoftext|>
0ff867319b3c2aadfa5c91b7a6faebf1d4139db9fef443a4827f7e377be86a82
def __state_changed(self): 'Wird ausgeführt, wenn der Button seinen Status durch klicken verändert und Prüft, ob das zugehörige Passwort angezeigt werden soll' if self.isChecked(): self.__passwort_eingabe.passwort_anzeigen() else: self.__passwort_eingabe.passwort_verstecken() pass
Wird ausgeführt, wenn der Button seinen Status durch klicken verändert und Prüft, ob das zugehörige Passwort angezeigt werden soll
PasswortFenster/__PasswortEingabeWidget/__PasswortShowButton.py
__state_changed
heureka-code/PasswortFenster
1
python
def __state_changed(self): if self.isChecked(): self.__passwort_eingabe.passwort_anzeigen() else: self.__passwort_eingabe.passwort_verstecken() pass
def __state_changed(self): if self.isChecked(): self.__passwort_eingabe.passwort_anzeigen() else: self.__passwort_eingabe.passwort_verstecken() pass<|docstring|>Wird ausgeführt, wenn der Button seinen Status durch klicken verändert und Prüft, ob das zugehörige Passwort angezeigt werden soll<|endoftext|>
3c9724d136a6ca91fee13b5175f34679a913b8036562545f401491520c555a3a
@mod.export() def get_trt_logger(): '\n Get the global TensorRT logger created by Polygraphy.\n\n Returns:\n trt.Logger: The TensorRT logger.\n ' global TRT_LOGGER if (TRT_LOGGER is None): TRT_LOGGER = trt.Logger() return TRT_LOGGER
Get the global TensorRT logger created by Polygraphy. Returns: trt.Logger: The TensorRT logger.
tools/Polygraphy/polygraphy/backend/trt/util.py
get_trt_logger
tobigue/TensorRT
5,249
python
@mod.export() def get_trt_logger(): '\n Get the global TensorRT logger created by Polygraphy.\n\n Returns:\n trt.Logger: The TensorRT logger.\n ' global TRT_LOGGER if (TRT_LOGGER is None): TRT_LOGGER = trt.Logger() return TRT_LOGGER
@mod.export() def get_trt_logger(): '\n Get the global TensorRT logger created by Polygraphy.\n\n Returns:\n trt.Logger: The TensorRT logger.\n ' global TRT_LOGGER if (TRT_LOGGER is None): TRT_LOGGER = trt.Logger() return TRT_LOGGER<|docstring|>Get the global TensorRT logger created by Polygraphy. Returns: trt.Logger: The TensorRT logger.<|endoftext|>
232429c7772cbb730074e7165eca7456f702b2baa1f3056fe56aeec1ba7a5a88
def str_from_network(network, mode='full'): '\n Converts a TensorRT network to a human-readable representation\n\n Args:\n network (trt.INetworkDefinition): The network.\n mode (str): Controls what is displayed for each layer. Choices: ["none", "basic", "attrs", "full"]\n\n Returns:\n str\n ' LAYER_TYPE_CLASS_MAPPING = get_layer_class_mapping() network_str = 'Name: {:} | {:} Batch Network{:}\n'.format(network.name, ('Implicit' if (hasattr(network, 'has_implicit_batch_dimension') and network.has_implicit_batch_dimension) else 'Explicit'), (' with Explicit Precision ' if (hasattr(network, 'has_explicit_precision') and network.has_explicit_precision) else '')) network_str += '\n' input_metadata = get_network_input_metadata(network) network_str += '---- {:} Network Input(s) ----\n{:}\n\n'.format(len(input_metadata), input_metadata) output_metadata = get_network_output_metadata(network) network_str += '---- {:} Network Output(s) ----\n{:}\n\n'.format(len(output_metadata), output_metadata) network_str += '---- {:} Layer(s) ----\n'.format(network.num_layers) if (mode != 'none'): for (index, layer) in enumerate(network): if (layer.type in LAYER_TYPE_CLASS_MAPPING): layer.__class__ = LAYER_TYPE_CLASS_MAPPING[layer.type] network_str += str_from_layer(layer, index) if (mode in ['attrs', 'full']): attrs = get_layer_attribute_names(layer) if attrs: network_str += (util.indent_block('---- Attributes ----') + '\n') for attr in attrs: with G_LOGGER.verbosity(): val = getattr(layer, attr) if ((mode == 'full') or (not isinstance(val, np.ndarray))): attr_str = '' if layer.name: attr_str += '{:}.'.format(layer.name) network_str += (util.indent_block('{:}{:} = {:}'.format(attr_str, attr, val)) + '\n') network_str += '\n' return util.indent_block(network_str, level=0)
Converts a TensorRT network to a human-readable representation Args: network (trt.INetworkDefinition): The network. mode (str): Controls what is displayed for each layer. Choices: ["none", "basic", "attrs", "full"] Returns: str
tools/Polygraphy/polygraphy/backend/trt/util.py
str_from_network
tobigue/TensorRT
5,249
python
def str_from_network(network, mode='full'): '\n Converts a TensorRT network to a human-readable representation\n\n Args:\n network (trt.INetworkDefinition): The network.\n mode (str): Controls what is displayed for each layer. Choices: ["none", "basic", "attrs", "full"]\n\n Returns:\n str\n ' LAYER_TYPE_CLASS_MAPPING = get_layer_class_mapping() network_str = 'Name: {:} | {:} Batch Network{:}\n'.format(network.name, ('Implicit' if (hasattr(network, 'has_implicit_batch_dimension') and network.has_implicit_batch_dimension) else 'Explicit'), (' with Explicit Precision ' if (hasattr(network, 'has_explicit_precision') and network.has_explicit_precision) else )) network_str += '\n' input_metadata = get_network_input_metadata(network) network_str += '---- {:} Network Input(s) ----\n{:}\n\n'.format(len(input_metadata), input_metadata) output_metadata = get_network_output_metadata(network) network_str += '---- {:} Network Output(s) ----\n{:}\n\n'.format(len(output_metadata), output_metadata) network_str += '---- {:} Layer(s) ----\n'.format(network.num_layers) if (mode != 'none'): for (index, layer) in enumerate(network): if (layer.type in LAYER_TYPE_CLASS_MAPPING): layer.__class__ = LAYER_TYPE_CLASS_MAPPING[layer.type] network_str += str_from_layer(layer, index) if (mode in ['attrs', 'full']): attrs = get_layer_attribute_names(layer) if attrs: network_str += (util.indent_block('---- Attributes ----') + '\n') for attr in attrs: with G_LOGGER.verbosity(): val = getattr(layer, attr) if ((mode == 'full') or (not isinstance(val, np.ndarray))): attr_str = if layer.name: attr_str += '{:}.'.format(layer.name) network_str += (util.indent_block('{:}{:} = {:}'.format(attr_str, attr, val)) + '\n') network_str += '\n' return util.indent_block(network_str, level=0)
def str_from_network(network, mode='full'): '\n Converts a TensorRT network to a human-readable representation\n\n Args:\n network (trt.INetworkDefinition): The network.\n mode (str): Controls what is displayed for each layer. Choices: ["none", "basic", "attrs", "full"]\n\n Returns:\n str\n ' LAYER_TYPE_CLASS_MAPPING = get_layer_class_mapping() network_str = 'Name: {:} | {:} Batch Network{:}\n'.format(network.name, ('Implicit' if (hasattr(network, 'has_implicit_batch_dimension') and network.has_implicit_batch_dimension) else 'Explicit'), (' with Explicit Precision ' if (hasattr(network, 'has_explicit_precision') and network.has_explicit_precision) else )) network_str += '\n' input_metadata = get_network_input_metadata(network) network_str += '---- {:} Network Input(s) ----\n{:}\n\n'.format(len(input_metadata), input_metadata) output_metadata = get_network_output_metadata(network) network_str += '---- {:} Network Output(s) ----\n{:}\n\n'.format(len(output_metadata), output_metadata) network_str += '---- {:} Layer(s) ----\n'.format(network.num_layers) if (mode != 'none'): for (index, layer) in enumerate(network): if (layer.type in LAYER_TYPE_CLASS_MAPPING): layer.__class__ = LAYER_TYPE_CLASS_MAPPING[layer.type] network_str += str_from_layer(layer, index) if (mode in ['attrs', 'full']): attrs = get_layer_attribute_names(layer) if attrs: network_str += (util.indent_block('---- Attributes ----') + '\n') for attr in attrs: with G_LOGGER.verbosity(): val = getattr(layer, attr) if ((mode == 'full') or (not isinstance(val, np.ndarray))): attr_str = if layer.name: attr_str += '{:}.'.format(layer.name) network_str += (util.indent_block('{:}{:} = {:}'.format(attr_str, attr, val)) + '\n') network_str += '\n' return util.indent_block(network_str, level=0)<|docstring|>Converts a TensorRT network to a human-readable representation Args: network (trt.INetworkDefinition): The network. mode (str): Controls what is displayed for each layer. Choices: ["none", "basic", "attrs", "full"] Returns: str<|endoftext|>
bca98105146cd1861acaf06af3eae0953bbb81900ff4e52b53ecc8922c4593be
def mark_outputs(network, outputs): '\n Mark the specified outputs as network outputs.\n\n Args:\n network (trt.INetworkDefinition): The network in which to mark outputs.\n outputs (Sequence[str]): The names of tensors to mark as outputs.\n ' outputs = set(outputs) all_outputs = [] for layer in network: for index in range(layer.num_outputs): tensor = layer.get_output(index) all_outputs.append(tensor.name) if tensor.is_network_output: network.unmark_output(tensor) if (tensor.name in outputs): if (not tensor.is_network_output): G_LOGGER.ultra_verbose('Marking {:} as an output'.format(tensor.name)) network.mark_output(tensor) marked_outputs = set(_get_network_outputs(network)) not_found = (outputs - marked_outputs) check_outputs_not_found(not_found, all_outputs)
Mark the specified outputs as network outputs. Args: network (trt.INetworkDefinition): The network in which to mark outputs. outputs (Sequence[str]): The names of tensors to mark as outputs.
tools/Polygraphy/polygraphy/backend/trt/util.py
mark_outputs
tobigue/TensorRT
5,249
python
def mark_outputs(network, outputs): '\n Mark the specified outputs as network outputs.\n\n Args:\n network (trt.INetworkDefinition): The network in which to mark outputs.\n outputs (Sequence[str]): The names of tensors to mark as outputs.\n ' outputs = set(outputs) all_outputs = [] for layer in network: for index in range(layer.num_outputs): tensor = layer.get_output(index) all_outputs.append(tensor.name) if tensor.is_network_output: network.unmark_output(tensor) if (tensor.name in outputs): if (not tensor.is_network_output): G_LOGGER.ultra_verbose('Marking {:} as an output'.format(tensor.name)) network.mark_output(tensor) marked_outputs = set(_get_network_outputs(network)) not_found = (outputs - marked_outputs) check_outputs_not_found(not_found, all_outputs)
def mark_outputs(network, outputs): '\n Mark the specified outputs as network outputs.\n\n Args:\n network (trt.INetworkDefinition): The network in which to mark outputs.\n outputs (Sequence[str]): The names of tensors to mark as outputs.\n ' outputs = set(outputs) all_outputs = [] for layer in network: for index in range(layer.num_outputs): tensor = layer.get_output(index) all_outputs.append(tensor.name) if tensor.is_network_output: network.unmark_output(tensor) if (tensor.name in outputs): if (not tensor.is_network_output): G_LOGGER.ultra_verbose('Marking {:} as an output'.format(tensor.name)) network.mark_output(tensor) marked_outputs = set(_get_network_outputs(network)) not_found = (outputs - marked_outputs) check_outputs_not_found(not_found, all_outputs)<|docstring|>Mark the specified outputs as network outputs. Args: network (trt.INetworkDefinition): The network in which to mark outputs. outputs (Sequence[str]): The names of tensors to mark as outputs.<|endoftext|>
7d074c1da37e40270da4a768aa17641c3c8ba3347643cc648ff829cd703583e3
def get_input_metadata_from_profile(profile, network): '\n Returns metadata about the inputs based on the OPT values set in a profile.\n\n Args:\n profile (trt.IOptimizationProfile):\n The profile from which to retrieve input metada.\n network (trt.INetworkDefinition):\n The network the profile applies to.\n\n Returns:\n TensorMetadata:\n A mapping of input names to their types and shapes.\n Shapes are retrieved from the OPT values in the profile.\n ' input_metadata = TensorMetadata() for index in range(network.num_inputs): tensor = network.get_input(index) if tensor.is_shape_tensor: shapes = profile.get_shape_input(tensor.name) else: shapes = profile.get_shape(tensor.name) if (tuple(shapes[0]) != tuple(shapes[2])): G_LOGGER.warning('Will use `opt` shapes from profile 0 for calibration. Note that even though `min` != `max` in this profile, calibration will use fixed input shapes (this is not necessarily an issue).') input_metadata.add(name=tensor.name, dtype=np_dtype_from_trt(tensor.dtype), shape=shapes[1]) return input_metadata
Returns metadata about the inputs based on the OPT values set in a profile. Args: profile (trt.IOptimizationProfile): The profile from which to retrieve input metada. network (trt.INetworkDefinition): The network the profile applies to. Returns: TensorMetadata: A mapping of input names to their types and shapes. Shapes are retrieved from the OPT values in the profile.
tools/Polygraphy/polygraphy/backend/trt/util.py
get_input_metadata_from_profile
tobigue/TensorRT
5,249
python
def get_input_metadata_from_profile(profile, network): '\n Returns metadata about the inputs based on the OPT values set in a profile.\n\n Args:\n profile (trt.IOptimizationProfile):\n The profile from which to retrieve input metada.\n network (trt.INetworkDefinition):\n The network the profile applies to.\n\n Returns:\n TensorMetadata:\n A mapping of input names to their types and shapes.\n Shapes are retrieved from the OPT values in the profile.\n ' input_metadata = TensorMetadata() for index in range(network.num_inputs): tensor = network.get_input(index) if tensor.is_shape_tensor: shapes = profile.get_shape_input(tensor.name) else: shapes = profile.get_shape(tensor.name) if (tuple(shapes[0]) != tuple(shapes[2])): G_LOGGER.warning('Will use `opt` shapes from profile 0 for calibration. Note that even though `min` != `max` in this profile, calibration will use fixed input shapes (this is not necessarily an issue).') input_metadata.add(name=tensor.name, dtype=np_dtype_from_trt(tensor.dtype), shape=shapes[1]) return input_metadata
def get_input_metadata_from_profile(profile, network): '\n Returns metadata about the inputs based on the OPT values set in a profile.\n\n Args:\n profile (trt.IOptimizationProfile):\n The profile from which to retrieve input metada.\n network (trt.INetworkDefinition):\n The network the profile applies to.\n\n Returns:\n TensorMetadata:\n A mapping of input names to their types and shapes.\n Shapes are retrieved from the OPT values in the profile.\n ' input_metadata = TensorMetadata() for index in range(network.num_inputs): tensor = network.get_input(index) if tensor.is_shape_tensor: shapes = profile.get_shape_input(tensor.name) else: shapes = profile.get_shape(tensor.name) if (tuple(shapes[0]) != tuple(shapes[2])): G_LOGGER.warning('Will use `opt` shapes from profile 0 for calibration. Note that even though `min` != `max` in this profile, calibration will use fixed input shapes (this is not necessarily an issue).') input_metadata.add(name=tensor.name, dtype=np_dtype_from_trt(tensor.dtype), shape=shapes[1]) return input_metadata<|docstring|>Returns metadata about the inputs based on the OPT values set in a profile. Args: profile (trt.IOptimizationProfile): The profile from which to retrieve input metada. network (trt.INetworkDefinition): The network the profile applies to. Returns: TensorMetadata: A mapping of input names to their types and shapes. Shapes are retrieved from the OPT values in the profile.<|endoftext|>
130b6c8de78af4567a932e076a64475cfa69465acacd98106cea4bf638d8dfe7
def get_active_profile_bindings(context): '\n Gets the start and end binding indices for the active optimization profile.\n\n Args:\n engine (trt.ICudaEngine): The engine in question.\n context (trt.IExecutionContext): The context where the profile is currently set.\n\n Returns:\n Tuple[int, int]: The start and end bindings indices, in that order\n ' active_profile = context.active_optimization_profile bindings_per_profile = get_bindings_per_profile(context.engine) start_binding = (bindings_per_profile * active_profile) end_binding = (start_binding + bindings_per_profile) G_LOGGER.ultra_verbose('Total # of Profiles: {:}, Bindings Per Profile: {:}, Active Profile: {:}, Start Binding: {:}, End Binding: {:}'.format(context.engine.num_optimization_profiles, bindings_per_profile, active_profile, start_binding, end_binding)) return (start_binding, end_binding)
Gets the start and end binding indices for the active optimization profile. Args: engine (trt.ICudaEngine): The engine in question. context (trt.IExecutionContext): The context where the profile is currently set. Returns: Tuple[int, int]: The start and end bindings indices, in that order
tools/Polygraphy/polygraphy/backend/trt/util.py
get_active_profile_bindings
tobigue/TensorRT
5,249
python
def get_active_profile_bindings(context): '\n Gets the start and end binding indices for the active optimization profile.\n\n Args:\n engine (trt.ICudaEngine): The engine in question.\n context (trt.IExecutionContext): The context where the profile is currently set.\n\n Returns:\n Tuple[int, int]: The start and end bindings indices, in that order\n ' active_profile = context.active_optimization_profile bindings_per_profile = get_bindings_per_profile(context.engine) start_binding = (bindings_per_profile * active_profile) end_binding = (start_binding + bindings_per_profile) G_LOGGER.ultra_verbose('Total # of Profiles: {:}, Bindings Per Profile: {:}, Active Profile: {:}, Start Binding: {:}, End Binding: {:}'.format(context.engine.num_optimization_profiles, bindings_per_profile, active_profile, start_binding, end_binding)) return (start_binding, end_binding)
def get_active_profile_bindings(context): '\n Gets the start and end binding indices for the active optimization profile.\n\n Args:\n engine (trt.ICudaEngine): The engine in question.\n context (trt.IExecutionContext): The context where the profile is currently set.\n\n Returns:\n Tuple[int, int]: The start and end bindings indices, in that order\n ' active_profile = context.active_optimization_profile bindings_per_profile = get_bindings_per_profile(context.engine) start_binding = (bindings_per_profile * active_profile) end_binding = (start_binding + bindings_per_profile) G_LOGGER.ultra_verbose('Total # of Profiles: {:}, Bindings Per Profile: {:}, Active Profile: {:}, Start Binding: {:}, End Binding: {:}'.format(context.engine.num_optimization_profiles, bindings_per_profile, active_profile, start_binding, end_binding)) return (start_binding, end_binding)<|docstring|>Gets the start and end binding indices for the active optimization profile. Args: engine (trt.ICudaEngine): The engine in question. context (trt.IExecutionContext): The context where the profile is currently set. Returns: Tuple[int, int]: The start and end bindings indices, in that order<|endoftext|>
3f85afa90d657e3462103609f6f0223038963aa4f9ea676e769da1345e5a6f7b
def create_dirs(fname): "Create (output) directories if they don't exist\n " fname = os.path.dirname(os.path.abspath(fname)) if (not os.path.exists(fname)): os.makedirs(fname)
Create (output) directories if they don't exist
nlpplngen/generate.py
create_dirs
nlppln/nlppln-gen
0
python
def create_dirs(fname): "\n " fname = os.path.dirname(os.path.abspath(fname)) if (not os.path.exists(fname)): os.makedirs(fname)
def create_dirs(fname): "\n " fname = os.path.dirname(os.path.abspath(fname)) if (not os.path.exists(fname)): os.makedirs(fname)<|docstring|>Create (output) directories if they don't exist<|endoftext|>
78315286fa0294eaa570f3d3727691645dd01691cbfa62faf14824c179e60fde
def to_bool(v): "Convert 'y' to True and 'n' to False or raise an error." if (v == 'y'): return True elif (v == 'n'): return False raise ValueError('Invalid input "{}" (only "y" or "n" are allowed)'.format(v))
Convert 'y' to True and 'n' to False or raise an error.
nlpplngen/generate.py
to_bool
nlppln/nlppln-gen
0
python
def to_bool(v): if (v == 'y'): return True elif (v == 'n'): return False raise ValueError('Invalid input "{}" (only "y" or "n" are allowed)'.format(v))
def to_bool(v): if (v == 'y'): return True elif (v == 'n'): return False raise ValueError('Invalid input "{}" (only "y" or "n" are allowed)'.format(v))<|docstring|>Convert 'y' to True and 'n' to False or raise an error.<|endoftext|>
2ecf2ab077f4a284e22b3faf4185488deb80658f6fd5afc994e1a2ae86e61a3c
@click.command() def command(): 'Generate a cwl file that specifies an nlppln processing step.\n ' script = click.prompt('Generate python command?', default='y', type=click.Choice(['y', 'n'])) script = to_bool(script) test = click.prompt('Generate test file?', default='y', type=click.Choice(['y', 'n'])) test = to_bool(test) step = click.prompt('Generate cwl step?', default='y', type=click.Choice(['y', 'n'])) step = to_bool(step) if ((not script) and (not test) and (not step)): click.echo('Not generating script, test file or cwl step.') sys.exit() cname = click.prompt('Command name', default='command') meta_in = click.prompt('Metadata input file?', default='n', type=click.Choice(['y', 'n'])) meta_in = to_bool(meta_in) inputs = click.prompt('Multiple input files?', default='y', type=click.Choice(['y', 'n'])) inputs = to_bool(inputs) outputs = click.prompt('Multiple output files?', default='y', type=click.Choice(['y', 'n'])) outputs = to_bool(outputs) ext = None glb = None if (outputs and step): glb = click.prompt('Glob pattern of output files?', default='*.json') ext = glb.split('.')[(- 1)] meta_out = click.prompt('Metadata output file?', default='n', type=click.Choice(['y', 'n'])) meta_out = to_bool(meta_out) meta_out_file = None if meta_out: meta_out_file = click.prompt('Save metadata to?', type=click.Path(), default='metadata_out.csv') if meta_out_file.startswith('/'): meta_out_file = meta_out_file[1:] if script: d = OrderedDict({'meta_in': meta_in, 'in_dir': inputs, 'name': meta_out}) args = [a for a in d.keys() if d[a]] args.append('out_dir') template = env.get_template('command.py') r = template.render(command_name=cname, extension=ext, meta_in=meta_in, inputs=inputs, outputs=outputs, meta_out=meta_out, args=', '.join(args), meta_out_file=meta_out_file) default = 'nlppln/commands/{}.py'.format(cname) out_file = click.prompt('Save python command to', type=click.Path(), default=default) create_dirs(out_file) with codecs.open(out_file, 'wb', encoding='utf-8') as f: f.write(r) if test: template = env.get_template('test.py') r = template.render(command_name=cname) default = 'tests/test_{}.py'.format(cname) out_file = click.prompt('Save test to', type=click.Path(), default=default) create_dirs(out_file) with codecs.open(out_file, 'wb', encoding='utf-8') as f: f.write(r) f.write('\n') if step: template = env.get_template('step.cwl') r = template.render(command_name=cname, glob=glb, meta_in=meta_in, inputs=inputs, outputs=outputs, meta_out=meta_out, meta_out_file=meta_out_file) default = 'nlppln/cwl/{}.cwl'.format(cname.replace('_', '-')) out_file = click.prompt('Save cwl step to', type=click.Path(), default=default) create_dirs(out_file) with codecs.open(out_file, 'wb', encoding='utf-8') as f: f.write(r) f.write('\n')
Generate a cwl file that specifies an nlppln processing step.
nlpplngen/generate.py
command
nlppln/nlppln-gen
0
python
@click.command() def command(): '\n ' script = click.prompt('Generate python command?', default='y', type=click.Choice(['y', 'n'])) script = to_bool(script) test = click.prompt('Generate test file?', default='y', type=click.Choice(['y', 'n'])) test = to_bool(test) step = click.prompt('Generate cwl step?', default='y', type=click.Choice(['y', 'n'])) step = to_bool(step) if ((not script) and (not test) and (not step)): click.echo('Not generating script, test file or cwl step.') sys.exit() cname = click.prompt('Command name', default='command') meta_in = click.prompt('Metadata input file?', default='n', type=click.Choice(['y', 'n'])) meta_in = to_bool(meta_in) inputs = click.prompt('Multiple input files?', default='y', type=click.Choice(['y', 'n'])) inputs = to_bool(inputs) outputs = click.prompt('Multiple output files?', default='y', type=click.Choice(['y', 'n'])) outputs = to_bool(outputs) ext = None glb = None if (outputs and step): glb = click.prompt('Glob pattern of output files?', default='*.json') ext = glb.split('.')[(- 1)] meta_out = click.prompt('Metadata output file?', default='n', type=click.Choice(['y', 'n'])) meta_out = to_bool(meta_out) meta_out_file = None if meta_out: meta_out_file = click.prompt('Save metadata to?', type=click.Path(), default='metadata_out.csv') if meta_out_file.startswith('/'): meta_out_file = meta_out_file[1:] if script: d = OrderedDict({'meta_in': meta_in, 'in_dir': inputs, 'name': meta_out}) args = [a for a in d.keys() if d[a]] args.append('out_dir') template = env.get_template('command.py') r = template.render(command_name=cname, extension=ext, meta_in=meta_in, inputs=inputs, outputs=outputs, meta_out=meta_out, args=', '.join(args), meta_out_file=meta_out_file) default = 'nlppln/commands/{}.py'.format(cname) out_file = click.prompt('Save python command to', type=click.Path(), default=default) create_dirs(out_file) with codecs.open(out_file, 'wb', encoding='utf-8') as f: f.write(r) if test: template = env.get_template('test.py') r = template.render(command_name=cname) default = 'tests/test_{}.py'.format(cname) out_file = click.prompt('Save test to', type=click.Path(), default=default) create_dirs(out_file) with codecs.open(out_file, 'wb', encoding='utf-8') as f: f.write(r) f.write('\n') if step: template = env.get_template('step.cwl') r = template.render(command_name=cname, glob=glb, meta_in=meta_in, inputs=inputs, outputs=outputs, meta_out=meta_out, meta_out_file=meta_out_file) default = 'nlppln/cwl/{}.cwl'.format(cname.replace('_', '-')) out_file = click.prompt('Save cwl step to', type=click.Path(), default=default) create_dirs(out_file) with codecs.open(out_file, 'wb', encoding='utf-8') as f: f.write(r) f.write('\n')
@click.command() def command(): '\n ' script = click.prompt('Generate python command?', default='y', type=click.Choice(['y', 'n'])) script = to_bool(script) test = click.prompt('Generate test file?', default='y', type=click.Choice(['y', 'n'])) test = to_bool(test) step = click.prompt('Generate cwl step?', default='y', type=click.Choice(['y', 'n'])) step = to_bool(step) if ((not script) and (not test) and (not step)): click.echo('Not generating script, test file or cwl step.') sys.exit() cname = click.prompt('Command name', default='command') meta_in = click.prompt('Metadata input file?', default='n', type=click.Choice(['y', 'n'])) meta_in = to_bool(meta_in) inputs = click.prompt('Multiple input files?', default='y', type=click.Choice(['y', 'n'])) inputs = to_bool(inputs) outputs = click.prompt('Multiple output files?', default='y', type=click.Choice(['y', 'n'])) outputs = to_bool(outputs) ext = None glb = None if (outputs and step): glb = click.prompt('Glob pattern of output files?', default='*.json') ext = glb.split('.')[(- 1)] meta_out = click.prompt('Metadata output file?', default='n', type=click.Choice(['y', 'n'])) meta_out = to_bool(meta_out) meta_out_file = None if meta_out: meta_out_file = click.prompt('Save metadata to?', type=click.Path(), default='metadata_out.csv') if meta_out_file.startswith('/'): meta_out_file = meta_out_file[1:] if script: d = OrderedDict({'meta_in': meta_in, 'in_dir': inputs, 'name': meta_out}) args = [a for a in d.keys() if d[a]] args.append('out_dir') template = env.get_template('command.py') r = template.render(command_name=cname, extension=ext, meta_in=meta_in, inputs=inputs, outputs=outputs, meta_out=meta_out, args=', '.join(args), meta_out_file=meta_out_file) default = 'nlppln/commands/{}.py'.format(cname) out_file = click.prompt('Save python command to', type=click.Path(), default=default) create_dirs(out_file) with codecs.open(out_file, 'wb', encoding='utf-8') as f: f.write(r) if test: template = env.get_template('test.py') r = template.render(command_name=cname) default = 'tests/test_{}.py'.format(cname) out_file = click.prompt('Save test to', type=click.Path(), default=default) create_dirs(out_file) with codecs.open(out_file, 'wb', encoding='utf-8') as f: f.write(r) f.write('\n') if step: template = env.get_template('step.cwl') r = template.render(command_name=cname, glob=glb, meta_in=meta_in, inputs=inputs, outputs=outputs, meta_out=meta_out, meta_out_file=meta_out_file) default = 'nlppln/cwl/{}.cwl'.format(cname.replace('_', '-')) out_file = click.prompt('Save cwl step to', type=click.Path(), default=default) create_dirs(out_file) with codecs.open(out_file, 'wb', encoding='utf-8') as f: f.write(r) f.write('\n')<|docstring|>Generate a cwl file that specifies an nlppln processing step.<|endoftext|>
c3f7b52cd6ea1526cdb0b2d00a74d4f91c544bc9ad61a9b8b1d5662a3a8bc1ff
def pick(image_rgb: np.ndarray, count: int=1) -> Optional[List[str]]: '\n Pick major colors from image\n ' if (not is_positive_int(count)): return None image_height = image_rgb.shape[0] image_width = image_rgb.shape[1] image_size = (image_height * image_width) rgb_ndarray = image_rgb.reshape(image_size, 3) cluster = KMeans(n_clusters=count, random_state=0) cluster.fit(rgb_ndarray) centers_arr = cluster.cluster_centers_.astype(np.uint8, copy=False) hex_colors = [rgb2hex(*dec_colors) for dec_colors in centers_arr] return hex_colors
Pick major colors from image
majocol/color.py
pick
suzukey/majocol
1
python
def pick(image_rgb: np.ndarray, count: int=1) -> Optional[List[str]]: '\n \n ' if (not is_positive_int(count)): return None image_height = image_rgb.shape[0] image_width = image_rgb.shape[1] image_size = (image_height * image_width) rgb_ndarray = image_rgb.reshape(image_size, 3) cluster = KMeans(n_clusters=count, random_state=0) cluster.fit(rgb_ndarray) centers_arr = cluster.cluster_centers_.astype(np.uint8, copy=False) hex_colors = [rgb2hex(*dec_colors) for dec_colors in centers_arr] return hex_colors
def pick(image_rgb: np.ndarray, count: int=1) -> Optional[List[str]]: '\n \n ' if (not is_positive_int(count)): return None image_height = image_rgb.shape[0] image_width = image_rgb.shape[1] image_size = (image_height * image_width) rgb_ndarray = image_rgb.reshape(image_size, 3) cluster = KMeans(n_clusters=count, random_state=0) cluster.fit(rgb_ndarray) centers_arr = cluster.cluster_centers_.astype(np.uint8, copy=False) hex_colors = [rgb2hex(*dec_colors) for dec_colors in centers_arr] return hex_colors<|docstring|>Pick major colors from image<|endoftext|>
5c241fe2efe98ee43b97cb39494c8dc9e90b1c694fad4d2cf330008fb772a06e
def test_constructor(self): '\n Can a MarkdownExporter be constructed?\n ' MarkdownExporter()
Can a MarkdownExporter be constructed?
nbconvert/exporters/tests/test_markdown.py
test_constructor
skizunov/nbconvert
1,367
python
def test_constructor(self): '\n \n ' MarkdownExporter()
def test_constructor(self): '\n \n ' MarkdownExporter()<|docstring|>Can a MarkdownExporter be constructed?<|endoftext|>
aa41c2918af8486e491a875d1966fe3416ab2466e93d35f48e3f1fed2bcb9a9d
def test_export(self): '\n Can a MarkdownExporter export something?\n ' (output, resources) = MarkdownExporter().from_filename(self._get_notebook()) assert (len(output) > 0)
Can a MarkdownExporter export something?
nbconvert/exporters/tests/test_markdown.py
test_export
skizunov/nbconvert
1,367
python
def test_export(self): '\n \n ' (output, resources) = MarkdownExporter().from_filename(self._get_notebook()) assert (len(output) > 0)
def test_export(self): '\n \n ' (output, resources) = MarkdownExporter().from_filename(self._get_notebook()) assert (len(output) > 0)<|docstring|>Can a MarkdownExporter export something?<|endoftext|>
c00956174c888169898c161343dac598487db343f32a99fffa54d3a9a72e689b
def construct(self, x): 'construct' x0_ = self.aspp1(x) x0 = self.aspp1_bn(x0_) x1_ = self.aspp2(x) x1 = self.aspp2_bn(x1_) x2_ = self.aspp3(x) x2 = self.aspp3_bn(x2_) x3_ = self.aspp4(x) x3 = self.aspp4_bn(x3_) x4_0 = self.global_pooling(x, ((- 2), (- 1))) x4_1 = self.aspp5(x4_0) x4_2 = self.aspp5_bn(x4_1) x4 = self.upsample(x4_2, (x.shape[2], x.shape[3]), None, True) x5 = self.cat((x0, x1, x2, x3, x4)) x6 = self.conv2(x5) output = self.bn2(x6) return output
construct
research/cv/Auto-DeepLab/src/core/aspp.py
construct
ZhimaoLin/models
77
python
def (self, x): x0_ = self.aspp1(x) x0 = self.aspp1_bn(x0_) x1_ = self.aspp2(x) x1 = self.aspp2_bn(x1_) x2_ = self.aspp3(x) x2 = self.aspp3_bn(x2_) x3_ = self.aspp4(x) x3 = self.aspp4_bn(x3_) x4_0 = self.global_pooling(x, ((- 2), (- 1))) x4_1 = self.aspp5(x4_0) x4_2 = self.aspp5_bn(x4_1) x4 = self.upsample(x4_2, (x.shape[2], x.shape[3]), None, True) x5 = self.cat((x0, x1, x2, x3, x4)) x6 = self.conv2(x5) output = self.bn2(x6) return output
def (self, x): x0_ = self.aspp1(x) x0 = self.aspp1_bn(x0_) x1_ = self.aspp2(x) x1 = self.aspp2_bn(x1_) x2_ = self.aspp3(x) x2 = self.aspp3_bn(x2_) x3_ = self.aspp4(x) x3 = self.aspp4_bn(x3_) x4_0 = self.global_pooling(x, ((- 2), (- 1))) x4_1 = self.aspp5(x4_0) x4_2 = self.aspp5_bn(x4_1) x4 = self.upsample(x4_2, (x.shape[2], x.shape[3]), None, True) x5 = self.cat((x0, x1, x2, x3, x4)) x6 = self.conv2(x5) output = self.bn2(x6) return output<|docstring|>construct<|endoftext|>
1014e0b04c1579ba71bbf39f918d539baf87b600ddf98fa9ad3a5e34fbc287ca
def createDatabase(store): '\n Initialize the given Store for use as a Mantissa webserver.\n ' Mantissa().installSite(store, u'') ws = store.findUnique(WebSite) ws.portNumber = 8088 ws.securePortNumber = 6443 ws.certificateFile = 'path/to/cert.pem' certPath = store.dbdir.child('path').child('to').child('cert.pem') certPath.parent().makedirs() fObj = certPath.open('w') fObj.write(cert) fObj.close() ws.httpLog = 'path/to/httpd.log' ws.hitCount = 123 loginSystem = store.findUnique(LoginSystem) account = loginSystem.addAccount(u'testuser', u'localhost', None) subStore = account.avatars.open() WebSite(store=subStore, hitCount=321).installOn(subStore)
Initialize the given Store for use as a Mantissa webserver.
xmantissa/test/historic/stub_website3to4.py
createDatabase
jonathanj/mantissa
6
python
def createDatabase(store): '\n \n ' Mantissa().installSite(store, u) ws = store.findUnique(WebSite) ws.portNumber = 8088 ws.securePortNumber = 6443 ws.certificateFile = 'path/to/cert.pem' certPath = store.dbdir.child('path').child('to').child('cert.pem') certPath.parent().makedirs() fObj = certPath.open('w') fObj.write(cert) fObj.close() ws.httpLog = 'path/to/httpd.log' ws.hitCount = 123 loginSystem = store.findUnique(LoginSystem) account = loginSystem.addAccount(u'testuser', u'localhost', None) subStore = account.avatars.open() WebSite(store=subStore, hitCount=321).installOn(subStore)
def createDatabase(store): '\n \n ' Mantissa().installSite(store, u) ws = store.findUnique(WebSite) ws.portNumber = 8088 ws.securePortNumber = 6443 ws.certificateFile = 'path/to/cert.pem' certPath = store.dbdir.child('path').child('to').child('cert.pem') certPath.parent().makedirs() fObj = certPath.open('w') fObj.write(cert) fObj.close() ws.httpLog = 'path/to/httpd.log' ws.hitCount = 123 loginSystem = store.findUnique(LoginSystem) account = loginSystem.addAccount(u'testuser', u'localhost', None) subStore = account.avatars.open() WebSite(store=subStore, hitCount=321).installOn(subStore)<|docstring|>Initialize the given Store for use as a Mantissa webserver.<|endoftext|>
206b461e7a672d97f51bc49560b5615664e0437bd5a35212f44e60541a933574
def test_wrong_gremlin_endpoint(): 'Tests that an HTTP error is returned by the API if the Gremlin endpoint\n is not valid.' conn_app = create_app() conn_app.app.testing = False conn_app.app.debug = False conn_app.app.config['GREMLIN_ENDPOINT'] = 'ws://invalid-host:8182/gremlin' with conn_app.app.test_client() as flask_cli: resp = flask_cli.get('/v1/teams') assert (resp.status_code == 500)
Tests that an HTTP error is returned by the API if the Gremlin endpoint is not valid.
tests/test_api.py
test_wrong_gremlin_endpoint
jroimartin/graph-asset-inventory-api
1
python
def test_wrong_gremlin_endpoint(): 'Tests that an HTTP error is returned by the API if the Gremlin endpoint\n is not valid.' conn_app = create_app() conn_app.app.testing = False conn_app.app.debug = False conn_app.app.config['GREMLIN_ENDPOINT'] = 'ws://invalid-host:8182/gremlin' with conn_app.app.test_client() as flask_cli: resp = flask_cli.get('/v1/teams') assert (resp.status_code == 500)
def test_wrong_gremlin_endpoint(): 'Tests that an HTTP error is returned by the API if the Gremlin endpoint\n is not valid.' conn_app = create_app() conn_app.app.testing = False conn_app.app.debug = False conn_app.app.config['GREMLIN_ENDPOINT'] = 'ws://invalid-host:8182/gremlin' with conn_app.app.test_client() as flask_cli: resp = flask_cli.get('/v1/teams') assert (resp.status_code == 500)<|docstring|>Tests that an HTTP error is returned by the API if the Gremlin endpoint is not valid.<|endoftext|>
2882ce929bdd434eb7050875413b0c475ebda9e7c2239b69bf30eff74f5645be
def test_datetime_validation(flask_cli): 'Tests the validation of date-time fields.' asset_req = {'type': 'type0', 'identifier': 'identifier0', 'timestamp': '1234', 'expiration': '2021-07-07T01:00:00+00:00'} resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') assert (resp.status_code == 400) asset_req['timestamp'] = '2021-07-01T01:000:00+00:00' resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') assert (resp.status_code == 400) asset_req['timestamp'] = '2021-07-01T01:00:00+00:00' resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') assert (resp.status_code == 201)
Tests the validation of date-time fields.
tests/test_api.py
test_datetime_validation
jroimartin/graph-asset-inventory-api
1
python
def test_datetime_validation(flask_cli): asset_req = {'type': 'type0', 'identifier': 'identifier0', 'timestamp': '1234', 'expiration': '2021-07-07T01:00:00+00:00'} resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') assert (resp.status_code == 400) asset_req['timestamp'] = '2021-07-01T01:000:00+00:00' resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') assert (resp.status_code == 400) asset_req['timestamp'] = '2021-07-01T01:00:00+00:00' resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') assert (resp.status_code == 201)
def test_datetime_validation(flask_cli): asset_req = {'type': 'type0', 'identifier': 'identifier0', 'timestamp': '1234', 'expiration': '2021-07-07T01:00:00+00:00'} resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') assert (resp.status_code == 400) asset_req['timestamp'] = '2021-07-01T01:000:00+00:00' resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') assert (resp.status_code == 400) asset_req['timestamp'] = '2021-07-01T01:00:00+00:00' resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') assert (resp.status_code == 201)<|docstring|>Tests the validation of date-time fields.<|endoftext|>
7eb28d38495192819a4d59388bf5ad6e20ed75617fa1d6ebb39bb2e4cc7e88f5
def test_datetime_rfc3339_parsing(flask_cli): 'Tests rfc3339 parsing.' asset_req = {'type': 'type0', 'identifier': 'identifier0', 'timestamp': '2021-07-01T01:00:00Z', 'expiration': '2021-07-07T03:00:00+02:00'} resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') resp_data = json.loads(resp.data) assert (resp.status_code == 201) assert (resp_data['first_seen'] == '2021-07-01T01:00:00+00:00') assert (resp_data['last_seen'] == '2021-07-01T01:00:00+00:00') assert (resp_data['expiration'] == '2021-07-07T01:00:00+00:00')
Tests rfc3339 parsing.
tests/test_api.py
test_datetime_rfc3339_parsing
jroimartin/graph-asset-inventory-api
1
python
def test_datetime_rfc3339_parsing(flask_cli): asset_req = {'type': 'type0', 'identifier': 'identifier0', 'timestamp': '2021-07-01T01:00:00Z', 'expiration': '2021-07-07T03:00:00+02:00'} resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') resp_data = json.loads(resp.data) assert (resp.status_code == 201) assert (resp_data['first_seen'] == '2021-07-01T01:00:00+00:00') assert (resp_data['last_seen'] == '2021-07-01T01:00:00+00:00') assert (resp_data['expiration'] == '2021-07-07T01:00:00+00:00')
def test_datetime_rfc3339_parsing(flask_cli): asset_req = {'type': 'type0', 'identifier': 'identifier0', 'timestamp': '2021-07-01T01:00:00Z', 'expiration': '2021-07-07T03:00:00+02:00'} resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') resp_data = json.loads(resp.data) assert (resp.status_code == 201) assert (resp_data['first_seen'] == '2021-07-01T01:00:00+00:00') assert (resp_data['last_seen'] == '2021-07-01T01:00:00+00:00') assert (resp_data['expiration'] == '2021-07-07T01:00:00+00:00')<|docstring|>Tests rfc3339 parsing.<|endoftext|>
90c0bca9a6d58c75c74aea540cc23444a4833f1de6c9a95815bd0398232de9cd
def test_datetime_timezone(flask_cli): 'Tests if gremlin returns the expected timezone for datetime\n properties.' asset_req = {'type': 'type0', 'identifier': 'identifier0', 'timestamp': '2021-07-01T05:00:00+04:00', 'expiration': '2021-07-07T01:00:00+00:00'} resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') resp_data = json.loads(resp.data) assert (resp.status_code == 201) assert (resp_data['first_seen'] == '2021-07-01T01:00:00+00:00') assert (resp_data['last_seen'] == '2021-07-01T01:00:00+00:00') assert (resp_data['expiration'] == '2021-07-07T01:00:00+00:00')
Tests if gremlin returns the expected timezone for datetime properties.
tests/test_api.py
test_datetime_timezone
jroimartin/graph-asset-inventory-api
1
python
def test_datetime_timezone(flask_cli): 'Tests if gremlin returns the expected timezone for datetime\n properties.' asset_req = {'type': 'type0', 'identifier': 'identifier0', 'timestamp': '2021-07-01T05:00:00+04:00', 'expiration': '2021-07-07T01:00:00+00:00'} resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') resp_data = json.loads(resp.data) assert (resp.status_code == 201) assert (resp_data['first_seen'] == '2021-07-01T01:00:00+00:00') assert (resp_data['last_seen'] == '2021-07-01T01:00:00+00:00') assert (resp_data['expiration'] == '2021-07-07T01:00:00+00:00')
def test_datetime_timezone(flask_cli): 'Tests if gremlin returns the expected timezone for datetime\n properties.' asset_req = {'type': 'type0', 'identifier': 'identifier0', 'timestamp': '2021-07-01T05:00:00+04:00', 'expiration': '2021-07-07T01:00:00+00:00'} resp = flask_cli.post('/v1/assets', data=json.dumps(asset_req), content_type='application/json') resp_data = json.loads(resp.data) assert (resp.status_code == 201) assert (resp_data['first_seen'] == '2021-07-01T01:00:00+00:00') assert (resp_data['last_seen'] == '2021-07-01T01:00:00+00:00') assert (resp_data['expiration'] == '2021-07-07T01:00:00+00:00')<|docstring|>Tests if gremlin returns the expected timezone for datetime properties.<|endoftext|>
12b01f50d3b18400f2f40393111bfbe998d4f900c52289c355671d0fd8cfc360
def __init__(self, id=None, console_identifier=None, disabled=None, email=None, gcp_pubsub=None, jira=None, last_error=None, modified=None, name=None, notes=None, owner=None, pagerduty=None, policy=None, previous_name=None, security_advisor=None, security_center=None, security_hub=None, service_now=None, slack=None, webhook=None, xsoar=None, local_vars_configuration=None): 'ApiAlertProfile - a model defined in OpenAPI' if (local_vars_configuration is None): local_vars_configuration = Configuration.get_default_copy() self.local_vars_configuration = local_vars_configuration self._id = None self._console_identifier = None self._disabled = None self._email = None self._gcp_pubsub = None self._jira = None self._last_error = None self._modified = None self._name = None self._notes = None self._owner = None self._pagerduty = None self._policy = None self._previous_name = None self._security_advisor = None self._security_center = None self._security_hub = None self._service_now = None self._slack = None self._webhook = None self._xsoar = None self.discriminator = None if (id is not None): self.id = id if (console_identifier is not None): self.console_identifier = console_identifier if (disabled is not None): self.disabled = disabled if (email is not None): self.email = email if (gcp_pubsub is not None): self.gcp_pubsub = gcp_pubsub if (jira is not None): self.jira = jira if (last_error is not None): self.last_error = last_error if (modified is not None): self.modified = modified if (name is not None): self.name = name if (notes is not None): self.notes = notes if (owner is not None): self.owner = owner if (pagerduty is not None): self.pagerduty = pagerduty if (policy is not None): self.policy = policy if (previous_name is not None): self.previous_name = previous_name if (security_advisor is not None): self.security_advisor = security_advisor if (security_center is not None): self.security_center = security_center if (security_hub is not None): self.security_hub = security_hub if (service_now is not None): self.service_now = service_now if (slack is not None): self.slack = slack if (webhook is not None): self.webhook = webhook if (xsoar is not None): self.xsoar = xsoar
ApiAlertProfile - a model defined in OpenAPI
openapi_client/models/api_alert_profile.py
__init__
hi-artem/twistlock-py
0
python
def __init__(self, id=None, console_identifier=None, disabled=None, email=None, gcp_pubsub=None, jira=None, last_error=None, modified=None, name=None, notes=None, owner=None, pagerduty=None, policy=None, previous_name=None, security_advisor=None, security_center=None, security_hub=None, service_now=None, slack=None, webhook=None, xsoar=None, local_vars_configuration=None): if (local_vars_configuration is None): local_vars_configuration = Configuration.get_default_copy() self.local_vars_configuration = local_vars_configuration self._id = None self._console_identifier = None self._disabled = None self._email = None self._gcp_pubsub = None self._jira = None self._last_error = None self._modified = None self._name = None self._notes = None self._owner = None self._pagerduty = None self._policy = None self._previous_name = None self._security_advisor = None self._security_center = None self._security_hub = None self._service_now = None self._slack = None self._webhook = None self._xsoar = None self.discriminator = None if (id is not None): self.id = id if (console_identifier is not None): self.console_identifier = console_identifier if (disabled is not None): self.disabled = disabled if (email is not None): self.email = email if (gcp_pubsub is not None): self.gcp_pubsub = gcp_pubsub if (jira is not None): self.jira = jira if (last_error is not None): self.last_error = last_error if (modified is not None): self.modified = modified if (name is not None): self.name = name if (notes is not None): self.notes = notes if (owner is not None): self.owner = owner if (pagerduty is not None): self.pagerduty = pagerduty if (policy is not None): self.policy = policy if (previous_name is not None): self.previous_name = previous_name if (security_advisor is not None): self.security_advisor = security_advisor if (security_center is not None): self.security_center = security_center if (security_hub is not None): self.security_hub = security_hub if (service_now is not None): self.service_now = service_now if (slack is not None): self.slack = slack if (webhook is not None): self.webhook = webhook if (xsoar is not None): self.xsoar = xsoar
def __init__(self, id=None, console_identifier=None, disabled=None, email=None, gcp_pubsub=None, jira=None, last_error=None, modified=None, name=None, notes=None, owner=None, pagerduty=None, policy=None, previous_name=None, security_advisor=None, security_center=None, security_hub=None, service_now=None, slack=None, webhook=None, xsoar=None, local_vars_configuration=None): if (local_vars_configuration is None): local_vars_configuration = Configuration.get_default_copy() self.local_vars_configuration = local_vars_configuration self._id = None self._console_identifier = None self._disabled = None self._email = None self._gcp_pubsub = None self._jira = None self._last_error = None self._modified = None self._name = None self._notes = None self._owner = None self._pagerduty = None self._policy = None self._previous_name = None self._security_advisor = None self._security_center = None self._security_hub = None self._service_now = None self._slack = None self._webhook = None self._xsoar = None self.discriminator = None if (id is not None): self.id = id if (console_identifier is not None): self.console_identifier = console_identifier if (disabled is not None): self.disabled = disabled if (email is not None): self.email = email if (gcp_pubsub is not None): self.gcp_pubsub = gcp_pubsub if (jira is not None): self.jira = jira if (last_error is not None): self.last_error = last_error if (modified is not None): self.modified = modified if (name is not None): self.name = name if (notes is not None): self.notes = notes if (owner is not None): self.owner = owner if (pagerduty is not None): self.pagerduty = pagerduty if (policy is not None): self.policy = policy if (previous_name is not None): self.previous_name = previous_name if (security_advisor is not None): self.security_advisor = security_advisor if (security_center is not None): self.security_center = security_center if (security_hub is not None): self.security_hub = security_hub if (service_now is not None): self.service_now = service_now if (slack is not None): self.slack = slack if (webhook is not None): self.webhook = webhook if (xsoar is not None): self.xsoar = xsoar<|docstring|>ApiAlertProfile - a model defined in OpenAPI<|endoftext|>
0fbb95c22b2f4e68f22d45bc8b0787a982913c36ba2ba6b698512d335483bbf5
@property def id(self): 'Gets the id of this ApiAlertProfile. # noqa: E501\n\n ID is the alert profile ID. # noqa: E501\n\n :return: The id of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._id
Gets the id of this ApiAlertProfile. # noqa: E501 ID is the alert profile ID. # noqa: E501 :return: The id of this ApiAlertProfile. # noqa: E501 :rtype: str
openapi_client/models/api_alert_profile.py
id
hi-artem/twistlock-py
0
python
@property def id(self): 'Gets the id of this ApiAlertProfile. # noqa: E501\n\n ID is the alert profile ID. # noqa: E501\n\n :return: The id of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._id
@property def id(self): 'Gets the id of this ApiAlertProfile. # noqa: E501\n\n ID is the alert profile ID. # noqa: E501\n\n :return: The id of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._id<|docstring|>Gets the id of this ApiAlertProfile. # noqa: E501 ID is the alert profile ID. # noqa: E501 :return: The id of this ApiAlertProfile. # noqa: E501 :rtype: str<|endoftext|>
da775c6e3ff6f694a9b76c5466abb3670c70bc9d0ae5d8d7721018fe2ba52ba9
@id.setter def id(self, id): 'Sets the id of this ApiAlertProfile.\n\n ID is the alert profile ID. # noqa: E501\n\n :param id: The id of this ApiAlertProfile. # noqa: E501\n :type id: str\n ' self._id = id
Sets the id of this ApiAlertProfile. ID is the alert profile ID. # noqa: E501 :param id: The id of this ApiAlertProfile. # noqa: E501 :type id: str
openapi_client/models/api_alert_profile.py
id
hi-artem/twistlock-py
0
python
@id.setter def id(self, id): 'Sets the id of this ApiAlertProfile.\n\n ID is the alert profile ID. # noqa: E501\n\n :param id: The id of this ApiAlertProfile. # noqa: E501\n :type id: str\n ' self._id = id
@id.setter def id(self, id): 'Sets the id of this ApiAlertProfile.\n\n ID is the alert profile ID. # noqa: E501\n\n :param id: The id of this ApiAlertProfile. # noqa: E501\n :type id: str\n ' self._id = id<|docstring|>Sets the id of this ApiAlertProfile. ID is the alert profile ID. # noqa: E501 :param id: The id of this ApiAlertProfile. # noqa: E501 :type id: str<|endoftext|>
72d663030fc3450fc23be967909c052955c283e1e8b706e6e9d82b90d9450410
@property def console_identifier(self): 'Gets the console_identifier of this ApiAlertProfile. # noqa: E501\n\n ConsoleIdentifier is the console identifier. # noqa: E501\n\n :return: The console_identifier of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._console_identifier
Gets the console_identifier of this ApiAlertProfile. # noqa: E501 ConsoleIdentifier is the console identifier. # noqa: E501 :return: The console_identifier of this ApiAlertProfile. # noqa: E501 :rtype: str
openapi_client/models/api_alert_profile.py
console_identifier
hi-artem/twistlock-py
0
python
@property def console_identifier(self): 'Gets the console_identifier of this ApiAlertProfile. # noqa: E501\n\n ConsoleIdentifier is the console identifier. # noqa: E501\n\n :return: The console_identifier of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._console_identifier
@property def console_identifier(self): 'Gets the console_identifier of this ApiAlertProfile. # noqa: E501\n\n ConsoleIdentifier is the console identifier. # noqa: E501\n\n :return: The console_identifier of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._console_identifier<|docstring|>Gets the console_identifier of this ApiAlertProfile. # noqa: E501 ConsoleIdentifier is the console identifier. # noqa: E501 :return: The console_identifier of this ApiAlertProfile. # noqa: E501 :rtype: str<|endoftext|>
e2e46521fb21d27517c63901250fd0cb660799e1baad9e2363ea7d550cfd1a71
@console_identifier.setter def console_identifier(self, console_identifier): 'Sets the console_identifier of this ApiAlertProfile.\n\n ConsoleIdentifier is the console identifier. # noqa: E501\n\n :param console_identifier: The console_identifier of this ApiAlertProfile. # noqa: E501\n :type console_identifier: str\n ' self._console_identifier = console_identifier
Sets the console_identifier of this ApiAlertProfile. ConsoleIdentifier is the console identifier. # noqa: E501 :param console_identifier: The console_identifier of this ApiAlertProfile. # noqa: E501 :type console_identifier: str
openapi_client/models/api_alert_profile.py
console_identifier
hi-artem/twistlock-py
0
python
@console_identifier.setter def console_identifier(self, console_identifier): 'Sets the console_identifier of this ApiAlertProfile.\n\n ConsoleIdentifier is the console identifier. # noqa: E501\n\n :param console_identifier: The console_identifier of this ApiAlertProfile. # noqa: E501\n :type console_identifier: str\n ' self._console_identifier = console_identifier
@console_identifier.setter def console_identifier(self, console_identifier): 'Sets the console_identifier of this ApiAlertProfile.\n\n ConsoleIdentifier is the console identifier. # noqa: E501\n\n :param console_identifier: The console_identifier of this ApiAlertProfile. # noqa: E501\n :type console_identifier: str\n ' self._console_identifier = console_identifier<|docstring|>Sets the console_identifier of this ApiAlertProfile. ConsoleIdentifier is the console identifier. # noqa: E501 :param console_identifier: The console_identifier of this ApiAlertProfile. # noqa: E501 :type console_identifier: str<|endoftext|>
c1f19f9ea06ccaa7ff8d94d0c90ae9ca5ff6ac9900c56a1863d6d6f4827f7342
@property def disabled(self): 'Gets the disabled of this ApiAlertProfile. # noqa: E501\n\n Indicates if the rule is currently disabled (true) or not (false). # noqa: E501\n\n :return: The disabled of this ApiAlertProfile. # noqa: E501\n :rtype: bool\n ' return self._disabled
Gets the disabled of this ApiAlertProfile. # noqa: E501 Indicates if the rule is currently disabled (true) or not (false). # noqa: E501 :return: The disabled of this ApiAlertProfile. # noqa: E501 :rtype: bool
openapi_client/models/api_alert_profile.py
disabled
hi-artem/twistlock-py
0
python
@property def disabled(self): 'Gets the disabled of this ApiAlertProfile. # noqa: E501\n\n Indicates if the rule is currently disabled (true) or not (false). # noqa: E501\n\n :return: The disabled of this ApiAlertProfile. # noqa: E501\n :rtype: bool\n ' return self._disabled
@property def disabled(self): 'Gets the disabled of this ApiAlertProfile. # noqa: E501\n\n Indicates if the rule is currently disabled (true) or not (false). # noqa: E501\n\n :return: The disabled of this ApiAlertProfile. # noqa: E501\n :rtype: bool\n ' return self._disabled<|docstring|>Gets the disabled of this ApiAlertProfile. # noqa: E501 Indicates if the rule is currently disabled (true) or not (false). # noqa: E501 :return: The disabled of this ApiAlertProfile. # noqa: E501 :rtype: bool<|endoftext|>
4ddb7e7b4cbaeeef86b08e0da030216e21bcc70a1bd79a5fa9610ef3b1073ea9
@disabled.setter def disabled(self, disabled): 'Sets the disabled of this ApiAlertProfile.\n\n Indicates if the rule is currently disabled (true) or not (false). # noqa: E501\n\n :param disabled: The disabled of this ApiAlertProfile. # noqa: E501\n :type disabled: bool\n ' self._disabled = disabled
Sets the disabled of this ApiAlertProfile. Indicates if the rule is currently disabled (true) or not (false). # noqa: E501 :param disabled: The disabled of this ApiAlertProfile. # noqa: E501 :type disabled: bool
openapi_client/models/api_alert_profile.py
disabled
hi-artem/twistlock-py
0
python
@disabled.setter def disabled(self, disabled): 'Sets the disabled of this ApiAlertProfile.\n\n Indicates if the rule is currently disabled (true) or not (false). # noqa: E501\n\n :param disabled: The disabled of this ApiAlertProfile. # noqa: E501\n :type disabled: bool\n ' self._disabled = disabled
@disabled.setter def disabled(self, disabled): 'Sets the disabled of this ApiAlertProfile.\n\n Indicates if the rule is currently disabled (true) or not (false). # noqa: E501\n\n :param disabled: The disabled of this ApiAlertProfile. # noqa: E501\n :type disabled: bool\n ' self._disabled = disabled<|docstring|>Sets the disabled of this ApiAlertProfile. Indicates if the rule is currently disabled (true) or not (false). # noqa: E501 :param disabled: The disabled of this ApiAlertProfile. # noqa: E501 :type disabled: bool<|endoftext|>
d2492aa46545c82fb7c8fb77caf06e0e9c7c669a3cff6698b05809166cda2bec
@property def email(self): 'Gets the email of this ApiAlertProfile. # noqa: E501\n\n\n :return: The email of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileEmailSettings\n ' return self._email
Gets the email of this ApiAlertProfile. # noqa: E501 :return: The email of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileEmailSettings
openapi_client/models/api_alert_profile.py
email
hi-artem/twistlock-py
0
python
@property def email(self): 'Gets the email of this ApiAlertProfile. # noqa: E501\n\n\n :return: The email of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileEmailSettings\n ' return self._email
@property def email(self): 'Gets the email of this ApiAlertProfile. # noqa: E501\n\n\n :return: The email of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileEmailSettings\n ' return self._email<|docstring|>Gets the email of this ApiAlertProfile. # noqa: E501 :return: The email of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileEmailSettings<|endoftext|>
2a63a886273db29b43b17b9677ddebca045e3bcf5664b1349b2e36d177b3be2e
@email.setter def email(self, email): 'Sets the email of this ApiAlertProfile.\n\n\n :param email: The email of this ApiAlertProfile. # noqa: E501\n :type email: ApiAlertProfileEmailSettings\n ' self._email = email
Sets the email of this ApiAlertProfile. :param email: The email of this ApiAlertProfile. # noqa: E501 :type email: ApiAlertProfileEmailSettings
openapi_client/models/api_alert_profile.py
email
hi-artem/twistlock-py
0
python
@email.setter def email(self, email): 'Sets the email of this ApiAlertProfile.\n\n\n :param email: The email of this ApiAlertProfile. # noqa: E501\n :type email: ApiAlertProfileEmailSettings\n ' self._email = email
@email.setter def email(self, email): 'Sets the email of this ApiAlertProfile.\n\n\n :param email: The email of this ApiAlertProfile. # noqa: E501\n :type email: ApiAlertProfileEmailSettings\n ' self._email = email<|docstring|>Sets the email of this ApiAlertProfile. :param email: The email of this ApiAlertProfile. # noqa: E501 :type email: ApiAlertProfileEmailSettings<|endoftext|>
f91cb1041bde448d149c0004d518a95b7ef4906e51622fc9a63a4c3521af121c
@property def gcp_pubsub(self): 'Gets the gcp_pubsub of this ApiAlertProfile. # noqa: E501\n\n\n :return: The gcp_pubsub of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileGcpPubsubSettings\n ' return self._gcp_pubsub
Gets the gcp_pubsub of this ApiAlertProfile. # noqa: E501 :return: The gcp_pubsub of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileGcpPubsubSettings
openapi_client/models/api_alert_profile.py
gcp_pubsub
hi-artem/twistlock-py
0
python
@property def gcp_pubsub(self): 'Gets the gcp_pubsub of this ApiAlertProfile. # noqa: E501\n\n\n :return: The gcp_pubsub of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileGcpPubsubSettings\n ' return self._gcp_pubsub
@property def gcp_pubsub(self): 'Gets the gcp_pubsub of this ApiAlertProfile. # noqa: E501\n\n\n :return: The gcp_pubsub of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileGcpPubsubSettings\n ' return self._gcp_pubsub<|docstring|>Gets the gcp_pubsub of this ApiAlertProfile. # noqa: E501 :return: The gcp_pubsub of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileGcpPubsubSettings<|endoftext|>
40d746d0ceebe4d28525394022c884198887afe401f5d0255efef2e6a66f2b11
@gcp_pubsub.setter def gcp_pubsub(self, gcp_pubsub): 'Sets the gcp_pubsub of this ApiAlertProfile.\n\n\n :param gcp_pubsub: The gcp_pubsub of this ApiAlertProfile. # noqa: E501\n :type gcp_pubsub: ApiAlertProfileGcpPubsubSettings\n ' self._gcp_pubsub = gcp_pubsub
Sets the gcp_pubsub of this ApiAlertProfile. :param gcp_pubsub: The gcp_pubsub of this ApiAlertProfile. # noqa: E501 :type gcp_pubsub: ApiAlertProfileGcpPubsubSettings
openapi_client/models/api_alert_profile.py
gcp_pubsub
hi-artem/twistlock-py
0
python
@gcp_pubsub.setter def gcp_pubsub(self, gcp_pubsub): 'Sets the gcp_pubsub of this ApiAlertProfile.\n\n\n :param gcp_pubsub: The gcp_pubsub of this ApiAlertProfile. # noqa: E501\n :type gcp_pubsub: ApiAlertProfileGcpPubsubSettings\n ' self._gcp_pubsub = gcp_pubsub
@gcp_pubsub.setter def gcp_pubsub(self, gcp_pubsub): 'Sets the gcp_pubsub of this ApiAlertProfile.\n\n\n :param gcp_pubsub: The gcp_pubsub of this ApiAlertProfile. # noqa: E501\n :type gcp_pubsub: ApiAlertProfileGcpPubsubSettings\n ' self._gcp_pubsub = gcp_pubsub<|docstring|>Sets the gcp_pubsub of this ApiAlertProfile. :param gcp_pubsub: The gcp_pubsub of this ApiAlertProfile. # noqa: E501 :type gcp_pubsub: ApiAlertProfileGcpPubsubSettings<|endoftext|>
a24d2bd7131f7560fa152c564e4dd40351c36d5827975a51ad2f861b76af6ad7
@property def jira(self): 'Gets the jira of this ApiAlertProfile. # noqa: E501\n\n\n :return: The jira of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileJIRASettings\n ' return self._jira
Gets the jira of this ApiAlertProfile. # noqa: E501 :return: The jira of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileJIRASettings
openapi_client/models/api_alert_profile.py
jira
hi-artem/twistlock-py
0
python
@property def jira(self): 'Gets the jira of this ApiAlertProfile. # noqa: E501\n\n\n :return: The jira of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileJIRASettings\n ' return self._jira
@property def jira(self): 'Gets the jira of this ApiAlertProfile. # noqa: E501\n\n\n :return: The jira of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileJIRASettings\n ' return self._jira<|docstring|>Gets the jira of this ApiAlertProfile. # noqa: E501 :return: The jira of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileJIRASettings<|endoftext|>
bc58c1e0c1d1b51dc9a0eb5f76d97c030d504b23b9800f7e3aed59bb2332e3cd
@jira.setter def jira(self, jira): 'Sets the jira of this ApiAlertProfile.\n\n\n :param jira: The jira of this ApiAlertProfile. # noqa: E501\n :type jira: ApiAlertProfileJIRASettings\n ' self._jira = jira
Sets the jira of this ApiAlertProfile. :param jira: The jira of this ApiAlertProfile. # noqa: E501 :type jira: ApiAlertProfileJIRASettings
openapi_client/models/api_alert_profile.py
jira
hi-artem/twistlock-py
0
python
@jira.setter def jira(self, jira): 'Sets the jira of this ApiAlertProfile.\n\n\n :param jira: The jira of this ApiAlertProfile. # noqa: E501\n :type jira: ApiAlertProfileJIRASettings\n ' self._jira = jira
@jira.setter def jira(self, jira): 'Sets the jira of this ApiAlertProfile.\n\n\n :param jira: The jira of this ApiAlertProfile. # noqa: E501\n :type jira: ApiAlertProfileJIRASettings\n ' self._jira = jira<|docstring|>Sets the jira of this ApiAlertProfile. :param jira: The jira of this ApiAlertProfile. # noqa: E501 :type jira: ApiAlertProfileJIRASettings<|endoftext|>
0f8a1f09b83699f25e0baf89900e75e527642fd39a2f73dc4fe4b17a8f93519c
@property def last_error(self): 'Gets the last_error of this ApiAlertProfile. # noqa: E501\n\n LastError represents the last error when sending the profile. # noqa: E501\n\n :return: The last_error of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._last_error
Gets the last_error of this ApiAlertProfile. # noqa: E501 LastError represents the last error when sending the profile. # noqa: E501 :return: The last_error of this ApiAlertProfile. # noqa: E501 :rtype: str
openapi_client/models/api_alert_profile.py
last_error
hi-artem/twistlock-py
0
python
@property def last_error(self): 'Gets the last_error of this ApiAlertProfile. # noqa: E501\n\n LastError represents the last error when sending the profile. # noqa: E501\n\n :return: The last_error of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._last_error
@property def last_error(self): 'Gets the last_error of this ApiAlertProfile. # noqa: E501\n\n LastError represents the last error when sending the profile. # noqa: E501\n\n :return: The last_error of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._last_error<|docstring|>Gets the last_error of this ApiAlertProfile. # noqa: E501 LastError represents the last error when sending the profile. # noqa: E501 :return: The last_error of this ApiAlertProfile. # noqa: E501 :rtype: str<|endoftext|>
b1cff5b8150e6165c9b8ec6d18af23dfd4f1fa1dad3a0392ec1ecf99cb641c38
@last_error.setter def last_error(self, last_error): 'Sets the last_error of this ApiAlertProfile.\n\n LastError represents the last error when sending the profile. # noqa: E501\n\n :param last_error: The last_error of this ApiAlertProfile. # noqa: E501\n :type last_error: str\n ' self._last_error = last_error
Sets the last_error of this ApiAlertProfile. LastError represents the last error when sending the profile. # noqa: E501 :param last_error: The last_error of this ApiAlertProfile. # noqa: E501 :type last_error: str
openapi_client/models/api_alert_profile.py
last_error
hi-artem/twistlock-py
0
python
@last_error.setter def last_error(self, last_error): 'Sets the last_error of this ApiAlertProfile.\n\n LastError represents the last error when sending the profile. # noqa: E501\n\n :param last_error: The last_error of this ApiAlertProfile. # noqa: E501\n :type last_error: str\n ' self._last_error = last_error
@last_error.setter def last_error(self, last_error): 'Sets the last_error of this ApiAlertProfile.\n\n LastError represents the last error when sending the profile. # noqa: E501\n\n :param last_error: The last_error of this ApiAlertProfile. # noqa: E501\n :type last_error: str\n ' self._last_error = last_error<|docstring|>Sets the last_error of this ApiAlertProfile. LastError represents the last error when sending the profile. # noqa: E501 :param last_error: The last_error of this ApiAlertProfile. # noqa: E501 :type last_error: str<|endoftext|>
f9054d5cbd035ea1d08bcc6a5c48573597dc4de0b0c86333c69d8bf73fb07a72
@property def modified(self): 'Gets the modified of this ApiAlertProfile. # noqa: E501\n\n Datetime when the rule was last modified. # noqa: E501\n\n :return: The modified of this ApiAlertProfile. # noqa: E501\n :rtype: datetime\n ' return self._modified
Gets the modified of this ApiAlertProfile. # noqa: E501 Datetime when the rule was last modified. # noqa: E501 :return: The modified of this ApiAlertProfile. # noqa: E501 :rtype: datetime
openapi_client/models/api_alert_profile.py
modified
hi-artem/twistlock-py
0
python
@property def modified(self): 'Gets the modified of this ApiAlertProfile. # noqa: E501\n\n Datetime when the rule was last modified. # noqa: E501\n\n :return: The modified of this ApiAlertProfile. # noqa: E501\n :rtype: datetime\n ' return self._modified
@property def modified(self): 'Gets the modified of this ApiAlertProfile. # noqa: E501\n\n Datetime when the rule was last modified. # noqa: E501\n\n :return: The modified of this ApiAlertProfile. # noqa: E501\n :rtype: datetime\n ' return self._modified<|docstring|>Gets the modified of this ApiAlertProfile. # noqa: E501 Datetime when the rule was last modified. # noqa: E501 :return: The modified of this ApiAlertProfile. # noqa: E501 :rtype: datetime<|endoftext|>
960bce39b44166a23d440083c95bdf066c257f7a1c1ed8e7f09e71e51b3bda9b
@modified.setter def modified(self, modified): 'Sets the modified of this ApiAlertProfile.\n\n Datetime when the rule was last modified. # noqa: E501\n\n :param modified: The modified of this ApiAlertProfile. # noqa: E501\n :type modified: datetime\n ' self._modified = modified
Sets the modified of this ApiAlertProfile. Datetime when the rule was last modified. # noqa: E501 :param modified: The modified of this ApiAlertProfile. # noqa: E501 :type modified: datetime
openapi_client/models/api_alert_profile.py
modified
hi-artem/twistlock-py
0
python
@modified.setter def modified(self, modified): 'Sets the modified of this ApiAlertProfile.\n\n Datetime when the rule was last modified. # noqa: E501\n\n :param modified: The modified of this ApiAlertProfile. # noqa: E501\n :type modified: datetime\n ' self._modified = modified
@modified.setter def modified(self, modified): 'Sets the modified of this ApiAlertProfile.\n\n Datetime when the rule was last modified. # noqa: E501\n\n :param modified: The modified of this ApiAlertProfile. # noqa: E501\n :type modified: datetime\n ' self._modified = modified<|docstring|>Sets the modified of this ApiAlertProfile. Datetime when the rule was last modified. # noqa: E501 :param modified: The modified of this ApiAlertProfile. # noqa: E501 :type modified: datetime<|endoftext|>
a3cf84bac69801b2e90f29a362e7e57994bb2cc62f19d9e36540e3e172697a51
@property def name(self): 'Gets the name of this ApiAlertProfile. # noqa: E501\n\n Name of the rule. # noqa: E501\n\n :return: The name of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._name
Gets the name of this ApiAlertProfile. # noqa: E501 Name of the rule. # noqa: E501 :return: The name of this ApiAlertProfile. # noqa: E501 :rtype: str
openapi_client/models/api_alert_profile.py
name
hi-artem/twistlock-py
0
python
@property def name(self): 'Gets the name of this ApiAlertProfile. # noqa: E501\n\n Name of the rule. # noqa: E501\n\n :return: The name of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._name
@property def name(self): 'Gets the name of this ApiAlertProfile. # noqa: E501\n\n Name of the rule. # noqa: E501\n\n :return: The name of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._name<|docstring|>Gets the name of this ApiAlertProfile. # noqa: E501 Name of the rule. # noqa: E501 :return: The name of this ApiAlertProfile. # noqa: E501 :rtype: str<|endoftext|>
0daab1ea1ec08d50f60d682310a0f2019cc645e57c242777355a6219cca1eb81
@name.setter def name(self, name): 'Sets the name of this ApiAlertProfile.\n\n Name of the rule. # noqa: E501\n\n :param name: The name of this ApiAlertProfile. # noqa: E501\n :type name: str\n ' self._name = name
Sets the name of this ApiAlertProfile. Name of the rule. # noqa: E501 :param name: The name of this ApiAlertProfile. # noqa: E501 :type name: str
openapi_client/models/api_alert_profile.py
name
hi-artem/twistlock-py
0
python
@name.setter def name(self, name): 'Sets the name of this ApiAlertProfile.\n\n Name of the rule. # noqa: E501\n\n :param name: The name of this ApiAlertProfile. # noqa: E501\n :type name: str\n ' self._name = name
@name.setter def name(self, name): 'Sets the name of this ApiAlertProfile.\n\n Name of the rule. # noqa: E501\n\n :param name: The name of this ApiAlertProfile. # noqa: E501\n :type name: str\n ' self._name = name<|docstring|>Sets the name of this ApiAlertProfile. Name of the rule. # noqa: E501 :param name: The name of this ApiAlertProfile. # noqa: E501 :type name: str<|endoftext|>
d896f7e97d21360e9722b683df0c677e3537539e7930d1f50ff7ae45502a6223
@property def notes(self): 'Gets the notes of this ApiAlertProfile. # noqa: E501\n\n Free-form text. # noqa: E501\n\n :return: The notes of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._notes
Gets the notes of this ApiAlertProfile. # noqa: E501 Free-form text. # noqa: E501 :return: The notes of this ApiAlertProfile. # noqa: E501 :rtype: str
openapi_client/models/api_alert_profile.py
notes
hi-artem/twistlock-py
0
python
@property def notes(self): 'Gets the notes of this ApiAlertProfile. # noqa: E501\n\n Free-form text. # noqa: E501\n\n :return: The notes of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._notes
@property def notes(self): 'Gets the notes of this ApiAlertProfile. # noqa: E501\n\n Free-form text. # noqa: E501\n\n :return: The notes of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._notes<|docstring|>Gets the notes of this ApiAlertProfile. # noqa: E501 Free-form text. # noqa: E501 :return: The notes of this ApiAlertProfile. # noqa: E501 :rtype: str<|endoftext|>
edf4908cfe8e9d5a38899ed7f64a8c6c42a9037686f13caadd81d6abbb90f14c
@notes.setter def notes(self, notes): 'Sets the notes of this ApiAlertProfile.\n\n Free-form text. # noqa: E501\n\n :param notes: The notes of this ApiAlertProfile. # noqa: E501\n :type notes: str\n ' self._notes = notes
Sets the notes of this ApiAlertProfile. Free-form text. # noqa: E501 :param notes: The notes of this ApiAlertProfile. # noqa: E501 :type notes: str
openapi_client/models/api_alert_profile.py
notes
hi-artem/twistlock-py
0
python
@notes.setter def notes(self, notes): 'Sets the notes of this ApiAlertProfile.\n\n Free-form text. # noqa: E501\n\n :param notes: The notes of this ApiAlertProfile. # noqa: E501\n :type notes: str\n ' self._notes = notes
@notes.setter def notes(self, notes): 'Sets the notes of this ApiAlertProfile.\n\n Free-form text. # noqa: E501\n\n :param notes: The notes of this ApiAlertProfile. # noqa: E501\n :type notes: str\n ' self._notes = notes<|docstring|>Sets the notes of this ApiAlertProfile. Free-form text. # noqa: E501 :param notes: The notes of this ApiAlertProfile. # noqa: E501 :type notes: str<|endoftext|>
7f7dc2029f69bbb0bb83fc69fdd0674ea7e3e9b26ba110f879a9c7e7ba02bc66
@property def owner(self): 'Gets the owner of this ApiAlertProfile. # noqa: E501\n\n User who created or last modified the rule. # noqa: E501\n\n :return: The owner of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._owner
Gets the owner of this ApiAlertProfile. # noqa: E501 User who created or last modified the rule. # noqa: E501 :return: The owner of this ApiAlertProfile. # noqa: E501 :rtype: str
openapi_client/models/api_alert_profile.py
owner
hi-artem/twistlock-py
0
python
@property def owner(self): 'Gets the owner of this ApiAlertProfile. # noqa: E501\n\n User who created or last modified the rule. # noqa: E501\n\n :return: The owner of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._owner
@property def owner(self): 'Gets the owner of this ApiAlertProfile. # noqa: E501\n\n User who created or last modified the rule. # noqa: E501\n\n :return: The owner of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._owner<|docstring|>Gets the owner of this ApiAlertProfile. # noqa: E501 User who created or last modified the rule. # noqa: E501 :return: The owner of this ApiAlertProfile. # noqa: E501 :rtype: str<|endoftext|>
3ea564f08ba0c066a96a37d4c016069c790d43bbfb637ab456b9a39f8f5b8d54
@owner.setter def owner(self, owner): 'Sets the owner of this ApiAlertProfile.\n\n User who created or last modified the rule. # noqa: E501\n\n :param owner: The owner of this ApiAlertProfile. # noqa: E501\n :type owner: str\n ' self._owner = owner
Sets the owner of this ApiAlertProfile. User who created or last modified the rule. # noqa: E501 :param owner: The owner of this ApiAlertProfile. # noqa: E501 :type owner: str
openapi_client/models/api_alert_profile.py
owner
hi-artem/twistlock-py
0
python
@owner.setter def owner(self, owner): 'Sets the owner of this ApiAlertProfile.\n\n User who created or last modified the rule. # noqa: E501\n\n :param owner: The owner of this ApiAlertProfile. # noqa: E501\n :type owner: str\n ' self._owner = owner
@owner.setter def owner(self, owner): 'Sets the owner of this ApiAlertProfile.\n\n User who created or last modified the rule. # noqa: E501\n\n :param owner: The owner of this ApiAlertProfile. # noqa: E501\n :type owner: str\n ' self._owner = owner<|docstring|>Sets the owner of this ApiAlertProfile. User who created or last modified the rule. # noqa: E501 :param owner: The owner of this ApiAlertProfile. # noqa: E501 :type owner: str<|endoftext|>
d26e8e4d935a0bae35635344b803faace94b5c66f8b870ce5cf8285762d13784
@property def pagerduty(self): 'Gets the pagerduty of this ApiAlertProfile. # noqa: E501\n\n\n :return: The pagerduty of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfilePagerDutySettings\n ' return self._pagerduty
Gets the pagerduty of this ApiAlertProfile. # noqa: E501 :return: The pagerduty of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfilePagerDutySettings
openapi_client/models/api_alert_profile.py
pagerduty
hi-artem/twistlock-py
0
python
@property def pagerduty(self): 'Gets the pagerduty of this ApiAlertProfile. # noqa: E501\n\n\n :return: The pagerduty of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfilePagerDutySettings\n ' return self._pagerduty
@property def pagerduty(self): 'Gets the pagerduty of this ApiAlertProfile. # noqa: E501\n\n\n :return: The pagerduty of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfilePagerDutySettings\n ' return self._pagerduty<|docstring|>Gets the pagerduty of this ApiAlertProfile. # noqa: E501 :return: The pagerduty of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfilePagerDutySettings<|endoftext|>
46db4ef437917492c3232b3d7f11d96bfed526a8ef08e4db36d2ed6cb5d9d81c
@pagerduty.setter def pagerduty(self, pagerduty): 'Sets the pagerduty of this ApiAlertProfile.\n\n\n :param pagerduty: The pagerduty of this ApiAlertProfile. # noqa: E501\n :type pagerduty: ApiAlertProfilePagerDutySettings\n ' self._pagerduty = pagerduty
Sets the pagerduty of this ApiAlertProfile. :param pagerduty: The pagerduty of this ApiAlertProfile. # noqa: E501 :type pagerduty: ApiAlertProfilePagerDutySettings
openapi_client/models/api_alert_profile.py
pagerduty
hi-artem/twistlock-py
0
python
@pagerduty.setter def pagerduty(self, pagerduty): 'Sets the pagerduty of this ApiAlertProfile.\n\n\n :param pagerduty: The pagerduty of this ApiAlertProfile. # noqa: E501\n :type pagerduty: ApiAlertProfilePagerDutySettings\n ' self._pagerduty = pagerduty
@pagerduty.setter def pagerduty(self, pagerduty): 'Sets the pagerduty of this ApiAlertProfile.\n\n\n :param pagerduty: The pagerduty of this ApiAlertProfile. # noqa: E501\n :type pagerduty: ApiAlertProfilePagerDutySettings\n ' self._pagerduty = pagerduty<|docstring|>Sets the pagerduty of this ApiAlertProfile. :param pagerduty: The pagerduty of this ApiAlertProfile. # noqa: E501 :type pagerduty: ApiAlertProfilePagerDutySettings<|endoftext|>
ec283b789bb5971aad11b4f2b32df9b42df7605ea2de6797db6386f3e4088037
@property def policy(self): 'Gets the policy of this ApiAlertProfile. # noqa: E501\n\n Policy contains the mapping between alert type to the applied alert rules. # noqa: E501\n\n :return: The policy of this ApiAlertProfile. # noqa: E501\n :rtype: dict(str, ApiAlertRule)\n ' return self._policy
Gets the policy of this ApiAlertProfile. # noqa: E501 Policy contains the mapping between alert type to the applied alert rules. # noqa: E501 :return: The policy of this ApiAlertProfile. # noqa: E501 :rtype: dict(str, ApiAlertRule)
openapi_client/models/api_alert_profile.py
policy
hi-artem/twistlock-py
0
python
@property def policy(self): 'Gets the policy of this ApiAlertProfile. # noqa: E501\n\n Policy contains the mapping between alert type to the applied alert rules. # noqa: E501\n\n :return: The policy of this ApiAlertProfile. # noqa: E501\n :rtype: dict(str, ApiAlertRule)\n ' return self._policy
@property def policy(self): 'Gets the policy of this ApiAlertProfile. # noqa: E501\n\n Policy contains the mapping between alert type to the applied alert rules. # noqa: E501\n\n :return: The policy of this ApiAlertProfile. # noqa: E501\n :rtype: dict(str, ApiAlertRule)\n ' return self._policy<|docstring|>Gets the policy of this ApiAlertProfile. # noqa: E501 Policy contains the mapping between alert type to the applied alert rules. # noqa: E501 :return: The policy of this ApiAlertProfile. # noqa: E501 :rtype: dict(str, ApiAlertRule)<|endoftext|>
53a77420ba4dfa8293b719648d25ed5016b11f003706b1a8caaef61913476dcc
@policy.setter def policy(self, policy): 'Sets the policy of this ApiAlertProfile.\n\n Policy contains the mapping between alert type to the applied alert rules. # noqa: E501\n\n :param policy: The policy of this ApiAlertProfile. # noqa: E501\n :type policy: dict(str, ApiAlertRule)\n ' self._policy = policy
Sets the policy of this ApiAlertProfile. Policy contains the mapping between alert type to the applied alert rules. # noqa: E501 :param policy: The policy of this ApiAlertProfile. # noqa: E501 :type policy: dict(str, ApiAlertRule)
openapi_client/models/api_alert_profile.py
policy
hi-artem/twistlock-py
0
python
@policy.setter def policy(self, policy): 'Sets the policy of this ApiAlertProfile.\n\n Policy contains the mapping between alert type to the applied alert rules. # noqa: E501\n\n :param policy: The policy of this ApiAlertProfile. # noqa: E501\n :type policy: dict(str, ApiAlertRule)\n ' self._policy = policy
@policy.setter def policy(self, policy): 'Sets the policy of this ApiAlertProfile.\n\n Policy contains the mapping between alert type to the applied alert rules. # noqa: E501\n\n :param policy: The policy of this ApiAlertProfile. # noqa: E501\n :type policy: dict(str, ApiAlertRule)\n ' self._policy = policy<|docstring|>Sets the policy of this ApiAlertProfile. Policy contains the mapping between alert type to the applied alert rules. # noqa: E501 :param policy: The policy of this ApiAlertProfile. # noqa: E501 :type policy: dict(str, ApiAlertRule)<|endoftext|>
1e9706614e3eb62b783c4c472a1369819ec594111c83f3a53955ffd0a867b0ca
@property def previous_name(self): 'Gets the previous_name of this ApiAlertProfile. # noqa: E501\n\n Previous name of the rule. Required for rule renaming. # noqa: E501\n\n :return: The previous_name of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._previous_name
Gets the previous_name of this ApiAlertProfile. # noqa: E501 Previous name of the rule. Required for rule renaming. # noqa: E501 :return: The previous_name of this ApiAlertProfile. # noqa: E501 :rtype: str
openapi_client/models/api_alert_profile.py
previous_name
hi-artem/twistlock-py
0
python
@property def previous_name(self): 'Gets the previous_name of this ApiAlertProfile. # noqa: E501\n\n Previous name of the rule. Required for rule renaming. # noqa: E501\n\n :return: The previous_name of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._previous_name
@property def previous_name(self): 'Gets the previous_name of this ApiAlertProfile. # noqa: E501\n\n Previous name of the rule. Required for rule renaming. # noqa: E501\n\n :return: The previous_name of this ApiAlertProfile. # noqa: E501\n :rtype: str\n ' return self._previous_name<|docstring|>Gets the previous_name of this ApiAlertProfile. # noqa: E501 Previous name of the rule. Required for rule renaming. # noqa: E501 :return: The previous_name of this ApiAlertProfile. # noqa: E501 :rtype: str<|endoftext|>
8ca1322c3a3d25d1e0e8d74ab4a821b7e9ef3f3098011152873b3aa1ed984fac
@previous_name.setter def previous_name(self, previous_name): 'Sets the previous_name of this ApiAlertProfile.\n\n Previous name of the rule. Required for rule renaming. # noqa: E501\n\n :param previous_name: The previous_name of this ApiAlertProfile. # noqa: E501\n :type previous_name: str\n ' self._previous_name = previous_name
Sets the previous_name of this ApiAlertProfile. Previous name of the rule. Required for rule renaming. # noqa: E501 :param previous_name: The previous_name of this ApiAlertProfile. # noqa: E501 :type previous_name: str
openapi_client/models/api_alert_profile.py
previous_name
hi-artem/twistlock-py
0
python
@previous_name.setter def previous_name(self, previous_name): 'Sets the previous_name of this ApiAlertProfile.\n\n Previous name of the rule. Required for rule renaming. # noqa: E501\n\n :param previous_name: The previous_name of this ApiAlertProfile. # noqa: E501\n :type previous_name: str\n ' self._previous_name = previous_name
@previous_name.setter def previous_name(self, previous_name): 'Sets the previous_name of this ApiAlertProfile.\n\n Previous name of the rule. Required for rule renaming. # noqa: E501\n\n :param previous_name: The previous_name of this ApiAlertProfile. # noqa: E501\n :type previous_name: str\n ' self._previous_name = previous_name<|docstring|>Sets the previous_name of this ApiAlertProfile. Previous name of the rule. Required for rule renaming. # noqa: E501 :param previous_name: The previous_name of this ApiAlertProfile. # noqa: E501 :type previous_name: str<|endoftext|>
f77d159f6d63fe468e79a8922e386e7b58d56df36dde3d2547c8403f1be5886f
@property def security_advisor(self): 'Gets the security_advisor of this ApiAlertProfile. # noqa: E501\n\n\n :return: The security_advisor of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileSecurityAdvisor\n ' return self._security_advisor
Gets the security_advisor of this ApiAlertProfile. # noqa: E501 :return: The security_advisor of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileSecurityAdvisor
openapi_client/models/api_alert_profile.py
security_advisor
hi-artem/twistlock-py
0
python
@property def security_advisor(self): 'Gets the security_advisor of this ApiAlertProfile. # noqa: E501\n\n\n :return: The security_advisor of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileSecurityAdvisor\n ' return self._security_advisor
@property def security_advisor(self): 'Gets the security_advisor of this ApiAlertProfile. # noqa: E501\n\n\n :return: The security_advisor of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileSecurityAdvisor\n ' return self._security_advisor<|docstring|>Gets the security_advisor of this ApiAlertProfile. # noqa: E501 :return: The security_advisor of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileSecurityAdvisor<|endoftext|>
61b0dd38c49b450d6693e40755287f39b777ffb6a314f05e8c66dbb3b7f3dc82
@security_advisor.setter def security_advisor(self, security_advisor): 'Sets the security_advisor of this ApiAlertProfile.\n\n\n :param security_advisor: The security_advisor of this ApiAlertProfile. # noqa: E501\n :type security_advisor: ApiAlertProfileSecurityAdvisor\n ' self._security_advisor = security_advisor
Sets the security_advisor of this ApiAlertProfile. :param security_advisor: The security_advisor of this ApiAlertProfile. # noqa: E501 :type security_advisor: ApiAlertProfileSecurityAdvisor
openapi_client/models/api_alert_profile.py
security_advisor
hi-artem/twistlock-py
0
python
@security_advisor.setter def security_advisor(self, security_advisor): 'Sets the security_advisor of this ApiAlertProfile.\n\n\n :param security_advisor: The security_advisor of this ApiAlertProfile. # noqa: E501\n :type security_advisor: ApiAlertProfileSecurityAdvisor\n ' self._security_advisor = security_advisor
@security_advisor.setter def security_advisor(self, security_advisor): 'Sets the security_advisor of this ApiAlertProfile.\n\n\n :param security_advisor: The security_advisor of this ApiAlertProfile. # noqa: E501\n :type security_advisor: ApiAlertProfileSecurityAdvisor\n ' self._security_advisor = security_advisor<|docstring|>Sets the security_advisor of this ApiAlertProfile. :param security_advisor: The security_advisor of this ApiAlertProfile. # noqa: E501 :type security_advisor: ApiAlertProfileSecurityAdvisor<|endoftext|>
daf24576943c28b2385042b3502ae9ae950697063d98106d0de5418aea62a839
@property def security_center(self): 'Gets the security_center of this ApiAlertProfile. # noqa: E501\n\n\n :return: The security_center of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileSecurityCenterSettings\n ' return self._security_center
Gets the security_center of this ApiAlertProfile. # noqa: E501 :return: The security_center of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileSecurityCenterSettings
openapi_client/models/api_alert_profile.py
security_center
hi-artem/twistlock-py
0
python
@property def security_center(self): 'Gets the security_center of this ApiAlertProfile. # noqa: E501\n\n\n :return: The security_center of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileSecurityCenterSettings\n ' return self._security_center
@property def security_center(self): 'Gets the security_center of this ApiAlertProfile. # noqa: E501\n\n\n :return: The security_center of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileSecurityCenterSettings\n ' return self._security_center<|docstring|>Gets the security_center of this ApiAlertProfile. # noqa: E501 :return: The security_center of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileSecurityCenterSettings<|endoftext|>
a3cac6a1d7b8c3dd79ccb01102fe233c35720971bebed0db74296f94126f6e35
@security_center.setter def security_center(self, security_center): 'Sets the security_center of this ApiAlertProfile.\n\n\n :param security_center: The security_center of this ApiAlertProfile. # noqa: E501\n :type security_center: ApiAlertProfileSecurityCenterSettings\n ' self._security_center = security_center
Sets the security_center of this ApiAlertProfile. :param security_center: The security_center of this ApiAlertProfile. # noqa: E501 :type security_center: ApiAlertProfileSecurityCenterSettings
openapi_client/models/api_alert_profile.py
security_center
hi-artem/twistlock-py
0
python
@security_center.setter def security_center(self, security_center): 'Sets the security_center of this ApiAlertProfile.\n\n\n :param security_center: The security_center of this ApiAlertProfile. # noqa: E501\n :type security_center: ApiAlertProfileSecurityCenterSettings\n ' self._security_center = security_center
@security_center.setter def security_center(self, security_center): 'Sets the security_center of this ApiAlertProfile.\n\n\n :param security_center: The security_center of this ApiAlertProfile. # noqa: E501\n :type security_center: ApiAlertProfileSecurityCenterSettings\n ' self._security_center = security_center<|docstring|>Sets the security_center of this ApiAlertProfile. :param security_center: The security_center of this ApiAlertProfile. # noqa: E501 :type security_center: ApiAlertProfileSecurityCenterSettings<|endoftext|>
737a111b74e6ddf034d9cef604c69c3d2cf181a571c0f238b895bad3ec5f7ad9
@property def security_hub(self): 'Gets the security_hub of this ApiAlertProfile. # noqa: E501\n\n\n :return: The security_hub of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileSecurityHubSettings\n ' return self._security_hub
Gets the security_hub of this ApiAlertProfile. # noqa: E501 :return: The security_hub of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileSecurityHubSettings
openapi_client/models/api_alert_profile.py
security_hub
hi-artem/twistlock-py
0
python
@property def security_hub(self): 'Gets the security_hub of this ApiAlertProfile. # noqa: E501\n\n\n :return: The security_hub of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileSecurityHubSettings\n ' return self._security_hub
@property def security_hub(self): 'Gets the security_hub of this ApiAlertProfile. # noqa: E501\n\n\n :return: The security_hub of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileSecurityHubSettings\n ' return self._security_hub<|docstring|>Gets the security_hub of this ApiAlertProfile. # noqa: E501 :return: The security_hub of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileSecurityHubSettings<|endoftext|>
ea4baa755f4ae6600abd402bb97b2aa85b1a43b9c2449bf51241e8e1b36315bf
@security_hub.setter def security_hub(self, security_hub): 'Sets the security_hub of this ApiAlertProfile.\n\n\n :param security_hub: The security_hub of this ApiAlertProfile. # noqa: E501\n :type security_hub: ApiAlertProfileSecurityHubSettings\n ' self._security_hub = security_hub
Sets the security_hub of this ApiAlertProfile. :param security_hub: The security_hub of this ApiAlertProfile. # noqa: E501 :type security_hub: ApiAlertProfileSecurityHubSettings
openapi_client/models/api_alert_profile.py
security_hub
hi-artem/twistlock-py
0
python
@security_hub.setter def security_hub(self, security_hub): 'Sets the security_hub of this ApiAlertProfile.\n\n\n :param security_hub: The security_hub of this ApiAlertProfile. # noqa: E501\n :type security_hub: ApiAlertProfileSecurityHubSettings\n ' self._security_hub = security_hub
@security_hub.setter def security_hub(self, security_hub): 'Sets the security_hub of this ApiAlertProfile.\n\n\n :param security_hub: The security_hub of this ApiAlertProfile. # noqa: E501\n :type security_hub: ApiAlertProfileSecurityHubSettings\n ' self._security_hub = security_hub<|docstring|>Sets the security_hub of this ApiAlertProfile. :param security_hub: The security_hub of this ApiAlertProfile. # noqa: E501 :type security_hub: ApiAlertProfileSecurityHubSettings<|endoftext|>
0dcb3d02c00835fe1ccf5d0668b96a78eeb4466cbfec0902aac92c13f197093b
@property def service_now(self): 'Gets the service_now of this ApiAlertProfile. # noqa: E501\n\n\n :return: The service_now of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileServiceNowSettings\n ' return self._service_now
Gets the service_now of this ApiAlertProfile. # noqa: E501 :return: The service_now of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileServiceNowSettings
openapi_client/models/api_alert_profile.py
service_now
hi-artem/twistlock-py
0
python
@property def service_now(self): 'Gets the service_now of this ApiAlertProfile. # noqa: E501\n\n\n :return: The service_now of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileServiceNowSettings\n ' return self._service_now
@property def service_now(self): 'Gets the service_now of this ApiAlertProfile. # noqa: E501\n\n\n :return: The service_now of this ApiAlertProfile. # noqa: E501\n :rtype: ApiAlertProfileServiceNowSettings\n ' return self._service_now<|docstring|>Gets the service_now of this ApiAlertProfile. # noqa: E501 :return: The service_now of this ApiAlertProfile. # noqa: E501 :rtype: ApiAlertProfileServiceNowSettings<|endoftext|>