repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
bykof/billomapy
billomapy/billomapy.py
Billomapy.complete_delivery_note
def complete_delivery_note(self, delivery_note_id, complete_dict): """ Completes an delivery note :param complete_dict: the complete dict with the template id :param delivery_note_id: the delivery note id :return: Response """ return self._create_put_request( ...
python
def complete_delivery_note(self, delivery_note_id, complete_dict): """ Completes an delivery note :param complete_dict: the complete dict with the template id :param delivery_note_id: the delivery note id :return: Response """ return self._create_put_request( ...
[ "def", "complete_delivery_note", "(", "self", ",", "delivery_note_id", ",", "complete_dict", ")", ":", "return", "self", ".", "_create_put_request", "(", "resource", "=", "DELIVERY_NOTES", ",", "billomat_id", "=", "delivery_note_id", ",", "command", "=", "COMPLETE",...
Completes an delivery note :param complete_dict: the complete dict with the template id :param delivery_note_id: the delivery note id :return: Response
[ "Completes", "an", "delivery", "note" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3564-L3577
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.delivery_note_pdf
def delivery_note_pdf(self, delivery_note_id): """ Opens a pdf of a delivery note :param delivery_note_id: the delivery note id :return: dict """ return self._create_get_request(resource=DELIVERY_NOTES, billomat_id=delivery_note_id, command=PDF)
python
def delivery_note_pdf(self, delivery_note_id): """ Opens a pdf of a delivery note :param delivery_note_id: the delivery note id :return: dict """ return self._create_get_request(resource=DELIVERY_NOTES, billomat_id=delivery_note_id, command=PDF)
[ "def", "delivery_note_pdf", "(", "self", ",", "delivery_note_id", ")", ":", "return", "self", ".", "_create_get_request", "(", "resource", "=", "DELIVERY_NOTES", ",", "billomat_id", "=", "delivery_note_id", ",", "command", "=", "PDF", ")" ]
Opens a pdf of a delivery note :param delivery_note_id: the delivery note id :return: dict
[ "Opens", "a", "pdf", "of", "a", "delivery", "note" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3579-L3586
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_items_of_delivery_note_per_page
def get_items_of_delivery_note_per_page(self, delivery_note_id, per_page=1000, page=1): """ Get items of delivery note per page :param delivery_note_id: the delivery note id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :re...
python
def get_items_of_delivery_note_per_page(self, delivery_note_id, per_page=1000, page=1): """ Get items of delivery note per page :param delivery_note_id: the delivery note id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :re...
[ "def", "get_items_of_delivery_note_per_page", "(", "self", ",", "delivery_note_id", ",", "per_page", "=", "1000", ",", "page", "=", "1", ")", ":", "return", "self", ".", "_get_resource_per_page", "(", "resource", "=", "DELIVERY_NOTE_ITEMS", ",", "per_page", "=", ...
Get items of delivery note per page :param delivery_note_id: the delivery note id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :return: list
[ "Get", "items", "of", "delivery", "note", "per", "page" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3612-L3626
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_all_items_of_delivery_note
def get_all_items_of_delivery_note(self, delivery_note_id): """ Get all items of delivery note This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param delivery_note_id: the delivery not...
python
def get_all_items_of_delivery_note(self, delivery_note_id): """ Get all items of delivery note This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param delivery_note_id: the delivery not...
[ "def", "get_all_items_of_delivery_note", "(", "self", ",", "delivery_note_id", ")", ":", "return", "self", ".", "_iterate_through_pages", "(", "get_function", "=", "self", ".", "get_items_of_delivery_note_per_page", ",", "resource", "=", "DELIVERY_NOTE_ITEMS", ",", "**"...
Get all items of delivery note This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param delivery_note_id: the delivery note id :return: list
[ "Get", "all", "items", "of", "delivery", "note", "This", "will", "iterate", "over", "all", "pages", "until", "it", "gets", "all", "elements", ".", "So", "if", "the", "rate", "limit", "exceeded", "it", "will", "throw", "an", "Exception", "and", "you", "wi...
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3628-L3641
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.update_delivery_note_item
def update_delivery_note_item(self, delivery_note_item_id, delivery_note_item_dict): """ Updates a delivery note item :param delivery_note_item_id: delivery note item id :param delivery_note_item_dict: dict :return: dict """ return self._create_put_request( ...
python
def update_delivery_note_item(self, delivery_note_item_id, delivery_note_item_dict): """ Updates a delivery note item :param delivery_note_item_id: delivery note item id :param delivery_note_item_dict: dict :return: dict """ return self._create_put_request( ...
[ "def", "update_delivery_note_item", "(", "self", ",", "delivery_note_item_id", ",", "delivery_note_item_dict", ")", ":", "return", "self", ".", "_create_put_request", "(", "resource", "=", "DELIVERY_NOTE_ITEMS", ",", "billomat_id", "=", "delivery_note_item_id", ",", "se...
Updates a delivery note item :param delivery_note_item_id: delivery note item id :param delivery_note_item_dict: dict :return: dict
[ "Updates", "a", "delivery", "note", "item" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3661-L3673
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_comments_of_delivery_note_per_page
def get_comments_of_delivery_note_per_page(self, delivery_note_id, per_page=1000, page=1): """ Get comments of delivery note per page :param delivery_note_id: the delivery note :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 ...
python
def get_comments_of_delivery_note_per_page(self, delivery_note_id, per_page=1000, page=1): """ Get comments of delivery note per page :param delivery_note_id: the delivery note :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 ...
[ "def", "get_comments_of_delivery_note_per_page", "(", "self", ",", "delivery_note_id", ",", "per_page", "=", "1000", ",", "page", "=", "1", ")", ":", "return", "self", ".", "_get_resource_per_page", "(", "resource", "=", "DELIVERY_NOTE_COMMENTS", ",", "per_page", ...
Get comments of delivery note per page :param delivery_note_id: the delivery note :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :return: list
[ "Get", "comments", "of", "delivery", "note", "per", "page" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3691-L3705
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_all_comments_of_delivery_note
def get_all_comments_of_delivery_note(self, delivery_note_id): """ Get all comments of delivery note This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param delivery_note_id: the delive...
python
def get_all_comments_of_delivery_note(self, delivery_note_id): """ Get all comments of delivery note This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param delivery_note_id: the delive...
[ "def", "get_all_comments_of_delivery_note", "(", "self", ",", "delivery_note_id", ")", ":", "return", "self", ".", "_iterate_through_pages", "(", "get_function", "=", "self", ".", "get_comments_of_delivery_note_per_page", ",", "resource", "=", "DELIVERY_NOTE_COMMENTS", ",...
Get all comments of delivery note This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param delivery_note_id: the delivery note id :return: list
[ "Get", "all", "comments", "of", "delivery", "note", "This", "will", "iterate", "over", "all", "pages", "until", "it", "gets", "all", "elements", ".", "So", "if", "the", "rate", "limit", "exceeded", "it", "will", "throw", "an", "Exception", "and", "you", ...
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3707-L3720
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.update_delivery_note_comment
def update_delivery_note_comment(self, delivery_note_comment_id, delivery_note_comment_dict): """ Updates a delivery note comment :param delivery_note_comment_id: the delivery note comment id :param delivery_note_comment_dict: dict :return: dict """ return self._...
python
def update_delivery_note_comment(self, delivery_note_comment_id, delivery_note_comment_dict): """ Updates a delivery note comment :param delivery_note_comment_id: the delivery note comment id :param delivery_note_comment_dict: dict :return: dict """ return self._...
[ "def", "update_delivery_note_comment", "(", "self", ",", "delivery_note_comment_id", ",", "delivery_note_comment_dict", ")", ":", "return", "self", ".", "_create_put_request", "(", "resource", "=", "DELIVERY_NOTE_COMMENTS", ",", "billomat_id", "=", "delivery_note_comment_id...
Updates a delivery note comment :param delivery_note_comment_id: the delivery note comment id :param delivery_note_comment_dict: dict :return: dict
[ "Updates", "a", "delivery", "note", "comment" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3740-L3752
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_tags_of_delivery_note_per_page
def get_tags_of_delivery_note_per_page(self, delivery_note_id, per_page=1000, page=1): """ Get tags of delivery note per page :param delivery_note_id: the delivery note id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :retu...
python
def get_tags_of_delivery_note_per_page(self, delivery_note_id, per_page=1000, page=1): """ Get tags of delivery note per page :param delivery_note_id: the delivery note id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :retu...
[ "def", "get_tags_of_delivery_note_per_page", "(", "self", ",", "delivery_note_id", ",", "per_page", "=", "1000", ",", "page", "=", "1", ")", ":", "return", "self", ".", "_get_resource_per_page", "(", "resource", "=", "DELIVERY_NOTE_TAGS", ",", "per_page", "=", "...
Get tags of delivery note per page :param delivery_note_id: the delivery note id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :return: list
[ "Get", "tags", "of", "delivery", "note", "per", "page" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3769-L3783
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_all_tags_of_delivery_note
def get_all_tags_of_delivery_note(self, delivery_note_id): """ Get all tags of delivery note This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param delivery_note_id: the delivery note ...
python
def get_all_tags_of_delivery_note(self, delivery_note_id): """ Get all tags of delivery note This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param delivery_note_id: the delivery note ...
[ "def", "get_all_tags_of_delivery_note", "(", "self", ",", "delivery_note_id", ")", ":", "return", "self", ".", "_iterate_through_pages", "(", "get_function", "=", "self", ".", "get_tags_of_delivery_note_per_page", ",", "resource", "=", "DELIVERY_NOTE_TAGS", ",", "**", ...
Get all tags of delivery note This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param delivery_note_id: the delivery note id :return: list
[ "Get", "all", "tags", "of", "delivery", "note", "This", "will", "iterate", "over", "all", "pages", "until", "it", "gets", "all", "elements", ".", "So", "if", "the", "rate", "limit", "exceeded", "it", "will", "throw", "an", "Exception", "and", "you", "wil...
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3785-L3798
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_letters_per_page
def get_letters_per_page(self, per_page=1000, page=1, params=None): """ Get letters per page :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :param params: Search parameters. Default: {} :return: list """ retu...
python
def get_letters_per_page(self, per_page=1000, page=1, params=None): """ Get letters per page :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :param params: Search parameters. Default: {} :return: list """ retu...
[ "def", "get_letters_per_page", "(", "self", ",", "per_page", "=", "1000", ",", "page", "=", "1", ",", "params", "=", "None", ")", ":", "return", "self", ".", "_get_resource_per_page", "(", "resource", "=", "LETTERS", ",", "per_page", "=", "per_page", ",", ...
Get letters per page :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :param params: Search parameters. Default: {} :return: list
[ "Get", "letters", "per", "page" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3834-L3843
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_all_letters
def get_all_letters(self, params=None): """ Get all letters This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list """ if no...
python
def get_all_letters(self, params=None): """ Get all letters This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list """ if no...
[ "def", "get_all_letters", "(", "self", ",", "params", "=", "None", ")", ":", "if", "not", "params", ":", "params", "=", "{", "}", "return", "self", ".", "_iterate_through_pages", "(", "self", ".", "get_letters_per_page", ",", "resource", "=", "LETTERS", ",...
Get all letters This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list
[ "Get", "all", "letters", "This", "will", "iterate", "over", "all", "pages", "until", "it", "gets", "all", "elements", ".", "So", "if", "the", "rate", "limit", "exceeded", "it", "will", "throw", "an", "Exception", "and", "you", "will", "get", "nothing" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3845-L3856
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.update_letter
def update_letter(self, letter_id, letter_dict): """ Updates a letter :param letter_id: the letter id :param letter_dict: dict :return: dict """ return self._create_put_request( resource=LETTERS, billomat_id=letter_id, send_dat...
python
def update_letter(self, letter_id, letter_dict): """ Updates a letter :param letter_id: the letter id :param letter_dict: dict :return: dict """ return self._create_put_request( resource=LETTERS, billomat_id=letter_id, send_dat...
[ "def", "update_letter", "(", "self", ",", "letter_id", ",", "letter_dict", ")", ":", "return", "self", ".", "_create_put_request", "(", "resource", "=", "LETTERS", ",", "billomat_id", "=", "letter_id", ",", "send_data", "=", "letter_dict", ")" ]
Updates a letter :param letter_id: the letter id :param letter_dict: dict :return: dict
[ "Updates", "a", "letter" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3876-L3888
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_comments_of_letter_per_page
def get_comments_of_letter_per_page(self, letter_id, per_page=1000, page=1): """ Get comments of letter per page :param letter_id: the letter id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :return: list """ ...
python
def get_comments_of_letter_per_page(self, letter_id, per_page=1000, page=1): """ Get comments of letter per page :param letter_id: the letter id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :return: list """ ...
[ "def", "get_comments_of_letter_per_page", "(", "self", ",", "letter_id", ",", "per_page", "=", "1000", ",", "page", "=", "1", ")", ":", "return", "self", ".", "_get_resource_per_page", "(", "resource", "=", "LETTER_COMMENTS", ",", "per_page", "=", "per_page", ...
Get comments of letter per page :param letter_id: the letter id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :return: list
[ "Get", "comments", "of", "letter", "per", "page" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3906-L3920
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_all_comments_of_letter
def get_all_comments_of_letter(self, letter_id): """ Get all comments of letter This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param letter_id: the letter id :return: list ...
python
def get_all_comments_of_letter(self, letter_id): """ Get all comments of letter This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param letter_id: the letter id :return: list ...
[ "def", "get_all_comments_of_letter", "(", "self", ",", "letter_id", ")", ":", "return", "self", ".", "_iterate_through_pages", "(", "get_function", "=", "self", ".", "get_comments_of_letter_per_page", ",", "resource", "=", "LETTER_COMMENTS", ",", "**", "{", "'letter...
Get all comments of letter This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param letter_id: the letter id :return: list
[ "Get", "all", "comments", "of", "letter", "This", "will", "iterate", "over", "all", "pages", "until", "it", "gets", "all", "elements", ".", "So", "if", "the", "rate", "limit", "exceeded", "it", "will", "throw", "an", "Exception", "and", "you", "will", "g...
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3922-L3935
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.update_letter_comment
def update_letter_comment(self, letter_comment_id, letter_comment_dict): """ Updates a letter comment :param letter_comment_id: the letter command id :param letter_comment_dict: dict :return: dict """ return self._create_put_request( resource=LETTER_C...
python
def update_letter_comment(self, letter_comment_id, letter_comment_dict): """ Updates a letter comment :param letter_comment_id: the letter command id :param letter_comment_dict: dict :return: dict """ return self._create_put_request( resource=LETTER_C...
[ "def", "update_letter_comment", "(", "self", ",", "letter_comment_id", ",", "letter_comment_dict", ")", ":", "return", "self", ".", "_create_put_request", "(", "resource", "=", "LETTER_COMMENTS", ",", "billomat_id", "=", "letter_comment_id", ",", "send_data", "=", "...
Updates a letter comment :param letter_comment_id: the letter command id :param letter_comment_dict: dict :return: dict
[ "Updates", "a", "letter", "comment" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3955-L3967
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_tags_of_letter_per_page
def get_tags_of_letter_per_page(self, letter_id, per_page=1000, page=1): """ Get tags of letter per page :param letter_id: the letter id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :return: list """ return...
python
def get_tags_of_letter_per_page(self, letter_id, per_page=1000, page=1): """ Get tags of letter per page :param letter_id: the letter id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :return: list """ return...
[ "def", "get_tags_of_letter_per_page", "(", "self", ",", "letter_id", ",", "per_page", "=", "1000", ",", "page", "=", "1", ")", ":", "return", "self", ".", "_get_resource_per_page", "(", "resource", "=", "LETTER_TAGS", ",", "per_page", "=", "per_page", ",", "...
Get tags of letter per page :param letter_id: the letter id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :return: list
[ "Get", "tags", "of", "letter", "per", "page" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L3984-L3998
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_all_tags_of_letter
def get_all_tags_of_letter(self, letter_id): """ Get all tags of letter This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param letter_id: the letter id :return: list ""...
python
def get_all_tags_of_letter(self, letter_id): """ Get all tags of letter This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param letter_id: the letter id :return: list ""...
[ "def", "get_all_tags_of_letter", "(", "self", ",", "letter_id", ")", ":", "return", "self", ".", "_iterate_through_pages", "(", "get_function", "=", "self", ".", "get_tags_of_letter_per_page", ",", "resource", "=", "LETTER_TAGS", ",", "**", "{", "'letter_id'", ":"...
Get all tags of letter This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param letter_id: the letter id :return: list
[ "Get", "all", "tags", "of", "letter", "This", "will", "iterate", "over", "all", "pages", "until", "it", "gets", "all", "elements", ".", "So", "if", "the", "rate", "limit", "exceeded", "it", "will", "throw", "an", "Exception", "and", "you", "will", "get",...
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L4000-L4013
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_email_templates_per_page
def get_email_templates_per_page(self, per_page=1000, page=1, params=None): """ Get e-mail templates per page :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :param params: Search parameters. Default: {} :return: list ...
python
def get_email_templates_per_page(self, per_page=1000, page=1, params=None): """ Get e-mail templates per page :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :param params: Search parameters. Default: {} :return: list ...
[ "def", "get_email_templates_per_page", "(", "self", ",", "per_page", "=", "1000", ",", "page", "=", "1", ",", "params", "=", "None", ")", ":", "return", "self", ".", "_get_resource_per_page", "(", "resource", "=", "EMAIL_TEMPLATES", ",", "per_page", "=", "pe...
Get e-mail templates per page :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :param params: Search parameters. Default: {} :return: list
[ "Get", "e", "-", "mail", "templates", "per", "page" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L4050-L4059
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_email_templates
def get_email_templates(self, params=None): """ Get all e-mail templates This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list """...
python
def get_email_templates(self, params=None): """ Get all e-mail templates This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list """...
[ "def", "get_email_templates", "(", "self", ",", "params", "=", "None", ")", ":", "if", "not", "params", ":", "params", "=", "{", "}", "return", "self", ".", "_iterate_through_pages", "(", "self", ".", "get_email_templates_per_page", ",", "resource", "=", "EM...
Get all e-mail templates This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list
[ "Get", "all", "e", "-", "mail", "templates", "This", "will", "iterate", "over", "all", "pages", "until", "it", "gets", "all", "elements", ".", "So", "if", "the", "rate", "limit", "exceeded", "it", "will", "throw", "an", "Exception", "and", "you", "will",...
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L4061-L4073
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.update_email_template
def update_email_template(self, template_id, template_dict): """ Updates a emailtemplate :param template_id: the template id :param template_dict: dict :return: dict """ return self._create_put_request( resource=EMAIL_TEMPLATES, billomat_i...
python
def update_email_template(self, template_id, template_dict): """ Updates a emailtemplate :param template_id: the template id :param template_dict: dict :return: dict """ return self._create_put_request( resource=EMAIL_TEMPLATES, billomat_i...
[ "def", "update_email_template", "(", "self", ",", "template_id", ",", "template_dict", ")", ":", "return", "self", ".", "_create_put_request", "(", "resource", "=", "EMAIL_TEMPLATES", ",", "billomat_id", "=", "template_id", ",", "send_data", "=", "template_dict", ...
Updates a emailtemplate :param template_id: the template id :param template_dict: dict :return: dict
[ "Updates", "a", "emailtemplate" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L4093-L4105
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_templates_per_page
def get_templates_per_page(self, per_page=1000, page=1, params=None): """ Get templates per page :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :param params: Search parameters. Default: {} :return: list """ ...
python
def get_templates_per_page(self, per_page=1000, page=1, params=None): """ Get templates per page :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :param params: Search parameters. Default: {} :return: list """ ...
[ "def", "get_templates_per_page", "(", "self", ",", "per_page", "=", "1000", ",", "page", "=", "1", ",", "params", "=", "None", ")", ":", "return", "self", ".", "_get_resource_per_page", "(", "resource", "=", "TEMPLATES", ",", "per_page", "=", "per_page", "...
Get templates per page :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :param params: Search parameters. Default: {} :return: list
[ "Get", "templates", "per", "page" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L4123-L4132
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.get_all_templates
def get_all_templates(self, params=None): """ Get all templates This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list """ i...
python
def get_all_templates(self, params=None): """ Get all templates This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list """ i...
[ "def", "get_all_templates", "(", "self", ",", "params", "=", "None", ")", ":", "if", "not", "params", ":", "params", "=", "{", "}", "return", "self", ".", "_iterate_through_pages", "(", "self", ".", "get_templates_per_page", ",", "resource", "=", "TEMPLATES"...
Get all templates This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list
[ "Get", "all", "templates", "This", "will", "iterate", "over", "all", "pages", "until", "it", "gets", "all", "elements", ".", "So", "if", "the", "rate", "limit", "exceeded", "it", "will", "throw", "an", "Exception", "and", "you", "will", "get", "nothing" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L4134-L4145
train
bykof/billomapy
billomapy/billomapy.py
Billomapy.update_template
def update_template(self, template_id, template_dict): """ Updates a template :param template_id: the template id :param template_dict: dict :return: dict """ return self._create_put_request( resource=TEMPLATES, billomat_id=template_id, ...
python
def update_template(self, template_id, template_dict): """ Updates a template :param template_id: the template id :param template_dict: dict :return: dict """ return self._create_put_request( resource=TEMPLATES, billomat_id=template_id, ...
[ "def", "update_template", "(", "self", ",", "template_id", ",", "template_dict", ")", ":", "return", "self", ".", "_create_put_request", "(", "resource", "=", "TEMPLATES", ",", "billomat_id", "=", "template_id", ",", "send_data", "=", "template_dict", ")" ]
Updates a template :param template_id: the template id :param template_dict: dict :return: dict
[ "Updates", "a", "template" ]
a28ba69fd37654fa145d0411d52c200e7f8984ab
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L4165-L4177
train
Kortemme-Lab/klab
klab/cloning/cloning.py
reverse_translate
def reverse_translate( protein_seq, template_dna=None, leading_seq=None, trailing_seq=None, forbidden_seqs=(), include_stop=True, manufacturer=None): """ Generate a well-behaved DNA sequence from the given protein sequence. If a template DNA sequence is specified, the returned DNA ...
python
def reverse_translate( protein_seq, template_dna=None, leading_seq=None, trailing_seq=None, forbidden_seqs=(), include_stop=True, manufacturer=None): """ Generate a well-behaved DNA sequence from the given protein sequence. If a template DNA sequence is specified, the returned DNA ...
[ "def", "reverse_translate", "(", "protein_seq", ",", "template_dna", "=", "None", ",", "leading_seq", "=", "None", ",", "trailing_seq", "=", "None", ",", "forbidden_seqs", "=", "(", ")", ",", "include_stop", "=", "True", ",", "manufacturer", "=", "None", ")"...
Generate a well-behaved DNA sequence from the given protein sequence. If a template DNA sequence is specified, the returned DNA sequence will be as similar to it as possible. Any given restriction sites will not be present in the sequence. And finally, the given leading and trailing sequences wi...
[ "Generate", "a", "well", "-", "behaved", "DNA", "sequence", "from", "the", "given", "protein", "sequence", ".", "If", "a", "template", "DNA", "sequence", "is", "specified", "the", "returned", "DNA", "sequence", "will", "be", "as", "similar", "to", "it", "a...
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/cloning/cloning.py#L21-L46
train
Kortemme-Lab/klab
klab/cloning/cloning.py
make_codon_list
def make_codon_list(protein_seq, template_dna=None, include_stop=True): """ Return a list of codons that would be translated to the given protein sequence. Codons are picked first to minimize the mutations relative to a template DNA sequence and second to prefer "optimal" codons. """ codon_l...
python
def make_codon_list(protein_seq, template_dna=None, include_stop=True): """ Return a list of codons that would be translated to the given protein sequence. Codons are picked first to minimize the mutations relative to a template DNA sequence and second to prefer "optimal" codons. """ codon_l...
[ "def", "make_codon_list", "(", "protein_seq", ",", "template_dna", "=", "None", ",", "include_stop", "=", "True", ")", ":", "codon_list", "=", "[", "]", "if", "template_dna", "is", "None", ":", "template_dna", "=", "[", "]", "for", "i", ",", "res", "in",...
Return a list of codons that would be translated to the given protein sequence. Codons are picked first to minimize the mutations relative to a template DNA sequence and second to prefer "optimal" codons.
[ "Return", "a", "list", "of", "codons", "that", "would", "be", "translated", "to", "the", "given", "protein", "sequence", ".", "Codons", "are", "picked", "first", "to", "minimize", "the", "mutations", "relative", "to", "a", "template", "DNA", "sequence", "and...
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/cloning/cloning.py#L48-L85
train
Kortemme-Lab/klab
klab/cloning/cloning.py
sanitize_codon_list
def sanitize_codon_list(codon_list, forbidden_seqs=()): """ Make silent mutations to the given codon lists to remove any undesirable sequences that are present within it. Undesirable sequences include restriction sites, which may be optionally specified as a second argument, and homopolymers abo...
python
def sanitize_codon_list(codon_list, forbidden_seqs=()): """ Make silent mutations to the given codon lists to remove any undesirable sequences that are present within it. Undesirable sequences include restriction sites, which may be optionally specified as a second argument, and homopolymers abo...
[ "def", "sanitize_codon_list", "(", "codon_list", ",", "forbidden_seqs", "=", "(", ")", ")", ":", "for", "codon", "in", "codon_list", ":", "if", "len", "(", "codon", ")", "!=", "3", ":", "raise", "ValueError", "(", "\"Codons must have exactly 3 bases: '{}'\"", ...
Make silent mutations to the given codon lists to remove any undesirable sequences that are present within it. Undesirable sequences include restriction sites, which may be optionally specified as a second argument, and homopolymers above a pre-defined length. The return value is the number of cor...
[ "Make", "silent", "mutations", "to", "the", "given", "codon", "lists", "to", "remove", "any", "undesirable", "sequences", "that", "are", "present", "within", "it", ".", "Undesirable", "sequences", "include", "restriction", "sites", "which", "may", "be", "optiona...
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/cloning/cloning.py#L87-L134
train
Kortemme-Lab/klab
klab/cloning/cloning.py
remove_bad_sequence
def remove_bad_sequence(codon_list, bad_seq, bad_seqs): """ Make a silent mutation to the given codon list to remove the first instance of the given bad sequence found in the gene sequence. If the bad sequence isn't found, nothing happens and the function returns false. Otherwise the function r...
python
def remove_bad_sequence(codon_list, bad_seq, bad_seqs): """ Make a silent mutation to the given codon list to remove the first instance of the given bad sequence found in the gene sequence. If the bad sequence isn't found, nothing happens and the function returns false. Otherwise the function r...
[ "def", "remove_bad_sequence", "(", "codon_list", ",", "bad_seq", ",", "bad_seqs", ")", ":", "gene_seq", "=", "''", ".", "join", "(", "codon_list", ")", "problem", "=", "bad_seq", ".", "search", "(", "gene_seq", ")", "if", "not", "problem", ":", "return", ...
Make a silent mutation to the given codon list to remove the first instance of the given bad sequence found in the gene sequence. If the bad sequence isn't found, nothing happens and the function returns false. Otherwise the function returns true. You can use these return values to easily write a ...
[ "Make", "a", "silent", "mutation", "to", "the", "given", "codon", "list", "to", "remove", "the", "first", "instance", "of", "the", "given", "bad", "sequence", "found", "in", "the", "gene", "sequence", ".", "If", "the", "bad", "sequence", "isn", "t", "fou...
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/cloning/cloning.py#L136-L173
train
Kortemme-Lab/klab
klab/cloning/cloning.py
problem_with_codon
def problem_with_codon(codon_index, codon_list, bad_seqs): """ Return true if the given codon overlaps with a bad sequence. """ base_1 = 3 * codon_index base_3 = 3 * codon_index + 2 gene_seq = ''.join(codon_list) for bad_seq in bad_seqs: problem = bad_seq.search(gene_seq) ...
python
def problem_with_codon(codon_index, codon_list, bad_seqs): """ Return true if the given codon overlaps with a bad sequence. """ base_1 = 3 * codon_index base_3 = 3 * codon_index + 2 gene_seq = ''.join(codon_list) for bad_seq in bad_seqs: problem = bad_seq.search(gene_seq) ...
[ "def", "problem_with_codon", "(", "codon_index", ",", "codon_list", ",", "bad_seqs", ")", ":", "base_1", "=", "3", "*", "codon_index", "base_3", "=", "3", "*", "codon_index", "+", "2", "gene_seq", "=", "''", ".", "join", "(", "codon_list", ")", "for", "b...
Return true if the given codon overlaps with a bad sequence.
[ "Return", "true", "if", "the", "given", "codon", "overlaps", "with", "a", "bad", "sequence", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/cloning/cloning.py#L175-L190
train
Kortemme-Lab/klab
klab/cloning/cloning.py
sequences_from_fasta
def sequences_from_fasta(path): """ Extract multiple sequences from a FASTA file. """ from Bio import SeqIO return {x.description: x.seq for x in SeqIO.parse(path, 'fasta')}
python
def sequences_from_fasta(path): """ Extract multiple sequences from a FASTA file. """ from Bio import SeqIO return {x.description: x.seq for x in SeqIO.parse(path, 'fasta')}
[ "def", "sequences_from_fasta", "(", "path", ")", ":", "from", "Bio", "import", "SeqIO", "return", "{", "x", ".", "description", ":", "x", ".", "seq", "for", "x", "in", "SeqIO", ".", "parse", "(", "path", ",", "'fasta'", ")", "}" ]
Extract multiple sequences from a FASTA file.
[ "Extract", "multiple", "sequences", "from", "a", "FASTA", "file", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/cloning/cloning.py#L204-L209
train
Kortemme-Lab/klab
klab/cloning/cloning.py
write_sequences_to_fasta
def write_sequences_to_fasta(path, seqs): """ Create a FASTA file listing the given sequences. Arguments ========= path: str or pathlib.Path The name of the file to create. seqs: dict A mapping of names to sequences, which can be either protein or DNA. """ from Bio impo...
python
def write_sequences_to_fasta(path, seqs): """ Create a FASTA file listing the given sequences. Arguments ========= path: str or pathlib.Path The name of the file to create. seqs: dict A mapping of names to sequences, which can be either protein or DNA. """ from Bio impo...
[ "def", "write_sequences_to_fasta", "(", "path", ",", "seqs", ")", ":", "from", "Bio", "import", "SeqIO", "from", "Bio", ".", "Seq", "import", "Seq", "from", "Bio", ".", "SeqRecord", "import", "SeqRecord", "path", "=", "Path", "(", "path", ")", "records", ...
Create a FASTA file listing the given sequences. Arguments ========= path: str or pathlib.Path The name of the file to create. seqs: dict A mapping of names to sequences, which can be either protein or DNA.
[ "Create", "a", "FASTA", "file", "listing", "the", "given", "sequences", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/cloning/cloning.py#L374-L397
train
Kortemme-Lab/klab
klab/cloning/cloning.py
write_sequences_to_xlsx
def write_sequences_to_xlsx(path, seqs): """ Create a XLSX file listing the given sequences. Arguments ========= path: str or pathlib.Path The name of the file to create. seqs: dict A mapping of names to sequences, which can be either protein or DNA. """ from openpyxl i...
python
def write_sequences_to_xlsx(path, seqs): """ Create a XLSX file listing the given sequences. Arguments ========= path: str or pathlib.Path The name of the file to create. seqs: dict A mapping of names to sequences, which can be either protein or DNA. """ from openpyxl i...
[ "def", "write_sequences_to_xlsx", "(", "path", ",", "seqs", ")", ":", "from", "openpyxl", "import", "Workbook", "wb", "=", "Workbook", "(", ")", "ws", "=", "wb", ".", "active", "for", "row", ",", "id", "in", "enumerate", "(", "seqs", ",", "1", ")", "...
Create a XLSX file listing the given sequences. Arguments ========= path: str or pathlib.Path The name of the file to create. seqs: dict A mapping of names to sequences, which can be either protein or DNA.
[ "Create", "a", "XLSX", "file", "listing", "the", "given", "sequences", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/cloning/cloning.py#L422-L443
train
berkeley-cocosci/Wallace
wallace/networks.py
DiscreteGenerational.add_node
def add_node(self, node): """Link the agent to a random member of the previous generation.""" nodes = [n for n in self.nodes() if not isinstance(n, Source)] num_agents = len(nodes) curr_generation = int((num_agents - 1) / float(self.generation_size)) node.generation = curr_genera...
python
def add_node(self, node): """Link the agent to a random member of the previous generation.""" nodes = [n for n in self.nodes() if not isinstance(n, Source)] num_agents = len(nodes) curr_generation = int((num_agents - 1) / float(self.generation_size)) node.generation = curr_genera...
[ "def", "add_node", "(", "self", ",", "node", ")", ":", "nodes", "=", "[", "n", "for", "n", "in", "self", ".", "nodes", "(", ")", "if", "not", "isinstance", "(", "n", ",", "Source", ")", "]", "num_agents", "=", "len", "(", "nodes", ")", "curr_gene...
Link the agent to a random member of the previous generation.
[ "Link", "the", "agent", "to", "a", "random", "member", "of", "the", "previous", "generation", "." ]
3650c0bc3b0804d0adb1d178c5eba9992babb1b0
https://github.com/berkeley-cocosci/Wallace/blob/3650c0bc3b0804d0adb1d178c5eba9992babb1b0/wallace/networks.py#L138-L170
train
berkeley-cocosci/Wallace
wallace/networks.py
ScaleFree.add_node
def add_node(self, node): """Add newcomers one by one, using linear preferential attachment.""" nodes = self.nodes() # Start with a core of m0 fully-connected agents... if len(nodes) <= self.m0: other_nodes = [n for n in nodes if n.id != node.id] for n in other_n...
python
def add_node(self, node): """Add newcomers one by one, using linear preferential attachment.""" nodes = self.nodes() # Start with a core of m0 fully-connected agents... if len(nodes) <= self.m0: other_nodes = [n for n in nodes if n.id != node.id] for n in other_n...
[ "def", "add_node", "(", "self", ",", "node", ")", ":", "nodes", "=", "self", ".", "nodes", "(", ")", "if", "len", "(", "nodes", ")", "<=", "self", ".", "m0", ":", "other_nodes", "=", "[", "n", "for", "n", "in", "nodes", "if", "n", ".", "id", ...
Add newcomers one by one, using linear preferential attachment.
[ "Add", "newcomers", "one", "by", "one", "using", "linear", "preferential", "attachment", "." ]
3650c0bc3b0804d0adb1d178c5eba9992babb1b0
https://github.com/berkeley-cocosci/Wallace/blob/3650c0bc3b0804d0adb1d178c5eba9992babb1b0/wallace/networks.py#L200-L232
train
TUNE-Archive/freight_forwarder
freight_forwarder/container/config.py
Config.docker_py_dict
def docker_py_dict(self): """Convert object to match valid docker-py properties. """ return { 'image': self.image, 'command': self.cmd, 'hostname': self.hostname, 'user': self.user, 'detach': self.detach, 'stdin_open': self....
python
def docker_py_dict(self): """Convert object to match valid docker-py properties. """ return { 'image': self.image, 'command': self.cmd, 'hostname': self.hostname, 'user': self.user, 'detach': self.detach, 'stdin_open': self....
[ "def", "docker_py_dict", "(", "self", ")", ":", "return", "{", "'image'", ":", "self", ".", "image", ",", "'command'", ":", "self", ".", "cmd", ",", "'hostname'", ":", "self", ".", "hostname", ",", "'user'", ":", "self", ".", "user", ",", "'detach'", ...
Convert object to match valid docker-py properties.
[ "Convert", "object", "to", "match", "valid", "docker", "-", "py", "properties", "." ]
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container/config.py#L75-L94
train
uw-it-aca/uw-restclients-pws
uw_pws/__init__.py
PWS.get_person_by_regid
def get_person_by_regid(self, regid): """ Returns a restclients.Person object for the given regid. If the regid isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown. """ if not self.valid_uwregid(regid): raise...
python
def get_person_by_regid(self, regid): """ Returns a restclients.Person object for the given regid. If the regid isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown. """ if not self.valid_uwregid(regid): raise...
[ "def", "get_person_by_regid", "(", "self", ",", "regid", ")", ":", "if", "not", "self", ".", "valid_uwregid", "(", "regid", ")", ":", "raise", "InvalidRegID", "(", "regid", ")", "url", "=", "\"{}/{}/full.json\"", ".", "format", "(", "PERSON_PREFIX", ",", "...
Returns a restclients.Person object for the given regid. If the regid isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown.
[ "Returns", "a", "restclients", ".", "Person", "object", "for", "the", "given", "regid", ".", "If", "the", "regid", "isn", "t", "found", "or", "if", "there", "is", "an", "error", "communicating", "with", "the", "PWS", "a", "DataFailureException", "will", "b...
758d94b42a01762738140c5f984d05f389325b7a
https://github.com/uw-it-aca/uw-restclients-pws/blob/758d94b42a01762738140c5f984d05f389325b7a/uw_pws/__init__.py#L38-L53
train
uw-it-aca/uw-restclients-pws
uw_pws/__init__.py
PWS.get_person_by_netid
def get_person_by_netid(self, netid): """ Returns a restclients.Person object for the given netid. If the netid isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown. """ if not self.valid_uwnetid(netid): raise...
python
def get_person_by_netid(self, netid): """ Returns a restclients.Person object for the given netid. If the netid isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown. """ if not self.valid_uwnetid(netid): raise...
[ "def", "get_person_by_netid", "(", "self", ",", "netid", ")", ":", "if", "not", "self", ".", "valid_uwnetid", "(", "netid", ")", ":", "raise", "InvalidNetID", "(", "netid", ")", "url", "=", "\"{}/{}/full.json\"", ".", "format", "(", "PERSON_PREFIX", ",", "...
Returns a restclients.Person object for the given netid. If the netid isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown.
[ "Returns", "a", "restclients", ".", "Person", "object", "for", "the", "given", "netid", ".", "If", "the", "netid", "isn", "t", "found", "or", "if", "there", "is", "an", "error", "communicating", "with", "the", "PWS", "a", "DataFailureException", "will", "b...
758d94b42a01762738140c5f984d05f389325b7a
https://github.com/uw-it-aca/uw-restclients-pws/blob/758d94b42a01762738140c5f984d05f389325b7a/uw_pws/__init__.py#L55-L70
train
uw-it-aca/uw-restclients-pws
uw_pws/__init__.py
PWS.get_person_by_employee_id
def get_person_by_employee_id(self, employee_id): """ Returns a restclients.Person object for the given employee id. If the employee id isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown. """ if not self.valid_employee_...
python
def get_person_by_employee_id(self, employee_id): """ Returns a restclients.Person object for the given employee id. If the employee id isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown. """ if not self.valid_employee_...
[ "def", "get_person_by_employee_id", "(", "self", ",", "employee_id", ")", ":", "if", "not", "self", ".", "valid_employee_id", "(", "employee_id", ")", ":", "raise", "InvalidEmployeeID", "(", "employee_id", ")", "url", "=", "\"{}.json?{}\"", ".", "format", "(", ...
Returns a restclients.Person object for the given employee id. If the employee id isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown.
[ "Returns", "a", "restclients", ".", "Person", "object", "for", "the", "given", "employee", "id", ".", "If", "the", "employee", "id", "isn", "t", "found", "or", "if", "there", "is", "an", "error", "communicating", "with", "the", "PWS", "a", "DataFailureExce...
758d94b42a01762738140c5f984d05f389325b7a
https://github.com/uw-it-aca/uw-restclients-pws/blob/758d94b42a01762738140c5f984d05f389325b7a/uw_pws/__init__.py#L72-L94
train
uw-it-aca/uw-restclients-pws
uw_pws/__init__.py
PWS.get_person_by_student_number
def get_person_by_student_number(self, student_number): """ Returns a restclients.Person object for the given student number. If the student number isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown. """ if not self.val...
python
def get_person_by_student_number(self, student_number): """ Returns a restclients.Person object for the given student number. If the student number isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown. """ if not self.val...
[ "def", "get_person_by_student_number", "(", "self", ",", "student_number", ")", ":", "if", "not", "self", ".", "valid_student_number", "(", "student_number", ")", ":", "raise", "InvalidStudentNumber", "(", "student_number", ")", "url", "=", "\"{}.json?{}\"", ".", ...
Returns a restclients.Person object for the given student number. If the student number isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown.
[ "Returns", "a", "restclients", ".", "Person", "object", "for", "the", "given", "student", "number", ".", "If", "the", "student", "number", "isn", "t", "found", "or", "if", "there", "is", "an", "error", "communicating", "with", "the", "PWS", "a", "DataFailu...
758d94b42a01762738140c5f984d05f389325b7a
https://github.com/uw-it-aca/uw-restclients-pws/blob/758d94b42a01762738140c5f984d05f389325b7a/uw_pws/__init__.py#L96-L118
train
uw-it-aca/uw-restclients-pws
uw_pws/__init__.py
PWS.get_person_by_prox_rfid
def get_person_by_prox_rfid(self, prox_rfid): """ Returns a restclients.Person object for the given rfid. If the rfid isn't found, or if there is an error communicating with the IdCard WS, a DataFailureException will be thrown. """ if not self.valid_prox_rfid(prox_rfid):...
python
def get_person_by_prox_rfid(self, prox_rfid): """ Returns a restclients.Person object for the given rfid. If the rfid isn't found, or if there is an error communicating with the IdCard WS, a DataFailureException will be thrown. """ if not self.valid_prox_rfid(prox_rfid):...
[ "def", "get_person_by_prox_rfid", "(", "self", ",", "prox_rfid", ")", ":", "if", "not", "self", ".", "valid_prox_rfid", "(", "prox_rfid", ")", ":", "raise", "InvalidProxRFID", "(", "prox_rfid", ")", "url", "=", "\"{}.json?{}\"", ".", "format", "(", "CARD_PREFI...
Returns a restclients.Person object for the given rfid. If the rfid isn't found, or if there is an error communicating with the IdCard WS, a DataFailureException will be thrown.
[ "Returns", "a", "restclients", ".", "Person", "object", "for", "the", "given", "rfid", ".", "If", "the", "rfid", "isn", "t", "found", "or", "if", "there", "is", "an", "error", "communicating", "with", "the", "IdCard", "WS", "a", "DataFailureException", "wi...
758d94b42a01762738140c5f984d05f389325b7a
https://github.com/uw-it-aca/uw-restclients-pws/blob/758d94b42a01762738140c5f984d05f389325b7a/uw_pws/__init__.py#L120-L141
train
uw-it-aca/uw-restclients-pws
uw_pws/__init__.py
PWS.get_entity_by_regid
def get_entity_by_regid(self, regid): """ Returns a restclients.Entity object for the given regid. If the regid isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown. """ if not self.valid_uwregid(regid): raise...
python
def get_entity_by_regid(self, regid): """ Returns a restclients.Entity object for the given regid. If the regid isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown. """ if not self.valid_uwregid(regid): raise...
[ "def", "get_entity_by_regid", "(", "self", ",", "regid", ")", ":", "if", "not", "self", ".", "valid_uwregid", "(", "regid", ")", ":", "raise", "InvalidRegID", "(", "regid", ")", "url", "=", "\"{}/{}.json\"", ".", "format", "(", "ENTITY_PREFIX", ",", "regid...
Returns a restclients.Entity object for the given regid. If the regid isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown.
[ "Returns", "a", "restclients", ".", "Entity", "object", "for", "the", "given", "regid", ".", "If", "the", "regid", "isn", "t", "found", "or", "if", "there", "is", "an", "error", "communicating", "with", "the", "PWS", "a", "DataFailureException", "will", "b...
758d94b42a01762738140c5f984d05f389325b7a
https://github.com/uw-it-aca/uw-restclients-pws/blob/758d94b42a01762738140c5f984d05f389325b7a/uw_pws/__init__.py#L143-L158
train
uw-it-aca/uw-restclients-pws
uw_pws/__init__.py
PWS.get_entity_by_netid
def get_entity_by_netid(self, netid): """ Returns a restclients.Entity object for the given netid. If the netid isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown. """ if not self.valid_uwnetid(netid): raise...
python
def get_entity_by_netid(self, netid): """ Returns a restclients.Entity object for the given netid. If the netid isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown. """ if not self.valid_uwnetid(netid): raise...
[ "def", "get_entity_by_netid", "(", "self", ",", "netid", ")", ":", "if", "not", "self", ".", "valid_uwnetid", "(", "netid", ")", ":", "raise", "InvalidNetID", "(", "netid", ")", "url", "=", "\"{}/{}.json\"", ".", "format", "(", "ENTITY_PREFIX", ",", "netid...
Returns a restclients.Entity object for the given netid. If the netid isn't found, or if there is an error communicating with the PWS, a DataFailureException will be thrown.
[ "Returns", "a", "restclients", ".", "Entity", "object", "for", "the", "given", "netid", ".", "If", "the", "netid", "isn", "t", "found", "or", "if", "there", "is", "an", "error", "communicating", "with", "the", "PWS", "a", "DataFailureException", "will", "b...
758d94b42a01762738140c5f984d05f389325b7a
https://github.com/uw-it-aca/uw-restclients-pws/blob/758d94b42a01762738140c5f984d05f389325b7a/uw_pws/__init__.py#L160-L175
train
adaptive-learning/proso-apps
proso_concepts/models.py
generate_identifier
def generate_identifier(sender, instance, **kwargs): """ Generate and set identifier of concept before saving object to DB Args: sender (class): should be Concept instance (Concept): saving concept """ identifier = Concept.create_identifier(instance.query) qs = Concept.objects.f...
python
def generate_identifier(sender, instance, **kwargs): """ Generate and set identifier of concept before saving object to DB Args: sender (class): should be Concept instance (Concept): saving concept """ identifier = Concept.create_identifier(instance.query) qs = Concept.objects.f...
[ "def", "generate_identifier", "(", "sender", ",", "instance", ",", "**", "kwargs", ")", ":", "identifier", "=", "Concept", ".", "create_identifier", "(", "instance", ".", "query", ")", "qs", "=", "Concept", ".", "objects", ".", "filter", "(", "identifier", ...
Generate and set identifier of concept before saving object to DB Args: sender (class): should be Concept instance (Concept): saving concept
[ "Generate", "and", "set", "identifier", "of", "concept", "before", "saving", "object", "to", "DB" ]
8278c72e498d6ef8d392cc47b48473f4ec037142
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_concepts/models.py#L369-L383
train
adaptive-learning/proso-apps
proso_concepts/models.py
ConceptManager.get_concept_item_mapping
def get_concept_item_mapping(self, concepts=None, lang=None): """ Get mapping of concepts to items belonging to concept. Args: concepts (list of Concept): Defaults to None meaning all concepts lang (str): language of concepts, if None use language of concepts Re...
python
def get_concept_item_mapping(self, concepts=None, lang=None): """ Get mapping of concepts to items belonging to concept. Args: concepts (list of Concept): Defaults to None meaning all concepts lang (str): language of concepts, if None use language of concepts Re...
[ "def", "get_concept_item_mapping", "(", "self", ",", "concepts", "=", "None", ",", "lang", "=", "None", ")", ":", "if", "concepts", "is", "None", ":", "concepts", "=", "self", ".", "filter", "(", "active", "=", "True", ")", "if", "lang", "is", "not", ...
Get mapping of concepts to items belonging to concept. Args: concepts (list of Concept): Defaults to None meaning all concepts lang (str): language of concepts, if None use language of concepts Returns: dict: concept (int) -> list of item ids (int)
[ "Get", "mapping", "of", "concepts", "to", "items", "belonging", "to", "concept", "." ]
8278c72e498d6ef8d392cc47b48473f4ec037142
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_concepts/models.py#L66-L88
train
adaptive-learning/proso-apps
proso_concepts/models.py
ConceptManager.get_item_concept_mapping
def get_item_concept_mapping(self, lang): """ Get mapping of items_ids to concepts containing these items Args: lang (str): language of concepts Returns: dict: item (int) -> set of concepts (int) """ concepts = self.filter(active=True, lang=lang) ...
python
def get_item_concept_mapping(self, lang): """ Get mapping of items_ids to concepts containing these items Args: lang (str): language of concepts Returns: dict: item (int) -> set of concepts (int) """ concepts = self.filter(active=True, lang=lang) ...
[ "def", "get_item_concept_mapping", "(", "self", ",", "lang", ")", ":", "concepts", "=", "self", ".", "filter", "(", "active", "=", "True", ",", "lang", "=", "lang", ")", "return", "group_keys_by_value_lists", "(", "Concept", ".", "objects", ".", "get_concept...
Get mapping of items_ids to concepts containing these items Args: lang (str): language of concepts Returns: dict: item (int) -> set of concepts (int)
[ "Get", "mapping", "of", "items_ids", "to", "concepts", "containing", "these", "items" ]
8278c72e498d6ef8d392cc47b48473f4ec037142
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_concepts/models.py#L91-L102
train
adaptive-learning/proso-apps
proso_concepts/models.py
ConceptManager.get_concepts_to_recalculate
def get_concepts_to_recalculate(self, users, lang, concepts=None): """ Get concept which have same changes and have to be recalculated Args: users (list of users or user): users whose user stats we are interesting in lang (str): language of used concepts conc...
python
def get_concepts_to_recalculate(self, users, lang, concepts=None): """ Get concept which have same changes and have to be recalculated Args: users (list of users or user): users whose user stats we are interesting in lang (str): language of used concepts conc...
[ "def", "get_concepts_to_recalculate", "(", "self", ",", "users", ",", "lang", ",", "concepts", "=", "None", ")", ":", "only_one_user", "=", "False", "if", "not", "isinstance", "(", "users", ",", "list", ")", ":", "only_one_user", "=", "True", "users", "=",...
Get concept which have same changes and have to be recalculated Args: users (list of users or user): users whose user stats we are interesting in lang (str): language of used concepts concepts (Optional[list of concepts]): list of primary keys of concepts or concepts ...
[ "Get", "concept", "which", "have", "same", "changes", "and", "have", "to", "be", "recalculated" ]
8278c72e498d6ef8d392cc47b48473f4ec037142
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_concepts/models.py#L104-L150
train
adaptive-learning/proso-apps
proso_concepts/models.py
UserStatManager.recalculate_concepts
def recalculate_concepts(self, concepts, lang=None): """ Recalculated given concepts for given users Args: concepts (dict): user id (int -> set of concepts to recalculate) lang(Optional[str]): language used to get items in all concepts (cached). Defaults ...
python
def recalculate_concepts(self, concepts, lang=None): """ Recalculated given concepts for given users Args: concepts (dict): user id (int -> set of concepts to recalculate) lang(Optional[str]): language used to get items in all concepts (cached). Defaults ...
[ "def", "recalculate_concepts", "(", "self", ",", "concepts", ",", "lang", "=", "None", ")", ":", "if", "len", "(", "concepts", ")", "==", "0", ":", "return", "if", "lang", "is", "None", ":", "items", "=", "Concept", ".", "objects", ".", "get_concept_it...
Recalculated given concepts for given users Args: concepts (dict): user id (int -> set of concepts to recalculate) lang(Optional[str]): language used to get items in all concepts (cached). Defaults to None, in that case are get items only in used concepts
[ "Recalculated", "given", "concepts", "for", "given", "users" ]
8278c72e498d6ef8d392cc47b48473f4ec037142
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_concepts/models.py#L250-L300
train
adaptive-learning/proso-apps
proso_concepts/models.py
UserStatManager.get_user_stats
def get_user_stats(self, users, lang=None, concepts=None, since=None, recalculate=True): """ Finds all UserStats of given concepts and users. Recompute UserStats if necessary Args: users (Optional[list of users] or [user]): list of primary keys of user or users ...
python
def get_user_stats(self, users, lang=None, concepts=None, since=None, recalculate=True): """ Finds all UserStats of given concepts and users. Recompute UserStats if necessary Args: users (Optional[list of users] or [user]): list of primary keys of user or users ...
[ "def", "get_user_stats", "(", "self", ",", "users", ",", "lang", "=", "None", ",", "concepts", "=", "None", ",", "since", "=", "None", ",", "recalculate", "=", "True", ")", ":", "only_one_user", "=", "False", "if", "not", "isinstance", "(", "users", ",...
Finds all UserStats of given concepts and users. Recompute UserStats if necessary Args: users (Optional[list of users] or [user]): list of primary keys of user or users Defaults to None meaning all users. lang (string): use only concepts witch the lang. Defaults ...
[ "Finds", "all", "UserStats", "of", "given", "concepts", "and", "users", ".", "Recompute", "UserStats", "if", "necessary" ]
8278c72e498d6ef8d392cc47b48473f4ec037142
https://github.com/adaptive-learning/proso-apps/blob/8278c72e498d6ef8d392cc47b48473f4ec037142/proso_concepts/models.py#L302-L346
train
Kortemme-Lab/klab
klab/deprecated/rosettadb.py
DatabaseInterface.locked_execute
def locked_execute(self, sql, parameters = None, cursorClass = DictCursor, quiet = False): '''We are lock-happy here but SQL performance is not currently an issue daemon-side.''' return self.execute(sql, parameters, cursorClass, quiet = quiet, locked = True)
python
def locked_execute(self, sql, parameters = None, cursorClass = DictCursor, quiet = False): '''We are lock-happy here but SQL performance is not currently an issue daemon-side.''' return self.execute(sql, parameters, cursorClass, quiet = quiet, locked = True)
[ "def", "locked_execute", "(", "self", ",", "sql", ",", "parameters", "=", "None", ",", "cursorClass", "=", "DictCursor", ",", "quiet", "=", "False", ")", ":", "return", "self", ".", "execute", "(", "sql", ",", "parameters", ",", "cursorClass", ",", "quie...
We are lock-happy here but SQL performance is not currently an issue daemon-side.
[ "We", "are", "lock", "-", "happy", "here", "but", "SQL", "performance", "is", "not", "currently", "an", "issue", "daemon", "-", "side", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/deprecated/rosettadb.py#L109-L111
train
Kortemme-Lab/klab
klab/deprecated/rosettadb.py
DatabaseInterface.execute
def execute(self, sql, parameters = None, cursorClass = DictCursor, quiet = False, locked = False, do_commit = True): """Execute SQL query. This uses DictCursor by default.""" i = 0 errcode = 0 caughte = None cursor = None if sql.find(";") != -1 or sql.find("\\G") != -1: # Catches some injections rais...
python
def execute(self, sql, parameters = None, cursorClass = DictCursor, quiet = False, locked = False, do_commit = True): """Execute SQL query. This uses DictCursor by default.""" i = 0 errcode = 0 caughte = None cursor = None if sql.find(";") != -1 or sql.find("\\G") != -1: # Catches some injections rais...
[ "def", "execute", "(", "self", ",", "sql", ",", "parameters", "=", "None", ",", "cursorClass", "=", "DictCursor", ",", "quiet", "=", "False", ",", "locked", "=", "False", ",", "do_commit", "=", "True", ")", ":", "i", "=", "0", "errcode", "=", "0", ...
Execute SQL query. This uses DictCursor by default.
[ "Execute", "SQL", "query", ".", "This", "uses", "DictCursor", "by", "default", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/deprecated/rosettadb.py#L116-L174
train
Kortemme-Lab/klab
klab/deprecated/rosettadb.py
DatabaseInterface.insertDict
def insertDict(self, tblname, d, fields = None): '''Simple function for inserting a dictionary whose keys match the fieldnames of tblname.''' if fields == None: fields = sorted(d.keys()) values = None try: SQL = 'INSERT INTO %s (%s) VALUES (%s)' % (tblname, join(fields, ", "), join(['%s' for x in range...
python
def insertDict(self, tblname, d, fields = None): '''Simple function for inserting a dictionary whose keys match the fieldnames of tblname.''' if fields == None: fields = sorted(d.keys()) values = None try: SQL = 'INSERT INTO %s (%s) VALUES (%s)' % (tblname, join(fields, ", "), join(['%s' for x in range...
[ "def", "insertDict", "(", "self", ",", "tblname", ",", "d", ",", "fields", "=", "None", ")", ":", "if", "fields", "==", "None", ":", "fields", "=", "sorted", "(", "d", ".", "keys", "(", ")", ")", "values", "=", "None", "try", ":", "SQL", "=", "...
Simple function for inserting a dictionary whose keys match the fieldnames of tblname.
[ "Simple", "function", "for", "inserting", "a", "dictionary", "whose", "keys", "match", "the", "fieldnames", "of", "tblname", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/deprecated/rosettadb.py#L176-L191
train
Kortemme-Lab/klab
klab/deprecated/rosettadb.py
RosettaDB.callproc
def callproc(self, procname, parameters = (), cursorClass = DictCursor, quiet = False): """Calls a MySQL stored procedure procname. This uses DictCursor by default.""" i = 0 errcode = 0 caughte = None while i < self.numTries: i += 1 try: cursor = self.connection.cursor(cursorClass) if type(para...
python
def callproc(self, procname, parameters = (), cursorClass = DictCursor, quiet = False): """Calls a MySQL stored procedure procname. This uses DictCursor by default.""" i = 0 errcode = 0 caughte = None while i < self.numTries: i += 1 try: cursor = self.connection.cursor(cursorClass) if type(para...
[ "def", "callproc", "(", "self", ",", "procname", ",", "parameters", "=", "(", ")", ",", "cursorClass", "=", "DictCursor", ",", "quiet", "=", "False", ")", ":", "i", "=", "0", "errcode", "=", "0", "caughte", "=", "None", "while", "i", "<", "self", "...
Calls a MySQL stored procedure procname. This uses DictCursor by default.
[ "Calls", "a", "MySQL", "stored", "procedure", "procname", ".", "This", "uses", "DictCursor", "by", "default", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/deprecated/rosettadb.py#L625-L654
train
Kortemme-Lab/klab
klab/deprecated/rosettadb.py
RosettaDB.execQuery
def execQuery(self, sql, parameters = None, cursorClass = MySQLdb.cursors.Cursor, InnoDB = False): """Execute SQL query.""" i = 0 errcode = 0 caughte = None while i < self.numTries: i += 1 try: cursor = self.connection.cursor(cursorClass) if parameters: errcode = cursor.execute(sql, parame...
python
def execQuery(self, sql, parameters = None, cursorClass = MySQLdb.cursors.Cursor, InnoDB = False): """Execute SQL query.""" i = 0 errcode = 0 caughte = None while i < self.numTries: i += 1 try: cursor = self.connection.cursor(cursorClass) if parameters: errcode = cursor.execute(sql, parame...
[ "def", "execQuery", "(", "self", ",", "sql", ",", "parameters", "=", "None", ",", "cursorClass", "=", "MySQLdb", ".", "cursors", ".", "Cursor", ",", "InnoDB", "=", "False", ")", ":", "i", "=", "0", "errcode", "=", "0", "caughte", "=", "None", "while"...
Execute SQL query.
[ "Execute", "SQL", "query", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/deprecated/rosettadb.py#L660-L696
train
Kortemme-Lab/klab
klab/deprecated/rosettadb.py
RosettaDB._getFieldsInDB
def _getFieldsInDB(self, tablename): """get all the fields from a specific table""" SQL = 'SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns where TABLE_NAME="%s"' % tablename array_data = self.execQuery(SQL) return [x[0] for x in array_data]
python
def _getFieldsInDB(self, tablename): """get all the fields from a specific table""" SQL = 'SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns where TABLE_NAME="%s"' % tablename array_data = self.execQuery(SQL) return [x[0] for x in array_data]
[ "def", "_getFieldsInDB", "(", "self", ",", "tablename", ")", ":", "SQL", "=", "'SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns where TABLE_NAME=\"%s\"'", "%", "tablename", "array_data", "=", "self", ".", "execQuery", "(", "SQL", ")", "return", "[", "x", "[", "0"...
get all the fields from a specific table
[ "get", "all", "the", "fields", "from", "a", "specific", "table" ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/deprecated/rosettadb.py#L699-L705
train
ABI-Software/MeshParser
src/meshparser/stlparser/parser.py
_is_ascii_stl
def _is_ascii_stl(first_bytes): """ Determine if this is an ASCII based data stream, simply by checking the bytes for the word 'solid'. """ is_ascii = False if 'solid' in first_bytes.decode("utf-8").lower(): is_ascii = True return is_ascii
python
def _is_ascii_stl(first_bytes): """ Determine if this is an ASCII based data stream, simply by checking the bytes for the word 'solid'. """ is_ascii = False if 'solid' in first_bytes.decode("utf-8").lower(): is_ascii = True return is_ascii
[ "def", "_is_ascii_stl", "(", "first_bytes", ")", ":", "is_ascii", "=", "False", "if", "'solid'", "in", "first_bytes", ".", "decode", "(", "\"utf-8\"", ")", ".", "lower", "(", ")", ":", "is_ascii", "=", "True", "return", "is_ascii" ]
Determine if this is an ASCII based data stream, simply by checking the bytes for the word 'solid'.
[ "Determine", "if", "this", "is", "an", "ASCII", "based", "data", "stream", "simply", "by", "checking", "the", "bytes", "for", "the", "word", "solid", "." ]
08dc0ce7c44d0149b443261ff6d3708e28a928e7
https://github.com/ABI-Software/MeshParser/blob/08dc0ce7c44d0149b443261ff6d3708e28a928e7/src/meshparser/stlparser/parser.py#L108-L116
train
ABI-Software/MeshParser
src/meshparser/stlparser/parser.py
_is_binary_stl
def _is_binary_stl(data): """ Determine if this is a binary file through unpacking the first value after the 80th character and testing whether this value is greater than zero. This indicates the number of facets in the file. Could possibly extend this to check that the remaining number of bytes is div...
python
def _is_binary_stl(data): """ Determine if this is a binary file through unpacking the first value after the 80th character and testing whether this value is greater than zero. This indicates the number of facets in the file. Could possibly extend this to check that the remaining number of bytes is div...
[ "def", "_is_binary_stl", "(", "data", ")", ":", "is_bin", "=", "False", "start_byte", "=", "0", "end_byte", "=", "80", "_", "=", "data", "[", "start_byte", ":", "end_byte", "]", "start_byte", "=", "end_byte", "end_byte", "+=", "4", "facet_count", "=", "s...
Determine if this is a binary file through unpacking the first value after the 80th character and testing whether this value is greater than zero. This indicates the number of facets in the file. Could possibly extend this to check that the remaining number of bytes is divisible by 50.
[ "Determine", "if", "this", "is", "a", "binary", "file", "through", "unpacking", "the", "first", "value", "after", "the", "80th", "character", "and", "testing", "whether", "this", "value", "is", "greater", "than", "zero", ".", "This", "indicates", "the", "num...
08dc0ce7c44d0149b443261ff6d3708e28a928e7
https://github.com/ABI-Software/MeshParser/blob/08dc0ce7c44d0149b443261ff6d3708e28a928e7/src/meshparser/stlparser/parser.py#L119-L135
train
mardix/Mocha
mocha/extras/mocha_db.py
StorageObjectType.process_bind_param
def process_bind_param(self, obj, dialect): """Get a flask_cloudy.Object and save it as a dict""" value = obj or {} if isinstance(obj, flask_cloudy.Object): value = {} for k in self.DEFAULT_KEYS: value[k] = getattr(obj, k) return super(self.__clas...
python
def process_bind_param(self, obj, dialect): """Get a flask_cloudy.Object and save it as a dict""" value = obj or {} if isinstance(obj, flask_cloudy.Object): value = {} for k in self.DEFAULT_KEYS: value[k] = getattr(obj, k) return super(self.__clas...
[ "def", "process_bind_param", "(", "self", ",", "obj", ",", "dialect", ")", ":", "value", "=", "obj", "or", "{", "}", "if", "isinstance", "(", "obj", ",", "flask_cloudy", ".", "Object", ")", ":", "value", "=", "{", "}", "for", "k", "in", "self", "."...
Get a flask_cloudy.Object and save it as a dict
[ "Get", "a", "flask_cloudy", ".", "Object", "and", "save", "it", "as", "a", "dict" ]
bce481cb31a0972061dd99bc548701411dcb9de3
https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/extras/mocha_db.py#L105-L113
train
assamite/creamas
creamas/util.py
create_tasks
def create_tasks(task_coro, addrs, *args, flatten=True, **kwargs): '''Create and schedule a set of asynchronous tasks. The function creates the tasks using a given list of agent addresses and wraps each of them in :func:`asyncio.ensure_future`. The ``*args`` and ``**kwargs`` are passed down to :func:`t...
python
def create_tasks(task_coro, addrs, *args, flatten=True, **kwargs): '''Create and schedule a set of asynchronous tasks. The function creates the tasks using a given list of agent addresses and wraps each of them in :func:`asyncio.ensure_future`. The ``*args`` and ``**kwargs`` are passed down to :func:`t...
[ "def", "create_tasks", "(", "task_coro", ",", "addrs", ",", "*", "args", ",", "flatten", "=", "True", ",", "**", "kwargs", ")", ":", "tasks", "=", "[", "]", "for", "agent_addr", "in", "addrs", ":", "task", "=", "asyncio", ".", "ensure_future", "(", "...
Create and schedule a set of asynchronous tasks. The function creates the tasks using a given list of agent addresses and wraps each of them in :func:`asyncio.ensure_future`. The ``*args`` and ``**kwargs`` are passed down to :func:`task_coro` when creating tasks for each address in :attr:`addrs`. ...
[ "Create", "and", "schedule", "a", "set", "of", "asynchronous", "tasks", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/util.py#L12-L48
train
assamite/creamas
creamas/util.py
wait_tasks
async def wait_tasks(tasks, flatten=True): '''Gather a list of asynchronous tasks and wait their completion. :param list tasks: A list of *asyncio* tasks wrapped in :func:`asyncio.ensure_future`. :param bool flatten: If ``True`` the returned results are flattened into one list if the ...
python
async def wait_tasks(tasks, flatten=True): '''Gather a list of asynchronous tasks and wait their completion. :param list tasks: A list of *asyncio* tasks wrapped in :func:`asyncio.ensure_future`. :param bool flatten: If ``True`` the returned results are flattened into one list if the ...
[ "async", "def", "wait_tasks", "(", "tasks", ",", "flatten", "=", "True", ")", ":", "rets", "=", "await", "asyncio", ".", "gather", "(", "*", "tasks", ")", "if", "flatten", "and", "all", "(", "map", "(", "lambda", "x", ":", "hasattr", "(", "x", ",",...
Gather a list of asynchronous tasks and wait their completion. :param list tasks: A list of *asyncio* tasks wrapped in :func:`asyncio.ensure_future`. :param bool flatten: If ``True`` the returned results are flattened into one list if the tasks return iterable objects. The parameter doe...
[ "Gather", "a", "list", "of", "asynchronous", "tasks", "and", "wait", "their", "completion", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/util.py#L51-L66
train
assamite/creamas
creamas/util.py
split_addrs
def split_addrs(addrs): '''Split addresses into dictionaries by hosts and ports. :param list addrs: A list of addresses. :returns: A dictionary of dictionaries, where ``dict[HOST][PORT]`` holds a list of all agent addresses in that environment. ''' splitted = {} for addr in add...
python
def split_addrs(addrs): '''Split addresses into dictionaries by hosts and ports. :param list addrs: A list of addresses. :returns: A dictionary of dictionaries, where ``dict[HOST][PORT]`` holds a list of all agent addresses in that environment. ''' splitted = {} for addr in add...
[ "def", "split_addrs", "(", "addrs", ")", ":", "splitted", "=", "{", "}", "for", "addr", "in", "addrs", ":", "host", ",", "port", ",", "_", "=", "_addr_key", "(", "addr", ")", "if", "host", "not", "in", "splitted", ":", "splitted", "[", "host", "]",...
Split addresses into dictionaries by hosts and ports. :param list addrs: A list of addresses. :returns: A dictionary of dictionaries, where ``dict[HOST][PORT]`` holds a list of all agent addresses in that environment.
[ "Split", "addresses", "into", "dictionaries", "by", "hosts", "and", "ports", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/util.py#L173-L190
train
assamite/creamas
creamas/util.py
addrs2managers
def addrs2managers(addrs): '''Map agent addresses to their assumed managers. .. seealso:: :func:`creamas.util.get_manager` ''' mgrs = {} for addr in addrs: mgr_addr = get_manager(addr) if mgr_addr not in mgrs: mgrs[mgr_addr] = [] mgrs[mgr_addr].append(ad...
python
def addrs2managers(addrs): '''Map agent addresses to their assumed managers. .. seealso:: :func:`creamas.util.get_manager` ''' mgrs = {} for addr in addrs: mgr_addr = get_manager(addr) if mgr_addr not in mgrs: mgrs[mgr_addr] = [] mgrs[mgr_addr].append(ad...
[ "def", "addrs2managers", "(", "addrs", ")", ":", "mgrs", "=", "{", "}", "for", "addr", "in", "addrs", ":", "mgr_addr", "=", "get_manager", "(", "addr", ")", "if", "mgr_addr", "not", "in", "mgrs", ":", "mgrs", "[", "mgr_addr", "]", "=", "[", "]", "m...
Map agent addresses to their assumed managers. .. seealso:: :func:`creamas.util.get_manager`
[ "Map", "agent", "addresses", "to", "their", "assumed", "managers", "." ]
54dc3e31c97a3f938e58272f8ab80b6bcafeff58
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/util.py#L199-L212
train
ronhanson/python-tbx
tbx/template.py
create_jinja_env
def create_jinja_env(template_path): """ Creates a Jinja2 environment with a specific template path. """ jinja_env = jinja2.Environment( loader=jinja2.FileSystemLoader(template_path), block_start_string='{%', block_end_string='%}', variable_start_string='${', vari...
python
def create_jinja_env(template_path): """ Creates a Jinja2 environment with a specific template path. """ jinja_env = jinja2.Environment( loader=jinja2.FileSystemLoader(template_path), block_start_string='{%', block_end_string='%}', variable_start_string='${', vari...
[ "def", "create_jinja_env", "(", "template_path", ")", ":", "jinja_env", "=", "jinja2", ".", "Environment", "(", "loader", "=", "jinja2", ".", "FileSystemLoader", "(", "template_path", ")", ",", "block_start_string", "=", "'{%'", ",", "block_end_string", "=", "'%...
Creates a Jinja2 environment with a specific template path.
[ "Creates", "a", "Jinja2", "environment", "with", "a", "specific", "template", "path", "." ]
87f72ae0cadecafbcd144f1e930181fba77f6b83
https://github.com/ronhanson/python-tbx/blob/87f72ae0cadecafbcd144f1e930181fba77f6b83/tbx/template.py#L15-L35
train
urain39/KngetPy
knget/base.py
Knget._debug_info
def _debug_info(self): """Show a list of recently variables info. """ self._msg('DEBUG') self._msg2('WorkDir: {0}'.format(self._curdir)) self._msg2('Cookies: {0}'.format(self._session.cookies)) self._msg2('Headers: {0}'.format(self._session.headers)) self._msg2('C...
python
def _debug_info(self): """Show a list of recently variables info. """ self._msg('DEBUG') self._msg2('WorkDir: {0}'.format(self._curdir)) self._msg2('Cookies: {0}'.format(self._session.cookies)) self._msg2('Headers: {0}'.format(self._session.headers)) self._msg2('C...
[ "def", "_debug_info", "(", "self", ")", ":", "self", ".", "_msg", "(", "'DEBUG'", ")", "self", ".", "_msg2", "(", "'WorkDir: {0}'", ".", "format", "(", "self", ".", "_curdir", ")", ")", "self", ".", "_msg2", "(", "'Cookies: {0}'", ".", "format", "(", ...
Show a list of recently variables info.
[ "Show", "a", "list", "of", "recently", "variables", "info", "." ]
00986bc16a497cee08aceb1c072f6187f152ee5d
https://github.com/urain39/KngetPy/blob/00986bc16a497cee08aceb1c072f6187f152ee5d/knget/base.py#L174-L183
train
urain39/KngetPy
knget/base.py
KngetCommand.register
def register(self, argtypes=r'M', help_msg=None): """Register a method to a command. NOTE: Method registered here is unbound method, e.g. registered `run` command -> `KngetShell.run` So we call it should add `self` at first. See also: KngetShell.execute() ...
python
def register(self, argtypes=r'M', help_msg=None): """Register a method to a command. NOTE: Method registered here is unbound method, e.g. registered `run` command -> `KngetShell.run` So we call it should add `self` at first. See also: KngetShell.execute() ...
[ "def", "register", "(", "self", ",", "argtypes", "=", "r'M'", ",", "help_msg", "=", "None", ")", ":", "def", "format_args", "(", "method", ")", ":", "def", "wrapped_method", "(", "*", "args", ",", "**", "kwargs", ")", ":", "args_count", "=", "len", "...
Register a method to a command. NOTE: Method registered here is unbound method, e.g. registered `run` command -> `KngetShell.run` So we call it should add `self` at first. See also: KngetShell.execute() :param argtypes: a str of the command args type. ...
[ "Register", "a", "method", "to", "a", "command", "." ]
00986bc16a497cee08aceb1c072f6187f152ee5d
https://github.com/urain39/KngetPy/blob/00986bc16a497cee08aceb1c072f6187f152ee5d/knget/base.py#L497-L563
train
urain39/KngetPy
knget/base.py
KngetShell.run
def run(self, tags, begin, end=False): """Override method of class Knget """ if not end: end = begin # Type `H` doesn't cast anything, so we # manually cast the strings end to integer. super(KngetShell, self).run(tags, begin, int(end))
python
def run(self, tags, begin, end=False): """Override method of class Knget """ if not end: end = begin # Type `H` doesn't cast anything, so we # manually cast the strings end to integer. super(KngetShell, self).run(tags, begin, int(end))
[ "def", "run", "(", "self", ",", "tags", ",", "begin", ",", "end", "=", "False", ")", ":", "if", "not", "end", ":", "end", "=", "begin", "super", "(", "KngetShell", ",", "self", ")", ".", "run", "(", "tags", ",", "begin", ",", "int", "(", "end",...
Override method of class Knget
[ "Override", "method", "of", "class", "Knget" ]
00986bc16a497cee08aceb1c072f6187f152ee5d
https://github.com/urain39/KngetPy/blob/00986bc16a497cee08aceb1c072f6187f152ee5d/knget/base.py#L584-L592
train
uogbuji/versa
tools/py/writer/md.py
write
def write(models, out=None, base=None, propertybase=None, shorteners=None, logger=logging): ''' models - input Versa models from which output is generated. Must be a sequence object, not an iterator ''' assert out is not None #Output stream required if not isinstance(models, list): m...
python
def write(models, out=None, base=None, propertybase=None, shorteners=None, logger=logging): ''' models - input Versa models from which output is generated. Must be a sequence object, not an iterator ''' assert out is not None #Output stream required if not isinstance(models, list): m...
[ "def", "write", "(", "models", ",", "out", "=", "None", ",", "base", "=", "None", ",", "propertybase", "=", "None", ",", "shorteners", "=", "None", ",", "logger", "=", "logging", ")", ":", "assert", "out", "is", "not", "None", "if", "not", "isinstanc...
models - input Versa models from which output is generated. Must be a sequence object, not an iterator
[ "models", "-", "input", "Versa", "models", "from", "which", "output", "is", "generated", ".", "Must", "be", "a", "sequence", "object", "not", "an", "iterator" ]
f092ffc7ed363a5b170890955168500f32de0dd5
https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/writer/md.py#L42-L79
train
aacanakin/glim
glim/app.py
Glim.register_routes
def register_routes(self): """ Function creates instances of controllers, adds into bottle routes """ routes = self.flatten_urls(self.urls) self.controllers = {} controller_names = set() for route in routes: cname = route['endpoint'].split('.')[0] ...
python
def register_routes(self): """ Function creates instances of controllers, adds into bottle routes """ routes = self.flatten_urls(self.urls) self.controllers = {} controller_names = set() for route in routes: cname = route['endpoint'].split('.')[0] ...
[ "def", "register_routes", "(", "self", ")", ":", "routes", "=", "self", ".", "flatten_urls", "(", "self", ".", "urls", ")", "self", ".", "controllers", "=", "{", "}", "controller_names", "=", "set", "(", ")", "for", "route", "in", "routes", ":", "cname...
Function creates instances of controllers, adds into bottle routes
[ "Function", "creates", "instances", "of", "controllers", "adds", "into", "bottle", "routes" ]
71a20ac149a1292c0d6c1dc7414985ea51854f7a
https://github.com/aacanakin/glim/blob/71a20ac149a1292c0d6c1dc7414985ea51854f7a/glim/app.py#L62-L82
train
aacanakin/glim
glim/app.py
Glim.register_extensions
def register_extensions(self): """ Function registers extensions given extensions list Args ---- extensions (list) : the extensions dict on app.config.<env> Raises ------ Exception: Raises exception when extension can't be loaded properly...
python
def register_extensions(self): """ Function registers extensions given extensions list Args ---- extensions (list) : the extensions dict on app.config.<env> Raises ------ Exception: Raises exception when extension can't be loaded properly...
[ "def", "register_extensions", "(", "self", ")", ":", "try", ":", "for", "extension", ",", "config", "in", "self", ".", "config", "[", "'extensions'", "]", ".", "items", "(", ")", ":", "extension_bstr", "=", "''", "extension_pieces", "=", "extension", ".", ...
Function registers extensions given extensions list Args ---- extensions (list) : the extensions dict on app.config.<env> Raises ------ Exception: Raises exception when extension can't be loaded properly.
[ "Function", "registers", "extensions", "given", "extensions", "list" ]
71a20ac149a1292c0d6c1dc7414985ea51854f7a
https://github.com/aacanakin/glim/blob/71a20ac149a1292c0d6c1dc7414985ea51854f7a/glim/app.py#L84-L131
train
aacanakin/glim
glim/app.py
Glim.register_ssl_context
def register_ssl_context(self): """ Function detects ssl context """ if not empty('ssl', self.config['app']): self.ssl_context = self.config['app']['ssl'] else: self.ssl_context = None
python
def register_ssl_context(self): """ Function detects ssl context """ if not empty('ssl', self.config['app']): self.ssl_context = self.config['app']['ssl'] else: self.ssl_context = None
[ "def", "register_ssl_context", "(", "self", ")", ":", "if", "not", "empty", "(", "'ssl'", ",", "self", ".", "config", "[", "'app'", "]", ")", ":", "self", ".", "ssl_context", "=", "self", ".", "config", "[", "'app'", "]", "[", "'ssl'", "]", "else", ...
Function detects ssl context
[ "Function", "detects", "ssl", "context" ]
71a20ac149a1292c0d6c1dc7414985ea51854f7a
https://github.com/aacanakin/glim/blob/71a20ac149a1292c0d6c1dc7414985ea51854f7a/glim/app.py#L156-L163
train
aacanakin/glim
glim/app.py
Glim.flatten_urls
def flatten_urls(self, urls): """ Function flatten urls for route grouping feature of glim. Args ---- urls (dict): a dict of url definitions. current_key (unknown type): a dict or a string marking the current key that is used for recursive calls. ...
python
def flatten_urls(self, urls): """ Function flatten urls for route grouping feature of glim. Args ---- urls (dict): a dict of url definitions. current_key (unknown type): a dict or a string marking the current key that is used for recursive calls. ...
[ "def", "flatten_urls", "(", "self", ",", "urls", ")", ":", "available_methods", "=", "[", "'POST'", ",", "'PUT'", ",", "'OPTIONS'", ",", "'GET'", ",", "'DELETE'", ",", "'TRACE'", ",", "'COPY'", "]", "ruleset", "=", "[", "]", "for", "route", ",", "endpo...
Function flatten urls for route grouping feature of glim. Args ---- urls (dict): a dict of url definitions. current_key (unknown type): a dict or a string marking the current key that is used for recursive calls. ruleset (dict): the ruleset that is eventually r...
[ "Function", "flatten", "urls", "for", "route", "grouping", "feature", "of", "glim", "." ]
71a20ac149a1292c0d6c1dc7414985ea51854f7a
https://github.com/aacanakin/glim/blob/71a20ac149a1292c0d6c1dc7414985ea51854f7a/glim/app.py#L165-L209
train
TUNE-Archive/freight_forwarder
freight_forwarder/cli/info.py
InfoCommand._info
def _info(self, args, **extra_args): """Print freight forwarder info to the user. """ if not isinstance(args, argparse.Namespace): raise logger.error(Exception("args should of an instance of argparse.Namespace")) logger.info("Freight Forwarder: {0}".format(VERSION)) ...
python
def _info(self, args, **extra_args): """Print freight forwarder info to the user. """ if not isinstance(args, argparse.Namespace): raise logger.error(Exception("args should of an instance of argparse.Namespace")) logger.info("Freight Forwarder: {0}".format(VERSION)) ...
[ "def", "_info", "(", "self", ",", "args", ",", "**", "extra_args", ")", ":", "if", "not", "isinstance", "(", "args", ",", "argparse", ".", "Namespace", ")", ":", "raise", "logger", ".", "error", "(", "Exception", "(", "\"args should of an instance of argpars...
Print freight forwarder info to the user.
[ "Print", "freight", "forwarder", "info", "to", "the", "user", "." ]
6ea4a49f474ec04abb8bb81b175c774a16b5312f
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/cli/info.py#L38-L47
train
20c/pluginmgr
pluginmgr/__init__.py
PluginManager.register
def register(self, typ): """ register a plugin """ # should be able to combine class/instance namespace, and inherit from either # would need to store meta or rely on copy ctor def _func(cls): if typ in self._class: raise ValueError("duplicated type name '%s'"...
python
def register(self, typ): """ register a plugin """ # should be able to combine class/instance namespace, and inherit from either # would need to store meta or rely on copy ctor def _func(cls): if typ in self._class: raise ValueError("duplicated type name '%s'"...
[ "def", "register", "(", "self", ",", "typ", ")", ":", "def", "_func", "(", "cls", ")", ":", "if", "typ", "in", "self", ".", "_class", ":", "raise", "ValueError", "(", "\"duplicated type name '%s'\"", "%", "typ", ")", "cls", ".", "plugin_type", "=", "ty...
register a plugin
[ "register", "a", "plugin" ]
ea19edab6d145f539641c304745acd4ab2c67eb7
https://github.com/20c/pluginmgr/blob/ea19edab6d145f539641c304745acd4ab2c67eb7/pluginmgr/__init__.py#L167-L177
train
20c/pluginmgr
pluginmgr/__init__.py
PluginManager.get_plugin_class
def get_plugin_class(self, typ): """ get class by name """ if typ in self._class: return self._class[typ] # try to import by same name try: importlib.import_module("%s.%s" % (self.namespace, typ)) if typ in self._class: ...
python
def get_plugin_class(self, typ): """ get class by name """ if typ in self._class: return self._class[typ] # try to import by same name try: importlib.import_module("%s.%s" % (self.namespace, typ)) if typ in self._class: ...
[ "def", "get_plugin_class", "(", "self", ",", "typ", ")", ":", "if", "typ", "in", "self", ".", "_class", ":", "return", "self", ".", "_class", "[", "typ", "]", "try", ":", "importlib", ".", "import_module", "(", "\"%s.%s\"", "%", "(", "self", ".", "na...
get class by name
[ "get", "class", "by", "name" ]
ea19edab6d145f539641c304745acd4ab2c67eb7
https://github.com/20c/pluginmgr/blob/ea19edab6d145f539641c304745acd4ab2c67eb7/pluginmgr/__init__.py#L186-L202
train
projectshift/shift-boiler
boiler/errors.py
register_error_handler
def register_error_handler(app, handler=None): """ Register error handler Registers an exception handler on the app instance for every type of exception code werkzeug is aware about. :param app: flask.Flask - flask application instance :param handler: function - the handler :return: None ...
python
def register_error_handler(app, handler=None): """ Register error handler Registers an exception handler on the app instance for every type of exception code werkzeug is aware about. :param app: flask.Flask - flask application instance :param handler: function - the handler :return: None ...
[ "def", "register_error_handler", "(", "app", ",", "handler", "=", "None", ")", ":", "if", "not", "handler", ":", "handler", "=", "default_error_handler", "for", "code", "in", "exceptions", ".", "default_exceptions", ".", "keys", "(", ")", ":", "app", ".", ...
Register error handler Registers an exception handler on the app instance for every type of exception code werkzeug is aware about. :param app: flask.Flask - flask application instance :param handler: function - the handler :return: None
[ "Register", "error", "handler", "Registers", "an", "exception", "handler", "on", "the", "app", "instance", "for", "every", "type", "of", "exception", "code", "werkzeug", "is", "aware", "about", "." ]
8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/errors.py#L6-L20
train
projectshift/shift-boiler
boiler/errors.py
default_error_handler
def default_error_handler(exception): """ Default error handler Will display an error page with the corresponding error code from template directory, for example, a not found will load a 404.html etc. Will first look in userland app templates and if not found, fallback to boiler templates to dis...
python
def default_error_handler(exception): """ Default error handler Will display an error page with the corresponding error code from template directory, for example, a not found will load a 404.html etc. Will first look in userland app templates and if not found, fallback to boiler templates to dis...
[ "def", "default_error_handler", "(", "exception", ")", ":", "http_exception", "=", "isinstance", "(", "exception", ",", "exceptions", ".", "HTTPException", ")", "code", "=", "exception", ".", "code", "if", "http_exception", "else", "500", "if", "code", "==", "...
Default error handler Will display an error page with the corresponding error code from template directory, for example, a not found will load a 404.html etc. Will first look in userland app templates and if not found, fallback to boiler templates to display a default page. :param exception: Except...
[ "Default", "error", "handler", "Will", "display", "an", "error", "page", "with", "the", "corresponding", "error", "code", "from", "template", "directory", "for", "example", "a", "not", "found", "will", "load", "a", "404", ".", "html", "etc", ".", "Will", "...
8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b
https://github.com/projectshift/shift-boiler/blob/8e6f3a3e4b9493fb6c8bd16bed160ede153bfb0b/boiler/errors.py#L23-L48
train
ethan92429/onshapepy
onshapepy/core/onshape.py
Onshape._make_nonce
def _make_nonce(self): ''' Generate a unique ID for the request, 25 chars in length Returns: - str: Cryptographic nonce ''' chars = string.digits + string.ascii_letters nonce = ''.join(random.choice(chars) for i in range(25)) if self._logging: ...
python
def _make_nonce(self): ''' Generate a unique ID for the request, 25 chars in length Returns: - str: Cryptographic nonce ''' chars = string.digits + string.ascii_letters nonce = ''.join(random.choice(chars) for i in range(25)) if self._logging: ...
[ "def", "_make_nonce", "(", "self", ")", ":", "chars", "=", "string", ".", "digits", "+", "string", ".", "ascii_letters", "nonce", "=", "''", ".", "join", "(", "random", ".", "choice", "(", "chars", ")", "for", "i", "in", "range", "(", "25", ")", ")...
Generate a unique ID for the request, 25 chars in length Returns: - str: Cryptographic nonce
[ "Generate", "a", "unique", "ID", "for", "the", "request", "25", "chars", "in", "length" ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/onshape.py#L60-L74
train
ethan92429/onshapepy
onshapepy/core/onshape.py
Onshape._make_auth
def _make_auth(self, method, date, nonce, path, query={}, ctype='application/json'): ''' Create the request signature to authenticate Args: - method (str): HTTP method - date (str): HTTP date header string - nonce (str): Cryptographic nonce - path...
python
def _make_auth(self, method, date, nonce, path, query={}, ctype='application/json'): ''' Create the request signature to authenticate Args: - method (str): HTTP method - date (str): HTTP date header string - nonce (str): Cryptographic nonce - path...
[ "def", "_make_auth", "(", "self", ",", "method", ",", "date", ",", "nonce", ",", "path", ",", "query", "=", "{", "}", ",", "ctype", "=", "'application/json'", ")", ":", "query", "=", "urlencode", "(", "query", ")", "hmac_str", "=", "(", "method", "+"...
Create the request signature to authenticate Args: - method (str): HTTP method - date (str): HTTP date header string - nonce (str): Cryptographic nonce - path (str): URL pathname - query (dict, default={}): URL query string in key-value pairs ...
[ "Create", "the", "request", "signature", "to", "authenticate" ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/onshape.py#L76-L105
train
ethan92429/onshapepy
onshapepy/core/onshape.py
Onshape._make_headers
def _make_headers(self, method, path, query={}, headers={}): ''' Creates a headers object to sign the request Args: - method (str): HTTP method - path (str): Request path, e.g. /api/documents. No query string - query (dict, default={}): Query string in key-va...
python
def _make_headers(self, method, path, query={}, headers={}): ''' Creates a headers object to sign the request Args: - method (str): HTTP method - path (str): Request path, e.g. /api/documents. No query string - query (dict, default={}): Query string in key-va...
[ "def", "_make_headers", "(", "self", ",", "method", ",", "path", ",", "query", "=", "{", "}", ",", "headers", "=", "{", "}", ")", ":", "date", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", ".", "strftime", "(", "'%a, %d %b %Y %H:%M:%S GMT'...
Creates a headers object to sign the request Args: - method (str): HTTP method - path (str): Request path, e.g. /api/documents. No query string - query (dict, default={}): Query string in key-value format - headers (dict, default={}): Other headers to pass in ...
[ "Creates", "a", "headers", "object", "to", "sign", "the", "request" ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/onshape.py#L107-L140
train
ethan92429/onshapepy
onshapepy/core/onshape.py
Onshape.request
def request(self, method, path, query={}, headers={}, body={}, base_url=None): ''' Issues a request to Onshape Args: - method (str): HTTP method - path (str): Path e.g. /api/documents/:id - query (dict, default={}): Query params in key-value pairs ...
python
def request(self, method, path, query={}, headers={}, body={}, base_url=None): ''' Issues a request to Onshape Args: - method (str): HTTP method - path (str): Path e.g. /api/documents/:id - query (dict, default={}): Query params in key-value pairs ...
[ "def", "request", "(", "self", ",", "method", ",", "path", ",", "query", "=", "{", "}", ",", "headers", "=", "{", "}", ",", "body", "=", "{", "}", ",", "base_url", "=", "None", ")", ":", "req_headers", "=", "self", ".", "_make_headers", "(", "met...
Issues a request to Onshape Args: - method (str): HTTP method - path (str): Path e.g. /api/documents/:id - query (dict, default={}): Query params in key-value pairs - headers (dict, default={}): Key-value pairs of headers - body (dict, default={}): B...
[ "Issues", "a", "request", "to", "Onshape" ]
61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df
https://github.com/ethan92429/onshapepy/blob/61dc7ccbdc6095fa6cc3b4a414e2f72d03d1c9df/onshapepy/core/onshape.py#L142-L194
train
Ceasar/twosheds
twosheds/program.py
Program.gen_sentences
def gen_sentences(self, tokens, aliases=None): """ Generate a sequence of sentences from stream of tokens. """ if aliases is None: aliases = {} for sentence in self._gen_sentences(tokens): try: alias = aliases[str(sentence[0])] ...
python
def gen_sentences(self, tokens, aliases=None): """ Generate a sequence of sentences from stream of tokens. """ if aliases is None: aliases = {} for sentence in self._gen_sentences(tokens): try: alias = aliases[str(sentence[0])] ...
[ "def", "gen_sentences", "(", "self", ",", "tokens", ",", "aliases", "=", "None", ")", ":", "if", "aliases", "is", "None", ":", "aliases", "=", "{", "}", "for", "sentence", "in", "self", ".", "_gen_sentences", "(", "tokens", ")", ":", "try", ":", "ali...
Generate a sequence of sentences from stream of tokens.
[ "Generate", "a", "sequence", "of", "sentences", "from", "stream", "of", "tokens", "." ]
55b0a207e3a06b85e9a9567069b3822a651501a7
https://github.com/Ceasar/twosheds/blob/55b0a207e3a06b85e9a9567069b3822a651501a7/twosheds/program.py#L106-L122
train
ZEDGR/pychal
challonge/api.py
set_timezone
def set_timezone(new_tz=None): """Set the timezone for datetime fields. By default is your machine's time. If it's called without parameter sets the local time again. :keyword param new_tz: timezone string ex. 'Europe/Athens', 'Asia/Seoul', 'America/Los_Angeles', 'UTC' ...
python
def set_timezone(new_tz=None): """Set the timezone for datetime fields. By default is your machine's time. If it's called without parameter sets the local time again. :keyword param new_tz: timezone string ex. 'Europe/Athens', 'Asia/Seoul', 'America/Los_Angeles', 'UTC' ...
[ "def", "set_timezone", "(", "new_tz", "=", "None", ")", ":", "global", "tz", "if", "new_tz", ":", "tz", "=", "pytz", ".", "timezone", "(", "new_tz", ")", "else", ":", "tz", "=", "tzlocal", ".", "get_localzone", "(", ")" ]
Set the timezone for datetime fields. By default is your machine's time. If it's called without parameter sets the local time again. :keyword param new_tz: timezone string ex. 'Europe/Athens', 'Asia/Seoul', 'America/Los_Angeles', 'UTC' :return None
[ "Set", "the", "timezone", "for", "datetime", "fields", ".", "By", "default", "is", "your", "machine", "s", "time", ".", "If", "it", "s", "called", "without", "parameter", "sets", "the", "local", "time", "again", "." ]
3600fa9e0557a2a14eb1ad0c0711d28dad3693d7
https://github.com/ZEDGR/pychal/blob/3600fa9e0557a2a14eb1ad0c0711d28dad3693d7/challonge/api.py#L32-L51
train
ZEDGR/pychal
challonge/api.py
fetch_and_parse
def fetch_and_parse(method, uri, params_prefix=None, **params): """Fetch the given uri and return python dictionary with parsed data-types.""" response = fetch(method, uri, params_prefix, **params) return _parse(json.loads(response.text))
python
def fetch_and_parse(method, uri, params_prefix=None, **params): """Fetch the given uri and return python dictionary with parsed data-types.""" response = fetch(method, uri, params_prefix, **params) return _parse(json.loads(response.text))
[ "def", "fetch_and_parse", "(", "method", ",", "uri", ",", "params_prefix", "=", "None", ",", "**", "params", ")", ":", "response", "=", "fetch", "(", "method", ",", "uri", ",", "params_prefix", ",", "**", "params", ")", "return", "_parse", "(", "json", ...
Fetch the given uri and return python dictionary with parsed data-types.
[ "Fetch", "the", "given", "uri", "and", "return", "python", "dictionary", "with", "parsed", "data", "-", "types", "." ]
3600fa9e0557a2a14eb1ad0c0711d28dad3693d7
https://github.com/ZEDGR/pychal/blob/3600fa9e0557a2a14eb1ad0c0711d28dad3693d7/challonge/api.py#L94-L97
train
ZEDGR/pychal
challonge/api.py
_parse
def _parse(data): """Recursively convert a json into python data types""" if not data: return [] elif isinstance(data, (tuple, list)): return [_parse(subdata) for subdata in data] # extract the nested dict. ex. {"tournament": {"url": "7k1safq" ...}} d = {ik: v for k in data.keys() ...
python
def _parse(data): """Recursively convert a json into python data types""" if not data: return [] elif isinstance(data, (tuple, list)): return [_parse(subdata) for subdata in data] # extract the nested dict. ex. {"tournament": {"url": "7k1safq" ...}} d = {ik: v for k in data.keys() ...
[ "def", "_parse", "(", "data", ")", ":", "if", "not", "data", ":", "return", "[", "]", "elif", "isinstance", "(", "data", ",", "(", "tuple", ",", "list", ")", ")", ":", "return", "[", "_parse", "(", "subdata", ")", "for", "subdata", "in", "data", ...
Recursively convert a json into python data types
[ "Recursively", "convert", "a", "json", "into", "python", "data", "types" ]
3600fa9e0557a2a14eb1ad0c0711d28dad3693d7
https://github.com/ZEDGR/pychal/blob/3600fa9e0557a2a14eb1ad0c0711d28dad3693d7/challonge/api.py#L100-L132
train
uw-it-aca/uw-restclients-sws
uw_sws/department.py
get_departments_by_college
def get_departments_by_college(college): """ Returns a list of restclients.Department models, for the passed College model. """ url = "{}?{}".format( dept_search_url_prefix, urlencode({"college_abbreviation": college.label})) return _json_to_departments(get_resource(url), college...
python
def get_departments_by_college(college): """ Returns a list of restclients.Department models, for the passed College model. """ url = "{}?{}".format( dept_search_url_prefix, urlencode({"college_abbreviation": college.label})) return _json_to_departments(get_resource(url), college...
[ "def", "get_departments_by_college", "(", "college", ")", ":", "url", "=", "\"{}?{}\"", ".", "format", "(", "dept_search_url_prefix", ",", "urlencode", "(", "{", "\"college_abbreviation\"", ":", "college", ".", "label", "}", ")", ")", "return", "_json_to_departmen...
Returns a list of restclients.Department models, for the passed College model.
[ "Returns", "a", "list", "of", "restclients", ".", "Department", "models", "for", "the", "passed", "College", "model", "." ]
4d36776dcca36855fc15c1b8fe7650ae045194cf
https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/department.py#L14-L22
train
berkeley-cocosci/Wallace
wallace/db.py
scoped_session_decorator
def scoped_session_decorator(func): """Manage contexts and add debugging to psiTurk sessions.""" @wraps(func) def wrapper(*args, **kwargs): from wallace.db import session as wallace_session with sessions_scope(wallace_session) as session: from psiturk.db import db_session as psi_...
python
def scoped_session_decorator(func): """Manage contexts and add debugging to psiTurk sessions.""" @wraps(func) def wrapper(*args, **kwargs): from wallace.db import session as wallace_session with sessions_scope(wallace_session) as session: from psiturk.db import db_session as psi_...
[ "def", "scoped_session_decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "from", "wallace", ".", "db", "import", "session", "as", "wallace_session", "with", "sessions_scope...
Manage contexts and add debugging to psiTurk sessions.
[ "Manage", "contexts", "and", "add", "debugging", "to", "psiTurk", "sessions", "." ]
3650c0bc3b0804d0adb1d178c5eba9992babb1b0
https://github.com/berkeley-cocosci/Wallace/blob/3650c0bc3b0804d0adb1d178c5eba9992babb1b0/wallace/db.py#L47-L62
train
Ceasar/twosheds
twosheds/terminal.py
Terminal.readline
def readline(self, continuation=False): """Read a line from the terminal. A backslash followed by a <newline> is interpreted as a line continuation. The backslash and <newline>s are removed before return. For example:: $ uname \ > -m x86_64 ...
python
def readline(self, continuation=False): """Read a line from the terminal. A backslash followed by a <newline> is interpreted as a line continuation. The backslash and <newline>s are removed before return. For example:: $ uname \ > -m x86_64 ...
[ "def", "readline", "(", "self", ",", "continuation", "=", "False", ")", ":", "prompt", "=", "(", "self", ".", "secondary_prompt_string", "if", "continuation", "else", "self", ".", "primary_prompt_string", ")", "try", ":", "line", "=", "raw_input", "(", "prom...
Read a line from the terminal. A backslash followed by a <newline> is interpreted as a line continuation. The backslash and <newline>s are removed before return. For example:: $ uname \ > -m x86_64 :param continuation: True if the line ...
[ "Read", "a", "line", "from", "the", "terminal", "." ]
55b0a207e3a06b85e9a9567069b3822a651501a7
https://github.com/Ceasar/twosheds/blob/55b0a207e3a06b85e9a9567069b3822a651501a7/twosheds/terminal.py#L24-L48
train
Ceasar/twosheds
twosheds/terminal.py
Terminal.readlines
def readlines(self): """Read a command from the terminal. Returns a list of tokens containing the user's input. """ continuation = False while True: yield self.readline(continuation) continuation = True
python
def readlines(self): """Read a command from the terminal. Returns a list of tokens containing the user's input. """ continuation = False while True: yield self.readline(continuation) continuation = True
[ "def", "readlines", "(", "self", ")", ":", "continuation", "=", "False", "while", "True", ":", "yield", "self", ".", "readline", "(", "continuation", ")", "continuation", "=", "True" ]
Read a command from the terminal. Returns a list of tokens containing the user's input.
[ "Read", "a", "command", "from", "the", "terminal", "." ]
55b0a207e3a06b85e9a9567069b3822a651501a7
https://github.com/Ceasar/twosheds/blob/55b0a207e3a06b85e9a9567069b3822a651501a7/twosheds/terminal.py#L50-L58
train
Kortemme-Lab/klab
klab/bio/pdb.py
sequence
def sequence(pdb_filepath): '''A convenience method for printing PDB sequences in command-line execution. :param pdb_filepath: A path to a PDB file. :return: A string where odd line is a chain letter and each following even line is that chain's ATOM sequence. Example use: from ...
python
def sequence(pdb_filepath): '''A convenience method for printing PDB sequences in command-line execution. :param pdb_filepath: A path to a PDB file. :return: A string where odd line is a chain letter and each following even line is that chain's ATOM sequence. Example use: from ...
[ "def", "sequence", "(", "pdb_filepath", ")", ":", "return", "'\\n'", ".", "join", "(", "[", "'{0}\\n{1}'", ".", "format", "(", "chain_id", ",", "str", "(", "seq", ")", ")", "for", "chain_id", ",", "seq", "in", "sorted", "(", "PDB", ".", "from_filepath"...
A convenience method for printing PDB sequences in command-line execution. :param pdb_filepath: A path to a PDB file. :return: A string where odd line is a chain letter and each following even line is that chain's ATOM sequence. Example use: from klab.bio import pdb pri...
[ "A", "convenience", "method", "for", "printing", "PDB", "sequences", "in", "command", "-", "line", "execution", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L3149-L3159
train
Kortemme-Lab/klab
klab/bio/pdb.py
PDB.fix_pdb
def fix_pdb(self): '''A function to fix fatal errors in PDB files when they can be automatically fixed. At present, this only runs if self.strict is False. We may want a separate property for this since we may want to keep strict mode but still allow PDBs to be fixed. The only ...
python
def fix_pdb(self): '''A function to fix fatal errors in PDB files when they can be automatically fixed. At present, this only runs if self.strict is False. We may want a separate property for this since we may want to keep strict mode but still allow PDBs to be fixed. The only ...
[ "def", "fix_pdb", "(", "self", ")", ":", "if", "self", ".", "strict", ":", "return", "chains", "=", "set", "(", ")", "for", "l", "in", "self", ".", "lines", ":", "if", "l", ".", "startswith", "(", "'ATOM '", ")", "or", "l", ".", "startswith", "(...
A function to fix fatal errors in PDB files when they can be automatically fixed. At present, this only runs if self.strict is False. We may want a separate property for this since we may want to keep strict mode but still allow PDBs to be fixed. The only fixes at the moment are for mi...
[ "A", "function", "to", "fix", "fatal", "errors", "in", "PDB", "files", "when", "they", "can", "be", "automatically", "fixed", ".", "At", "present", "this", "only", "runs", "if", "self", ".", "strict", "is", "False", ".", "We", "may", "want", "a", "sepa...
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L456-L490
train
Kortemme-Lab/klab
klab/bio/pdb.py
PDB.replace_headers
def replace_headers(source_pdb_content, target_pdb_content): '''Takes the headers from source_pdb_content and adds them to target_pdb_content, removing any headers that target_pdb_content had. Only the content up to the first structural line are taken from source_pdb_content and only the c...
python
def replace_headers(source_pdb_content, target_pdb_content): '''Takes the headers from source_pdb_content and adds them to target_pdb_content, removing any headers that target_pdb_content had. Only the content up to the first structural line are taken from source_pdb_content and only the c...
[ "def", "replace_headers", "(", "source_pdb_content", ",", "target_pdb_content", ")", ":", "s", "=", "PDB", "(", "source_pdb_content", ")", "t", "=", "PDB", "(", "target_pdb_content", ")", "source_headers", "=", "[", "]", "for", "l", "in", "s", ".", "lines", ...
Takes the headers from source_pdb_content and adds them to target_pdb_content, removing any headers that target_pdb_content had. Only the content up to the first structural line are taken from source_pdb_content and only the content from the first structural line in target_pdb_content a...
[ "Takes", "the", "headers", "from", "source_pdb_content", "and", "adds", "them", "to", "target_pdb_content", "removing", "any", "headers", "that", "target_pdb_content", "had", ".", "Only", "the", "content", "up", "to", "the", "first", "structural", "line", "are", ...
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L557-L581
train
Kortemme-Lab/klab
klab/bio/pdb.py
PDB.from_lines
def from_lines(pdb_file_lines, strict = True, parse_ligands = False): '''A function to replace the old constructor call where a list of the file's lines was passed in.''' return PDB("\n".join(pdb_file_lines), strict = strict, parse_ligands = parse_ligands)
python
def from_lines(pdb_file_lines, strict = True, parse_ligands = False): '''A function to replace the old constructor call where a list of the file's lines was passed in.''' return PDB("\n".join(pdb_file_lines), strict = strict, parse_ligands = parse_ligands)
[ "def", "from_lines", "(", "pdb_file_lines", ",", "strict", "=", "True", ",", "parse_ligands", "=", "False", ")", ":", "return", "PDB", "(", "\"\\n\"", ".", "join", "(", "pdb_file_lines", ")", ",", "strict", "=", "strict", ",", "parse_ligands", "=", "parse_...
A function to replace the old constructor call where a list of the file's lines was passed in.
[ "A", "function", "to", "replace", "the", "old", "constructor", "call", "where", "a", "list", "of", "the", "file", "s", "lines", "was", "passed", "in", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L591-L593
train
Kortemme-Lab/klab
klab/bio/pdb.py
PDB._split_lines
def _split_lines(self): '''Creates the parsed_lines dict which keeps all record data in document order indexed by the record type.''' parsed_lines = {} for rt in all_record_types: parsed_lines[rt] = [] parsed_lines[0] = [] for line in self.lines: linetype...
python
def _split_lines(self): '''Creates the parsed_lines dict which keeps all record data in document order indexed by the record type.''' parsed_lines = {} for rt in all_record_types: parsed_lines[rt] = [] parsed_lines[0] = [] for line in self.lines: linetype...
[ "def", "_split_lines", "(", "self", ")", ":", "parsed_lines", "=", "{", "}", "for", "rt", "in", "all_record_types", ":", "parsed_lines", "[", "rt", "]", "=", "[", "]", "parsed_lines", "[", "0", "]", "=", "[", "]", "for", "line", "in", "self", ".", ...
Creates the parsed_lines dict which keeps all record data in document order indexed by the record type.
[ "Creates", "the", "parsed_lines", "dict", "which", "keeps", "all", "record", "data", "in", "document", "order", "indexed", "by", "the", "record", "type", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L621-L636
train
Kortemme-Lab/klab
klab/bio/pdb.py
PDB._update_structure_lines
def _update_structure_lines(self): '''ATOM and HETATM lines may be altered by function calls. When this happens, this function should be called to keep self.structure_lines up to date.''' structure_lines = [] atom_chain_order = [] chain_atoms = {} for line in self.lines: ...
python
def _update_structure_lines(self): '''ATOM and HETATM lines may be altered by function calls. When this happens, this function should be called to keep self.structure_lines up to date.''' structure_lines = [] atom_chain_order = [] chain_atoms = {} for line in self.lines: ...
[ "def", "_update_structure_lines", "(", "self", ")", ":", "structure_lines", "=", "[", "]", "atom_chain_order", "=", "[", "]", "chain_atoms", "=", "{", "}", "for", "line", "in", "self", ".", "lines", ":", "linetype", "=", "line", "[", "0", ":", "6", "]"...
ATOM and HETATM lines may be altered by function calls. When this happens, this function should be called to keep self.structure_lines up to date.
[ "ATOM", "and", "HETATM", "lines", "may", "be", "altered", "by", "function", "calls", ".", "When", "this", "happens", "this", "function", "should", "be", "called", "to", "keep", "self", ".", "structure_lines", "up", "to", "date", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L639-L666
train
Kortemme-Lab/klab
klab/bio/pdb.py
PDB.clone
def clone(self, parse_ligands = False): '''A function to replace the old constructor call where a PDB object was passed in and 'cloned'.''' return PDB("\n".join(self.lines), pdb_id = self.pdb_id, strict = self.strict, parse_ligands = parse_ligands)
python
def clone(self, parse_ligands = False): '''A function to replace the old constructor call where a PDB object was passed in and 'cloned'.''' return PDB("\n".join(self.lines), pdb_id = self.pdb_id, strict = self.strict, parse_ligands = parse_ligands)
[ "def", "clone", "(", "self", ",", "parse_ligands", "=", "False", ")", ":", "return", "PDB", "(", "\"\\n\"", ".", "join", "(", "self", ".", "lines", ")", ",", "pdb_id", "=", "self", ".", "pdb_id", ",", "strict", "=", "self", ".", "strict", ",", "par...
A function to replace the old constructor call where a PDB object was passed in and 'cloned'.
[ "A", "function", "to", "replace", "the", "old", "constructor", "call", "where", "a", "PDB", "object", "was", "passed", "in", "and", "cloned", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L670-L672
train
Kortemme-Lab/klab
klab/bio/pdb.py
PDB.get_pdb_id
def get_pdb_id(self): '''Return the PDB ID. If one was passed in to the constructor, this takes precedence, otherwise the header is parsed to try to find an ID. The header does not always contain a PDB ID in regular PDB files and appears to always have an ID of 'XXXX' in biological units s...
python
def get_pdb_id(self): '''Return the PDB ID. If one was passed in to the constructor, this takes precedence, otherwise the header is parsed to try to find an ID. The header does not always contain a PDB ID in regular PDB files and appears to always have an ID of 'XXXX' in biological units s...
[ "def", "get_pdb_id", "(", "self", ")", ":", "if", "self", ".", "pdb_id", ":", "return", "self", ".", "pdb_id", "else", ":", "header", "=", "self", ".", "parsed_lines", "[", "\"HEADER\"", "]", "assert", "(", "len", "(", "header", ")", "<=", "1", ")", ...
Return the PDB ID. If one was passed in to the constructor, this takes precedence, otherwise the header is parsed to try to find an ID. The header does not always contain a PDB ID in regular PDB files and appears to always have an ID of 'XXXX' in biological units so the constructor override is use...
[ "Return", "the", "PDB", "ID", ".", "If", "one", "was", "passed", "in", "to", "the", "constructor", "this", "takes", "precedence", "otherwise", "the", "header", "is", "parsed", "to", "try", "to", "find", "an", "ID", ".", "The", "header", "does", "not", ...
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L684-L696
train
Kortemme-Lab/klab
klab/bio/pdb.py
PDB.get_annotated_chain_sequence_string
def get_annotated_chain_sequence_string(self, chain_id, use_seqres_sequences_if_possible, raise_Exception_if_not_found = True): '''A helper function to return the Sequence for a chain. If use_seqres_sequences_if_possible then we return the SEQRES Sequence if it exists. We return a tuple of values, th...
python
def get_annotated_chain_sequence_string(self, chain_id, use_seqres_sequences_if_possible, raise_Exception_if_not_found = True): '''A helper function to return the Sequence for a chain. If use_seqres_sequences_if_possible then we return the SEQRES Sequence if it exists. We return a tuple of values, th...
[ "def", "get_annotated_chain_sequence_string", "(", "self", ",", "chain_id", ",", "use_seqres_sequences_if_possible", ",", "raise_Exception_if_not_found", "=", "True", ")", ":", "if", "use_seqres_sequences_if_possible", "and", "self", ".", "seqres_sequences", "and", "self", ...
A helper function to return the Sequence for a chain. If use_seqres_sequences_if_possible then we return the SEQRES Sequence if it exists. We return a tuple of values, the first identifying which sequence was returned.
[ "A", "helper", "function", "to", "return", "the", "Sequence", "for", "a", "chain", ".", "If", "use_seqres_sequences_if_possible", "then", "we", "return", "the", "SEQRES", "Sequence", "if", "it", "exists", ".", "We", "return", "a", "tuple", "of", "values", "t...
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L704-L714
train
Kortemme-Lab/klab
klab/bio/pdb.py
PDB.get_chain_sequence_string
def get_chain_sequence_string(self, chain_id, use_seqres_sequences_if_possible, raise_Exception_if_not_found = True): '''Similar to get_annotated_chain_sequence_string except that we only return the Sequence and do not state which sequence it was.''' chain_pair = self.get_annotated_chain_sequence_string...
python
def get_chain_sequence_string(self, chain_id, use_seqres_sequences_if_possible, raise_Exception_if_not_found = True): '''Similar to get_annotated_chain_sequence_string except that we only return the Sequence and do not state which sequence it was.''' chain_pair = self.get_annotated_chain_sequence_string...
[ "def", "get_chain_sequence_string", "(", "self", ",", "chain_id", ",", "use_seqres_sequences_if_possible", ",", "raise_Exception_if_not_found", "=", "True", ")", ":", "chain_pair", "=", "self", ".", "get_annotated_chain_sequence_string", "(", "chain_id", ",", "use_seqres_...
Similar to get_annotated_chain_sequence_string except that we only return the Sequence and do not state which sequence it was.
[ "Similar", "to", "get_annotated_chain_sequence_string", "except", "that", "we", "only", "return", "the", "Sequence", "and", "do", "not", "state", "which", "sequence", "it", "was", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L717-L722
train
Kortemme-Lab/klab
klab/bio/pdb.py
PDB.strip_HETATMs
def strip_HETATMs(self, only_strip_these_chains = []): '''Throw away all HETATM lines. If only_strip_these_chains is specified then only strip HETATMs lines for those chains.''' if only_strip_these_chains: self.lines = [l for l in self.lines if not(l.startswith('HETATM')) or l[21] not in onl...
python
def strip_HETATMs(self, only_strip_these_chains = []): '''Throw away all HETATM lines. If only_strip_these_chains is specified then only strip HETATMs lines for those chains.''' if only_strip_these_chains: self.lines = [l for l in self.lines if not(l.startswith('HETATM')) or l[21] not in onl...
[ "def", "strip_HETATMs", "(", "self", ",", "only_strip_these_chains", "=", "[", "]", ")", ":", "if", "only_strip_these_chains", ":", "self", ".", "lines", "=", "[", "l", "for", "l", "in", "self", ".", "lines", "if", "not", "(", "l", ".", "startswith", "...
Throw away all HETATM lines. If only_strip_these_chains is specified then only strip HETATMs lines for those chains.
[ "Throw", "away", "all", "HETATM", "lines", ".", "If", "only_strip_these_chains", "is", "specified", "then", "only", "strip", "HETATMs", "lines", "for", "those", "chains", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L800-L806
train
Kortemme-Lab/klab
klab/bio/pdb.py
PDB._get_pdb_format_version
def _get_pdb_format_version(self): '''Remark 4 indicates the version of the PDB File Format used to generate the file.''' if not self.format_version: version = None version_lines = None try: version_lines = [line for line in self.parsed_lines['REMARK']...
python
def _get_pdb_format_version(self): '''Remark 4 indicates the version of the PDB File Format used to generate the file.''' if not self.format_version: version = None version_lines = None try: version_lines = [line for line in self.parsed_lines['REMARK']...
[ "def", "_get_pdb_format_version", "(", "self", ")", ":", "if", "not", "self", ".", "format_version", ":", "version", "=", "None", "version_lines", "=", "None", "try", ":", "version_lines", "=", "[", "line", "for", "line", "in", "self", ".", "parsed_lines", ...
Remark 4 indicates the version of the PDB File Format used to generate the file.
[ "Remark", "4", "indicates", "the", "version", "of", "the", "PDB", "File", "Format", "used", "to", "generate", "the", "file", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L926-L944
train
Kortemme-Lab/klab
klab/bio/pdb.py
PDB.get_atom_sequence_to_rosetta_json_map
def get_atom_sequence_to_rosetta_json_map(self): '''Returns the mapping from PDB ATOM residue IDs to Rosetta residue IDs in JSON format.''' import json d = {} atom_sequence_to_rosetta_mapping = self.get_atom_sequence_to_rosetta_map() for c, sm in atom_sequence_to_rosetta_mapping....
python
def get_atom_sequence_to_rosetta_json_map(self): '''Returns the mapping from PDB ATOM residue IDs to Rosetta residue IDs in JSON format.''' import json d = {} atom_sequence_to_rosetta_mapping = self.get_atom_sequence_to_rosetta_map() for c, sm in atom_sequence_to_rosetta_mapping....
[ "def", "get_atom_sequence_to_rosetta_json_map", "(", "self", ")", ":", "import", "json", "d", "=", "{", "}", "atom_sequence_to_rosetta_mapping", "=", "self", ".", "get_atom_sequence_to_rosetta_map", "(", ")", "for", "c", ",", "sm", "in", "atom_sequence_to_rosetta_mapp...
Returns the mapping from PDB ATOM residue IDs to Rosetta residue IDs in JSON format.
[ "Returns", "the", "mapping", "from", "PDB", "ATOM", "residue", "IDs", "to", "Rosetta", "residue", "IDs", "in", "JSON", "format", "." ]
6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/pdb.py#L1744-L1752
train