repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.set_credentials | def set_credentials(self, username, password=None, region=None,
tenant_id=None, authenticate=False):
"""Sets the username and password directly."""
self.username = username
self.password = password
self.tenant_id = tenant_id
if region:
self.region = region... | python | def set_credentials(self, username, password=None, region=None,
tenant_id=None, authenticate=False):
"""Sets the username and password directly."""
self.username = username
self.password = password
self.tenant_id = tenant_id
if region:
self.region = region... | Sets the username and password directly. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L411-L420 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.set_credential_file | def set_credential_file(self, credential_file, region=None,
tenant_id=None, authenticate=False):
"""
Reads in the credentials from the supplied file. It should be
a standard config file in the format:
[keystone]
username = myusername
password = top_secret
... | python | def set_credential_file(self, credential_file, region=None,
tenant_id=None, authenticate=False):
"""
Reads in the credentials from the supplied file. It should be
a standard config file in the format:
[keystone]
username = myusername
password = top_secret
... | Reads in the credentials from the supplied file. It should be
a standard config file in the format:
[keystone]
username = myusername
password = top_secret
tenant_id = my_id | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L423-L453 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.auth_with_token | def auth_with_token(self, token, tenant_id=None, tenant_name=None):
"""
If a valid token is already known, this call uses it to generate the
service catalog.
"""
resp, resp_body = self._call_token_auth(token, tenant_id, tenant_name)
self._parse_response(resp_body)
... | python | def auth_with_token(self, token, tenant_id=None, tenant_name=None):
"""
If a valid token is already known, this call uses it to generate the
service catalog.
"""
resp, resp_body = self._call_token_auth(token, tenant_id, tenant_name)
self._parse_response(resp_body)
... | If a valid token is already known, this call uses it to generate the
service catalog. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L456-L463 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity._read_credential_file | def _read_credential_file(self, cfg):
"""
Implements the default (keystone) behavior.
"""
self.username = cfg.get("keystone", "username")
self.password = cfg.get("keystone", "password", raw=True)
self.tenant_id = cfg.get("keystone", "tenant_id") | python | def _read_credential_file(self, cfg):
"""
Implements the default (keystone) behavior.
"""
self.username = cfg.get("keystone", "username")
self.password = cfg.get("keystone", "password", raw=True)
self.tenant_id = cfg.get("keystone", "tenant_id") | Implements the default (keystone) behavior. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L497-L503 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity._format_credentials | def _format_credentials(self):
"""
Returns the current credentials in the format expected by
the authentication service.
"""
tenant_name = self.tenant_name or self.username
tenant_id = self.tenant_id or self.username
return {"auth": {"passwordCredentials":
... | python | def _format_credentials(self):
"""
Returns the current credentials in the format expected by
the authentication service.
"""
tenant_name = self.tenant_name or self.username
tenant_id = self.tenant_id or self.username
return {"auth": {"passwordCredentials":
... | Returns the current credentials in the format expected by
the authentication service. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L506-L517 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity._call | def _call(self, mthd, uri, admin, data, headers, std_headers):
"""
Handles all the common functionality required for API calls. Returns
the resulting response object.
"""
if not uri.startswith("http"):
uri = "/".join((self.auth_endpoint.rstrip("/"), uri))
if a... | python | def _call(self, mthd, uri, admin, data, headers, std_headers):
"""
Handles all the common functionality required for API calls. Returns
the resulting response object.
"""
if not uri.startswith("http"):
uri = "/".join((self.auth_endpoint.rstrip("/"), uri))
if a... | Handles all the common functionality required for API calls. Returns
the resulting response object. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L548-L570 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.authenticate | def authenticate(self, username=None, password=None, api_key=None,
tenant_id=None, connect=False):
"""
Using the supplied credentials, connects to the specified
authentication endpoint and attempts to log in.
Credentials can either be passed directly to this method, or
... | python | def authenticate(self, username=None, password=None, api_key=None,
tenant_id=None, connect=False):
"""
Using the supplied credentials, connects to the specified
authentication endpoint and attempts to log in.
Credentials can either be passed directly to this method, or
... | Using the supplied credentials, connects to the specified
authentication endpoint and attempts to log in.
Credentials can either be passed directly to this method, or
previously-stored credentials can be used. If authentication is
successful, the token and service catalog information is... | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L573-L623 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity._parse_response | def _parse_response(self, resp):
"""Gets the authentication information from the returned JSON."""
access = resp["access"]
token = access.get("token")
self.token = token["id"]
self.tenant_id = token["tenant"]["id"]
self.tenant_name = token["tenant"]["name"]
self.e... | python | def _parse_response(self, resp):
"""Gets the authentication information from the returned JSON."""
access = resp["access"]
token = access.get("token")
self.token = token["id"]
self.tenant_id = token["tenant"]["id"]
self.tenant_name = token["tenant"]["name"]
self.e... | Gets the authentication information from the returned JSON. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L626-L640 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.keyring_auth | def keyring_auth(self, username=None):
"""
Uses the keyring module to retrieve the user's password or api_key.
"""
if not keyring:
# Module not installed
raise exc.KeyringModuleNotInstalled("The 'keyring' Python module "
"is not installed on th... | python | def keyring_auth(self, username=None):
"""
Uses the keyring module to retrieve the user's password or api_key.
"""
if not keyring:
# Module not installed
raise exc.KeyringModuleNotInstalled("The 'keyring' Python module "
"is not installed on th... | Uses the keyring module to retrieve the user's password or api_key. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L667-L691 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.unauthenticate | def unauthenticate(self):
"""
Clears out any credentials, tokens, and service catalog info.
"""
self.username = ""
self.password = ""
self.tenant_id = ""
self.tenant_name = ""
self.token = ""
self.expires = None
self.region = ""
sel... | python | def unauthenticate(self):
"""
Clears out any credentials, tokens, and service catalog info.
"""
self.username = ""
self.password = ""
self.tenant_id = ""
self.tenant_name = ""
self.token = ""
self.expires = None
self.region = ""
sel... | Clears out any credentials, tokens, and service catalog info. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L694-L709 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.get_token | def get_token(self, force=False):
"""
Returns the auth token, if it is valid. If not, calls the auth endpoint
to get a new token. Passing 'True' to 'force' forces a call for a new
token, even if there already is a valid token.
"""
self.authenticated = self._has_valid_toke... | python | def get_token(self, force=False):
"""
Returns the auth token, if it is valid. If not, calls the auth endpoint
to get a new token. Passing 'True' to 'force' forces a call for a new
token, even if there already is a valid token.
"""
self.authenticated = self._has_valid_toke... | Returns the auth token, if it is valid. If not, calls the auth endpoint
to get a new token. Passing 'True' to 'force' forces a call for a new
token, even if there already is a valid token. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L731-L740 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity._has_valid_token | def _has_valid_token(self):
"""
This only checks the token's existence and expiration. If it has been
invalidated on the server, this method may indicate that the token is
valid when it might actually not be.
"""
return bool(self.token and (self.expires > datetime.datetim... | python | def _has_valid_token(self):
"""
This only checks the token's existence and expiration. If it has been
invalidated on the server, this method may indicate that the token is
valid when it might actually not be.
"""
return bool(self.token and (self.expires > datetime.datetim... | This only checks the token's existence and expiration. If it has been
invalidated on the server, this method may indicate that the token is
valid when it might actually not be. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L743-L749 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.list_tokens | def list_tokens(self):
"""
ADMIN ONLY. Returns a dict containing tokens, endpoints, user info, and
role metadata.
"""
resp, resp_body = self.method_get("tokens/%s" % self.token, admin=True)
if resp.status_code in (401, 403):
raise exc.AuthorizationFailure("You... | python | def list_tokens(self):
"""
ADMIN ONLY. Returns a dict containing tokens, endpoints, user info, and
role metadata.
"""
resp, resp_body = self.method_get("tokens/%s" % self.token, admin=True)
if resp.status_code in (401, 403):
raise exc.AuthorizationFailure("You... | ADMIN ONLY. Returns a dict containing tokens, endpoints, user info, and
role metadata. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L752-L761 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.check_token | def check_token(self, token=None):
"""
ADMIN ONLY. Returns True or False, depending on whether the current
token is valid.
"""
if token is None:
token = self.token
resp, resp_body = self.method_head("tokens/%s" % token, admin=True)
if resp.status_code ... | python | def check_token(self, token=None):
"""
ADMIN ONLY. Returns True or False, depending on whether the current
token is valid.
"""
if token is None:
token = self.token
resp, resp_body = self.method_head("tokens/%s" % token, admin=True)
if resp.status_code ... | ADMIN ONLY. Returns True or False, depending on whether the current
token is valid. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L764-L775 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.revoke_token | def revoke_token(self, token):
"""
ADMIN ONLY. Returns True or False, depending on whether deletion of the
specified token was successful.
"""
resp, resp_body = self.method_delete("tokens/%s" % token, admin=True)
if resp.status_code in (401, 403):
raise exc.Au... | python | def revoke_token(self, token):
"""
ADMIN ONLY. Returns True or False, depending on whether deletion of the
specified token was successful.
"""
resp, resp_body = self.method_delete("tokens/%s" % token, admin=True)
if resp.status_code in (401, 403):
raise exc.Au... | ADMIN ONLY. Returns True or False, depending on whether deletion of the
specified token was successful. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L778-L787 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.list_users | def list_users(self):
"""
ADMIN ONLY. Returns a list of objects for all users for the tenant
(account) if this request is issued by a user holding the admin role
(identity:user-admin).
"""
resp, resp_body = self.method_get("users", admin=True)
if resp.status_code ... | python | def list_users(self):
"""
ADMIN ONLY. Returns a list of objects for all users for the tenant
(account) if this request is issued by a user holding the admin role
(identity:user-admin).
"""
resp, resp_body = self.method_get("users", admin=True)
if resp.status_code ... | ADMIN ONLY. Returns a list of objects for all users for the tenant
(account) if this request is issued by a user holding the admin role
(identity:user-admin). | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L802-L824 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.create_user | def create_user(self, name, email, password=None, enabled=True):
"""
ADMIN ONLY. Creates a new user for this tenant (account). The username
and email address must be supplied. You may optionally supply the
password for this user; if not, the API server generates a password and
re... | python | def create_user(self, name, email, password=None, enabled=True):
"""
ADMIN ONLY. Creates a new user for this tenant (account). The username
and email address must be supplied. You may optionally supply the
password for this user; if not, the API server generates a password and
re... | ADMIN ONLY. Creates a new user for this tenant (account). The username
and email address must be supplied. You may optionally supply the
password for this user; if not, the API server generates a password and
return it in the 'password' attribute of the resulting User object.
NOTE: this ... | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L827-L861 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.delete_user | def delete_user(self, user):
"""
ADMIN ONLY. Removes the user from the system. There is no 'undo'
available, so you should be certain that the user specified is the user
you wish to delete.
"""
user_id = utils.get_id(user)
uri = "users/%s" % user_id
resp, ... | python | def delete_user(self, user):
"""
ADMIN ONLY. Removes the user from the system. There is no 'undo'
available, so you should be certain that the user specified is the user
you wish to delete.
"""
user_id = utils.get_id(user)
uri = "users/%s" % user_id
resp, ... | ADMIN ONLY. Removes the user from the system. There is no 'undo'
available, so you should be certain that the user specified is the user
you wish to delete. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L926-L939 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.list_roles_for_user | def list_roles_for_user(self, user):
"""
ADMIN ONLY. Returns a list of roles for the specified user. Each role
will be a 3-tuple, consisting of (role_id, role_name,
role_description).
"""
user_id = utils.get_id(user)
uri = "users/%s/roles" % user_id
resp, ... | python | def list_roles_for_user(self, user):
"""
ADMIN ONLY. Returns a list of roles for the specified user. Each role
will be a 3-tuple, consisting of (role_id, role_name,
role_description).
"""
user_id = utils.get_id(user)
uri = "users/%s/roles" % user_id
resp, ... | ADMIN ONLY. Returns a list of roles for the specified user. Each role
will be a 3-tuple, consisting of (role_id, role_name,
role_description). | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L942-L955 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.list_credentials | def list_credentials(self, user=None):
"""
Returns a user's non-password credentials. If no user is specified, the
credentials for the currently authenticated user are returned.
You cannot retrieve passwords by this or any other means.
"""
if not user:
user =... | python | def list_credentials(self, user=None):
"""
Returns a user's non-password credentials. If no user is specified, the
credentials for the currently authenticated user are returned.
You cannot retrieve passwords by this or any other means.
"""
if not user:
user =... | Returns a user's non-password credentials. If no user is specified, the
credentials for the currently authenticated user are returned.
You cannot retrieve passwords by this or any other means. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L958-L970 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity._list_tenants | def _list_tenants(self, admin):
"""
Returns either a list of all tenants (admin=True), or the tenant for
the currently-authenticated user (admin=False).
"""
resp, resp_body = self.method_get("tenants", admin=admin)
if 200 <= resp.status_code < 300:
tenants = r... | python | def _list_tenants(self, admin):
"""
Returns either a list of all tenants (admin=True), or the tenant for
the currently-authenticated user (admin=False).
"""
resp, resp_body = self.method_get("tenants", admin=admin)
if 200 <= resp.status_code < 300:
tenants = r... | Returns either a list of all tenants (admin=True), or the tenant for
the currently-authenticated user (admin=False). | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L999-L1012 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.create_tenant | def create_tenant(self, name, description=None, enabled=True):
"""
ADMIN ONLY. Creates a new tenant.
"""
data = {"tenant": {
"name": name,
"enabled": enabled,
}}
if description:
data["tenant"]["description"] = descriptio... | python | def create_tenant(self, name, description=None, enabled=True):
"""
ADMIN ONLY. Creates a new tenant.
"""
data = {"tenant": {
"name": name,
"enabled": enabled,
}}
if description:
data["tenant"]["description"] = descriptio... | ADMIN ONLY. Creates a new tenant. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L1015-L1026 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.update_tenant | def update_tenant(self, tenant, name=None, description=None, enabled=True):
"""
ADMIN ONLY. Updates an existing tenant.
"""
tenant_id = utils.get_id(tenant)
data = {"tenant": {
"enabled": enabled,
}}
if name:
data["tenant"]["nam... | python | def update_tenant(self, tenant, name=None, description=None, enabled=True):
"""
ADMIN ONLY. Updates an existing tenant.
"""
tenant_id = utils.get_id(tenant)
data = {"tenant": {
"enabled": enabled,
}}
if name:
data["tenant"]["nam... | ADMIN ONLY. Updates an existing tenant. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L1029-L1042 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.delete_tenant | def delete_tenant(self, tenant):
"""
ADMIN ONLY. Removes the tenant from the system. There is no 'undo'
available, so you should be certain that the tenant specified is the
tenant you wish to delete.
"""
tenant_id = utils.get_id(tenant)
uri = "tenants/%s" % tenant... | python | def delete_tenant(self, tenant):
"""
ADMIN ONLY. Removes the tenant from the system. There is no 'undo'
available, so you should be certain that the tenant specified is the
tenant you wish to delete.
"""
tenant_id = utils.get_id(tenant)
uri = "tenants/%s" % tenant... | ADMIN ONLY. Removes the tenant from the system. There is no 'undo'
available, so you should be certain that the tenant specified is the
tenant you wish to delete. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L1045-L1055 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.list_roles | def list_roles(self, service_id=None, limit=None, marker=None):
"""
Returns a list of all global roles for users, optionally limited by
service. Pagination can be handled through the standard 'limit' and
'marker' parameters.
"""
uri = "OS-KSADM/roles"
pagination_i... | python | def list_roles(self, service_id=None, limit=None, marker=None):
"""
Returns a list of all global roles for users, optionally limited by
service. Pagination can be handled through the standard 'limit' and
'marker' parameters.
"""
uri = "OS-KSADM/roles"
pagination_i... | Returns a list of all global roles for users, optionally limited by
service. Pagination can be handled through the standard 'limit' and
'marker' parameters. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L1058-L1077 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.get_role | def get_role(self, role):
"""
Returns a Role object representing the specified parameter. The 'role'
parameter can be either an existing Role object, or the ID of the role.
If an invalid role is passed, a NotFound exception is raised.
"""
uri = "OS-KSADM/roles/%s" % util... | python | def get_role(self, role):
"""
Returns a Role object representing the specified parameter. The 'role'
parameter can be either an existing Role object, or the ID of the role.
If an invalid role is passed, a NotFound exception is raised.
"""
uri = "OS-KSADM/roles/%s" % util... | Returns a Role object representing the specified parameter. The 'role'
parameter can be either an existing Role object, or the ID of the role.
If an invalid role is passed, a NotFound exception is raised. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L1080-L1090 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.add_role_to_user | def add_role_to_user(self, role, user):
"""
Adds the specified role to the specified user.
There is no return value upon success. Passing a non-existent role or
user raises a NotFound exception.
"""
uri = "users/%s/roles/OS-KSADM/%s" % (utils.get_id(user),
... | python | def add_role_to_user(self, role, user):
"""
Adds the specified role to the specified user.
There is no return value upon success. Passing a non-existent role or
user raises a NotFound exception.
"""
uri = "users/%s/roles/OS-KSADM/%s" % (utils.get_id(user),
... | Adds the specified role to the specified user.
There is no return value upon success. Passing a non-existent role or
user raises a NotFound exception. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L1093-L1102 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity.delete_role_from_user | def delete_role_from_user(self, role, user):
"""
Deletes the specified role from the specified user.
There is no return value upon success. Passing a non-existent role or
user raises a NotFound exception.
"""
uri = "users/%s/roles/OS-KSADM/%s" % (utils.get_id(user),
... | python | def delete_role_from_user(self, role, user):
"""
Deletes the specified role from the specified user.
There is no return value upon success. Passing a non-existent role or
user raises a NotFound exception.
"""
uri = "users/%s/roles/OS-KSADM/%s" % (utils.get_id(user),
... | Deletes the specified role from the specified user.
There is no return value upon success. Passing a non-existent role or
user raises a NotFound exception. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L1105-L1114 |
pycontribs/pyrax | pyrax/base_identity.py | BaseIdentity._parse_api_time | def _parse_api_time(timestr):
"""
Typical expiration times returned from the auth server are in this
format:
2012-05-02T14:27:40.000-05:00
They can also be returned as a UTC value in this format:
2012-05-02T14:27:40.000Z
This method returns a proper dateti... | python | def _parse_api_time(timestr):
"""
Typical expiration times returned from the auth server are in this
format:
2012-05-02T14:27:40.000-05:00
They can also be returned as a UTC value in this format:
2012-05-02T14:27:40.000Z
This method returns a proper dateti... | Typical expiration times returned from the auth server are in this
format:
2012-05-02T14:27:40.000-05:00
They can also be returned as a UTC value in this format:
2012-05-02T14:27:40.000Z
This method returns a proper datetime object from either of these
formats. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L1118-L1145 |
pycontribs/pyrax | pyrax/cloudnetworks.py | CloudNetwork.delete | def delete(self):
"""
Wraps the standard delete() method to catch expected exceptions and
raise the appropriate pyrax exceptions.
"""
try:
return super(CloudNetwork, self).delete()
except exc.Forbidden as e:
# Network is in use
raise ex... | python | def delete(self):
"""
Wraps the standard delete() method to catch expected exceptions and
raise the appropriate pyrax exceptions.
"""
try:
return super(CloudNetwork, self).delete()
except exc.Forbidden as e:
# Network is in use
raise ex... | Wraps the standard delete() method to catch expected exceptions and
raise the appropriate pyrax exceptions. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudnetworks.py#L80-L89 |
pycontribs/pyrax | pyrax/cloudnetworks.py | CloudNetworkManager._create_body | def _create_body(self, name, label=None, cidr=None):
"""
Used to create the dict required to create a network. Accepts either
'label' or 'name' as the keyword parameter for the label attribute.
"""
label = label or name
body = {"network": {
"label": label,... | python | def _create_body(self, name, label=None, cidr=None):
"""
Used to create the dict required to create a network. Accepts either
'label' or 'name' as the keyword parameter for the label attribute.
"""
label = label or name
body = {"network": {
"label": label,... | Used to create the dict required to create a network. Accepts either
'label' or 'name' as the keyword parameter for the label attribute. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudnetworks.py#L113-L123 |
pycontribs/pyrax | pyrax/cloudnetworks.py | CloudNetworkClient._configure_manager | def _configure_manager(self):
"""
Creates the Manager instance to handle networks.
"""
self._manager = CloudNetworkManager(self, resource_class=CloudNetwork,
response_key="network", uri_base="os-networksv2") | python | def _configure_manager(self):
"""
Creates the Manager instance to handle networks.
"""
self._manager = CloudNetworkManager(self, resource_class=CloudNetwork,
response_key="network", uri_base="os-networksv2") | Creates the Manager instance to handle networks. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudnetworks.py#L141-L146 |
pycontribs/pyrax | pyrax/cloudnetworks.py | CloudNetworkClient.create | def create(self, label=None, name=None, cidr=None):
"""
Wraps the basic create() call to handle specific failures.
"""
try:
return super(CloudNetworkClient, self).create(label=label,
name=name, cidr=cidr)
except exc.BadRequest as e:
msg... | python | def create(self, label=None, name=None, cidr=None):
"""
Wraps the basic create() call to handle specific failures.
"""
try:
return super(CloudNetworkClient, self).create(label=label,
name=name, cidr=cidr)
except exc.BadRequest as e:
msg... | Wraps the basic create() call to handle specific failures. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudnetworks.py#L149-L168 |
pycontribs/pyrax | pyrax/cloudnetworks.py | CloudNetworkClient.delete | def delete(self, network):
"""
Wraps the standard delete() method to catch expected exceptions and
raise the appropriate pyrax exceptions.
"""
try:
return super(CloudNetworkClient, self).delete(network)
except exc.Forbidden as e:
# Network is in us... | python | def delete(self, network):
"""
Wraps the standard delete() method to catch expected exceptions and
raise the appropriate pyrax exceptions.
"""
try:
return super(CloudNetworkClient, self).delete(network)
except exc.Forbidden as e:
# Network is in us... | Wraps the standard delete() method to catch expected exceptions and
raise the appropriate pyrax exceptions. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudnetworks.py#L171-L180 |
pycontribs/pyrax | pyrax/cloudnetworks.py | CloudNetworkClient.find_network_by_label | def find_network_by_label(self, label):
"""
This is inefficient; it gets all the networks and then filters on
the client side to find the matching name.
"""
networks = self.list()
match = [network for network in networks
if network.label == label]
... | python | def find_network_by_label(self, label):
"""
This is inefficient; it gets all the networks and then filters on
the client side to find the matching name.
"""
networks = self.list()
match = [network for network in networks
if network.label == label]
... | This is inefficient; it gets all the networks and then filters on
the client side to find the matching name. | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudnetworks.py#L183-L197 |
pycontribs/pyrax | pyrax/cloudnetworks.py | CloudNetworkClient.get_server_networks | def get_server_networks(self, network, public=False, private=False,
key=None):
"""
Creates the dict of network UUIDs required by Cloud Servers when
creating a new server with isolated networks. By default, the UUID
values are returned with the key of "net-id", which is what n... | python | def get_server_networks(self, network, public=False, private=False,
key=None):
"""
Creates the dict of network UUIDs required by Cloud Servers when
creating a new server with isolated networks. By default, the UUID
values are returned with the key of "net-id", which is what n... | Creates the dict of network UUIDs required by Cloud Servers when
creating a new server with isolated networks. By default, the UUID
values are returned with the key of "net-id", which is what novaclient
expects. Other tools may require different values, such as 'uuid'. If
that is the cas... | https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/cloudnetworks.py#L202-L216 |
robotools/fontMath | Lib/fontMath/mathInfo.py | _openTypeOS2WidthClassFormatter | def _openTypeOS2WidthClassFormatter(value):
"""
>>> _openTypeOS2WidthClassFormatter(-2)
1
>>> _openTypeOS2WidthClassFormatter(0)
1
>>> _openTypeOS2WidthClassFormatter(5.4)
5
>>> _openTypeOS2WidthClassFormatter(9.6)
9
>>> _openTypeOS2WidthClassFormatter(12)
9
"""
value... | python | def _openTypeOS2WidthClassFormatter(value):
"""
>>> _openTypeOS2WidthClassFormatter(-2)
1
>>> _openTypeOS2WidthClassFormatter(0)
1
>>> _openTypeOS2WidthClassFormatter(5.4)
5
>>> _openTypeOS2WidthClassFormatter(9.6)
9
>>> _openTypeOS2WidthClassFormatter(12)
9
"""
value... | >>> _openTypeOS2WidthClassFormatter(-2)
1
>>> _openTypeOS2WidthClassFormatter(0)
1
>>> _openTypeOS2WidthClassFormatter(5.4)
5
>>> _openTypeOS2WidthClassFormatter(9.6)
9
>>> _openTypeOS2WidthClassFormatter(12)
9 | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathInfo.py#L322-L340 |
robotools/fontMath | Lib/fontMath/mathInfo.py | MathInfo.extractInfo | def extractInfo(self, otherInfoObject):
"""
>>> from fontMath.test.test_mathInfo import _TestInfoObject, _testData
>>> from fontMath.mathFunctions import _roundNumber
>>> info1 = MathInfo(_TestInfoObject())
>>> info2 = info1 * 2.5
>>> info3 = _TestInfoObject()
>>>... | python | def extractInfo(self, otherInfoObject):
"""
>>> from fontMath.test.test_mathInfo import _TestInfoObject, _testData
>>> from fontMath.mathFunctions import _roundNumber
>>> info1 = MathInfo(_TestInfoObject())
>>> info2 = info1 * 2.5
>>> info3 = _TestInfoObject()
>>>... | >>> from fontMath.test.test_mathInfo import _TestInfoObject, _testData
>>> from fontMath.mathFunctions import _roundNumber
>>> info1 = MathInfo(_TestInfoObject())
>>> info2 = info1 * 2.5
>>> info3 = _TestInfoObject()
>>> info2.extractInfo(info3)
>>> written = {}
>... | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathInfo.py#L207-L239 |
robotools/fontMath | Lib/fontMath/mathGlyph.py | _pairAnchors | def _pairAnchors(anchorDict1, anchorDict2):
"""
Anchors are paired using the following rules:
Matching Identifiers
--------------------
>>> anchors1 = {
... "test" : [
... (None, 1, 2, None),
... ("identifier 1", 3, 4, None)
... ]
... }
>>> anchors2... | python | def _pairAnchors(anchorDict1, anchorDict2):
"""
Anchors are paired using the following rules:
Matching Identifiers
--------------------
>>> anchors1 = {
... "test" : [
... (None, 1, 2, None),
... ("identifier 1", 3, 4, None)
... ]
... }
>>> anchors2... | Anchors are paired using the following rules:
Matching Identifiers
--------------------
>>> anchors1 = {
... "test" : [
... (None, 1, 2, None),
... ("identifier 1", 3, 4, None)
... ]
... }
>>> anchors2 = {
... "test" : [
... ("identifier... | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathGlyph.py#L537-L630 |
robotools/fontMath | Lib/fontMath/mathGlyph.py | MathGlyph.copyWithoutMathSubObjects | def copyWithoutMathSubObjects(self):
"""
return a new MathGlyph containing all data except:
contours
components
anchors
guidelines
this is used mainly for internal glyph math.
"""
n = MathGlyph(None)
n.name = self.name
if self.unic... | python | def copyWithoutMathSubObjects(self):
"""
return a new MathGlyph containing all data except:
contours
components
anchors
guidelines
this is used mainly for internal glyph math.
"""
n = MathGlyph(None)
n.name = self.name
if self.unic... | return a new MathGlyph containing all data except:
contours
components
anchors
guidelines
this is used mainly for internal glyph math. | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathGlyph.py#L119-L137 |
robotools/fontMath | Lib/fontMath/mathGlyph.py | MathGlyph.round | def round(self, digits=None):
"""round the geometry."""
copiedGlyph = self.copyWithoutMathSubObjects()
# misc
copiedGlyph.width = _roundNumber(self.width, digits)
copiedGlyph.height = _roundNumber(self.height, digits)
# contours
copiedGlyph.contours = []
i... | python | def round(self, digits=None):
"""round the geometry."""
copiedGlyph = self.copyWithoutMathSubObjects()
# misc
copiedGlyph.width = _roundNumber(self.width, digits)
copiedGlyph.height = _roundNumber(self.height, digits)
# contours
copiedGlyph.contours = []
i... | round the geometry. | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathGlyph.py#L239-L265 |
robotools/fontMath | Lib/fontMath/mathGlyph.py | MathGlyph.drawPoints | def drawPoints(self, pointPen, filterRedundantPoints=False):
"""draw self using pointPen"""
if filterRedundantPoints:
pointPen = FilterRedundantPointPen(pointPen)
for contour in self.contours:
pointPen.beginPath(identifier=contour["identifier"])
for segmentTyp... | python | def drawPoints(self, pointPen, filterRedundantPoints=False):
"""draw self using pointPen"""
if filterRedundantPoints:
pointPen = FilterRedundantPointPen(pointPen)
for contour in self.contours:
pointPen.beginPath(identifier=contour["identifier"])
for segmentTyp... | draw self using pointPen | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathGlyph.py#L276-L286 |
robotools/fontMath | Lib/fontMath/mathGlyph.py | MathGlyph.draw | def draw(self, pen, filterRedundantPoints=False):
"""draw self using pen"""
from fontTools.pens.pointPen import PointToSegmentPen
pointPen = PointToSegmentPen(pen)
self.drawPoints(pointPen, filterRedundantPoints=filterRedundantPoints) | python | def draw(self, pen, filterRedundantPoints=False):
"""draw self using pen"""
from fontTools.pens.pointPen import PointToSegmentPen
pointPen = PointToSegmentPen(pen)
self.drawPoints(pointPen, filterRedundantPoints=filterRedundantPoints) | draw self using pen | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathGlyph.py#L288-L292 |
robotools/fontMath | Lib/fontMath/mathGlyph.py | MathGlyph.extractGlyph | def extractGlyph(self, glyph, pointPen=None, onlyGeometry=False):
"""
"rehydrate" to a glyph. this requires
a glyph as an argument. if a point pen other
than the type of pen returned by glyph.getPointPen()
is required for drawing, send this the needed point pen.
"""
... | python | def extractGlyph(self, glyph, pointPen=None, onlyGeometry=False):
"""
"rehydrate" to a glyph. this requires
a glyph as an argument. if a point pen other
than the type of pen returned by glyph.getPointPen()
is required for drawing, send this the needed point pen.
"""
... | "rehydrate" to a glyph. this requires
a glyph as an argument. if a point pen other
than the type of pen returned by glyph.getPointPen()
is required for drawing, send this the needed point pen. | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathGlyph.py#L298-L324 |
robotools/fontMath | Lib/fontMath/mathGlyph.py | MathGlyphPen._flushContour | def _flushContour(self):
"""
This normalizes the contour so that:
- there are no line segments. in their place will be
curve segments with the off curves positioned on top
of the previous on curve and the new curve on curve.
- the contour starts with an on curve
... | python | def _flushContour(self):
"""
This normalizes the contour so that:
- there are no line segments. in their place will be
curve segments with the off curves positioned on top
of the previous on curve and the new curve on curve.
- the contour starts with an on curve
... | This normalizes the contour so that:
- there are no line segments. in their place will be
curve segments with the off curves positioned on top
of the previous on curve and the new curve on curve.
- the contour starts with an on curve | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathGlyph.py#L347-L389 |
robotools/fontMath | Lib/fontMath/mathTransform.py | matrixToMathTransform | def matrixToMathTransform(matrix):
""" Take a 6-tuple and return a ShallowTransform object."""
if isinstance(matrix, ShallowTransform):
return matrix
off, scl, rot = MathTransform(matrix).decompose()
return ShallowTransform(off, scl, rot) | python | def matrixToMathTransform(matrix):
""" Take a 6-tuple and return a ShallowTransform object."""
if isinstance(matrix, ShallowTransform):
return matrix
off, scl, rot = MathTransform(matrix).decompose()
return ShallowTransform(off, scl, rot) | Take a 6-tuple and return a ShallowTransform object. | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathTransform.py#L30-L35 |
robotools/fontMath | Lib/fontMath/mathTransform.py | mathTransformToMatrix | def mathTransformToMatrix(mathTransform):
""" Take a ShallowTransform object and return a 6-tuple. """
m = MathTransform().compose(mathTransform.offset, mathTransform.scale, mathTransform.rotation)
return tuple(m) | python | def mathTransformToMatrix(mathTransform):
""" Take a ShallowTransform object and return a 6-tuple. """
m = MathTransform().compose(mathTransform.offset, mathTransform.scale, mathTransform.rotation)
return tuple(m) | Take a ShallowTransform object and return a 6-tuple. | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathTransform.py#L37-L40 |
robotools/fontMath | Lib/fontMath/mathTransform.py | _linearInterpolationTransformMatrix | def _linearInterpolationTransformMatrix(matrix1, matrix2, value):
""" Linear, 'oldstyle' interpolation of the transform matrix."""
return tuple(_interpolateValue(matrix1[i], matrix2[i], value) for i in range(len(matrix1))) | python | def _linearInterpolationTransformMatrix(matrix1, matrix2, value):
""" Linear, 'oldstyle' interpolation of the transform matrix."""
return tuple(_interpolateValue(matrix1[i], matrix2[i], value) for i in range(len(matrix1))) | Linear, 'oldstyle' interpolation of the transform matrix. | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathTransform.py#L338-L340 |
robotools/fontMath | Lib/fontMath/mathTransform.py | _polarDecomposeInterpolationTransformation | def _polarDecomposeInterpolationTransformation(matrix1, matrix2, value):
""" Interpolate using the MathTransform method. """
m1 = MathTransform(matrix1)
m2 = MathTransform(matrix2)
return tuple(m1.interpolate(m2, value)) | python | def _polarDecomposeInterpolationTransformation(matrix1, matrix2, value):
""" Interpolate using the MathTransform method. """
m1 = MathTransform(matrix1)
m2 = MathTransform(matrix2)
return tuple(m1.interpolate(m2, value)) | Interpolate using the MathTransform method. | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathTransform.py#L342-L346 |
robotools/fontMath | Lib/fontMath/mathTransform.py | _mathPolarDecomposeInterpolationTransformation | def _mathPolarDecomposeInterpolationTransformation(matrix1, matrix2, value):
""" Interpolation with ShallowTransfor, wrapped by decompose / compose actions."""
off, scl, rot = MathTransform(matrix1).decompose()
m1 = ShallowTransform(off, scl, rot)
off, scl, rot = MathTransform(matrix2).decompose()
m... | python | def _mathPolarDecomposeInterpolationTransformation(matrix1, matrix2, value):
""" Interpolation with ShallowTransfor, wrapped by decompose / compose actions."""
off, scl, rot = MathTransform(matrix1).decompose()
m1 = ShallowTransform(off, scl, rot)
off, scl, rot = MathTransform(matrix2).decompose()
m... | Interpolation with ShallowTransfor, wrapped by decompose / compose actions. | https://github.com/robotools/fontMath/blob/6abcb9d5a1ca19788fbde4418d7b5630c60990d8/Lib/fontMath/mathTransform.py#L348-L356 |
noxdafox/clipspy | clips/facts.py | Facts.facts | def facts(self):
"""Iterate over the asserted Facts."""
fact = lib.EnvGetNextFact(self._env, ffi.NULL)
while fact != ffi.NULL:
yield new_fact(self._env, fact)
fact = lib.EnvGetNextFact(self._env, fact) | python | def facts(self):
"""Iterate over the asserted Facts."""
fact = lib.EnvGetNextFact(self._env, ffi.NULL)
while fact != ffi.NULL:
yield new_fact(self._env, fact)
fact = lib.EnvGetNextFact(self._env, fact) | Iterate over the asserted Facts. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L67-L74 |
noxdafox/clipspy | clips/facts.py | Facts.templates | def templates(self):
"""Iterate over the defined Templates."""
template = lib.EnvGetNextDeftemplate(self._env, ffi.NULL)
while template != ffi.NULL:
yield Template(self._env, template)
template = lib.EnvGetNextDeftemplate(self._env, template) | python | def templates(self):
"""Iterate over the defined Templates."""
template = lib.EnvGetNextDeftemplate(self._env, ffi.NULL)
while template != ffi.NULL:
yield Template(self._env, template)
template = lib.EnvGetNextDeftemplate(self._env, template) | Iterate over the defined Templates. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L76-L83 |
noxdafox/clipspy | clips/facts.py | Facts.find_template | def find_template(self, name):
"""Find the Template by its name."""
deftemplate = lib.EnvFindDeftemplate(self._env, name.encode())
if deftemplate == ffi.NULL:
raise LookupError("Template '%s' not found" % name)
return Template(self._env, deftemplate) | python | def find_template(self, name):
"""Find the Template by its name."""
deftemplate = lib.EnvFindDeftemplate(self._env, name.encode())
if deftemplate == ffi.NULL:
raise LookupError("Template '%s' not found" % name)
return Template(self._env, deftemplate) | Find the Template by its name. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L85-L91 |
noxdafox/clipspy | clips/facts.py | Facts.assert_string | def assert_string(self, string):
"""Assert a fact as string."""
fact = lib.EnvAssertString(self._env, string.encode())
if fact == ffi.NULL:
raise CLIPSError(self._env)
return new_fact(self._env, fact) | python | def assert_string(self, string):
"""Assert a fact as string."""
fact = lib.EnvAssertString(self._env, string.encode())
if fact == ffi.NULL:
raise CLIPSError(self._env)
return new_fact(self._env, fact) | Assert a fact as string. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L93-L100 |
noxdafox/clipspy | clips/facts.py | Facts.load_facts | def load_facts(self, facts):
"""Load a set of facts into the CLIPS data base.
The C equivalent of the CLIPS load-facts command.
Facts can be loaded from a string or from a text file.
"""
facts = facts.encode()
if os.path.exists(facts):
ret = lib.EnvLoadFac... | python | def load_facts(self, facts):
"""Load a set of facts into the CLIPS data base.
The C equivalent of the CLIPS load-facts command.
Facts can be loaded from a string or from a text file.
"""
facts = facts.encode()
if os.path.exists(facts):
ret = lib.EnvLoadFac... | Load a set of facts into the CLIPS data base.
The C equivalent of the CLIPS load-facts command.
Facts can be loaded from a string or from a text file. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L102-L121 |
noxdafox/clipspy | clips/facts.py | Facts.save_facts | def save_facts(self, path, mode=SaveMode.LOCAL_SAVE):
"""Save the facts in the system to the specified file.
The Python equivalent of the CLIPS save-facts command.
"""
ret = lib.EnvSaveFacts(self._env, path.encode(), mode)
if ret == -1:
raise CLIPSError(self._env)
... | python | def save_facts(self, path, mode=SaveMode.LOCAL_SAVE):
"""Save the facts in the system to the specified file.
The Python equivalent of the CLIPS save-facts command.
"""
ret = lib.EnvSaveFacts(self._env, path.encode(), mode)
if ret == -1:
raise CLIPSError(self._env)
... | Save the facts in the system to the specified file.
The Python equivalent of the CLIPS save-facts command. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L123-L133 |
noxdafox/clipspy | clips/facts.py | Fact.asserted | def asserted(self):
"""True if the fact has been asserted within CLIPS."""
# https://sourceforge.net/p/clipsrules/discussion/776945/thread/4f04bb9e/
if self.index == 0:
return False
return bool(lib.EnvFactExistp(self._env, self._fact)) | python | def asserted(self):
"""True if the fact has been asserted within CLIPS."""
# https://sourceforge.net/p/clipsrules/discussion/776945/thread/4f04bb9e/
if self.index == 0:
return False
return bool(lib.EnvFactExistp(self._env, self._fact)) | True if the fact has been asserted within CLIPS. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L173-L179 |
noxdafox/clipspy | clips/facts.py | Fact.template | def template(self):
"""The associated Template."""
return Template(
self._env, lib.EnvFactDeftemplate(self._env, self._fact)) | python | def template(self):
"""The associated Template."""
return Template(
self._env, lib.EnvFactDeftemplate(self._env, self._fact)) | The associated Template. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L182-L185 |
noxdafox/clipspy | clips/facts.py | Fact.assertit | def assertit(self):
"""Assert the fact within the CLIPS environment."""
if self.asserted:
raise RuntimeError("Fact already asserted")
lib.EnvAssignFactSlotDefaults(self._env, self._fact)
if lib.EnvAssert(self._env, self._fact) == ffi.NULL:
raise CLIPSError(self.... | python | def assertit(self):
"""Assert the fact within the CLIPS environment."""
if self.asserted:
raise RuntimeError("Fact already asserted")
lib.EnvAssignFactSlotDefaults(self._env, self._fact)
if lib.EnvAssert(self._env, self._fact) == ffi.NULL:
raise CLIPSError(self.... | Assert the fact within the CLIPS environment. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L187-L195 |
noxdafox/clipspy | clips/facts.py | Fact.retract | def retract(self):
"""Retract the fact from the CLIPS environment."""
if lib.EnvRetract(self._env, self._fact) != 1:
raise CLIPSError(self._env) | python | def retract(self):
"""Retract the fact from the CLIPS environment."""
if lib.EnvRetract(self._env, self._fact) != 1:
raise CLIPSError(self._env) | Retract the fact from the CLIPS environment. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L197-L200 |
noxdafox/clipspy | clips/facts.py | ImpliedFact.append | def append(self, value):
"""Append an element to the fact."""
if self.asserted:
raise RuntimeError("Fact already asserted")
self._multifield.append(value) | python | def append(self, value):
"""Append an element to the fact."""
if self.asserted:
raise RuntimeError("Fact already asserted")
self._multifield.append(value) | Append an element to the fact. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L224-L229 |
noxdafox/clipspy | clips/facts.py | ImpliedFact.extend | def extend(self, values):
"""Append multiple elements to the fact."""
if self.asserted:
raise RuntimeError("Fact already asserted")
self._multifield.extend(values) | python | def extend(self, values):
"""Append multiple elements to the fact."""
if self.asserted:
raise RuntimeError("Fact already asserted")
self._multifield.extend(values) | Append multiple elements to the fact. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L231-L236 |
noxdafox/clipspy | clips/facts.py | ImpliedFact.assertit | def assertit(self):
"""Assert the fact within CLIPS."""
data = clips.data.DataObject(self._env)
data.value = list(self._multifield)
if lib.EnvPutFactSlot(
self._env, self._fact, ffi.NULL, data.byref) != 1:
raise CLIPSError(self._env)
super(ImpliedFac... | python | def assertit(self):
"""Assert the fact within CLIPS."""
data = clips.data.DataObject(self._env)
data.value = list(self._multifield)
if lib.EnvPutFactSlot(
self._env, self._fact, ffi.NULL, data.byref) != 1:
raise CLIPSError(self._env)
super(ImpliedFac... | Assert the fact within CLIPS. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L238-L247 |
noxdafox/clipspy | clips/facts.py | TemplateFact.update | def update(self, sequence=None, **mapping):
"""Add multiple elements to the fact."""
if sequence is not None:
if isinstance(sequence, dict):
for slot in sequence:
self[slot] = sequence[slot]
else:
for slot, value in sequence:
... | python | def update(self, sequence=None, **mapping):
"""Add multiple elements to the fact."""
if sequence is not None:
if isinstance(sequence, dict):
for slot in sequence:
self[slot] = sequence[slot]
else:
for slot, value in sequence:
... | Add multiple elements to the fact. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L289-L300 |
noxdafox/clipspy | clips/facts.py | Template.name | def name(self):
"""Template name."""
return ffi.string(
lib.EnvGetDeftemplateName(self._env, self._tpl)).decode() | python | def name(self):
"""Template name."""
return ffi.string(
lib.EnvGetDeftemplateName(self._env, self._tpl)).decode() | Template name. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L337-L340 |
noxdafox/clipspy | clips/facts.py | Template.module | def module(self):
"""The module in which the Template is defined.
Python equivalent of the CLIPS deftemplate-module command.
"""
modname = ffi.string(lib.EnvDeftemplateModule(self._env, self._tpl))
defmodule = lib.EnvFindDefmodule(self._env, modname)
return Module(self... | python | def module(self):
"""The module in which the Template is defined.
Python equivalent of the CLIPS deftemplate-module command.
"""
modname = ffi.string(lib.EnvDeftemplateModule(self._env, self._tpl))
defmodule = lib.EnvFindDefmodule(self._env, modname)
return Module(self... | The module in which the Template is defined.
Python equivalent of the CLIPS deftemplate-module command. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L343-L352 |
noxdafox/clipspy | clips/facts.py | Template.watch | def watch(self, flag):
"""Whether or not the Template is being watched."""
lib.EnvSetDeftemplateWatch(self._env, int(flag), self._tpl) | python | def watch(self, flag):
"""Whether or not the Template is being watched."""
lib.EnvSetDeftemplateWatch(self._env, int(flag), self._tpl) | Whether or not the Template is being watched. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L365-L367 |
noxdafox/clipspy | clips/facts.py | Template.slots | def slots(self):
"""Iterate over the Slots of the Template."""
if self.implied:
return ()
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotNames(self._env, self._tpl, data.byref)
return tuple(
TemplateSlot(self._env, self._tpl, n.encode()) ... | python | def slots(self):
"""Iterate over the Slots of the Template."""
if self.implied:
return ()
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotNames(self._env, self._tpl, data.byref)
return tuple(
TemplateSlot(self._env, self._tpl, n.encode()) ... | Iterate over the Slots of the Template. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L374-L384 |
noxdafox/clipspy | clips/facts.py | Template.new_fact | def new_fact(self):
"""Create a new Fact from this template."""
fact = lib.EnvCreateFact(self._env, self._tpl)
if fact == ffi.NULL:
raise CLIPSError(self._env)
return new_fact(self._env, fact) | python | def new_fact(self):
"""Create a new Fact from this template."""
fact = lib.EnvCreateFact(self._env, self._tpl)
if fact == ffi.NULL:
raise CLIPSError(self._env)
return new_fact(self._env, fact) | Create a new Fact from this template. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L386-L392 |
noxdafox/clipspy | clips/facts.py | Template.undefine | def undefine(self):
"""Undefine the Template.
Python equivalent of the CLIPS undeftemplate command.
The object becomes unusable after this method has been called.
"""
if lib.EnvUndeftemplate(self._env, self._tpl) != 1:
raise CLIPSError(self._env) | python | def undefine(self):
"""Undefine the Template.
Python equivalent of the CLIPS undeftemplate command.
The object becomes unusable after this method has been called.
"""
if lib.EnvUndeftemplate(self._env, self._tpl) != 1:
raise CLIPSError(self._env) | Undefine the Template.
Python equivalent of the CLIPS undeftemplate command.
The object becomes unusable after this method has been called. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L394-L403 |
noxdafox/clipspy | clips/facts.py | TemplateSlot.multifield | def multifield(self):
"""True if the slot is a multifield slot."""
return bool(lib.EnvDeftemplateSlotMultiP(
self._env, self._tpl, self._name)) | python | def multifield(self):
"""True if the slot is a multifield slot."""
return bool(lib.EnvDeftemplateSlotMultiP(
self._env, self._tpl, self._name)) | True if the slot is a multifield slot. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L438-L441 |
noxdafox/clipspy | clips/facts.py | TemplateSlot.types | def types(self):
"""A tuple containing the value types for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-types function.
"""
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotTypes(
self._env, self._tpl, self._name, data.byref)
... | python | def types(self):
"""A tuple containing the value types for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-types function.
"""
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotTypes(
self._env, self._tpl, self._name, data.byref)
... | A tuple containing the value types for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-types function. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L444-L455 |
noxdafox/clipspy | clips/facts.py | TemplateSlot.range | def range(self):
"""A tuple containing the numeric range for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-range function.
"""
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotRange(
self._env, self._tpl, self._name, data.byref)
... | python | def range(self):
"""A tuple containing the numeric range for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-range function.
"""
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotRange(
self._env, self._tpl, self._name, data.byref)
... | A tuple containing the numeric range for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-range function. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L458-L469 |
noxdafox/clipspy | clips/facts.py | TemplateSlot.cardinality | def cardinality(self):
"""A tuple containing the cardinality for this Slot.
The Python equivalent
of the CLIPS deftemplate-slot-cardinality function.
"""
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotCardinality(
self._env, self._tpl, self._... | python | def cardinality(self):
"""A tuple containing the cardinality for this Slot.
The Python equivalent
of the CLIPS deftemplate-slot-cardinality function.
"""
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotCardinality(
self._env, self._tpl, self._... | A tuple containing the cardinality for this Slot.
The Python equivalent
of the CLIPS deftemplate-slot-cardinality function. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L472-L484 |
noxdafox/clipspy | clips/facts.py | TemplateSlot.default_type | def default_type(self):
"""The default value type for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-defaultp function.
"""
return TemplateSlotDefaultType(
lib.EnvDeftemplateSlotDefaultP(self._env, self._tpl, self._name)) | python | def default_type(self):
"""The default value type for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-defaultp function.
"""
return TemplateSlotDefaultType(
lib.EnvDeftemplateSlotDefaultP(self._env, self._tpl, self._name)) | The default value type for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-defaultp function. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L487-L494 |
noxdafox/clipspy | clips/facts.py | TemplateSlot.default_value | def default_value(self):
"""The default value for this Slot.
The Python equivalent
of the CLIPS deftemplate-slot-default-value function.
"""
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotDefaultValue(
self._env, self._tpl, self._name, data.b... | python | def default_value(self):
"""The default value for this Slot.
The Python equivalent
of the CLIPS deftemplate-slot-default-value function.
"""
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotDefaultValue(
self._env, self._tpl, self._name, data.b... | The default value for this Slot.
The Python equivalent
of the CLIPS deftemplate-slot-default-value function. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L497-L509 |
noxdafox/clipspy | clips/facts.py | TemplateSlot.allowed_values | def allowed_values(self):
"""A tuple containing the allowed values for this Slot.
The Python equivalent of the CLIPS slot-allowed-values function.
"""
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotAllowedValues(
self._env, self._tpl, self._name, dat... | python | def allowed_values(self):
"""A tuple containing the allowed values for this Slot.
The Python equivalent of the CLIPS slot-allowed-values function.
"""
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotAllowedValues(
self._env, self._tpl, self._name, dat... | A tuple containing the allowed values for this Slot.
The Python equivalent of the CLIPS slot-allowed-values function. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/facts.py#L512-L523 |
noxdafox/clipspy | clips/classes.py | Classes.instances_changed | def instances_changed(self):
"""True if any instance has changed."""
value = bool(lib.EnvGetInstancesChanged(self._env))
lib.EnvSetInstancesChanged(self._env, int(False))
return value | python | def instances_changed(self):
"""True if any instance has changed."""
value = bool(lib.EnvGetInstancesChanged(self._env))
lib.EnvSetInstancesChanged(self._env, int(False))
return value | True if any instance has changed. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L84-L89 |
noxdafox/clipspy | clips/classes.py | Classes.classes | def classes(self):
"""Iterate over the defined Classes."""
defclass = lib.EnvGetNextDefclass(self._env, ffi.NULL)
while defclass != ffi.NULL:
yield Class(self._env, defclass)
defclass = lib.EnvGetNextDefclass(self._env, defclass) | python | def classes(self):
"""Iterate over the defined Classes."""
defclass = lib.EnvGetNextDefclass(self._env, ffi.NULL)
while defclass != ffi.NULL:
yield Class(self._env, defclass)
defclass = lib.EnvGetNextDefclass(self._env, defclass) | Iterate over the defined Classes. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L91-L98 |
noxdafox/clipspy | clips/classes.py | Classes.find_class | def find_class(self, name):
"""Find the Class by its name."""
defclass = lib.EnvFindDefclass(self._env, name.encode())
if defclass == ffi.NULL:
raise LookupError("Class '%s' not found" % name)
return Class(self._env, defclass) | python | def find_class(self, name):
"""Find the Class by its name."""
defclass = lib.EnvFindDefclass(self._env, name.encode())
if defclass == ffi.NULL:
raise LookupError("Class '%s' not found" % name)
return Class(self._env, defclass) | Find the Class by its name. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L100-L106 |
noxdafox/clipspy | clips/classes.py | Classes.instances | def instances(self):
"""Iterate over the defined Instancees."""
definstance = lib.EnvGetNextInstance(self._env, ffi.NULL)
while definstance != ffi.NULL:
yield Instance(self._env, definstance)
definstance = lib.EnvGetNextInstance(self._env, definstance) | python | def instances(self):
"""Iterate over the defined Instancees."""
definstance = lib.EnvGetNextInstance(self._env, ffi.NULL)
while definstance != ffi.NULL:
yield Instance(self._env, definstance)
definstance = lib.EnvGetNextInstance(self._env, definstance) | Iterate over the defined Instancees. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L108-L115 |
noxdafox/clipspy | clips/classes.py | Classes.find_instance | def find_instance(self, name, module=None):
"""Find the Instance by its name."""
module = module if module is not None else ffi.NULL
definstance = lib.EnvFindInstance(self._env, module, name.encode(), 1)
if definstance == ffi.NULL:
raise LookupError("Instance '%s' not found" ... | python | def find_instance(self, name, module=None):
"""Find the Instance by its name."""
module = module if module is not None else ffi.NULL
definstance = lib.EnvFindInstance(self._env, module, name.encode(), 1)
if definstance == ffi.NULL:
raise LookupError("Instance '%s' not found" ... | Find the Instance by its name. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L117-L124 |
noxdafox/clipspy | clips/classes.py | Classes.load_instances | def load_instances(self, instances):
"""Load a set of instances into the CLIPS data base.
The C equivalent of the CLIPS load-instances command.
Instances can be loaded from a string,
from a file or from a binary file.
"""
instances = instances.encode()
if os.p... | python | def load_instances(self, instances):
"""Load a set of instances into the CLIPS data base.
The C equivalent of the CLIPS load-instances command.
Instances can be loaded from a string,
from a file or from a binary file.
"""
instances = instances.encode()
if os.p... | Load a set of instances into the CLIPS data base.
The C equivalent of the CLIPS load-instances command.
Instances can be loaded from a string,
from a file or from a binary file. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L126-L143 |
noxdafox/clipspy | clips/classes.py | Classes.restore_instances | def restore_instances(self, instances):
"""Restore a set of instances into the CLIPS data base.
The Python equivalent of the CLIPS restore-instances command.
Instances can be passed as a set of strings or as a file.
"""
instances = instances.encode()
if os.path.exists... | python | def restore_instances(self, instances):
"""Restore a set of instances into the CLIPS data base.
The Python equivalent of the CLIPS restore-instances command.
Instances can be passed as a set of strings or as a file.
"""
instances = instances.encode()
if os.path.exists... | Restore a set of instances into the CLIPS data base.
The Python equivalent of the CLIPS restore-instances command.
Instances can be passed as a set of strings or as a file. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L166-L185 |
noxdafox/clipspy | clips/classes.py | Classes.save_instances | def save_instances(self, path, binary=False, mode=SaveMode.LOCAL_SAVE):
"""Save the instances in the system to the specified file.
If binary is True, the instances will be saved in binary format.
The Python equivalent of the CLIPS save-instances command.
"""
if binary:
... | python | def save_instances(self, path, binary=False, mode=SaveMode.LOCAL_SAVE):
"""Save the instances in the system to the specified file.
If binary is True, the instances will be saved in binary format.
The Python equivalent of the CLIPS save-instances command.
"""
if binary:
... | Save the instances in the system to the specified file.
If binary is True, the instances will be saved in binary format.
The Python equivalent of the CLIPS save-instances command. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L187-L202 |
noxdafox/clipspy | clips/classes.py | Classes.make_instance | def make_instance(self, command):
"""Create and initialize an instance of a user-defined class.
command must be a string in the form:
(<instance-name> of <class-name> <slot-override>*)
<slot-override> :== (<slot-name> <constant>*)
Python equivalent of the CLIPS make-instance c... | python | def make_instance(self, command):
"""Create and initialize an instance of a user-defined class.
command must be a string in the form:
(<instance-name> of <class-name> <slot-override>*)
<slot-override> :== (<slot-name> <constant>*)
Python equivalent of the CLIPS make-instance c... | Create and initialize an instance of a user-defined class.
command must be a string in the form:
(<instance-name> of <class-name> <slot-override>*)
<slot-override> :== (<slot-name> <constant>*)
Python equivalent of the CLIPS make-instance command. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L204-L219 |
noxdafox/clipspy | clips/classes.py | Class.name | def name(self):
"""Class name."""
return ffi.string(lib.EnvGetDefclassName(self._env, self._cls)).decode() | python | def name(self):
"""Class name."""
return ffi.string(lib.EnvGetDefclassName(self._env, self._cls)).decode() | Class name. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L267-L269 |
noxdafox/clipspy | clips/classes.py | Class.module | def module(self):
"""The module in which the Class is defined.
Python equivalent of the CLIPS defglobal-module command.
"""
modname = ffi.string(lib.EnvDefclassModule(self._env, self._cls))
defmodule = lib.EnvFindDefmodule(self._env, modname)
return Module(self._env, d... | python | def module(self):
"""The module in which the Class is defined.
Python equivalent of the CLIPS defglobal-module command.
"""
modname = ffi.string(lib.EnvDefclassModule(self._env, self._cls))
defmodule = lib.EnvFindDefmodule(self._env, modname)
return Module(self._env, d... | The module in which the Class is defined.
Python equivalent of the CLIPS defglobal-module command. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L272-L281 |
noxdafox/clipspy | clips/classes.py | Class.watch_instances | def watch_instances(self, flag):
"""Whether or not the Class Instances are being watched."""
lib.EnvSetDefclassWatchInstances(self._env, int(flag), self._cls) | python | def watch_instances(self, flag):
"""Whether or not the Class Instances are being watched."""
lib.EnvSetDefclassWatchInstances(self._env, int(flag), self._cls) | Whether or not the Class Instances are being watched. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L294-L296 |
noxdafox/clipspy | clips/classes.py | Class.watch_slots | def watch_slots(self, flag):
"""Whether or not the Class Slots are being watched."""
lib.EnvSetDefclassWatchSlots(self._env, int(flag), self._cls) | python | def watch_slots(self, flag):
"""Whether or not the Class Slots are being watched."""
lib.EnvSetDefclassWatchSlots(self._env, int(flag), self._cls) | Whether or not the Class Slots are being watched. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L304-L306 |
noxdafox/clipspy | clips/classes.py | Class.new_instance | def new_instance(self, name):
"""Create a new raw instance from this Class.
No slot overrides or class default initializations
are performed for the instance.
This function bypasses message-passing.
"""
ist = lib.EnvCreateRawInstance(self._env, self._cls, name.encode()... | python | def new_instance(self, name):
"""Create a new raw instance from this Class.
No slot overrides or class default initializations
are performed for the instance.
This function bypasses message-passing.
"""
ist = lib.EnvCreateRawInstance(self._env, self._cls, name.encode()... | Create a new raw instance from this Class.
No slot overrides or class default initializations
are performed for the instance.
This function bypasses message-passing. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L308-L321 |
noxdafox/clipspy | clips/classes.py | Class.find_message_handler | def find_message_handler(self, handler_name, handler_type='primary'):
"""Returns the MessageHandler given its name and type for this class."""
ret = lib.EnvFindDefmessageHandler(
self._env, self._cls, handler_name.encode(), handler_type.encode())
if ret == 0:
raise CLIPSE... | python | def find_message_handler(self, handler_name, handler_type='primary'):
"""Returns the MessageHandler given its name and type for this class."""
ret = lib.EnvFindDefmessageHandler(
self._env, self._cls, handler_name.encode(), handler_type.encode())
if ret == 0:
raise CLIPSE... | Returns the MessageHandler given its name and type for this class. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L323-L330 |
noxdafox/clipspy | clips/classes.py | Class.subclass | def subclass(self, klass):
"""True if the Class is a subclass of the given one."""
return bool(lib.EnvSubclassP(self._env, self._cls, klass._cls)) | python | def subclass(self, klass):
"""True if the Class is a subclass of the given one."""
return bool(lib.EnvSubclassP(self._env, self._cls, klass._cls)) | True if the Class is a subclass of the given one. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L332-L334 |
noxdafox/clipspy | clips/classes.py | Class.superclass | def superclass(self, klass):
"""True if the Class is a superclass of the given one."""
return bool(lib.EnvSuperclassP(self._env, self._cls, klass._cls)) | python | def superclass(self, klass):
"""True if the Class is a superclass of the given one."""
return bool(lib.EnvSuperclassP(self._env, self._cls, klass._cls)) | True if the Class is a superclass of the given one. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L336-L338 |
noxdafox/clipspy | clips/classes.py | Class.slots | def slots(self, inherited=False):
"""Iterate over the Slots of the class."""
data = clips.data.DataObject(self._env)
lib.EnvClassSlots(self._env, self._cls, data.byref, int(inherited))
return (ClassSlot(self._env, self._cls, n.encode()) for n in data.value) | python | def slots(self, inherited=False):
"""Iterate over the Slots of the class."""
data = clips.data.DataObject(self._env)
lib.EnvClassSlots(self._env, self._cls, data.byref, int(inherited))
return (ClassSlot(self._env, self._cls, n.encode()) for n in data.value) | Iterate over the Slots of the class. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L340-L346 |
noxdafox/clipspy | clips/classes.py | Class.instances | def instances(self):
"""Iterate over the instances of the class."""
ist = lib.EnvGetNextInstanceInClass(self._env, self._cls, ffi.NULL)
while ist != ffi.NULL:
yield Instance(self._env, ist)
ist = lib.EnvGetNextInstanceInClass(self._env, self._cls, ist) | python | def instances(self):
"""Iterate over the instances of the class."""
ist = lib.EnvGetNextInstanceInClass(self._env, self._cls, ffi.NULL)
while ist != ffi.NULL:
yield Instance(self._env, ist)
ist = lib.EnvGetNextInstanceInClass(self._env, self._cls, ist) | Iterate over the instances of the class. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L348-L355 |
noxdafox/clipspy | clips/classes.py | Class.subclasses | def subclasses(self, inherited=False):
"""Iterate over the subclasses of the class.
This function is the Python equivalent
of the CLIPS class-subclasses command.
"""
data = clips.data.DataObject(self._env)
lib.EnvClassSubclasses(self._env, self._cls, data.byref, int(in... | python | def subclasses(self, inherited=False):
"""Iterate over the subclasses of the class.
This function is the Python equivalent
of the CLIPS class-subclasses command.
"""
data = clips.data.DataObject(self._env)
lib.EnvClassSubclasses(self._env, self._cls, data.byref, int(in... | Iterate over the subclasses of the class.
This function is the Python equivalent
of the CLIPS class-subclasses command. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L357-L369 |
noxdafox/clipspy | clips/classes.py | Class.superclasses | def superclasses(self, inherited=False):
"""Iterate over the superclasses of the class.
This function is the Python equivalent
of the CLIPS class-superclasses command.
"""
data = clips.data.DataObject(self._env)
lib.EnvClassSuperclasses(
self._env, self._cl... | python | def superclasses(self, inherited=False):
"""Iterate over the superclasses of the class.
This function is the Python equivalent
of the CLIPS class-superclasses command.
"""
data = clips.data.DataObject(self._env)
lib.EnvClassSuperclasses(
self._env, self._cl... | Iterate over the superclasses of the class.
This function is the Python equivalent
of the CLIPS class-superclasses command. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L371-L384 |
noxdafox/clipspy | clips/classes.py | Class.message_handlers | def message_handlers(self):
"""Iterate over the message handlers of the class."""
index = lib.EnvGetNextDefmessageHandler(self._env, self._cls, 0)
while index != 0:
yield MessageHandler(self._env, self._cls, index)
index = lib.EnvGetNextDefmessageHandler(self._env, self... | python | def message_handlers(self):
"""Iterate over the message handlers of the class."""
index = lib.EnvGetNextDefmessageHandler(self._env, self._cls, 0)
while index != 0:
yield MessageHandler(self._env, self._cls, index)
index = lib.EnvGetNextDefmessageHandler(self._env, self... | Iterate over the message handlers of the class. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L386-L393 |
noxdafox/clipspy | clips/classes.py | Class.undefine | def undefine(self):
"""Undefine the Class.
Python equivalent of the CLIPS undefclass command.
The object becomes unusable after this method has been called.
"""
if lib.EnvUndefclass(self._env, self._cls) != 1:
raise CLIPSError(self._env)
self._env = None | python | def undefine(self):
"""Undefine the Class.
Python equivalent of the CLIPS undefclass command.
The object becomes unusable after this method has been called.
"""
if lib.EnvUndefclass(self._env, self._cls) != 1:
raise CLIPSError(self._env)
self._env = None | Undefine the Class.
Python equivalent of the CLIPS undefclass command.
The object becomes unusable after this method has been called. | https://github.com/noxdafox/clipspy/blob/b22d71a6da821c1715d8fa00d7d75cabc09ed364/clips/classes.py#L395-L406 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.