INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Parse the next token in the stream. | def get_token(s, pos, brackets_are_chars=True, environments=True, **parse_flags):
"""
Parse the next token in the stream.
Returns a `LatexToken`. Raises `LatexWalkerEndOfStream` if end of stream reached.
.. deprecated:: 1.0
Please use :py:meth:`LatexWalker.get_token()` instead.
"""
retu... |
Reads a latex expression e. g. macro argument. This may be a single char an escape sequence or a expression placed in braces. | def get_latex_expression(s, pos, **parse_flags):
"""
Reads a latex expression, e.g. macro argument. This may be a single char, an escape
sequence, or a expression placed in braces.
Returns a tuple `(<LatexNode instance>, pos, len)`. `pos` is the first char of the
expression, and `len` is its length... |
Attempts to parse an optional argument. Returns a tuple ( groupnode pos len ) if success otherwise returns None. | def get_latex_maybe_optional_arg(s, pos, **parse_flags):
"""
Attempts to parse an optional argument. Returns a tuple `(groupnode, pos, len)` if
success, otherwise returns None.
.. deprecated:: 1.0
Please use :py:meth:`LatexWalker.get_latex_maybe_optional_arg()` instead.
"""
return Latex... |
Reads a latex expression enclosed in braces {... }. The first token of s [ pos: ] must be an opening brace. | def get_latex_braced_group(s, pos, brace_type='{', **parse_flags):
"""
Reads a latex expression enclosed in braces {...}. The first token of `s[pos:]` must
be an opening brace.
Returns a tuple `(node, pos, len)`. `pos` is the first char of the
expression (which has to be an opening brace), and `len... |
Reads a latex expression enclosed in a \\ begin { environment }... \\ end { environment }. The first token in the stream must be the \\ begin { environment }. | def get_latex_environment(s, pos, environmentname=None, **parse_flags):
"""
Reads a latex expression enclosed in a \\begin{environment}...\\end{environment}. The first
token in the stream must be the \\begin{environment}.
Returns a tuple (node, pos, len) with node being a :py:class:`LatexEnvironmentNod... |
Parses latex content s. | def get_latex_nodes(s, pos=0, stop_upon_closing_brace=None, stop_upon_end_environment=None,
stop_upon_closing_mathmode=None, **parse_flags):
"""
Parses latex content `s`.
Returns a tuple `(nodelist, pos, len)` where nodelist is a list of `LatexNode` 's.
If `stop_upon_closing_brace`... |
Parses the latex content given to the constructor ( and stored in self. s ) starting at position pos to parse a single token as defined by: py: class: LatexToken. | def get_token(self, pos, brackets_are_chars=True, environments=True, keep_inline_math=None):
"""
Parses the latex content given to the constructor (and stored in `self.s`),
starting at position `pos`, to parse a single "token", as defined by
:py:class:`LatexToken`.
Parse the tok... |
Parses the latex content given to the constructor ( and stored in self. s ) starting at position pos to parse a single LaTeX expression. | def get_latex_expression(self, pos, strict_braces=None):
"""
Parses the latex content given to the constructor (and stored in `self.s`),
starting at position `pos`, to parse a single LaTeX expression.
Reads a latex expression, e.g. macro argument. This may be a single char, an escape
... |
Parses the latex content given to the constructor ( and stored in self. s ) starting at position pos to attempt to parse an optional argument. | def get_latex_maybe_optional_arg(self, pos):
"""
Parses the latex content given to the constructor (and stored in `self.s`),
starting at position `pos`, to attempt to parse an optional argument.
Attempts to parse an optional argument. If this is successful, we return
a tuple `(n... |
Parses the latex content given to the constructor ( and stored in self. s ) starting at position pos to read a latex group delimited by braces. | def get_latex_braced_group(self, pos, brace_type='{'):
"""
Parses the latex content given to the constructor (and stored in `self.s`),
starting at position `pos`, to read a latex group delimited by braces.
Reads a latex expression enclosed in braces ``{ ... }``. The first token of
... |
r Parses the latex content given to the constructor ( and stored in self. s ) starting at position pos to read a latex environment. | def get_latex_environment(self, pos, environmentname=None):
r"""
Parses the latex content given to the constructor (and stored in `self.s`),
starting at position `pos`, to read a latex environment.
Reads a latex expression enclosed in a
``\begin{environment}...\end{environment}`... |
Parses the latex content given to the constructor ( and stored in self. s ) into a list of nodes. | def get_latex_nodes(self, pos=0, stop_upon_closing_brace=None, stop_upon_end_environment=None,
stop_upon_closing_mathmode=None):
"""
Parses the latex content given to the constructor (and stored in `self.s`)
into a list of nodes.
Returns a tuple `(nodelist, pos, ... |
Extracts text from content meant for database indexing. content is some LaTeX code. | def latex2text(content, tolerant_parsing=False, keep_inline_math=False, keep_comments=False):
"""
Extracts text from `content` meant for database indexing. `content` is
some LaTeX code.
.. deprecated:: 1.0
Please use :py:class:`LatexNodes2Text` instead.
"""
(nodelist, tpos, tlen) = late... |
Extracts text from a node list. nodelist is a list of nodes as returned by: py: func: pylatexenc. latexwalker. get_latex_nodes (). | def latexnodes2text(nodelist, keep_inline_math=False, keep_comments=False):
"""
Extracts text from a node list. `nodelist` is a list of nodes as returned by
:py:func:`pylatexenc.latexwalker.get_latex_nodes()`.
.. deprecated:: 1.0
Please use :py:class:`LatexNodes2Text` instead.
"""
retur... |
Set where to look for input files when encountering the \\ input or \\ include macro. | def set_tex_input_directory(self, tex_input_directory, latex_walker_init_args=None, strict_input=True):
"""
Set where to look for input files when encountering the ``\\input`` or
``\\include`` macro.
Alternatively, you may also override :py:meth:`read_input_file()` to
implement ... |
This method may be overridden to implement a custom lookup mechanism when encountering \\ input or \\ include directives. | def read_input_file(self, fn):
"""
This method may be overridden to implement a custom lookup mechanism when
encountering ``\\input`` or ``\\include`` directives.
The default implementation looks for a file of the given name relative
to the directory set by :py:meth:`set_tex_inp... |
Parses the given latex code and returns its textual representation. | def latex_to_text(self, latex, **parse_flags):
"""
Parses the given `latex` code and returns its textual representation.
The `parse_flags` are the flags to give on to the
:py:class:`pylatexenc.latexwalker.LatexWalker` constructor.
"""
return self.nodelist_to_text(latexwa... |
Extracts text from a node list. nodelist is a list of nodes as returned by: py: meth: pylatexenc. latexwalker. LatexWalker. get_latex_nodes (). | def nodelist_to_text(self, nodelist):
"""
Extracts text from a node list. `nodelist` is a list of nodes as returned by
:py:meth:`pylatexenc.latexwalker.LatexWalker.get_latex_nodes()`.
In addition to converting each node in the list to text using
`node_to_text()`, we apply some g... |
Turn the node list to text representations of each node. Basically apply node_to_text () to each node. ( But not quite actually since we take some care as to where we add whitespace. ) | def _nodelistcontents_to_text(self, nodelist):
"""
Turn the node list to text representations of each node. Basically apply
`node_to_text()` to each node. (But not quite actually, since we take
some care as to where we add whitespace.)
"""
s = ''
prev_node = Non... |
Return the textual representation of the given node. | def node_to_text(self, node, prev_node_hint=None):
"""
Return the textual representation of the given `node`.
If `prev_node_hint` is specified, then the current node is formatted
suitably as following the node given in `prev_node_hint`. This might
affect how much space we keep/... |
u Encode a UTF - 8 string to a LaTeX snippet. | def utf8tolatex(s, non_ascii_only=False, brackets=True, substitute_bad_chars=False, fail_bad_chars=False):
u"""
Encode a UTF-8 string to a LaTeX snippet.
If `non_ascii_only` is set to `True`, then usual (ascii) characters such as ``#``,
``{``, ``}`` etc. will not be escaped. If set to `False` (the def... |
Unpack \\ uNNNN escapes in s and encode the result as UTF - 8 | def _unascii(s):
"""Unpack `\\uNNNN` escapes in 's' and encode the result as UTF-8
This method takes the output of the JSONEncoder and expands any \\uNNNN
escapes it finds (except for \\u0000 to \\u001F, which are converted to
\\xNN escapes).
For performance, it assumes that the input is valid JSO... |
Get information fot this organisation. Returns a dictionary of values. | def get_organisation_information(self, query_params=None):
'''
Get information fot this organisation. Returns a dictionary of values.
'''
return self.fetch_json(
uri_path=self.base_uri,
query_params=query_params or {}
) |
Get all the boards for this organisation. Returns a list of Board s. | def get_boards(self, **query_params):
'''
Get all the boards for this organisation. Returns a list of Board s.
Returns:
list(Board): The boards attached to this organisation
'''
boards = self.get_boards_json(self.base_uri, query_params=query_params)
boards_l... |
Get all members attached to this organisation. Returns a list of Member objects | def get_members(self, **query_params):
'''
Get all members attached to this organisation. Returns a list of
Member objects
Returns:
list(Member): The members attached to this organisation
'''
members = self.get_members_json(self.base_uri,
... |
Update this organisations information. Returns a new organisation object. | def update_organisation(self, query_params=None):
'''
Update this organisations information. Returns a new organisation
object.
'''
organisation_json = self.fetch_json(
uri_path=self.base_uri,
http_method='PUT',
query_params=query_params or {}
... |
Remove a member from the organisation. Returns JSON of all members if successful or raises an Unauthorised exception if not. | def remove_member(self, member_id):
'''
Remove a member from the organisation.Returns JSON of all members if
successful or raises an Unauthorised exception if not.
'''
return self.fetch_json(
uri_path=self.base_uri + '/members/%s' % member_id,
http_method=... |
Add a member to the board using the id. Membership type can be normal or admin. Returns JSON of all members if successful or raises an Unauthorised exception if not. | def add_member_by_id(self, member_id, membership_type='normal'):
'''
Add a member to the board using the id. Membership type can be
normal or admin. Returns JSON of all members if successful or raises an
Unauthorised exception if not.
'''
return self.fetch_json(
... |
Add a member to the board. Membership type can be normal or admin. Returns JSON of all members if successful or raises an Unauthorised exception if not. | def add_member(self, email, fullname, membership_type='normal'):
'''
Add a member to the board. Membership type can be normal or admin.
Returns JSON of all members if successful or raises an Unauthorised
exception if not.
'''
return self.fetch_json(
uri_path=s... |
Get information for this list. Returns a dictionary of values. | def get_list_information(self, query_params=None):
'''
Get information for this list. Returns a dictionary of values.
'''
return self.fetch_json(
uri_path=self.base_uri,
query_params=query_params or {}
) |
Create a card for this list. Returns a Card object. | def add_card(self, query_params=None):
'''
Create a card for this list. Returns a Card object.
'''
card_json = self.fetch_json(
uri_path=self.base_uri + '/cards',
http_method='POST',
query_params=query_params or {}
)
return self.create... |
Get all information for this Label. Returns a dictionary of values. | def get_label_information(self, query_params=None):
'''
Get all information for this Label. Returns a dictionary of values.
'''
return self.fetch_json(
uri_path=self.base_uri,
query_params=query_params or {}
) |
Get all the items for this label. Returns a list of dictionaries. Each dictionary has the values for an item. | def get_items(self, query_params=None):
'''
Get all the items for this label. Returns a list of dictionaries.
Each dictionary has the values for an item.
'''
return self.fetch_json(
uri_path=self.base_uri + '/checkItems',
query_params=query_params or {}
... |
Update the current label s name. Returns a new Label object. | def _update_label_name(self, name):
'''
Update the current label's name. Returns a new Label object.
'''
label_json = self.fetch_json(
uri_path=self.base_uri,
http_method='PUT',
query_params={'name': name}
)
return self.create_label(la... |
Update the current label. Returns a new Label object. | def _update_label_dict(self, query_params={}):
'''
Update the current label. Returns a new Label object.
'''
label_json = self.fetch_json(
uri_path=self.base_uri,
http_method='PUT',
query_params=query_params
)
return self.create_label(... |
Returns a URL that needs to be opened in a browser to retrieve an access token. | def get_authorisation_url(self, application_name, token_expire='1day'):
'''
Returns a URL that needs to be opened in a browser to retrieve an
access token.
'''
query_params = {
'name': application_name,
'expiration': token_expire,
'response_typ... |
Get information for this card. Returns a dictionary of values. | def get_card_information(self, query_params=None):
'''
Get information for this card. Returns a dictionary of values.
'''
return self.fetch_json(
uri_path=self.base_uri,
query_params=query_params or {}
) |
Get board information for this card. Returns a Board object. | def get_board(self, **query_params):
'''
Get board information for this card. Returns a Board object.
Returns:
Board: The board this card is attached to
'''
board_json = self.get_board_json(self.base_uri,
query_params=query_pa... |
Get list information for this card. Returns a List object. | def get_list(self, **query_params):
'''
Get list information for this card. Returns a List object.
Returns:
List: The list this card is attached to
'''
list_json = self.get_list_json(self.base_uri,
query_params=query_params)
... |
Get the checklists for this card. Returns a list of Checklist objects. | def get_checklists(self, **query_params):
'''
Get the checklists for this card. Returns a list of Checklist objects.
Returns:
list(Checklist): The checklists attached to this card
'''
checklists = self.get_checklist_json(self.base_uri,
... |
Adds a comment to this card by the current user. | def add_comment(self, comment_text):
'''
Adds a comment to this card by the current user.
'''
return self.fetch_json(
uri_path=self.base_uri + '/actions/comments',
http_method='POST',
query_params={'text': comment_text}
) |
Adds an attachment to this card. | def add_attachment(self, filename, open_file):
'''
Adds an attachment to this card.
'''
fields = {
'api_key': self.client.api_key,
'token': self.client.user_auth_token
}
content_type, body = self.encode_multipart_formdata(
fields=field... |
Add a checklist to this card. Returns a Checklist object. | def add_checklist(self, query_params=None):
'''
Add a checklist to this card. Returns a Checklist object.
'''
checklist_json = self.fetch_json(
uri_path=self.base_uri + '/checklists',
http_method='POST',
query_params=query_params or {}
)
... |
Add a label to this card from a dictionary. | def _add_label_from_dict(self, query_params=None):
'''
Add a label to this card, from a dictionary.
'''
return self.fetch_json(
uri_path=self.base_uri + '/labels',
http_method='POST',
query_params=query_params or {}
) |
Add an existing label to this card. | def _add_label_from_class(self, label=None):
'''
Add an existing label to this card.
'''
return self.fetch_json(
uri_path=self.base_uri + '/idLabels',
http_method='POST',
query_params={'value': label.id}
) |
Add a member to this card. Returns a list of Member objects. | def add_member(self, member_id):
'''
Add a member to this card. Returns a list of Member objects.
'''
members = self.fetch_json(
uri_path=self.base_uri + '/idMembers',
http_method='POST',
query_params={'value': member_id}
)
members_lis... |
Encodes data to updload a file to Trello. Fields is a dictionary of api_key and token. Filename is the name of the file and file_values is the open ( file ). read () string. | def encode_multipart_formdata(self, fields, filename, file_values):
'''
Encodes data to updload a file to Trello.
Fields is a dictionary of api_key and token. Filename is the name of
the file and file_values is the open(file).read() string.
'''
boundary = '----------Trell... |
Get Information for a member. Returns a dictionary of values. | def get_member_information(self, query_params=None):
'''
Get Information for a member. Returns a dictionary of values.
Returns:
dict
'''
return self.fetch_json(
uri_path=self.base_uri,
query_params=query_params or {}
) |
Get all cards this member is attached to. Return a list of Card objects. | def get_cards(self, **query_params):
'''
Get all cards this member is attached to. Return a list of Card
objects.
Returns:
list(Card): Return all cards this member is attached to
'''
cards = self.get_cards_json(self.base_uri, query_params=query_params)
... |
Get all organisations this member is attached to. Return a list of Organisation objects. | def get_organisations(self, **query_params):
'''
Get all organisations this member is attached to. Return a list of
Organisation objects.
Returns:
list(Organisation): Return all organisations this member is
attached to
'''
organisations = self.get... |
Create a new board. name is required in query_params. Returns a Board object. | def create_new_board(self, query_params=None):
'''
Create a new board. name is required in query_params. Returns a Board
object.
Returns:
Board: Returns the created board
'''
board_json = self.fetch_json(
uri_path='/boards',
http_metho... |
Enable singledispatch for class methods. | def singledispatchmethod(method):
'''
Enable singledispatch for class methods.
See http://stackoverflow.com/a/24602374/274318
'''
dispatcher = singledispatch(method)
def wrapper(*args, **kw):
return dispatcher.dispatch(args[1].__class__)(*args, **kw)
wrapper.register = dispatcher.re... |
Create a ChecklistItem object from JSON object | def create_checklist_item(self, card_id, checklist_id, checklistitem_json, **kwargs):
'''
Create a ChecklistItem object from JSON object
'''
return self.client.create_checklist_item(card_id, checklist_id, checklistitem_json, **kwargs) |
Get all information for this board. Returns a dictionary of values. | def get_board_information(self, query_params=None):
'''
Get all information for this board. Returns a dictionary of values.
'''
return self.fetch_json(
uri_path='/boards/' + self.id,
query_params=query_params or {}
) |
Get the lists attached to this board. Returns a list of List objects. | def get_lists(self, **query_params):
'''
Get the lists attached to this board. Returns a list of List objects.
Returns:
list(List): The lists attached to this board
'''
lists = self.get_lists_json(self.base_uri, query_params=query_params)
lists_list = []
... |
Get the labels attached to this board. Returns a label of Label objects. | def get_labels(self, **query_params):
'''
Get the labels attached to this board. Returns a label of Label
objects.
Returns:
list(Label): The labels attached to this board
'''
labels = self.get_labels_json(self.base_uri, query_params=query_params)
lab... |
Get a Card for a given card id. Returns a Card object. | def get_card(self, card_id, **query_params):
'''
Get a Card for a given card id. Returns a Card object.
Returns:
Card: The card with the given card_id
'''
card_json = self.fetch_json(
uri_path=self.base_uri + '/cards/' + card_id
)
return ... |
Get the checklists for this board. Returns a list of Checklist objects. | def get_checklists( self ):
"""
Get the checklists for this board. Returns a list of Checklist objects.
"""
checklists = self.getChecklistsJson( self.base_uri )
checklists_list = []
for checklist_json in checklists:
checklists_list.append( self.createChecklis... |
Get the Organisation for this board. Returns Organisation object. | def get_organisation(self, **query_params):
'''
Get the Organisation for this board. Returns Organisation object.
Returns:
list(Organisation): The organisation attached to this board
'''
organisation_json = self.get_organisations_json(
self.base_uri, quer... |
Update this board s information. Returns a new board. | def update_board(self, query_params=None):
'''
Update this board's information. Returns a new board.
'''
board_json = self.fetch_json(
uri_path=self.base_uri,
http_method='PUT',
query_params=query_params or {}
)
return self.create_boar... |
Create a list for a board. Returns a new List object. | def add_list(self, query_params=None):
'''
Create a list for a board. Returns a new List object.
'''
list_json = self.fetch_json(
uri_path=self.base_uri + '/lists',
http_method='POST',
query_params=query_params or {}
)
return self.crea... |
Create a label for a board. Returns a new Label object. | def add_label(self, query_params=None):
'''
Create a label for a board. Returns a new Label object.
'''
list_json = self.fetch_json(
uri_path=self.base_uri + '/labels',
http_method='POST',
query_params=query_params or {}
)
return self.... |
Get all information for this Checklist. Returns a dictionary of values. | def get_checklist_information(self, query_params=None):
'''
Get all information for this Checklist. Returns a dictionary of values.
'''
# We don't use trelloobject.TrelloObject.get_checklist_json, because
# that is meant to return lists of checklists.
return self.fetch_js... |
Get card this checklist is on. | def get_card(self):
'''
Get card this checklist is on.
'''
card_id = self.get_checklist_information().get('idCard', None)
if card_id:
return self.client.get_card(card_id) |
Get the items for this checklist. Returns a list of ChecklistItem objects. | def get_item_objects(self, query_params=None):
"""
Get the items for this checklist. Returns a list of ChecklistItem objects.
"""
card = self.get_card()
checklistitems_list = []
for checklistitem_json in self.get_items(query_params):
checklistitems_list.append... |
Update the current checklist. Returns a new Checklist object. | def update_checklist(self, name):
'''
Update the current checklist. Returns a new Checklist object.
'''
checklist_json = self.fetch_json(
uri_path=self.base_uri,
http_method='PUT',
query_params={'name': name}
)
return self.create_check... |
Add an item to this checklist. Returns a dictionary of values of new item. | def add_item(self, query_params=None):
'''
Add an item to this checklist. Returns a dictionary of values of new
item.
'''
return self.fetch_json(
uri_path=self.base_uri + '/checkItems',
http_method='POST',
query_params=query_params or {}
... |
Deletes an item from this checklist. | def remove_item(self, item_id):
'''
Deletes an item from this checklist.
'''
return self.fetch_json(
uri_path=self.base_uri + '/checkItems/' + item_id,
http_method='DELETE'
) |
Rename the current checklist item. Returns a new ChecklistItem object. | def update_name( self, name ):
"""
Rename the current checklist item. Returns a new ChecklistItem object.
"""
checklistitem_json = self.fetch_json(
uri_path = self.base_uri + '/name',
http_method = 'PUT',
query_params = {'value': name}
)
... |
Set the state of the current checklist item. Returns a new ChecklistItem object. | def update_state(self, state):
"""
Set the state of the current checklist item. Returns a new ChecklistItem object.
"""
checklistitem_json = self.fetch_json(
uri_path = self.base_uri + '/state',
http_method = 'PUT',
query_params = {'value': 'complete' ... |
Adds the API key and user auth token to the query parameters | def add_authorisation(self, query_params):
'''
Adds the API key and user auth token to the query parameters
'''
query_params['key'] = self.api_key
if self.user_auth_token:
query_params['token'] = self.user_auth_token
return query_params |
Check HTTP reponse for known errors | def check_errors(self, uri, response):
'''
Check HTTP reponse for known errors
'''
if response.status == 401:
raise trolly.Unauthorised(uri, response)
if response.status != 200:
raise trolly.ResourceUnavailable(uri, response) |
Build the URI for the API call. | def build_uri(self, path, query_params):
'''
Build the URI for the API call.
'''
url = 'https://api.trello.com/1' + self.clean_path(path)
url += '?' + urlencode(query_params)
return url |
Make a call to Trello API and capture JSON response. Raises an error when it fails. | def fetch_json(self, uri_path, http_method='GET', query_params=None,
body=None, headers=None):
'''
Make a call to Trello API and capture JSON response. Raises an error
when it fails.
Returns:
dict: Dictionary with the JSON data
'''
query_pa... |
Create an Organisation object from a JSON object | def create_organisation(self, organisation_json):
'''
Create an Organisation object from a JSON object
Returns:
Organisation: The organisation from the given `organisation_json`.
'''
return trolly.organisation.Organisation(
trello_client=self,
... |
Create Board object from a JSON object | def create_board(self, board_json):
'''
Create Board object from a JSON object
Returns:
Board: The board from the given `board_json`.
'''
return trolly.board.Board(
trello_client=self,
board_id=board_json['id'],
name=board_json['na... |
Create Label object from JSON object | def create_label(self, label_json):
'''
Create Label object from JSON object
Returns:
Label: The label from the given `label_json`.
'''
return trolly.label.Label(
trello_client=self,
label_id=label_json['id'],
name=label_json['name... |
Create List object from JSON object | def create_list(self, list_json):
'''
Create List object from JSON object
Returns:
List: The list from the given `list_json`.
'''
return trolly.list.List(
trello_client=self,
list_id=list_json['id'],
name=list_json['name'],
... |
Create a Card object from JSON object | def create_card(self, card_json):
'''
Create a Card object from JSON object
Returns:
Card: The card from the given `card_json`.
'''
return trolly.card.Card(
trello_client=self,
card_id=card_json['id'],
name=card_json['name'],
... |
Create a Checklist object from JSON object | def create_checklist(self, checklist_json):
'''
Create a Checklist object from JSON object
Returns:
Checklist: The checklist from the given `checklist_json`.
'''
return trolly.checklist.Checklist(
trello_client=self,
checklist_id=checklist_jso... |
Create a ChecklistItem object from JSON object | def create_checklist_item(self, card_id, checklist_id, checklistitem_json):
"""
Create a ChecklistItem object from JSON object
"""
return trolly.checklist.ChecklistItem(
trello_client=self,
card_id=card_id,
checklist_id=checklist_id,
checkl... |
Create a Member object from JSON object | def create_member(self, member_json):
'''
Create a Member object from JSON object
Returns:
Member: The member from the given `member_json`.
'''
return trolly.member.Member(
trello_client=self,
member_id=member_json['id'],
name=memb... |
Get an organisation | def get_organisation(self, id, name=None):
'''
Get an organisation
Returns:
Organisation: The organisation with the given `id`
'''
return self.create_organisation(dict(id=id, name=name)) |
Get a board | def get_board(self, id, name=None):
'''
Get a board
Returns:
Board: The board with the given `id`
'''
return self.create_board(dict(id=id, name=name)) |
Get a list | def get_list(self, id, name=None):
'''
Get a list
Returns:
List: The list with the given `id`
'''
return self.create_list(dict(id=id, name=name)) |
Get a card | def get_card(self, id, name=None):
'''
Get a card
Returns:
Card: The card with the given `id`
'''
return self.create_card(dict(id=id, name=name)) |
Get a checklist | def get_checklist(self, id, name=None):
'''
Get a checklist
Returns:
Checklist: The checklist with the given `id`
'''
return self.create_checklist(dict(id=id, name=name)) |
Get a member or your current member if id wasn t given. | def get_member(self, id='me', name=None):
'''
Get a member or your current member if `id` wasn't given.
Returns:
Member: The member with the given `id`, defaults to the
logged in member.
'''
return self.create_member(dict(id=id, fullName=name)) |
Get root domain from url. Will prune away query strings url paths protocol prefix and sub - domains Exceptions will be raised on invalid urls | def domain_from_url(url):
"""
Get root domain from url.
Will prune away query strings, url paths, protocol prefix and sub-domains
Exceptions will be raised on invalid urls
"""
ext = tldextract.extract(url)
if not ext.suffix:
raise InvalidURLException()
new_url = ext.domain + "." ... |
A generator to convert raw text segments without xml to a list of words without any markup. Additionally dates are replaced by 7777 for normalization. | def to_raw_text_markupless(text, keep_whitespace=False, normalize_ascii=True):
"""
A generator to convert raw text segments, without xml to a
list of words without any markup.
Additionally dates are replaced by `7777` for normalization.
Arguments
---------
text: str, input text to token... |
A generator to convert raw text segments with xml and other non - textual content to a list of words without any markup. Additionally dates are replaced by 7777 for normalization. | def to_raw_text(text, keep_whitespace=False, normalize_ascii=True):
"""
A generator to convert raw text segments, with xml, and other
non-textual content to a list of words without any markup.
Additionally dates are replaced by `7777` for normalization.
Arguments
---------
text: str, inp... |
A generator to convert raw text segments with xml and other non - textual content to a list of words without any markup. Additionally dates are replaced by 7777 for normalization along with wikipedia anchors kept. | def to_raw_text_pairings(text, keep_whitespace=False, normalize_ascii=True):
"""
A generator to convert raw text segments, with xml, and other
non-textual content to a list of words without any markup.
Additionally dates are replaced by `7777` for normalization,
along with wikipedia anchors kept.
... |
Subdivide an input list of strings ( tokens ) into multiple lists according to detected sentence boundaries. | def detect_sentence_boundaries(tokens):
"""
Subdivide an input list of strings (tokens)
into multiple lists according to detected
sentence boundaries.
```
detect_sentence_boundaries(
["Cat ", "sat ", "mat", ". ", "Cat ", "'s ", "named ", "Cool", "."]
)
#=> [
["Cat ", "sa... |
Perform sentence + word tokenization on the input text using regular expressions and english/ french specific rules. | def sent_tokenize(text, keep_whitespace=False, normalize_ascii=True):
"""
Perform sentence + word tokenization on the input text
using regular expressions and english/french specific
rules.
Arguments:
----------
text : str, input string to tokenize
keep_whitespace : bool, whethe... |
Javascript templates ( jquery handlebars. js mustache. js ) use constructs like: | def verbatim_tags(parser, token, endtagname):
"""
Javascript templates (jquery, handlebars.js, mustache.js) use constructs like:
::
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} means something.
The fol... |
Write the password in the file. | def set_password(self, service, username, password):
"""Write the password in the file.
"""
assoc = self._generate_assoc(service, username)
# encrypt the password
password_encrypted = self.encrypt(password.encode('utf-8'), assoc)
# encode with base64 and add line break to... |
Annotate locations in a string that contain periods as being true periods or periods that are a part of shorthand ( and thus should not be treated as punctuation marks ). | def protect_shorthand(text, split_locations):
"""
Annotate locations in a string that contain
periods as being true periods or periods
that are a part of shorthand (and thus should
not be treated as punctuation marks).
Arguments:
----------
text : str
split_locations : list<... |
Use an integer list to split the string contained in text. | def split_with_locations(text, locations):
"""
Use an integer list to split the string
contained in `text`.
Arguments:
----------
text : str, same length as locations.
locations : list<int>, contains values
'SHOULD_SPLIT', 'UNDECIDED', and
'SHOULD_NOT_SPLIT'.... |
Regex that adds a SHOULD_SPLIT marker at the end location of each matching group of the given regex. | def mark_regex(regex, text, split_locations):
"""
Regex that adds a 'SHOULD_SPLIT' marker at the end
location of each matching group of the given regex.
Arguments
---------
regex : re.Expression
text : str, same length as split_locations
split_locations : list<int>, split de... |
Regex that adds a SHOULD_SPLIT marker at the end location of each matching group of the given regex and adds a SHOULD_SPLIT at the beginning of the matching group. Each character within the matching group will be marked as SHOULD_NOT_SPLIT. | def mark_begin_end_regex(regex, text, split_locations):
"""
Regex that adds a 'SHOULD_SPLIT' marker at the end
location of each matching group of the given regex,
and adds a 'SHOULD_SPLIT' at the beginning of the
matching group. Each character within the matching
group will be marked as 'SHOULD_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.