repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
bitesofcode/projexui
projexui/widgets/xchart/axes/xnumberaxis.py
XNumberAxis.calculateValues
def calculateValues(self): """ Overloads the calculate values method to calculate the values for this axis based on the minimum and maximum values, and the number of steps desired. :return [<variant>, ..] """ if self.maximum() <= self.minimum(...
python
def calculateValues(self): """ Overloads the calculate values method to calculate the values for this axis based on the minimum and maximum values, and the number of steps desired. :return [<variant>, ..] """ if self.maximum() <= self.minimum(...
[ "def", "calculateValues", "(", "self", ")", ":", "if", "self", ".", "maximum", "(", ")", "<=", "self", ".", "minimum", "(", ")", ":", "return", "[", "]", "max_labels", "=", "self", ".", "maximumLabelCount", "(", ")", "step", "=", "(", "self", ".", ...
Overloads the calculate values method to calculate the values for this axis based on the minimum and maximum values, and the number of steps desired. :return [<variant>, ..]
[ "Overloads", "the", "calculate", "values", "method", "to", "calculate", "the", "values", "for", "this", "axis", "based", "on", "the", "minimum", "and", "maximum", "values", "and", "the", "number", "of", "steps", "desired", ".", ":", "return", "[", "<variant"...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/axes/xnumberaxis.py#L59-L88
train
Returns a list of values for the most recent values for the given time series.
bitesofcode/projexui
projexui/widgets/xchart/axes/xnumberaxis.py
XNumberAxis.percentAt
def percentAt(self, value): """ Returns the percentage the value represents between the minimum and maximum for this axis. :param value | <int> || <float> :return <float> """ min_val = self.minimum() max_val = self.maxi...
python
def percentAt(self, value): """ Returns the percentage the value represents between the minimum and maximum for this axis. :param value | <int> || <float> :return <float> """ min_val = self.minimum() max_val = self.maxi...
[ "def", "percentAt", "(", "self", ",", "value", ")", ":", "min_val", "=", "self", ".", "minimum", "(", ")", "max_val", "=", "self", ".", "maximum", "(", ")", "if", "value", "<", "min_val", ":", "return", "0.0", "elif", "max_val", "<", "value", ":", ...
Returns the percentage the value represents between the minimum and maximum for this axis. :param value | <int> || <float> :return <float>
[ "Returns", "the", "percentage", "the", "value", "represents", "between", "the", "minimum", "and", "maximum", "for", "this", "axis", ".", ":", "param", "value", "|", "<int", ">", "||", "<float", ">", ":", "return", "<float", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/axes/xnumberaxis.py#L90-L115
train
Returns the percentage of value represents between the minimum and maximum for this axis.
bitesofcode/projexui
projexui/widgets/xchart/axes/xnumberaxis.py
XNumberAxis.percentOfTotal
def percentOfTotal(self, value, values): """ Calculates the percent the inputed value is in relation to the list of other values. :param value | <variant> values | [<variant>, ..] :return <float> 0.0 - 1.0 """ ...
python
def percentOfTotal(self, value, values): """ Calculates the percent the inputed value is in relation to the list of other values. :param value | <variant> values | [<variant>, ..] :return <float> 0.0 - 1.0 """ ...
[ "def", "percentOfTotal", "(", "self", ",", "value", ",", "values", ")", ":", "try", ":", "return", "float", "(", "value", ")", "/", "sum", "(", "values", ")", "except", "(", "ZeroDivisionError", ",", "TypeError", ",", "ValueError", ")", ":", "return", ...
Calculates the percent the inputed value is in relation to the list of other values. :param value | <variant> values | [<variant>, ..] :return <float> 0.0 - 1.0
[ "Calculates", "the", "percent", "the", "inputed", "value", "is", "in", "relation", "to", "the", "list", "of", "other", "values", ".", ":", "param", "value", "|", "<variant", ">", "values", "|", "[", "<variant", ">", "..", "]", ":", "return", "<float", ...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/axes/xnumberaxis.py#L117-L130
train
Returns the percentage of total value in the inputed value.
bitesofcode/projexui
projexui/widgets/xchart/axes/xnumberaxis.py
XNumberAxis.rounded
def rounded(self, number, roundto=None): """ Rounds the inputed number to the nearest value. :param number | <int> || <float> """ if roundto is None: roundto = self.roundTo() if not roundto: return number ...
python
def rounded(self, number, roundto=None): """ Rounds the inputed number to the nearest value. :param number | <int> || <float> """ if roundto is None: roundto = self.roundTo() if not roundto: return number ...
[ "def", "rounded", "(", "self", ",", "number", ",", "roundto", "=", "None", ")", ":", "if", "roundto", "is", "None", ":", "roundto", "=", "self", ".", "roundTo", "(", ")", "if", "not", "roundto", ":", "return", "number", "remain", "=", "number", "%", ...
Rounds the inputed number to the nearest value. :param number | <int> || <float>
[ "Rounds", "the", "inputed", "number", "to", "the", "nearest", "value", ".", ":", "param", "number", "|", "<int", ">", "||", "<float", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/axes/xnumberaxis.py#L132-L147
train
Rounds the inputed number to the nearest value.
bitesofcode/projexui
projexui/widgets/xchart/axes/xnumberaxis.py
XNumberAxis.roundTo
def roundTo(self): """ Returns the number that this should round the default values to. :return <int> """ if self._roundTo is None: min_val = max(self.minimum(), 1) max_val = max(self.maximum(), 1) max_labels = self.maximu...
python
def roundTo(self): """ Returns the number that this should round the default values to. :return <int> """ if self._roundTo is None: min_val = max(self.minimum(), 1) max_val = max(self.maximum(), 1) max_labels = self.maximu...
[ "def", "roundTo", "(", "self", ")", ":", "if", "self", ".", "_roundTo", "is", "None", ":", "min_val", "=", "max", "(", "self", ".", "minimum", "(", ")", ",", "1", ")", "max_val", "=", "max", "(", "self", ".", "maximum", "(", ")", ",", "1", ")",...
Returns the number that this should round the default values to. :return <int>
[ "Returns", "the", "number", "that", "this", "should", "round", "the", "default", "values", "to", ".", ":", "return", "<int", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/axes/xnumberaxis.py#L149-L162
train
Returns the number of times this calendar should be rounded to.
bitesofcode/projexui
projexui/widgets/xchart/axes/xnumberaxis.py
XNumberAxis.valueAt
def valueAt(self, percent): """ Returns the value the percent represents between the minimum and maximum for this axis. :param value | <int> || <float> :return <float> """ min_val = self.minimum() max_val = self.maximum...
python
def valueAt(self, percent): """ Returns the value the percent represents between the minimum and maximum for this axis. :param value | <int> || <float> :return <float> """ min_val = self.minimum() max_val = self.maximum...
[ "def", "valueAt", "(", "self", ",", "percent", ")", ":", "min_val", "=", "self", ".", "minimum", "(", ")", "max_val", "=", "self", ".", "maximum", "(", ")", "# round the max value to sync with the values in the grid\r", "max_val", "=", "self", ".", "rounded", ...
Returns the value the percent represents between the minimum and maximum for this axis. :param value | <int> || <float> :return <float>
[ "Returns", "the", "value", "the", "percent", "represents", "between", "the", "minimum", "and", "maximum", "for", "this", "axis", ".", ":", "param", "value", "|", "<int", ">", "||", "<float", ">", ":", "return", "<float", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/axes/xnumberaxis.py#L180-L195
train
Returns the value at the given percent for this axis.
kimdhamilton/merkle-proofs
merkleproof/hash_functions.py
sha256
def sha256(content): """Finds the sha256 hash of the content.""" if isinstance(content, str): content = content.encode('utf-8') return hashlib.sha256(content).hexdigest()
python
def sha256(content): """Finds the sha256 hash of the content.""" if isinstance(content, str): content = content.encode('utf-8') return hashlib.sha256(content).hexdigest()
[ "def", "sha256", "(", "content", ")", ":", "if", "isinstance", "(", "content", ",", "str", ")", ":", "content", "=", "content", ".", "encode", "(", "'utf-8'", ")", "return", "hashlib", ".", "sha256", "(", "content", ")", ".", "hexdigest", "(", ")" ]
Finds the sha256 hash of the content.
[ "Finds", "the", "sha256", "hash", "of", "the", "content", "." ]
77551cc65f72b50ac203f10a5069cb1a5b3ffb49
https://github.com/kimdhamilton/merkle-proofs/blob/77551cc65f72b50ac203f10a5069cb1a5b3ffb49/merkleproof/hash_functions.py#L9-L13
train
Finds the sha256 hash of the content.
whiteclover/dbpy
db/connection.py
Connection.cursor
def cursor(self, as_dict=False): """Gets the cursor by type , if ``as_dict is ture, make a dict sql connection cursor""" self.ensure_connect() ctype = self.real_ctype(as_dict) return self._connect.cursor(ctype)
python
def cursor(self, as_dict=False): """Gets the cursor by type , if ``as_dict is ture, make a dict sql connection cursor""" self.ensure_connect() ctype = self.real_ctype(as_dict) return self._connect.cursor(ctype)
[ "def", "cursor", "(", "self", ",", "as_dict", "=", "False", ")", ":", "self", ".", "ensure_connect", "(", ")", "ctype", "=", "self", ".", "real_ctype", "(", "as_dict", ")", "return", "self", ".", "_connect", ".", "cursor", "(", "ctype", ")" ]
Gets the cursor by type , if ``as_dict is ture, make a dict sql connection cursor
[ "Gets", "the", "cursor", "by", "type", "if", "as_dict", "is", "ture", "make", "a", "dict", "sql", "connection", "cursor" ]
3d9ce85f55cfb39cced22081e525f79581b26b3a
https://github.com/whiteclover/dbpy/blob/3d9ce85f55cfb39cced22081e525f79581b26b3a/db/connection.py#L57-L61
train
Gets the cursor by type
bitesofcode/projexui
projexui/widgets/xorbpopupbutton.py
XOrbPopupButton.setCentralWidget
def setCentralWidget(self, widget, createsNew=True, autoCommit=True): """ Sets the central widget for this popup button. If createsNew is set to True, then the about to show signal from the popup will be linked to the widget's reset slot. If autoCommit is set to True, then the widg...
python
def setCentralWidget(self, widget, createsNew=True, autoCommit=True): """ Sets the central widget for this popup button. If createsNew is set to True, then the about to show signal from the popup will be linked to the widget's reset slot. If autoCommit is set to True, then the widg...
[ "def", "setCentralWidget", "(", "self", ",", "widget", ",", "createsNew", "=", "True", ",", "autoCommit", "=", "True", ")", ":", "if", "not", "isinstance", "(", "widget", ",", "XOrbRecordWidget", ")", ":", "return", "False", "# assign the widget\r", "super", ...
Sets the central widget for this popup button. If createsNew is set to True, then the about to show signal from the popup will be linked to the widget's reset slot. If autoCommit is set to True, then the widget will commit it's information to the database. :param wid...
[ "Sets", "the", "central", "widget", "for", "this", "popup", "button", ".", "If", "createsNew", "is", "set", "to", "True", "then", "the", "about", "to", "show", "signal", "from", "the", "popup", "will", "be", "linked", "to", "the", "widget", "s", "reset",...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbpopupbutton.py#L30-L68
train
Sets the central widget for this popup button.
bearyinnovative/bearychat.py
bearychat/rtm_client_service.py
RTMCurrentTeam.members
def members(self): """Gets members of current team Returns: list of User Throws: RTMServiceError when request failed """ resp = self._rtm_client.get('v1/current_team.members?all=true') if resp.is_fail(): raise RTMServiceError( ...
python
def members(self): """Gets members of current team Returns: list of User Throws: RTMServiceError when request failed """ resp = self._rtm_client.get('v1/current_team.members?all=true') if resp.is_fail(): raise RTMServiceError( ...
[ "def", "members", "(", "self", ")", ":", "resp", "=", "self", ".", "_rtm_client", ".", "get", "(", "'v1/current_team.members?all=true'", ")", "if", "resp", ".", "is_fail", "(", ")", ":", "raise", "RTMServiceError", "(", "'Failed to get members of current team'", ...
Gets members of current team Returns: list of User Throws: RTMServiceError when request failed
[ "Gets", "members", "of", "current", "team" ]
6c7af2d215c2ff7135bb5af66ca333d0ea1089fd
https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/bearychat/rtm_client_service.py#L33-L48
train
Gets members of current team
bearyinnovative/bearychat.py
bearychat/rtm_client_service.py
RTMCurrentTeam.channels
def channels(self): """Gets channels of current team Returns: list of Channel Throws: RTMServiceError when request failed """ resp = self._rtm_client.get('v1/current_team.channels') if resp.is_fail(): raise RTMServiceError( ...
python
def channels(self): """Gets channels of current team Returns: list of Channel Throws: RTMServiceError when request failed """ resp = self._rtm_client.get('v1/current_team.channels') if resp.is_fail(): raise RTMServiceError( ...
[ "def", "channels", "(", "self", ")", ":", "resp", "=", "self", ".", "_rtm_client", ".", "get", "(", "'v1/current_team.channels'", ")", "if", "resp", ".", "is_fail", "(", ")", ":", "raise", "RTMServiceError", "(", "'Failed to get channels of current team'", ",", ...
Gets channels of current team Returns: list of Channel Throws: RTMServiceError when request failed
[ "Gets", "channels", "of", "current", "team" ]
6c7af2d215c2ff7135bb5af66ca333d0ea1089fd
https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/bearychat/rtm_client_service.py#L50-L65
train
Gets the list of channels of current team
bearyinnovative/bearychat.py
bearychat/rtm_client_service.py
RTMUser.info
def info(self, user_id): """Gets user information by user id Args: user_id(int): the id of user Returns: User Throws: RTMServiceError when request failed """ resp = self._rtm_client.get('v1/user.info?user_id={}'.format(user_id)) ...
python
def info(self, user_id): """Gets user information by user id Args: user_id(int): the id of user Returns: User Throws: RTMServiceError when request failed """ resp = self._rtm_client.get('v1/user.info?user_id={}'.format(user_id)) ...
[ "def", "info", "(", "self", ",", "user_id", ")", ":", "resp", "=", "self", ".", "_rtm_client", ".", "get", "(", "'v1/user.info?user_id={}'", ".", "format", "(", "user_id", ")", ")", "if", "resp", ".", "is_fail", "(", ")", ":", "raise", "RTMServiceError",...
Gets user information by user id Args: user_id(int): the id of user Returns: User Throws: RTMServiceError when request failed
[ "Gets", "user", "information", "by", "user", "id" ]
6c7af2d215c2ff7135bb5af66ca333d0ea1089fd
https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/bearychat/rtm_client_service.py#L69-L85
train
Gets user information by user id
bearyinnovative/bearychat.py
bearychat/rtm_client_service.py
RTMChannel.info
def info(self, channel_id): """Gets channel information by channel id Args: channel_id(int): the id of channel Returns: Channel Throws: RTMServiceError when request failed """ resource = 'v1/channel.info?channel_id={}'.format(channel...
python
def info(self, channel_id): """Gets channel information by channel id Args: channel_id(int): the id of channel Returns: Channel Throws: RTMServiceError when request failed """ resource = 'v1/channel.info?channel_id={}'.format(channel...
[ "def", "info", "(", "self", ",", "channel_id", ")", ":", "resource", "=", "'v1/channel.info?channel_id={}'", ".", "format", "(", "channel_id", ")", "resp", "=", "self", ".", "_rtm_client", ".", "get", "(", "resource", ")", "if", "resp", ".", "is_fail", "("...
Gets channel information by channel id Args: channel_id(int): the id of channel Returns: Channel Throws: RTMServiceError when request failed
[ "Gets", "channel", "information", "by", "channel", "id" ]
6c7af2d215c2ff7135bb5af66ca333d0ea1089fd
https://github.com/bearyinnovative/bearychat.py/blob/6c7af2d215c2ff7135bb5af66ca333d0ea1089fd/bearychat/rtm_client_service.py#L89-L106
train
Gets the channel information by channel id
bitesofcode/projexui
projexui/widgets/xcodeedit/xcodeedit.py
XCodeEdit.setLanguage
def setLanguage(self, language): """ Sets the language for this code. :param language | <str> """ cls = XCodeHighlighter.byName(language) if cls: self._highlighter = cls(self.document())
python
def setLanguage(self, language): """ Sets the language for this code. :param language | <str> """ cls = XCodeHighlighter.byName(language) if cls: self._highlighter = cls(self.document())
[ "def", "setLanguage", "(", "self", ",", "language", ")", ":", "cls", "=", "XCodeHighlighter", ".", "byName", "(", "language", ")", "if", "cls", ":", "self", ".", "_highlighter", "=", "cls", "(", "self", ".", "document", "(", ")", ")" ]
Sets the language for this code. :param language | <str>
[ "Sets", "the", "language", "for", "this", "code", ".", ":", "param", "language", "|", "<str", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xcodeedit/xcodeedit.py#L120-L128
train
Sets the language for this code.
jschaf/ideone-api
ideone/__init__.py
Ideone._transform_to_dict
def _transform_to_dict(result): """ Transform the array from Ideone into a Python dictionary. """ result_dict = {} property_list = result.item for item in property_list: result_dict[item.key[0]] = item.value[0] return result_dict
python
def _transform_to_dict(result): """ Transform the array from Ideone into a Python dictionary. """ result_dict = {} property_list = result.item for item in property_list: result_dict[item.key[0]] = item.value[0] return result_dict
[ "def", "_transform_to_dict", "(", "result", ")", ":", "result_dict", "=", "{", "}", "property_list", "=", "result", ".", "item", "for", "item", "in", "property_list", ":", "result_dict", "[", "item", ".", "key", "[", "0", "]", "]", "=", "item", ".", "v...
Transform the array from Ideone into a Python dictionary.
[ "Transform", "the", "array", "from", "Ideone", "into", "a", "Python", "dictionary", "." ]
2e97767071d5be53c1d435f755b425a6dd8f2514
https://github.com/jschaf/ideone-api/blob/2e97767071d5be53c1d435f755b425a6dd8f2514/ideone/__init__.py#L40-L48
train
Transform the array from Ideone into a Python dictionary.
jschaf/ideone-api
ideone/__init__.py
Ideone._collapse_language_array
def _collapse_language_array(language_array): """ Convert the Ideone language list into a Python dictionary. """ language_dict = {} for language in language_array.item: key = language.key[0] value = language.value[0] language_dict[key] = value ...
python
def _collapse_language_array(language_array): """ Convert the Ideone language list into a Python dictionary. """ language_dict = {} for language in language_array.item: key = language.key[0] value = language.value[0] language_dict[key] = value ...
[ "def", "_collapse_language_array", "(", "language_array", ")", ":", "language_dict", "=", "{", "}", "for", "language", "in", "language_array", ".", "item", ":", "key", "=", "language", ".", "key", "[", "0", "]", "value", "=", "language", ".", "value", "[",...
Convert the Ideone language list into a Python dictionary.
[ "Convert", "the", "Ideone", "language", "list", "into", "a", "Python", "dictionary", "." ]
2e97767071d5be53c1d435f755b425a6dd8f2514
https://github.com/jschaf/ideone-api/blob/2e97767071d5be53c1d435f755b425a6dd8f2514/ideone/__init__.py#L62-L72
train
Convert the Ideone language list into a Python dictionary.
jschaf/ideone-api
ideone/__init__.py
Ideone._translate_language_name
def _translate_language_name(self, language_name): """ Translate a human readable langauge name into its Ideone integer representation. Keyword Arguments ----------------- * langauge_name: a string of the language (e.g. "c++") Returns ------- A...
python
def _translate_language_name(self, language_name): """ Translate a human readable langauge name into its Ideone integer representation. Keyword Arguments ----------------- * langauge_name: a string of the language (e.g. "c++") Returns ------- A...
[ "def", "_translate_language_name", "(", "self", ",", "language_name", ")", ":", "languages", "=", "self", ".", "languages", "(", ")", "language_id", "=", "None", "# Check for exact match first including the whole version", "# string", "for", "ideone_index", ",", "ideone...
Translate a human readable langauge name into its Ideone integer representation. Keyword Arguments ----------------- * langauge_name: a string of the language (e.g. "c++") Returns ------- An integer representation of the language. Notes ----- ...
[ "Translate", "a", "human", "readable", "langauge", "name", "into", "its", "Ideone", "integer", "representation", "." ]
2e97767071d5be53c1d435f755b425a6dd8f2514
https://github.com/jschaf/ideone-api/blob/2e97767071d5be53c1d435f755b425a6dd8f2514/ideone/__init__.py#L74-L137
train
Translate a human readable langauge name into its Ideone language name.
jschaf/ideone-api
ideone/__init__.py
Ideone.create_submission
def create_submission(self, source_code, language_name=None, language_id=None, std_input="", run=True, private=False): """ Create a submission and upload it to Ideone. Keyword Arguments ----------------- * source_code: a string of the programs source c...
python
def create_submission(self, source_code, language_name=None, language_id=None, std_input="", run=True, private=False): """ Create a submission and upload it to Ideone. Keyword Arguments ----------------- * source_code: a string of the programs source c...
[ "def", "create_submission", "(", "self", ",", "source_code", ",", "language_name", "=", "None", ",", "language_id", "=", "None", ",", "std_input", "=", "\"\"", ",", "run", "=", "True", ",", "private", "=", "False", ")", ":", "language_id", "=", "language_i...
Create a submission and upload it to Ideone. Keyword Arguments ----------------- * source_code: a string of the programs source code * language_name: the human readable language string (e.g. 'python') * language_id: the ID of the programming language * std_input: the st...
[ "Create", "a", "submission", "and", "upload", "it", "to", "Ideone", "." ]
2e97767071d5be53c1d435f755b425a6dd8f2514
https://github.com/jschaf/ideone-api/blob/2e97767071d5be53c1d435f755b425a6dd8f2514/ideone/__init__.py#L141-L179
train
Create a submission and upload it to Ideone.
jschaf/ideone-api
ideone/__init__.py
Ideone.submission_status
def submission_status(self, link): """ Given the unique link of a submission, returns its current status. Keyword Arguments ----------------- * link: the unique id string of a submission Returns ------- A dictionary of the error, the result cod...
python
def submission_status(self, link): """ Given the unique link of a submission, returns its current status. Keyword Arguments ----------------- * link: the unique id string of a submission Returns ------- A dictionary of the error, the result cod...
[ "def", "submission_status", "(", "self", ",", "link", ")", ":", "result", "=", "self", ".", "client", ".", "service", ".", "getSubmissionStatus", "(", "self", ".", "user", ",", "self", ".", "password", ",", "link", ")", "result_dict", "=", "Ideone", ".",...
Given the unique link of a submission, returns its current status. Keyword Arguments ----------------- * link: the unique id string of a submission Returns ------- A dictionary of the error, the result code and the status code. Notes -...
[ "Given", "the", "unique", "link", "of", "a", "submission", "returns", "its", "current", "status", "." ]
2e97767071d5be53c1d435f755b425a6dd8f2514
https://github.com/jschaf/ideone-api/blob/2e97767071d5be53c1d435f755b425a6dd8f2514/ideone/__init__.py#L181-L234
train
Returns the status of a submission.
jschaf/ideone-api
ideone/__init__.py
Ideone.submission_details
def submission_details(self, link, with_source=True, with_input=True, with_output=True, with_stderr=True, with_compilation_info=True): """ Return a dictionary of requested details about a submission with the id of link. Keywo...
python
def submission_details(self, link, with_source=True, with_input=True, with_output=True, with_stderr=True, with_compilation_info=True): """ Return a dictionary of requested details about a submission with the id of link. Keywo...
[ "def", "submission_details", "(", "self", ",", "link", ",", "with_source", "=", "True", ",", "with_input", "=", "True", ",", "with_output", "=", "True", ",", "with_stderr", "=", "True", ",", "with_compilation_info", "=", "True", ")", ":", "result", "=", "s...
Return a dictionary of requested details about a submission with the id of link. Keyword Arguments ----------------- * link: the unique string ID of a submission * with_source: should we request the source code * with_input: request the program input * with_outp...
[ "Return", "a", "dictionary", "of", "requested", "details", "about", "a", "submission", "with", "the", "id", "of", "link", "." ]
2e97767071d5be53c1d435f755b425a6dd8f2514
https://github.com/jschaf/ideone-api/blob/2e97767071d5be53c1d435f755b425a6dd8f2514/ideone/__init__.py#L236-L283
train
Get the details about a submission.
jschaf/ideone-api
ideone/__init__.py
Ideone.languages
def languages(self): """ Get a list of supported languages and cache it. Examples -------- >>> ideone_object.languages() {'error': 'OK', 'languages': {1: "C++ (gcc-4.3.4)", 2: "Pascal (gpc) (gpc 20070904)", ... ...
python
def languages(self): """ Get a list of supported languages and cache it. Examples -------- >>> ideone_object.languages() {'error': 'OK', 'languages': {1: "C++ (gcc-4.3.4)", 2: "Pascal (gpc) (gpc 20070904)", ... ...
[ "def", "languages", "(", "self", ")", ":", "if", "self", ".", "_language_dict", "is", "None", ":", "result", "=", "self", ".", "client", ".", "service", ".", "getLanguages", "(", "self", ".", "user", ",", "self", ".", "password", ")", "result_dict", "=...
Get a list of supported languages and cache it. Examples -------- >>> ideone_object.languages() {'error': 'OK', 'languages': {1: "C++ (gcc-4.3.4)", 2: "Pascal (gpc) (gpc 20070904)", ... ... ...
[ "Get", "a", "list", "of", "supported", "languages", "and", "cache", "it", "." ]
2e97767071d5be53c1d435f755b425a6dd8f2514
https://github.com/jschaf/ideone-api/blob/2e97767071d5be53c1d435f755b425a6dd8f2514/ideone/__init__.py#L285-L309
train
Get a list of supported languages and cache it.
dmerejkowsky/replacer
replacer.py
is_binary
def is_binary(filename): """ Returns True if the file is binary """ with open(filename, 'rb') as fp: data = fp.read(1024) if not data: return False if b'\0' in data: return True return False
python
def is_binary(filename): """ Returns True if the file is binary """ with open(filename, 'rb') as fp: data = fp.read(1024) if not data: return False if b'\0' in data: return True return False
[ "def", "is_binary", "(", "filename", ")", ":", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "fp", ":", "data", "=", "fp", ".", "read", "(", "1024", ")", "if", "not", "data", ":", "return", "False", "if", "b'\\0'", "in", "data", ":", "...
Returns True if the file is binary
[ "Returns", "True", "if", "the", "file", "is", "binary" ]
8dc16f297d0ff3a6ee2fa3c0d77789a6859b0f6a
https://github.com/dmerejkowsky/replacer/blob/8dc16f297d0ff3a6ee2fa3c0d77789a6859b0f6a/replacer.py#L55-L65
train
Returns True if the file is binary False otherwise
dmerejkowsky/replacer
replacer.py
walk_files
def walk_files(args, root, directory, action): """ Recusively go do the subdirectories of the directory, calling the action on each file """ for entry in os.listdir(directory): if is_hidden(args, entry): continue if is_excluded_directory(args, entry): continu...
python
def walk_files(args, root, directory, action): """ Recusively go do the subdirectories of the directory, calling the action on each file """ for entry in os.listdir(directory): if is_hidden(args, entry): continue if is_excluded_directory(args, entry): continu...
[ "def", "walk_files", "(", "args", ",", "root", ",", "directory", ",", "action", ")", ":", "for", "entry", "in", "os", ".", "listdir", "(", "directory", ")", ":", "if", "is_hidden", "(", "args", ",", "entry", ")", ":", "continue", "if", "is_excluded_dir...
Recusively go do the subdirectories of the directory, calling the action on each file
[ "Recusively", "go", "do", "the", "subdirectories", "of", "the", "directory", "calling", "the", "action", "on", "each", "file" ]
8dc16f297d0ff3a6ee2fa3c0d77789a6859b0f6a
https://github.com/dmerejkowsky/replacer/blob/8dc16f297d0ff3a6ee2fa3c0d77789a6859b0f6a/replacer.py#L110-L133
train
Recursively walk the directory tree and call the action on each file
dmerejkowsky/replacer
replacer.py
replace_in_file
def replace_in_file(args, in_file, regexp, repl): """ Perfoms re.sub(regexp, repl, line) for each line in in_file """ in_lines = [] try: with open(in_file, "r") as in_fd: in_lines = in_fd.readlines() except (OSError, UnicodeDecodeError) as error: print("Cant open ...
python
def replace_in_file(args, in_file, regexp, repl): """ Perfoms re.sub(regexp, repl, line) for each line in in_file """ in_lines = [] try: with open(in_file, "r") as in_fd: in_lines = in_fd.readlines() except (OSError, UnicodeDecodeError) as error: print("Cant open ...
[ "def", "replace_in_file", "(", "args", ",", "in_file", ",", "regexp", ",", "repl", ")", ":", "in_lines", "=", "[", "]", "try", ":", "with", "open", "(", "in_file", ",", "\"r\"", ")", "as", "in_fd", ":", "in_lines", "=", "in_fd", ".", "readlines", "("...
Perfoms re.sub(regexp, repl, line) for each line in in_file
[ "Perfoms", "re", ".", "sub", "(", "regexp", "repl", "line", ")", "for", "each", "line", "in", "in_file" ]
8dc16f297d0ff3a6ee2fa3c0d77789a6859b0f6a
https://github.com/dmerejkowsky/replacer/blob/8dc16f297d0ff3a6ee2fa3c0d77789a6859b0f6a/replacer.py#L203-L233
train
Replace a regular expression in a file.
dmerejkowsky/replacer
replacer.py
repl_main
def repl_main(args): """ replacer main """ pattern = args.pattern repl = args.replacement regexp = re.compile(pattern) def repl_action(f): return replace_in_file(args, f, regexp, repl) if args.paths: for f in args.paths: repl_action(f) else: root = os.ge...
python
def repl_main(args): """ replacer main """ pattern = args.pattern repl = args.replacement regexp = re.compile(pattern) def repl_action(f): return replace_in_file(args, f, regexp, repl) if args.paths: for f in args.paths: repl_action(f) else: root = os.ge...
[ "def", "repl_main", "(", "args", ")", ":", "pattern", "=", "args", ".", "pattern", "repl", "=", "args", ".", "replacement", "regexp", "=", "re", ".", "compile", "(", "pattern", ")", "def", "repl_action", "(", "f", ")", ":", "return", "replace_in_file", ...
replacer main
[ "replacer", "main" ]
8dc16f297d0ff3a6ee2fa3c0d77789a6859b0f6a
https://github.com/dmerejkowsky/replacer/blob/8dc16f297d0ff3a6ee2fa3c0d77789a6859b0f6a/replacer.py#L236-L250
train
replacer main
dmerejkowsky/replacer
replacer.py
main
def main(args=None): """ manages options when called from command line """ parser = ArgumentParser(usage=__usage__) parser.add_argument("--no-skip-hidden", action="store_false", dest="skip_hidden", help="Do not skip hidden files. " ...
python
def main(args=None): """ manages options when called from command line """ parser = ArgumentParser(usage=__usage__) parser.add_argument("--no-skip-hidden", action="store_false", dest="skip_hidden", help="Do not skip hidden files. " ...
[ "def", "main", "(", "args", "=", "None", ")", ":", "parser", "=", "ArgumentParser", "(", "usage", "=", "__usage__", ")", "parser", ".", "add_argument", "(", "\"--no-skip-hidden\"", ",", "action", "=", "\"store_false\"", ",", "dest", "=", "\"skip_hidden\"", "...
manages options when called from command line
[ "manages", "options", "when", "called", "from", "command", "line" ]
8dc16f297d0ff3a6ee2fa3c0d77789a6859b0f6a
https://github.com/dmerejkowsky/replacer/blob/8dc16f297d0ff3a6ee2fa3c0d77789a6859b0f6a/replacer.py#L253-L300
train
This function is called from command line. It is called by the command line to run the main function.
bitesofcode/projexui
projexui/windows/xdkwindow/xdkitem.py
XdkEntryItem.load
def load( self ): """ Loads this item. """ if self._loaded: return self._loaded = True self.setChildIndicatorPolicy(self.DontShowIndicatorWhenChildless) if not self.isFolder(): return path = s...
python
def load( self ): """ Loads this item. """ if self._loaded: return self._loaded = True self.setChildIndicatorPolicy(self.DontShowIndicatorWhenChildless) if not self.isFolder(): return path = s...
[ "def", "load", "(", "self", ")", ":", "if", "self", ".", "_loaded", ":", "return", "self", ".", "_loaded", "=", "True", "self", ".", "setChildIndicatorPolicy", "(", "self", ".", "DontShowIndicatorWhenChildless", ")", "if", "not", "self", ".", "isFolder", "...
Loads this item.
[ "Loads", "this", "item", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/windows/xdkwindow/xdkitem.py#L122-L156
train
Loads the item from the file system.
bitesofcode/projexui
projexui/windows/xdkwindow/xdkitem.py
XdkEntryItem.titleForFilepath
def titleForFilepath( url ): """ Returns a gui title for this url. :return <str> """ url = nativestring(url) if url in XdkEntryItem.TITLE_MAP: return XdkEntryItem.TITLE_MAP.get(url) url = nativestring(url).replace('...
python
def titleForFilepath( url ): """ Returns a gui title for this url. :return <str> """ url = nativestring(url) if url in XdkEntryItem.TITLE_MAP: return XdkEntryItem.TITLE_MAP.get(url) url = nativestring(url).replace('...
[ "def", "titleForFilepath", "(", "url", ")", ":", "url", "=", "nativestring", "(", "url", ")", "if", "url", "in", "XdkEntryItem", ".", "TITLE_MAP", ":", "return", "XdkEntryItem", ".", "TITLE_MAP", ".", "get", "(", "url", ")", "url", "=", "nativestring", "...
Returns a gui title for this url. :return <str>
[ "Returns", "a", "gui", "title", "for", "this", "url", ".", ":", "return", "<str", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/windows/xdkwindow/xdkitem.py#L204-L230
train
Returns a gui title for the given file path.
bitesofcode/projexui
projexui/windows/xdkwindow/xdkitem.py
XdkItem.indexlist
def indexlist( self ): """ Returns the list of files in alphabetical order for index lookups. :return [(<str> name, <str> url), ..] """ output = [(child.text(0), child.url()) for child in self.children(recursive=True)] out...
python
def indexlist( self ): """ Returns the list of files in alphabetical order for index lookups. :return [(<str> name, <str> url), ..] """ output = [(child.text(0), child.url()) for child in self.children(recursive=True)] out...
[ "def", "indexlist", "(", "self", ")", ":", "output", "=", "[", "(", "child", ".", "text", "(", "0", ")", ",", "child", ".", "url", "(", ")", ")", "for", "child", "in", "self", ".", "children", "(", "recursive", "=", "True", ")", "]", "output", ...
Returns the list of files in alphabetical order for index lookups. :return [(<str> name, <str> url), ..]
[ "Returns", "the", "list", "of", "files", "in", "alphabetical", "order", "for", "index", "lookups", ".", ":", "return", "[", "(", "<str", ">", "name", "<str", ">", "url", ")", "..", "]" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/windows/xdkwindow/xdkitem.py#L299-L309
train
Returns the list of files in alphabetical order for index lookups.
bitesofcode/projexui
projexui/windows/xdkwindow/xdkitem.py
XdkItem.search
def search(self, terms): """ Seraches the documents for the inputed terms. :param terms :return [{'url': <str>, 'title': <str>', 'strength': <int>}] """ # load the search information if not self._searchurls: base = se...
python
def search(self, terms): """ Seraches the documents for the inputed terms. :param terms :return [{'url': <str>, 'title': <str>', 'strength': <int>}] """ # load the search information if not self._searchurls: base = se...
[ "def", "search", "(", "self", ",", "terms", ")", ":", "# load the search information\r", "if", "not", "self", ".", "_searchurls", ":", "base", "=", "self", ".", "tempFilepath", "(", ")", "root_url", "=", "projex", ".", "text", ".", "underscore", "(", "self...
Seraches the documents for the inputed terms. :param terms :return [{'url': <str>, 'title': <str>', 'strength': <int>}]
[ "Seraches", "the", "documents", "for", "the", "inputed", "terms", ".", ":", "param", "terms", ":", "return", "[", "{", "url", ":", "<str", ">", "title", ":", "<str", ">", "strength", ":", "<int", ">", "}", "]" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/windows/xdkwindow/xdkitem.py#L311-L384
train
Returns a list of dicts with the url title and strength of the documents that match the inputed terms.
AgeOfLearning/coeus-unity-python-framework
coeus_unity/assertions.py
assert_transform_exists
def assert_transform_exists(cli, transform_path): """ Asserts that the transform exists. :param cli: :param transform_path: :return: """ result = commands.query_transform_exists(cli, transform_path) assert result is True return result
python
def assert_transform_exists(cli, transform_path): """ Asserts that the transform exists. :param cli: :param transform_path: :return: """ result = commands.query_transform_exists(cli, transform_path) assert result is True return result
[ "def", "assert_transform_exists", "(", "cli", ",", "transform_path", ")", ":", "result", "=", "commands", ".", "query_transform_exists", "(", "cli", ",", "transform_path", ")", "assert", "result", "is", "True", "return", "result" ]
Asserts that the transform exists. :param cli: :param transform_path: :return:
[ "Asserts", "that", "the", "transform", "exists", ".", ":", "param", "cli", ":", ":", "param", "transform_path", ":", ":", "return", ":" ]
cf8ca6800ace1425d917ea2628dbd05ed959fdd7
https://github.com/AgeOfLearning/coeus-unity-python-framework/blob/cf8ca6800ace1425d917ea2628dbd05ed959fdd7/coeus_unity/assertions.py#L9-L18
train
Assert that the transform exists.
AgeOfLearning/coeus-unity-python-framework
coeus_unity/assertions.py
assert_scene_loaded
def assert_scene_loaded(cli, scene_name): """ Asserts that the scene is loaded. :param cli: :param scene_name: :return: """ result = commands.query_scene_loaded(cli, scene_name) assert result is True return result
python
def assert_scene_loaded(cli, scene_name): """ Asserts that the scene is loaded. :param cli: :param scene_name: :return: """ result = commands.query_scene_loaded(cli, scene_name) assert result is True return result
[ "def", "assert_scene_loaded", "(", "cli", ",", "scene_name", ")", ":", "result", "=", "commands", ".", "query_scene_loaded", "(", "cli", ",", "scene_name", ")", "assert", "result", "is", "True", "return", "result" ]
Asserts that the scene is loaded. :param cli: :param scene_name: :return:
[ "Asserts", "that", "the", "scene", "is", "loaded", ".", ":", "param", "cli", ":", ":", "param", "scene_name", ":", ":", "return", ":" ]
cf8ca6800ace1425d917ea2628dbd05ed959fdd7
https://github.com/AgeOfLearning/coeus-unity-python-framework/blob/cf8ca6800ace1425d917ea2628dbd05ed959fdd7/coeus_unity/assertions.py#L21-L30
train
Assert that the scene is loaded.
AgeOfLearning/coeus-unity-python-framework
coeus_unity/assertions.py
assert_await_transform_exists
def assert_await_transform_exists(cli, transform_path, does_exist=DEFAULT_TRANSFORM_EXISTS, timeout_seconds=DEFAULT_TIMEOUT_SECONDS): """ Asserts that we successfully awaited for the transform to exist based on does_exist. If the timeout passes or the expression is_registered != actual state, then it will f...
python
def assert_await_transform_exists(cli, transform_path, does_exist=DEFAULT_TRANSFORM_EXISTS, timeout_seconds=DEFAULT_TIMEOUT_SECONDS): """ Asserts that we successfully awaited for the transform to exist based on does_exist. If the timeout passes or the expression is_registered != actual state, then it will f...
[ "def", "assert_await_transform_exists", "(", "cli", ",", "transform_path", ",", "does_exist", "=", "DEFAULT_TRANSFORM_EXISTS", ",", "timeout_seconds", "=", "DEFAULT_TIMEOUT_SECONDS", ")", ":", "result", "=", "commands", ".", "await_transform_exists", "(", "cli", ",", ...
Asserts that we successfully awaited for the transform to exist based on does_exist. If the timeout passes or the expression is_registered != actual state, then it will fail. :param cli: :param transform_path: :param does_exist: (True | False) the state change we are waiting for. :param timeout_seco...
[ "Asserts", "that", "we", "successfully", "awaited", "for", "the", "transform", "to", "exist", "based", "on", "does_exist", ".", "If", "the", "timeout", "passes", "or", "the", "expression", "is_registered", "!", "=", "actual", "state", "then", "it", "will", "...
cf8ca6800ace1425d917ea2628dbd05ed959fdd7
https://github.com/AgeOfLearning/coeus-unity-python-framework/blob/cf8ca6800ace1425d917ea2628dbd05ed959fdd7/coeus_unity/assertions.py#L33-L45
train
Assert that a transform exists based on does_exist.
AgeOfLearning/coeus-unity-python-framework
coeus_unity/assertions.py
assert_await_any_transforms_exist
def assert_await_any_transforms_exist(cli, transform_paths, does_exist=DEFAULT_TRANSFORM_EXISTS, timeout_seconds=DEFAULT_TIMEOUT_SECONDS): """ Asserts that we successfully awaited for any transforms to exist based on does_exist. If the timeout passes or the expression is_registered != actual state, then it ...
python
def assert_await_any_transforms_exist(cli, transform_paths, does_exist=DEFAULT_TRANSFORM_EXISTS, timeout_seconds=DEFAULT_TIMEOUT_SECONDS): """ Asserts that we successfully awaited for any transforms to exist based on does_exist. If the timeout passes or the expression is_registered != actual state, then it ...
[ "def", "assert_await_any_transforms_exist", "(", "cli", ",", "transform_paths", ",", "does_exist", "=", "DEFAULT_TRANSFORM_EXISTS", ",", "timeout_seconds", "=", "DEFAULT_TIMEOUT_SECONDS", ")", ":", "result", "=", "commands", ".", "await_any_transforms_exist", "(", "cli", ...
Asserts that we successfully awaited for any transforms to exist based on does_exist. If the timeout passes or the expression is_registered != actual state, then it will fail. :param cli: :param transform_paths: :param does_exist: (True | False) the state change we are waiting for. :param timeout_se...
[ "Asserts", "that", "we", "successfully", "awaited", "for", "any", "transforms", "to", "exist", "based", "on", "does_exist", ".", "If", "the", "timeout", "passes", "or", "the", "expression", "is_registered", "!", "=", "actual", "state", "then", "it", "will", ...
cf8ca6800ace1425d917ea2628dbd05ed959fdd7
https://github.com/AgeOfLearning/coeus-unity-python-framework/blob/cf8ca6800ace1425d917ea2628dbd05ed959fdd7/coeus_unity/assertions.py#L48-L60
train
Assert that there are any transforms that exist based on does_exist.
AgeOfLearning/coeus-unity-python-framework
coeus_unity/assertions.py
assert_await_all_transforms_exist
def assert_await_all_transforms_exist(cli, transform_paths, does_exist=DEFAULT_TRANSFORM_EXISTS, timeout_seconds=DEFAULT_TIMEOUT_SECONDS): """ Asserts that we successfully awaited for all transforms to exist based on does_exist. If the timeout passes or the expression is_registered != actual state, then it ...
python
def assert_await_all_transforms_exist(cli, transform_paths, does_exist=DEFAULT_TRANSFORM_EXISTS, timeout_seconds=DEFAULT_TIMEOUT_SECONDS): """ Asserts that we successfully awaited for all transforms to exist based on does_exist. If the timeout passes or the expression is_registered != actual state, then it ...
[ "def", "assert_await_all_transforms_exist", "(", "cli", ",", "transform_paths", ",", "does_exist", "=", "DEFAULT_TRANSFORM_EXISTS", ",", "timeout_seconds", "=", "DEFAULT_TIMEOUT_SECONDS", ")", ":", "result", "=", "commands", ".", "await_all_transforms_exist", "(", "cli", ...
Asserts that we successfully awaited for all transforms to exist based on does_exist. If the timeout passes or the expression is_registered != actual state, then it will fail. :param cli: :param transform_paths: :param does_exist: (True | False) the state change we are waiting for. :param timeout_se...
[ "Asserts", "that", "we", "successfully", "awaited", "for", "all", "transforms", "to", "exist", "based", "on", "does_exist", ".", "If", "the", "timeout", "passes", "or", "the", "expression", "is_registered", "!", "=", "actual", "state", "then", "it", "will", ...
cf8ca6800ace1425d917ea2628dbd05ed959fdd7
https://github.com/AgeOfLearning/coeus-unity-python-framework/blob/cf8ca6800ace1425d917ea2628dbd05ed959fdd7/coeus_unity/assertions.py#L63-L75
train
Assert that all transform paths exist based on does_exist.
AgeOfLearning/coeus-unity-python-framework
coeus_unity/assertions.py
assert_await_renderer_visible
def assert_await_renderer_visible(cli, transform_path, is_visible=DEFAULT_RENDERER_VISIBLE, timeout_seconds=DEFAULT_TIMEOUT_SECONDS): """ Asserts that we successfully awaited for the renderer to be visible based on is_visible. If the timeout passes or the expression is_registered != actual state, then it wi...
python
def assert_await_renderer_visible(cli, transform_path, is_visible=DEFAULT_RENDERER_VISIBLE, timeout_seconds=DEFAULT_TIMEOUT_SECONDS): """ Asserts that we successfully awaited for the renderer to be visible based on is_visible. If the timeout passes or the expression is_registered != actual state, then it wi...
[ "def", "assert_await_renderer_visible", "(", "cli", ",", "transform_path", ",", "is_visible", "=", "DEFAULT_RENDERER_VISIBLE", ",", "timeout_seconds", "=", "DEFAULT_TIMEOUT_SECONDS", ")", ":", "result", "=", "commands", ".", "await_renderer_visible", "(", "cli", ",", ...
Asserts that we successfully awaited for the renderer to be visible based on is_visible. If the timeout passes or the expression is_registered != actual state, then it will fail. :param cli: :param transform_path: :param is_visible: (True | False) the state change we are waiting for. :param timeout_...
[ "Asserts", "that", "we", "successfully", "awaited", "for", "the", "renderer", "to", "be", "visible", "based", "on", "is_visible", ".", "If", "the", "timeout", "passes", "or", "the", "expression", "is_registered", "!", "=", "actual", "state", "then", "it", "w...
cf8ca6800ace1425d917ea2628dbd05ed959fdd7
https://github.com/AgeOfLearning/coeus-unity-python-framework/blob/cf8ca6800ace1425d917ea2628dbd05ed959fdd7/coeus_unity/assertions.py#L78-L90
train
Assert that the renderer is visible based on is_visible.
AgeOfLearning/coeus-unity-python-framework
coeus_unity/assertions.py
assert_await_scene_loaded
def assert_await_scene_loaded(cli, scene_name, is_loaded=DEFAULT_SCENE_LOADED, timeout_seconds=DEFAULT_TIMEOUT_SECONDS): """ Asserts that we successfully awaited for the scene to be loaded based on is_loaded. If the timeout passes or the expression is_registered != actual state, then it will fail. :para...
python
def assert_await_scene_loaded(cli, scene_name, is_loaded=DEFAULT_SCENE_LOADED, timeout_seconds=DEFAULT_TIMEOUT_SECONDS): """ Asserts that we successfully awaited for the scene to be loaded based on is_loaded. If the timeout passes or the expression is_registered != actual state, then it will fail. :para...
[ "def", "assert_await_scene_loaded", "(", "cli", ",", "scene_name", ",", "is_loaded", "=", "DEFAULT_SCENE_LOADED", ",", "timeout_seconds", "=", "DEFAULT_TIMEOUT_SECONDS", ")", ":", "result", "=", "commands", ".", "await_scene_loaded", "(", "cli", ",", "scene_name", "...
Asserts that we successfully awaited for the scene to be loaded based on is_loaded. If the timeout passes or the expression is_registered != actual state, then it will fail. :param cli: :param scene_name: :param is_loaded: (True | False) the state change we are waiting for. :param timeout_seconds: T...
[ "Asserts", "that", "we", "successfully", "awaited", "for", "the", "scene", "to", "be", "loaded", "based", "on", "is_loaded", ".", "If", "the", "timeout", "passes", "or", "the", "expression", "is_registered", "!", "=", "actual", "state", "then", "it", "will",...
cf8ca6800ace1425d917ea2628dbd05ed959fdd7
https://github.com/AgeOfLearning/coeus-unity-python-framework/blob/cf8ca6800ace1425d917ea2628dbd05ed959fdd7/coeus_unity/assertions.py#L93-L105
train
Assert that a scene is loaded based on is_loaded.
stephenmcd/sphinx-me
sphinx_me.py
install
def install(): """ Main entry point for running sphinx_me as a script. Creates a docs directory in the current directory and adds the required files for generating Sphinx docs from the project's README file - a conf module that calls setup_conf() from this module, and an index file that includes...
python
def install(): """ Main entry point for running sphinx_me as a script. Creates a docs directory in the current directory and adds the required files for generating Sphinx docs from the project's README file - a conf module that calls setup_conf() from this module, and an index file that includes...
[ "def", "install", "(", ")", ":", "for", "name", "in", "listdir", "(", "getcwd", "(", ")", ")", ":", "if", "splitext", "(", "name", ")", "[", "0", "]", ".", "upper", "(", ")", "==", "\"README\"", ":", "readme", "=", "name", "break", "else", ":", ...
Main entry point for running sphinx_me as a script. Creates a docs directory in the current directory and adds the required files for generating Sphinx docs from the project's README file - a conf module that calls setup_conf() from this module, and an index file that includes the project's README.
[ "Main", "entry", "point", "for", "running", "sphinx_me", "as", "a", "script", ".", "Creates", "a", "docs", "directory", "in", "the", "current", "directory", "and", "adds", "the", "required", "files", "for", "generating", "Sphinx", "docs", "from", "the", "pro...
9f51a04d58a90834a787246ce475a564b4f9e5ee
https://github.com/stephenmcd/sphinx-me/blob/9f51a04d58a90834a787246ce475a564b4f9e5ee/sphinx_me.py#L21-L57
train
Installs the Sphinx docs and index. rst files for the project.
stephenmcd/sphinx-me
sphinx_me.py
get_version
def get_version(module): """ Attempts to read a version attribute from the given module that could be specified via several different names and formats. """ version_names = ["__version__", "get_version", "version"] version_names.extend([name.upper() for name in version_names]) for name in ve...
python
def get_version(module): """ Attempts to read a version attribute from the given module that could be specified via several different names and formats. """ version_names = ["__version__", "get_version", "version"] version_names.extend([name.upper() for name in version_names]) for name in ve...
[ "def", "get_version", "(", "module", ")", ":", "version_names", "=", "[", "\"__version__\"", ",", "\"get_version\"", ",", "\"version\"", "]", "version_names", ".", "extend", "(", "[", "name", ".", "upper", "(", ")", "for", "name", "in", "version_names", "]",...
Attempts to read a version attribute from the given module that could be specified via several different names and formats.
[ "Attempts", "to", "read", "a", "version", "attribute", "from", "the", "given", "module", "that", "could", "be", "specified", "via", "several", "different", "names", "and", "formats", "." ]
9f51a04d58a90834a787246ce475a564b4f9e5ee
https://github.com/stephenmcd/sphinx-me/blob/9f51a04d58a90834a787246ce475a564b4f9e5ee/sphinx_me.py#L66-L84
train
Reads the version attribute from the given module that is a sequence of strings.
stephenmcd/sphinx-me
sphinx_me.py
get_setup_attribute
def get_setup_attribute(attribute, setup_path): """ Runs the project's setup.py script in a process with an arg that will print out the value for a particular attribute such as author or version, and returns the value. """ args = ["python", setup_path, "--%s" % attribute] return Popen(args, ...
python
def get_setup_attribute(attribute, setup_path): """ Runs the project's setup.py script in a process with an arg that will print out the value for a particular attribute such as author or version, and returns the value. """ args = ["python", setup_path, "--%s" % attribute] return Popen(args, ...
[ "def", "get_setup_attribute", "(", "attribute", ",", "setup_path", ")", ":", "args", "=", "[", "\"python\"", ",", "setup_path", ",", "\"--%s\"", "%", "attribute", "]", "return", "Popen", "(", "args", ",", "stdout", "=", "PIPE", ")", ".", "communicate", "("...
Runs the project's setup.py script in a process with an arg that will print out the value for a particular attribute such as author or version, and returns the value.
[ "Runs", "the", "project", "s", "setup", ".", "py", "script", "in", "a", "process", "with", "an", "arg", "that", "will", "print", "out", "the", "value", "for", "a", "particular", "attribute", "such", "as", "author", "or", "version", "and", "returns", "the...
9f51a04d58a90834a787246ce475a564b4f9e5ee
https://github.com/stephenmcd/sphinx-me/blob/9f51a04d58a90834a787246ce475a564b4f9e5ee/sphinx_me.py#L87-L94
train
Runs the setup. py script to get the value for a particular attribute.
stephenmcd/sphinx-me
sphinx_me.py
setup_conf
def setup_conf(conf_globals): """ Setup function that is called from within the project's docs/conf.py module that takes the conf module's globals() and assigns the values that can be automatically determined from the current project, such as project name, package name, version and author. "...
python
def setup_conf(conf_globals): """ Setup function that is called from within the project's docs/conf.py module that takes the conf module's globals() and assigns the values that can be automatically determined from the current project, such as project name, package name, version and author. "...
[ "def", "setup_conf", "(", "conf_globals", ")", ":", "project_path", "=", "abspath", "(", "join", "(", "dirname", "(", "conf_globals", "[", "\"__file__\"", "]", ")", ",", "\"..\"", ")", ")", "chdir", "(", "project_path", ")", "sys", ".", "path", ".", "ins...
Setup function that is called from within the project's docs/conf.py module that takes the conf module's globals() and assigns the values that can be automatically determined from the current project, such as project name, package name, version and author.
[ "Setup", "function", "that", "is", "called", "from", "within", "the", "project", "s", "docs", "/", "conf", ".", "py", "module", "that", "takes", "the", "conf", "module", "s", "globals", "()", "and", "assigns", "the", "values", "that", "can", "be", "autom...
9f51a04d58a90834a787246ce475a564b4f9e5ee
https://github.com/stephenmcd/sphinx-me/blob/9f51a04d58a90834a787246ce475a564b4f9e5ee/sphinx_me.py#L97-L177
train
Setup function that is called from within the project s conf. py module that takes the conf module s globals and assigns the values that can be automatically determined from the project s version and author.
chaoss/grimoirelab-perceval-puppet
perceval/backends/puppet/puppetforge.py
PuppetForge.fetch_items
def fetch_items(self, category, **kwargs): """Fetch the modules :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items """ from_date = kwargs['from_date'] logger.info("Fetching modules from %s", str(from_...
python
def fetch_items(self, category, **kwargs): """Fetch the modules :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items """ from_date = kwargs['from_date'] logger.info("Fetching modules from %s", str(from_...
[ "def", "fetch_items", "(", "self", ",", "category", ",", "*", "*", "kwargs", ")", ":", "from_date", "=", "kwargs", "[", "'from_date'", "]", "logger", ".", "info", "(", "\"Fetching modules from %s\"", ",", "str", "(", "from_date", ")", ")", "from_date_ts", ...
Fetch the modules :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items
[ "Fetch", "the", "modules" ]
4b215df2e8045ce3d6538e532e8b5c660ebed7ea
https://github.com/chaoss/grimoirelab-perceval-puppet/blob/4b215df2e8045ce3d6538e532e8b5c660ebed7ea/perceval/backends/puppet/puppetforge.py#L91-L134
train
Fetch the items from the backend
chaoss/grimoirelab-perceval-puppet
perceval/backends/puppet/puppetforge.py
PuppetForge.parse_json
def parse_json(raw_json): """Parse a Puppet forge JSON stream. The method parses a JSON stream and returns a list with the parsed data. :param raw_json: JSON string to parse :returns: a list with the parsed data """ result = json.loads(raw_json) if 're...
python
def parse_json(raw_json): """Parse a Puppet forge JSON stream. The method parses a JSON stream and returns a list with the parsed data. :param raw_json: JSON string to parse :returns: a list with the parsed data """ result = json.loads(raw_json) if 're...
[ "def", "parse_json", "(", "raw_json", ")", ":", "result", "=", "json", ".", "loads", "(", "raw_json", ")", "if", "'results'", "in", "result", ":", "result", "=", "result", "[", "'results'", "]", "return", "result" ]
Parse a Puppet forge JSON stream. The method parses a JSON stream and returns a list with the parsed data. :param raw_json: JSON string to parse :returns: a list with the parsed data
[ "Parse", "a", "Puppet", "forge", "JSON", "stream", "." ]
4b215df2e8045ce3d6538e532e8b5c660ebed7ea
https://github.com/chaoss/grimoirelab-perceval-puppet/blob/4b215df2e8045ce3d6538e532e8b5c660ebed7ea/perceval/backends/puppet/puppetforge.py#L185-L200
train
Parse a Puppet forge JSON stream and return a list with the parsed data.
chaoss/grimoirelab-perceval-puppet
perceval/backends/puppet/puppetforge.py
PuppetForge._init_client
def _init_client(self, from_archive=False): """Init client""" return PuppetForgeClient(PUPPET_FORGE_URL, self.max_items, self.archive, from_archive)
python
def _init_client(self, from_archive=False): """Init client""" return PuppetForgeClient(PUPPET_FORGE_URL, self.max_items, self.archive, from_archive)
[ "def", "_init_client", "(", "self", ",", "from_archive", "=", "False", ")", ":", "return", "PuppetForgeClient", "(", "PUPPET_FORGE_URL", ",", "self", ".", "max_items", ",", "self", ".", "archive", ",", "from_archive", ")" ]
Init client
[ "Init", "client" ]
4b215df2e8045ce3d6538e532e8b5c660ebed7ea
https://github.com/chaoss/grimoirelab-perceval-puppet/blob/4b215df2e8045ce3d6538e532e8b5c660ebed7ea/perceval/backends/puppet/puppetforge.py#L202-L205
train
Initialize the client.
chaoss/grimoirelab-perceval-puppet
perceval/backends/puppet/puppetforge.py
PuppetForgeClient.modules
def modules(self): """Fetch modules pages.""" resource = self.RMODULES params = { self.PLIMIT: self.max_items, self.PSORT_BY: self.VLATEST_RELEASE } for page in self._fetch(resource, params): yield page
python
def modules(self): """Fetch modules pages.""" resource = self.RMODULES params = { self.PLIMIT: self.max_items, self.PSORT_BY: self.VLATEST_RELEASE } for page in self._fetch(resource, params): yield page
[ "def", "modules", "(", "self", ")", ":", "resource", "=", "self", ".", "RMODULES", "params", "=", "{", "self", ".", "PLIMIT", ":", "self", ".", "max_items", ",", "self", ".", "PSORT_BY", ":", "self", ".", "VLATEST_RELEASE", "}", "for", "page", "in", ...
Fetch modules pages.
[ "Fetch", "modules", "pages", "." ]
4b215df2e8045ce3d6538e532e8b5c660ebed7ea
https://github.com/chaoss/grimoirelab-perceval-puppet/blob/4b215df2e8045ce3d6538e532e8b5c660ebed7ea/perceval/backends/puppet/puppetforge.py#L264-L275
train
Fetch modules pages.
chaoss/grimoirelab-perceval-puppet
perceval/backends/puppet/puppetforge.py
PuppetForgeClient.releases
def releases(self, owner, module): """Fetch the releases of a module.""" resource = self.RRELEASES params = { self.PMODULE: owner + '-' + module, self.PLIMIT: self.max_items, self.PSHOW_DELETED: 'true', self.PSORT_BY: self.VRELEASE_DATE, ...
python
def releases(self, owner, module): """Fetch the releases of a module.""" resource = self.RRELEASES params = { self.PMODULE: owner + '-' + module, self.PLIMIT: self.max_items, self.PSHOW_DELETED: 'true', self.PSORT_BY: self.VRELEASE_DATE, ...
[ "def", "releases", "(", "self", ",", "owner", ",", "module", ")", ":", "resource", "=", "self", ".", "RRELEASES", "params", "=", "{", "self", ".", "PMODULE", ":", "owner", "+", "'-'", "+", "module", ",", "self", ".", "PLIMIT", ":", "self", ".", "ma...
Fetch the releases of a module.
[ "Fetch", "the", "releases", "of", "a", "module", "." ]
4b215df2e8045ce3d6538e532e8b5c660ebed7ea
https://github.com/chaoss/grimoirelab-perceval-puppet/blob/4b215df2e8045ce3d6538e532e8b5c660ebed7ea/perceval/backends/puppet/puppetforge.py#L277-L290
train
Fetch the releases of a module.
chaoss/grimoirelab-perceval-puppet
perceval/backends/puppet/puppetforge.py
PuppetForgeClient.user
def user(self, user): """Fetch user data.""" resource = self.RUSER + '/' + user params = {} result = [page for page in self._fetch(resource, params)] return result[0]
python
def user(self, user): """Fetch user data.""" resource = self.RUSER + '/' + user params = {} result = [page for page in self._fetch(resource, params)] return result[0]
[ "def", "user", "(", "self", ",", "user", ")", ":", "resource", "=", "self", ".", "RUSER", "+", "'/'", "+", "user", "params", "=", "{", "}", "result", "=", "[", "page", "for", "page", "in", "self", ".", "_fetch", "(", "resource", ",", "params", ")...
Fetch user data.
[ "Fetch", "user", "data", "." ]
4b215df2e8045ce3d6538e532e8b5c660ebed7ea
https://github.com/chaoss/grimoirelab-perceval-puppet/blob/4b215df2e8045ce3d6538e532e8b5c660ebed7ea/perceval/backends/puppet/puppetforge.py#L292-L300
train
Fetch user data.
chaoss/grimoirelab-perceval-puppet
perceval/backends/puppet/puppetforge.py
PuppetForgeClient._fetch
def _fetch(self, resource, params): """Fetch a resource. Method to fetch and to iterate over the contents of a type of resource. The method returns a generator of pages for that resource and parameters. :param resource: type of the resource :param params: parameters to ...
python
def _fetch(self, resource, params): """Fetch a resource. Method to fetch and to iterate over the contents of a type of resource. The method returns a generator of pages for that resource and parameters. :param resource: type of the resource :param params: parameters to ...
[ "def", "_fetch", "(", "self", ",", "resource", ",", "params", ")", ":", "url", "=", "urijoin", "(", "self", ".", "base_url", ",", "'v3'", ",", "resource", ")", "do_fetch", "=", "True", "while", "do_fetch", ":", "logger", ".", "debug", "(", "\"Puppet fo...
Fetch a resource. Method to fetch and to iterate over the contents of a type of resource. The method returns a generator of pages for that resource and parameters. :param resource: type of the resource :param params: parameters to filter :returns: a generator of pages ...
[ "Fetch", "a", "resource", "." ]
4b215df2e8045ce3d6538e532e8b5c660ebed7ea
https://github.com/chaoss/grimoirelab-perceval-puppet/blob/4b215df2e8045ce3d6538e532e8b5c660ebed7ea/perceval/backends/puppet/puppetforge.py#L302-L337
train
Fetch a resource. A resource. A resource is returned and the parameters are included in the URL.
kimdhamilton/merkle-proofs
merkleproof/MerkleTree.py
MerkleTree.reset_tree
def reset_tree(self): """ Resets the current tree to empty. """ self.tree = {} self.tree['leaves'] = [] self.tree['levels'] = [] self.tree['is_ready'] = False
python
def reset_tree(self): """ Resets the current tree to empty. """ self.tree = {} self.tree['leaves'] = [] self.tree['levels'] = [] self.tree['is_ready'] = False
[ "def", "reset_tree", "(", "self", ")", ":", "self", ".", "tree", "=", "{", "}", "self", ".", "tree", "[", "'leaves'", "]", "=", "[", "]", "self", ".", "tree", "[", "'levels'", "]", "=", "[", "]", "self", ".", "tree", "[", "'is_ready'", "]", "="...
Resets the current tree to empty.
[ "Resets", "the", "current", "tree", "to", "empty", "." ]
77551cc65f72b50ac203f10a5069cb1a5b3ffb49
https://github.com/kimdhamilton/merkle-proofs/blob/77551cc65f72b50ac203f10a5069cb1a5b3ffb49/merkleproof/MerkleTree.py#L25-L32
train
Resets the current tree to empty.
kimdhamilton/merkle-proofs
merkleproof/MerkleTree.py
MerkleTree.add_leaf
def add_leaf(self, value, do_hash=False): """ Add a leaf to the tree. :param value: hash value (as a Buffer) or hex string :param do_hash: whether to hash value """ self.tree['is_ready'] = False self._add_leaf(value, do_hash)
python
def add_leaf(self, value, do_hash=False): """ Add a leaf to the tree. :param value: hash value (as a Buffer) or hex string :param do_hash: whether to hash value """ self.tree['is_ready'] = False self._add_leaf(value, do_hash)
[ "def", "add_leaf", "(", "self", ",", "value", ",", "do_hash", "=", "False", ")", ":", "self", ".", "tree", "[", "'is_ready'", "]", "=", "False", "self", ".", "_add_leaf", "(", "value", ",", "do_hash", ")" ]
Add a leaf to the tree. :param value: hash value (as a Buffer) or hex string :param do_hash: whether to hash value
[ "Add", "a", "leaf", "to", "the", "tree", ".", ":", "param", "value", ":", "hash", "value", "(", "as", "a", "Buffer", ")", "or", "hex", "string", ":", "param", "do_hash", ":", "whether", "to", "hash", "value" ]
77551cc65f72b50ac203f10a5069cb1a5b3ffb49
https://github.com/kimdhamilton/merkle-proofs/blob/77551cc65f72b50ac203f10a5069cb1a5b3ffb49/merkleproof/MerkleTree.py#L34-L41
train
Add a leaf to the tree.
kimdhamilton/merkle-proofs
merkleproof/MerkleTree.py
MerkleTree.add_leaves
def add_leaves(self, values_array, do_hash=False): """ Add leaves to the tree. Similar to chainpoint merkle tree library, this accepts hash values as an array of Buffers or hex strings. :param values_array: array of values to add :param do_hash: whether to hash the values before...
python
def add_leaves(self, values_array, do_hash=False): """ Add leaves to the tree. Similar to chainpoint merkle tree library, this accepts hash values as an array of Buffers or hex strings. :param values_array: array of values to add :param do_hash: whether to hash the values before...
[ "def", "add_leaves", "(", "self", ",", "values_array", ",", "do_hash", "=", "False", ")", ":", "self", ".", "tree", "[", "'is_ready'", "]", "=", "False", "[", "self", ".", "_add_leaf", "(", "value", ",", "do_hash", ")", "for", "value", "in", "values_ar...
Add leaves to the tree. Similar to chainpoint merkle tree library, this accepts hash values as an array of Buffers or hex strings. :param values_array: array of values to add :param do_hash: whether to hash the values before inserting
[ "Add", "leaves", "to", "the", "tree", "." ]
77551cc65f72b50ac203f10a5069cb1a5b3ffb49
https://github.com/kimdhamilton/merkle-proofs/blob/77551cc65f72b50ac203f10a5069cb1a5b3ffb49/merkleproof/MerkleTree.py#L43-L52
train
Adds leaves to the tree.
kimdhamilton/merkle-proofs
merkleproof/MerkleTree.py
MerkleTree.get_leaf
def get_leaf(self, index): """ Returns a leaf at the given index. :param index: :return: leaf (value) at index """ leaf_level_index = len(self.tree['levels']) - 1 if index < 0 or index > len(self.tree['levels'][leaf_level_index]) - 1: # index is out of...
python
def get_leaf(self, index): """ Returns a leaf at the given index. :param index: :return: leaf (value) at index """ leaf_level_index = len(self.tree['levels']) - 1 if index < 0 or index > len(self.tree['levels'][leaf_level_index]) - 1: # index is out of...
[ "def", "get_leaf", "(", "self", ",", "index", ")", ":", "leaf_level_index", "=", "len", "(", "self", ".", "tree", "[", "'levels'", "]", ")", "-", "1", "if", "index", "<", "0", "or", "index", ">", "len", "(", "self", ".", "tree", "[", "'levels'", ...
Returns a leaf at the given index. :param index: :return: leaf (value) at index
[ "Returns", "a", "leaf", "at", "the", "given", "index", ".", ":", "param", "index", ":", ":", "return", ":", "leaf", "(", "value", ")", "at", "index" ]
77551cc65f72b50ac203f10a5069cb1a5b3ffb49
https://github.com/kimdhamilton/merkle-proofs/blob/77551cc65f72b50ac203f10a5069cb1a5b3ffb49/merkleproof/MerkleTree.py#L54-L64
train
Returns a leaf at the given index.
kimdhamilton/merkle-proofs
merkleproof/MerkleTree.py
MerkleTree.make_tree
def make_tree(self): """ Generates the merkle tree. """ self.tree['is_ready'] = False leaf_count = len(self.tree['leaves']) if leaf_count > 0: # skip this whole process if there are no leaves added to the tree self._unshift(self.tree['levels'], sel...
python
def make_tree(self): """ Generates the merkle tree. """ self.tree['is_ready'] = False leaf_count = len(self.tree['leaves']) if leaf_count > 0: # skip this whole process if there are no leaves added to the tree self._unshift(self.tree['levels'], sel...
[ "def", "make_tree", "(", "self", ")", ":", "self", ".", "tree", "[", "'is_ready'", "]", "=", "False", "leaf_count", "=", "len", "(", "self", ".", "tree", "[", "'leaves'", "]", ")", "if", "leaf_count", ">", "0", ":", "# skip this whole process if there are ...
Generates the merkle tree.
[ "Generates", "the", "merkle", "tree", "." ]
77551cc65f72b50ac203f10a5069cb1a5b3ffb49
https://github.com/kimdhamilton/merkle-proofs/blob/77551cc65f72b50ac203f10a5069cb1a5b3ffb49/merkleproof/MerkleTree.py#L80-L91
train
Generates the merkle tree.
kimdhamilton/merkle-proofs
merkleproof/MerkleTree.py
MerkleTree.get_proof
def get_proof(self, index): """ Returns the proof for a leaf at the given index as an array of merkle siblings in hex format :param index: :return: """ if not self.tree['is_ready']: return None current_row_index = len(self.tree['levels']) - 1 ...
python
def get_proof(self, index): """ Returns the proof for a leaf at the given index as an array of merkle siblings in hex format :param index: :return: """ if not self.tree['is_ready']: return None current_row_index = len(self.tree['levels']) - 1 ...
[ "def", "get_proof", "(", "self", ",", "index", ")", ":", "if", "not", "self", ".", "tree", "[", "'is_ready'", "]", ":", "return", "None", "current_row_index", "=", "len", "(", "self", ".", "tree", "[", "'levels'", "]", ")", "-", "1", "if", "index", ...
Returns the proof for a leaf at the given index as an array of merkle siblings in hex format :param index: :return:
[ "Returns", "the", "proof", "for", "a", "leaf", "at", "the", "given", "index", "as", "an", "array", "of", "merkle", "siblings", "in", "hex", "format", ":", "param", "index", ":", ":", "return", ":" ]
77551cc65f72b50ac203f10a5069cb1a5b3ffb49
https://github.com/kimdhamilton/merkle-proofs/blob/77551cc65f72b50ac203f10a5069cb1a5b3ffb49/merkleproof/MerkleTree.py#L102-L144
train
Returns the proof for a leaf at the given index as an array of merkle siblings in hex format
kimdhamilton/merkle-proofs
merkleproof/MerkleTree.py
MerkleTree.validate_proof
def validate_proof(self, proof, target_hash, merkle_root): """ Takes a proof array, a target hash value, and a merkle root Checks the validity of the proof and return true or false :param proof: :param target_hash: :param merkle_root: :return: """ ...
python
def validate_proof(self, proof, target_hash, merkle_root): """ Takes a proof array, a target hash value, and a merkle root Checks the validity of the proof and return true or false :param proof: :param target_hash: :param merkle_root: :return: """ ...
[ "def", "validate_proof", "(", "self", ",", "proof", ",", "target_hash", ",", "merkle_root", ")", ":", "return", "validate_proof", "(", "proof", ",", "target_hash", ",", "merkle_root", ",", "self", ".", "hash_f", ")" ]
Takes a proof array, a target hash value, and a merkle root Checks the validity of the proof and return true or false :param proof: :param target_hash: :param merkle_root: :return:
[ "Takes", "a", "proof", "array", "a", "target", "hash", "value", "and", "a", "merkle", "root", "Checks", "the", "validity", "of", "the", "proof", "and", "return", "true", "or", "false", ":", "param", "proof", ":", ":", "param", "target_hash", ":", ":", ...
77551cc65f72b50ac203f10a5069cb1a5b3ffb49
https://github.com/kimdhamilton/merkle-proofs/blob/77551cc65f72b50ac203f10a5069cb1a5b3ffb49/merkleproof/MerkleTree.py#L162-L171
train
Checks the validity of a proof array and returns true or false
bitesofcode/projexui
projexui/completers/xjoincompleter.py
XJoinCompleter.pathFromIndex
def pathFromIndex(self, index): """ Returns the joined path from the given model index. This will join together the full path with periods. :param index | <QModelIndex> :return <str> """ out = [] while index and index...
python
def pathFromIndex(self, index): """ Returns the joined path from the given model index. This will join together the full path with periods. :param index | <QModelIndex> :return <str> """ out = [] while index and index...
[ "def", "pathFromIndex", "(", "self", ",", "index", ")", ":", "out", "=", "[", "]", "while", "index", "and", "index", ".", "isValid", "(", ")", ":", "out", ".", "append", "(", "nativestring", "(", "unwrapVariant", "(", "index", ".", "data", "(", ")", ...
Returns the joined path from the given model index. This will join together the full path with periods. :param index | <QModelIndex> :return <str>
[ "Returns", "the", "joined", "path", "from", "the", "given", "model", "index", ".", "This", "will", "join", "together", "the", "full", "path", "with", "periods", ".", ":", "param", "index", "|", "<QModelIndex", ">", ":", "return", "<str", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/completers/xjoincompleter.py#L38-L52
train
Returns the full path from the given index.
johnnoone/aioconsul
aioconsul/common/util.py
duration_to_timedelta
def duration_to_timedelta(obj): """Converts duration to timedelta >>> duration_to_timedelta("10m") >>> datetime.timedelta(0, 600) """ matches = DURATION_PATTERN.search(obj) matches = matches.groupdict(default="0") matches = {k: int(v) for k, v in matches.items()} return timedelta(**matc...
python
def duration_to_timedelta(obj): """Converts duration to timedelta >>> duration_to_timedelta("10m") >>> datetime.timedelta(0, 600) """ matches = DURATION_PATTERN.search(obj) matches = matches.groupdict(default="0") matches = {k: int(v) for k, v in matches.items()} return timedelta(**matc...
[ "def", "duration_to_timedelta", "(", "obj", ")", ":", "matches", "=", "DURATION_PATTERN", ".", "search", "(", "obj", ")", "matches", "=", "matches", ".", "groupdict", "(", "default", "=", "\"0\"", ")", "matches", "=", "{", "k", ":", "int", "(", "v", ")...
Converts duration to timedelta >>> duration_to_timedelta("10m") >>> datetime.timedelta(0, 600)
[ "Converts", "duration", "to", "timedelta" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/common/util.py#L39-L48
train
Converts a duration to timedelta
johnnoone/aioconsul
aioconsul/common/util.py
timedelta_to_duration
def timedelta_to_duration(obj): """Converts timedelta to duration >>> timedelta_to_duration(datetime.timedelta(0, 600)) >>> "10m" """ minutes, hours, days = 0, 0, 0 seconds = int(obj.total_seconds()) if seconds > 59: minutes = seconds // 60 seconds = seconds % 60 if minu...
python
def timedelta_to_duration(obj): """Converts timedelta to duration >>> timedelta_to_duration(datetime.timedelta(0, 600)) >>> "10m" """ minutes, hours, days = 0, 0, 0 seconds = int(obj.total_seconds()) if seconds > 59: minutes = seconds // 60 seconds = seconds % 60 if minu...
[ "def", "timedelta_to_duration", "(", "obj", ")", ":", "minutes", ",", "hours", ",", "days", "=", "0", ",", "0", ",", "0", "seconds", "=", "int", "(", "obj", ".", "total_seconds", "(", ")", ")", "if", "seconds", ">", "59", ":", "minutes", "=", "seco...
Converts timedelta to duration >>> timedelta_to_duration(datetime.timedelta(0, 600)) >>> "10m"
[ "Converts", "timedelta", "to", "duration" ]
02f7a529d7dc2e49bed942111067aa5faf320e90
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/common/util.py#L51-L77
train
Converts timedelta to duration
bitesofcode/projexui
projexui/widgets/xwalkthroughwidget/xwalkthrough.py
XWalkthroughSlide.fromXml
def fromXml(xml): """ Creates a new slide from XML. :return <XWalkthroughSlide> """ slide = XWalkthroughSlide(**xml.attrib) # create the items for xgraphic in xml: slide.addItem(XWalkthroughItem.fromXml(xgraphic)) ...
python
def fromXml(xml): """ Creates a new slide from XML. :return <XWalkthroughSlide> """ slide = XWalkthroughSlide(**xml.attrib) # create the items for xgraphic in xml: slide.addItem(XWalkthroughItem.fromXml(xgraphic)) ...
[ "def", "fromXml", "(", "xml", ")", ":", "slide", "=", "XWalkthroughSlide", "(", "*", "*", "xml", ".", "attrib", ")", "# create the items\r", "for", "xgraphic", "in", "xml", ":", "slide", ".", "addItem", "(", "XWalkthroughItem", ".", "fromXml", "(", "xgraph...
Creates a new slide from XML. :return <XWalkthroughSlide>
[ "Creates", "a", "new", "slide", "from", "XML", ".", ":", "return", "<XWalkthroughSlide", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xwalkthroughwidget/xwalkthrough.py#L133-L145
train
Creates a new slide from an XML object.
bitesofcode/projexui
projexui/widgets/xwalkthroughwidget/xwalkthrough.py
XWalkthrough.load
def load(xmlstr): """ Loads the contents for this walkthrough from XML. :param xmlstr | <str> :return <XWalkthrough> || None """ try: xml = ElementTree.fromstring(xmlstr) except StandardError: return No...
python
def load(xmlstr): """ Loads the contents for this walkthrough from XML. :param xmlstr | <str> :return <XWalkthrough> || None """ try: xml = ElementTree.fromstring(xmlstr) except StandardError: return No...
[ "def", "load", "(", "xmlstr", ")", ":", "try", ":", "xml", "=", "ElementTree", ".", "fromstring", "(", "xmlstr", ")", "except", "StandardError", ":", "return", "None", "return", "XWalkthrough", ".", "fromXml", "(", "xml", ")" ]
Loads the contents for this walkthrough from XML. :param xmlstr | <str> :return <XWalkthrough> || None
[ "Loads", "the", "contents", "for", "this", "walkthrough", "from", "XML", ".", ":", "param", "xmlstr", "|", "<str", ">", ":", "return", "<XWalkthrough", ">", "||", "None" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xwalkthroughwidget/xwalkthrough.py#L215-L228
train
Loads the contents of this walkthrough from XML.
bitesofcode/projexui
projexui/widgets/xwalkthroughwidget/xwalkthrough.py
XWalkthrough.fromXml
def fromXml(xml): """ Creates a new walkthrough element from XML :param xml | <xml.etree.ElementTree.Element> :return <XWalkthrough> || None """ walkthrough = XWalkthrough(name=xml.get('name', ''), ver...
python
def fromXml(xml): """ Creates a new walkthrough element from XML :param xml | <xml.etree.ElementTree.Element> :return <XWalkthrough> || None """ walkthrough = XWalkthrough(name=xml.get('name', ''), ver...
[ "def", "fromXml", "(", "xml", ")", ":", "walkthrough", "=", "XWalkthrough", "(", "name", "=", "xml", ".", "get", "(", "'name'", ",", "''", ")", ",", "version", "=", "xml", ".", "get", "(", "'version'", ")", ")", "for", "xslide", "in", "xml", ":", ...
Creates a new walkthrough element from XML :param xml | <xml.etree.ElementTree.Element> :return <XWalkthrough> || None
[ "Creates", "a", "new", "walkthrough", "element", "from", "XML", ":", "param", "xml", "|", "<xml", ".", "etree", ".", "ElementTree", ".", "Element", ">", ":", "return", "<XWalkthrough", ">", "||", "None" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xwalkthroughwidget/xwalkthrough.py#L231-L245
train
Creates a new walkthrough element from XML object xml.
talkincode/txradius
txradius/ext/ikuai.py
create_dm_pkg
def create_dm_pkg(secret,username): ''' create ikuai dm message''' secret = tools.EncodeString(secret) username = tools.EncodeString(username) pkg_format = '>HHHH32sHH32s' pkg_vals = [ IK_RAD_PKG_VER, IK_RAD_PKG_AUTH, IK_RAD_PKG_USR_PWD_TAG, len(secret), secre...
python
def create_dm_pkg(secret,username): ''' create ikuai dm message''' secret = tools.EncodeString(secret) username = tools.EncodeString(username) pkg_format = '>HHHH32sHH32s' pkg_vals = [ IK_RAD_PKG_VER, IK_RAD_PKG_AUTH, IK_RAD_PKG_USR_PWD_TAG, len(secret), secre...
[ "def", "create_dm_pkg", "(", "secret", ",", "username", ")", ":", "secret", "=", "tools", ".", "EncodeString", "(", "secret", ")", "username", "=", "tools", ".", "EncodeString", "(", "username", ")", "pkg_format", "=", "'>HHHH32sHH32s'", "pkg_vals", "=", "["...
create ikuai dm message
[ "create", "ikuai", "dm", "message" ]
b86fdbc9be41183680b82b07d3a8e8ea10926e01
https://github.com/talkincode/txradius/blob/b86fdbc9be41183680b82b07d3a8e8ea10926e01/txradius/ext/ikuai.py#L20-L35
train
create ikuai dm message
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.addBreakpoint
def addBreakpoint( self, lineno = -1 ): """ Adds a breakpoint for the given line number to this edit. :note The lineno is 0-based, while the editor displays lines as a 1-based system. So, if you want to put a breakpoint at visual line...
python
def addBreakpoint( self, lineno = -1 ): """ Adds a breakpoint for the given line number to this edit. :note The lineno is 0-based, while the editor displays lines as a 1-based system. So, if you want to put a breakpoint at visual line...
[ "def", "addBreakpoint", "(", "self", ",", "lineno", "=", "-", "1", ")", ":", "if", "(", "lineno", "==", "-", "1", ")", ":", "lineno", ",", "colno", "=", "self", ".", "getCursorPosition", "(", ")", "self", ".", "markerAdd", "(", "lineno", ",", "self...
Adds a breakpoint for the given line number to this edit. :note The lineno is 0-based, while the editor displays lines as a 1-based system. So, if you want to put a breakpoint at visual line 3, you would pass in lineno as 2 :param ...
[ "Adds", "a", "breakpoint", "for", "the", "given", "line", "number", "to", "this", "edit", ".", ":", "note", "The", "lineno", "is", "0", "-", "based", "while", "the", "editor", "displays", "lines", "as", "a", "1", "-", "based", "system", ".", "So", "i...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L88-L104
train
Adds a breakpoint at the given line number to this edit.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.breakpoints
def breakpoints( self ): """ Returns a list of lines that have breakpoints for this edit. :return [<int>, ..] """ lines = [] result = self.markerFindNext(0, self._breakpointMarker + 1) while ( result != -1 ): lines.append(result) ...
python
def breakpoints( self ): """ Returns a list of lines that have breakpoints for this edit. :return [<int>, ..] """ lines = [] result = self.markerFindNext(0, self._breakpointMarker + 1) while ( result != -1 ): lines.append(result) ...
[ "def", "breakpoints", "(", "self", ")", ":", "lines", "=", "[", "]", "result", "=", "self", ".", "markerFindNext", "(", "0", ",", "self", ".", "_breakpointMarker", "+", "1", ")", "while", "(", "result", "!=", "-", "1", ")", ":", "lines", ".", "appe...
Returns a list of lines that have breakpoints for this edit. :return [<int>, ..]
[ "Returns", "a", "list", "of", "lines", "that", "have", "breakpoints", "for", "this", "edit", ".", ":", "return", "[", "<int", ">", "..", "]" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L106-L117
train
Returns a list of lines that have breakpoints for this edit.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.clearBreakpoints
def clearBreakpoints( self ): """ Clears the file of all the breakpoints. """ self.markerDeleteAll(self._breakpointMarker) if ( not self.signalsBlocked() ): self.breakpointsChanged.emit()
python
def clearBreakpoints( self ): """ Clears the file of all the breakpoints. """ self.markerDeleteAll(self._breakpointMarker) if ( not self.signalsBlocked() ): self.breakpointsChanged.emit()
[ "def", "clearBreakpoints", "(", "self", ")", ":", "self", ".", "markerDeleteAll", "(", "self", ".", "_breakpointMarker", ")", "if", "(", "not", "self", ".", "signalsBlocked", "(", ")", ")", ":", "self", ".", "breakpointsChanged", ".", "emit", "(", ")" ]
Clears the file of all the breakpoints.
[ "Clears", "the", "file", "of", "all", "the", "breakpoints", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L127-L134
train
Clears the file of all the breakpoints.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.closeEvent
def closeEvent( self, event ): """ Overloads the close event for this widget to make sure that the data \ is properly saved before exiting. :param event | <QCloseEvent> """ if ( not (self.saveOnClose() and self.checkForSave()) ): event.ignore() ...
python
def closeEvent( self, event ): """ Overloads the close event for this widget to make sure that the data \ is properly saved before exiting. :param event | <QCloseEvent> """ if ( not (self.saveOnClose() and self.checkForSave()) ): event.ignore() ...
[ "def", "closeEvent", "(", "self", ",", "event", ")", ":", "if", "(", "not", "(", "self", ".", "saveOnClose", "(", ")", "and", "self", ".", "checkForSave", "(", ")", ")", ")", ":", "event", ".", "ignore", "(", ")", "else", ":", "super", "(", "XSci...
Overloads the close event for this widget to make sure that the data \ is properly saved before exiting. :param event | <QCloseEvent>
[ "Overloads", "the", "close", "event", "for", "this", "widget", "to", "make", "sure", "that", "the", "data", "\\", "is", "properly", "saved", "before", "exiting", ".", ":", "param", "event", "|", "<QCloseEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L142-L152
train
Overloads the close event for this widget to make sure that the data is properly saved before exiting.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.checkForSave
def checkForSave( self ): """ Checks to see if the current document has been modified and should \ be saved. :return <bool> """ # if the file is not modified, then save is not needed if ( not self.isModified() ): return True ...
python
def checkForSave( self ): """ Checks to see if the current document has been modified and should \ be saved. :return <bool> """ # if the file is not modified, then save is not needed if ( not self.isModified() ): return True ...
[ "def", "checkForSave", "(", "self", ")", ":", "# if the file is not modified, then save is not needed", "if", "(", "not", "self", ".", "isModified", "(", ")", ")", ":", "return", "True", "options", "=", "QMessageBox", ".", "Yes", "|", "QMessageBox", ".", "No", ...
Checks to see if the current document has been modified and should \ be saved. :return <bool>
[ "Checks", "to", "see", "if", "the", "current", "document", "has", "been", "modified", "and", "should", "\\", "be", "saved", ".", ":", "return", "<bool", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L154-L178
train
Checks to see if the current document has been modified and should be saved.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.findNext
def findNext( self, text, wholeWords = False, caseSensitive = False, regexed = False, wrap = True ): """ Looks up the next iteration fot the inputed search term. :param t...
python
def findNext( self, text, wholeWords = False, caseSensitive = False, regexed = False, wrap = True ): """ Looks up the next iteration fot the inputed search term. :param t...
[ "def", "findNext", "(", "self", ",", "text", ",", "wholeWords", "=", "False", ",", "caseSensitive", "=", "False", ",", "regexed", "=", "False", ",", "wrap", "=", "True", ")", ":", "return", "self", ".", "findFirst", "(", "text", ",", "regexed", ",", ...
Looks up the next iteration fot the inputed search term. :param text | <str> wholeWords | <bool> caseSensitive | <bool> regexed | <bool> :return <bool>
[ "Looks", "up", "the", "next", "iteration", "fot", "the", "inputed", "search", "term", ".", ":", "param", "text", "|", "<str", ">", "wholeWords", "|", "<bool", ">", "caseSensitive", "|", "<bool", ">", "regexed", "|", "<bool", ">", ":", "return", "<bool", ...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L196-L217
train
Returns the next iteration of the search term in the list.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.findPrev
def findPrev( self, text, wholeWords = False, caseSensitive = False, regexed = False, wrap = True ): """ Looks up the previous iteration for the inputed search term. :param t...
python
def findPrev( self, text, wholeWords = False, caseSensitive = False, regexed = False, wrap = True ): """ Looks up the previous iteration for the inputed search term. :param t...
[ "def", "findPrev", "(", "self", ",", "text", ",", "wholeWords", "=", "False", ",", "caseSensitive", "=", "False", ",", "regexed", "=", "False", ",", "wrap", "=", "True", ")", ":", "lineFrom", ",", "indexFrom", ",", "lineTo", ",", "indexTo", "=", "self"...
Looks up the previous iteration for the inputed search term. :param text | <str> wholeWords | <bool> caseSensitive | <bool> regexed | <bool> wrap | <bool> :return ...
[ "Looks", "up", "the", "previous", "iteration", "for", "the", "inputed", "search", "term", ".", ":", "param", "text", "|", "<str", ">", "wholeWords", "|", "<bool", ">", "caseSensitive", "|", "<bool", ">", "regexed", "|", "<bool", ">", "wrap", "|", "<bool"...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L219-L245
train
Returns the previous iteration of the inputed search term.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.findRepl
def findRepl( self, text, repl, caseSensitive = False, replaceAll = False ): """ Looks for the inputed text and replaces it with the given replacement \ text. :param text | <str>...
python
def findRepl( self, text, repl, caseSensitive = False, replaceAll = False ): """ Looks for the inputed text and replaces it with the given replacement \ text. :param text | <str>...
[ "def", "findRepl", "(", "self", ",", "text", ",", "repl", ",", "caseSensitive", "=", "False", ",", "replaceAll", "=", "False", ")", ":", "# make sure something is selected", "if", "(", "not", "text", ")", ":", "return", "0", "# make sure we have some text select...
Looks for the inputed text and replaces it with the given replacement \ text. :param text | <str> repl | <str> caseSensitive | <bool> replaceAll | <bool> :return <int> numb...
[ "Looks", "for", "the", "inputed", "text", "and", "replaces", "it", "with", "the", "given", "replacement", "\\", "text", ".", ":", "param", "text", "|", "<str", ">", "repl", "|", "<str", ">", "caseSensitive", "|", "<bool", ">", "replaceAll", "|", "<bool",...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L247-L309
train
Find the next replacement in the given text and replace it with the given replacement.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.initOptions
def initOptions(self, options): """ Initializes the edit with the inputed options data set. :param options | <XScintillaEditOptions> """ self.setAutoIndent( options.value('autoIndent')) self.setIndentationsUseTabs( options.value('indentationsU...
python
def initOptions(self, options): """ Initializes the edit with the inputed options data set. :param options | <XScintillaEditOptions> """ self.setAutoIndent( options.value('autoIndent')) self.setIndentationsUseTabs( options.value('indentationsU...
[ "def", "initOptions", "(", "self", ",", "options", ")", ":", "self", ".", "setAutoIndent", "(", "options", ".", "value", "(", "'autoIndent'", ")", ")", "self", ".", "setIndentationsUseTabs", "(", "options", ".", "value", "(", "'indentationsUseTabs'", ")", ")...
Initializes the edit with the inputed options data set. :param options | <XScintillaEditOptions>
[ "Initializes", "the", "edit", "with", "the", "inputed", "options", "data", "set", ".", ":", "param", "options", "|", "<XScintillaEditOptions", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L311-L361
train
Initializes the edit with the inputed options data set.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.insertComments
def insertComments( self, comment = None ): """ Inserts comments into the editor based on the current selection.\ If no comment string is supplied, then the comment from the language \ will be used. :param comment | <str> || None :return <bool> ...
python
def insertComments( self, comment = None ): """ Inserts comments into the editor based on the current selection.\ If no comment string is supplied, then the comment from the language \ will be used. :param comment | <str> || None :return <bool> ...
[ "def", "insertComments", "(", "self", ",", "comment", "=", "None", ")", ":", "if", "(", "not", "comment", ")", ":", "lang", "=", "self", ".", "language", "(", ")", "if", "(", "lang", ")", ":", "comment", "=", "lang", ".", "lineComment", "(", ")", ...
Inserts comments into the editor based on the current selection.\ If no comment string is supplied, then the comment from the language \ will be used. :param comment | <str> || None :return <bool> | success
[ "Inserts", "comments", "into", "the", "editor", "based", "on", "the", "current", "selection", ".", "\\", "If", "no", "comment", "string", "is", "supplied", "then", "the", "comment", "from", "the", "language", "\\", "will", "be", "used", ".", ":", "param", ...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L363-L390
train
Inserts comments into the editor based on the current selection.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.keyPressEvent
def keyPressEvent( self, event ): """ Overloads the keyPressEvent method to support backtab operations. :param event | <QKeyPressEvent> """ if ( event.key() == Qt.Key_Backtab ): self.unindentSelection() else: super(XScintilla...
python
def keyPressEvent( self, event ): """ Overloads the keyPressEvent method to support backtab operations. :param event | <QKeyPressEvent> """ if ( event.key() == Qt.Key_Backtab ): self.unindentSelection() else: super(XScintilla...
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "if", "(", "event", ".", "key", "(", ")", "==", "Qt", ".", "Key_Backtab", ")", ":", "self", ".", "unindentSelection", "(", ")", "else", ":", "super", "(", "XScintillaEdit", ",", "self", ")"...
Overloads the keyPressEvent method to support backtab operations. :param event | <QKeyPressEvent>
[ "Overloads", "the", "keyPressEvent", "method", "to", "support", "backtab", "operations", ".", ":", "param", "event", "|", "<QKeyPressEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L392-L401
train
Overloads the keyPressEvent method to support backtab operations.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.load
def load( self, filename, lineno = 0 ): """ Loads the inputed filename as the current document for this edit. :param filename | <str> lineno | <int> :return <bool> | success """ filename = nativestring(filename) ...
python
def load( self, filename, lineno = 0 ): """ Loads the inputed filename as the current document for this edit. :param filename | <str> lineno | <int> :return <bool> | success """ filename = nativestring(filename) ...
[ "def", "load", "(", "self", ",", "filename", ",", "lineno", "=", "0", ")", ":", "filename", "=", "nativestring", "(", "filename", ")", "if", "(", "not", "(", "filename", "and", "os", ".", "path", ".", "exists", "(", "filename", ")", ")", ")", ":", ...
Loads the inputed filename as the current document for this edit. :param filename | <str> lineno | <int> :return <bool> | success
[ "Loads", "the", "inputed", "filename", "as", "the", "current", "document", "for", "this", "edit", ".", ":", "param", "filename", "|", "<str", ">", "lineno", "|", "<int", ">", ":", "return", "<bool", ">", "|", "success" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L411-L446
train
Loads the inputed filename as the current document for this edit.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.removeComments
def removeComments( self, comment = None ): """ Inserts comments into the editor based on the current selection.\ If no comment string is supplied, then the comment from the language \ will be used. :param comment | <str> || None :return <bool> ...
python
def removeComments( self, comment = None ): """ Inserts comments into the editor based on the current selection.\ If no comment string is supplied, then the comment from the language \ will be used. :param comment | <str> || None :return <bool> ...
[ "def", "removeComments", "(", "self", ",", "comment", "=", "None", ")", ":", "if", "(", "not", "comment", ")", ":", "lang", "=", "self", ".", "language", "(", ")", "if", "(", "lang", ")", ":", "comment", "=", "lang", ".", "lineComment", "(", ")", ...
Inserts comments into the editor based on the current selection.\ If no comment string is supplied, then the comment from the language \ will be used. :param comment | <str> || None :return <bool> | success
[ "Inserts", "comments", "into", "the", "editor", "based", "on", "the", "current", "selection", ".", "\\", "If", "no", "comment", "string", "is", "supplied", "then", "the", "comment", "from", "the", "language", "\\", "will", "be", "used", ".", ":", "param", ...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L448-L478
train
Removes comments from the editor based on the current selection.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.removeBreakpoint
def removeBreakpoint( self, lineno = -1 ): """ Removes the breakpoint at the inputed line number. If the lineno is -1, then the current line number will be used :note The lineno is 0-based, while the editor displays lines as a 1-based system. So...
python
def removeBreakpoint( self, lineno = -1 ): """ Removes the breakpoint at the inputed line number. If the lineno is -1, then the current line number will be used :note The lineno is 0-based, while the editor displays lines as a 1-based system. So...
[ "def", "removeBreakpoint", "(", "self", ",", "lineno", "=", "-", "1", ")", ":", "if", "(", "lineno", "==", "-", "1", ")", ":", "lineno", ",", "colno", "=", "self", ".", "getCursorPosition", "(", ")", "self", ".", "markerDelete", "(", "lineno", ",", ...
Removes the breakpoint at the inputed line number. If the lineno is -1, then the current line number will be used :note The lineno is 0-based, while the editor displays lines as a 1-based system. So, if you remove a breakpoint at visual line ...
[ "Removes", "the", "breakpoint", "at", "the", "inputed", "line", "number", ".", "If", "the", "lineno", "is", "-", "1", "then", "the", "current", "line", "number", "will", "be", "used", ":", "note", "The", "lineno", "is", "0", "-", "based", "while", "the...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L480-L497
train
Removes the breakpoint at the inputed line number.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.saveAs
def saveAs( self, filename = '' ): """ Saves the current document to the inputed filename. If no filename \ is supplied, then the user will be prompted to supply a filename. :param filename | <str> :return <bool> | success """ if ( not ...
python
def saveAs( self, filename = '' ): """ Saves the current document to the inputed filename. If no filename \ is supplied, then the user will be prompted to supply a filename. :param filename | <str> :return <bool> | success """ if ( not ...
[ "def", "saveAs", "(", "self", ",", "filename", "=", "''", ")", ":", "if", "(", "not", "(", "filename", "and", "isinstance", "(", "filename", ",", "basestring", ")", ")", ")", ":", "langTypes", "=", "XLanguage", ".", "pluginFileTypes", "(", ")", "filena...
Saves the current document to the inputed filename. If no filename \ is supplied, then the user will be prompted to supply a filename. :param filename | <str> :return <bool> | success
[ "Saves", "the", "current", "document", "to", "the", "inputed", "filename", ".", "If", "no", "filename", "\\", "is", "supplied", "then", "the", "user", "will", "be", "prompted", "to", "supply", "a", "filename", ".", ":", "param", "filename", "|", "<str", ...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L509-L550
train
Saves the current document to the inputed filename.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.setBreakpoints
def setBreakpoints( self, breakpoints ): """ Sets the breakpoints for this edit to the inputed list of breakpoints. :param breakpoints | [<int>, ..] """ self.clearBreakpoints() for breakpoint in breakpoints: self.addBreakpoint(breakpoint)
python
def setBreakpoints( self, breakpoints ): """ Sets the breakpoints for this edit to the inputed list of breakpoints. :param breakpoints | [<int>, ..] """ self.clearBreakpoints() for breakpoint in breakpoints: self.addBreakpoint(breakpoint)
[ "def", "setBreakpoints", "(", "self", ",", "breakpoints", ")", ":", "self", ".", "clearBreakpoints", "(", ")", "for", "breakpoint", "in", "breakpoints", ":", "self", ".", "addBreakpoint", "(", "breakpoint", ")" ]
Sets the breakpoints for this edit to the inputed list of breakpoints. :param breakpoints | [<int>, ..]
[ "Sets", "the", "breakpoints", "for", "this", "edit", "to", "the", "inputed", "list", "of", "breakpoints", ".", ":", "param", "breakpoints", "|", "[", "<int", ">", "..", "]" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L561-L569
train
Sets the breakpoints for this edit to the inputed list of breakpoints.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.setColorSet
def setColorSet( self, colorSet ): """ Sets the color set for this edit to the inputed set. :param colorSet | <XColorSet> """ self._colorSet = colorSet if ( not colorSet ): return palette = self.palette() ...
python
def setColorSet( self, colorSet ): """ Sets the color set for this edit to the inputed set. :param colorSet | <XColorSet> """ self._colorSet = colorSet if ( not colorSet ): return palette = self.palette() ...
[ "def", "setColorSet", "(", "self", ",", "colorSet", ")", ":", "self", ".", "_colorSet", "=", "colorSet", "if", "(", "not", "colorSet", ")", ":", "return", "palette", "=", "self", ".", "palette", "(", ")", "palette", ".", "setColor", "(", "palette", "."...
Sets the color set for this edit to the inputed set. :param colorSet | <XColorSet>
[ "Sets", "the", "color", "set", "for", "this", "edit", "to", "the", "inputed", "set", ".", ":", "param", "colorSet", "|", "<XColorSet", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L571-L647
train
Sets the color set for this edit to the inputed colorSet.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.setCurrentDebugLine
def setCurrentDebugLine( self, lineno ): """ Returns the line number for the documents debug line. :param lineno | <int> """ self.markerDeleteAll(self._currentDebugMarker) self.markerAdd(lineno, self._currentDebugMarker) self.setCurrentLine(l...
python
def setCurrentDebugLine( self, lineno ): """ Returns the line number for the documents debug line. :param lineno | <int> """ self.markerDeleteAll(self._currentDebugMarker) self.markerAdd(lineno, self._currentDebugMarker) self.setCurrentLine(l...
[ "def", "setCurrentDebugLine", "(", "self", ",", "lineno", ")", ":", "self", ".", "markerDeleteAll", "(", "self", ".", "_currentDebugMarker", ")", "self", ".", "markerAdd", "(", "lineno", ",", "self", ".", "_currentDebugMarker", ")", "self", ".", "setCurrentLin...
Returns the line number for the documents debug line. :param lineno | <int>
[ "Returns", "the", "line", "number", "for", "the", "documents", "debug", "line", ".", ":", "param", "lineno", "|", "<int", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L649-L657
train
Sets the current debug line number.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.unindentSelection
def unindentSelection( self ): """ Unindents the current selected text. """ sel = self.getSelection() for line in range(sel[0], sel[2] + 1): self.unindent(line)
python
def unindentSelection( self ): """ Unindents the current selected text. """ sel = self.getSelection() for line in range(sel[0], sel[2] + 1): self.unindent(line)
[ "def", "unindentSelection", "(", "self", ")", ":", "sel", "=", "self", ".", "getSelection", "(", ")", "for", "line", "in", "range", "(", "sel", "[", "0", "]", ",", "sel", "[", "2", "]", "+", "1", ")", ":", "self", ".", "unindent", "(", "line", ...
Unindents the current selected text.
[ "Unindents", "the", "current", "selected", "text", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L742-L749
train
Unindents the current selected text.
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.windowTitle
def windowTitle( self ): """ Returns the window title for this edit based on its filename and \ modified state. :return <str> """ output = os.path.basename(self._filename) if ( not output ): output = 'New Document' if ( se...
python
def windowTitle( self ): """ Returns the window title for this edit based on its filename and \ modified state. :return <str> """ output = os.path.basename(self._filename) if ( not output ): output = 'New Document' if ( se...
[ "def", "windowTitle", "(", "self", ")", ":", "output", "=", "os", ".", "path", ".", "basename", "(", "self", ".", "_filename", ")", "if", "(", "not", "output", ")", ":", "output", "=", "'New Document'", "if", "(", "self", ".", "isModified", "(", ")",...
Returns the window title for this edit based on its filename and \ modified state. :return <str>
[ "Returns", "the", "window", "title", "for", "this", "edit", "based", "on", "its", "filename", "and", "\\", "modified", "state", ".", ":", "return", "<str", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L784-L798
train
Returns the window title based on the filename and modified state.
starling-lab/rnlp
rnlp/textprocessing.py
_removePunctuation
def _removePunctuation(text_string): """ Removes punctuation symbols from a string. :param text_string: A string. :type text_string: str. :returns: The input ``text_string`` with punctuation symbols removed. :rtype: str. >>> from rnlp.textprocessing import __removePunctuation >>> exam...
python
def _removePunctuation(text_string): """ Removes punctuation symbols from a string. :param text_string: A string. :type text_string: str. :returns: The input ``text_string`` with punctuation symbols removed. :rtype: str. >>> from rnlp.textprocessing import __removePunctuation >>> exam...
[ "def", "_removePunctuation", "(", "text_string", ")", ":", "try", ":", "return", "text_string", ".", "translate", "(", "None", ",", "_punctuation", ")", "except", "TypeError", ":", "return", "text_string", ".", "translate", "(", "str", ".", "maketrans", "(", ...
Removes punctuation symbols from a string. :param text_string: A string. :type text_string: str. :returns: The input ``text_string`` with punctuation symbols removed. :rtype: str. >>> from rnlp.textprocessing import __removePunctuation >>> example = 'Hello, World!' >>> __removePunctuation...
[ "Removes", "punctuation", "symbols", "from", "a", "string", "." ]
72054cc2c0cbaea1d281bf3d56b271d4da29fc4a
https://github.com/starling-lab/rnlp/blob/72054cc2c0cbaea1d281bf3d56b271d4da29fc4a/rnlp/textprocessing.py#L49-L67
train
Removes punctuation symbols from a string.
starling-lab/rnlp
rnlp/textprocessing.py
_removeStopwords
def _removeStopwords(text_list): """ Removes stopwords contained in a list of words. :param text_string: A list of strings. :type text_string: list. :returns: The input ``text_list`` with stopwords removed. :rtype: list """ output_list = [] for word in text_list: if word....
python
def _removeStopwords(text_list): """ Removes stopwords contained in a list of words. :param text_string: A list of strings. :type text_string: list. :returns: The input ``text_list`` with stopwords removed. :rtype: list """ output_list = [] for word in text_list: if word....
[ "def", "_removeStopwords", "(", "text_list", ")", ":", "output_list", "=", "[", "]", "for", "word", "in", "text_list", ":", "if", "word", ".", "lower", "(", ")", "not", "in", "_stopwords", ":", "output_list", ".", "append", "(", "word", ")", "return", ...
Removes stopwords contained in a list of words. :param text_string: A list of strings. :type text_string: list. :returns: The input ``text_list`` with stopwords removed. :rtype: list
[ "Removes", "stopwords", "contained", "in", "a", "list", "of", "words", "." ]
72054cc2c0cbaea1d281bf3d56b271d4da29fc4a
https://github.com/starling-lab/rnlp/blob/72054cc2c0cbaea1d281bf3d56b271d4da29fc4a/rnlp/textprocessing.py#L70-L87
train
Removes stopwords contained in a list of words.
starling-lab/rnlp
rnlp/textprocessing.py
getBlocks
def getBlocks(sentences, n): """ Get blocks of n sentences together. :param sentences: List of strings where each string is a sentence. :type sentences: list :param n: Maximum blocksize for sentences, i.e. a block will be composed of ``n`` sentences. :type n: int. :returns: ...
python
def getBlocks(sentences, n): """ Get blocks of n sentences together. :param sentences: List of strings where each string is a sentence. :type sentences: list :param n: Maximum blocksize for sentences, i.e. a block will be composed of ``n`` sentences. :type n: int. :returns: ...
[ "def", "getBlocks", "(", "sentences", ",", "n", ")", ":", "blocks", "=", "[", "]", "for", "i", "in", "range", "(", "0", ",", "len", "(", "sentences", ")", ",", "n", ")", ":", "blocks", ".", "append", "(", "sentences", "[", "i", ":", "(", "i", ...
Get blocks of n sentences together. :param sentences: List of strings where each string is a sentence. :type sentences: list :param n: Maximum blocksize for sentences, i.e. a block will be composed of ``n`` sentences. :type n: int. :returns: Blocks of n sentences. :rtype: list-o...
[ "Get", "blocks", "of", "n", "sentences", "together", "." ]
72054cc2c0cbaea1d281bf3d56b271d4da29fc4a
https://github.com/starling-lab/rnlp/blob/72054cc2c0cbaea1d281bf3d56b271d4da29fc4a/rnlp/textprocessing.py#L90-L120
train
Get blocks of n sentences together.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.__collectFilterTerms
def __collectFilterTerms( self, mapping, item = None, level = 0 ): """ Generates a list of filter terms based on the column data for the \ items in the tree. If no parent is supplied, then the top level...
python
def __collectFilterTerms( self, mapping, item = None, level = 0 ): """ Generates a list of filter terms based on the column data for the \ items in the tree. If no parent is supplied, then the top level...
[ "def", "__collectFilterTerms", "(", "self", ",", "mapping", ",", "item", "=", "None", ",", "level", "=", "0", ")", ":", "if", "not", "mapping", ":", "return", "max_level", "=", "self", ".", "maximumFilterLevel", "(", ")", "if", "max_level", "!=", "None",...
Generates a list of filter terms based on the column data for the \ items in the tree. If no parent is supplied, then the top level items \ will be used, otherwise the children will be searched through. The \ level value will drive how far down the tree we will look for the terms. ...
[ "Generates", "a", "list", "of", "filter", "terms", "based", "on", "the", "column", "data", "for", "the", "\\", "items", "in", "the", "tree", ".", "If", "no", "parent", "is", "supplied", "then", "the", "top", "level", "items", "\\", "will", "be", "used"...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L149-L183
train
This method returns a list of filter terms based on the column data for the items in the tree.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.__destroyLockedView
def __destroyLockedView(self): """ Destroys the locked view from this widget. """ if self._lockedView: self._lockedView.close() self._lockedView.deleteLater() self._lockedView = None
python
def __destroyLockedView(self): """ Destroys the locked view from this widget. """ if self._lockedView: self._lockedView.close() self._lockedView.deleteLater() self._lockedView = None
[ "def", "__destroyLockedView", "(", "self", ")", ":", "if", "self", ".", "_lockedView", ":", "self", ".", "_lockedView", ".", "close", "(", ")", "self", ".", "_lockedView", ".", "deleteLater", "(", ")", "self", ".", "_lockedView", "=", "None" ]
Destroys the locked view from this widget.
[ "Destroys", "the", "locked", "view", "from", "this", "widget", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L185-L192
train
Destroys the locked view from this widget.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.__filterItems
def __filterItems(self, terms, autoExpand=True, caseSensitive=False, parent=None, level=0): """ Filters the items in this tree based on the inputed keywords. :param ...
python
def __filterItems(self, terms, autoExpand=True, caseSensitive=False, parent=None, level=0): """ Filters the items in this tree based on the inputed keywords. :param ...
[ "def", "__filterItems", "(", "self", ",", "terms", ",", "autoExpand", "=", "True", ",", "caseSensitive", "=", "False", ",", "parent", "=", "None", ",", "level", "=", "0", ")", ":", "# make sure we're within our mex level for filtering\r", "max_level", "=", "self...
Filters the items in this tree based on the inputed keywords. :param terms | {<int> column: [<str> term, ..], ..} autoExpand | <bool> caseSensitive | <bool> parent | <QtGui.QTreeWidgetItem> || None ...
[ "Filters", "the", "items", "in", "this", "tree", "based", "on", "the", "inputed", "keywords", ".", ":", "param", "terms", "|", "{", "<int", ">", "column", ":", "[", "<str", ">", "term", "..", "]", "..", "}", "autoExpand", "|", "<bool", ">", "caseSens...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L194-L319
train
Filter the items in this tree based on the inputed keywords.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.__setUserMinimumSize
def __setUserMinimumSize( self, section, oldSize, newSize ): """ Records the user minimum size for a column. :param section | <int> oldSize | <int> newSize | <int> """ if self.isVisible(): self._columnMini...
python
def __setUserMinimumSize( self, section, oldSize, newSize ): """ Records the user minimum size for a column. :param section | <int> oldSize | <int> newSize | <int> """ if self.isVisible(): self._columnMini...
[ "def", "__setUserMinimumSize", "(", "self", ",", "section", ",", "oldSize", ",", "newSize", ")", ":", "if", "self", ".", "isVisible", "(", ")", ":", "self", ".", "_columnMinimums", "[", "section", "]", "=", "newSize" ]
Records the user minimum size for a column. :param section | <int> oldSize | <int> newSize | <int>
[ "Records", "the", "user", "minimum", "size", "for", "a", "column", ".", ":", "param", "section", "|", "<int", ">", "oldSize", "|", "<int", ">", "newSize", "|", "<int", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L321-L330
train
Sets the user minimum size for a column.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.blockAllSignals
def blockAllSignals( self, state ): """ Fully blocks all signals - tree, header signals. :param state | <bool> """ self.blockSignals(state) self.header().blockSignals(state)
python
def blockAllSignals( self, state ): """ Fully blocks all signals - tree, header signals. :param state | <bool> """ self.blockSignals(state) self.header().blockSignals(state)
[ "def", "blockAllSignals", "(", "self", ",", "state", ")", ":", "self", ".", "blockSignals", "(", "state", ")", "self", ".", "header", "(", ")", ".", "blockSignals", "(", "state", ")" ]
Fully blocks all signals - tree, header signals. :param state | <bool>
[ "Fully", "blocks", "all", "signals", "-", "tree", "header", "signals", ".", ":", "param", "state", "|", "<bool", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L362-L369
train
Blocks all the signals in the tree and header signals.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.checkedItems
def checkedItems(self, column=0, parent=None, recurse=True): """ Returns a list of the checked items for this tree widget based on the inputed column and parent information. :param column | <int> parent | <QtGui.QTreeWidget> || None ...
python
def checkedItems(self, column=0, parent=None, recurse=True): """ Returns a list of the checked items for this tree widget based on the inputed column and parent information. :param column | <int> parent | <QtGui.QTreeWidget> || None ...
[ "def", "checkedItems", "(", "self", ",", "column", "=", "0", ",", "parent", "=", "None", ",", "recurse", "=", "True", ")", ":", "output", "=", "[", "]", "if", "not", "parent", ":", "for", "i", "in", "range", "(", "self", ".", "topLevelItemCount", "...
Returns a list of the checked items for this tree widget based on the inputed column and parent information. :param column | <int> parent | <QtGui.QTreeWidget> || None recurse | <bool> :return [<QtGui.QTreeWidgetItem>, ....
[ "Returns", "a", "list", "of", "the", "checked", "items", "for", "this", "tree", "widget", "based", "on", "the", "inputed", "column", "and", "parent", "information", ".", ":", "param", "column", "|", "<int", ">", "parent", "|", "<QtGui", ".", "QTreeWidget",...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L371-L399
train
Returns a list of the checked items for this tree widget based on the inputed column and parent information.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.clear
def clear(self): """ Removes all the items from this tree widget. This will go through and also destroy any XTreeWidgetItems prior to the model clearing its references. """ # go through and properly destroy all the items for this tree for item in self.trav...
python
def clear(self): """ Removes all the items from this tree widget. This will go through and also destroy any XTreeWidgetItems prior to the model clearing its references. """ # go through and properly destroy all the items for this tree for item in self.trav...
[ "def", "clear", "(", "self", ")", ":", "# go through and properly destroy all the items for this tree\r", "for", "item", "in", "self", ".", "traverseItems", "(", ")", ":", "if", "isinstance", "(", "item", ",", "XTreeWidgetItem", ")", ":", "item", ".", "destroy", ...
Removes all the items from this tree widget. This will go through and also destroy any XTreeWidgetItems prior to the model clearing its references.
[ "Removes", "all", "the", "items", "from", "this", "tree", "widget", ".", "This", "will", "go", "through", "and", "also", "destroy", "any", "XTreeWidgetItems", "prior", "to", "the", "model", "clearing", "its", "references", "." ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L401-L412
train
Clears the items for this tree widget.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.collectFilterTerms
def collectFilterTerms( self, columns = None, ignore = None ): """ Returns a collection of filter terms for this tree widget based on \ the results in the tree items. If the optional columns or ignore \ values are supplied then the specific columns will be used to generate \ ...
python
def collectFilterTerms( self, columns = None, ignore = None ): """ Returns a collection of filter terms for this tree widget based on \ the results in the tree items. If the optional columns or ignore \ values are supplied then the specific columns will be used to generate \ ...
[ "def", "collectFilterTerms", "(", "self", ",", "columns", "=", "None", ",", "ignore", "=", "None", ")", ":", "if", "(", "columns", "==", "None", ")", ":", "columns", "=", "self", ".", "columns", "(", ")", "if", "(", "ignore", ")", ":", "columns", "...
Returns a collection of filter terms for this tree widget based on \ the results in the tree items. If the optional columns or ignore \ values are supplied then the specific columns will be used to generate \ the search terms, and the columns in the ignore list will be stripped \ ou...
[ "Returns", "a", "collection", "of", "filter", "terms", "for", "this", "tree", "widget", "based", "on", "\\", "the", "results", "in", "the", "tree", "items", ".", "If", "the", "optional", "columns", "or", "ignore", "\\", "values", "are", "supplied", "then",...
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L414-L443
train
Returns a dictionary of filter terms for this tree widget based on the given columns and ignore list.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.column
def column(self, name): """ Returns the index of the column at the given name. :param name | <str> :return <int> (-1 if not found) """ columns = self.columns() if name in columns: return columns.index(name) ...
python
def column(self, name): """ Returns the index of the column at the given name. :param name | <str> :return <int> (-1 if not found) """ columns = self.columns() if name in columns: return columns.index(name) ...
[ "def", "column", "(", "self", ",", "name", ")", ":", "columns", "=", "self", ".", "columns", "(", ")", "if", "name", "in", "columns", ":", "return", "columns", ".", "index", "(", "name", ")", "else", ":", "check", "=", "projex", ".", "text", ".", ...
Returns the index of the column at the given name. :param name | <str> :return <int> (-1 if not found)
[ "Returns", "the", "index", "of", "the", "column", "at", "the", "given", "name", ".", ":", "param", "name", "|", "<str", ">", ":", "return", "<int", ">", "(", "-", "1", "if", "not", "found", ")" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L445-L461
train
Returns the index of the column with the given name.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.columnOf
def columnOf(self, index): """ Returns the name of the column at the inputed index. :param index | <int> :return <str> """ columns = self.columns() if ( 0 <= index and index < len(columns) ): return columns[index] ...
python
def columnOf(self, index): """ Returns the name of the column at the inputed index. :param index | <int> :return <str> """ columns = self.columns() if ( 0 <= index and index < len(columns) ): return columns[index] ...
[ "def", "columnOf", "(", "self", ",", "index", ")", ":", "columns", "=", "self", ".", "columns", "(", ")", "if", "(", "0", "<=", "index", "and", "index", "<", "len", "(", "columns", ")", ")", ":", "return", "columns", "[", "index", "]", "return", ...
Returns the name of the column at the inputed index. :param index | <int> :return <str>
[ "Returns", "the", "name", "of", "the", "column", "at", "the", "inputed", "index", ".", ":", "param", "index", "|", "<int", ">", ":", "return", "<str", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L463-L474
train
Returns the name of the column at the inputed index.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.createHeaderMenu
def createHeaderMenu(self, index): """ Creates a new header menu to be displayed. :return <QtGui.QMenu> """ menu = QtGui.QMenu(self) act = menu.addAction("Hide '%s'" % self.columnOf(index)) act.triggered.connect( self.headerHideColumn ) ...
python
def createHeaderMenu(self, index): """ Creates a new header menu to be displayed. :return <QtGui.QMenu> """ menu = QtGui.QMenu(self) act = menu.addAction("Hide '%s'" % self.columnOf(index)) act.triggered.connect( self.headerHideColumn ) ...
[ "def", "createHeaderMenu", "(", "self", ",", "index", ")", ":", "menu", "=", "QtGui", ".", "QMenu", "(", "self", ")", "act", "=", "menu", ".", "addAction", "(", "\"Hide '%s'\"", "%", "self", ".", "columnOf", "(", "index", ")", ")", "act", ".", "trigg...
Creates a new header menu to be displayed. :return <QtGui.QMenu>
[ "Creates", "a", "new", "header", "menu", "to", "be", "displayed", ".", ":", "return", "<QtGui", ".", "QMenu", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L491-L543
train
Creates a new header menu for the current index.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.dragEnterEvent
def dragEnterEvent( self, event ): """ Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDragEvent> """ filt = self.dragDropFilter() if not filt: super(XTreeWidget, self).dragEnterEven...
python
def dragEnterEvent( self, event ): """ Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDragEvent> """ filt = self.dragDropFilter() if not filt: super(XTreeWidget, self).dragEnterEven...
[ "def", "dragEnterEvent", "(", "self", ",", "event", ")", ":", "filt", "=", "self", ".", "dragDropFilter", "(", ")", "if", "not", "filt", ":", "super", "(", "XTreeWidget", ",", "self", ")", ".", "dragEnterEvent", "(", "event", ")", "return", "filt", "("...
Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDragEvent>
[ "Processes", "the", "drag", "drop", "event", "using", "the", "filter", "set", "by", "the", "\\", "setDragDropFilter", ":", "param", "event", "|", "<QDragEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L585-L597
train
Processes the drag drop event using the filter set by the user.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.dragMoveEvent
def dragMoveEvent( self, event ): """ Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDragEvent> """ filt = self.dragDropFilter() if not filt: super(XTreeWidget, self).dragMoveEvent(...
python
def dragMoveEvent( self, event ): """ Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDragEvent> """ filt = self.dragDropFilter() if not filt: super(XTreeWidget, self).dragMoveEvent(...
[ "def", "dragMoveEvent", "(", "self", ",", "event", ")", ":", "filt", "=", "self", ".", "dragDropFilter", "(", ")", "if", "not", "filt", ":", "super", "(", "XTreeWidget", ",", "self", ")", ".", "dragMoveEvent", "(", "event", ")", "return", "filt", "(", ...
Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDragEvent>
[ "Processes", "the", "drag", "drop", "event", "using", "the", "filter", "set", "by", "the", "\\", "setDragDropFilter", ":", "param", "event", "|", "<QDragEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L599-L611
train
Processes the drag move event using the filter set by the XTreeWidget class.
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.dropEvent
def dropEvent( self, event ): """ Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDropEvent> """ filt = self.dragDropFilter() if not filt: super(XTreeWidget, self).dropEvent(event) ...
python
def dropEvent( self, event ): """ Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDropEvent> """ filt = self.dragDropFilter() if not filt: super(XTreeWidget, self).dropEvent(event) ...
[ "def", "dropEvent", "(", "self", ",", "event", ")", ":", "filt", "=", "self", ".", "dragDropFilter", "(", ")", "if", "not", "filt", ":", "super", "(", "XTreeWidget", ",", "self", ")", ".", "dropEvent", "(", "event", ")", "return", "filt", "(", "self"...
Processes the drag drop event using the filter set by the \ setDragDropFilter :param event | <QDropEvent>
[ "Processes", "the", "drag", "drop", "event", "using", "the", "filter", "set", "by", "the", "\\", "setDragDropFilter", ":", "param", "event", "|", "<QDropEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L661-L673
train
Processes the drag drop event using the dragDropFilter method setDragDropFilter
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidget.py
XTreeWidget.edit
def edit(self, index, trigger, event): """ Prompts the edit for the inputed index given a trigger and event. :param index | <QModelIndex> trigger | <EditTrigger> event | <QEvent> """ # disable right-click editing ...
python
def edit(self, index, trigger, event): """ Prompts the edit for the inputed index given a trigger and event. :param index | <QModelIndex> trigger | <EditTrigger> event | <QEvent> """ # disable right-click editing ...
[ "def", "edit", "(", "self", ",", "index", ",", "trigger", ",", "event", ")", ":", "# disable right-click editing\r", "if", "trigger", "in", "(", "self", ".", "SelectedClicked", ",", "self", ".", "DoubleClicked", ")", "and", "event", ".", "button", "(", ")"...
Prompts the edit for the inputed index given a trigger and event. :param index | <QModelIndex> trigger | <EditTrigger> event | <QEvent>
[ "Prompts", "the", "edit", "for", "the", "inputed", "index", "given", "a", "trigger", "and", "event", ".", ":", "param", "index", "|", "<QModelIndex", ">", "trigger", "|", "<EditTrigger", ">", "event", "|", "<QEvent", ">" ]
f18a73bec84df90b034ca69b9deea118dbedfc4d
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidget.py#L675-L696
train
Prompts the edit for the inputed index given a trigger and event. Returns True if the edit was successful False otherwise.