repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
xray7224/PyPump
pypump/models/note.py
Note.serialize
def serialize(self): """ Converts the post to something compatible with `json.dumps` """ data = super(Note, self).serialize() data.update({ "verb": "post", "object": { "objectType": self.object_type, "content": self.content, } ...
python
def serialize(self): """ Converts the post to something compatible with `json.dumps` """ data = super(Note, self).serialize() data.update({ "verb": "post", "object": { "objectType": self.object_type, "content": self.content, } ...
[ "def", "serialize", "(", "self", ")", ":", "data", "=", "super", "(", "Note", ",", "self", ")", ".", "serialize", "(", ")", "data", ".", "update", "(", "{", "\"verb\"", ":", "\"post\"", ",", "\"object\"", ":", "{", "\"objectType\"", ":", "self", ".",...
Converts the post to something compatible with `json.dumps`
[ "Converts", "the", "post", "to", "something", "compatible", "with", "json", ".", "dumps" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/note.py#L50-L63
train
59,800
xray7224/PyPump
pypump/client.py
Client.context
def context(self): """ Provides request context """ type = "client_associate" if self.key is None else "client_update" data = { "type": type, "application_type": self.type, } # is this an update? if self.key: data["client_id"] = self.k...
python
def context(self): """ Provides request context """ type = "client_associate" if self.key is None else "client_update" data = { "type": type, "application_type": self.type, } # is this an update? if self.key: data["client_id"] = self.k...
[ "def", "context", "(", "self", ")", ":", "type", "=", "\"client_associate\"", "if", "self", ".", "key", "is", "None", "else", "\"client_update\"", "data", "=", "{", "\"type\"", ":", "type", ",", "\"application_type\"", ":", "self", ".", "type", ",", "}", ...
Provides request context
[ "Provides", "request", "context" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/client.py#L95-L123
train
59,801
xray7224/PyPump
pypump/client.py
Client.request
def request(self, server=None): """ Sends the request """ request = { "headers": {"Content-Type": "application/json"}, "timeout": self._pump.timeout, "data": self.context, } url = "{proto}://{server}/{endpoint}".format( proto=self._pump.pr...
python
def request(self, server=None): """ Sends the request """ request = { "headers": {"Content-Type": "application/json"}, "timeout": self._pump.timeout, "data": self.context, } url = "{proto}://{server}/{endpoint}".format( proto=self._pump.pr...
[ "def", "request", "(", "self", ",", "server", "=", "None", ")", ":", "request", "=", "{", "\"headers\"", ":", "{", "\"Content-Type\"", ":", "\"application/json\"", "}", ",", "\"timeout\"", ":", "self", ".", "_pump", ".", "timeout", ",", "\"data\"", ":", ...
Sends the request
[ "Sends", "the", "request" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/client.py#L125-L155
train
59,802
xray7224/PyPump
pypump/client.py
Client.register
def register(self, server=None): """ Registers the client with the Pump API retrieving the id and secret """ if (self.key or self.secret): return self.update() server_data = self.request(server) self.key = server_data["client_id"] self.secret = server_data["client_s...
python
def register(self, server=None): """ Registers the client with the Pump API retrieving the id and secret """ if (self.key or self.secret): return self.update() server_data = self.request(server) self.key = server_data["client_id"] self.secret = server_data["client_s...
[ "def", "register", "(", "self", ",", "server", "=", "None", ")", ":", "if", "(", "self", ".", "key", "or", "self", ".", "secret", ")", ":", "return", "self", ".", "update", "(", ")", "server_data", "=", "self", ".", "request", "(", "server", ")", ...
Registers the client with the Pump API retrieving the id and secret
[ "Registers", "the", "client", "with", "the", "Pump", "API", "retrieving", "the", "id", "and", "secret" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/client.py#L157-L166
train
59,803
xray7224/PyPump
pypump/client.py
Client.update
def update(self): """ Updates the information the Pump server has about the client """ error = "" if self.key is None: error = "To update a client you need to provide a key" if self.secret is None: error = "To update a client you need to provide the secret" ...
python
def update(self): """ Updates the information the Pump server has about the client """ error = "" if self.key is None: error = "To update a client you need to provide a key" if self.secret is None: error = "To update a client you need to provide the secret" ...
[ "def", "update", "(", "self", ")", ":", "error", "=", "\"\"", "if", "self", ".", "key", "is", "None", ":", "error", "=", "\"To update a client you need to provide a key\"", "if", "self", ".", "secret", "is", "None", ":", "error", "=", "\"To update a client you...
Updates the information the Pump server has about the client
[ "Updates", "the", "information", "the", "Pump", "server", "has", "about", "the", "client" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/client.py#L168-L181
train
59,804
commx/python-rrdtool
setup.py
compile_extensions
def compile_extensions(macros, compat=False): """ Compiler subroutine to test whether some functions are available on the target system. Since the rrdtool headers shipped with most packages do not disclose any versioning information, we cannot test whether a given function is available that way. Ins...
python
def compile_extensions(macros, compat=False): """ Compiler subroutine to test whether some functions are available on the target system. Since the rrdtool headers shipped with most packages do not disclose any versioning information, we cannot test whether a given function is available that way. Ins...
[ "def", "compile_extensions", "(", "macros", ",", "compat", "=", "False", ")", ":", "import", "distutils", ".", "sysconfig", "import", "distutils", ".", "ccompiler", "import", "tempfile", "import", "shutil", "from", "textwrap", "import", "dedent", "# common vars", ...
Compiler subroutine to test whether some functions are available on the target system. Since the rrdtool headers shipped with most packages do not disclose any versioning information, we cannot test whether a given function is available that way. Instead, use this to manually try to compile code and see...
[ "Compiler", "subroutine", "to", "test", "whether", "some", "functions", "are", "available", "on", "the", "target", "system", ".", "Since", "the", "rrdtool", "headers", "shipped", "with", "most", "packages", "do", "not", "disclose", "any", "versioning", "informat...
74b7dee35c17a2558da475369699ef63408b7b6c
https://github.com/commx/python-rrdtool/blob/74b7dee35c17a2558da475369699ef63408b7b6c/setup.py#L42-L119
train
59,805
xray7224/PyPump
pypump/models/collection.py
Collection.add
def add(self, obj): """ Adds a member to the collection. :param obj: Object to add. Example: >>> mycollection.add(pump.Person('bob@example.org')) """ activity = { "verb": "add", "object": { "objectType": obj.object_type, ...
python
def add(self, obj): """ Adds a member to the collection. :param obj: Object to add. Example: >>> mycollection.add(pump.Person('bob@example.org')) """ activity = { "verb": "add", "object": { "objectType": obj.object_type, ...
[ "def", "add", "(", "self", ",", "obj", ")", ":", "activity", "=", "{", "\"verb\"", ":", "\"add\"", ",", "\"object\"", ":", "{", "\"objectType\"", ":", "obj", ".", "object_type", ",", "\"id\"", ":", "obj", ".", "id", "}", ",", "\"target\"", ":", "{", ...
Adds a member to the collection. :param obj: Object to add. Example: >>> mycollection.add(pump.Person('bob@example.org'))
[ "Adds", "a", "member", "to", "the", "collection", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/collection.py#L58-L81
train
59,806
xray7224/PyPump
pypump/models/collection.py
Collection.remove
def remove(self, obj): """ Removes a member from the collection. :param obj: Object to remove. Example: >>> mycollection.remove(pump.Person('bob@example.org')) """ activity = { "verb": "remove", "object": { "objectType": obj.o...
python
def remove(self, obj): """ Removes a member from the collection. :param obj: Object to remove. Example: >>> mycollection.remove(pump.Person('bob@example.org')) """ activity = { "verb": "remove", "object": { "objectType": obj.o...
[ "def", "remove", "(", "self", ",", "obj", ")", ":", "activity", "=", "{", "\"verb\"", ":", "\"remove\"", ",", "\"object\"", ":", "{", "\"objectType\"", ":", "obj", ".", "object_type", ",", "\"id\"", ":", "obj", ".", "id", "}", ",", "\"target\"", ":", ...
Removes a member from the collection. :param obj: Object to remove. Example: >>> mycollection.remove(pump.Person('bob@example.org'))
[ "Removes", "a", "member", "from", "the", "collection", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/collection.py#L83-L106
train
59,807
xray7224/PyPump
pypump/models/__init__.py
PumpObject._post_activity
def _post_activity(self, activity, unserialize=True): """ Posts a activity to feed """ # I think we always want to post to feed feed_url = "{proto}://{server}/api/user/{username}/feed".format( proto=self._pump.protocol, server=self._pump.client.server, usernam...
python
def _post_activity(self, activity, unserialize=True): """ Posts a activity to feed """ # I think we always want to post to feed feed_url = "{proto}://{server}/api/user/{username}/feed".format( proto=self._pump.protocol, server=self._pump.client.server, usernam...
[ "def", "_post_activity", "(", "self", ",", "activity", ",", "unserialize", "=", "True", ")", ":", "# I think we always want to post to feed", "feed_url", "=", "\"{proto}://{server}/api/user/{username}/feed\"", ".", "format", "(", "proto", "=", "self", ".", "_pump", "....
Posts a activity to feed
[ "Posts", "a", "activity", "to", "feed" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/__init__.py#L100-L132
train
59,808
xray7224/PyPump
pypump/models/__init__.py
PumpObject._add_links
def _add_links(self, links, key="href", proxy_key="proxyURL", endpoints=None): """ Parses and adds block of links """ if endpoints is None: endpoints = ["likes", "replies", "shares", "self", "followers", "following", "lists", "favorites", "members"] if links...
python
def _add_links(self, links, key="href", proxy_key="proxyURL", endpoints=None): """ Parses and adds block of links """ if endpoints is None: endpoints = ["likes", "replies", "shares", "self", "followers", "following", "lists", "favorites", "members"] if links...
[ "def", "_add_links", "(", "self", ",", "links", ",", "key", "=", "\"href\"", ",", "proxy_key", "=", "\"proxyURL\"", ",", "endpoints", "=", "None", ")", ":", "if", "endpoints", "is", "None", ":", "endpoints", "=", "[", "\"likes\"", ",", "\"replies\"", ","...
Parses and adds block of links
[ "Parses", "and", "adds", "block", "of", "links" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/__init__.py#L156-L184
train
59,809
xray7224/PyPump
pypump/models/__init__.py
Addressable._set_people
def _set_people(self, people): """ Sets who the object is sent to """ if hasattr(people, "object_type"): people = [people] elif hasattr(people, "__iter__"): people = list(people) return people
python
def _set_people(self, people): """ Sets who the object is sent to """ if hasattr(people, "object_type"): people = [people] elif hasattr(people, "__iter__"): people = list(people) return people
[ "def", "_set_people", "(", "self", ",", "people", ")", ":", "if", "hasattr", "(", "people", ",", "\"object_type\"", ")", ":", "people", "=", "[", "people", "]", "elif", "hasattr", "(", "people", ",", "\"__iter__\"", ")", ":", "people", "=", "list", "("...
Sets who the object is sent to
[ "Sets", "who", "the", "object", "is", "sent", "to" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/__init__.py#L493-L500
train
59,810
xray7224/PyPump
pypump/models/__init__.py
Uploadable.from_file
def from_file(self, filename): """ Uploads a file from a filename on your system. :param filename: Path to file on your system. Example: >>> myimage.from_file('/path/to/dinner.png') """ mimetype = mimetypes.guess_type(filename)[0] or "application/octal-stream" ...
python
def from_file(self, filename): """ Uploads a file from a filename on your system. :param filename: Path to file on your system. Example: >>> myimage.from_file('/path/to/dinner.png') """ mimetype = mimetypes.guess_type(filename)[0] or "application/octal-stream" ...
[ "def", "from_file", "(", "self", ",", "filename", ")", ":", "mimetype", "=", "mimetypes", ".", "guess_type", "(", "filename", ")", "[", "0", "]", "or", "\"application/octal-stream\"", "headers", "=", "{", "\"Content-Type\"", ":", "mimetype", ",", "\"Content-Le...
Uploads a file from a filename on your system. :param filename: Path to file on your system. Example: >>> myimage.from_file('/path/to/dinner.png')
[ "Uploads", "a", "file", "from", "a", "filename", "on", "your", "system", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/__init__.py#L604-L652
train
59,811
xray7224/PyPump
pypump/models/activity.py
Activity.unserialize
def unserialize(self, data): """ From JSON -> Activity object """ # copy activity attributes into object if "author" not in data["object"]: data["object"]["author"] = data["actor"] for key in ["to", "cc", "bto", "bcc"]: if key not in data["object"] and key in dat...
python
def unserialize(self, data): """ From JSON -> Activity object """ # copy activity attributes into object if "author" not in data["object"]: data["object"]["author"] = data["actor"] for key in ["to", "cc", "bto", "bcc"]: if key not in data["object"] and key in dat...
[ "def", "unserialize", "(", "self", ",", "data", ")", ":", "# copy activity attributes into object", "if", "\"author\"", "not", "in", "data", "[", "\"object\"", "]", ":", "data", "[", "\"object\"", "]", "[", "\"author\"", "]", "=", "data", "[", "\"actor\"", "...
From JSON -> Activity object
[ "From", "JSON", "-", ">", "Activity", "object" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/models/activity.py#L59-L72
train
59,812
xray7224/PyPump
pypump/pypump.py
PyPump.create_store
def create_store(self): """ Creates store object """ if self.store_class is not None: return self.store_class.load(self.client.webfinger, self) raise NotImplementedError("You need to specify PyPump.store_class or override PyPump.create_store method.")
python
def create_store(self): """ Creates store object """ if self.store_class is not None: return self.store_class.load(self.client.webfinger, self) raise NotImplementedError("You need to specify PyPump.store_class or override PyPump.create_store method.")
[ "def", "create_store", "(", "self", ")", ":", "if", "self", ".", "store_class", "is", "not", "None", ":", "return", "self", ".", "store_class", ".", "load", "(", "self", ".", "client", ".", "webfinger", ",", "self", ")", "raise", "NotImplementedError", "...
Creates store object
[ "Creates", "store", "object" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L151-L156
train
59,813
xray7224/PyPump
pypump/pypump.py
PyPump._build_url
def _build_url(self, endpoint): """ Returns a fully qualified URL """ server = None if "://" in endpoint: # looks like an url, let's break it down server, endpoint = self._deconstruct_url(endpoint) endpoint = endpoint.lstrip("/") url = "{proto}://{server}...
python
def _build_url(self, endpoint): """ Returns a fully qualified URL """ server = None if "://" in endpoint: # looks like an url, let's break it down server, endpoint = self._deconstruct_url(endpoint) endpoint = endpoint.lstrip("/") url = "{proto}://{server}...
[ "def", "_build_url", "(", "self", ",", "endpoint", ")", ":", "server", "=", "None", "if", "\"://\"", "in", "endpoint", ":", "# looks like an url, let's break it down", "server", ",", "endpoint", "=", "self", ".", "_deconstruct_url", "(", "endpoint", ")", "endpoi...
Returns a fully qualified URL
[ "Returns", "a", "fully", "qualified", "URL" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L175-L188
train
59,814
xray7224/PyPump
pypump/pypump.py
PyPump._deconstruct_url
def _deconstruct_url(self, url): """ Breaks down URL and returns server and endpoint """ url = url.split("://", 1)[-1] server, endpoint = url.split("/", 1) return (server, endpoint)
python
def _deconstruct_url(self, url): """ Breaks down URL and returns server and endpoint """ url = url.split("://", 1)[-1] server, endpoint = url.split("/", 1) return (server, endpoint)
[ "def", "_deconstruct_url", "(", "self", ",", "url", ")", ":", "url", "=", "url", ".", "split", "(", "\"://\"", ",", "1", ")", "[", "-", "1", "]", "server", ",", "endpoint", "=", "url", ".", "split", "(", "\"/\"", ",", "1", ")", "return", "(", "...
Breaks down URL and returns server and endpoint
[ "Breaks", "down", "URL", "and", "returns", "server", "and", "endpoint" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L190-L194
train
59,815
xray7224/PyPump
pypump/pypump.py
PyPump._add_client
def _add_client(self, url, key=None, secret=None): """ Creates Client object with key and secret for server and adds it to _server_cache if it doesnt already exist """ if "://" in url: server, endpoint = self._deconstruct_url(url) else: server = url if s...
python
def _add_client(self, url, key=None, secret=None): """ Creates Client object with key and secret for server and adds it to _server_cache if it doesnt already exist """ if "://" in url: server, endpoint = self._deconstruct_url(url) else: server = url if s...
[ "def", "_add_client", "(", "self", ",", "url", ",", "key", "=", "None", ",", "secret", "=", "None", ")", ":", "if", "\"://\"", "in", "url", ":", "server", ",", "endpoint", "=", "self", ".", "_deconstruct_url", "(", "url", ")", "else", ":", "server", ...
Creates Client object with key and secret for server and adds it to _server_cache if it doesnt already exist
[ "Creates", "Client", "object", "with", "key", "and", "secret", "for", "server", "and", "adds", "it", "to", "_server_cache", "if", "it", "doesnt", "already", "exist" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L196-L224
train
59,816
xray7224/PyPump
pypump/pypump.py
PyPump.request
def request(self, endpoint, method="GET", data="", raw=False, params=None, retries=None, client=None, headers=None, timeout=None, **kwargs): """ Make request to endpoint with OAuth. Returns dictionary with response data. :param endpoint: endpoint path, or a fully...
python
def request(self, endpoint, method="GET", data="", raw=False, params=None, retries=None, client=None, headers=None, timeout=None, **kwargs): """ Make request to endpoint with OAuth. Returns dictionary with response data. :param endpoint: endpoint path, or a fully...
[ "def", "request", "(", "self", ",", "endpoint", ",", "method", "=", "\"GET\"", ",", "data", "=", "\"\"", ",", "raw", "=", "False", ",", "params", "=", "None", ",", "retries", "=", "None", ",", "client", "=", "None", ",", "headers", "=", "None", ","...
Make request to endpoint with OAuth. Returns dictionary with response data. :param endpoint: endpoint path, or a fully qualified URL if raw=True. :param method: GET (default), POST or DELETE. :param data: data to send in the request body. :param raw: use endpoint as entered with...
[ "Make", "request", "to", "endpoint", "with", "OAuth", ".", "Returns", "dictionary", "with", "response", "data", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L226-L343
train
59,817
xray7224/PyPump
pypump/pypump.py
PyPump.oauth_request
def oauth_request(self): """ Makes a oauth connection """ # get tokens from server and make a dict of them. self._server_tokens = self.request_token() self.store["oauth-request-token"] = self._server_tokens["token"] self.store["oauth-request-secret"] = self._server_tokens["token...
python
def oauth_request(self): """ Makes a oauth connection """ # get tokens from server and make a dict of them. self._server_tokens = self.request_token() self.store["oauth-request-token"] = self._server_tokens["token"] self.store["oauth-request-secret"] = self._server_tokens["token...
[ "def", "oauth_request", "(", "self", ")", ":", "# get tokens from server and make a dict of them.", "self", ".", "_server_tokens", "=", "self", ".", "request_token", "(", ")", "self", ".", "store", "[", "\"oauth-request-token\"", "]", "=", "self", ".", "_server_toke...
Makes a oauth connection
[ "Makes", "a", "oauth", "connection" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L377-L388
train
59,818
xray7224/PyPump
pypump/pypump.py
PyPump.construct_oauth_url
def construct_oauth_url(self): """ Constructs verifier OAuth URL """ response = self._requester(requests.head, "{0}://{1}/".format(self.protocol, self.client.server), allow_redirects=False ) ...
python
def construct_oauth_url(self): """ Constructs verifier OAuth URL """ response = self._requester(requests.head, "{0}://{1}/".format(self.protocol, self.client.server), allow_redirects=False ) ...
[ "def", "construct_oauth_url", "(", "self", ")", ":", "response", "=", "self", ".", "_requester", "(", "requests", ".", "head", ",", "\"{0}://{1}/\"", ".", "format", "(", "self", ".", "protocol", ",", "self", ".", "client", ".", "server", ")", ",", "allow...
Constructs verifier OAuth URL
[ "Constructs", "verifier", "OAuth", "URL" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L390-L407
train
59,819
xray7224/PyPump
pypump/pypump.py
PyPump.setup_oauth_client
def setup_oauth_client(self, url=None): """ Sets up client for requests to pump """ if url and "://" in url: server, endpoint = self._deconstruct_url(url) else: server = self.client.server if server not in self._server_cache: self._add_client(server) ...
python
def setup_oauth_client(self, url=None): """ Sets up client for requests to pump """ if url and "://" in url: server, endpoint = self._deconstruct_url(url) else: server = self.client.server if server not in self._server_cache: self._add_client(server) ...
[ "def", "setup_oauth_client", "(", "self", ",", "url", "=", "None", ")", ":", "if", "url", "and", "\"://\"", "in", "url", ":", "server", ",", "endpoint", "=", "self", ".", "_deconstruct_url", "(", "url", ")", "else", ":", "server", "=", "self", ".", "...
Sets up client for requests to pump
[ "Sets", "up", "client", "for", "requests", "to", "pump" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L413-L435
train
59,820
xray7224/PyPump
pypump/pypump.py
PyPump.request_token
def request_token(self): """ Gets OAuth request token """ client = OAuth1( client_key=self._server_cache[self.client.server].key, client_secret=self._server_cache[self.client.server].secret, callback_uri=self.callback, ) request = {"auth": client} ...
python
def request_token(self): """ Gets OAuth request token """ client = OAuth1( client_key=self._server_cache[self.client.server].key, client_secret=self._server_cache[self.client.server].secret, callback_uri=self.callback, ) request = {"auth": client} ...
[ "def", "request_token", "(", "self", ")", ":", "client", "=", "OAuth1", "(", "client_key", "=", "self", ".", "_server_cache", "[", "self", ".", "client", ".", "server", "]", ".", "key", ",", "client_secret", "=", "self", ".", "_server_cache", "[", "self"...
Gets OAuth request token
[ "Gets", "OAuth", "request", "token" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L437-L458
train
59,821
xray7224/PyPump
pypump/pypump.py
PyPump.request_access
def request_access(self, verifier): """ Get OAuth access token so we can make requests """ client = OAuth1( client_key=self._server_cache[self.client.server].key, client_secret=self._server_cache[self.client.server].secret, resource_owner_key=self.store["oauth-request...
python
def request_access(self, verifier): """ Get OAuth access token so we can make requests """ client = OAuth1( client_key=self._server_cache[self.client.server].key, client_secret=self._server_cache[self.client.server].secret, resource_owner_key=self.store["oauth-request...
[ "def", "request_access", "(", "self", ",", "verifier", ")", ":", "client", "=", "OAuth1", "(", "client_key", "=", "self", ".", "_server_cache", "[", "self", ".", "client", ".", "server", "]", ".", "key", ",", "client_secret", "=", "self", ".", "_server_c...
Get OAuth access token so we can make requests
[ "Get", "OAuth", "access", "token", "so", "we", "can", "make", "requests" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L460-L481
train
59,822
xray7224/PyPump
pypump/pypump.py
WebPump.logged_in
def logged_in(self): """ Return boolean if is logged in """ if "oauth-access-token" not in self.store: return False response = self.request("/api/whoami", allow_redirects=False) # It should response with a redirect to our profile if it's logged in if response.status...
python
def logged_in(self): """ Return boolean if is logged in """ if "oauth-access-token" not in self.store: return False response = self.request("/api/whoami", allow_redirects=False) # It should response with a redirect to our profile if it's logged in if response.status...
[ "def", "logged_in", "(", "self", ")", ":", "if", "\"oauth-access-token\"", "not", "in", "self", ".", "store", ":", "return", "False", "response", "=", "self", ".", "request", "(", "\"/api/whoami\"", ",", "allow_redirects", "=", "False", ")", "# It should respo...
Return boolean if is logged in
[ "Return", "boolean", "if", "is", "logged", "in" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/pypump.py#L516-L531
train
59,823
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnCreate
def cudnnCreate(): """ Initialize cuDNN. Initializes cuDNN and returns a handle to the cuDNN context. Returns ------- handle : cudnnHandle cuDNN context """ handle = ctypes.c_void_p() status = _libcudnn.cudnnCreate(ctypes.byref(handle)) cudnnCheckStatus(status) re...
python
def cudnnCreate(): """ Initialize cuDNN. Initializes cuDNN and returns a handle to the cuDNN context. Returns ------- handle : cudnnHandle cuDNN context """ handle = ctypes.c_void_p() status = _libcudnn.cudnnCreate(ctypes.byref(handle)) cudnnCheckStatus(status) re...
[ "def", "cudnnCreate", "(", ")", ":", "handle", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudnn", ".", "cudnnCreate", "(", "ctypes", ".", "byref", "(", "handle", ")", ")", "cudnnCheckStatus", "(", "status", ")", "return", "handle", "."...
Initialize cuDNN. Initializes cuDNN and returns a handle to the cuDNN context. Returns ------- handle : cudnnHandle cuDNN context
[ "Initialize", "cuDNN", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L288-L304
train
59,824
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnDestroy
def cudnnDestroy(handle): """ Release cuDNN resources. Release hardware resources used by cuDNN. Parameters ---------- handle : cudnnHandle cuDNN context. """ status = _libcudnn.cudnnDestroy(ctypes.c_void_p(handle)) cudnnCheckStatus(status)
python
def cudnnDestroy(handle): """ Release cuDNN resources. Release hardware resources used by cuDNN. Parameters ---------- handle : cudnnHandle cuDNN context. """ status = _libcudnn.cudnnDestroy(ctypes.c_void_p(handle)) cudnnCheckStatus(status)
[ "def", "cudnnDestroy", "(", "handle", ")", ":", "status", "=", "_libcudnn", ".", "cudnnDestroy", "(", "ctypes", ".", "c_void_p", "(", "handle", ")", ")", "cudnnCheckStatus", "(", "status", ")" ]
Release cuDNN resources. Release hardware resources used by cuDNN. Parameters ---------- handle : cudnnHandle cuDNN context.
[ "Release", "cuDNN", "resources", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L308-L321
train
59,825
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSetStream
def cudnnSetStream(handle, id): """ Set current cuDNN library stream. Parameters ---------- handle : cudnnHandle cuDNN context. id : cudaStream Stream Id. """ status = _libcudnn.cudnnSetStream(handle, id) cudnnCheckStatus(status)
python
def cudnnSetStream(handle, id): """ Set current cuDNN library stream. Parameters ---------- handle : cudnnHandle cuDNN context. id : cudaStream Stream Id. """ status = _libcudnn.cudnnSetStream(handle, id) cudnnCheckStatus(status)
[ "def", "cudnnSetStream", "(", "handle", ",", "id", ")", ":", "status", "=", "_libcudnn", ".", "cudnnSetStream", "(", "handle", ",", "id", ")", "cudnnCheckStatus", "(", "status", ")" ]
Set current cuDNN library stream. Parameters ---------- handle : cudnnHandle cuDNN context. id : cudaStream Stream Id.
[ "Set", "current", "cuDNN", "library", "stream", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L325-L338
train
59,826
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetStream
def cudnnGetStream(handle): """ Get current cuDNN library stream. Parameters ---------- handle : int cuDNN context. Returns ------- id : int Stream ID. """ id = ctypes.c_void_p() status = _libcudnn.cudnnGetStream(handle, ctypes.byref(id)) cudnnCheckStat...
python
def cudnnGetStream(handle): """ Get current cuDNN library stream. Parameters ---------- handle : int cuDNN context. Returns ------- id : int Stream ID. """ id = ctypes.c_void_p() status = _libcudnn.cudnnGetStream(handle, ctypes.byref(id)) cudnnCheckStat...
[ "def", "cudnnGetStream", "(", "handle", ")", ":", "id", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudnn", ".", "cudnnGetStream", "(", "handle", ",", "ctypes", ".", "byref", "(", "id", ")", ")", "cudnnCheckStatus", "(", "status", ")", ...
Get current cuDNN library stream. Parameters ---------- handle : int cuDNN context. Returns ------- id : int Stream ID.
[ "Get", "current", "cuDNN", "library", "stream", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L342-L360
train
59,827
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnCreateTensorDescriptor
def cudnnCreateTensorDescriptor(): """ Create a Tensor descriptor object. Allocates a cudnnTensorDescriptor_t structure and returns a pointer to it. Returns ------- tensor_descriptor : int Tensor descriptor. """ tensor = ctypes.c_void_p() status = _libcudnn.cudnnCreateTens...
python
def cudnnCreateTensorDescriptor(): """ Create a Tensor descriptor object. Allocates a cudnnTensorDescriptor_t structure and returns a pointer to it. Returns ------- tensor_descriptor : int Tensor descriptor. """ tensor = ctypes.c_void_p() status = _libcudnn.cudnnCreateTens...
[ "def", "cudnnCreateTensorDescriptor", "(", ")", ":", "tensor", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudnn", ".", "cudnnCreateTensorDescriptor", "(", "ctypes", ".", "byref", "(", "tensor", ")", ")", "cudnnCheckStatus", "(", "status", ")...
Create a Tensor descriptor object. Allocates a cudnnTensorDescriptor_t structure and returns a pointer to it. Returns ------- tensor_descriptor : int Tensor descriptor.
[ "Create", "a", "Tensor", "descriptor", "object", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L364-L379
train
59,828
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSetTensor4dDescriptor
def cudnnSetTensor4dDescriptor(tensorDesc, format, dataType, n, c, h, w): """ Initialize a previously created Tensor 4D object. This function initializes a previously created Tensor4D descriptor object. The strides of the four dimensions are inferred from the format parameter and set in such a way that...
python
def cudnnSetTensor4dDescriptor(tensorDesc, format, dataType, n, c, h, w): """ Initialize a previously created Tensor 4D object. This function initializes a previously created Tensor4D descriptor object. The strides of the four dimensions are inferred from the format parameter and set in such a way that...
[ "def", "cudnnSetTensor4dDescriptor", "(", "tensorDesc", ",", "format", ",", "dataType", ",", "n", ",", "c", ",", "h", ",", "w", ")", ":", "status", "=", "_libcudnn", ".", "cudnnSetTensor4dDescriptor", "(", "tensorDesc", ",", "format", ",", "dataType", ",", ...
Initialize a previously created Tensor 4D object. This function initializes a previously created Tensor4D descriptor object. The strides of the four dimensions are inferred from the format parameter and set in such a way that the data is contiguous in memory with no padding between dimensions. Paramet...
[ "Initialize", "a", "previously", "created", "Tensor", "4D", "object", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L386-L414
train
59,829
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSetTensor4dDescriptorEx
def cudnnSetTensor4dDescriptorEx(tensorDesc, dataType, n, c, h, w, nStride, cStride, hStride, wStride): """" Initialize a Tensor descriptor object with strides. This function initializes a previously created generic Tensor descriptor object into a 4D tensor, similarly to cudnnSetTensor4dDescriptor but ...
python
def cudnnSetTensor4dDescriptorEx(tensorDesc, dataType, n, c, h, w, nStride, cStride, hStride, wStride): """" Initialize a Tensor descriptor object with strides. This function initializes a previously created generic Tensor descriptor object into a 4D tensor, similarly to cudnnSetTensor4dDescriptor but ...
[ "def", "cudnnSetTensor4dDescriptorEx", "(", "tensorDesc", ",", "dataType", ",", "n", ",", "c", ",", "h", ",", "w", ",", "nStride", ",", "cStride", ",", "hStride", ",", "wStride", ")", ":", "status", "=", "_libcudnn", ".", "cudnnSetTensor4dDescriptorEx", "(",...
Initialize a Tensor descriptor object with strides. This function initializes a previously created generic Tensor descriptor object into a 4D tensor, similarly to cudnnSetTensor4dDescriptor but with the strides explicitly passed as parameters. This can be used to lay out the 4D tensor in any order or simpl...
[ "Initialize", "a", "Tensor", "descriptor", "object", "with", "strides", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L420-L455
train
59,830
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetTensor4dDescriptor
def cudnnGetTensor4dDescriptor(tensorDesc): """" Get parameters of a Tensor descriptor object. This function queries the parameters of the previouly initialized Tensor4D descriptor object. Parameters ---------- tensorDesc : cudnnTensorDescriptor Handle to a previously initialized t...
python
def cudnnGetTensor4dDescriptor(tensorDesc): """" Get parameters of a Tensor descriptor object. This function queries the parameters of the previouly initialized Tensor4D descriptor object. Parameters ---------- tensorDesc : cudnnTensorDescriptor Handle to a previously initialized t...
[ "def", "cudnnGetTensor4dDescriptor", "(", "tensorDesc", ")", ":", "dataType", "=", "ctypes", ".", "c_int", "(", ")", "n", "=", "ctypes", ".", "c_int", "(", ")", "c", "=", "ctypes", ".", "c_int", "(", ")", "h", "=", "ctypes", ".", "c_int", "(", ")", ...
Get parameters of a Tensor descriptor object. This function queries the parameters of the previouly initialized Tensor4D descriptor object. Parameters ---------- tensorDesc : cudnnTensorDescriptor Handle to a previously initialized tensor descriptor. Returns ------- dataType :...
[ "Get", "parameters", "of", "a", "Tensor", "descriptor", "object", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L462-L513
train
59,831
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnCreateFilterDescriptor
def cudnnCreateFilterDescriptor(): """" Create a filter descriptor. This function creates a filter descriptor object by allocating the memory needed to hold its opaque structure. Parameters ---------- Returns ------- wDesc : cudnnFilterDescriptor Handle to a newly allocate...
python
def cudnnCreateFilterDescriptor(): """" Create a filter descriptor. This function creates a filter descriptor object by allocating the memory needed to hold its opaque structure. Parameters ---------- Returns ------- wDesc : cudnnFilterDescriptor Handle to a newly allocate...
[ "def", "cudnnCreateFilterDescriptor", "(", ")", ":", "wDesc", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudnn", ".", "cudnnCreateFilterDescriptor", "(", "ctypes", ".", "byref", "(", "wDesc", ")", ")", "cudnnCheckStatus", "(", "status", ")",...
Create a filter descriptor. This function creates a filter descriptor object by allocating the memory needed to hold its opaque structure. Parameters ---------- Returns ------- wDesc : cudnnFilterDescriptor Handle to a newly allocated filter descriptor.
[ "Create", "a", "filter", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L686-L706
train
59,832
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSetFilter4dDescriptor
def cudnnSetFilter4dDescriptor(wDesc, dataType, format, k, c, h, w): """" Initialize a filter descriptor. This function initializes a previously created filter descriptor object into a 4D filter. Filters layout must be contiguous in memory. Parameters ---------- wDesc : cudnnFilterDescript...
python
def cudnnSetFilter4dDescriptor(wDesc, dataType, format, k, c, h, w): """" Initialize a filter descriptor. This function initializes a previously created filter descriptor object into a 4D filter. Filters layout must be contiguous in memory. Parameters ---------- wDesc : cudnnFilterDescript...
[ "def", "cudnnSetFilter4dDescriptor", "(", "wDesc", ",", "dataType", ",", "format", ",", "k", ",", "c", ",", "h", ",", "w", ")", ":", "status", "=", "_libcudnn", ".", "cudnnSetFilter4dDescriptor", "(", "wDesc", ",", "dataType", ",", "format", ",", "k", ",...
Initialize a filter descriptor. This function initializes a previously created filter descriptor object into a 4D filter. Filters layout must be contiguous in memory. Parameters ---------- wDesc : cudnnFilterDescriptor Handle to a previously created filter descriptor. dataType : cudnnD...
[ "Initialize", "a", "filter", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L712-L738
train
59,833
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetFilter4dDescriptor
def cudnnGetFilter4dDescriptor(wDesc): """" Get parameters of filter descriptor. This function queries the parameters of the previouly initialized filter descriptor object. Parameters ---------- wDesc : cudnnFilterDescriptor Handle to a previously created filter descriptor. Return...
python
def cudnnGetFilter4dDescriptor(wDesc): """" Get parameters of filter descriptor. This function queries the parameters of the previouly initialized filter descriptor object. Parameters ---------- wDesc : cudnnFilterDescriptor Handle to a previously created filter descriptor. Return...
[ "def", "cudnnGetFilter4dDescriptor", "(", "wDesc", ")", ":", "dataType", "=", "ctypes", ".", "c_int", "(", ")", "format", "=", "ctypes", ".", "c_int", "(", ")", "k", "=", "ctypes", ".", "c_int", "(", ")", "c", "=", "ctypes", ".", "c_int", "(", ")", ...
Get parameters of filter descriptor. This function queries the parameters of the previouly initialized filter descriptor object. Parameters ---------- wDesc : cudnnFilterDescriptor Handle to a previously created filter descriptor. Returns ------- dataType : cudnnDataType D...
[ "Get", "parameters", "of", "filter", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L744-L784
train
59,834
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnCreateConvolutionDescriptor
def cudnnCreateConvolutionDescriptor(): """" Create a convolution descriptor. This function creates a convolution descriptor object by allocating the memory needed to hold its opaque structure. Returns ------- convDesc : cudnnConvolutionDescriptor Handle to newly allocated convolut...
python
def cudnnCreateConvolutionDescriptor(): """" Create a convolution descriptor. This function creates a convolution descriptor object by allocating the memory needed to hold its opaque structure. Returns ------- convDesc : cudnnConvolutionDescriptor Handle to newly allocated convolut...
[ "def", "cudnnCreateConvolutionDescriptor", "(", ")", ":", "convDesc", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudnn", ".", "cudnnCreateConvolutionDescriptor", "(", "ctypes", ".", "byref", "(", "convDesc", ")", ")", "cudnnCheckStatus", "(", ...
Create a convolution descriptor. This function creates a convolution descriptor object by allocating the memory needed to hold its opaque structure. Returns ------- convDesc : cudnnConvolutionDescriptor Handle to newly allocated convolution descriptor.
[ "Create", "a", "convolution", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L804-L822
train
59,835
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSetConvolution2dDescriptor
def cudnnSetConvolution2dDescriptor(convDesc, pad_h, pad_w, u, v, dilation_h, dilation_w, mode, computeType): """" Initialize a convolution descriptor. This function initializes a previously created convolution descriptor object into a 2D correlation. This function a...
python
def cudnnSetConvolution2dDescriptor(convDesc, pad_h, pad_w, u, v, dilation_h, dilation_w, mode, computeType): """" Initialize a convolution descriptor. This function initializes a previously created convolution descriptor object into a 2D correlation. This function a...
[ "def", "cudnnSetConvolution2dDescriptor", "(", "convDesc", ",", "pad_h", ",", "pad_w", ",", "u", ",", "v", ",", "dilation_h", ",", "dilation_w", ",", "mode", ",", "computeType", ")", ":", "status", "=", "_libcudnn", ".", "cudnnSetConvolution2dDescriptor", "(", ...
Initialize a convolution descriptor. This function initializes a previously created convolution descriptor object into a 2D correlation. This function assumes that the tensor and filter descriptors corresponds to the formard convolution path and checks if their settings are valid. That same convolution...
[ "Initialize", "a", "convolution", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L828-L866
train
59,836
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetConvolution2dDescriptor
def cudnnGetConvolution2dDescriptor(convDesc): """" Get a convolution descriptor. This function queries a previously initialized 2D convolution descriptor object. Parameters ---------- convDesc : cudnnConvolutionDescriptor Handle to a previously created convolution descriptor. Ret...
python
def cudnnGetConvolution2dDescriptor(convDesc): """" Get a convolution descriptor. This function queries a previously initialized 2D convolution descriptor object. Parameters ---------- convDesc : cudnnConvolutionDescriptor Handle to a previously created convolution descriptor. Ret...
[ "def", "cudnnGetConvolution2dDescriptor", "(", "convDesc", ")", ":", "pad_h", "=", "ctypes", ".", "c_int", "(", ")", "pad_w", "=", "ctypes", ".", "c_int", "(", ")", "u", "=", "ctypes", ".", "c_int", "(", ")", "v", "=", "ctypes", ".", "c_int", "(", ")...
Get a convolution descriptor. This function queries a previously initialized 2D convolution descriptor object. Parameters ---------- convDesc : cudnnConvolutionDescriptor Handle to a previously created convolution descriptor. Returns ------- pad_h : int zero-padding height...
[ "Get", "a", "convolution", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L870-L920
train
59,837
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetConvolution2dForwardOutputDim
def cudnnGetConvolution2dForwardOutputDim(convDesc, inputTensorDesc, wDesc): """" Return the dimensions of the output tensor given a convolution descriptor. This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor...
python
def cudnnGetConvolution2dForwardOutputDim(convDesc, inputTensorDesc, wDesc): """" Return the dimensions of the output tensor given a convolution descriptor. This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor...
[ "def", "cudnnGetConvolution2dForwardOutputDim", "(", "convDesc", ",", "inputTensorDesc", ",", "wDesc", ")", ":", "n", "=", "ctypes", ".", "c_int", "(", ")", "c", "=", "ctypes", ".", "c_int", "(", ")", "h", "=", "ctypes", ".", "c_int", "(", ")", "w", "=...
Return the dimensions of the output tensor given a convolution descriptor. This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor. This function can help to setup the output tensor and allo...
[ "Return", "the", "dimensions", "of", "the", "output", "tensor", "given", "a", "convolution", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L925-L965
train
59,838
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetConvolutionForwardAlgorithm
def cudnnGetConvolutionForwardAlgorithm(handle, srcDesc, wDesc, convDesc, destDesc, preference, memoryLimitInbytes): """" This function returns the best algorithm to choose for the forward convolution depending on the critera expressed in the cudnnConvolutionFwdPrefer...
python
def cudnnGetConvolutionForwardAlgorithm(handle, srcDesc, wDesc, convDesc, destDesc, preference, memoryLimitInbytes): """" This function returns the best algorithm to choose for the forward convolution depending on the critera expressed in the cudnnConvolutionFwdPrefer...
[ "def", "cudnnGetConvolutionForwardAlgorithm", "(", "handle", ",", "srcDesc", ",", "wDesc", ",", "convDesc", ",", "destDesc", ",", "preference", ",", "memoryLimitInbytes", ")", ":", "algo", "=", "ctypes", ".", "c_int", "(", ")", "status", "=", "_libcudnn", ".",...
This function returns the best algorithm to choose for the forward convolution depending on the critera expressed in the cudnnConvolutionFwdPreference_t enumerant. Parameters ---------- handle : cudnnHandle Handle to a previously created cuDNN context. srcDesc : cudnnTensorDescriptor ...
[ "This", "function", "returns", "the", "best", "algorithm", "to", "choose", "for", "the", "forward", "convolution", "depending", "on", "the", "critera", "expressed", "in", "the", "cudnnConvolutionFwdPreference_t", "enumerant", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1049-L1088
train
59,839
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetConvolutionForwardWorkspaceSize
def cudnnGetConvolutionForwardWorkspaceSize(handle, srcDesc, wDesc, convDesc, destDesc, algo): """" This function returns the amount of GPU memory workspace the user needs to allocate to be able to call cudnnConvolutionForward with the specified algorithm. Pa...
python
def cudnnGetConvolutionForwardWorkspaceSize(handle, srcDesc, wDesc, convDesc, destDesc, algo): """" This function returns the amount of GPU memory workspace the user needs to allocate to be able to call cudnnConvolutionForward with the specified algorithm. Pa...
[ "def", "cudnnGetConvolutionForwardWorkspaceSize", "(", "handle", ",", "srcDesc", ",", "wDesc", ",", "convDesc", ",", "destDesc", ",", "algo", ")", ":", "sizeInBytes", "=", "ctypes", ".", "c_size_t", "(", ")", "status", "=", "_libcudnn", ".", "cudnnGetConvolution...
This function returns the amount of GPU memory workspace the user needs to allocate to be able to call cudnnConvolutionForward with the specified algorithm. Parameters ---------- handle : cudnnHandle Handle to a previously created cuDNN context. srcDesc : cudnnTensorDescriptor Handl...
[ "This", "function", "returns", "the", "amount", "of", "GPU", "memory", "workspace", "the", "user", "needs", "to", "allocate", "to", "be", "able", "to", "call", "cudnnConvolutionForward", "with", "the", "specified", "algorithm", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1097-L1131
train
59,840
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSoftmaxForward
def cudnnSoftmaxForward(handle, algorithm, mode, alpha, srcDesc, srcData, beta, destDesc, destData): """" This routing computes the softmax function Parameters ---------- handle : cudnnHandle Handle to a previously created cuDNN context. algorithm : cudnnSoftmaxAlgorithm Enumera...
python
def cudnnSoftmaxForward(handle, algorithm, mode, alpha, srcDesc, srcData, beta, destDesc, destData): """" This routing computes the softmax function Parameters ---------- handle : cudnnHandle Handle to a previously created cuDNN context. algorithm : cudnnSoftmaxAlgorithm Enumera...
[ "def", "cudnnSoftmaxForward", "(", "handle", ",", "algorithm", ",", "mode", ",", "alpha", ",", "srcDesc", ",", "srcData", ",", "beta", ",", "destDesc", ",", "destData", ")", ":", "dataType", "=", "cudnnGetTensor4dDescriptor", "(", "destDesc", ")", "[", "0", ...
This routing computes the softmax function Parameters ---------- handle : cudnnHandle Handle to a previously created cuDNN context. algorithm : cudnnSoftmaxAlgorithm Enumerant to specify the softmax algorithm. mode : cudnnSoftmaxMode Enumerant to specify the softmax mode. ...
[ "This", "routing", "computes", "the", "softmax", "function" ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1497-L1538
train
59,841
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnCreatePoolingDescriptor
def cudnnCreatePoolingDescriptor(): """" Create pooling descriptor. This function creates a pooling descriptor object by allocating the memory needed to hold its opaque structure, Returns ------- poolingDesc : cudnnPoolingDescriptor Newly allocated pooling descriptor. """ ...
python
def cudnnCreatePoolingDescriptor(): """" Create pooling descriptor. This function creates a pooling descriptor object by allocating the memory needed to hold its opaque structure, Returns ------- poolingDesc : cudnnPoolingDescriptor Newly allocated pooling descriptor. """ ...
[ "def", "cudnnCreatePoolingDescriptor", "(", ")", ":", "poolingDesc", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudnn", ".", "cudnnCreatePoolingDescriptor", "(", "ctypes", ".", "byref", "(", "poolingDesc", ")", ")", "cudnnCheckStatus", "(", "s...
Create pooling descriptor. This function creates a pooling descriptor object by allocating the memory needed to hold its opaque structure, Returns ------- poolingDesc : cudnnPoolingDescriptor Newly allocated pooling descriptor.
[ "Create", "pooling", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1597-L1614
train
59,842
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSetPooling2dDescriptor
def cudnnSetPooling2dDescriptor(poolingDesc, mode, windowHeight, windowWidth, verticalPadding, horizontalPadding, verticalStride, horizontalStride): """" Initialize a 2D pooling descriptor. This function initializes a previously created pooling descriptor object. Parame...
python
def cudnnSetPooling2dDescriptor(poolingDesc, mode, windowHeight, windowWidth, verticalPadding, horizontalPadding, verticalStride, horizontalStride): """" Initialize a 2D pooling descriptor. This function initializes a previously created pooling descriptor object. Parame...
[ "def", "cudnnSetPooling2dDescriptor", "(", "poolingDesc", ",", "mode", ",", "windowHeight", ",", "windowWidth", ",", "verticalPadding", ",", "horizontalPadding", ",", "verticalStride", ",", "horizontalStride", ")", ":", "status", "=", "_libcudnn", ".", "cudnnSetPoolin...
Initialize a 2D pooling descriptor. This function initializes a previously created pooling descriptor object. Parameters ---------- poolingDesc : cudnnPoolingDescriptor Handle to a previously created pooling descriptor. mode : cudnnPoolingMode Enumerant to specify the pooling mode....
[ "Initialize", "a", "2D", "pooling", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1621-L1651
train
59,843
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetPooling2dDescriptor
def cudnnGetPooling2dDescriptor(poolingDesc): """" This function queries a previously created pooling descriptor object. Parameters ---------- poolingDesc : cudnnPoolingDescriptor Handle to a previously created 2D pooling descriptor. Returns ------- mode : cudnnPoolingMode ...
python
def cudnnGetPooling2dDescriptor(poolingDesc): """" This function queries a previously created pooling descriptor object. Parameters ---------- poolingDesc : cudnnPoolingDescriptor Handle to a previously created 2D pooling descriptor. Returns ------- mode : cudnnPoolingMode ...
[ "def", "cudnnGetPooling2dDescriptor", "(", "poolingDesc", ")", ":", "mode", "=", "ctypes", ".", "c_int", "(", ")", "windowHeight", "=", "ctypes", ".", "c_int", "(", ")", "windowWidth", "=", "ctypes", ".", "c_int", "(", ")", "verticalPadding", "=", "ctypes", ...
This function queries a previously created pooling descriptor object. Parameters ---------- poolingDesc : cudnnPoolingDescriptor Handle to a previously created 2D pooling descriptor. Returns ------- mode : cudnnPoolingMode Enumerant to specify the pooling mode. windowHeight : i...
[ "This", "function", "queries", "a", "previously", "created", "pooling", "descriptor", "object", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1657-L1698
train
59,844
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnActivationBackward
def cudnnActivationBackward(handle, mode, alpha, srcDesc, srcData, srcDiffDesc, srcDiffData, destDesc, destData, beta, destDiffDesc, destDiffData): """" Gradient of activation function. This routine computes the gradient of a neuron activation function. In-place operation i...
python
def cudnnActivationBackward(handle, mode, alpha, srcDesc, srcData, srcDiffDesc, srcDiffData, destDesc, destData, beta, destDiffDesc, destDiffData): """" Gradient of activation function. This routine computes the gradient of a neuron activation function. In-place operation i...
[ "def", "cudnnActivationBackward", "(", "handle", ",", "mode", ",", "alpha", ",", "srcDesc", ",", "srcData", ",", "srcDiffDesc", ",", "srcDiffData", ",", "destDesc", ",", "destData", ",", "beta", ",", "destDiffDesc", ",", "destDiffData", ")", ":", "dataType", ...
Gradient of activation function. This routine computes the gradient of a neuron activation function. In-place operation is allowed for this routine; i.e., srcData and destData pointers may be equal and srcDiffData and destDiffData pointers may be equal. However, this requires the corresponding tensor ...
[ "Gradient", "of", "activation", "function", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1881-L1940
train
59,845
xray7224/PyPump
pypump/store.py
AbstractStore.__prefix_key
def __prefix_key(self, key): """ This will add the prefix to the key if one exists on the store """ # If there isn't a prefix don't bother if self.prefix is None: return key # Don't prefix key if it already has it if key.startswith(self.prefix + "-"): ret...
python
def __prefix_key(self, key): """ This will add the prefix to the key if one exists on the store """ # If there isn't a prefix don't bother if self.prefix is None: return key # Don't prefix key if it already has it if key.startswith(self.prefix + "-"): ret...
[ "def", "__prefix_key", "(", "self", ",", "key", ")", ":", "# If there isn't a prefix don't bother", "if", "self", ".", "prefix", "is", "None", ":", "return", "key", "# Don't prefix key if it already has it", "if", "key", ".", "startswith", "(", "self", ".", "prefi...
This will add the prefix to the key if one exists on the store
[ "This", "will", "add", "the", "prefix", "to", "the", "key", "if", "one", "exists", "on", "the", "store" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/store.py#L61-L71
train
59,846
xray7224/PyPump
pypump/store.py
AbstractStore.export
def export(self): """ Exports as dictionary """ data = {} for key, value in self.items(): data[key] = value return data
python
def export(self): """ Exports as dictionary """ data = {} for key, value in self.items(): data[key] = value return data
[ "def", "export", "(", "self", ")", ":", "data", "=", "{", "}", "for", "key", ",", "value", "in", "self", ".", "items", "(", ")", ":", "data", "[", "key", "]", "=", "value", "return", "data" ]
Exports as dictionary
[ "Exports", "as", "dictionary" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/store.py#L96-L102
train
59,847
xray7224/PyPump
pypump/store.py
JSONStore.save
def save(self): """ Saves dictionary to disk in JSON format. """ if self.filename is None: raise StoreException("Filename must be set to write store to disk") # We need an atomic way of re-writing the settings, we also need to # prevent only overwriting part of the settings ...
python
def save(self): """ Saves dictionary to disk in JSON format. """ if self.filename is None: raise StoreException("Filename must be set to write store to disk") # We need an atomic way of re-writing the settings, we also need to # prevent only overwriting part of the settings ...
[ "def", "save", "(", "self", ")", ":", "if", "self", ".", "filename", "is", "None", ":", "raise", "StoreException", "(", "\"Filename must be set to write store to disk\"", ")", "# We need an atomic way of re-writing the settings, we also need to", "# prevent only overwriting par...
Saves dictionary to disk in JSON format.
[ "Saves", "dictionary", "to", "disk", "in", "JSON", "format", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/store.py#L151-L176
train
59,848
xray7224/PyPump
pypump/store.py
JSONStore.get_filename
def get_filename(cls): """ Gets filename of store on disk """ config_home = os.environ.get("XDG_CONFIG_HOME", "~/.config") config_home = os.path.expanduser(config_home) base_path = os.path.join(config_home, "PyPump") if not os.path.isdir(base_path): os.makedirs(base_...
python
def get_filename(cls): """ Gets filename of store on disk """ config_home = os.environ.get("XDG_CONFIG_HOME", "~/.config") config_home = os.path.expanduser(config_home) base_path = os.path.join(config_home, "PyPump") if not os.path.isdir(base_path): os.makedirs(base_...
[ "def", "get_filename", "(", "cls", ")", ":", "config_home", "=", "os", ".", "environ", ".", "get", "(", "\"XDG_CONFIG_HOME\"", ",", "\"~/.config\"", ")", "config_home", "=", "os", ".", "path", ".", "expanduser", "(", "config_home", ")", "base_path", "=", "...
Gets filename of store on disk
[ "Gets", "filename", "of", "store", "on", "disk" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/store.py#L179-L188
train
59,849
xray7224/PyPump
pypump/store.py
JSONStore.load
def load(cls, webfinger, pypump): """ Load JSON from disk into store object """ filename = cls.get_filename() if os.path.isfile(filename): data = open(filename).read() data = json.loads(data) store = cls(data, filename=filename) else: stor...
python
def load(cls, webfinger, pypump): """ Load JSON from disk into store object """ filename = cls.get_filename() if os.path.isfile(filename): data = open(filename).read() data = json.loads(data) store = cls(data, filename=filename) else: stor...
[ "def", "load", "(", "cls", ",", "webfinger", ",", "pypump", ")", ":", "filename", "=", "cls", ".", "get_filename", "(", ")", "if", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "data", "=", "open", "(", "filename", ")", ".", "read", ...
Load JSON from disk into store object
[ "Load", "JSON", "from", "disk", "into", "store", "object" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/store.py#L191-L203
train
59,850
joeyespo/py-getch
getch/pause.py
pause
def pause(message='Press any key to continue . . . '): """ Prints the specified message if it's not None and waits for a keypress. """ if message is not None: print(message, end='') sys.stdout.flush() getch() print()
python
def pause(message='Press any key to continue . . . '): """ Prints the specified message if it's not None and waits for a keypress. """ if message is not None: print(message, end='') sys.stdout.flush() getch() print()
[ "def", "pause", "(", "message", "=", "'Press any key to continue . . . '", ")", ":", "if", "message", "is", "not", "None", ":", "print", "(", "message", ",", "end", "=", "''", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "getch", "(", ")", "print...
Prints the specified message if it's not None and waits for a keypress.
[ "Prints", "the", "specified", "message", "if", "it", "s", "not", "None", "and", "waits", "for", "a", "keypress", "." ]
295f0c2e602e6043ba0d338076abe847a7b29b0b
https://github.com/joeyespo/py-getch/blob/295f0c2e602e6043ba0d338076abe847a7b29b0b/getch/pause.py#L7-L15
train
59,851
woolfson-group/isambard
isambard/ampal/interactions.py
covalent_bonds
def covalent_bonds(atoms, threshold=1.1): """Returns all the covalent bonds in a list of `Atom` pairs. Notes ----- Uses information `element_data`, which can be accessed directly through this module i.e. `isambard.ampal.interactions.element_data`. Parameters ---------- atoms : [(`Atom`...
python
def covalent_bonds(atoms, threshold=1.1): """Returns all the covalent bonds in a list of `Atom` pairs. Notes ----- Uses information `element_data`, which can be accessed directly through this module i.e. `isambard.ampal.interactions.element_data`. Parameters ---------- atoms : [(`Atom`...
[ "def", "covalent_bonds", "(", "atoms", ",", "threshold", "=", "1.1", ")", ":", "bonds", "=", "[", "]", "for", "a", ",", "b", "in", "atoms", ":", "bond_distance", "=", "(", "element_data", "[", "a", ".", "element", ".", "title", "(", ")", "]", "[", ...
Returns all the covalent bonds in a list of `Atom` pairs. Notes ----- Uses information `element_data`, which can be accessed directly through this module i.e. `isambard.ampal.interactions.element_data`. Parameters ---------- atoms : [(`Atom`, `Atom`)] List of pairs of `Atoms`. ...
[ "Returns", "all", "the", "covalent", "bonds", "in", "a", "list", "of", "Atom", "pairs", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/interactions.py#L178-L203
train
59,852
woolfson-group/isambard
isambard/ampal/interactions.py
find_covalent_bonds
def find_covalent_bonds(ampal, max_range=2.2, threshold=1.1, tag=True): """Finds all covalent bonds in the AMPAL object. Parameters ---------- ampal : AMPAL Object Any AMPAL object with a `get_atoms` method. max_range : float, optional Used to define the sector size, so interactions...
python
def find_covalent_bonds(ampal, max_range=2.2, threshold=1.1, tag=True): """Finds all covalent bonds in the AMPAL object. Parameters ---------- ampal : AMPAL Object Any AMPAL object with a `get_atoms` method. max_range : float, optional Used to define the sector size, so interactions...
[ "def", "find_covalent_bonds", "(", "ampal", ",", "max_range", "=", "2.2", ",", "threshold", "=", "1.1", ",", "tag", "=", "True", ")", ":", "sectors", "=", "gen_sectors", "(", "ampal", ".", "get_atoms", "(", ")", ",", "max_range", "*", "1.1", ")", "bond...
Finds all covalent bonds in the AMPAL object. Parameters ---------- ampal : AMPAL Object Any AMPAL object with a `get_atoms` method. max_range : float, optional Used to define the sector size, so interactions at longer ranges will not be found. threshold : float, optional ...
[ "Finds", "all", "covalent", "bonds", "in", "the", "AMPAL", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/interactions.py#L206-L242
train
59,853
woolfson-group/isambard
isambard/ampal/interactions.py
generate_covalent_bond_graph
def generate_covalent_bond_graph(covalent_bonds): """Generates a graph of the covalent bond network described by the interactions. Parameters ---------- covalent_bonds: [CovalentBond] List of `CovalentBond`. Returns ------- bond_graph: networkx.Graph A graph of the covalent...
python
def generate_covalent_bond_graph(covalent_bonds): """Generates a graph of the covalent bond network described by the interactions. Parameters ---------- covalent_bonds: [CovalentBond] List of `CovalentBond`. Returns ------- bond_graph: networkx.Graph A graph of the covalent...
[ "def", "generate_covalent_bond_graph", "(", "covalent_bonds", ")", ":", "bond_graph", "=", "networkx", ".", "Graph", "(", ")", "for", "inter", "in", "covalent_bonds", ":", "bond_graph", ".", "add_edge", "(", "inter", ".", "a", ",", "inter", ".", "b", ")", ...
Generates a graph of the covalent bond network described by the interactions. Parameters ---------- covalent_bonds: [CovalentBond] List of `CovalentBond`. Returns ------- bond_graph: networkx.Graph A graph of the covalent bond network.
[ "Generates", "a", "graph", "of", "the", "covalent", "bond", "network", "described", "by", "the", "interactions", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/interactions.py#L245-L261
train
59,854
woolfson-group/isambard
isambard/ampal/interactions.py
generate_bond_subgraphs_from_break
def generate_bond_subgraphs_from_break(bond_graph, atom1, atom2): """Splits the bond graph between two atoms to producing subgraphs. Notes ----- This will not work if there are cycles in the bond graph. Parameters ---------- bond_graph: networkx.Graph Graph of covalent bond network...
python
def generate_bond_subgraphs_from_break(bond_graph, atom1, atom2): """Splits the bond graph between two atoms to producing subgraphs. Notes ----- This will not work if there are cycles in the bond graph. Parameters ---------- bond_graph: networkx.Graph Graph of covalent bond network...
[ "def", "generate_bond_subgraphs_from_break", "(", "bond_graph", ",", "atom1", ",", "atom2", ")", ":", "bond_graph", ".", "remove_edge", "(", "atom1", ",", "atom2", ")", "try", ":", "subgraphs", "=", "list", "(", "networkx", ".", "connected_component_subgraphs", ...
Splits the bond graph between two atoms to producing subgraphs. Notes ----- This will not work if there are cycles in the bond graph. Parameters ---------- bond_graph: networkx.Graph Graph of covalent bond network atom1: isambard.ampal.Atom First atom in the bond. atom2...
[ "Splits", "the", "bond", "graph", "between", "two", "atoms", "to", "producing", "subgraphs", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/interactions.py#L264-L293
train
59,855
woolfson-group/isambard
isambard/ampal/base_ampal.py
cap
def cap(v, l): """Shortens string is above certain length.""" s = str(v) return s if len(s) <= l else s[-l:]
python
def cap(v, l): """Shortens string is above certain length.""" s = str(v) return s if len(s) <= l else s[-l:]
[ "def", "cap", "(", "v", ",", "l", ")", ":", "s", "=", "str", "(", "v", ")", "return", "s", "if", "len", "(", "s", ")", "<=", "l", "else", "s", "[", "-", "l", ":", "]" ]
Shortens string is above certain length.
[ "Shortens", "string", "is", "above", "certain", "length", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L16-L19
train
59,856
woolfson-group/isambard
isambard/ampal/base_ampal.py
find_atoms_within_distance
def find_atoms_within_distance(atoms, cutoff_distance, point): """Returns atoms within the distance from the point. Parameters ---------- atoms : [ampal.atom] A list of `ampal.atoms`. cutoff_distance : float Maximum distance from point. point : (float, float, float) Refe...
python
def find_atoms_within_distance(atoms, cutoff_distance, point): """Returns atoms within the distance from the point. Parameters ---------- atoms : [ampal.atom] A list of `ampal.atoms`. cutoff_distance : float Maximum distance from point. point : (float, float, float) Refe...
[ "def", "find_atoms_within_distance", "(", "atoms", ",", "cutoff_distance", ",", "point", ")", ":", "return", "[", "x", "for", "x", "in", "atoms", "if", "distance", "(", "x", ",", "point", ")", "<=", "cutoff_distance", "]" ]
Returns atoms within the distance from the point. Parameters ---------- atoms : [ampal.atom] A list of `ampal.atoms`. cutoff_distance : float Maximum distance from point. point : (float, float, float) Reference point, 3D coordinate. Returns ------- filtered_atom...
[ "Returns", "atoms", "within", "the", "distance", "from", "the", "point", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L22-L39
train
59,857
woolfson-group/isambard
isambard/ampal/base_ampal.py
centre_of_atoms
def centre_of_atoms(atoms, mass_weighted=True): """ Returns centre point of any list of atoms. Parameters ---------- atoms : list List of AMPAL atom objects. mass_weighted : bool, optional If True returns centre of mass, otherwise just geometric centre of points. Returns --...
python
def centre_of_atoms(atoms, mass_weighted=True): """ Returns centre point of any list of atoms. Parameters ---------- atoms : list List of AMPAL atom objects. mass_weighted : bool, optional If True returns centre of mass, otherwise just geometric centre of points. Returns --...
[ "def", "centre_of_atoms", "(", "atoms", ",", "mass_weighted", "=", "True", ")", ":", "points", "=", "[", "x", ".", "_vector", "for", "x", "in", "atoms", "]", "if", "mass_weighted", ":", "masses", "=", "[", "x", ".", "mass", "for", "x", "in", "atoms",...
Returns centre point of any list of atoms. Parameters ---------- atoms : list List of AMPAL atom objects. mass_weighted : bool, optional If True returns centre of mass, otherwise just geometric centre of points. Returns ------- centre_of_mass : numpy.array 3D coordi...
[ "Returns", "centre", "point", "of", "any", "list", "of", "atoms", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L42-L62
train
59,858
woolfson-group/isambard
isambard/ampal/base_ampal.py
BaseAmpal.assign_force_field
def assign_force_field(self, ff, mol2=False): """Assigns force field parameters to Atoms in the AMPAL object. Parameters ---------- ff: BuffForceField The force field to be used for scoring. mol2: bool, optional If true, mol2 style labels will also be use...
python
def assign_force_field(self, ff, mol2=False): """Assigns force field parameters to Atoms in the AMPAL object. Parameters ---------- ff: BuffForceField The force field to be used for scoring. mol2: bool, optional If true, mol2 style labels will also be use...
[ "def", "assign_force_field", "(", "self", ",", "ff", ",", "mol2", "=", "False", ")", ":", "if", "hasattr", "(", "self", ",", "'ligands'", ")", ":", "atoms", "=", "self", ".", "get_atoms", "(", "ligands", "=", "True", ",", "inc_alt_states", "=", "True",...
Assigns force field parameters to Atoms in the AMPAL object. Parameters ---------- ff: BuffForceField The force field to be used for scoring. mol2: bool, optional If true, mol2 style labels will also be used.
[ "Assigns", "force", "field", "parameters", "to", "Atoms", "in", "the", "AMPAL", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L178-L224
train
59,859
woolfson-group/isambard
isambard/ampal/base_ampal.py
BaseAmpal.update_ff
def update_ff(self, ff, mol2=False, force_ff_assign=False): """Manages assigning the force field parameters. The aim of this method is to avoid unnecessary assignment of the force field. Parameters ---------- ff: BuffForceField The force field to be used for...
python
def update_ff(self, ff, mol2=False, force_ff_assign=False): """Manages assigning the force field parameters. The aim of this method is to avoid unnecessary assignment of the force field. Parameters ---------- ff: BuffForceField The force field to be used for...
[ "def", "update_ff", "(", "self", ",", "ff", ",", "mol2", "=", "False", ",", "force_ff_assign", "=", "False", ")", ":", "aff", "=", "False", "if", "force_ff_assign", ":", "aff", "=", "True", "elif", "'assigned_ff'", "not", "in", "self", ".", "tags", ":"...
Manages assigning the force field parameters. The aim of this method is to avoid unnecessary assignment of the force field. Parameters ---------- ff: BuffForceField The force field to be used for scoring. mol2: bool, optional If true, mol2 style ...
[ "Manages", "assigning", "the", "force", "field", "parameters", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L226-L251
train
59,860
woolfson-group/isambard
isambard/ampal/base_ampal.py
BaseAmpal.get_internal_energy
def get_internal_energy(self, assign_ff=True, ff=None, mol2=False, force_ff_assign=False): """Calculates the internal energy of the AMPAL object. This method is assigned to the buff_internal_energy property, using the default arguments. Parameters --...
python
def get_internal_energy(self, assign_ff=True, ff=None, mol2=False, force_ff_assign=False): """Calculates the internal energy of the AMPAL object. This method is assigned to the buff_internal_energy property, using the default arguments. Parameters --...
[ "def", "get_internal_energy", "(", "self", ",", "assign_ff", "=", "True", ",", "ff", "=", "None", ",", "mol2", "=", "False", ",", "force_ff_assign", "=", "False", ")", ":", "if", "not", "ff", ":", "ff", "=", "global_settings", "[", "'buff'", "]", "[", ...
Calculates the internal energy of the AMPAL object. This method is assigned to the buff_internal_energy property, using the default arguments. Parameters ---------- assign_ff: bool, optional If true the force field will be updated if required. ff: BuffForceF...
[ "Calculates", "the", "internal", "energy", "of", "the", "AMPAL", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L253-L284
train
59,861
woolfson-group/isambard
isambard/ampal/base_ampal.py
BaseAmpal.rotate
def rotate(self, angle, axis, point=None, radians=False, inc_alt_states=True): """Rotates every atom in the AMPAL object. Parameters ---------- angle : float Angle that AMPAL object will be rotated. axis : 3D Vector (tuple, list, numpy.array) Axis about w...
python
def rotate(self, angle, axis, point=None, radians=False, inc_alt_states=True): """Rotates every atom in the AMPAL object. Parameters ---------- angle : float Angle that AMPAL object will be rotated. axis : 3D Vector (tuple, list, numpy.array) Axis about w...
[ "def", "rotate", "(", "self", ",", "angle", ",", "axis", ",", "point", "=", "None", ",", "radians", "=", "False", ",", "inc_alt_states", "=", "True", ")", ":", "q", "=", "Quaternion", ".", "angle_and_axis", "(", "angle", "=", "angle", ",", "axis", "=...
Rotates every atom in the AMPAL object. Parameters ---------- angle : float Angle that AMPAL object will be rotated. axis : 3D Vector (tuple, list, numpy.array) Axis about which the AMPAL object will be rotated. point : 3D Vector (tuple, list, numpy.array...
[ "Rotates", "every", "atom", "in", "the", "AMPAL", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L288-L308
train
59,862
woolfson-group/isambard
isambard/ampal/base_ampal.py
BaseAmpal.translate
def translate(self, vector, inc_alt_states=True): """Translates every atom in the AMPAL object. Parameters ---------- vector : 3D Vector (tuple, list, numpy.array) Vector used for translation. inc_alt_states : bool, optional If true, will rotate atoms in ...
python
def translate(self, vector, inc_alt_states=True): """Translates every atom in the AMPAL object. Parameters ---------- vector : 3D Vector (tuple, list, numpy.array) Vector used for translation. inc_alt_states : bool, optional If true, will rotate atoms in ...
[ "def", "translate", "(", "self", ",", "vector", ",", "inc_alt_states", "=", "True", ")", ":", "vector", "=", "numpy", ".", "array", "(", "vector", ")", "for", "atom", "in", "self", ".", "get_atoms", "(", "inc_alt_states", "=", "inc_alt_states", ")", ":",...
Translates every atom in the AMPAL object. Parameters ---------- vector : 3D Vector (tuple, list, numpy.array) Vector used for translation. inc_alt_states : bool, optional If true, will rotate atoms in all states i.e. includes alternate conformations ...
[ "Translates", "every", "atom", "in", "the", "AMPAL", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L310-L324
train
59,863
woolfson-group/isambard
isambard/ampal/base_ampal.py
BaseAmpal.rmsd
def rmsd(self, other, backbone=False): """Calculates the RMSD between two AMPAL objects. Notes ----- No fitting operation is performs and both AMPAL objects must have the same number of atoms. Parameters ---------- other : AMPAL Object Any AM...
python
def rmsd(self, other, backbone=False): """Calculates the RMSD between two AMPAL objects. Notes ----- No fitting operation is performs and both AMPAL objects must have the same number of atoms. Parameters ---------- other : AMPAL Object Any AM...
[ "def", "rmsd", "(", "self", ",", "other", ",", "backbone", "=", "False", ")", ":", "assert", "type", "(", "self", ")", "==", "type", "(", "other", ")", "if", "backbone", "and", "hasattr", "(", "self", ",", "'backbone'", ")", ":", "points1", "=", "s...
Calculates the RMSD between two AMPAL objects. Notes ----- No fitting operation is performs and both AMPAL objects must have the same number of atoms. Parameters ---------- other : AMPAL Object Any AMPAL object with `get_atoms` method. backbo...
[ "Calculates", "the", "RMSD", "between", "two", "AMPAL", "objects", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L326-L350
train
59,864
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.append
def append(self, item): """Appends a `Monomer to the `Polymer`. Notes ----- Does not update labelling. """ if isinstance(item, Monomer): self._monomers.append(item) else: raise TypeError( 'Only Monomer objects can be append...
python
def append(self, item): """Appends a `Monomer to the `Polymer`. Notes ----- Does not update labelling. """ if isinstance(item, Monomer): self._monomers.append(item) else: raise TypeError( 'Only Monomer objects can be append...
[ "def", "append", "(", "self", ",", "item", ")", ":", "if", "isinstance", "(", "item", ",", "Monomer", ")", ":", "self", ".", "_monomers", ".", "append", "(", "item", ")", "else", ":", "raise", "TypeError", "(", "'Only Monomer objects can be appended to an Po...
Appends a `Monomer to the `Polymer`. Notes ----- Does not update labelling.
[ "Appends", "a", "Monomer", "to", "the", "Polymer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L449-L461
train
59,865
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.extend
def extend(self, polymer): """Extends the `Polymer` with the contents of another `Polymer`. Notes ----- Does not update labelling. """ if isinstance(polymer, Polymer): self._monomers.extend(polymer) else: raise TypeError( '...
python
def extend(self, polymer): """Extends the `Polymer` with the contents of another `Polymer`. Notes ----- Does not update labelling. """ if isinstance(polymer, Polymer): self._monomers.extend(polymer) else: raise TypeError( '...
[ "def", "extend", "(", "self", ",", "polymer", ")", ":", "if", "isinstance", "(", "polymer", ",", "Polymer", ")", ":", "self", ".", "_monomers", ".", "extend", "(", "polymer", ")", "else", ":", "raise", "TypeError", "(", "'Only Polymer objects may be merged w...
Extends the `Polymer` with the contents of another `Polymer`. Notes ----- Does not update labelling.
[ "Extends", "the", "Polymer", "with", "the", "contents", "of", "another", "Polymer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L463-L475
train
59,866
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.get_monomers
def get_monomers(self, ligands=True): """Retrieves all the `Monomers` from the AMPAL object. Parameters ---------- ligands : bool, optional If true, will include ligand `Monomers`. """ if ligands and self.ligands: monomers = self._monomers + self....
python
def get_monomers(self, ligands=True): """Retrieves all the `Monomers` from the AMPAL object. Parameters ---------- ligands : bool, optional If true, will include ligand `Monomers`. """ if ligands and self.ligands: monomers = self._monomers + self....
[ "def", "get_monomers", "(", "self", ",", "ligands", "=", "True", ")", ":", "if", "ligands", "and", "self", ".", "ligands", ":", "monomers", "=", "self", ".", "_monomers", "+", "self", ".", "ligands", ".", "_monomers", "else", ":", "monomers", "=", "sel...
Retrieves all the `Monomers` from the AMPAL object. Parameters ---------- ligands : bool, optional If true, will include ligand `Monomers`.
[ "Retrieves", "all", "the", "Monomers", "from", "the", "AMPAL", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L477-L489
train
59,867
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.get_atoms
def get_atoms(self, ligands=True, inc_alt_states=False): """Flat list of all the Atoms in the Polymer. Parameters ---------- inc_alt_states : bool If true atoms from alternate conformations are included rather than only the "active" states. Returns ...
python
def get_atoms(self, ligands=True, inc_alt_states=False): """Flat list of all the Atoms in the Polymer. Parameters ---------- inc_alt_states : bool If true atoms from alternate conformations are included rather than only the "active" states. Returns ...
[ "def", "get_atoms", "(", "self", ",", "ligands", "=", "True", ",", "inc_alt_states", "=", "False", ")", ":", "if", "ligands", "and", "self", ".", "ligands", ":", "monomers", "=", "self", ".", "_monomers", "+", "self", ".", "ligands", ".", "_monomers", ...
Flat list of all the Atoms in the Polymer. Parameters ---------- inc_alt_states : bool If true atoms from alternate conformations are included rather than only the "active" states. Returns ------- atoms : itertools.chain Returns an it...
[ "Flat", "list", "of", "all", "the", "Atoms", "in", "the", "Polymer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L491-L512
train
59,868
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.relabel_monomers
def relabel_monomers(self, labels=None): """Relabels the either in numerically or using a list of labels. Parameters ---------- labels : list, optional A list of new labels. Raises ------ ValueError Raised if the number of labels does not...
python
def relabel_monomers(self, labels=None): """Relabels the either in numerically or using a list of labels. Parameters ---------- labels : list, optional A list of new labels. Raises ------ ValueError Raised if the number of labels does not...
[ "def", "relabel_monomers", "(", "self", ",", "labels", "=", "None", ")", ":", "if", "labels", ":", "if", "len", "(", "self", ".", "_monomers", ")", "==", "len", "(", "labels", ")", ":", "for", "monomer", ",", "label", "in", "zip", "(", "self", ".",...
Relabels the either in numerically or using a list of labels. Parameters ---------- labels : list, optional A list of new labels. Raises ------ ValueError Raised if the number of labels does not match the number of component Monoer ob...
[ "Relabels", "the", "either", "in", "numerically", "or", "using", "a", "list", "of", "labels", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L514-L541
train
59,869
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.relabel_atoms
def relabel_atoms(self, start=1): """Relabels all `Atoms` in numerical order. Parameters ---------- start : int, optional Offset the labelling by `start` residues. """ counter = start for atom in self.get_atoms(): atom.id = counter ...
python
def relabel_atoms(self, start=1): """Relabels all `Atoms` in numerical order. Parameters ---------- start : int, optional Offset the labelling by `start` residues. """ counter = start for atom in self.get_atoms(): atom.id = counter ...
[ "def", "relabel_atoms", "(", "self", ",", "start", "=", "1", ")", ":", "counter", "=", "start", "for", "atom", "in", "self", ".", "get_atoms", "(", ")", ":", "atom", ".", "id", "=", "counter", "counter", "+=", "1", "return" ]
Relabels all `Atoms` in numerical order. Parameters ---------- start : int, optional Offset the labelling by `start` residues.
[ "Relabels", "all", "Atoms", "in", "numerical", "order", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L543-L555
train
59,870
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.make_pdb
def make_pdb(self, alt_states=False, inc_ligands=True): """Generates a PDB string for the `Polymer`. Parameters ---------- alt_states : bool, optional Include alternate conformations for `Monomers` in PDB. inc_ligands : bool, optional Includes `Ligands` i...
python
def make_pdb(self, alt_states=False, inc_ligands=True): """Generates a PDB string for the `Polymer`. Parameters ---------- alt_states : bool, optional Include alternate conformations for `Monomers` in PDB. inc_ligands : bool, optional Includes `Ligands` i...
[ "def", "make_pdb", "(", "self", ",", "alt_states", "=", "False", ",", "inc_ligands", "=", "True", ")", ":", "if", "any", "(", "[", "False", "if", "x", ".", "id", "else", "True", "for", "x", "in", "self", ".", "_monomers", "]", ")", ":", "self", "...
Generates a PDB string for the `Polymer`. Parameters ---------- alt_states : bool, optional Include alternate conformations for `Monomers` in PDB. inc_ligands : bool, optional Includes `Ligands` in PDB. Returns ------- pdb_str : str ...
[ "Generates", "a", "PDB", "string", "for", "the", "Polymer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L563-L586
train
59,871
woolfson-group/isambard
isambard/ampal/base_ampal.py
Atom.rotate
def rotate(self, angle, axis, point=None, radians=False): """Rotates `Atom` by `angle`. Parameters ---------- angle : float Angle that `Atom` will be rotated. axis : 3D Vector (tuple, list, numpy.array) Axis about which the `Atom` will be rotated. ...
python
def rotate(self, angle, axis, point=None, radians=False): """Rotates `Atom` by `angle`. Parameters ---------- angle : float Angle that `Atom` will be rotated. axis : 3D Vector (tuple, list, numpy.array) Axis about which the `Atom` will be rotated. ...
[ "def", "rotate", "(", "self", ",", "angle", ",", "axis", ",", "point", "=", "None", ",", "radians", "=", "False", ")", ":", "q", "=", "Quaternion", ".", "angle_and_axis", "(", "angle", "=", "angle", ",", "axis", "=", "axis", ",", "radians", "=", "r...
Rotates `Atom` by `angle`. Parameters ---------- angle : float Angle that `Atom` will be rotated. axis : 3D Vector (tuple, list, numpy.array) Axis about which the `Atom` will be rotated. point : 3D Vector (tuple, list, numpy.array), optional P...
[ "Rotates", "Atom", "by", "angle", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L865-L881
train
59,872
woolfson-group/isambard
isambard/tools/file_parsing.py
dict_from_mmcif
def dict_from_mmcif(mmcif, path=True): """Parse mmcif file into a dictionary. Notes ----- Full list of keys/value types, and further information on them can be viewed here: http://mmcif.wwpdb.org/docs/pdb_to_pdbx_correspondences.html All values in the returned dict are str or list(str)....
python
def dict_from_mmcif(mmcif, path=True): """Parse mmcif file into a dictionary. Notes ----- Full list of keys/value types, and further information on them can be viewed here: http://mmcif.wwpdb.org/docs/pdb_to_pdbx_correspondences.html All values in the returned dict are str or list(str)....
[ "def", "dict_from_mmcif", "(", "mmcif", ",", "path", "=", "True", ")", ":", "if", "path", ":", "with", "open", "(", "mmcif", ",", "'r'", ")", "as", "foo", ":", "lines", "=", "foo", ".", "readlines", "(", ")", "else", ":", "lines", "=", "mmcif", "...
Parse mmcif file into a dictionary. Notes ----- Full list of keys/value types, and further information on them can be viewed here: http://mmcif.wwpdb.org/docs/pdb_to_pdbx_correspondences.html All values in the returned dict are str or list(str). This means that some of the data values a...
[ "Parse", "mmcif", "file", "into", "a", "dictionary", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/file_parsing.py#L9-L155
train
59,873
woolfson-group/isambard
isambard/tools/file_parsing.py
get_protein_dict
def get_protein_dict(cif_data): """ Parse cif_data dict for a subset of its data. Notes ----- cif_data dict contains all the data from the .cif file, with values as strings. This function returns a more 'human readable' dictionary of key-value pairs. The keys have simpler (and still often more ...
python
def get_protein_dict(cif_data): """ Parse cif_data dict for a subset of its data. Notes ----- cif_data dict contains all the data from the .cif file, with values as strings. This function returns a more 'human readable' dictionary of key-value pairs. The keys have simpler (and still often more ...
[ "def", "get_protein_dict", "(", "cif_data", ")", ":", "# Dictionary relating the keys of protein_dict (column names in Protein model) to the keys of cif_data.", "mmcif_data_names", "=", "{", "'keywords'", ":", "'_struct_keywords.text'", ",", "'header'", ":", "'_struct_keywords.pdbx_k...
Parse cif_data dict for a subset of its data. Notes ----- cif_data dict contains all the data from the .cif file, with values as strings. This function returns a more 'human readable' dictionary of key-value pairs. The keys have simpler (and still often more descriptive!) names, and the values are ...
[ "Parse", "cif_data", "dict", "for", "a", "subset", "of", "its", "data", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/file_parsing.py#L158-L277
train
59,874
woolfson-group/isambard
isambard/tools/file_parsing.py
parse_PISCES_output
def parse_PISCES_output(pisces_output, path=False): """ Takes the output list of a PISCES cull and returns in a usable dictionary. Notes ----- Designed for outputs of protein sequence redundancy culls conducted using the PISCES server. http://dunbrack.fccc.edu/PISCES.php G. Wang and R. L. Dunbr...
python
def parse_PISCES_output(pisces_output, path=False): """ Takes the output list of a PISCES cull and returns in a usable dictionary. Notes ----- Designed for outputs of protein sequence redundancy culls conducted using the PISCES server. http://dunbrack.fccc.edu/PISCES.php G. Wang and R. L. Dunbr...
[ "def", "parse_PISCES_output", "(", "pisces_output", ",", "path", "=", "False", ")", ":", "pisces_dict", "=", "{", "}", "if", "path", ":", "pisces_path", "=", "Path", "(", "pisces_output", ")", "pisces_content", "=", "pisces_path", ".", "read_text", "(", ")",...
Takes the output list of a PISCES cull and returns in a usable dictionary. Notes ----- Designed for outputs of protein sequence redundancy culls conducted using the PISCES server. http://dunbrack.fccc.edu/PISCES.php G. Wang and R. L. Dunbrack, Jr. PISCES: a protein sequence culling server. Bioinfor...
[ "Takes", "the", "output", "list", "of", "a", "PISCES", "cull", "and", "returns", "in", "a", "usable", "dictionary", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/file_parsing.py#L300-L340
train
59,875
woolfson-group/isambard
isambard/tools/file_parsing.py
download_decode
def download_decode(URL, encoding='utf-8', verbose=True): """ Downloads data from URL and returns decoded contents.""" if verbose: print("Downloading data from " + URL) req = Request(URL) try: with urlopen(req) as u: decoded_file = u.read().decode(encoding) except URLErro...
python
def download_decode(URL, encoding='utf-8', verbose=True): """ Downloads data from URL and returns decoded contents.""" if verbose: print("Downloading data from " + URL) req = Request(URL) try: with urlopen(req) as u: decoded_file = u.read().decode(encoding) except URLErro...
[ "def", "download_decode", "(", "URL", ",", "encoding", "=", "'utf-8'", ",", "verbose", "=", "True", ")", ":", "if", "verbose", ":", "print", "(", "\"Downloading data from \"", "+", "URL", ")", "req", "=", "Request", "(", "URL", ")", "try", ":", "with", ...
Downloads data from URL and returns decoded contents.
[ "Downloads", "data", "from", "URL", "and", "returns", "decoded", "contents", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/file_parsing.py#L343-L359
train
59,876
woolfson-group/isambard
isambard/tools/file_parsing.py
olderado_best_model
def olderado_best_model(pdb_id): """ Checks the Olderado web server and returns the most representative conformation for PDB NMR structures. Notes ----- Uses OLDERADO from the EBI. See http://www.ebi.ac.uk/pdbe/nmr/olderado/ and citations therein. Parameters ---------- pdb_id : str ...
python
def olderado_best_model(pdb_id): """ Checks the Olderado web server and returns the most representative conformation for PDB NMR structures. Notes ----- Uses OLDERADO from the EBI. See http://www.ebi.ac.uk/pdbe/nmr/olderado/ and citations therein. Parameters ---------- pdb_id : str ...
[ "def", "olderado_best_model", "(", "pdb_id", ")", ":", "pdb_code", "=", "pdb_id", "[", ":", "4", "]", ".", "lower", "(", ")", "olderado_url", "=", "'http://www.ebi.ac.uk/pdbe/nmr/olderado/searchEntry?pdbCode='", "+", "pdb_code", "olderado_page", "=", "download_decode"...
Checks the Olderado web server and returns the most representative conformation for PDB NMR structures. Notes ----- Uses OLDERADO from the EBI. See http://www.ebi.ac.uk/pdbe/nmr/olderado/ and citations therein. Parameters ---------- pdb_id : str The 4-character PDB code for the NMR...
[ "Checks", "the", "Olderado", "web", "server", "and", "returns", "the", "most", "representative", "conformation", "for", "PDB", "NMR", "structures", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/file_parsing.py#L362-L402
train
59,877
woolfson-group/isambard
isambard/optimisation/optimizer.py
buff_eval
def buff_eval(params): """Builds and evaluates BUFF energy of model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence, and the parameters for model building. Returns ------- model.bude_score: float BUF...
python
def buff_eval(params): """Builds and evaluates BUFF energy of model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence, and the parameters for model building. Returns ------- model.bude_score: float BUF...
[ "def", "buff_eval", "(", "params", ")", ":", "specification", ",", "sequence", ",", "parsed_ind", "=", "params", "model", "=", "specification", "(", "*", "parsed_ind", ")", "model", ".", "build", "(", ")", "model", ".", "pack_new_sequences", "(", "sequence",...
Builds and evaluates BUFF energy of model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence, and the parameters for model building. Returns ------- model.bude_score: float BUFF score for model to be assign...
[ "Builds", "and", "evaluates", "BUFF", "energy", "of", "model", "in", "parallelization" ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L26-L44
train
59,878
woolfson-group/isambard
isambard/optimisation/optimizer.py
buff_internal_eval
def buff_internal_eval(params): """Builds and evaluates BUFF internal energy of a model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence and the parameters for model building. Returns ------- model.bude_score...
python
def buff_internal_eval(params): """Builds and evaluates BUFF internal energy of a model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence and the parameters for model building. Returns ------- model.bude_score...
[ "def", "buff_internal_eval", "(", "params", ")", ":", "specification", ",", "sequence", ",", "parsed_ind", "=", "params", "model", "=", "specification", "(", "*", "parsed_ind", ")", "model", ".", "build", "(", ")", "model", ".", "pack_new_sequences", "(", "s...
Builds and evaluates BUFF internal energy of a model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence and the parameters for model building. Returns ------- model.bude_score: float BUFF internal energy sc...
[ "Builds", "and", "evaluates", "BUFF", "internal", "energy", "of", "a", "model", "in", "parallelization" ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L47-L67
train
59,879
woolfson-group/isambard
isambard/optimisation/optimizer.py
rmsd_eval
def rmsd_eval(rmsd_params): """Builds a model and runs profit against a reference model. Parameters ---------- rmsd_params Returns ------- rmsd: float rmsd against reference model as calculated by profit. """ specification, sequence, parsed_ind, reference_pdb = rmsd_params ...
python
def rmsd_eval(rmsd_params): """Builds a model and runs profit against a reference model. Parameters ---------- rmsd_params Returns ------- rmsd: float rmsd against reference model as calculated by profit. """ specification, sequence, parsed_ind, reference_pdb = rmsd_params ...
[ "def", "rmsd_eval", "(", "rmsd_params", ")", ":", "specification", ",", "sequence", ",", "parsed_ind", ",", "reference_pdb", "=", "rmsd_params", "model", "=", "specification", "(", "*", "parsed_ind", ")", "model", ".", "pack_new_sequences", "(", "sequence", ")",...
Builds a model and runs profit against a reference model. Parameters ---------- rmsd_params Returns ------- rmsd: float rmsd against reference model as calculated by profit.
[ "Builds", "a", "model", "and", "runs", "profit", "against", "a", "reference", "model", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L70-L86
train
59,880
woolfson-group/isambard
isambard/optimisation/optimizer.py
comparator_eval
def comparator_eval(comparator_params): """Gets BUFF score for interaction between two AMPAL objects """ top1, top2, params1, params2, seq1, seq2, movements = comparator_params xrot, yrot, zrot, xtrans, ytrans, ztrans = movements obj1 = top1(*params1) obj2 = top2(*params2) obj2.rotate(xrot, ...
python
def comparator_eval(comparator_params): """Gets BUFF score for interaction between two AMPAL objects """ top1, top2, params1, params2, seq1, seq2, movements = comparator_params xrot, yrot, zrot, xtrans, ytrans, ztrans = movements obj1 = top1(*params1) obj2 = top2(*params2) obj2.rotate(xrot, ...
[ "def", "comparator_eval", "(", "comparator_params", ")", ":", "top1", ",", "top2", ",", "params1", ",", "params2", ",", "seq1", ",", "seq2", ",", "movements", "=", "comparator_params", "xrot", ",", "yrot", ",", "zrot", ",", "xtrans", ",", "ytrans", ",", ...
Gets BUFF score for interaction between two AMPAL objects
[ "Gets", "BUFF", "score", "for", "interaction", "between", "two", "AMPAL", "objects" ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L89-L103
train
59,881
woolfson-group/isambard
isambard/optimisation/optimizer.py
BaseOptimizer.parameters
def parameters(self, sequence, value_means, value_ranges, arrangement): """Relates the individual to be evolved to the full parameter string. Parameters ---------- sequence: str Full amino acid sequence for specification object to be optimized. Must be equal to t...
python
def parameters(self, sequence, value_means, value_ranges, arrangement): """Relates the individual to be evolved to the full parameter string. Parameters ---------- sequence: str Full amino acid sequence for specification object to be optimized. Must be equal to t...
[ "def", "parameters", "(", "self", ",", "sequence", ",", "value_means", ",", "value_ranges", ",", "arrangement", ")", ":", "self", ".", "_params", "[", "'sequence'", "]", "=", "sequence", "self", ".", "_params", "[", "'value_means'", "]", "=", "value_means", ...
Relates the individual to be evolved to the full parameter string. Parameters ---------- sequence: str Full amino acid sequence for specification object to be optimized. Must be equal to the number of residues in the model. value_means: list ...
[ "Relates", "the", "individual", "to", "be", "evolved", "to", "the", "full", "parameter", "string", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L205-L242
train
59,882
woolfson-group/isambard
isambard/optimisation/optimizer.py
BaseScore.make_energy_funnel_data
def make_energy_funnel_data(self, cores=1): """Compares models created during the minimisation to the best model. Returns ------- energy_rmsd_gen: [(float, float, int)] A list of triples containing the BUFF score, RMSD to the top model and generation of a model g...
python
def make_energy_funnel_data(self, cores=1): """Compares models created during the minimisation to the best model. Returns ------- energy_rmsd_gen: [(float, float, int)] A list of triples containing the BUFF score, RMSD to the top model and generation of a model g...
[ "def", "make_energy_funnel_data", "(", "self", ",", "cores", "=", "1", ")", ":", "if", "not", "self", ".", "parameter_log", ":", "raise", "AttributeError", "(", "'No parameter log data to make funnel, have you ran the '", "'optimiser?'", ")", "model_cls", "=", "self",...
Compares models created during the minimisation to the best model. Returns ------- energy_rmsd_gen: [(float, float, int)] A list of triples containing the BUFF score, RMSD to the top model and generation of a model generated during the minimisation.
[ "Compares", "models", "created", "during", "the", "minimisation", "to", "the", "best", "model", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L348-L382
train
59,883
woolfson-group/isambard
isambard/optimisation/optimizer.py
BaseScore.funnel_rebuild
def funnel_rebuild(psg_trm_spec): """Rebuilds a model and compares it to a reference model. Parameters ---------- psg_trm: (([float], float, int), AMPAL, specification) A tuple containing the parameters, score and generation for a model as well as a model of the ...
python
def funnel_rebuild(psg_trm_spec): """Rebuilds a model and compares it to a reference model. Parameters ---------- psg_trm: (([float], float, int), AMPAL, specification) A tuple containing the parameters, score and generation for a model as well as a model of the ...
[ "def", "funnel_rebuild", "(", "psg_trm_spec", ")", ":", "param_score_gen", ",", "top_result_model", ",", "specification", "=", "psg_trm_spec", "params", ",", "score", ",", "gen", "=", "param_score_gen", "model", "=", "specification", "(", "*", "params", ")", "rm...
Rebuilds a model and compares it to a reference model. Parameters ---------- psg_trm: (([float], float, int), AMPAL, specification) A tuple containing the parameters, score and generation for a model as well as a model of the best scoring parameters. Returns ...
[ "Rebuilds", "a", "model", "and", "compares", "it", "to", "a", "reference", "model", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L385-L404
train
59,884
woolfson-group/isambard
isambard/optimisation/optimizer.py
OptDE.update_pop
def update_pop(self): """Updates the population according to crossover and fitness criteria. """ candidates = [] for ind in self.population: candidates.append(self.crossover(ind)) self._params['model_count'] += len(candidates) self.assign_fitnesses(candidates)...
python
def update_pop(self): """Updates the population according to crossover and fitness criteria. """ candidates = [] for ind in self.population: candidates.append(self.crossover(ind)) self._params['model_count'] += len(candidates) self.assign_fitnesses(candidates)...
[ "def", "update_pop", "(", "self", ")", ":", "candidates", "=", "[", "]", "for", "ind", "in", "self", ".", "population", ":", "candidates", ".", "append", "(", "self", ".", "crossover", "(", "ind", ")", ")", "self", ".", "_params", "[", "'model_count'",...
Updates the population according to crossover and fitness criteria.
[ "Updates", "the", "population", "according", "to", "crossover", "and", "fitness", "criteria", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L607-L617
train
59,885
woolfson-group/isambard
isambard/optimisation/optimizer.py
OptPSO.initialize_pop
def initialize_pop(self): """Generates initial population with random positions and speeds.""" self.population = self.toolbox.swarm(n=self._params['popsize']) if self._params['neighbours']: for i in range(len(self.population)): self.population[i].ident = i ...
python
def initialize_pop(self): """Generates initial population with random positions and speeds.""" self.population = self.toolbox.swarm(n=self._params['popsize']) if self._params['neighbours']: for i in range(len(self.population)): self.population[i].ident = i ...
[ "def", "initialize_pop", "(", "self", ")", ":", "self", ".", "population", "=", "self", ".", "toolbox", ".", "swarm", "(", "n", "=", "self", ".", "_params", "[", "'popsize'", "]", ")", "if", "self", ".", "_params", "[", "'neighbours'", "]", ":", "for...
Generates initial population with random positions and speeds.
[ "Generates", "initial", "population", "with", "random", "positions", "and", "speeds", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L647-L669
train
59,886
woolfson-group/isambard
isambard/optimisation/optimizer.py
OptGA.initialize_pop
def initialize_pop(self): """Assigns initial fitnesses.""" self.toolbox.register("individual", self.generate) self.toolbox.register("population", tools.initRepeat, list, self.toolbox.individual) self.population = self.toolbox.population(n=self._params['popsi...
python
def initialize_pop(self): """Assigns initial fitnesses.""" self.toolbox.register("individual", self.generate) self.toolbox.register("population", tools.initRepeat, list, self.toolbox.individual) self.population = self.toolbox.population(n=self._params['popsi...
[ "def", "initialize_pop", "(", "self", ")", ":", "self", ".", "toolbox", ".", "register", "(", "\"individual\"", ",", "self", ".", "generate", ")", "self", ".", "toolbox", ".", "register", "(", "\"population\"", ",", "tools", ".", "initRepeat", ",", "list",...
Assigns initial fitnesses.
[ "Assigns", "initial", "fitnesses", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L792-L799
train
59,887
woolfson-group/isambard
isambard/optimisation/mmc_optimizer.py
MMCParameter.randomise_proposed_value
def randomise_proposed_value(self): """Creates a randomly the proposed value. Raises ------ TypeError Raised if this method is called on a static value. TypeError Raised if the parameter type is unknown. """ if self.parameter_type is MMCPa...
python
def randomise_proposed_value(self): """Creates a randomly the proposed value. Raises ------ TypeError Raised if this method is called on a static value. TypeError Raised if the parameter type is unknown. """ if self.parameter_type is MMCPa...
[ "def", "randomise_proposed_value", "(", "self", ")", ":", "if", "self", ".", "parameter_type", "is", "MMCParameterType", ".", "UNIFORM_DIST", ":", "(", "a", ",", "b", ")", "=", "self", ".", "static_dist_or_list", "self", ".", "proposed_value", "=", "random", ...
Creates a randomly the proposed value. Raises ------ TypeError Raised if this method is called on a static value. TypeError Raised if the parameter type is unknown.
[ "Creates", "a", "randomly", "the", "proposed", "value", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/mmc_optimizer.py#L87-L114
train
59,888
woolfson-group/isambard
isambard/optimisation/mmc_optimizer.py
MMCParameter.accept_proposed_value
def accept_proposed_value(self): """Changes the current value to the proposed value.""" if self.proposed_value is not None: self.current_value = self.proposed_value self.proposed_value = None return
python
def accept_proposed_value(self): """Changes the current value to the proposed value.""" if self.proposed_value is not None: self.current_value = self.proposed_value self.proposed_value = None return
[ "def", "accept_proposed_value", "(", "self", ")", ":", "if", "self", ".", "proposed_value", "is", "not", "None", ":", "self", ".", "current_value", "=", "self", ".", "proposed_value", "self", ".", "proposed_value", "=", "None", "return" ]
Changes the current value to the proposed value.
[ "Changes", "the", "current", "value", "to", "the", "proposed", "value", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/mmc_optimizer.py#L116-L121
train
59,889
woolfson-group/isambard
isambard/optimisation/mmc_optimizer.py
MMCParameterOptimisation.start_optimisation
def start_optimisation(self, rounds, temp=298.15): """Begin the optimisation run. Parameters ---------- rounds : int The number of rounds of optimisation to perform. temp : float, optional The temperature (in K) used during the optimisation. """ ...
python
def start_optimisation(self, rounds, temp=298.15): """Begin the optimisation run. Parameters ---------- rounds : int The number of rounds of optimisation to perform. temp : float, optional The temperature (in K) used during the optimisation. """ ...
[ "def", "start_optimisation", "(", "self", ",", "rounds", ",", "temp", "=", "298.15", ")", ":", "self", ".", "_generate_initial_model", "(", ")", "self", ".", "_mmc_loop", "(", "rounds", ",", "temp", "=", "temp", ")", "return" ]
Begin the optimisation run. Parameters ---------- rounds : int The number of rounds of optimisation to perform. temp : float, optional The temperature (in K) used during the optimisation.
[ "Begin", "the", "optimisation", "run", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/mmc_optimizer.py#L194-L206
train
59,890
woolfson-group/isambard
isambard/optimisation/mmc_optimizer.py
MMCParameterOptimisation._generate_initial_model
def _generate_initial_model(self): """Creates the initial model for the optimistation. Raises ------ TypeError Raised if the model failed to build. This could be due to parameters being passed to the specification in the wrong format. """ ...
python
def _generate_initial_model(self): """Creates the initial model for the optimistation. Raises ------ TypeError Raised if the model failed to build. This could be due to parameters being passed to the specification in the wrong format. """ ...
[ "def", "_generate_initial_model", "(", "self", ")", ":", "initial_parameters", "=", "[", "p", ".", "current_value", "for", "p", "in", "self", ".", "current_parameters", "]", "try", ":", "initial_model", "=", "self", ".", "specification", "(", "*", "initial_par...
Creates the initial model for the optimistation. Raises ------ TypeError Raised if the model failed to build. This could be due to parameters being passed to the specification in the wrong format.
[ "Creates", "the", "initial", "model", "for", "the", "optimistation", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/mmc_optimizer.py#L208-L231
train
59,891
woolfson-group/isambard
isambard/optimisation/mmc_optimizer.py
MMCParameterOptimisation._mmc_loop
def _mmc_loop(self, rounds, temp=298.15, verbose=True): """The main MMC loop. Parameters ---------- rounds : int The number of rounds of optimisation to perform. temp : float, optional The temperature (in K) used during the optimisation. verbose :...
python
def _mmc_loop(self, rounds, temp=298.15, verbose=True): """The main MMC loop. Parameters ---------- rounds : int The number of rounds of optimisation to perform. temp : float, optional The temperature (in K) used during the optimisation. verbose :...
[ "def", "_mmc_loop", "(", "self", ",", "rounds", ",", "temp", "=", "298.15", ",", "verbose", "=", "True", ")", ":", "# TODO add weighted randomisation of altered variable", "current_round", "=", "0", "while", "current_round", "<", "rounds", ":", "modifiable", "=", ...
The main MMC loop. Parameters ---------- rounds : int The number of rounds of optimisation to perform. temp : float, optional The temperature (in K) used during the optimisation. verbose : bool, optional If true, prints information about the r...
[ "The", "main", "MMC", "loop", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/mmc_optimizer.py#L233-L289
train
59,892
woolfson-group/isambard
isambard/optimisation/evo_optimizers.py
DE._crossover
def _crossover(self, ind): """Used by the evolution process to generate a new individual. Notes ----- This is a tweaked version of the classical DE crossover algorithm, the main difference that candidate parameters are generated using a lognormal distribution. Bound hand...
python
def _crossover(self, ind): """Used by the evolution process to generate a new individual. Notes ----- This is a tweaked version of the classical DE crossover algorithm, the main difference that candidate parameters are generated using a lognormal distribution. Bound hand...
[ "def", "_crossover", "(", "self", ",", "ind", ")", ":", "if", "self", ".", "neighbours", ":", "a", ",", "b", ",", "c", "=", "random", ".", "sample", "(", "[", "self", ".", "population", "[", "i", "]", "for", "i", "in", "ind", ".", "neighbours", ...
Used by the evolution process to generate a new individual. Notes ----- This is a tweaked version of the classical DE crossover algorithm, the main difference that candidate parameters are generated using a lognormal distribution. Bound handling is achieved by resampling...
[ "Used", "by", "the", "evolution", "process", "to", "generate", "a", "new", "individual", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/evo_optimizers.py#L98-L141
train
59,893
woolfson-group/isambard
isambard/optimisation/evo_optimizers.py
PSO._generate
def _generate(self): """Generates a particle using the creator function. Notes ----- Position and speed are uniformly randomly seeded within allowed bounds. The particle also has speed limit settings taken from global values. Returns ------- part...
python
def _generate(self): """Generates a particle using the creator function. Notes ----- Position and speed are uniformly randomly seeded within allowed bounds. The particle also has speed limit settings taken from global values. Returns ------- part...
[ "def", "_generate", "(", "self", ")", ":", "part", "=", "creator", ".", "Particle", "(", "[", "random", ".", "uniform", "(", "-", "1", ",", "1", ")", "for", "_", "in", "range", "(", "len", "(", "self", ".", "value_means", ")", ")", "]", ")", "p...
Generates a particle using the creator function. Notes ----- Position and speed are uniformly randomly seeded within allowed bounds. The particle also has speed limit settings taken from global values. Returns ------- part : particle object A...
[ "Generates", "a", "particle", "using", "the", "creator", "function", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/evo_optimizers.py#L233-L257
train
59,894
woolfson-group/isambard
isambard/optimisation/evo_optimizers.py
PSO.update_particle
def update_particle(self, part, chi=0.729843788, c=2.05): """Constriction factor update particle method. Notes ----- Looks for a list of neighbours attached to a particle and uses the particle's best position and that of the best neighbour. """ neighbour_...
python
def update_particle(self, part, chi=0.729843788, c=2.05): """Constriction factor update particle method. Notes ----- Looks for a list of neighbours attached to a particle and uses the particle's best position and that of the best neighbour. """ neighbour_...
[ "def", "update_particle", "(", "self", ",", "part", ",", "chi", "=", "0.729843788", ",", "c", "=", "2.05", ")", ":", "neighbour_pool", "=", "[", "self", ".", "population", "[", "i", "]", "for", "i", "in", "part", ".", "neighbours", "]", "best_neighbour...
Constriction factor update particle method. Notes ----- Looks for a list of neighbours attached to a particle and uses the particle's best position and that of the best neighbour.
[ "Constriction", "factor", "update", "particle", "method", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/evo_optimizers.py#L259-L287
train
59,895
woolfson-group/isambard
isambard/optimisation/evo_optimizers.py
CMAES._make_individual
def _make_individual(self, paramlist): """Makes an individual particle.""" part = creator.Individual(paramlist) part.ident = None return part
python
def _make_individual(self, paramlist): """Makes an individual particle.""" part = creator.Individual(paramlist) part.ident = None return part
[ "def", "_make_individual", "(", "self", ",", "paramlist", ")", ":", "part", "=", "creator", ".", "Individual", "(", "paramlist", ")", "part", ".", "ident", "=", "None", "return", "part" ]
Makes an individual particle.
[ "Makes", "an", "individual", "particle", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/evo_optimizers.py#L494-L498
train
59,896
woolfson-group/isambard
isambard/add_ons/filesystem.py
number_of_mmols
def number_of_mmols(code): """ Number of .mmol files associated with code in the PDBE. Notes ----- This function makes a series of calls to the PDBE website using the requests module. This can make it slow! Parameters ---------- code : str PDB code. Returns ------- num...
python
def number_of_mmols(code): """ Number of .mmol files associated with code in the PDBE. Notes ----- This function makes a series of calls to the PDBE website using the requests module. This can make it slow! Parameters ---------- code : str PDB code. Returns ------- num...
[ "def", "number_of_mmols", "(", "code", ")", ":", "# If num_mmols is already known, return it", "if", "mmols_numbers", ":", "if", "code", "in", "mmols_numbers", ".", "keys", "(", ")", ":", "mmol", "=", "mmols_numbers", "[", "code", "]", "[", "0", "]", "return",...
Number of .mmol files associated with code in the PDBE. Notes ----- This function makes a series of calls to the PDBE website using the requests module. This can make it slow! Parameters ---------- code : str PDB code. Returns ------- num_mmols : int Raises ------...
[ "Number", "of", ".", "mmol", "files", "associated", "with", "code", "in", "the", "PDBE", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L229-L280
train
59,897
woolfson-group/isambard
isambard/add_ons/filesystem.py
get_mmol
def get_mmol(code, mmol_number=None, outfile=None): """ Get mmol file from PDBe and return its content as a string. Write to file if outfile given. Parameters ---------- code : str PDB code. mmol_number : int mmol number (biological assembly number) of file to download. Numbers from...
python
def get_mmol(code, mmol_number=None, outfile=None): """ Get mmol file from PDBe and return its content as a string. Write to file if outfile given. Parameters ---------- code : str PDB code. mmol_number : int mmol number (biological assembly number) of file to download. Numbers from...
[ "def", "get_mmol", "(", "code", ",", "mmol_number", "=", "None", ",", "outfile", "=", "None", ")", ":", "if", "not", "mmol_number", ":", "try", ":", "mmol_number", "=", "preferred_mmol", "(", "code", "=", "code", ")", "except", "(", "ValueError", ",", ...
Get mmol file from PDBe and return its content as a string. Write to file if outfile given. Parameters ---------- code : str PDB code. mmol_number : int mmol number (biological assembly number) of file to download. Numbers from PDBe. If None, defaults to the preferred biological...
[ "Get", "mmol", "file", "from", "PDBe", "and", "return", "its", "content", "as", "a", "string", ".", "Write", "to", "file", "if", "outfile", "given", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L283-L343
train
59,898
woolfson-group/isambard
isambard/add_ons/filesystem.py
get_mmcif
def get_mmcif(code, outfile=None): """ Get mmcif file associated with code from PDBE. Parameters ---------- code : str PDB code. outfile : str Filepath. Writes returned value to this file. Returns ------- mmcif_file : str Filepath to the mmcif file. """ ...
python
def get_mmcif(code, outfile=None): """ Get mmcif file associated with code from PDBE. Parameters ---------- code : str PDB code. outfile : str Filepath. Writes returned value to this file. Returns ------- mmcif_file : str Filepath to the mmcif file. """ ...
[ "def", "get_mmcif", "(", "code", ",", "outfile", "=", "None", ")", ":", "pdbe_url", "=", "\"http://www.ebi.ac.uk/pdbe/entry-files/download/{0}.cif\"", ".", "format", "(", "code", ")", "r", "=", "requests", ".", "get", "(", "pdbe_url", ")", "if", "r", ".", "s...
Get mmcif file associated with code from PDBE. Parameters ---------- code : str PDB code. outfile : str Filepath. Writes returned value to this file. Returns ------- mmcif_file : str Filepath to the mmcif file.
[ "Get", "mmcif", "file", "associated", "with", "code", "from", "PDBE", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L381-L409
train
59,899