repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
read_yaml_config
def read_yaml_config(filename, check=True, osreplace=True, exit=True): """ reads in a yaml file from the specified filename. If check is set to true the code will fail if the file does not exist. However if it is set to false and the file does not exist, None is returned. :param exit: if true is ex...
python
def read_yaml_config(filename, check=True, osreplace=True, exit=True): """ reads in a yaml file from the specified filename. If check is set to true the code will fail if the file does not exist. However if it is set to false and the file does not exist, None is returned. :param exit: if true is ex...
[ "def", "read_yaml_config", "(", "filename", ",", "check", "=", "True", ",", "osreplace", "=", "True", ",", "exit", "=", "True", ")", ":", "location", "=", "filename", "if", "location", "is", "not", "None", ":", "location", "=", "path_expand", "(", "locat...
reads in a yaml file from the specified filename. If check is set to true the code will fail if the file does not exist. However if it is set to false and the file does not exist, None is returned. :param exit: if true is exist with sys exit :param osreplace: if true replaces environment variables from...
[ "reads", "in", "a", "yaml", "file", "from", "the", "specified", "filename", ".", "If", "check", "is", "set", "to", "true", "the", "code", "will", "fail", "if", "the", "file", "does", "not", "exist", ".", "However", "if", "it", "is", "set", "to", "fal...
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L129-L185
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
custom_print
def custom_print(data_structure, indent): """ prints a given data structure such as a dict or ordered dict at a given indentation level :param data_structure: :param indent: :return: """ for key, value in data_structure.items(): print("\n%s%s:" % (' ' * attribute_indent * indent, ...
python
def custom_print(data_structure, indent): """ prints a given data structure such as a dict or ordered dict at a given indentation level :param data_structure: :param indent: :return: """ for key, value in data_structure.items(): print("\n%s%s:" % (' ' * attribute_indent * indent, ...
[ "def", "custom_print", "(", "data_structure", ",", "indent", ")", ":", "for", "key", ",", "value", "in", "data_structure", ".", "items", "(", ")", ":", "print", "(", "\"\\n%s%s:\"", "%", "(", "' '", "*", "attribute_indent", "*", "indent", ",", "str", "("...
prints a given data structure such as a dict or ordered dict at a given indentation level :param data_structure: :param indent: :return:
[ "prints", "a", "given", "data", "structure", "such", "as", "a", "dict", "or", "ordered", "dict", "at", "a", "given", "indentation", "level", ":", "param", "data_structure", ":", ":", "param", "indent", ":", ":", "return", ":" ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L209-L223
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
OrderedJsonEncoder.encode
def encode(self, o, depth=0): """ encode the json object at given depth :param o: the object :param depth: the depth :return: the json encoding """ if isinstance(o, OrderedDict): return "{" + ",\n ".join([self.encode(k) + ":" + ...
python
def encode(self, o, depth=0): """ encode the json object at given depth :param o: the object :param depth: the depth :return: the json encoding """ if isinstance(o, OrderedDict): return "{" + ",\n ".join([self.encode(k) + ":" + ...
[ "def", "encode", "(", "self", ",", "o", ",", "depth", "=", "0", ")", ":", "if", "isinstance", "(", "o", ",", "OrderedDict", ")", ":", "return", "\"{\"", "+", "\",\\n \"", ".", "join", "(", "[", "self", ".", "encode", "(", "k", ")", "+", "\":\"", ...
encode the json object at given depth :param o: the object :param depth: the depth :return: the json encoding
[ "encode", "the", "json", "object", "at", "given", "depth", ":", "param", "o", ":", "the", "object", ":", "param", "depth", ":", "the", "depth", ":", "return", ":", "the", "json", "encoding" ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L194-L206
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict._update_meta
def _update_meta(self): """ internal function to define the metadata regarding filename, location, and prefix. """ for v in ["filename", "location", "prefix"]: if "meta" not in self: self["meta"] = {} self["meta"][v] = self[v] d...
python
def _update_meta(self): """ internal function to define the metadata regarding filename, location, and prefix. """ for v in ["filename", "location", "prefix"]: if "meta" not in self: self["meta"] = {} self["meta"][v] = self[v] d...
[ "def", "_update_meta", "(", "self", ")", ":", "for", "v", "in", "[", "\"filename\"", ",", "\"location\"", ",", "\"prefix\"", "]", ":", "if", "\"meta\"", "not", "in", "self", ":", "self", "[", "\"meta\"", "]", "=", "{", "}", "self", "[", "\"meta\"", "...
internal function to define the metadata regarding filename, location, and prefix.
[ "internal", "function", "to", "define", "the", "metadata", "regarding", "filename", "location", "and", "prefix", "." ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L264-L273
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict.load
def load(self, filename): """ Loads the yaml file with the given filename. :param filename: the name of the yaml file """ self._set_filename(filename) if os.path.isfile(self['location']): # d = OrderedDict(read_yaml_config(self['location'], check=True)) ...
python
def load(self, filename): """ Loads the yaml file with the given filename. :param filename: the name of the yaml file """ self._set_filename(filename) if os.path.isfile(self['location']): # d = OrderedDict(read_yaml_config(self['location'], check=True)) ...
[ "def", "load", "(", "self", ",", "filename", ")", ":", "self", ".", "_set_filename", "(", "filename", ")", "if", "os", ".", "path", ".", "isfile", "(", "self", "[", "'location'", "]", ")", ":", "# d = OrderedDict(read_yaml_config(self['location'], check=True))",...
Loads the yaml file with the given filename. :param filename: the name of the yaml file
[ "Loads", "the", "yaml", "file", "with", "the", "given", "filename", "." ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L284-L307
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict.error_keys_not_found
def error_keys_not_found(self, keys): """ Check if the requested keys are found in the dict. :param keys: keys to be looked for """ try: log.error("Filename: {0}".format(self['meta']['location'])) except: log.error("Filename: {0}".format(self['loc...
python
def error_keys_not_found(self, keys): """ Check if the requested keys are found in the dict. :param keys: keys to be looked for """ try: log.error("Filename: {0}".format(self['meta']['location'])) except: log.error("Filename: {0}".format(self['loc...
[ "def", "error_keys_not_found", "(", "self", ",", "keys", ")", ":", "try", ":", "log", ".", "error", "(", "\"Filename: {0}\"", ".", "format", "(", "self", "[", "'meta'", "]", "[", "'location'", "]", ")", ")", "except", ":", "log", ".", "error", "(", "...
Check if the requested keys are found in the dict. :param keys: keys to be looked for
[ "Check", "if", "the", "requested", "keys", "are", "found", "in", "the", "dict", "." ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L361-L379
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict.yaml
def yaml(self): """ returns the yaml output of the dict. """ return ordered_dump(OrderedDict(self), Dumper=yaml.SafeDumper, default_flow_style=False)
python
def yaml(self): """ returns the yaml output of the dict. """ return ordered_dump(OrderedDict(self), Dumper=yaml.SafeDumper, default_flow_style=False)
[ "def", "yaml", "(", "self", ")", ":", "return", "ordered_dump", "(", "OrderedDict", "(", "self", ")", ",", "Dumper", "=", "yaml", ".", "SafeDumper", ",", "default_flow_style", "=", "False", ")" ]
returns the yaml output of the dict.
[ "returns", "the", "yaml", "output", "of", "the", "dict", "." ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L393-L399
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict.get
def get(self, *keys): """ returns the dict of the information as read from the yaml file. To access the file safely, you can use the keys in the order of the access. Example: get("provisioner","policy") will return the value of config["provisioner"]["policy"] from the yam...
python
def get(self, *keys): """ returns the dict of the information as read from the yaml file. To access the file safely, you can use the keys in the order of the access. Example: get("provisioner","policy") will return the value of config["provisioner"]["policy"] from the yam...
[ "def", "get", "(", "self", ",", "*", "keys", ")", ":", "if", "keys", "is", "None", ":", "return", "self", "if", "\".\"", "in", "keys", "[", "0", "]", ":", "keys", "=", "keys", "[", "0", "]", ".", "split", "(", "'.'", ")", "element", "=", "sel...
returns the dict of the information as read from the yaml file. To access the file safely, you can use the keys in the order of the access. Example: get("provisioner","policy") will return the value of config["provisioner"]["policy"] from the yaml file if it does not exists an er...
[ "returns", "the", "dict", "of", "the", "information", "as", "read", "from", "the", "yaml", "file", ".", "To", "access", "the", "file", "safely", "you", "can", "use", "the", "keys", "in", "the", "order", "of", "the", "access", ".", "Example", ":", "get"...
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L425-L447
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict.set
def set(self, value, *keys): """ Sets the dict of the information as read from the yaml file. To access the file safely, you can use the keys in the order of the access. Example: set("{'project':{'fg82':[i0-i10]}}", "provisioner","policy") will set the value of config["provisione...
python
def set(self, value, *keys): """ Sets the dict of the information as read from the yaml file. To access the file safely, you can use the keys in the order of the access. Example: set("{'project':{'fg82':[i0-i10]}}", "provisioner","policy") will set the value of config["provisione...
[ "def", "set", "(", "self", ",", "value", ",", "*", "keys", ")", ":", "element", "=", "self", "if", "keys", "is", "None", ":", "return", "self", "if", "'.'", "in", "keys", "[", "0", "]", ":", "keys", "=", "keys", "[", "0", "]", ".", "split", "...
Sets the dict of the information as read from the yaml file. To access the file safely, you can use the keys in the order of the access. Example: set("{'project':{'fg82':[i0-i10]}}", "provisioner","policy") will set the value of config["provisioner"]["policy"] in the yaml file if it does...
[ "Sets", "the", "dict", "of", "the", "information", "as", "read", "from", "the", "yaml", "file", ".", "To", "access", "the", "file", "safely", "you", "can", "use", "the", "keys", "in", "the", "order", "of", "the", "access", ".", "Example", ":", "set", ...
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L449-L477
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict.attribute
def attribute(self, keys): """ TODO: document this method :param keys: """ if self['meta']['prefix'] is None: k = keys else: k = self['meta']['prefix'] + "." + keys return self.get(k)
python
def attribute(self, keys): """ TODO: document this method :param keys: """ if self['meta']['prefix'] is None: k = keys else: k = self['meta']['prefix'] + "." + keys return self.get(k)
[ "def", "attribute", "(", "self", ",", "keys", ")", ":", "if", "self", "[", "'meta'", "]", "[", "'prefix'", "]", "is", "None", ":", "k", "=", "keys", "else", ":", "k", "=", "self", "[", "'meta'", "]", "[", "'prefix'", "]", "+", "\".\"", "+", "ke...
TODO: document this method :param keys:
[ "TODO", ":", "document", "this", "method" ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L488-L498
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.flatwrite
def flatwrite(cls, table, order=None, header=None, output="table", sort_keys=True, show_none="", sep="." ): """ writes the information given in the table :param table: th...
python
def flatwrite(cls, table, order=None, header=None, output="table", sort_keys=True, show_none="", sep="." ): """ writes the information given in the table :param table: th...
[ "def", "flatwrite", "(", "cls", ",", "table", ",", "order", "=", "None", ",", "header", "=", "None", ",", "output", "=", "\"table\"", ",", "sort_keys", "=", "True", ",", "show_none", "=", "\"\"", ",", "sep", "=", "\".\"", ")", ":", "flat", "=", "fl...
writes the information given in the table :param table: the table of values :param order: the order of the columns :param header: the header for the columns :param output: the format (default is table, values are raw, csv, json, yaml, dict :param sort_keys: if true the table is s...
[ "writes", "the", "information", "given", "in", "the", "table", ":", "param", "table", ":", "the", "table", "of", "values", ":", "param", "order", ":", "the", "order", "of", "the", "columns", ":", "param", "header", ":", "the", "header", "for", "the", "...
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L24-L50
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.write
def write(cls, table, order=None, header=None, output="table", sort_keys=True, show_none="" ): """ writes the information given in the table :param table: the table of values :param order: the order of th...
python
def write(cls, table, order=None, header=None, output="table", sort_keys=True, show_none="" ): """ writes the information given in the table :param table: the table of values :param order: the order of th...
[ "def", "write", "(", "cls", ",", "table", ",", "order", "=", "None", ",", "header", "=", "None", ",", "output", "=", "\"table\"", ",", "sort_keys", "=", "True", ",", "show_none", "=", "\"\"", ")", ":", "if", "output", "==", "\"raw\"", ":", "return", ...
writes the information given in the table :param table: the table of values :param order: the order of the columns :param header: the header for the columns :param output: the format (default is table, values are raw, csv, json, yaml, dict :param sort_keys: if true the table is s...
[ "writes", "the", "information", "given", "in", "the", "table", ":", "param", "table", ":", "the", "table", "of", "values", ":", "param", "order", ":", "the", "order", "of", "the", "columns", ":", "param", "header", ":", "the", "header", "for", "the", "...
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L53-L88
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.list
def list(cls, l, order=None, header=None, output="table", sort_keys=True, show_none="" ): """ :param l: l is a list not a dict :param order: :param header: :param output: :param sor...
python
def list(cls, l, order=None, header=None, output="table", sort_keys=True, show_none="" ): """ :param l: l is a list not a dict :param order: :param header: :param output: :param sor...
[ "def", "list", "(", "cls", ",", "l", ",", "order", "=", "None", ",", "header", "=", "None", ",", "output", "=", "\"table\"", ",", "sort_keys", "=", "True", ",", "show_none", "=", "\"\"", ")", ":", "d", "=", "{", "}", "count", "=", "0", "for", "...
:param l: l is a list not a dict :param order: :param header: :param output: :param sort_keys: :param show_none: :return:
[ ":", "param", "l", ":", "l", "is", "a", "list", "not", "a", "dict", ":", "param", "order", ":", ":", "param", "header", ":", ":", "param", "output", ":", ":", "param", "sort_keys", ":", ":", "param", "show_none", ":", ":", "return", ":" ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L91-L119
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.dict
def dict(cls, d, order=None, header=None, output="table", sort_keys=True, show_none=""): """ TODO :param d: A a dict with dicts of the same type. :type d: dict :param order:The order in which the column...
python
def dict(cls, d, order=None, header=None, output="table", sort_keys=True, show_none=""): """ TODO :param d: A a dict with dicts of the same type. :type d: dict :param order:The order in which the column...
[ "def", "dict", "(", "cls", ",", "d", ",", "order", "=", "None", ",", "header", "=", "None", ",", "output", "=", "\"table\"", ",", "sort_keys", "=", "True", ",", "show_none", "=", "\"\"", ")", ":", "if", "output", "==", "\"table\"", ":", "if", "d", ...
TODO :param d: A a dict with dicts of the same type. :type d: dict :param order:The order in which the columns are printed. The order is specified by the key names of the dict. :type order: :param header: The Header of each of the columns :type header:...
[ "TODO", ":", "param", "d", ":", "A", "a", "dict", "with", "dicts", "of", "the", "same", "type", ".", ":", "type", "d", ":", "dict", ":", "param", "order", ":", "The", "order", "in", "which", "the", "columns", "are", "printed", ".", "The", "order", ...
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L122-L166
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.csv
def csv(cls, d, order=None, header=None, sort_keys=True): """ prints a table in csv format :param d: A a dict with dicts of the same type. :type d: dict :param order:The order in which the columns are printed. T...
python
def csv(cls, d, order=None, header=None, sort_keys=True): """ prints a table in csv format :param d: A a dict with dicts of the same type. :type d: dict :param order:The order in which the columns are printed. T...
[ "def", "csv", "(", "cls", ",", "d", ",", "order", "=", "None", ",", "header", "=", "None", ",", "sort_keys", "=", "True", ")", ":", "first_element", "=", "list", "(", "d", ")", "[", "0", "]", "def", "_keys", "(", ")", ":", "return", "list", "("...
prints a table in csv format :param d: A a dict with dicts of the same type. :type d: dict :param order:The order in which the columns are printed. The order is specified by the key names of the dict. :type order: :param header: The Header of each of the colu...
[ "prints", "a", "table", "in", "csv", "format" ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L169-L226
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.dict_table
def dict_table(cls, d, order=None, header=None, sort_keys=True, show_none="", max_width=40): """prints a pretty table from an dict of dicts :param d: A a dict with dicts of the same type. ...
python
def dict_table(cls, d, order=None, header=None, sort_keys=True, show_none="", max_width=40): """prints a pretty table from an dict of dicts :param d: A a dict with dicts of the same type. ...
[ "def", "dict_table", "(", "cls", ",", "d", ",", "order", "=", "None", ",", "header", "=", "None", ",", "sort_keys", "=", "True", ",", "show_none", "=", "\"\"", ",", "max_width", "=", "40", ")", ":", "def", "_keys", "(", ")", ":", "all_keys", "=", ...
prints a pretty table from an dict of dicts :param d: A a dict with dicts of the same type. Each key will be a column :param order: The order in which the columns are printed. The order is specified by the key names of the dict. :param header: The Hea...
[ "prints", "a", "pretty", "table", "from", "an", "dict", "of", "dicts", ":", "param", "d", ":", "A", "a", "dict", "with", "dicts", "of", "the", "same", "type", ".", "Each", "key", "will", "be", "a", "column", ":", "param", "order", ":", "The", "orde...
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L229-L300
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.attribute
def attribute(cls, d, header=None, order=None, sort_keys=True, output="table"): """prints a attribute/key value table :param d: A a dict with dicts of the same type. Each key will be a colu...
python
def attribute(cls, d, header=None, order=None, sort_keys=True, output="table"): """prints a attribute/key value table :param d: A a dict with dicts of the same type. Each key will be a colu...
[ "def", "attribute", "(", "cls", ",", "d", ",", "header", "=", "None", ",", "order", "=", "None", ",", "sort_keys", "=", "True", ",", "output", "=", "\"table\"", ")", ":", "if", "header", "is", "None", ":", "header", "=", "[", "\"Attribute\"", ",", ...
prints a attribute/key value table :param d: A a dict with dicts of the same type. Each key will be a column :param order: The order in which the columns are printed. The order is specified by the key names of the dict. :param header: The Header...
[ "prints", "a", "attribute", "/", "key", "value", "table", ":", "param", "d", ":", "A", "a", "dict", "with", "dicts", "of", "the", "same", "type", ".", "Each", "key", "will", "be", "a", "column", ":", "param", "order", ":", "The", "order", "in", "wh...
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L303-L350
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.print_list
def print_list(cls, l, output='table'): """ prints a list :param l: the list :param output: the output, default is a table :return: """ def dict_from_list(l): """ returns a dict from a list for printing :param l: the list ...
python
def print_list(cls, l, output='table'): """ prints a list :param l: the list :param output: the output, default is a table :return: """ def dict_from_list(l): """ returns a dict from a list for printing :param l: the list ...
[ "def", "print_list", "(", "cls", ",", "l", ",", "output", "=", "'table'", ")", ":", "def", "dict_from_list", "(", "l", ")", ":", "\"\"\"\n returns a dict from a list for printing\n :param l: the list\n :return: \n \"\"\"", "d", "=",...
prints a list :param l: the list :param output: the output, default is a table :return:
[ "prints", "a", "list", ":", "param", "l", ":", "the", "list", ":", "param", "output", ":", "the", "output", "default", "is", "a", "table", ":", "return", ":" ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L353-L391
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.row_table
def row_table(cls, d, order=None, labels=None): """prints a pretty table from data in the dict. :param d: A dict to be printed :param order: The order in which the columns are printed. The order is specified by the key names of the dict. :param labels: The array of ...
python
def row_table(cls, d, order=None, labels=None): """prints a pretty table from data in the dict. :param d: A dict to be printed :param order: The order in which the columns are printed. The order is specified by the key names of the dict. :param labels: The array of ...
[ "def", "row_table", "(", "cls", ",", "d", ",", "order", "=", "None", ",", "labels", "=", "None", ")", ":", "# header", "header", "=", "list", "(", "d", ")", "x", "=", "PrettyTable", "(", "labels", ")", "if", "order", "is", "None", ":", "order", "...
prints a pretty table from data in the dict. :param d: A dict to be printed :param order: The order in which the columns are printed. The order is specified by the key names of the dict. :param labels: The array of labels for the column
[ "prints", "a", "pretty", "table", "from", "data", "in", "the", "dict", ".", ":", "param", "d", ":", "A", "dict", "to", "be", "printed", ":", "param", "order", ":", "The", "order", "in", "which", "the", "columns", "are", "printed", ".", "The", "order"...
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L394-L424
cloudmesh/cloudmesh-common
cloudmesh/common/ssh/authorized_keys.py
get_fingerprint_from_public_key
def get_fingerprint_from_public_key(pubkey): """Generate the fingerprint of a public key :param str pubkey: the value of the public key :returns: fingerprint :rtype: str """ # TODO: why is there a tmpdir? with tempdir() as workdir: key = os.path.join(workdir, 'key.pub') wit...
python
def get_fingerprint_from_public_key(pubkey): """Generate the fingerprint of a public key :param str pubkey: the value of the public key :returns: fingerprint :rtype: str """ # TODO: why is there a tmpdir? with tempdir() as workdir: key = os.path.join(workdir, 'key.pub') wit...
[ "def", "get_fingerprint_from_public_key", "(", "pubkey", ")", ":", "# TODO: why is there a tmpdir?", "with", "tempdir", "(", ")", "as", "workdir", ":", "key", "=", "os", ".", "path", ".", "join", "(", "workdir", ",", "'key.pub'", ")", "with", "open", "(", "k...
Generate the fingerprint of a public key :param str pubkey: the value of the public key :returns: fingerprint :rtype: str
[ "Generate", "the", "fingerprint", "of", "a", "public", "key" ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/ssh/authorized_keys.py#L17-L40
cloudmesh/cloudmesh-common
cloudmesh/common/ssh/authorized_keys.py
AuthorizedKeys.load
def load(cls, path): """ load the keys from a path :param path: the filename (path) in which we find the keys :return: """ auth = cls() with open(path) as fd: for pubkey in itertools.imap(str.strip, fd): # skip empty lines ...
python
def load(cls, path): """ load the keys from a path :param path: the filename (path) in which we find the keys :return: """ auth = cls() with open(path) as fd: for pubkey in itertools.imap(str.strip, fd): # skip empty lines ...
[ "def", "load", "(", "cls", ",", "path", ")", ":", "auth", "=", "cls", "(", ")", "with", "open", "(", "path", ")", "as", "fd", ":", "for", "pubkey", "in", "itertools", ".", "imap", "(", "str", ".", "strip", ",", "fd", ")", ":", "# skip empty lines...
load the keys from a path :param path: the filename (path) in which we find the keys :return:
[ "load", "the", "keys", "from", "a", "path", ":", "param", "path", ":", "the", "filename", "(", "path", ")", "in", "which", "we", "find", "the", "keys", ":", "return", ":" ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/ssh/authorized_keys.py#L52-L66
cloudmesh/cloudmesh-common
cloudmesh/common/ssh/authorized_keys.py
AuthorizedKeys.add
def add(self, pubkey): """ add a public key. :param pubkey: the filename to the public key :return: """ f = get_fingerprint_from_public_key(pubkey) if f not in self._keys: self._order[len(self._keys)] = f self._keys[f] = pubkey
python
def add(self, pubkey): """ add a public key. :param pubkey: the filename to the public key :return: """ f = get_fingerprint_from_public_key(pubkey) if f not in self._keys: self._order[len(self._keys)] = f self._keys[f] = pubkey
[ "def", "add", "(", "self", ",", "pubkey", ")", ":", "f", "=", "get_fingerprint_from_public_key", "(", "pubkey", ")", "if", "f", "not", "in", "self", ".", "_keys", ":", "self", ".", "_order", "[", "len", "(", "self", ".", "_keys", ")", "]", "=", "f"...
add a public key. :param pubkey: the filename to the public key :return:
[ "add", "a", "public", "key", ".", ":", "param", "pubkey", ":", "the", "filename", "to", "the", "public", "key", ":", "return", ":" ]
train
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/ssh/authorized_keys.py#L68-L77
ella/ella
ella/photos/newman_admin.py
PhotoAdmin.thumb
def thumb(self, obj): """ Generates html and thumbnails for admin site. """ format, created = Format.objects.get_or_create(name='newman_thumb', defaults={ 'max_width': 100, 'max_height': 100, 'flex...
python
def thumb(self, obj): """ Generates html and thumbnails for admin site. """ format, created = Format.objects.get_or_create(name='newman_thumb', defaults={ 'max_width': 100, 'max_height': 100, 'flex...
[ "def", "thumb", "(", "self", ",", "obj", ")", ":", "format", ",", "created", "=", "Format", ".", "objects", ".", "get_or_create", "(", "name", "=", "'newman_thumb'", ",", "defaults", "=", "{", "'max_width'", ":", "100", ",", "'max_height'", ":", "100", ...
Generates html and thumbnails for admin site.
[ "Generates", "html", "and", "thumbnails", "for", "admin", "site", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/newman_admin.py#L125-L146
ssalentin/plip
plip/plipcmd.py
process_pdb
def process_pdb(pdbfile, outpath, as_string=False, outputprefix='report'): """Analysis of a single PDB file. Can generate textual reports XML, PyMOL session files and images as output.""" if not as_string: startmessage = '\nStarting analysis of %s\n' % pdbfile.split('/')[-1] else: startmessa...
python
def process_pdb(pdbfile, outpath, as_string=False, outputprefix='report'): """Analysis of a single PDB file. Can generate textual reports XML, PyMOL session files and images as output.""" if not as_string: startmessage = '\nStarting analysis of %s\n' % pdbfile.split('/')[-1] else: startmessa...
[ "def", "process_pdb", "(", "pdbfile", ",", "outpath", ",", "as_string", "=", "False", ",", "outputprefix", "=", "'report'", ")", ":", "if", "not", "as_string", ":", "startmessage", "=", "'\\nStarting analysis of %s\\n'", "%", "pdbfile", ".", "split", "(", "'/'...
Analysis of a single PDB file. Can generate textual reports XML, PyMOL session files and images as output.
[ "Analysis", "of", "a", "single", "PDB", "file", ".", "Can", "generate", "textual", "reports", "XML", "PyMOL", "session", "files", "and", "images", "as", "output", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/plipcmd.py#L53-L97
ssalentin/plip
plip/plipcmd.py
download_structure
def download_structure(inputpdbid): """Given a PDB ID, downloads the corresponding PDB structure. Checks for validity of ID and handles error while downloading. Returns the path of the downloaded file.""" try: if len(inputpdbid) != 4 or extract_pdbid(inputpdbid.lower()) == 'UnknownProtein': ...
python
def download_structure(inputpdbid): """Given a PDB ID, downloads the corresponding PDB structure. Checks for validity of ID and handles error while downloading. Returns the path of the downloaded file.""" try: if len(inputpdbid) != 4 or extract_pdbid(inputpdbid.lower()) == 'UnknownProtein': ...
[ "def", "download_structure", "(", "inputpdbid", ")", ":", "try", ":", "if", "len", "(", "inputpdbid", ")", "!=", "4", "or", "extract_pdbid", "(", "inputpdbid", ".", "lower", "(", ")", ")", "==", "'UnknownProtein'", ":", "sysexit", "(", "3", ",", "'Invali...
Given a PDB ID, downloads the corresponding PDB structure. Checks for validity of ID and handles error while downloading. Returns the path of the downloaded file.
[ "Given", "a", "PDB", "ID", "downloads", "the", "corresponding", "PDB", "structure", ".", "Checks", "for", "validity", "of", "ID", "and", "handles", "error", "while", "downloading", ".", "Returns", "the", "path", "of", "the", "downloaded", "file", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/plipcmd.py#L100-L116
ssalentin/plip
plip/plipcmd.py
remove_duplicates
def remove_duplicates(slist): """Checks input lists for duplicates and returns a list with unique entries""" unique = list(set(slist)) difference = len(slist) - len(unique) if difference == 1: write_message("Removed one duplicate entry from input list.\n") if difference > 1: writ...
python
def remove_duplicates(slist): """Checks input lists for duplicates and returns a list with unique entries""" unique = list(set(slist)) difference = len(slist) - len(unique) if difference == 1: write_message("Removed one duplicate entry from input list.\n") if difference > 1: writ...
[ "def", "remove_duplicates", "(", "slist", ")", ":", "unique", "=", "list", "(", "set", "(", "slist", ")", ")", "difference", "=", "len", "(", "slist", ")", "-", "len", "(", "unique", ")", "if", "difference", "==", "1", ":", "write_message", "(", "\"R...
Checks input lists for duplicates and returns a list with unique entries
[ "Checks", "input", "lists", "for", "duplicates", "and", "returns", "a", "list", "with", "unique", "entries" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/plipcmd.py#L119-L128
ssalentin/plip
plip/plipcmd.py
main
def main(inputstructs, inputpdbids): """Main function. Calls functions for processing, report generation and visualization.""" pdbid, pdbpath = None, None # #@todo For multiprocessing, implement better stacktracing for errors # Print title and version title = "* Protein-Ligand Interaction Profiler v...
python
def main(inputstructs, inputpdbids): """Main function. Calls functions for processing, report generation and visualization.""" pdbid, pdbpath = None, None # #@todo For multiprocessing, implement better stacktracing for errors # Print title and version title = "* Protein-Ligand Interaction Profiler v...
[ "def", "main", "(", "inputstructs", ",", "inputpdbids", ")", ":", "pdbid", ",", "pdbpath", "=", "None", ",", "None", "# #@todo For multiprocessing, implement better stacktracing for errors", "# Print title and version", "title", "=", "\"* Protein-Ligand Interaction Profiler v%s...
Main function. Calls functions for processing, report generation and visualization.
[ "Main", "function", ".", "Calls", "functions", "for", "processing", "report", "generation", "and", "visualization", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/plipcmd.py#L131-L177
ssalentin/plip
plip/plipcmd.py
main_init
def main_init(): """Parse command line arguments and start main script for analysis.""" parser = ArgumentParser(prog="PLIP", description=descript) pdbstructure = parser.add_mutually_exclusive_group(required=True) # Needs either PDB ID or file # '-' as file name reads from stdin pdbstructure.add_arg...
python
def main_init(): """Parse command line arguments and start main script for analysis.""" parser = ArgumentParser(prog="PLIP", description=descript) pdbstructure = parser.add_mutually_exclusive_group(required=True) # Needs either PDB ID or file # '-' as file name reads from stdin pdbstructure.add_arg...
[ "def", "main_init", "(", ")", ":", "parser", "=", "ArgumentParser", "(", "prog", "=", "\"PLIP\"", ",", "description", "=", "descript", ")", "pdbstructure", "=", "parser", ".", "add_mutually_exclusive_group", "(", "required", "=", "True", ")", "# Needs either PDB...
Parse command line arguments and start main script for analysis.
[ "Parse", "command", "line", "arguments", "and", "start", "main", "script", "for", "analysis", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/plipcmd.py#L184-L307
ella/ella
ella/photos/admin.py
FormatedPhotoForm.clean
def clean(self): """ Validation function that checks the dimensions of the crop whether it fits into the original and the format. """ data = self.cleaned_data photo = data['photo'] if ( (data['crop_left'] > photo.width) or (data['crop_top'] > photo...
python
def clean(self): """ Validation function that checks the dimensions of the crop whether it fits into the original and the format. """ data = self.cleaned_data photo = data['photo'] if ( (data['crop_left'] > photo.width) or (data['crop_top'] > photo...
[ "def", "clean", "(", "self", ")", ":", "data", "=", "self", ".", "cleaned_data", "photo", "=", "data", "[", "'photo'", "]", "if", "(", "(", "data", "[", "'crop_left'", "]", ">", "photo", ".", "width", ")", "or", "(", "data", "[", "'crop_top'", "]",...
Validation function that checks the dimensions of the crop whether it fits into the original and the format.
[ "Validation", "function", "that", "checks", "the", "dimensions", "of", "the", "crop", "whether", "it", "fits", "into", "the", "original", "and", "the", "format", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/admin.py#L16-L30
ella/ella
ella/photos/admin.py
FormatForm.clean
def clean(self): """ Check format name uniqueness for sites :return: cleaned_data """ data = self.cleaned_data formats = Format.objects.filter(name=data['name']) if self.instance: formats = formats.exclude(pk=self.instance.pk) exists_sites =...
python
def clean(self): """ Check format name uniqueness for sites :return: cleaned_data """ data = self.cleaned_data formats = Format.objects.filter(name=data['name']) if self.instance: formats = formats.exclude(pk=self.instance.pk) exists_sites =...
[ "def", "clean", "(", "self", ")", ":", "data", "=", "self", ".", "cleaned_data", "formats", "=", "Format", ".", "objects", ".", "filter", "(", "name", "=", "data", "[", "'name'", "]", ")", "if", "self", ".", "instance", ":", "formats", "=", "formats"...
Check format name uniqueness for sites :return: cleaned_data
[ "Check", "format", "name", "uniqueness", "for", "sites" ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/admin.py#L37-L58
ella/ella
ella/photos/admin.py
PhotoOptions.format_photo_json
def format_photo_json(self, request, photo, format): "Used in admin image 'crop tool'." try: photo = get_cached_object(Photo, pk=photo) format = get_cached_object(Format, pk=format) content = { 'error': False, 'image':settings.MEDIA_URL...
python
def format_photo_json(self, request, photo, format): "Used in admin image 'crop tool'." try: photo = get_cached_object(Photo, pk=photo) format = get_cached_object(Format, pk=format) content = { 'error': False, 'image':settings.MEDIA_URL...
[ "def", "format_photo_json", "(", "self", ",", "request", ",", "photo", ",", "format", ")", ":", "try", ":", "photo", "=", "get_cached_object", "(", "Photo", ",", "pk", "=", "photo", ")", "format", "=", "get_cached_object", "(", "Format", ",", "pk", "=", ...
Used in admin image 'crop tool'.
[ "Used", "in", "admin", "image", "crop", "tool", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/admin.py#L114-L129
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.set_initial_representations
def set_initial_representations(self): """Set the initial representations""" self.update_model_dict() self.rc("background solid white") self.rc("setattr g display 0") # Hide all pseudobonds self.rc("~display #%i & :/isHet & ~:%s" % (self.model_dict[self.plipname], self.hetid))
python
def set_initial_representations(self): """Set the initial representations""" self.update_model_dict() self.rc("background solid white") self.rc("setattr g display 0") # Hide all pseudobonds self.rc("~display #%i & :/isHet & ~:%s" % (self.model_dict[self.plipname], self.hetid))
[ "def", "set_initial_representations", "(", "self", ")", ":", "self", ".", "update_model_dict", "(", ")", "self", ".", "rc", "(", "\"background solid white\"", ")", "self", ".", "rc", "(", "\"setattr g display 0\"", ")", "# Hide all pseudobonds", "self", ".", "rc",...
Set the initial representations
[ "Set", "the", "initial", "representations" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L36-L41
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.update_model_dict
def update_model_dict(self): """Updates the model dictionary""" dct = {} models = self.chimera.openModels for md in models.list(): dct[md.name] = md.id self.model_dict = dct
python
def update_model_dict(self): """Updates the model dictionary""" dct = {} models = self.chimera.openModels for md in models.list(): dct[md.name] = md.id self.model_dict = dct
[ "def", "update_model_dict", "(", "self", ")", ":", "dct", "=", "{", "}", "models", "=", "self", ".", "chimera", ".", "openModels", "for", "md", "in", "models", ".", "list", "(", ")", ":", "dct", "[", "md", ".", "name", "]", "=", "md", ".", "id", ...
Updates the model dictionary
[ "Updates", "the", "model", "dictionary" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L43-L49
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.atom_by_serialnumber
def atom_by_serialnumber(self): """Provides a dictionary mapping serial numbers to their atom objects.""" atm_by_snum = {} for atom in self.model.atoms: atm_by_snum[atom.serialNumber] = atom return atm_by_snum
python
def atom_by_serialnumber(self): """Provides a dictionary mapping serial numbers to their atom objects.""" atm_by_snum = {} for atom in self.model.atoms: atm_by_snum[atom.serialNumber] = atom return atm_by_snum
[ "def", "atom_by_serialnumber", "(", "self", ")", ":", "atm_by_snum", "=", "{", "}", "for", "atom", "in", "self", ".", "model", ".", "atoms", ":", "atm_by_snum", "[", "atom", ".", "serialNumber", "]", "=", "atom", "return", "atm_by_snum" ]
Provides a dictionary mapping serial numbers to their atom objects.
[ "Provides", "a", "dictionary", "mapping", "serial", "numbers", "to", "their", "atom", "objects", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L51-L56
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_hydrophobic
def show_hydrophobic(self): """Visualizes hydrophobic contacts.""" grp = self.getPseudoBondGroup("Hydrophobic Interactions-%i" % self.tid, associateWith=[self.model]) grp.lineType = self.chimera.Dash grp.lineWidth = 3 grp.color = self.colorbyname('gray') for i in self.plc...
python
def show_hydrophobic(self): """Visualizes hydrophobic contacts.""" grp = self.getPseudoBondGroup("Hydrophobic Interactions-%i" % self.tid, associateWith=[self.model]) grp.lineType = self.chimera.Dash grp.lineWidth = 3 grp.color = self.colorbyname('gray') for i in self.plc...
[ "def", "show_hydrophobic", "(", "self", ")", ":", "grp", "=", "self", ".", "getPseudoBondGroup", "(", "\"Hydrophobic Interactions-%i\"", "%", "self", ".", "tid", ",", "associateWith", "=", "[", "self", ".", "model", "]", ")", "grp", ".", "lineType", "=", "...
Visualizes hydrophobic contacts.
[ "Visualizes", "hydrophobic", "contacts", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L58-L65
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_hbonds
def show_hbonds(self): """Visualizes hydrogen bonds.""" grp = self.getPseudoBondGroup("Hydrogen Bonds-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i in self.plcomplex.hbonds.ldon_id: b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]]) b....
python
def show_hbonds(self): """Visualizes hydrogen bonds.""" grp = self.getPseudoBondGroup("Hydrogen Bonds-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i in self.plcomplex.hbonds.ldon_id: b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]]) b....
[ "def", "show_hbonds", "(", "self", ")", ":", "grp", "=", "self", ".", "getPseudoBondGroup", "(", "\"Hydrogen Bonds-%i\"", "%", "self", ".", "tid", ",", "associateWith", "=", "[", "self", ".", "model", "]", ")", "grp", ".", "lineWidth", "=", "3", "for", ...
Visualizes hydrogen bonds.
[ "Visualizes", "hydrogen", "bonds", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L67-L78
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_halogen
def show_halogen(self): """Visualizes halogen bonds.""" grp = self.getPseudoBondGroup("HalogenBonds-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i in self.plcomplex.halogen_bonds: b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]]) b.col...
python
def show_halogen(self): """Visualizes halogen bonds.""" grp = self.getPseudoBondGroup("HalogenBonds-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i in self.plcomplex.halogen_bonds: b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]]) b.col...
[ "def", "show_halogen", "(", "self", ")", ":", "grp", "=", "self", ".", "getPseudoBondGroup", "(", "\"HalogenBonds-%i\"", "%", "self", ".", "tid", ",", "associateWith", "=", "[", "self", ".", "model", "]", ")", "grp", ".", "lineWidth", "=", "3", "for", ...
Visualizes halogen bonds.
[ "Visualizes", "halogen", "bonds", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L80-L88
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_stacking
def show_stacking(self): """Visualizes pi-stacking interactions.""" grp = self.getPseudoBondGroup("pi-Stacking-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 grp.lineType = self.chimera.Dash for i, stack in enumerate(self.plcomplex.pistacking): m = sel...
python
def show_stacking(self): """Visualizes pi-stacking interactions.""" grp = self.getPseudoBondGroup("pi-Stacking-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 grp.lineType = self.chimera.Dash for i, stack in enumerate(self.plcomplex.pistacking): m = sel...
[ "def", "show_stacking", "(", "self", ")", ":", "grp", "=", "self", ".", "getPseudoBondGroup", "(", "\"pi-Stacking-%i\"", "%", "self", ".", "tid", ",", "associateWith", "=", "[", "self", ".", "model", "]", ")", "grp", ".", "lineWidth", "=", "3", "grp", ...
Visualizes pi-stacking interactions.
[ "Visualizes", "pi", "-", "stacking", "interactions", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L90-L112
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_cationpi
def show_cationpi(self): """Visualizes cation-pi interactions""" grp = self.getPseudoBondGroup("Cation-Pi-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 grp.lineType = self.chimera.Dash for i, cat in enumerate(self.plcomplex.pication): m = self.model ...
python
def show_cationpi(self): """Visualizes cation-pi interactions""" grp = self.getPseudoBondGroup("Cation-Pi-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 grp.lineType = self.chimera.Dash for i, cat in enumerate(self.plcomplex.pication): m = self.model ...
[ "def", "show_cationpi", "(", "self", ")", ":", "grp", "=", "self", ".", "getPseudoBondGroup", "(", "\"Cation-Pi-%i\"", "%", "self", ".", "tid", ",", "associateWith", "=", "[", "self", ".", "model", "]", ")", "grp", ".", "lineWidth", "=", "3", "grp", "....
Visualizes cation-pi interactions
[ "Visualizes", "cation", "-", "pi", "interactions" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L114-L139
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_sbridges
def show_sbridges(self): """Visualizes salt bridges.""" # Salt Bridges grp = self.getPseudoBondGroup("Salt Bridges-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 grp.lineType = self.chimera.Dash for i, sbridge in enumerate(self.plcomplex.saltbridges): ...
python
def show_sbridges(self): """Visualizes salt bridges.""" # Salt Bridges grp = self.getPseudoBondGroup("Salt Bridges-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 grp.lineType = self.chimera.Dash for i, sbridge in enumerate(self.plcomplex.saltbridges): ...
[ "def", "show_sbridges", "(", "self", ")", ":", "# Salt Bridges", "grp", "=", "self", ".", "getPseudoBondGroup", "(", "\"Salt Bridges-%i\"", "%", "self", ".", "tid", ",", "associateWith", "=", "[", "self", ".", "model", "]", ")", "grp", ".", "lineWidth", "=...
Visualizes salt bridges.
[ "Visualizes", "salt", "bridges", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L141-L167
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_wbridges
def show_wbridges(self): """Visualizes water bridges""" grp = self.getPseudoBondGroup("Water Bridges-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i, wbridge in enumerate(self.plcomplex.waterbridges): c = grp.newPseudoBond(self.atoms[wbridge.water_id], sel...
python
def show_wbridges(self): """Visualizes water bridges""" grp = self.getPseudoBondGroup("Water Bridges-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i, wbridge in enumerate(self.plcomplex.waterbridges): c = grp.newPseudoBond(self.atoms[wbridge.water_id], sel...
[ "def", "show_wbridges", "(", "self", ")", ":", "grp", "=", "self", ".", "getPseudoBondGroup", "(", "\"Water Bridges-%i\"", "%", "self", ".", "tid", ",", "associateWith", "=", "[", "self", ".", "model", "]", ")", "grp", ".", "lineWidth", "=", "3", "for", ...
Visualizes water bridges
[ "Visualizes", "water", "bridges" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L169-L183
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_metal
def show_metal(self): """Visualizes metal coordination.""" grp = self.getPseudoBondGroup("Metal Coordination-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i, metal in enumerate(self.plcomplex.metal_complexes): c = grp.newPseudoBond(self.atoms[metal.metal_i...
python
def show_metal(self): """Visualizes metal coordination.""" grp = self.getPseudoBondGroup("Metal Coordination-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i, metal in enumerate(self.plcomplex.metal_complexes): c = grp.newPseudoBond(self.atoms[metal.metal_i...
[ "def", "show_metal", "(", "self", ")", ":", "grp", "=", "self", ".", "getPseudoBondGroup", "(", "\"Metal Coordination-%i\"", "%", "self", ".", "tid", ",", "associateWith", "=", "[", "self", ".", "model", "]", ")", "grp", ".", "lineWidth", "=", "3", "for"...
Visualizes metal coordination.
[ "Visualizes", "metal", "coordination", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L185-L197
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.cleanup
def cleanup(self): """Clean up the visualization.""" if not len(self.water_ids) == 0: # Hide all non-interacting water molecules water_selection = [] for wid in self.water_ids: water_selection.append('serialNumber=%i' % wid) self.rc("~disp...
python
def cleanup(self): """Clean up the visualization.""" if not len(self.water_ids) == 0: # Hide all non-interacting water molecules water_selection = [] for wid in self.water_ids: water_selection.append('serialNumber=%i' % wid) self.rc("~disp...
[ "def", "cleanup", "(", "self", ")", ":", "if", "not", "len", "(", "self", ".", "water_ids", ")", "==", "0", ":", "# Hide all non-interacting water molecules", "water_selection", "=", "[", "]", "for", "wid", "in", "self", ".", "water_ids", ":", "water_selecti...
Clean up the visualization.
[ "Clean", "up", "the", "visualization", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L199-L213
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.zoom_to_ligand
def zoom_to_ligand(self): """Centers the view on the ligand and its binding site residues.""" self.rc("center #%i & :%s" % (self.model_dict[self.plipname], self.hetid))
python
def zoom_to_ligand(self): """Centers the view on the ligand and its binding site residues.""" self.rc("center #%i & :%s" % (self.model_dict[self.plipname], self.hetid))
[ "def", "zoom_to_ligand", "(", "self", ")", ":", "self", ".", "rc", "(", "\"center #%i & :%s\"", "%", "(", "self", ".", "model_dict", "[", "self", ".", "plipname", "]", ",", "self", ".", "hetid", ")", ")" ]
Centers the view on the ligand and its binding site residues.
[ "Centers", "the", "view", "on", "the", "ligand", "and", "its", "binding", "site", "residues", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L215-L217
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.refinements
def refinements(self): """Details for the visualization.""" self.rc("setattr a color gray @CENTROID") self.rc("setattr a radius 0.3 @CENTROID") self.rc("represent sphere @CENTROID") self.rc("setattr a color orange @CHARGE") self.rc("setattr a radius 0.4 @CHARGE") ...
python
def refinements(self): """Details for the visualization.""" self.rc("setattr a color gray @CENTROID") self.rc("setattr a radius 0.3 @CENTROID") self.rc("represent sphere @CENTROID") self.rc("setattr a color orange @CHARGE") self.rc("setattr a radius 0.4 @CHARGE") ...
[ "def", "refinements", "(", "self", ")", ":", "self", ".", "rc", "(", "\"setattr a color gray @CENTROID\"", ")", "self", ".", "rc", "(", "\"setattr a radius 0.3 @CENTROID\"", ")", "self", ".", "rc", "(", "\"represent sphere @CENTROID\"", ")", "self", ".", "rc", "...
Details for the visualization.
[ "Details", "for", "the", "visualization", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L219-L227
ella/ella
ella/core/migrations/0002_remove_shit_data.py
Migration.forwards
def forwards(self, orm): "Write your forwards methods here." if not db.dry_run: for pl in orm['core.Placement'].objects.all(): pl.listing_set.update(publishable=pl.publishable) publishable = pl.publishable publishable.publish_from = pl.publish_...
python
def forwards(self, orm): "Write your forwards methods here." if not db.dry_run: for pl in orm['core.Placement'].objects.all(): pl.listing_set.update(publishable=pl.publishable) publishable = pl.publishable publishable.publish_from = pl.publish_...
[ "def", "forwards", "(", "self", ",", "orm", ")", ":", "if", "not", "db", ".", "dry_run", ":", "for", "pl", "in", "orm", "[", "'core.Placement'", "]", ".", "objects", ".", "all", "(", ")", ":", "pl", ".", "listing_set", ".", "update", "(", "publisha...
Write your forwards methods here.
[ "Write", "your", "forwards", "methods", "here", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/migrations/0002_remove_shit_data.py#L11-L20
ella/ella
ella/photos/formatter.py
Formatter.format
def format(self): """ Crop and resize the supplied image. Return the image and the crop_box used. If the input format is JPEG and in EXIF there is information about rotation, use it and rotate resulting image. """ if hasattr(self.image, '_getexif'): self.rotate_exif()...
python
def format(self): """ Crop and resize the supplied image. Return the image and the crop_box used. If the input format is JPEG and in EXIF there is information about rotation, use it and rotate resulting image. """ if hasattr(self.image, '_getexif'): self.rotate_exif()...
[ "def", "format", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "image", ",", "'_getexif'", ")", ":", "self", ".", "rotate_exif", "(", ")", "crop_box", "=", "self", ".", "crop_to_ratio", "(", ")", "self", ".", "resize", "(", ")", "return",...
Crop and resize the supplied image. Return the image and the crop_box used. If the input format is JPEG and in EXIF there is information about rotation, use it and rotate resulting image.
[ "Crop", "and", "resize", "the", "supplied", "image", ".", "Return", "the", "image", "and", "the", "crop_box", "used", ".", "If", "the", "input", "format", "is", "JPEG", "and", "in", "EXIF", "there", "is", "information", "about", "rotation", "use", "it", ...
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L22-L31
ella/ella
ella/photos/formatter.py
Formatter.set_format
def set_format(self): """ Check if the format has a flexible height, if so check if the ratio of the flexible format is closer to the actual ratio of the image. If so use that instead of the default values (f.max_width, f.max_height). """ f = self.fmt if f.flexib...
python
def set_format(self): """ Check if the format has a flexible height, if so check if the ratio of the flexible format is closer to the actual ratio of the image. If so use that instead of the default values (f.max_width, f.max_height). """ f = self.fmt if f.flexib...
[ "def", "set_format", "(", "self", ")", ":", "f", "=", "self", ".", "fmt", "if", "f", ".", "flexible_height", "and", "f", ".", "flexible_max_height", ":", "flexw", ",", "flexh", "=", "self", ".", "fw", ",", "f", ".", "flexible_max_height", "flex_ratio", ...
Check if the format has a flexible height, if so check if the ratio of the flexible format is closer to the actual ratio of the image. If so use that instead of the default values (f.max_width, f.max_height).
[ "Check", "if", "the", "format", "has", "a", "flexible", "height", "if", "so", "check", "if", "the", "ratio", "of", "the", "flexible", "format", "is", "closer", "to", "the", "actual", "ratio", "of", "the", "image", ".", "If", "so", "use", "that", "inste...
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L33-L47
ella/ella
ella/photos/formatter.py
Formatter.get_crop_box
def get_crop_box(self): """ Get coordinates of the rectangle defining the new image boundaries. It takes into acount any specific wishes from the model (explicitely passed in crop_box), the desired format and it's options (flexible_height, nocrop) and mainly it's ratio. After dim...
python
def get_crop_box(self): """ Get coordinates of the rectangle defining the new image boundaries. It takes into acount any specific wishes from the model (explicitely passed in crop_box), the desired format and it's options (flexible_height, nocrop) and mainly it's ratio. After dim...
[ "def", "get_crop_box", "(", "self", ")", ":", "# check if the flexible height option is active and applies", "self", ".", "set_format", "(", ")", "if", "self", ".", "fmt", ".", "nocrop", ":", "# cropping not allowed", "return", "if", "self", ".", "crop_box", ":", ...
Get coordinates of the rectangle defining the new image boundaries. It takes into acount any specific wishes from the model (explicitely passed in crop_box), the desired format and it's options (flexible_height, nocrop) and mainly it's ratio. After dimensions of the format were specified...
[ "Get", "coordinates", "of", "the", "rectangle", "defining", "the", "new", "image", "boundaries", ".", "It", "takes", "into", "acount", "any", "specific", "wishes", "from", "the", "model", "(", "explicitely", "passed", "in", "crop_box", ")", "the", "desired", ...
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L49-L89
ella/ella
ella/photos/formatter.py
Formatter.center_important_part
def center_important_part(self, crop_box): """ If important_box was specified, make sure it lies inside the crop box. """ if not self.important_box: return crop_box # shortcuts ib = self.important_box cl, ct, cr, cb = crop_box iw, ih = self.im...
python
def center_important_part(self, crop_box): """ If important_box was specified, make sure it lies inside the crop box. """ if not self.important_box: return crop_box # shortcuts ib = self.important_box cl, ct, cr, cb = crop_box iw, ih = self.im...
[ "def", "center_important_part", "(", "self", ",", "crop_box", ")", ":", "if", "not", "self", ".", "important_box", ":", "return", "crop_box", "# shortcuts", "ib", "=", "self", ".", "important_box", "cl", ",", "ct", ",", "cr", ",", "cb", "=", "crop_box", ...
If important_box was specified, make sure it lies inside the crop box.
[ "If", "important_box", "was", "specified", "make", "sure", "it", "lies", "inside", "the", "crop", "box", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L91-L121
ella/ella
ella/photos/formatter.py
Formatter.crop_to_ratio
def crop_to_ratio(self): " Get crop coordinates and perform the crop if we get any. " crop_box = self.get_crop_box() if not crop_box: return crop_box = self.center_important_part(crop_box) iw, ih = self.image.size # see if we want to crop something from out...
python
def crop_to_ratio(self): " Get crop coordinates and perform the crop if we get any. " crop_box = self.get_crop_box() if not crop_box: return crop_box = self.center_important_part(crop_box) iw, ih = self.image.size # see if we want to crop something from out...
[ "def", "crop_to_ratio", "(", "self", ")", ":", "crop_box", "=", "self", ".", "get_crop_box", "(", ")", "if", "not", "crop_box", ":", "return", "crop_box", "=", "self", ".", "center_important_part", "(", "crop_box", ")", "iw", ",", "ih", "=", "self", ".",...
Get crop coordinates and perform the crop if we get any.
[ "Get", "crop", "coordinates", "and", "perform", "the", "crop", "if", "we", "get", "any", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L124-L153
ella/ella
ella/photos/formatter.py
Formatter.get_resized_size
def get_resized_size(self): """ Get target size for the stretched or shirnked image to fit within the target dimensions. Do not stretch images if not format.stretch. Note that this method is designed to operate on already cropped image. """ f = self.fmt iw, ih = ...
python
def get_resized_size(self): """ Get target size for the stretched or shirnked image to fit within the target dimensions. Do not stretch images if not format.stretch. Note that this method is designed to operate on already cropped image. """ f = self.fmt iw, ih = ...
[ "def", "get_resized_size", "(", "self", ")", ":", "f", "=", "self", ".", "fmt", "iw", ",", "ih", "=", "self", ".", "image", ".", "size", "if", "not", "f", ".", "stretch", "and", "iw", "<=", "self", ".", "fw", "and", "ih", "<=", "self", ".", "fh...
Get target size for the stretched or shirnked image to fit within the target dimensions. Do not stretch images if not format.stretch. Note that this method is designed to operate on already cropped image.
[ "Get", "target", "size", "for", "the", "stretched", "or", "shirnked", "image", "to", "fit", "within", "the", "target", "dimensions", ".", "Do", "not", "stretch", "images", "if", "not", "format", ".", "stretch", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L155-L178
ella/ella
ella/photos/formatter.py
Formatter.resize
def resize(self): """ Get target size for a cropped image and do the resizing if we got anything usable. """ resized_size = self.get_resized_size() if not resized_size: return self.image = self.image.resize(resized_size, Image.ANTIALIAS)
python
def resize(self): """ Get target size for a cropped image and do the resizing if we got anything usable. """ resized_size = self.get_resized_size() if not resized_size: return self.image = self.image.resize(resized_size, Image.ANTIALIAS)
[ "def", "resize", "(", "self", ")", ":", "resized_size", "=", "self", ".", "get_resized_size", "(", ")", "if", "not", "resized_size", ":", "return", "self", ".", "image", "=", "self", ".", "image", ".", "resize", "(", "resized_size", ",", "Image", ".", ...
Get target size for a cropped image and do the resizing if we got anything usable.
[ "Get", "target", "size", "for", "a", "cropped", "image", "and", "do", "the", "resizing", "if", "we", "got", "anything", "usable", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L180-L189
ella/ella
ella/photos/formatter.py
Formatter.rotate_exif
def rotate_exif(self): """ Rotate image via exif information. Only 90, 180 and 270 rotations are supported. """ exif = self.image._getexif() or {} rotation = exif.get(TAGS['Orientation'], 1) rotations = { 6: -90, 3: -180, 8: -2...
python
def rotate_exif(self): """ Rotate image via exif information. Only 90, 180 and 270 rotations are supported. """ exif = self.image._getexif() or {} rotation = exif.get(TAGS['Orientation'], 1) rotations = { 6: -90, 3: -180, 8: -2...
[ "def", "rotate_exif", "(", "self", ")", ":", "exif", "=", "self", ".", "image", ".", "_getexif", "(", ")", "or", "{", "}", "rotation", "=", "exif", ".", "get", "(", "TAGS", "[", "'Orientation'", "]", ",", "1", ")", "rotations", "=", "{", "6", ":"...
Rotate image via exif information. Only 90, 180 and 270 rotations are supported.
[ "Rotate", "image", "via", "exif", "information", ".", "Only", "90", "180", "and", "270", "rotations", "are", "supported", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L191-L207
ssalentin/plip
plip/modules/visualize.py
select_by_ids
def select_by_ids(selname, idlist, selection_exists=False, chunksize=20, restrict=None): """Selection with a large number of ids concatenated into a selection list can cause buffer overflow in PyMOL. This function takes a selection name and and list of IDs (list of integers) as input and makes a careful ...
python
def select_by_ids(selname, idlist, selection_exists=False, chunksize=20, restrict=None): """Selection with a large number of ids concatenated into a selection list can cause buffer overflow in PyMOL. This function takes a selection name and and list of IDs (list of integers) as input and makes a careful ...
[ "def", "select_by_ids", "(", "selname", ",", "idlist", ",", "selection_exists", "=", "False", ",", "chunksize", "=", "20", ",", "restrict", "=", "None", ")", ":", "idlist", "=", "list", "(", "set", "(", "idlist", ")", ")", "# Remove duplicates", "if", "n...
Selection with a large number of ids concatenated into a selection list can cause buffer overflow in PyMOL. This function takes a selection name and and list of IDs (list of integers) as input and makes a careful step-by-step selection (packages of 20 by default)
[ "Selection", "with", "a", "large", "number", "of", "ids", "concatenated", "into", "a", "selection", "list", "can", "cause", "buffer", "overflow", "in", "PyMOL", ".", "This", "function", "takes", "a", "selection", "name", "and", "and", "list", "of", "IDs", ...
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/visualize.py#L18-L30
ssalentin/plip
plip/modules/visualize.py
visualize_in_pymol
def visualize_in_pymol(plcomplex): """Visualizes the protein-ligand pliprofiler at one site in PyMOL.""" vis = PyMOLVisualizer(plcomplex) ##################### # Set everything up # ##################### pdbid = plcomplex.pdbid lig_members = plcomplex.lig_members chain = plcomplex.cha...
python
def visualize_in_pymol(plcomplex): """Visualizes the protein-ligand pliprofiler at one site in PyMOL.""" vis = PyMOLVisualizer(plcomplex) ##################### # Set everything up # ##################### pdbid = plcomplex.pdbid lig_members = plcomplex.lig_members chain = plcomplex.cha...
[ "def", "visualize_in_pymol", "(", "plcomplex", ")", ":", "vis", "=", "PyMOLVisualizer", "(", "plcomplex", ")", "#####################", "# Set everything up #", "#####################", "pdbid", "=", "plcomplex", ".", "pdbid", "lig_members", "=", "plcomplex", ".", "li...
Visualizes the protein-ligand pliprofiler at one site in PyMOL.
[ "Visualizes", "the", "protein", "-", "ligand", "pliprofiler", "at", "one", "site", "in", "PyMOL", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/visualize.py#L33-L134
ella/ella
ella/core/views.py
get_content_type
def get_content_type(ct_name): """ A helper function that returns ContentType object based on its slugified verbose_name_plural. Results of this function is cached to improve performance. :Parameters: - `ct_name`: Slugified verbose_name_plural of the target model. :Exceptions: - ...
python
def get_content_type(ct_name): """ A helper function that returns ContentType object based on its slugified verbose_name_plural. Results of this function is cached to improve performance. :Parameters: - `ct_name`: Slugified verbose_name_plural of the target model. :Exceptions: - ...
[ "def", "get_content_type", "(", "ct_name", ")", ":", "try", ":", "ct", "=", "CONTENT_TYPE_MAPPING", "[", "ct_name", "]", "except", "KeyError", ":", "for", "model", "in", "models", ".", "get_models", "(", ")", ":", "if", "ct_name", "==", "slugify", "(", "...
A helper function that returns ContentType object based on its slugified verbose_name_plural. Results of this function is cached to improve performance. :Parameters: - `ct_name`: Slugified verbose_name_plural of the target model. :Exceptions: - `Http404`: if no matching ContentType is fo...
[ "A", "helper", "function", "that", "returns", "ContentType", "object", "based", "on", "its", "slugified", "verbose_name_plural", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/views.py#L423-L445
ella/ella
ella/core/views.py
get_templates
def get_templates(name, slug=None, category=None, app_label=None, model_label=None): """ Returns templates in following format and order: * ``'page/category/%s/content_type/%s.%s/%s/%s' % (<CATEGORY_PART>, app_label, model_label, slug, name)`` * ``'page/category/%s/content_type/%s.%s/%s' % (<CATEGORY_P...
python
def get_templates(name, slug=None, category=None, app_label=None, model_label=None): """ Returns templates in following format and order: * ``'page/category/%s/content_type/%s.%s/%s/%s' % (<CATEGORY_PART>, app_label, model_label, slug, name)`` * ``'page/category/%s/content_type/%s.%s/%s' % (<CATEGORY_P...
[ "def", "get_templates", "(", "name", ",", "slug", "=", "None", ",", "category", "=", "None", ",", "app_label", "=", "None", ",", "model_label", "=", "None", ")", ":", "def", "category_templates", "(", "category", ",", "incomplete_template", ",", "params", ...
Returns templates in following format and order: * ``'page/category/%s/content_type/%s.%s/%s/%s' % (<CATEGORY_PART>, app_label, model_label, slug, name)`` * ``'page/category/%s/content_type/%s.%s/%s' % (<CATEGORY_PART>, app_label, model_label, name)`` * ``'page/category/%s/%s' % (<CATEGORY_PART>, name)`` ...
[ "Returns", "templates", "in", "following", "format", "and", "order", ":" ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/views.py#L449-L518
ella/ella
ella/core/views.py
get_templates_from_publishable
def get_templates_from_publishable(name, publishable): """ Returns the same template list as `get_templates` but gets values from `Publishable` instance. """ slug = publishable.slug category = publishable.category app_label = publishable.content_type.app_label model_label = publishable.conte...
python
def get_templates_from_publishable(name, publishable): """ Returns the same template list as `get_templates` but gets values from `Publishable` instance. """ slug = publishable.slug category = publishable.category app_label = publishable.content_type.app_label model_label = publishable.conte...
[ "def", "get_templates_from_publishable", "(", "name", ",", "publishable", ")", ":", "slug", "=", "publishable", ".", "slug", "category", "=", "publishable", ".", "category", "app_label", "=", "publishable", ".", "content_type", ".", "app_label", "model_label", "="...
Returns the same template list as `get_templates` but gets values from `Publishable` instance.
[ "Returns", "the", "same", "template", "list", "as", "get_templates", "but", "gets", "values", "from", "Publishable", "instance", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/views.py#L521-L529
ella/ella
ella/core/views.py
export
def export(request, count, name='', content_type=None): """ Export banners. :Parameters: - `count`: number of objects to pass into the template - `name`: name of the template ( page/export/banner.html is default ) - `models`: list of Model classes to include """ t_list = [] ...
python
def export(request, count, name='', content_type=None): """ Export banners. :Parameters: - `count`: number of objects to pass into the template - `name`: name of the template ( page/export/banner.html is default ) - `models`: list of Model classes to include """ t_list = [] ...
[ "def", "export", "(", "request", ",", "count", ",", "name", "=", "''", ",", "content_type", "=", "None", ")", ":", "t_list", "=", "[", "]", "if", "name", ":", "t_list", ".", "append", "(", "'page/export/%s.html'", "%", "name", ")", "t_list", ".", "ap...
Export banners. :Parameters: - `count`: number of objects to pass into the template - `name`: name of the template ( page/export/banner.html is default ) - `models`: list of Model classes to include
[ "Export", "banners", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/views.py#L538-L562
ella/ella
ella/core/views.py
EllaCoreView.get_templates
def get_templates(self, context, template_name=None): " Extract parameters for `get_templates` from the context. " if not template_name: template_name = self.template_name kw = {} if 'object' in context: o = context['object'] kw['slug'] = o.slug ...
python
def get_templates(self, context, template_name=None): " Extract parameters for `get_templates` from the context. " if not template_name: template_name = self.template_name kw = {} if 'object' in context: o = context['object'] kw['slug'] = o.slug ...
[ "def", "get_templates", "(", "self", ",", "context", ",", "template_name", "=", "None", ")", ":", "if", "not", "template_name", ":", "template_name", "=", "self", ".", "template_name", "kw", "=", "{", "}", "if", "'object'", "in", "context", ":", "o", "="...
Extract parameters for `get_templates` from the context.
[ "Extract", "parameters", "for", "get_templates", "from", "the", "context", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/views.py#L82-L97
ella/ella
ella/core/views.py
ListContentType._archive_entry_year
def _archive_entry_year(self, category): " Return ARCHIVE_ENTRY_YEAR from settings (if exists) or year of the newest object in category " year = getattr(settings, 'ARCHIVE_ENTRY_YEAR', None) if not year: n = now() try: year = Listing.objects.filter( ...
python
def _archive_entry_year(self, category): " Return ARCHIVE_ENTRY_YEAR from settings (if exists) or year of the newest object in category " year = getattr(settings, 'ARCHIVE_ENTRY_YEAR', None) if not year: n = now() try: year = Listing.objects.filter( ...
[ "def", "_archive_entry_year", "(", "self", ",", "category", ")", ":", "year", "=", "getattr", "(", "settings", ",", "'ARCHIVE_ENTRY_YEAR'", ",", "None", ")", "if", "not", "year", ":", "n", "=", "now", "(", ")", "try", ":", "year", "=", "Listing", ".", ...
Return ARCHIVE_ENTRY_YEAR from settings (if exists) or year of the newest object in category
[ "Return", "ARCHIVE_ENTRY_YEAR", "from", "settings", "(", "if", "exists", ")", "or", "year", "of", "the", "newest", "object", "in", "category" ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/views.py#L321-L334
ella/ella
ella/photos/models.py
Photo.save
def save(self, **kwargs): """Overrides models.Model.save. - Generates slug. - Saves image file. """ if not self.width or not self.height: self.width, self.height = self.image.width, self.image.height # prefill the slug with the ID, it requires double save ...
python
def save(self, **kwargs): """Overrides models.Model.save. - Generates slug. - Saves image file. """ if not self.width or not self.height: self.width, self.height = self.image.width, self.image.height # prefill the slug with the ID, it requires double save ...
[ "def", "save", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "width", "or", "not", "self", ".", "height", ":", "self", ".", "width", ",", "self", ".", "height", "=", "self", ".", "image", ".", "width", ",", "self", "...
Overrides models.Model.save. - Generates slug. - Saves image file.
[ "Overrides", "models", ".", "Model", ".", "save", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L110-L152
ella/ella
ella/photos/models.py
Format.get_blank_img
def get_blank_img(self): """ Return fake ``FormatedPhoto`` object to be used in templates when an error occurs in image generation. """ if photos_settings.DEBUG: return self.get_placeholder_img() out = { 'blank': True, 'width': self.ma...
python
def get_blank_img(self): """ Return fake ``FormatedPhoto`` object to be used in templates when an error occurs in image generation. """ if photos_settings.DEBUG: return self.get_placeholder_img() out = { 'blank': True, 'width': self.ma...
[ "def", "get_blank_img", "(", "self", ")", ":", "if", "photos_settings", ".", "DEBUG", ":", "return", "self", ".", "get_placeholder_img", "(", ")", "out", "=", "{", "'blank'", ":", "True", ",", "'width'", ":", "self", ".", "max_width", ",", "'height'", ":...
Return fake ``FormatedPhoto`` object to be used in templates when an error occurs in image generation.
[ "Return", "fake", "FormatedPhoto", "object", "to", "be", "used", "in", "templates", "when", "an", "error", "occurs", "in", "image", "generation", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L216-L230
ella/ella
ella/photos/models.py
Format.get_placeholder_img
def get_placeholder_img(self): """ Returns fake ``FormatedPhoto`` object grabbed from image placeholder generator service for the purpose of debugging when images are not available but we still want to see something. """ pars = { 'width': self.max_width, ...
python
def get_placeholder_img(self): """ Returns fake ``FormatedPhoto`` object grabbed from image placeholder generator service for the purpose of debugging when images are not available but we still want to see something. """ pars = { 'width': self.max_width, ...
[ "def", "get_placeholder_img", "(", "self", ")", ":", "pars", "=", "{", "'width'", ":", "self", ".", "max_width", ",", "'height'", ":", "self", ".", "max_height", "}", "out", "=", "{", "'placeholder'", ":", "True", ",", "'width'", ":", "self", ".", "max...
Returns fake ``FormatedPhoto`` object grabbed from image placeholder generator service for the purpose of debugging when images are not available but we still want to see something.
[ "Returns", "fake", "FormatedPhoto", "object", "grabbed", "from", "image", "placeholder", "generator", "service", "for", "the", "purpose", "of", "debugging", "when", "images", "are", "not", "available", "but", "we", "still", "want", "to", "see", "something", "." ...
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L232-L248
ella/ella
ella/photos/models.py
Format.save
def save(self, **kwargs): """Overrides models.Model.save. - Delete formatted photos if format save and not now created (because of possible changes) """ if self.id: for f_photo in self.formatedphoto_set.all(): f_photo.delete() super(Format...
python
def save(self, **kwargs): """Overrides models.Model.save. - Delete formatted photos if format save and not now created (because of possible changes) """ if self.id: for f_photo in self.formatedphoto_set.all(): f_photo.delete() super(Format...
[ "def", "save", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "id", ":", "for", "f_photo", "in", "self", ".", "formatedphoto_set", ".", "all", "(", ")", ":", "f_photo", ".", "delete", "(", ")", "super", "(", "Format", ",", "se...
Overrides models.Model.save. - Delete formatted photos if format save and not now created (because of possible changes)
[ "Overrides", "models", ".", "Model", ".", "save", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L254-L265
ella/ella
ella/photos/models.py
FormatedPhoto.generate
def generate(self, save=True): """ Generates photo file in current format. If ``save`` is ``True``, file is saved too. """ stretched_photo, crop_box = self._generate_img() # set crop_box to (0,0,0,0) if photo not cropped if not crop_box: crop_box = 0...
python
def generate(self, save=True): """ Generates photo file in current format. If ``save`` is ``True``, file is saved too. """ stretched_photo, crop_box = self._generate_img() # set crop_box to (0,0,0,0) if photo not cropped if not crop_box: crop_box = 0...
[ "def", "generate", "(", "self", ",", "save", "=", "True", ")", ":", "stretched_photo", ",", "crop_box", "=", "self", ".", "_generate_img", "(", ")", "# set crop_box to (0,0,0,0) if photo not cropped", "if", "not", "crop_box", ":", "crop_box", "=", "0", ",", "0...
Generates photo file in current format. If ``save`` is ``True``, file is saved too.
[ "Generates", "photo", "file", "in", "current", "format", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L375-L400
ella/ella
ella/photos/models.py
FormatedPhoto.save
def save(self, **kwargs): """Overrides models.Model.save - Removes old file from the FS - Generates new file. """ self.remove_file() if not self.image: self.generate(save=False) else: self.image.name = self.file() super(FormatedPho...
python
def save(self, **kwargs): """Overrides models.Model.save - Removes old file from the FS - Generates new file. """ self.remove_file() if not self.image: self.generate(save=False) else: self.image.name = self.file() super(FormatedPho...
[ "def", "save", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "remove_file", "(", ")", "if", "not", "self", ".", "image", ":", "self", ".", "generate", "(", "save", "=", "False", ")", "else", ":", "self", ".", "image", ".", "name", ...
Overrides models.Model.save - Removes old file from the FS - Generates new file.
[ "Overrides", "models", ".", "Model", ".", "save" ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L402-L413
ella/ella
ella/photos/models.py
FormatedPhoto.file
def file(self): """ Method returns formated photo path - derived from format.id and source Photo filename """ if photos_settings.FORMATED_PHOTO_FILENAME is not None: return photos_settings.FORMATED_PHOTO_FILENAME(self) source_file = path.split(self.photo.image.name) return pa...
python
def file(self): """ Method returns formated photo path - derived from format.id and source Photo filename """ if photos_settings.FORMATED_PHOTO_FILENAME is not None: return photos_settings.FORMATED_PHOTO_FILENAME(self) source_file = path.split(self.photo.image.name) return pa...
[ "def", "file", "(", "self", ")", ":", "if", "photos_settings", ".", "FORMATED_PHOTO_FILENAME", "is", "not", "None", ":", "return", "photos_settings", ".", "FORMATED_PHOTO_FILENAME", "(", "self", ")", "source_file", "=", "path", ".", "split", "(", "self", ".", ...
Method returns formated photo path - derived from format.id and source Photo filename
[ "Method", "returns", "formated", "photo", "path", "-", "derived", "from", "format", ".", "id", "and", "source", "Photo", "filename" ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L427-L432
ella/ella
ella/positions/templatetags/positions.py
_get_category_from_pars_var
def _get_category_from_pars_var(template_var, context): ''' get category from template variable or from tree_path ''' cat = template_var.resolve(context) if isinstance(cat, basestring): cat = Category.objects.get_by_tree_path(cat) return cat
python
def _get_category_from_pars_var(template_var, context): ''' get category from template variable or from tree_path ''' cat = template_var.resolve(context) if isinstance(cat, basestring): cat = Category.objects.get_by_tree_path(cat) return cat
[ "def", "_get_category_from_pars_var", "(", "template_var", ",", "context", ")", ":", "cat", "=", "template_var", ".", "resolve", "(", "context", ")", "if", "isinstance", "(", "cat", ",", "basestring", ")", ":", "cat", "=", "Category", ".", "objects", ".", ...
get category from template variable or from tree_path
[ "get", "category", "from", "template", "variable", "or", "from", "tree_path" ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/positions/templatetags/positions.py#L11-L18
ella/ella
ella/positions/templatetags/positions.py
position
def position(parser, token): """ Render a given position for category. If some position is not defined for first category, position from its parent category is used unless nofallback is specified. Syntax:: {% position POSITION_NAME for CATEGORY [nofallback] %}{% endposition %} {% p...
python
def position(parser, token): """ Render a given position for category. If some position is not defined for first category, position from its parent category is used unless nofallback is specified. Syntax:: {% position POSITION_NAME for CATEGORY [nofallback] %}{% endposition %} {% p...
[ "def", "position", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "split_contents", "(", ")", "nodelist", "=", "parser", ".", "parse", "(", "(", "'end'", "+", "bits", "[", "0", "]", ",", ")", ")", "parser", ".", "delete_first_token...
Render a given position for category. If some position is not defined for first category, position from its parent category is used unless nofallback is specified. Syntax:: {% position POSITION_NAME for CATEGORY [nofallback] %}{% endposition %} {% position POSITION_NAME for CATEGORY using ...
[ "Render", "a", "given", "position", "for", "category", ".", "If", "some", "position", "is", "not", "defined", "for", "first", "category", "position", "from", "its", "parent", "category", "is", "used", "unless", "nofallback", "is", "specified", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/positions/templatetags/positions.py#L22-L40
ella/ella
ella/positions/templatetags/positions.py
ifposition
def ifposition(parser, token): """ Syntax:: {% ifposition POSITION_NAME ... for CATEGORY [nofallback] %} {% else %} {% endifposition %} """ bits = list(token.split_contents()) end_tag = 'end' + bits[0] nofallback = False if bits[-1] == 'nofallback': nofallb...
python
def ifposition(parser, token): """ Syntax:: {% ifposition POSITION_NAME ... for CATEGORY [nofallback] %} {% else %} {% endifposition %} """ bits = list(token.split_contents()) end_tag = 'end' + bits[0] nofallback = False if bits[-1] == 'nofallback': nofallb...
[ "def", "ifposition", "(", "parser", ",", "token", ")", ":", "bits", "=", "list", "(", "token", ".", "split_contents", "(", ")", ")", "end_tag", "=", "'end'", "+", "bits", "[", "0", "]", "nofallback", "=", "False", "if", "bits", "[", "-", "1", "]", ...
Syntax:: {% ifposition POSITION_NAME ... for CATEGORY [nofallback] %} {% else %} {% endifposition %}
[ "Syntax", "::" ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/positions/templatetags/positions.py#L77-L109
ssalentin/plip
plip/modules/detection.py
filter_contacts
def filter_contacts(pairings): """Filter interactions by two criteria: 1. No interactions between the same residue (important for intra mode). 2. No duplicate interactions (A with B and B with A, also important for intra mode).""" if not config.INTRA: return pairings filtered1_pairings = [p ...
python
def filter_contacts(pairings): """Filter interactions by two criteria: 1. No interactions between the same residue (important for intra mode). 2. No duplicate interactions (A with B and B with A, also important for intra mode).""" if not config.INTRA: return pairings filtered1_pairings = [p ...
[ "def", "filter_contacts", "(", "pairings", ")", ":", "if", "not", "config", ".", "INTRA", ":", "return", "pairings", "filtered1_pairings", "=", "[", "p", "for", "p", "in", "pairings", "if", "(", "p", ".", "resnr", ",", "p", ".", "reschain", ")", "!=", ...
Filter interactions by two criteria: 1. No interactions between the same residue (important for intra mode). 2. No duplicate interactions (A with B and B with A, also important for intra mode).
[ "Filter", "interactions", "by", "two", "criteria", ":", "1", ".", "No", "interactions", "between", "the", "same", "residue", "(", "important", "for", "intra", "mode", ")", ".", "2", ".", "No", "duplicate", "interactions", "(", "A", "with", "B", "and", "B...
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L22-L45
ssalentin/plip
plip/modules/detection.py
hydrophobic_interactions
def hydrophobic_interactions(atom_set_a, atom_set_b): """Detection of hydrophobic pliprofiler between atom_set_a (binding site) and atom_set_b (ligand). Definition: All pairs of qualified carbon atoms within a distance of HYDROPH_DIST_MAX """ data = namedtuple('hydroph_interaction', 'bsatom bsatom_orig_...
python
def hydrophobic_interactions(atom_set_a, atom_set_b): """Detection of hydrophobic pliprofiler between atom_set_a (binding site) and atom_set_b (ligand). Definition: All pairs of qualified carbon atoms within a distance of HYDROPH_DIST_MAX """ data = namedtuple('hydroph_interaction', 'bsatom bsatom_orig_...
[ "def", "hydrophobic_interactions", "(", "atom_set_a", ",", "atom_set_b", ")", ":", "data", "=", "namedtuple", "(", "'hydroph_interaction'", ",", "'bsatom bsatom_orig_idx ligatom ligatom_orig_idx '", "'distance restype resnr reschain restype_l, resnr_l, reschain_l'", ")", "pairings"...
Detection of hydrophobic pliprofiler between atom_set_a (binding site) and atom_set_b (ligand). Definition: All pairs of qualified carbon atoms within a distance of HYDROPH_DIST_MAX
[ "Detection", "of", "hydrophobic", "pliprofiler", "between", "atom_set_a", "(", "binding", "site", ")", "and", "atom_set_b", "(", "ligand", ")", ".", "Definition", ":", "All", "pairs", "of", "qualified", "carbon", "atoms", "within", "a", "distance", "of", "HYDR...
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L52-L72
ssalentin/plip
plip/modules/detection.py
hbonds
def hbonds(acceptors, donor_pairs, protisdon, typ): """Detection of hydrogen bonds between sets of acceptors and donor pairs. Definition: All pairs of hydrogen bond acceptor and donors with donor hydrogens and acceptor showing a distance within HBOND DIST MIN and HBOND DIST MAX and donor angles above HB...
python
def hbonds(acceptors, donor_pairs, protisdon, typ): """Detection of hydrogen bonds between sets of acceptors and donor pairs. Definition: All pairs of hydrogen bond acceptor and donors with donor hydrogens and acceptor showing a distance within HBOND DIST MIN and HBOND DIST MAX and donor angles above HB...
[ "def", "hbonds", "(", "acceptors", ",", "donor_pairs", ",", "protisdon", ",", "typ", ")", ":", "data", "=", "namedtuple", "(", "'hbond'", ",", "'a a_orig_idx d d_orig_idx h distance_ah distance_ad angle type protisdon resnr '", "'restype reschain resnr_l restype_l reschain_l si...
Detection of hydrogen bonds between sets of acceptors and donor pairs. Definition: All pairs of hydrogen bond acceptor and donors with donor hydrogens and acceptor showing a distance within HBOND DIST MIN and HBOND DIST MAX and donor angles above HBOND_DON_ANGLE_MIN
[ "Detection", "of", "hydrogen", "bonds", "between", "sets", "of", "acceptors", "and", "donor", "pairs", ".", "Definition", ":", "All", "pairs", "of", "hydrogen", "bond", "acceptor", "and", "donors", "with", "donor", "hydrogens", "and", "acceptor", "showing", "a...
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L75-L117
ssalentin/plip
plip/modules/detection.py
pistacking
def pistacking(rings_bs, rings_lig): """Return all pi-stackings between the given aromatic ring systems in receptor and ligand.""" data = namedtuple( 'pistack', 'proteinring ligandring distance angle offset type restype resnr reschain restype_l resnr_l reschain_l') pairings = [] for r, l in iter...
python
def pistacking(rings_bs, rings_lig): """Return all pi-stackings between the given aromatic ring systems in receptor and ligand.""" data = namedtuple( 'pistack', 'proteinring ligandring distance angle offset type restype resnr reschain restype_l resnr_l reschain_l') pairings = [] for r, l in iter...
[ "def", "pistacking", "(", "rings_bs", ",", "rings_lig", ")", ":", "data", "=", "namedtuple", "(", "'pistack'", ",", "'proteinring ligandring distance angle offset type restype resnr reschain restype_l resnr_l reschain_l'", ")", "pairings", "=", "[", "]", "for", "r", ",", ...
Return all pi-stackings between the given aromatic ring systems in receptor and ligand.
[ "Return", "all", "pi", "-", "stackings", "between", "the", "given", "aromatic", "ring", "systems", "in", "receptor", "and", "ligand", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L120-L156
ssalentin/plip
plip/modules/detection.py
pication
def pication(rings, pos_charged, protcharged): """Return all pi-Cation interaction between aromatic rings and positively charged groups. For tertiary and quaternary amines, check also the angle between the ring and the nitrogen. """ data = namedtuple( 'pication', 'ring charge distance offset typ...
python
def pication(rings, pos_charged, protcharged): """Return all pi-Cation interaction between aromatic rings and positively charged groups. For tertiary and quaternary amines, check also the angle between the ring and the nitrogen. """ data = namedtuple( 'pication', 'ring charge distance offset typ...
[ "def", "pication", "(", "rings", ",", "pos_charged", ",", "protcharged", ")", ":", "data", "=", "namedtuple", "(", "'pication'", ",", "'ring charge distance offset type restype resnr reschain restype_l resnr_l reschain_l protcharged'", ")", "pairings", "=", "[", "]", "if"...
Return all pi-Cation interaction between aromatic rings and positively charged groups. For tertiary and quaternary amines, check also the angle between the ring and the nitrogen.
[ "Return", "all", "pi", "-", "Cation", "interaction", "between", "aromatic", "rings", "and", "positively", "charged", "groups", ".", "For", "tertiary", "and", "quaternary", "amines", "check", "also", "the", "angle", "between", "the", "ring", "and", "the", "nitr...
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L159-L208
ssalentin/plip
plip/modules/detection.py
saltbridge
def saltbridge(poscenter, negcenter, protispos): """Detect all salt bridges (pliprofiler between centers of positive and negative charge)""" data = namedtuple( 'saltbridge', 'positive negative distance protispos resnr restype reschain resnr_l restype_l reschain_l') pairings = [] for pc, nc in it...
python
def saltbridge(poscenter, negcenter, protispos): """Detect all salt bridges (pliprofiler between centers of positive and negative charge)""" data = namedtuple( 'saltbridge', 'positive negative distance protispos resnr restype reschain resnr_l restype_l reschain_l') pairings = [] for pc, nc in it...
[ "def", "saltbridge", "(", "poscenter", ",", "negcenter", ",", "protispos", ")", ":", "data", "=", "namedtuple", "(", "'saltbridge'", ",", "'positive negative distance protispos resnr restype reschain resnr_l restype_l reschain_l'", ")", "pairings", "=", "[", "]", "for", ...
Detect all salt bridges (pliprofiler between centers of positive and negative charge)
[ "Detect", "all", "salt", "bridges", "(", "pliprofiler", "between", "centers", "of", "positive", "and", "negative", "charge", ")" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L211-L229
ssalentin/plip
plip/modules/detection.py
halogen
def halogen(acceptor, donor): """Detect all halogen bonds of the type Y-O...X-C""" data = namedtuple('halogenbond', 'acc acc_orig_idx don don_orig_idx distance don_angle acc_angle restype ' 'resnr reschain restype_l resnr_l reschain_l donortype acctype sidechain') pairin...
python
def halogen(acceptor, donor): """Detect all halogen bonds of the type Y-O...X-C""" data = namedtuple('halogenbond', 'acc acc_orig_idx don don_orig_idx distance don_angle acc_angle restype ' 'resnr reschain restype_l resnr_l reschain_l donortype acctype sidechain') pairin...
[ "def", "halogen", "(", "acceptor", ",", "donor", ")", ":", "data", "=", "namedtuple", "(", "'halogenbond'", ",", "'acc acc_orig_idx don don_orig_idx distance don_angle acc_angle restype '", "'resnr reschain restype_l resnr_l reschain_l donortype acctype sidechain'", ")", "pairings"...
Detect all halogen bonds of the type Y-O...X-C
[ "Detect", "all", "halogen", "bonds", "of", "the", "type", "Y", "-", "O", "...", "X", "-", "C" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L232-L260
ssalentin/plip
plip/modules/detection.py
water_bridges
def water_bridges(bs_hba, lig_hba, bs_hbd, lig_hbd, water): """Find water-bridged hydrogen bonds between ligand and protein. For now only considers bridged of first degree.""" data = namedtuple('waterbridge', 'a a_orig_idx atype d d_orig_idx dtype h water water_orig_idx distance_aw ' ...
python
def water_bridges(bs_hba, lig_hba, bs_hbd, lig_hbd, water): """Find water-bridged hydrogen bonds between ligand and protein. For now only considers bridged of first degree.""" data = namedtuple('waterbridge', 'a a_orig_idx atype d d_orig_idx dtype h water water_orig_idx distance_aw ' ...
[ "def", "water_bridges", "(", "bs_hba", ",", "lig_hba", ",", "bs_hbd", ",", "lig_hbd", ",", "water", ")", ":", "data", "=", "namedtuple", "(", "'waterbridge'", ",", "'a a_orig_idx atype d d_orig_idx dtype h water water_orig_idx distance_aw '", "'distance_dw d_angle w_angle t...
Find water-bridged hydrogen bonds between ligand and protein. For now only considers bridged of first degree.
[ "Find", "water", "-", "bridged", "hydrogen", "bonds", "between", "ligand", "and", "protein", ".", "For", "now", "only", "considers", "bridged", "of", "first", "degree", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L263-L330
ssalentin/plip
plip/modules/detection.py
metal_complexation
def metal_complexation(metals, metal_binding_lig, metal_binding_bs): """Find all metal complexes between metals and appropriate groups in both protein and ligand, as well as water""" data = namedtuple('metal_complex', 'metal metal_orig_idx metal_type target target_orig_idx target_type ' ...
python
def metal_complexation(metals, metal_binding_lig, metal_binding_bs): """Find all metal complexes between metals and appropriate groups in both protein and ligand, as well as water""" data = namedtuple('metal_complex', 'metal metal_orig_idx metal_type target target_orig_idx target_type ' ...
[ "def", "metal_complexation", "(", "metals", ",", "metal_binding_lig", ",", "metal_binding_bs", ")", ":", "data", "=", "namedtuple", "(", "'metal_complex'", ",", "'metal metal_orig_idx metal_type target target_orig_idx target_type '", "'coordination_num distance resnr restype '", ...
Find all metal complexes between metals and appropriate groups in both protein and ligand, as well as water
[ "Find", "all", "metal", "complexes", "between", "metals", "and", "appropriate", "groups", "in", "both", "protein", "and", "ligand", "as", "well", "as", "water" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L333-L485
ssalentin/plip
plip/modules/plipxml.py
XMLStorage.getdata
def getdata(self, tree, location, force_string=False): """Gets XML data from a specific element and handles types.""" found = tree.xpath('%s/text()' % location) if not found: return None else: data = found[0] if force_string: return data ...
python
def getdata(self, tree, location, force_string=False): """Gets XML data from a specific element and handles types.""" found = tree.xpath('%s/text()' % location) if not found: return None else: data = found[0] if force_string: return data ...
[ "def", "getdata", "(", "self", ",", "tree", ",", "location", ",", "force_string", "=", "False", ")", ":", "found", "=", "tree", ".", "xpath", "(", "'%s/text()'", "%", "location", ")", "if", "not", "found", ":", "return", "None", "else", ":", "data", ...
Gets XML data from a specific element and handles types.
[ "Gets", "XML", "data", "from", "a", "specific", "element", "and", "handles", "types", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/plipxml.py#L18-L39
ssalentin/plip
plip/modules/plipxml.py
XMLStorage.getcoordinates
def getcoordinates(self, tree, location): """Gets coordinates from a specific element in PLIP XML""" return tuple(float(x) for x in tree.xpath('.//%s/*/text()' % location))
python
def getcoordinates(self, tree, location): """Gets coordinates from a specific element in PLIP XML""" return tuple(float(x) for x in tree.xpath('.//%s/*/text()' % location))
[ "def", "getcoordinates", "(", "self", ",", "tree", ",", "location", ")", ":", "return", "tuple", "(", "float", "(", "x", ")", "for", "x", "in", "tree", ".", "xpath", "(", "'.//%s/*/text()'", "%", "location", ")", ")" ]
Gets coordinates from a specific element in PLIP XML
[ "Gets", "coordinates", "from", "a", "specific", "element", "in", "PLIP", "XML" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/plipxml.py#L41-L43
ssalentin/plip
plip/modules/plipxml.py
BSite.get_atom_mapping
def get_atom_mapping(self): """Parses the ligand atom mapping.""" # Atom mappings smiles_to_pdb_mapping = self.bindingsite.xpath('mappings/smiles_to_pdb/text()') if smiles_to_pdb_mapping == []: self.mappings = {'smiles_to_pdb': None, 'pdb_to_smiles': None} else: ...
python
def get_atom_mapping(self): """Parses the ligand atom mapping.""" # Atom mappings smiles_to_pdb_mapping = self.bindingsite.xpath('mappings/smiles_to_pdb/text()') if smiles_to_pdb_mapping == []: self.mappings = {'smiles_to_pdb': None, 'pdb_to_smiles': None} else: ...
[ "def", "get_atom_mapping", "(", "self", ")", ":", "# Atom mappings", "smiles_to_pdb_mapping", "=", "self", ".", "bindingsite", ".", "xpath", "(", "'mappings/smiles_to_pdb/text()'", ")", "if", "smiles_to_pdb_mapping", "==", "[", "]", ":", "self", ".", "mappings", "...
Parses the ligand atom mapping.
[ "Parses", "the", "ligand", "atom", "mapping", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/plipxml.py#L249-L259
ssalentin/plip
plip/modules/plipxml.py
BSite.get_counts
def get_counts(self): """counts the interaction types and backbone hydrogen bonding in a binding site""" hbondsback = len([hb for hb in self.hbonds if not hb.sidechain]) counts = {'hydrophobics': len(self.hydrophobics), 'hbonds': len(self.hbonds), 'wbridges': len(self.wbridges...
python
def get_counts(self): """counts the interaction types and backbone hydrogen bonding in a binding site""" hbondsback = len([hb for hb in self.hbonds if not hb.sidechain]) counts = {'hydrophobics': len(self.hydrophobics), 'hbonds': len(self.hbonds), 'wbridges': len(self.wbridges...
[ "def", "get_counts", "(", "self", ")", ":", "hbondsback", "=", "len", "(", "[", "hb", "for", "hb", "in", "self", ".", "hbonds", "if", "not", "hb", ".", "sidechain", "]", ")", "counts", "=", "{", "'hydrophobics'", ":", "len", "(", "self", ".", "hydr...
counts the interaction types and backbone hydrogen bonding in a binding site
[ "counts", "the", "interaction", "types", "and", "backbone", "hydrogen", "bonding", "in", "a", "binding", "site" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/plipxml.py#L261-L271
ssalentin/plip
plip/modules/plipxml.py
PLIPXMLREST.load_data
def load_data(self, pdbid): """Loads and parses an XML resource and saves it as a tree if successful""" f = urlopen("http://projects.biotec.tu-dresden.de/plip-rest/pdb/%s?format=xml" % pdbid.lower()) self.doc = etree.parse(f)
python
def load_data(self, pdbid): """Loads and parses an XML resource and saves it as a tree if successful""" f = urlopen("http://projects.biotec.tu-dresden.de/plip-rest/pdb/%s?format=xml" % pdbid.lower()) self.doc = etree.parse(f)
[ "def", "load_data", "(", "self", ",", "pdbid", ")", ":", "f", "=", "urlopen", "(", "\"http://projects.biotec.tu-dresden.de/plip-rest/pdb/%s?format=xml\"", "%", "pdbid", ".", "lower", "(", ")", ")", "self", ".", "doc", "=", "etree", ".", "parse", "(", "f", ")...
Loads and parses an XML resource and saves it as a tree if successful
[ "Loads", "and", "parses", "an", "XML", "resource", "and", "saves", "it", "as", "a", "tree", "if", "successful" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/plipxml.py#L303-L306
ella/ella
ella/articles/migrations/0005_move_updated_to_publishable.py
Migration.forwards
def forwards(self, orm): "Write your forwards methods here." for a in orm.Article.objects.all(): if a.updated: a.last_updated = a.updated a.save(force_update=True)
python
def forwards(self, orm): "Write your forwards methods here." for a in orm.Article.objects.all(): if a.updated: a.last_updated = a.updated a.save(force_update=True)
[ "def", "forwards", "(", "self", ",", "orm", ")", ":", "for", "a", "in", "orm", ".", "Article", ".", "objects", ".", "all", "(", ")", ":", "if", "a", ".", "updated", ":", "a", ".", "last_updated", "=", "a", ".", "updated", "a", ".", "save", "(",...
Write your forwards methods here.
[ "Write", "your", "forwards", "methods", "here", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/articles/migrations/0005_move_updated_to_publishable.py#L16-L21
ssalentin/plip
plip/modules/webservices.py
check_pdb_status
def check_pdb_status(pdbid): """Returns the status and up-to-date entry in the PDB for a given PDB ID""" url = 'http://www.rcsb.org/pdb/rest/idStatus?structureId=%s' % pdbid xmlf = urlopen(url) xml = et.parse(xmlf) xmlf.close() status = None current_pdbid = pdbid for df in xml.xpath('//r...
python
def check_pdb_status(pdbid): """Returns the status and up-to-date entry in the PDB for a given PDB ID""" url = 'http://www.rcsb.org/pdb/rest/idStatus?structureId=%s' % pdbid xmlf = urlopen(url) xml = et.parse(xmlf) xmlf.close() status = None current_pdbid = pdbid for df in xml.xpath('//r...
[ "def", "check_pdb_status", "(", "pdbid", ")", ":", "url", "=", "'http://www.rcsb.org/pdb/rest/idStatus?structureId=%s'", "%", "pdbid", "xmlf", "=", "urlopen", "(", "url", ")", "xml", "=", "et", ".", "parse", "(", "xmlf", ")", "xmlf", ".", "close", "(", ")", ...
Returns the status and up-to-date entry in the PDB for a given PDB ID
[ "Returns", "the", "status", "and", "up", "-", "to", "-", "date", "entry", "in", "the", "PDB", "for", "a", "given", "PDB", "ID" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/webservices.py#L22-L34
ssalentin/plip
plip/modules/webservices.py
fetch_pdb
def fetch_pdb(pdbid): """Get the newest entry from the RCSB server for the given PDB ID. Exits with '1' if PDB ID is invalid.""" pdbid = pdbid.lower() write_message('\nChecking status of PDB ID %s ... ' % pdbid) state, current_entry = check_pdb_status(pdbid) # Get state and current PDB ID if state...
python
def fetch_pdb(pdbid): """Get the newest entry from the RCSB server for the given PDB ID. Exits with '1' if PDB ID is invalid.""" pdbid = pdbid.lower() write_message('\nChecking status of PDB ID %s ... ' % pdbid) state, current_entry = check_pdb_status(pdbid) # Get state and current PDB ID if state...
[ "def", "fetch_pdb", "(", "pdbid", ")", ":", "pdbid", "=", "pdbid", ".", "lower", "(", ")", "write_message", "(", "'\\nChecking status of PDB ID %s ... '", "%", "pdbid", ")", "state", ",", "current_entry", "=", "check_pdb_status", "(", "pdbid", ")", "# Get state ...
Get the newest entry from the RCSB server for the given PDB ID. Exits with '1' if PDB ID is invalid.
[ "Get", "the", "newest", "entry", "from", "the", "RCSB", "server", "for", "the", "given", "PDB", "ID", ".", "Exits", "with", "1", "if", "PDB", "ID", "is", "invalid", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/webservices.py#L37-L59
ella/ella
ella/positions/models.py
PositionBox
def PositionBox(position, *args, **kwargs): " Delegate the boxing. " obj = position.target return getattr(position.target, 'box_class', Box)(obj, *args, **kwargs)
python
def PositionBox(position, *args, **kwargs): " Delegate the boxing. " obj = position.target return getattr(position.target, 'box_class', Box)(obj, *args, **kwargs)
[ "def", "PositionBox", "(", "position", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "obj", "=", "position", ".", "target", "return", "getattr", "(", "position", ".", "target", ",", "'box_class'", ",", "Box", ")", "(", "obj", ",", "*", "args",...
Delegate the boxing.
[ "Delegate", "the", "boxing", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/positions/models.py#L57-L60
ella/ella
ella/positions/models.py
PositionManager.get_active_position
def get_active_position(self, category, name, nofallback=False): """ Get active position for given position name. params: category - Category model to look for name - name of the position nofallback - if True than do not fall back to parent ...
python
def get_active_position(self, category, name, nofallback=False): """ Get active position for given position name. params: category - Category model to look for name - name of the position nofallback - if True than do not fall back to parent ...
[ "def", "get_active_position", "(", "self", ",", "category", ",", "name", ",", "nofallback", "=", "False", ")", ":", "now", "=", "timezone", ".", "now", "(", ")", "lookup", "=", "(", "Q", "(", "active_from__isnull", "=", "True", ")", "|", "Q", "(", "a...
Get active position for given position name. params: category - Category model to look for name - name of the position nofallback - if True than do not fall back to parent category if active position is not found for category
[ "Get", "active", "position", "for", "given", "position", "name", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/positions/models.py#L26-L54
ella/ella
ella/positions/models.py
Position.render
def render(self, context, nodelist, box_type): " Render the position. " if not self.target: if self.target_ct: # broken Generic FK: log.warning('Broken target for position with pk %r', self.pk) return '' try: return ...
python
def render(self, context, nodelist, box_type): " Render the position. " if not self.target: if self.target_ct: # broken Generic FK: log.warning('Broken target for position with pk %r', self.pk) return '' try: return ...
[ "def", "render", "(", "self", ",", "context", ",", "nodelist", ",", "box_type", ")", ":", "if", "not", "self", ".", "target", ":", "if", "self", ".", "target_ct", ":", "# broken Generic FK:", "log", ".", "warning", "(", "'Broken target for position with pk %r'...
Render the position.
[ "Render", "the", "position", "." ]
train
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/positions/models.py#L119-L139
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.set_initial_representations
def set_initial_representations(self): """General settings for PyMOL""" self.standard_settings() cmd.set('dash_gap', 0) # Show not dashes, but lines for the pliprofiler cmd.set('ray_shadow', 0) # Turn on ray shadows for clearer ray-traced images cmd.set('cartoon_color', 'myligh...
python
def set_initial_representations(self): """General settings for PyMOL""" self.standard_settings() cmd.set('dash_gap', 0) # Show not dashes, but lines for the pliprofiler cmd.set('ray_shadow', 0) # Turn on ray shadows for clearer ray-traced images cmd.set('cartoon_color', 'myligh...
[ "def", "set_initial_representations", "(", "self", ")", ":", "self", ".", "standard_settings", "(", ")", "cmd", ".", "set", "(", "'dash_gap'", ",", "0", ")", "# Show not dashes, but lines for the pliprofiler", "cmd", ".", "set", "(", "'ray_shadow'", ",", "0", ")...
General settings for PyMOL
[ "General", "settings", "for", "PyMOL" ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L24-L33
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.standard_settings
def standard_settings(self): """Sets up standard settings for a nice visualization.""" cmd.set('bg_rgb', [1.0, 1.0, 1.0]) # White background cmd.set('depth_cue', 0) # Turn off depth cueing (no fog) cmd.set('cartoon_side_chain_helper', 1) # Improve combined visualization of sticks and ...
python
def standard_settings(self): """Sets up standard settings for a nice visualization.""" cmd.set('bg_rgb', [1.0, 1.0, 1.0]) # White background cmd.set('depth_cue', 0) # Turn off depth cueing (no fog) cmd.set('cartoon_side_chain_helper', 1) # Improve combined visualization of sticks and ...
[ "def", "standard_settings", "(", "self", ")", ":", "cmd", ".", "set", "(", "'bg_rgb'", ",", "[", "1.0", ",", "1.0", ",", "1.0", "]", ")", "# White background", "cmd", ".", "set", "(", "'depth_cue'", ",", "0", ")", "# Turn off depth cueing (no fog)", "cmd",...
Sets up standard settings for a nice visualization.
[ "Sets", "up", "standard", "settings", "for", "a", "nice", "visualization", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L46-L54
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.set_custom_colorset
def set_custom_colorset(self): """Defines a colorset with matching colors. Provided by Joachim.""" cmd.set_color('myorange', '[253, 174, 97]') cmd.set_color('mygreen', '[171, 221, 164]') cmd.set_color('myred', '[215, 25, 28]') cmd.set_color('myblue', '[43, 131, 186]') cmd...
python
def set_custom_colorset(self): """Defines a colorset with matching colors. Provided by Joachim.""" cmd.set_color('myorange', '[253, 174, 97]') cmd.set_color('mygreen', '[171, 221, 164]') cmd.set_color('myred', '[215, 25, 28]') cmd.set_color('myblue', '[43, 131, 186]') cmd...
[ "def", "set_custom_colorset", "(", "self", ")", ":", "cmd", ".", "set_color", "(", "'myorange'", ",", "'[253, 174, 97]'", ")", "cmd", ".", "set_color", "(", "'mygreen'", ",", "'[171, 221, 164]'", ")", "cmd", ".", "set_color", "(", "'myred'", ",", "'[215, 25, 2...
Defines a colorset with matching colors. Provided by Joachim.
[ "Defines", "a", "colorset", "with", "matching", "colors", ".", "Provided", "by", "Joachim", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L56-L63
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.show_hydrophobic
def show_hydrophobic(self): """Visualizes hydrophobic contacts.""" hydroph = self.plcomplex.hydrophobic_contacts if not len(hydroph.bs_ids) == 0: self.select_by_ids('Hydrophobic-P', hydroph.bs_ids, restrict=self.protname) self.select_by_ids('Hydrophobic-L', hydroph.lig_id...
python
def show_hydrophobic(self): """Visualizes hydrophobic contacts.""" hydroph = self.plcomplex.hydrophobic_contacts if not len(hydroph.bs_ids) == 0: self.select_by_ids('Hydrophobic-P', hydroph.bs_ids, restrict=self.protname) self.select_by_ids('Hydrophobic-L', hydroph.lig_id...
[ "def", "show_hydrophobic", "(", "self", ")", ":", "hydroph", "=", "self", ".", "plcomplex", ".", "hydrophobic_contacts", "if", "not", "len", "(", "hydroph", ".", "bs_ids", ")", "==", "0", ":", "self", ".", "select_by_ids", "(", "'Hydrophobic-P'", ",", "hyd...
Visualizes hydrophobic contacts.
[ "Visualizes", "hydrophobic", "contacts", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L83-L98
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.show_hbonds
def show_hbonds(self): """Visualizes hydrogen bonds.""" hbonds = self.plcomplex.hbonds for group in [['HBondDonor-P', hbonds.prot_don_id], ['HBondAccept-P', hbonds.prot_acc_id]]: if not len(group[1]) == 0: self.select_by_ids(group[0], group[1], r...
python
def show_hbonds(self): """Visualizes hydrogen bonds.""" hbonds = self.plcomplex.hbonds for group in [['HBondDonor-P', hbonds.prot_don_id], ['HBondAccept-P', hbonds.prot_acc_id]]: if not len(group[1]) == 0: self.select_by_ids(group[0], group[1], r...
[ "def", "show_hbonds", "(", "self", ")", ":", "hbonds", "=", "self", ".", "plcomplex", ".", "hbonds", "for", "group", "in", "[", "[", "'HBondDonor-P'", ",", "hbonds", ".", "prot_don_id", "]", ",", "[", "'HBondAccept-P'", ",", "hbonds", ".", "prot_acc_id", ...
Visualizes hydrogen bonds.
[ "Visualizes", "hydrogen", "bonds", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L100-L120
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.show_halogen
def show_halogen(self): """Visualize halogen bonds.""" halogen = self.plcomplex.halogen_bonds all_don_x, all_acc_o = [], [] for h in halogen: all_don_x.append(h.don_id) all_acc_o.append(h.acc_id) cmd.select('tmp_bs', 'id %i & %s' % (h.acc_id, self.prot...
python
def show_halogen(self): """Visualize halogen bonds.""" halogen = self.plcomplex.halogen_bonds all_don_x, all_acc_o = [], [] for h in halogen: all_don_x.append(h.don_id) all_acc_o.append(h.acc_id) cmd.select('tmp_bs', 'id %i & %s' % (h.acc_id, self.prot...
[ "def", "show_halogen", "(", "self", ")", ":", "halogen", "=", "self", ".", "plcomplex", ".", "halogen_bonds", "all_don_x", ",", "all_acc_o", "=", "[", "]", ",", "[", "]", "for", "h", "in", "halogen", ":", "all_don_x", ".", "append", "(", "h", ".", "d...
Visualize halogen bonds.
[ "Visualize", "halogen", "bonds", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L122-L137
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.show_stacking
def show_stacking(self): """Visualize pi-stacking interactions.""" stacks = self.plcomplex.pistacking for i, stack in enumerate(stacks): pires_ids = '+'.join(map(str, stack.proteinring_atoms)) pilig_ids = '+'.join(map(str, stack.ligandring_atoms)) cmd.select('...
python
def show_stacking(self): """Visualize pi-stacking interactions.""" stacks = self.plcomplex.pistacking for i, stack in enumerate(stacks): pires_ids = '+'.join(map(str, stack.proteinring_atoms)) pilig_ids = '+'.join(map(str, stack.ligandring_atoms)) cmd.select('...
[ "def", "show_stacking", "(", "self", ")", ":", "stacks", "=", "self", ".", "plcomplex", ".", "pistacking", "for", "i", ",", "stack", "in", "enumerate", "(", "stacks", ")", ":", "pires_ids", "=", "'+'", ".", "join", "(", "map", "(", "str", ",", "stack...
Visualize pi-stacking interactions.
[ "Visualize", "pi", "-", "stacking", "interactions", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L139-L166
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.show_cationpi
def show_cationpi(self): """Visualize cation-pi interactions.""" for i, p in enumerate(self.plcomplex.pication): cmd.pseudoatom('ps-picat-1-%i' % i, pos=p.ring_center) cmd.pseudoatom('ps-picat-2-%i' % i, pos=p.charge_center) if p.protcharged: cmd.pseud...
python
def show_cationpi(self): """Visualize cation-pi interactions.""" for i, p in enumerate(self.plcomplex.pication): cmd.pseudoatom('ps-picat-1-%i' % i, pos=p.ring_center) cmd.pseudoatom('ps-picat-2-%i' % i, pos=p.charge_center) if p.protcharged: cmd.pseud...
[ "def", "show_cationpi", "(", "self", ")", ":", "for", "i", ",", "p", "in", "enumerate", "(", "self", ".", "plcomplex", ".", "pication", ")", ":", "cmd", ".", "pseudoatom", "(", "'ps-picat-1-%i'", "%", "i", ",", "pos", "=", "p", ".", "ring_center", ")...
Visualize cation-pi interactions.
[ "Visualize", "cation", "-", "pi", "interactions", "." ]
train
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L168-L191