id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
55,200
CivicSpleen/ambry
ambry/util/debug.py
patch_file_open
def patch_file_open(): # pragma: no cover """A Monkey patch to log opening and closing of files, which is useful for debugging file descriptor exhaustion.""" openfiles = set() oldfile = builtins.file class newfile(oldfile): def __init__(self, *args, **kwargs): self.x = args[0] ...
python
def patch_file_open(): # pragma: no cover """A Monkey patch to log opening and closing of files, which is useful for debugging file descriptor exhaustion.""" openfiles = set() oldfile = builtins.file class newfile(oldfile): def __init__(self, *args, **kwargs): self.x = args[0] ...
[ "def", "patch_file_open", "(", ")", ":", "# pragma: no cover", "openfiles", "=", "set", "(", ")", "oldfile", "=", "builtins", ".", "file", "class", "newfile", "(", "oldfile", ")", ":", "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "k...
A Monkey patch to log opening and closing of files, which is useful for debugging file descriptor exhaustion.
[ "A", "Monkey", "patch", "to", "log", "opening", "and", "closing", "of", "files", "which", "is", "useful", "for", "debugging", "file", "descriptor", "exhaustion", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/debug.py#L66-L94
55,201
twisted/epsilon
epsilon/ampauth.py
PasswordChallengeResponse.determineFrom
def determineFrom(cls, challenge, password): """ Create a nonce and use it, along with the given challenge and password, to generate the parameters for a response. @return: A C{dict} suitable to be used as the keyword arguments when calling this command. """ ...
python
def determineFrom(cls, challenge, password): """ Create a nonce and use it, along with the given challenge and password, to generate the parameters for a response. @return: A C{dict} suitable to be used as the keyword arguments when calling this command. """ ...
[ "def", "determineFrom", "(", "cls", ",", "challenge", ",", "password", ")", ":", "nonce", "=", "secureRandom", "(", "16", ")", "response", "=", "_calcResponse", "(", "challenge", ",", "nonce", ",", "password", ")", "return", "dict", "(", "cnonce", "=", "...
Create a nonce and use it, along with the given challenge and password, to generate the parameters for a response. @return: A C{dict} suitable to be used as the keyword arguments when calling this command.
[ "Create", "a", "nonce", "and", "use", "it", "along", "with", "the", "given", "challenge", "and", "password", "to", "generate", "the", "parameters", "for", "a", "response", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/ampauth.py#L102-L112
55,202
twisted/epsilon
epsilon/ampauth.py
_AMPUsernamePassword.checkPassword
def checkPassword(self, password): """ Check the given plaintext password against the response in this credentials object. @type password: C{str} @param password: The known correct password associated with C{self.username}. @return: A C{bool}, C{True} if thi...
python
def checkPassword(self, password): """ Check the given plaintext password against the response in this credentials object. @type password: C{str} @param password: The known correct password associated with C{self.username}. @return: A C{bool}, C{True} if thi...
[ "def", "checkPassword", "(", "self", ",", "password", ")", ":", "if", "isinstance", "(", "password", ",", "unicode", ")", ":", "password", "=", "password", ".", "encode", "(", "'utf-8'", ")", "correctResponse", "=", "_calcResponse", "(", "self", ".", "chal...
Check the given plaintext password against the response in this credentials object. @type password: C{str} @param password: The known correct password associated with C{self.username}. @return: A C{bool}, C{True} if this credentials object agrees with the given ...
[ "Check", "the", "given", "plaintext", "password", "against", "the", "response", "in", "this", "credentials", "object", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/ampauth.py#L123-L138
55,203
twisted/epsilon
epsilon/ampauth.py
CredReceiver.passwordLogin
def passwordLogin(self, username): """ Generate a new challenge for the given username. """ self.challenge = secureRandom(16) self.username = username return {'challenge': self.challenge}
python
def passwordLogin(self, username): """ Generate a new challenge for the given username. """ self.challenge = secureRandom(16) self.username = username return {'challenge': self.challenge}
[ "def", "passwordLogin", "(", "self", ",", "username", ")", ":", "self", ".", "challenge", "=", "secureRandom", "(", "16", ")", "self", ".", "username", "=", "username", "return", "{", "'challenge'", ":", "self", ".", "challenge", "}" ]
Generate a new challenge for the given username.
[ "Generate", "a", "new", "challenge", "for", "the", "given", "username", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/ampauth.py#L182-L188
55,204
twisted/epsilon
epsilon/ampauth.py
CredReceiver._login
def _login(self, credentials): """ Actually login to our portal with the given credentials. """ d = self.portal.login(credentials, None, IBoxReceiver) def cbLoggedIn((interface, avatar, logout)): self.logout = logout self.boxReceiver = avatar s...
python
def _login(self, credentials): """ Actually login to our portal with the given credentials. """ d = self.portal.login(credentials, None, IBoxReceiver) def cbLoggedIn((interface, avatar, logout)): self.logout = logout self.boxReceiver = avatar s...
[ "def", "_login", "(", "self", ",", "credentials", ")", ":", "d", "=", "self", ".", "portal", ".", "login", "(", "credentials", ",", "None", ",", "IBoxReceiver", ")", "def", "cbLoggedIn", "(", "(", "interface", ",", "avatar", ",", "logout", ")", ")", ...
Actually login to our portal with the given credentials.
[ "Actually", "login", "to", "our", "portal", "with", "the", "given", "credentials", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/ampauth.py#L191-L202
55,205
twisted/epsilon
epsilon/ampauth.py
CredReceiver.passwordChallengeResponse
def passwordChallengeResponse(self, cnonce, response): """ Verify the response to a challenge. """ return self._login(_AMPUsernamePassword( self.username, self.challenge, cnonce, response))
python
def passwordChallengeResponse(self, cnonce, response): """ Verify the response to a challenge. """ return self._login(_AMPUsernamePassword( self.username, self.challenge, cnonce, response))
[ "def", "passwordChallengeResponse", "(", "self", ",", "cnonce", ",", "response", ")", ":", "return", "self", ".", "_login", "(", "_AMPUsernamePassword", "(", "self", ".", "username", ",", "self", ".", "challenge", ",", "cnonce", ",", "response", ")", ")" ]
Verify the response to a challenge.
[ "Verify", "the", "response", "to", "a", "challenge", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/ampauth.py#L206-L211
55,206
twisted/epsilon
epsilon/ampauth.py
CredReceiver.connectionLost
def connectionLost(self, reason): """ If a login has happened, perform a logout. """ AMP.connectionLost(self, reason) if self.logout is not None: self.logout() self.boxReceiver = self.logout = None
python
def connectionLost(self, reason): """ If a login has happened, perform a logout. """ AMP.connectionLost(self, reason) if self.logout is not None: self.logout() self.boxReceiver = self.logout = None
[ "def", "connectionLost", "(", "self", ",", "reason", ")", ":", "AMP", ".", "connectionLost", "(", "self", ",", "reason", ")", "if", "self", ".", "logout", "is", "not", "None", ":", "self", ".", "logout", "(", ")", "self", ".", "boxReceiver", "=", "se...
If a login has happened, perform a logout.
[ "If", "a", "login", "has", "happened", "perform", "a", "logout", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/ampauth.py#L222-L229
55,207
cosven/feeluown-core
fuocore/live_lyric.py
LiveLyric.on_position_changed
def on_position_changed(self, position): """bind position changed signal with this""" if not self._lyric: return pos = find_previous(position*1000 + 300, self._pos_list) if pos is not None and pos != self._pos: self.current_sentence = self._pos_s_map[pos] ...
python
def on_position_changed(self, position): """bind position changed signal with this""" if not self._lyric: return pos = find_previous(position*1000 + 300, self._pos_list) if pos is not None and pos != self._pos: self.current_sentence = self._pos_s_map[pos] ...
[ "def", "on_position_changed", "(", "self", ",", "position", ")", ":", "if", "not", "self", ".", "_lyric", ":", "return", "pos", "=", "find_previous", "(", "position", "*", "1000", "+", "300", ",", "self", ".", "_pos_list", ")", "if", "pos", "is", "not"...
bind position changed signal with this
[ "bind", "position", "changed", "signal", "with", "this" ]
62dc64638f62971b16be0a75c0b8c7ae2999869e
https://github.com/cosven/feeluown-core/blob/62dc64638f62971b16be0a75c0b8c7ae2999869e/fuocore/live_lyric.py#L44-L52
55,208
cosven/feeluown-core
fuocore/live_lyric.py
LiveLyric.on_song_changed
def on_song_changed(self, song): """bind song changed signal with this""" if song is None or song.lyric is None: self._lyric = None self._pos_s_map = {} else: self._lyric = song.lyric.content self._pos_s_map = parse(self._lyric) self._pos_l...
python
def on_song_changed(self, song): """bind song changed signal with this""" if song is None or song.lyric is None: self._lyric = None self._pos_s_map = {} else: self._lyric = song.lyric.content self._pos_s_map = parse(self._lyric) self._pos_l...
[ "def", "on_song_changed", "(", "self", ",", "song", ")", ":", "if", "song", "is", "None", "or", "song", ".", "lyric", "is", "None", ":", "self", ".", "_lyric", "=", "None", "self", ".", "_pos_s_map", "=", "{", "}", "else", ":", "self", ".", "_lyric...
bind song changed signal with this
[ "bind", "song", "changed", "signal", "with", "this" ]
62dc64638f62971b16be0a75c0b8c7ae2999869e
https://github.com/cosven/feeluown-core/blob/62dc64638f62971b16be0a75c0b8c7ae2999869e/fuocore/live_lyric.py#L54-L64
55,209
twisted/epsilon
epsilon/extime.py
sanitizeStructTime
def sanitizeStructTime(struct): """ Convert struct_time tuples with possibly invalid values to valid ones by substituting the closest valid value. """ maxValues = (9999, 12, 31, 23, 59, 59) minValues = (1, 1, 1, 0, 0, 0) newstruct = [] for value, maxValue, minValue in zip(struct[:6], max...
python
def sanitizeStructTime(struct): """ Convert struct_time tuples with possibly invalid values to valid ones by substituting the closest valid value. """ maxValues = (9999, 12, 31, 23, 59, 59) minValues = (1, 1, 1, 0, 0, 0) newstruct = [] for value, maxValue, minValue in zip(struct[:6], max...
[ "def", "sanitizeStructTime", "(", "struct", ")", ":", "maxValues", "=", "(", "9999", ",", "12", ",", "31", ",", "23", ",", "59", ",", "59", ")", "minValues", "=", "(", "1", ",", "1", ",", "1", ",", "0", ",", "0", ",", "0", ")", "newstruct", "...
Convert struct_time tuples with possibly invalid values to valid ones by substituting the closest valid value.
[ "Convert", "struct_time", "tuples", "with", "possibly", "invalid", "values", "to", "valid", "ones", "by", "substituting", "the", "closest", "valid", "value", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L23-L33
55,210
twisted/epsilon
epsilon/extime.py
Time.fromHumanly
def fromHumanly(klass, humanStr, tzinfo=None, now=None): """Return a new Time instance from a string a human might type. @param humanStr: the string to be parsed. @param tzinfo: A tzinfo instance indicating the timezone to assume if none is specified in humanStr. If None, assume UTC. ...
python
def fromHumanly(klass, humanStr, tzinfo=None, now=None): """Return a new Time instance from a string a human might type. @param humanStr: the string to be parsed. @param tzinfo: A tzinfo instance indicating the timezone to assume if none is specified in humanStr. If None, assume UTC. ...
[ "def", "fromHumanly", "(", "klass", ",", "humanStr", ",", "tzinfo", "=", "None", ",", "now", "=", "None", ")", ":", "humanStr", "=", "humanStr", ".", "strip", "(", ")", "if", "now", "is", "None", ":", "now", "=", "Time", "(", ")", "if", "tzinfo", ...
Return a new Time instance from a string a human might type. @param humanStr: the string to be parsed. @param tzinfo: A tzinfo instance indicating the timezone to assume if none is specified in humanStr. If None, assume UTC. @param now: A Time instance to be considered "now" for when ...
[ "Return", "a", "new", "Time", "instance", "from", "a", "string", "a", "human", "might", "type", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L309-L339
55,211
twisted/epsilon
epsilon/extime.py
Time.fromStructTime
def fromStructTime(klass, structTime, tzinfo=None): """Return a new Time instance from a time.struct_time. If tzinfo is None, structTime is in UTC. Otherwise, tzinfo is a datetime.tzinfo instance coresponding to the timezone in which structTime is. Many of the functions in the ...
python
def fromStructTime(klass, structTime, tzinfo=None): """Return a new Time instance from a time.struct_time. If tzinfo is None, structTime is in UTC. Otherwise, tzinfo is a datetime.tzinfo instance coresponding to the timezone in which structTime is. Many of the functions in the ...
[ "def", "fromStructTime", "(", "klass", ",", "structTime", ",", "tzinfo", "=", "None", ")", ":", "dtime", "=", "datetime", ".", "datetime", "(", "tzinfo", "=", "tzinfo", ",", "*", "structTime", "[", ":", "6", "]", ")", "self", "=", "klass", ".", "from...
Return a new Time instance from a time.struct_time. If tzinfo is None, structTime is in UTC. Otherwise, tzinfo is a datetime.tzinfo instance coresponding to the timezone in which structTime is. Many of the functions in the standard time module return these things. This will als...
[ "Return", "a", "new", "Time", "instance", "from", "a", "time", ".", "struct_time", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L572-L587
55,212
twisted/epsilon
epsilon/extime.py
Time.fromDatetime
def fromDatetime(klass, dtime): """Return a new Time instance from a datetime.datetime instance. If the datetime instance does not have an associated timezone, it is assumed to be UTC. """ self = klass.__new__(klass) if dtime.tzinfo is not None: self._time = ...
python
def fromDatetime(klass, dtime): """Return a new Time instance from a datetime.datetime instance. If the datetime instance does not have an associated timezone, it is assumed to be UTC. """ self = klass.__new__(klass) if dtime.tzinfo is not None: self._time = ...
[ "def", "fromDatetime", "(", "klass", ",", "dtime", ")", ":", "self", "=", "klass", ".", "__new__", "(", "klass", ")", "if", "dtime", ".", "tzinfo", "is", "not", "None", ":", "self", ".", "_time", "=", "dtime", ".", "astimezone", "(", "FixedOffset", "...
Return a new Time instance from a datetime.datetime instance. If the datetime instance does not have an associated timezone, it is assumed to be UTC.
[ "Return", "a", "new", "Time", "instance", "from", "a", "datetime", ".", "datetime", "instance", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L591-L603
55,213
twisted/epsilon
epsilon/extime.py
Time.fromPOSIXTimestamp
def fromPOSIXTimestamp(klass, secs): """Return a new Time instance from seconds since the POSIX epoch. The POSIX epoch is midnight Jan 1, 1970 UTC. According to POSIX, leap seconds don't exist, so one UTC day is exactly 86400 seconds, even if it wasn't. @param secs: a number of...
python
def fromPOSIXTimestamp(klass, secs): """Return a new Time instance from seconds since the POSIX epoch. The POSIX epoch is midnight Jan 1, 1970 UTC. According to POSIX, leap seconds don't exist, so one UTC day is exactly 86400 seconds, even if it wasn't. @param secs: a number of...
[ "def", "fromPOSIXTimestamp", "(", "klass", ",", "secs", ")", ":", "self", "=", "klass", ".", "fromDatetime", "(", "_EPOCH", "+", "datetime", ".", "timedelta", "(", "seconds", "=", "secs", ")", ")", "self", ".", "resolution", "=", "datetime", ".", "timede...
Return a new Time instance from seconds since the POSIX epoch. The POSIX epoch is midnight Jan 1, 1970 UTC. According to POSIX, leap seconds don't exist, so one UTC day is exactly 86400 seconds, even if it wasn't. @param secs: a number of seconds, represented as an integer, long or ...
[ "Return", "a", "new", "Time", "instance", "from", "seconds", "since", "the", "POSIX", "epoch", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L607-L619
55,214
twisted/epsilon
epsilon/extime.py
Time.fromRFC2822
def fromRFC2822(klass, rfc822string): """ Return a new Time instance from a string formated as described in RFC 2822. @type rfc822string: str @raise ValueError: if the timestamp is not formatted properly (or if certain obsoleted elements of the specification are used). ...
python
def fromRFC2822(klass, rfc822string): """ Return a new Time instance from a string formated as described in RFC 2822. @type rfc822string: str @raise ValueError: if the timestamp is not formatted properly (or if certain obsoleted elements of the specification are used). ...
[ "def", "fromRFC2822", "(", "klass", ",", "rfc822string", ")", ":", "# parsedate_tz is going to give us a \"struct_time plus\", a 10-tuple", "# containing the 9 values a struct_time would, i.e.: (tm_year, tm_mon,", "# tm_day, tm_hour, tm_min, tm_sec, tm_wday, tm_yday, tm_isdst), plus a", "# bon...
Return a new Time instance from a string formated as described in RFC 2822. @type rfc822string: str @raise ValueError: if the timestamp is not formatted properly (or if certain obsoleted elements of the specification are used). @return: a new L{Time}
[ "Return", "a", "new", "Time", "instance", "from", "a", "string", "formated", "as", "described", "in", "RFC", "2822", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L623-L654
55,215
twisted/epsilon
epsilon/extime.py
Time.asDatetime
def asDatetime(self, tzinfo=None): """Return this time as an aware datetime.datetime instance. The returned datetime object has the specified tzinfo, or a tzinfo describing UTC if the tzinfo parameter is None. """ if tzinfo is None: tzinfo = FixedOffset(0, 0) ...
python
def asDatetime(self, tzinfo=None): """Return this time as an aware datetime.datetime instance. The returned datetime object has the specified tzinfo, or a tzinfo describing UTC if the tzinfo parameter is None. """ if tzinfo is None: tzinfo = FixedOffset(0, 0) ...
[ "def", "asDatetime", "(", "self", ",", "tzinfo", "=", "None", ")", ":", "if", "tzinfo", "is", "None", ":", "tzinfo", "=", "FixedOffset", "(", "0", ",", "0", ")", "if", "not", "self", ".", "isTimezoneDependent", "(", ")", ":", "return", "self", ".", ...
Return this time as an aware datetime.datetime instance. The returned datetime object has the specified tzinfo, or a tzinfo describing UTC if the tzinfo parameter is None.
[ "Return", "this", "time", "as", "an", "aware", "datetime", ".", "datetime", "instance", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L671-L683
55,216
twisted/epsilon
epsilon/extime.py
Time.asRFC2822
def asRFC2822(self, tzinfo=None, includeDayOfWeek=True): """Return this Time formatted as specified in RFC 2822. RFC 2822 specifies the format of email messages. RFC 2822 says times in email addresses should reflect the local timezone. If tzinfo is a datetime.tzinfo instance, the retur...
python
def asRFC2822(self, tzinfo=None, includeDayOfWeek=True): """Return this Time formatted as specified in RFC 2822. RFC 2822 specifies the format of email messages. RFC 2822 says times in email addresses should reflect the local timezone. If tzinfo is a datetime.tzinfo instance, the retur...
[ "def", "asRFC2822", "(", "self", ",", "tzinfo", "=", "None", ",", "includeDayOfWeek", "=", "True", ")", ":", "dtime", "=", "self", ".", "asDatetime", "(", "tzinfo", ")", "if", "tzinfo", "is", "None", ":", "rfcoffset", "=", "'-0000'", "else", ":", "rfco...
Return this Time formatted as specified in RFC 2822. RFC 2822 specifies the format of email messages. RFC 2822 says times in email addresses should reflect the local timezone. If tzinfo is a datetime.tzinfo instance, the returned formatted string will reflect that timezone. Otherwise, ...
[ "Return", "this", "Time", "formatted", "as", "specified", "in", "RFC", "2822", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L694-L728
55,217
twisted/epsilon
epsilon/extime.py
Time.asISO8601TimeAndDate
def asISO8601TimeAndDate(self, includeDelimiters=True, tzinfo=None, includeTimezone=True): """Return this time formatted as specified by ISO 8861. ISO 8601 allows optional dashes to delimit dates and colons to delimit times. The parameter includeDelimiters (default ...
python
def asISO8601TimeAndDate(self, includeDelimiters=True, tzinfo=None, includeTimezone=True): """Return this time formatted as specified by ISO 8861. ISO 8601 allows optional dashes to delimit dates and colons to delimit times. The parameter includeDelimiters (default ...
[ "def", "asISO8601TimeAndDate", "(", "self", ",", "includeDelimiters", "=", "True", ",", "tzinfo", "=", "None", ",", "includeTimezone", "=", "True", ")", ":", "if", "not", "self", ".", "isTimezoneDependent", "(", ")", ":", "tzinfo", "=", "None", "dtime", "=...
Return this time formatted as specified by ISO 8861. ISO 8601 allows optional dashes to delimit dates and colons to delimit times. The parameter includeDelimiters (default True) defines the inclusion of these delimiters in the output. If tzinfo is a datetime.tzinfo instance, the output...
[ "Return", "this", "time", "formatted", "as", "specified", "by", "ISO", "8861", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L742-L797
55,218
twisted/epsilon
epsilon/extime.py
Time.asStructTime
def asStructTime(self, tzinfo=None): """Return this time represented as a time.struct_time. tzinfo is a datetime.tzinfo instance coresponding to the desired timezone of the output. If is is the default None, UTC is assumed. """ dtime = self.asDatetime(tzinfo) if tzinfo i...
python
def asStructTime(self, tzinfo=None): """Return this time represented as a time.struct_time. tzinfo is a datetime.tzinfo instance coresponding to the desired timezone of the output. If is is the default None, UTC is assumed. """ dtime = self.asDatetime(tzinfo) if tzinfo i...
[ "def", "asStructTime", "(", "self", ",", "tzinfo", "=", "None", ")", ":", "dtime", "=", "self", ".", "asDatetime", "(", "tzinfo", ")", "if", "tzinfo", "is", "None", ":", "return", "dtime", ".", "utctimetuple", "(", ")", "else", ":", "return", "dtime", ...
Return this time represented as a time.struct_time. tzinfo is a datetime.tzinfo instance coresponding to the desired timezone of the output. If is is the default None, UTC is assumed.
[ "Return", "this", "time", "represented", "as", "a", "time", ".", "struct_time", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L799-L809
55,219
twisted/epsilon
epsilon/extime.py
Time.asHumanly
def asHumanly(self, tzinfo=None, now=None, precision=Precision.MINUTES): """Return this time as a short string, tailored to the current time. Parts of the date that can be assumed are omitted. Consequently, the output string depends on the current time. This is the format used for displ...
python
def asHumanly(self, tzinfo=None, now=None, precision=Precision.MINUTES): """Return this time as a short string, tailored to the current time. Parts of the date that can be assumed are omitted. Consequently, the output string depends on the current time. This is the format used for displ...
[ "def", "asHumanly", "(", "self", ",", "tzinfo", "=", "None", ",", "now", "=", "None", ",", "precision", "=", "Precision", ".", "MINUTES", ")", ":", "try", ":", "timeFormat", "=", "Time", ".", "_timeFormat", "[", "precision", "]", "except", "KeyError", ...
Return this time as a short string, tailored to the current time. Parts of the date that can be assumed are omitted. Consequently, the output string depends on the current time. This is the format used for displaying dates in most user visible places in the quotient web UI. By default,...
[ "Return", "this", "time", "as", "a", "short", "string", "tailored", "to", "the", "current", "time", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L811-L853
55,220
twisted/epsilon
epsilon/extime.py
Time.getBounds
def getBounds(self, tzinfo=None): """ Return a pair describing the bounds of self. This returns a pair (min, max) of Time instances. It is not quite the same as (self, self + self.resolution). This is because timezones are insignificant for instances with a resolution greater or...
python
def getBounds(self, tzinfo=None): """ Return a pair describing the bounds of self. This returns a pair (min, max) of Time instances. It is not quite the same as (self, self + self.resolution). This is because timezones are insignificant for instances with a resolution greater or...
[ "def", "getBounds", "(", "self", ",", "tzinfo", "=", "None", ")", ":", "if", "self", ".", "resolution", ">=", "datetime", ".", "timedelta", "(", "days", "=", "1", ")", "and", "tzinfo", "is", "not", "None", ":", "time", "=", "self", ".", "_time", "....
Return a pair describing the bounds of self. This returns a pair (min, max) of Time instances. It is not quite the same as (self, self + self.resolution). This is because timezones are insignificant for instances with a resolution greater or equal to 1 day. To illustrate the pr...
[ "Return", "a", "pair", "describing", "the", "bounds", "of", "self", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L859-L901
55,221
twisted/epsilon
epsilon/extime.py
Time.oneDay
def oneDay(self): """Return a Time instance representing the day of the start of self. The returned new instance will be set to midnight of the day containing the first instant of self in the specified timezone, and have a resolution of datetime.timedelta(days=1). """ da...
python
def oneDay(self): """Return a Time instance representing the day of the start of self. The returned new instance will be set to midnight of the day containing the first instant of self in the specified timezone, and have a resolution of datetime.timedelta(days=1). """ da...
[ "def", "oneDay", "(", "self", ")", ":", "day", "=", "self", ".", "__class__", ".", "fromDatetime", "(", "self", ".", "asDatetime", "(", ")", ".", "replace", "(", "hour", "=", "0", ",", "minute", "=", "0", ",", "second", "=", "0", ",", "microsecond"...
Return a Time instance representing the day of the start of self. The returned new instance will be set to midnight of the day containing the first instant of self in the specified timezone, and have a resolution of datetime.timedelta(days=1).
[ "Return", "a", "Time", "instance", "representing", "the", "day", "of", "the", "start", "of", "self", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/extime.py#L903-L913
55,222
CivicSpleen/ambry
ambry/util/__init__.py
expiring_memoize
def expiring_memoize(obj): """Like memoize, but forgets after 10 seconds.""" cache = obj.cache = {} last_access = obj.last_access = defaultdict(int) @wraps(obj) def memoizer(*args, **kwargs): key = str(args) + str(kwargs) if last_access[key] and last_access[key] + 10 < time(): ...
python
def expiring_memoize(obj): """Like memoize, but forgets after 10 seconds.""" cache = obj.cache = {} last_access = obj.last_access = defaultdict(int) @wraps(obj) def memoizer(*args, **kwargs): key = str(args) + str(kwargs) if last_access[key] and last_access[key] + 10 < time(): ...
[ "def", "expiring_memoize", "(", "obj", ")", ":", "cache", "=", "obj", ".", "cache", "=", "{", "}", "last_access", "=", "obj", ".", "last_access", "=", "defaultdict", "(", "int", ")", "@", "wraps", "(", "obj", ")", "def", "memoizer", "(", "*", "args",...
Like memoize, but forgets after 10 seconds.
[ "Like", "memoize", "but", "forgets", "after", "10", "seconds", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L88-L108
55,223
CivicSpleen/ambry
ambry/util/__init__.py
md5_for_file
def md5_for_file(f, block_size=2 ** 20): """Generate an MD5 has for a possibly large file by breaking it into chunks.""" md5 = hashlib.md5() try: # Guess that f is a FLO. f.seek(0) return md5_for_stream(f, block_size=block_size) except AttributeError: # Nope, not a...
python
def md5_for_file(f, block_size=2 ** 20): """Generate an MD5 has for a possibly large file by breaking it into chunks.""" md5 = hashlib.md5() try: # Guess that f is a FLO. f.seek(0) return md5_for_stream(f, block_size=block_size) except AttributeError: # Nope, not a...
[ "def", "md5_for_file", "(", "f", ",", "block_size", "=", "2", "**", "20", ")", ":", "md5", "=", "hashlib", ".", "md5", "(", ")", "try", ":", "# Guess that f is a FLO.", "f", ".", "seek", "(", "0", ")", "return", "md5_for_stream", "(", "f", ",", "bloc...
Generate an MD5 has for a possibly large file by breaking it into chunks.
[ "Generate", "an", "MD5", "has", "for", "a", "possibly", "large", "file", "by", "breaking", "it", "into", "chunks", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L637-L653
55,224
CivicSpleen/ambry
ambry/util/__init__.py
make_acro
def make_acro(past, prefix, s): # pragma: no cover """Create a three letter acronym from the input string s. Args: past: A set object, for storing acronyms that have already been created prefix: A prefix added to the acronym before storing in the set s: The string to create the acronym...
python
def make_acro(past, prefix, s): # pragma: no cover """Create a three letter acronym from the input string s. Args: past: A set object, for storing acronyms that have already been created prefix: A prefix added to the acronym before storing in the set s: The string to create the acronym...
[ "def", "make_acro", "(", "past", ",", "prefix", ",", "s", ")", ":", "# pragma: no cover", "def", "_make_acro", "(", "s", ",", "t", "=", "0", ")", ":", "\"\"\"Make an acronym of s for trial t\"\"\"", "# Really should cache these ...", "v", "=", "[", "'a'", ",", ...
Create a three letter acronym from the input string s. Args: past: A set object, for storing acronyms that have already been created prefix: A prefix added to the acronym before storing in the set s: The string to create the acronym from.
[ "Create", "a", "three", "letter", "acronym", "from", "the", "input", "string", "s", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L656-L737
55,225
CivicSpleen/ambry
ambry/util/__init__.py
ensure_dir_exists
def ensure_dir_exists(path): """Given a file, ensure that the path to the file exists""" import os f_dir = os.path.dirname(path) if not os.path.exists(f_dir): os.makedirs(f_dir) return f_dir
python
def ensure_dir_exists(path): """Given a file, ensure that the path to the file exists""" import os f_dir = os.path.dirname(path) if not os.path.exists(f_dir): os.makedirs(f_dir) return f_dir
[ "def", "ensure_dir_exists", "(", "path", ")", ":", "import", "os", "f_dir", "=", "os", ".", "path", ".", "dirname", "(", "path", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "f_dir", ")", ":", "os", ".", "makedirs", "(", "f_dir", ")", ...
Given a file, ensure that the path to the file exists
[ "Given", "a", "file", "ensure", "that", "the", "path", "to", "the", "file", "exists" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L740-L750
55,226
CivicSpleen/ambry
ambry/util/__init__.py
init_log_rate
def init_log_rate(output_f, N=None, message='', print_rate=None): """Initialze the log_rate function. Returnas a partial function to call for each event. If N is not specified but print_rate is specified, the initial N is set to 100, and after the first message, the N value is adjusted to emit prin...
python
def init_log_rate(output_f, N=None, message='', print_rate=None): """Initialze the log_rate function. Returnas a partial function to call for each event. If N is not specified but print_rate is specified, the initial N is set to 100, and after the first message, the N value is adjusted to emit prin...
[ "def", "init_log_rate", "(", "output_f", ",", "N", "=", "None", ",", "message", "=", "''", ",", "print_rate", "=", "None", ")", ":", "if", "print_rate", "and", "not", "N", ":", "N", "=", "100", "if", "not", "N", ":", "N", "=", "5000", "d", "=", ...
Initialze the log_rate function. Returnas a partial function to call for each event. If N is not specified but print_rate is specified, the initial N is set to 100, and after the first message, the N value is adjusted to emit print_rate messages per second
[ "Initialze", "the", "log_rate", "function", ".", "Returnas", "a", "partial", "function", "to", "call", "for", "each", "event", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L781-L812
55,227
CivicSpleen/ambry
ambry/util/__init__.py
_log_rate
def _log_rate(output_f, d, message=None): """Log a message for the Nth time the method is called. d is the object returned from init_log_rate """ if d[2] <= 0: if message is None: message = d[4] # Average the rate over the length of the deque. d[6].append(int(d[3...
python
def _log_rate(output_f, d, message=None): """Log a message for the Nth time the method is called. d is the object returned from init_log_rate """ if d[2] <= 0: if message is None: message = d[4] # Average the rate over the length of the deque. d[6].append(int(d[3...
[ "def", "_log_rate", "(", "output_f", ",", "d", ",", "message", "=", "None", ")", ":", "if", "d", "[", "2", "]", "<=", "0", ":", "if", "message", "is", "None", ":", "message", "=", "d", "[", "4", "]", "# Average the rate over the length of the deque.", ...
Log a message for the Nth time the method is called. d is the object returned from init_log_rate
[ "Log", "a", "message", "for", "the", "Nth", "time", "the", "method", "is", "called", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L815-L845
55,228
CivicSpleen/ambry
ambry/util/__init__.py
count_open_fds
def count_open_fds(): """return the number of open file descriptors for current process. .. warning: will only work on UNIX-like os-es. http://stackoverflow.com/a/7142094 """ pid = os.getpid() procs = subprocess.check_output( ['lsof', '-w', '-Ff', '-p', str(pid)]) nprocs = len( ...
python
def count_open_fds(): """return the number of open file descriptors for current process. .. warning: will only work on UNIX-like os-es. http://stackoverflow.com/a/7142094 """ pid = os.getpid() procs = subprocess.check_output( ['lsof', '-w', '-Ff', '-p', str(pid)]) nprocs = len( ...
[ "def", "count_open_fds", "(", ")", ":", "pid", "=", "os", ".", "getpid", "(", ")", "procs", "=", "subprocess", ".", "check_output", "(", "[", "'lsof'", ",", "'-w'", ",", "'-Ff'", ",", "'-p'", ",", "str", "(", "pid", ")", "]", ")", "nprocs", "=", ...
return the number of open file descriptors for current process. .. warning: will only work on UNIX-like os-es. http://stackoverflow.com/a/7142094
[ "return", "the", "number", "of", "open", "file", "descriptors", "for", "current", "process", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L917-L933
55,229
CivicSpleen/ambry
ambry/util/__init__.py
parse_url_to_dict
def parse_url_to_dict(url): """Parse a url and return a dict with keys for all of the parts. The urlparse function() returns a wacky combination of a namedtuple with properties. """ p = urlparse(url) return { 'scheme': p.scheme, 'netloc': p.netloc, 'path': p.path, ...
python
def parse_url_to_dict(url): """Parse a url and return a dict with keys for all of the parts. The urlparse function() returns a wacky combination of a namedtuple with properties. """ p = urlparse(url) return { 'scheme': p.scheme, 'netloc': p.netloc, 'path': p.path, ...
[ "def", "parse_url_to_dict", "(", "url", ")", ":", "p", "=", "urlparse", "(", "url", ")", "return", "{", "'scheme'", ":", "p", ".", "scheme", ",", "'netloc'", ":", "p", ".", "netloc", ",", "'path'", ":", "p", ".", "path", ",", "'params'", ":", "p", ...
Parse a url and return a dict with keys for all of the parts. The urlparse function() returns a wacky combination of a namedtuple with properties.
[ "Parse", "a", "url", "and", "return", "a", "dict", "with", "keys", "for", "all", "of", "the", "parts", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L936-L956
55,230
CivicSpleen/ambry
ambry/util/__init__.py
set_url_part
def set_url_part(url, **kwargs): """Change one or more parts of a URL""" d = parse_url_to_dict(url) d.update(kwargs) return unparse_url_dict(d)
python
def set_url_part(url, **kwargs): """Change one or more parts of a URL""" d = parse_url_to_dict(url) d.update(kwargs) return unparse_url_dict(d)
[ "def", "set_url_part", "(", "url", ",", "*", "*", "kwargs", ")", ":", "d", "=", "parse_url_to_dict", "(", "url", ")", "d", ".", "update", "(", "kwargs", ")", "return", "unparse_url_dict", "(", "d", ")" ]
Change one or more parts of a URL
[ "Change", "one", "or", "more", "parts", "of", "a", "URL" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L987-L993
55,231
CivicSpleen/ambry
ambry/util/__init__.py
filter_url
def filter_url(url, **kwargs): """filter a URL by returning a URL with only the parts specified in the keywords""" d = parse_url_to_dict(url) d.update(kwargs) return unparse_url_dict({k: v for k, v in list(d.items()) if v})
python
def filter_url(url, **kwargs): """filter a URL by returning a URL with only the parts specified in the keywords""" d = parse_url_to_dict(url) d.update(kwargs) return unparse_url_dict({k: v for k, v in list(d.items()) if v})
[ "def", "filter_url", "(", "url", ",", "*", "*", "kwargs", ")", ":", "d", "=", "parse_url_to_dict", "(", "url", ")", "d", ".", "update", "(", "kwargs", ")", "return", "unparse_url_dict", "(", "{", "k", ":", "v", "for", "k", ",", "v", "in", "list", ...
filter a URL by returning a URL with only the parts specified in the keywords
[ "filter", "a", "URL", "by", "returning", "a", "URL", "with", "only", "the", "parts", "specified", "in", "the", "keywords" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L996-L1003
55,232
CivicSpleen/ambry
ambry/util/__init__.py
print_yaml
def print_yaml(o): """Pretty print an object as YAML.""" print(yaml.dump(o, default_flow_style=False, indent=4, encoding='utf-8'))
python
def print_yaml(o): """Pretty print an object as YAML.""" print(yaml.dump(o, default_flow_style=False, indent=4, encoding='utf-8'))
[ "def", "print_yaml", "(", "o", ")", ":", "print", "(", "yaml", ".", "dump", "(", "o", ",", "default_flow_style", "=", "False", ",", "indent", "=", "4", ",", "encoding", "=", "'utf-8'", ")", ")" ]
Pretty print an object as YAML.
[ "Pretty", "print", "an", "object", "as", "YAML", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L1016-L1018
55,233
CivicSpleen/ambry
ambry/util/__init__.py
qualified_class_name
def qualified_class_name(o): """Full name of an object, including the module""" module = o.__class__.__module__ if module is None or module == str.__class__.__module__: return o.__class__.__name__ return module + '.' + o.__class__.__name__
python
def qualified_class_name(o): """Full name of an object, including the module""" module = o.__class__.__module__ if module is None or module == str.__class__.__module__: return o.__class__.__name__ return module + '.' + o.__class__.__name__
[ "def", "qualified_class_name", "(", "o", ")", ":", "module", "=", "o", ".", "__class__", ".", "__module__", "if", "module", "is", "None", "or", "module", "==", "str", ".", "__class__", ".", "__module__", ":", "return", "o", ".", "__class__", ".", "__name...
Full name of an object, including the module
[ "Full", "name", "of", "an", "object", "including", "the", "module" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L1021-L1026
55,234
CivicSpleen/ambry
ambry/util/__init__.py
drop_empty
def drop_empty(rows): """Transpose the columns into rows, remove all of the rows that are empty after the first cell, then transpose back. The result is that columns that have a header but no data in the body are removed, assuming the header is the first row. """ return zip(*[col for col in zip(*rows) i...
python
def drop_empty(rows): """Transpose the columns into rows, remove all of the rows that are empty after the first cell, then transpose back. The result is that columns that have a header but no data in the body are removed, assuming the header is the first row. """ return zip(*[col for col in zip(*rows) i...
[ "def", "drop_empty", "(", "rows", ")", ":", "return", "zip", "(", "*", "[", "col", "for", "col", "in", "zip", "(", "*", "rows", ")", "if", "bool", "(", "filter", "(", "bool", ",", "col", "[", "1", ":", "]", ")", ")", "]", ")" ]
Transpose the columns into rows, remove all of the rows that are empty after the first cell, then transpose back. The result is that columns that have a header but no data in the body are removed, assuming the header is the first row.
[ "Transpose", "the", "columns", "into", "rows", "remove", "all", "of", "the", "rows", "that", "are", "empty", "after", "the", "first", "cell", "then", "transpose", "back", ".", "The", "result", "is", "that", "columns", "that", "have", "a", "header", "but", ...
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L1184-L1188
55,235
CivicSpleen/ambry
ambry/util/__init__.py
pretty_time
def pretty_time(s, granularity=3): """Pretty print time in seconds. COnverts the input time in seconds into a string with interval names, such as days, hours and minutes From: http://stackoverflow.com/a/24542445/1144479 """ intervals = ( ('weeks', 604800), # 60 * 60 * 24 * 7 ...
python
def pretty_time(s, granularity=3): """Pretty print time in seconds. COnverts the input time in seconds into a string with interval names, such as days, hours and minutes From: http://stackoverflow.com/a/24542445/1144479 """ intervals = ( ('weeks', 604800), # 60 * 60 * 24 * 7 ...
[ "def", "pretty_time", "(", "s", ",", "granularity", "=", "3", ")", ":", "intervals", "=", "(", "(", "'weeks'", ",", "604800", ")", ",", "# 60 * 60 * 24 * 7", "(", "'days'", ",", "86400", ")", ",", "# 60 * 60 * 24", "(", "'hours'", ",", "3600", ")", ","...
Pretty print time in seconds. COnverts the input time in seconds into a string with interval names, such as days, hours and minutes From: http://stackoverflow.com/a/24542445/1144479
[ "Pretty", "print", "time", "in", "seconds", ".", "COnverts", "the", "input", "time", "in", "seconds", "into", "a", "string", "with", "interval", "names", "such", "as", "days", "hours", "and", "minutes" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L1205-L1235
55,236
CivicSpleen/ambry
ambry/util/__init__.py
Proxy._create_class_proxy
def _create_class_proxy(cls, theclass): """creates a proxy for the given class""" def make_method(name): def method(self, *args, **kw): return getattr(object.__getattribute__(self, "_obj"), name)(*args, **kw) return method namespace = {} for name...
python
def _create_class_proxy(cls, theclass): """creates a proxy for the given class""" def make_method(name): def method(self, *args, **kw): return getattr(object.__getattribute__(self, "_obj"), name)(*args, **kw) return method namespace = {} for name...
[ "def", "_create_class_proxy", "(", "cls", ",", "theclass", ")", ":", "def", "make_method", "(", "name", ")", ":", "def", "method", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "return", "getattr", "(", "object", ".", "__getattribute__"...
creates a proxy for the given class
[ "creates", "a", "proxy", "for", "the", "given", "class" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/util/__init__.py#L1312-L1324
55,237
SmartTeleMax/iktomi
iktomi/cli/base.py
Cli.description
def description(self, argv0='manage.py', command=None): '''Description outputed to console''' command = command or self.__class__.__name__.lower() import inspect _help = u'' _help += u'{}\n'.format(command) if self.__doc__: _help += self._fix_docstring(self.__...
python
def description(self, argv0='manage.py', command=None): '''Description outputed to console''' command = command or self.__class__.__name__.lower() import inspect _help = u'' _help += u'{}\n'.format(command) if self.__doc__: _help += self._fix_docstring(self.__...
[ "def", "description", "(", "self", ",", "argv0", "=", "'manage.py'", ",", "command", "=", "None", ")", ":", "command", "=", "command", "or", "self", ".", "__class__", ".", "__name__", ".", "lower", "(", ")", "import", "inspect", "_help", "=", "u''", "_...
Description outputed to console
[ "Description", "outputed", "to", "console" ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/cli/base.py#L139-L164
55,238
twisted/epsilon
doc/listings/amp/amp_auth_server.py
AdditionRealm.requestAvatar
def requestAvatar(self, avatarId, mind, *interfaces): """ Create Adder avatars for any IBoxReceiver request. """ if IBoxReceiver in interfaces: return (IBoxReceiver, Adder(avatarId), lambda: None) raise NotImplementedError()
python
def requestAvatar(self, avatarId, mind, *interfaces): """ Create Adder avatars for any IBoxReceiver request. """ if IBoxReceiver in interfaces: return (IBoxReceiver, Adder(avatarId), lambda: None) raise NotImplementedError()
[ "def", "requestAvatar", "(", "self", ",", "avatarId", ",", "mind", ",", "*", "interfaces", ")", ":", "if", "IBoxReceiver", "in", "interfaces", ":", "return", "(", "IBoxReceiver", ",", "Adder", "(", "avatarId", ")", ",", "lambda", ":", "None", ")", "raise...
Create Adder avatars for any IBoxReceiver request.
[ "Create", "Adder", "avatars", "for", "any", "IBoxReceiver", "request", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/doc/listings/amp/amp_auth_server.py#L52-L58
55,239
SmartTeleMax/iktomi
iktomi/web/app.py
Application.handle_error
def handle_error(self, env): ''' Unhandled exception handler. You can put any logging, error warning, etc here.''' logger.exception('Exception for %s %s :', env.request.method, env.request.url)
python
def handle_error(self, env): ''' Unhandled exception handler. You can put any logging, error warning, etc here.''' logger.exception('Exception for %s %s :', env.request.method, env.request.url)
[ "def", "handle_error", "(", "self", ",", "env", ")", ":", "logger", ".", "exception", "(", "'Exception for %s %s :'", ",", "env", ".", "request", ".", "method", ",", "env", ".", "request", ".", "url", ")" ]
Unhandled exception handler. You can put any logging, error warning, etc here.
[ "Unhandled", "exception", "handler", ".", "You", "can", "put", "any", "logging", "error", "warning", "etc", "here", "." ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/web/app.py#L92-L97
55,240
twisted/epsilon
epsilon/expose.py
Exposer.get
def get(self, obj, key): """ Retrieve 'key' from an instance of a class which previously exposed it. @param key: a hashable object, previously passed to L{Exposer.expose}. @return: the object which was exposed with the given name on obj's key. @raise MethodNotExposed: when the...
python
def get(self, obj, key): """ Retrieve 'key' from an instance of a class which previously exposed it. @param key: a hashable object, previously passed to L{Exposer.expose}. @return: the object which was exposed with the given name on obj's key. @raise MethodNotExposed: when the...
[ "def", "get", "(", "self", ",", "obj", ",", "key", ")", ":", "if", "key", "not", "in", "self", ".", "_exposed", ":", "raise", "MethodNotExposed", "(", ")", "rightFuncs", "=", "self", ".", "_exposed", "[", "key", "]", "T", "=", "obj", ".", "__class_...
Retrieve 'key' from an instance of a class which previously exposed it. @param key: a hashable object, previously passed to L{Exposer.expose}. @return: the object which was exposed with the given name on obj's key. @raise MethodNotExposed: when the key in question was not exposed with ...
[ "Retrieve", "key", "from", "an", "instance", "of", "a", "class", "which", "previously", "exposed", "it", "." ]
e85fa985a41983ef06e1d3bb26639181e1f78b24
https://github.com/twisted/epsilon/blob/e85fa985a41983ef06e1d3bb26639181e1f78b24/epsilon/expose.py#L117-L141
55,241
SmartTeleMax/iktomi
iktomi/utils/url.py
repercent_broken_unicode
def repercent_broken_unicode(path): """ As per section 3.2 of RFC 3987, step three of converting a URI into an IRI, we need to re-percent-encode any octet produced that is not part of a strictly legal UTF-8 octet sequence. """ # originally from django.utils.encoding while True: try: ...
python
def repercent_broken_unicode(path): """ As per section 3.2 of RFC 3987, step three of converting a URI into an IRI, we need to re-percent-encode any octet produced that is not part of a strictly legal UTF-8 octet sequence. """ # originally from django.utils.encoding while True: try: ...
[ "def", "repercent_broken_unicode", "(", "path", ")", ":", "# originally from django.utils.encoding", "while", "True", ":", "try", ":", "return", "path", ".", "decode", "(", "'utf-8'", ")", "except", "UnicodeDecodeError", "as", "e", ":", "repercent", "=", "quote", ...
As per section 3.2 of RFC 3987, step three of converting a URI into an IRI, we need to re-percent-encode any octet produced that is not part of a strictly legal UTF-8 octet sequence.
[ "As", "per", "section", "3", ".", "2", "of", "RFC", "3987", "step", "three", "of", "converting", "a", "URI", "into", "an", "IRI", "we", "need", "to", "re", "-", "percent", "-", "encode", "any", "octet", "produced", "that", "is", "not", "part", "of", ...
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/utils/url.py#L49-L61
55,242
SmartTeleMax/iktomi
iktomi/utils/url.py
uri_to_iri_parts
def uri_to_iri_parts(path, query, fragment): r""" Converts a URI parts to corresponding IRI parts in a given charset. Examples for URI versus IRI: :param path: The path of URI to convert. :param query: The query string of URI to convert. :param fragment: The fragment of URI to convert. """...
python
def uri_to_iri_parts(path, query, fragment): r""" Converts a URI parts to corresponding IRI parts in a given charset. Examples for URI versus IRI: :param path: The path of URI to convert. :param query: The query string of URI to convert. :param fragment: The fragment of URI to convert. """...
[ "def", "uri_to_iri_parts", "(", "path", ",", "query", ",", "fragment", ")", ":", "path", "=", "url_unquote", "(", "path", ",", "'%/;?'", ")", "query", "=", "url_unquote", "(", "query", ",", "'%;/?:@&=+,$#'", ")", "fragment", "=", "url_unquote", "(", "fragm...
r""" Converts a URI parts to corresponding IRI parts in a given charset. Examples for URI versus IRI: :param path: The path of URI to convert. :param query: The query string of URI to convert. :param fragment: The fragment of URI to convert.
[ "r", "Converts", "a", "URI", "parts", "to", "corresponding", "IRI", "parts", "in", "a", "given", "charset", "." ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/utils/url.py#L64-L77
55,243
CivicSpleen/ambry
ambry/support/__init__.py
default_bundle_config
def default_bundle_config(): """Return the default bundle config file as an AttrDict.""" import os from ambry.util import AttrDict config = AttrDict() f = os.path.join( os.path.dirname( os.path.realpath(__file__)), 'bundle.yaml') config.update_yaml(f) return c...
python
def default_bundle_config(): """Return the default bundle config file as an AttrDict.""" import os from ambry.util import AttrDict config = AttrDict() f = os.path.join( os.path.dirname( os.path.realpath(__file__)), 'bundle.yaml') config.update_yaml(f) return c...
[ "def", "default_bundle_config", "(", ")", ":", "import", "os", "from", "ambry", ".", "util", "import", "AttrDict", "config", "=", "AttrDict", "(", ")", "f", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", ...
Return the default bundle config file as an AttrDict.
[ "Return", "the", "default", "bundle", "config", "file", "as", "an", "AttrDict", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/support/__init__.py#L2-L16
55,244
CivicSpleen/ambry
setup.py
find_package_data
def find_package_data(): """ Returns package_data, because setuptools is too stupid to handle nested directories. Returns: dict: key is "ambry", value is list of paths. """ l = list() for start in ('ambry/support', 'ambry/bundle/default_files'): for root, dirs, files in os.walk(sta...
python
def find_package_data(): """ Returns package_data, because setuptools is too stupid to handle nested directories. Returns: dict: key is "ambry", value is list of paths. """ l = list() for start in ('ambry/support', 'ambry/bundle/default_files'): for root, dirs, files in os.walk(sta...
[ "def", "find_package_data", "(", ")", ":", "l", "=", "list", "(", ")", "for", "start", "in", "(", "'ambry/support'", ",", "'ambry/bundle/default_files'", ")", ":", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "start", ")", ":...
Returns package_data, because setuptools is too stupid to handle nested directories. Returns: dict: key is "ambry", value is list of paths.
[ "Returns", "package_data", "because", "setuptools", "is", "too", "stupid", "to", "handle", "nested", "directories", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/setup.py#L29-L49
55,245
CivicSpleen/ambry
ambry/orm/file.py
File.update
def update(self, of): """Update a file from another file, for copying""" # The other values should be set when the file object is created with dataset.bsfile() for p in ('mime_type', 'preference', 'state', 'hash', 'modified', 'size', 'contents', 'source_hash', 'data'): setattr(self,...
python
def update(self, of): """Update a file from another file, for copying""" # The other values should be set when the file object is created with dataset.bsfile() for p in ('mime_type', 'preference', 'state', 'hash', 'modified', 'size', 'contents', 'source_hash', 'data'): setattr(self,...
[ "def", "update", "(", "self", ",", "of", ")", ":", "# The other values should be set when the file object is created with dataset.bsfile()", "for", "p", "in", "(", "'mime_type'", ",", "'preference'", ",", "'state'", ",", "'hash'", ",", "'modified'", ",", "'size'", ","...
Update a file from another file, for copying
[ "Update", "a", "file", "from", "another", "file", "for", "copying" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/file.py#L80-L87
55,246
CivicSpleen/ambry
ambry/orm/file.py
File.dict_row_reader
def dict_row_reader(self): """ Unpacks message pack rows into a stream of dicts. """ rows = self.unpacked_contents if not rows: return header = rows.pop(0) for row in rows: yield dict(list(zip(header, row)))
python
def dict_row_reader(self): """ Unpacks message pack rows into a stream of dicts. """ rows = self.unpacked_contents if not rows: return header = rows.pop(0) for row in rows: yield dict(list(zip(header, row)))
[ "def", "dict_row_reader", "(", "self", ")", ":", "rows", "=", "self", ".", "unpacked_contents", "if", "not", "rows", ":", "return", "header", "=", "rows", ".", "pop", "(", "0", ")", "for", "row", "in", "rows", ":", "yield", "dict", "(", "list", "(", ...
Unpacks message pack rows into a stream of dicts.
[ "Unpacks", "message", "pack", "rows", "into", "a", "stream", "of", "dicts", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/file.py#L110-L121
55,247
CivicSpleen/ambry
ambry/orm/file.py
File.update_contents
def update_contents(self, contents, mime_type): """Update the contents and set the hash and modification time""" import hashlib import time new_size = len(contents) self.mime_type = mime_type if mime_type == 'text/plain': self.contents = contents.encode('ut...
python
def update_contents(self, contents, mime_type): """Update the contents and set the hash and modification time""" import hashlib import time new_size = len(contents) self.mime_type = mime_type if mime_type == 'text/plain': self.contents = contents.encode('ut...
[ "def", "update_contents", "(", "self", ",", "contents", ",", "mime_type", ")", ":", "import", "hashlib", "import", "time", "new_size", "=", "len", "(", "contents", ")", "self", ".", "mime_type", "=", "mime_type", "if", "mime_type", "==", "'text/plain'", ":",...
Update the contents and set the hash and modification time
[ "Update", "the", "contents", "and", "set", "the", "hash", "and", "modification", "time" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/file.py#L123-L144
55,248
project-ncl/pnc-cli
pnc_cli/swagger_client/api_client.py
ApiClient.__deserialize_datetime
def __deserialize_datetime(self, string): """ Deserializes string to datetime. The string should be in iso8601 datetime format. :param string: str. :return: datetime. """ try: from dateutil.parser import parse timestr = str(datetime.fromt...
python
def __deserialize_datetime(self, string): """ Deserializes string to datetime. The string should be in iso8601 datetime format. :param string: str. :return: datetime. """ try: from dateutil.parser import parse timestr = str(datetime.fromt...
[ "def", "__deserialize_datetime", "(", "self", ",", "string", ")", ":", "try", ":", "from", "dateutil", ".", "parser", "import", "parse", "timestr", "=", "str", "(", "datetime", ".", "fromtimestamp", "(", "string", "/", "1000", ")", ")", "return", "parse", ...
Deserializes string to datetime. The string should be in iso8601 datetime format. :param string: str. :return: datetime.
[ "Deserializes", "string", "to", "datetime", "." ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/swagger_client/api_client.py#L589-L611
55,249
solidsnack/tsv
tsv.py
un
def un(source, wrapper=list, error_bad_lines=True): """Parse a text stream to TSV If the source is a string, it is converted to a line-iterable stream. If it is a file handle or other object, we assume that we can iterate over the lines in it. The result is a generator, and what it contains depend...
python
def un(source, wrapper=list, error_bad_lines=True): """Parse a text stream to TSV If the source is a string, it is converted to a line-iterable stream. If it is a file handle or other object, we assume that we can iterate over the lines in it. The result is a generator, and what it contains depend...
[ "def", "un", "(", "source", ",", "wrapper", "=", "list", ",", "error_bad_lines", "=", "True", ")", ":", "if", "isinstance", "(", "source", ",", "six", ".", "string_types", ")", ":", "source", "=", "six", ".", "StringIO", "(", "source", ")", "# Prepare ...
Parse a text stream to TSV If the source is a string, it is converted to a line-iterable stream. If it is a file handle or other object, we assume that we can iterate over the lines in it. The result is a generator, and what it contains depends on whether the second argument is set and what it is ...
[ "Parse", "a", "text", "stream", "to", "TSV" ]
2d3c0f45477c8ffbed5cd61050855c4e4617e6be
https://github.com/solidsnack/tsv/blob/2d3c0f45477c8ffbed5cd61050855c4e4617e6be/tsv.py#L10-L52
55,250
solidsnack/tsv
tsv.py
to
def to(items, output=None): """Present a collection of items as TSV The items in the collection can themselves be any iterable collection. (Single field structures should be represented as one tuples.) With no output parameter, a generator of strings is returned. If an output parameter is passed, ...
python
def to(items, output=None): """Present a collection of items as TSV The items in the collection can themselves be any iterable collection. (Single field structures should be represented as one tuples.) With no output parameter, a generator of strings is returned. If an output parameter is passed, ...
[ "def", "to", "(", "items", ",", "output", "=", "None", ")", ":", "strings", "=", "(", "format_collection", "(", "item", ")", "for", "item", "in", "items", ")", "if", "output", "is", "None", ":", "return", "strings", "else", ":", "for", "s", "in", "...
Present a collection of items as TSV The items in the collection can themselves be any iterable collection. (Single field structures should be represented as one tuples.) With no output parameter, a generator of strings is returned. If an output parameter is passed, it should be a file-like object. Ou...
[ "Present", "a", "collection", "of", "items", "as", "TSV" ]
2d3c0f45477c8ffbed5cd61050855c4e4617e6be
https://github.com/solidsnack/tsv/blob/2d3c0f45477c8ffbed5cd61050855c4e4617e6be/tsv.py#L112-L127
55,251
CivicSpleen/ambry
ambry/cli/bundle.py
get_bundle_ref
def get_bundle_ref(args, l, use_history=False): """ Use a variety of methods to determine which bundle to use :param args: :return: """ if not use_history: if args.id: return (args.id, '-i argument') if hasattr(args, 'bundle_ref') and args.bundle_ref: retu...
python
def get_bundle_ref(args, l, use_history=False): """ Use a variety of methods to determine which bundle to use :param args: :return: """ if not use_history: if args.id: return (args.id, '-i argument') if hasattr(args, 'bundle_ref') and args.bundle_ref: retu...
[ "def", "get_bundle_ref", "(", "args", ",", "l", ",", "use_history", "=", "False", ")", ":", "if", "not", "use_history", ":", "if", "args", ".", "id", ":", "return", "(", "args", ".", "id", ",", "'-i argument'", ")", "if", "hasattr", "(", "args", ",",...
Use a variety of methods to determine which bundle to use :param args: :return:
[ "Use", "a", "variety", "of", "methods", "to", "determine", "which", "bundle", "to", "use" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/cli/bundle.py#L535-L573
55,252
CivicSpleen/ambry
ambry/cli/bundle.py
bundle_variant
def bundle_variant(args, l, rc): """Create a new bundle as a variant of an existing bundle""" from ambry.orm.exc import ConflictError ob = l.bundle(args.ref) d = dict( dataset=args.dataset or ob.identity.dataset, revision=args.revision, source=args.source or ob.identity.source...
python
def bundle_variant(args, l, rc): """Create a new bundle as a variant of an existing bundle""" from ambry.orm.exc import ConflictError ob = l.bundle(args.ref) d = dict( dataset=args.dataset or ob.identity.dataset, revision=args.revision, source=args.source or ob.identity.source...
[ "def", "bundle_variant", "(", "args", ",", "l", ",", "rc", ")", ":", "from", "ambry", ".", "orm", ".", "exc", "import", "ConflictError", "ob", "=", "l", ".", "bundle", "(", "args", ".", "ref", ")", "d", "=", "dict", "(", "dataset", "=", "args", "...
Create a new bundle as a variant of an existing bundle
[ "Create", "a", "new", "bundle", "as", "a", "variant", "of", "an", "existing", "bundle" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/cli/bundle.py#L802-L845
55,253
CivicSpleen/ambry
ambry/cli/bundle.py
bundle_new
def bundle_new(args, l, rc): """Create a new bundle""" from ambry.orm.exc import ConflictError d = dict( dataset=args.dataset, revision=args.revision, source=args.source, bspace=args.space, subset=args.subset, btime=args.time, variation=args.variatio...
python
def bundle_new(args, l, rc): """Create a new bundle""" from ambry.orm.exc import ConflictError d = dict( dataset=args.dataset, revision=args.revision, source=args.source, bspace=args.space, subset=args.subset, btime=args.time, variation=args.variatio...
[ "def", "bundle_new", "(", "args", ",", "l", ",", "rc", ")", ":", "from", "ambry", ".", "orm", ".", "exc", "import", "ConflictError", "d", "=", "dict", "(", "dataset", "=", "args", ".", "dataset", ",", "revision", "=", "args", ".", "revision", ",", ...
Create a new bundle
[ "Create", "a", "new", "bundle" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/cli/bundle.py#L1408-L1452
55,254
ambitioninc/django-dynamic-initial-data
dynamic_initial_data/base.py
InitialDataUpdater.handle_deletions
def handle_deletions(self): """ Manages handling deletions of objects that were previously managed by the initial data process but no longer managed. It does so by mantaining a list of receipts for model objects that are registered for deletion on each round of initial data processing. A...
python
def handle_deletions(self): """ Manages handling deletions of objects that were previously managed by the initial data process but no longer managed. It does so by mantaining a list of receipts for model objects that are registered for deletion on each round of initial data processing. A...
[ "def", "handle_deletions", "(", "self", ")", ":", "deduplicated_objs", "=", "{", "}", "for", "model", "in", "self", ".", "model_objs_registered_for_deletion", ":", "key", "=", "'{0}:{1}'", ".", "format", "(", "ContentType", ".", "objects", ".", "get_for_model", ...
Manages handling deletions of objects that were previously managed by the initial data process but no longer managed. It does so by mantaining a list of receipts for model objects that are registered for deletion on each round of initial data processing. Any receipts that are from previous rounds and no...
[ "Manages", "handling", "deletions", "of", "objects", "that", "were", "previously", "managed", "by", "the", "initial", "data", "process", "but", "no", "longer", "managed", ".", "It", "does", "so", "by", "mantaining", "a", "list", "of", "receipts", "for", "mod...
27b7bf4ac31b465cc14127832d0d4b97362cc40f
https://github.com/ambitioninc/django-dynamic-initial-data/blob/27b7bf4ac31b465cc14127832d0d4b97362cc40f/dynamic_initial_data/base.py#L149-L187
55,255
ambitioninc/django-dynamic-initial-data
dynamic_initial_data/base.py
InitialDataUpdater.update_all_apps
def update_all_apps(self): """ Loops through all app names contained in settings.INSTALLED_APPS and calls `update_app` on each one. Handles any object deletions that happened after all apps have been initialized. """ for app in apps.get_app_configs(): self.update_app(...
python
def update_all_apps(self): """ Loops through all app names contained in settings.INSTALLED_APPS and calls `update_app` on each one. Handles any object deletions that happened after all apps have been initialized. """ for app in apps.get_app_configs(): self.update_app(...
[ "def", "update_all_apps", "(", "self", ")", ":", "for", "app", "in", "apps", ".", "get_app_configs", "(", ")", ":", "self", ".", "update_app", "(", "app", ".", "name", ")", "# During update_app, all apps added model objects that were registered for deletion.", "# Dele...
Loops through all app names contained in settings.INSTALLED_APPS and calls `update_app` on each one. Handles any object deletions that happened after all apps have been initialized.
[ "Loops", "through", "all", "app", "names", "contained", "in", "settings", ".", "INSTALLED_APPS", "and", "calls", "update_app", "on", "each", "one", ".", "Handles", "any", "object", "deletions", "that", "happened", "after", "all", "apps", "have", "been", "initi...
27b7bf4ac31b465cc14127832d0d4b97362cc40f
https://github.com/ambitioninc/django-dynamic-initial-data/blob/27b7bf4ac31b465cc14127832d0d4b97362cc40f/dynamic_initial_data/base.py#L190-L200
55,256
CivicSpleen/ambry
ambry/library/search_backends/base.py
BaseSearchBackend._and_join
def _and_join(self, terms): """ Joins terms using AND operator. Args: terms (list): terms to join Examples: self._and_join(['term1']) -> 'term1' self._and_join(['term1', 'term2']) -> 'term1 AND term2' self._and_join(['term1', 'term2', 'term3']) -...
python
def _and_join(self, terms): """ Joins terms using AND operator. Args: terms (list): terms to join Examples: self._and_join(['term1']) -> 'term1' self._and_join(['term1', 'term2']) -> 'term1 AND term2' self._and_join(['term1', 'term2', 'term3']) -...
[ "def", "_and_join", "(", "self", ",", "terms", ")", ":", "if", "len", "(", "terms", ")", ">", "1", ":", "return", "' AND '", ".", "join", "(", "[", "self", ".", "_or_join", "(", "t", ")", "for", "t", "in", "terms", "]", ")", "else", ":", "retur...
Joins terms using AND operator. Args: terms (list): terms to join Examples: self._and_join(['term1']) -> 'term1' self._and_join(['term1', 'term2']) -> 'term1 AND term2' self._and_join(['term1', 'term2', 'term3']) -> 'term1 AND term2 AND term3' R...
[ "Joins", "terms", "using", "AND", "operator", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/base.py#L204-L221
55,257
CivicSpleen/ambry
ambry/library/search_backends/base.py
BaseIndex.index_one
def index_one(self, instance, force=False): """ Indexes exactly one object of the Ambry system. Args: instance (any): instance to index. force (boolean): if True replace document in the index. Returns: boolean: True if document added to index, False if docum...
python
def index_one(self, instance, force=False): """ Indexes exactly one object of the Ambry system. Args: instance (any): instance to index. force (boolean): if True replace document in the index. Returns: boolean: True if document added to index, False if docum...
[ "def", "index_one", "(", "self", ",", "instance", ",", "force", "=", "False", ")", ":", "if", "not", "self", ".", "is_indexed", "(", "instance", ")", "and", "not", "force", ":", "doc", "=", "self", ".", "_as_document", "(", "instance", ")", "self", "...
Indexes exactly one object of the Ambry system. Args: instance (any): instance to index. force (boolean): if True replace document in the index. Returns: boolean: True if document added to index, False if document already exists in the index.
[ "Indexes", "exactly", "one", "object", "of", "the", "Ambry", "system", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/base.py#L258-L275
55,258
CivicSpleen/ambry
ambry/library/search_backends/base.py
BaseDatasetIndex._expand_terms
def _expand_terms(self, terms): """ Expands terms of the dataset to the appropriate fields. It will parse the search phrase and return only the search term components that are applicable to a Dataset query. Args: terms (dict or str): Returns: dict: keys are fie...
python
def _expand_terms(self, terms): """ Expands terms of the dataset to the appropriate fields. It will parse the search phrase and return only the search term components that are applicable to a Dataset query. Args: terms (dict or str): Returns: dict: keys are fie...
[ "def", "_expand_terms", "(", "self", ",", "terms", ")", ":", "ret", "=", "{", "'keywords'", ":", "list", "(", ")", ",", "'doc'", ":", "list", "(", ")", "}", "if", "not", "isinstance", "(", "terms", ",", "dict", ")", ":", "stp", "=", "SearchTermPars...
Expands terms of the dataset to the appropriate fields. It will parse the search phrase and return only the search term components that are applicable to a Dataset query. Args: terms (dict or str): Returns: dict: keys are field names, values are query strings
[ "Expands", "terms", "of", "the", "dataset", "to", "the", "appropriate", "fields", ".", "It", "will", "parse", "the", "search", "phrase", "and", "return", "only", "the", "search", "term", "components", "that", "are", "applicable", "to", "a", "Dataset", "query...
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/base.py#L412-L436
55,259
CivicSpleen/ambry
ambry/library/search_backends/base.py
BasePartitionIndex._as_document
def _as_document(self, partition): """ Converts given partition to the document indexed by FTS backend. Args: partition (orm.Partition): partition to convert. Returns: dict with structure matches to BasePartitionIndex._schema. """ schema = ' '.join( ...
python
def _as_document(self, partition): """ Converts given partition to the document indexed by FTS backend. Args: partition (orm.Partition): partition to convert. Returns: dict with structure matches to BasePartitionIndex._schema. """ schema = ' '.join( ...
[ "def", "_as_document", "(", "self", ",", "partition", ")", ":", "schema", "=", "' '", ".", "join", "(", "u'{} {} {} {} {}'", ".", "format", "(", "c", ".", "id", ",", "c", ".", "vid", ",", "c", ".", "name", ",", "c", ".", "altname", ",", "c", ".",...
Converts given partition to the document indexed by FTS backend. Args: partition (orm.Partition): partition to convert. Returns: dict with structure matches to BasePartitionIndex._schema.
[ "Converts", "given", "partition", "to", "the", "document", "indexed", "by", "FTS", "backend", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/base.py#L448-L515
55,260
CivicSpleen/ambry
ambry/library/search_backends/base.py
BasePartitionIndex._expand_terms
def _expand_terms(self, terms): """ Expands partition terms to the appropriate fields. Args: terms (dict or str): Returns: dict: keys are field names, values are query strings """ ret = { 'keywords': list(), 'doc': list(), ...
python
def _expand_terms(self, terms): """ Expands partition terms to the appropriate fields. Args: terms (dict or str): Returns: dict: keys are field names, values are query strings """ ret = { 'keywords': list(), 'doc': list(), ...
[ "def", "_expand_terms", "(", "self", ",", "terms", ")", ":", "ret", "=", "{", "'keywords'", ":", "list", "(", ")", ",", "'doc'", ":", "list", "(", ")", ",", "'from'", ":", "None", ",", "'to'", ":", "None", "}", "if", "not", "isinstance", "(", "te...
Expands partition terms to the appropriate fields. Args: terms (dict or str): Returns: dict: keys are field names, values are query strings
[ "Expands", "partition", "terms", "to", "the", "appropriate", "fields", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/base.py#L517-L550
55,261
CivicSpleen/ambry
ambry/library/search_backends/base.py
BasePartitionIndex._expand_place_ids
def _expand_place_ids(self, terms): """ Lookups all of the place identifiers to get gvids Args: terms (str or unicode): terms to lookup Returns: str or list: given terms if no identifiers found, otherwise list of identifiers. """ place_vids = [] ...
python
def _expand_place_ids(self, terms): """ Lookups all of the place identifiers to get gvids Args: terms (str or unicode): terms to lookup Returns: str or list: given terms if no identifiers found, otherwise list of identifiers. """ place_vids = [] ...
[ "def", "_expand_place_ids", "(", "self", ",", "terms", ")", ":", "place_vids", "=", "[", "]", "first_type", "=", "None", "for", "result", "in", "self", ".", "backend", ".", "identifier_index", ".", "search", "(", "terms", ")", ":", "if", "not", "first_ty...
Lookups all of the place identifiers to get gvids Args: terms (str or unicode): terms to lookup Returns: str or list: given terms if no identifiers found, otherwise list of identifiers.
[ "Lookups", "all", "of", "the", "place", "identifiers", "to", "get", "gvids" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/base.py#L552-L582
55,262
CivicSpleen/ambry
ambry/library/search_backends/base.py
BaseIdentifierIndex._as_document
def _as_document(self, identifier): """ Converts given identifier to the document indexed by FTS backend. Args: identifier (dict): identifier to convert. Dict contains at least 'identifier', 'type' and 'name' keys. Returns: dict with structure matches to...
python
def _as_document(self, identifier): """ Converts given identifier to the document indexed by FTS backend. Args: identifier (dict): identifier to convert. Dict contains at least 'identifier', 'type' and 'name' keys. Returns: dict with structure matches to...
[ "def", "_as_document", "(", "self", ",", "identifier", ")", ":", "return", "{", "'identifier'", ":", "u", "(", "'{}'", ")", ".", "format", "(", "identifier", "[", "'identifier'", "]", ")", ",", "'type'", ":", "u", "(", "'{}'", ")", ".", "format", "("...
Converts given identifier to the document indexed by FTS backend. Args: identifier (dict): identifier to convert. Dict contains at least 'identifier', 'type' and 'name' keys. Returns: dict with structure matches to BaseIdentifierIndex._schema.
[ "Converts", "given", "identifier", "to", "the", "document", "indexed", "by", "FTS", "backend", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/base.py#L593-L608
55,263
CivicSpleen/ambry
ambry/library/search_backends/base.py
SearchTermParser._geograins
def _geograins(self): """Create a map geographic area terms to the geo grain GVid values """ from geoid.civick import GVid geo_grains = {} for sl, cls in GVid.sl_map.items(): if '_' not in cls.level: geo_grains[self.stem(cls.level)] = str(cls.nullval().summ...
python
def _geograins(self): """Create a map geographic area terms to the geo grain GVid values """ from geoid.civick import GVid geo_grains = {} for sl, cls in GVid.sl_map.items(): if '_' not in cls.level: geo_grains[self.stem(cls.level)] = str(cls.nullval().summ...
[ "def", "_geograins", "(", "self", ")", ":", "from", "geoid", ".", "civick", "import", "GVid", "geo_grains", "=", "{", "}", "for", "sl", ",", "cls", "in", "GVid", ".", "sl_map", ".", "items", "(", ")", ":", "if", "'_'", "not", "in", "cls", ".", "l...
Create a map geographic area terms to the geo grain GVid values
[ "Create", "a", "map", "geographic", "area", "terms", "to", "the", "geo", "grain", "GVid", "values" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/base.py#L684-L695
55,264
CivicSpleen/ambry
ambry/library/search_backends/base.py
SearchTermParser.parse
def parse(self, s, term_join=None): """ Parses search term to Args: s (str): string with search term. or_join (callable): function to join 'OR' terms. Returns: dict: all of the terms grouped by marker. Key is a marker, value is a term. Example: ...
python
def parse(self, s, term_join=None): """ Parses search term to Args: s (str): string with search term. or_join (callable): function to join 'OR' terms. Returns: dict: all of the terms grouped by marker. Key is a marker, value is a term. Example: ...
[ "def", "parse", "(", "self", ",", "s", ",", "term_join", "=", "None", ")", ":", "if", "not", "term_join", ":", "term_join", "=", "lambda", "x", ":", "'('", "+", "' OR '", ".", "join", "(", "x", ")", "+", "')'", "toks", "=", "self", ".", "scan", ...
Parses search term to Args: s (str): string with search term. or_join (callable): function to join 'OR' terms. Returns: dict: all of the terms grouped by marker. Key is a marker, value is a term. Example: >>> SearchTermParser().parse('table2 fro...
[ "Parses", "search", "term", "to" ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search_backends/base.py#L705-L832
55,265
SmartTeleMax/iktomi
iktomi/cli/sqla.py
Sqla.command_create_tables
def command_create_tables(self, meta_name=None, verbose=False): ''' Create tables according sqlalchemy data model. Is not a complex migration tool like alembic, just creates tables that does not exist:: ./manage.py sqla:create_tables [--verbose] [meta_name] ''' ...
python
def command_create_tables(self, meta_name=None, verbose=False): ''' Create tables according sqlalchemy data model. Is not a complex migration tool like alembic, just creates tables that does not exist:: ./manage.py sqla:create_tables [--verbose] [meta_name] ''' ...
[ "def", "command_create_tables", "(", "self", ",", "meta_name", "=", "None", ",", "verbose", "=", "False", ")", ":", "def", "_create_metadata_tables", "(", "metadata", ")", ":", "for", "table", "in", "metadata", ".", "sorted_tables", ":", "if", "verbose", ":"...
Create tables according sqlalchemy data model. Is not a complex migration tool like alembic, just creates tables that does not exist:: ./manage.py sqla:create_tables [--verbose] [meta_name]
[ "Create", "tables", "according", "sqlalchemy", "data", "model", "." ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/cli/sqla.py#L86-L113
55,266
SmartTeleMax/iktomi
iktomi/cli/sqla.py
Sqla.command_gen
def command_gen(self, *names): ''' Runs generator functions. Run `docs` generator function:: ./manage.py sqla:gen docs Run `docs` generator function with `count=10`:: ./manage.py sqla:gen docs:10 ''' if not names: sys.exit('Please p...
python
def command_gen(self, *names): ''' Runs generator functions. Run `docs` generator function:: ./manage.py sqla:gen docs Run `docs` generator function with `count=10`:: ./manage.py sqla:gen docs:10 ''' if not names: sys.exit('Please p...
[ "def", "command_gen", "(", "self", ",", "*", "names", ")", ":", "if", "not", "names", ":", "sys", ".", "exit", "(", "'Please provide generator names'", ")", "for", "name", "in", "names", ":", "name", ",", "count", "=", "name", ",", "0", "if", "':'", ...
Runs generator functions. Run `docs` generator function:: ./manage.py sqla:gen docs Run `docs` generator function with `count=10`:: ./manage.py sqla:gen docs:10
[ "Runs", "generator", "functions", "." ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/cli/sqla.py#L199-L221
55,267
CivicSpleen/ambry
ambry/mprlib/backends/base.py
_get_table_names
def _get_table_names(statement): """ Returns table names found in the query. NOTE. This routine would use the sqlparse parse tree, but vnames don't parse very well. Args: statement (sqlparse.sql.Statement): parsed by sqlparse sql statement. Returns: list of str """ parts = st...
python
def _get_table_names(statement): """ Returns table names found in the query. NOTE. This routine would use the sqlparse parse tree, but vnames don't parse very well. Args: statement (sqlparse.sql.Statement): parsed by sqlparse sql statement. Returns: list of str """ parts = st...
[ "def", "_get_table_names", "(", "statement", ")", ":", "parts", "=", "statement", ".", "to_unicode", "(", ")", ".", "split", "(", ")", "tables", "=", "set", "(", ")", "for", "i", ",", "token", "in", "enumerate", "(", "parts", ")", ":", "if", "token",...
Returns table names found in the query. NOTE. This routine would use the sqlparse parse tree, but vnames don't parse very well. Args: statement (sqlparse.sql.Statement): parsed by sqlparse sql statement. Returns: list of str
[ "Returns", "table", "names", "found", "in", "the", "query", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/base.py#L167-L187
55,268
CivicSpleen/ambry
ambry/mprlib/backends/base.py
DatabaseBackend.install
def install(self, connection, partition, table_name=None, index_columns=None, materialize=False, logger=None): """ Installs partition's mpr to the database to allow to execute sql queries over mpr. Args: connection: partition (orm.Partition): material...
python
def install(self, connection, partition, table_name=None, index_columns=None, materialize=False, logger=None): """ Installs partition's mpr to the database to allow to execute sql queries over mpr. Args: connection: partition (orm.Partition): material...
[ "def", "install", "(", "self", ",", "connection", ",", "partition", ",", "table_name", "=", "None", ",", "index_columns", "=", "None", ",", "materialize", "=", "False", ",", "logger", "=", "None", ")", ":", "raise", "NotImplementedError" ]
Installs partition's mpr to the database to allow to execute sql queries over mpr. Args: connection: partition (orm.Partition): materialize (boolean): if True, create generic table. If False create MED over mpr. Returns: str: name of the created table.
[ "Installs", "partition", "s", "mpr", "to", "the", "database", "to", "allow", "to", "execute", "sql", "queries", "over", "mpr", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/base.py#L24-L38
55,269
CivicSpleen/ambry
ambry/mprlib/backends/base.py
DatabaseBackend.install_table
def install_table(self, connection, table, logger = None): """ Installs all partitons of the table and create view with union of all partitons. Args: connection: connection to database who stores mpr data. table (orm.Table): """ # first install all partitions of ...
python
def install_table(self, connection, table, logger = None): """ Installs all partitons of the table and create view with union of all partitons. Args: connection: connection to database who stores mpr data. table (orm.Table): """ # first install all partitions of ...
[ "def", "install_table", "(", "self", ",", "connection", ",", "table", ",", "logger", "=", "None", ")", ":", "# first install all partitions of the table", "queries", "=", "[", "]", "query_tmpl", "=", "'SELECT * FROM {}'", "for", "partition", "in", "table", ".", ...
Installs all partitons of the table and create view with union of all partitons. Args: connection: connection to database who stores mpr data. table (orm.Table):
[ "Installs", "all", "partitons", "of", "the", "table", "and", "create", "view", "with", "union", "of", "all", "partitons", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/base.py#L40-L59
55,270
CivicSpleen/ambry
ambry/mprlib/backends/base.py
DatabaseBackend.query
def query(self, connection, query, fetch=True): """ Creates virtual tables for all partitions found in the query and executes query. Args: query (str): sql query fetch (bool): fetch result from database if True, do not fetch overwise. """ self.install_module(co...
python
def query(self, connection, query, fetch=True): """ Creates virtual tables for all partitions found in the query and executes query. Args: query (str): sql query fetch (bool): fetch result from database if True, do not fetch overwise. """ self.install_module(co...
[ "def", "query", "(", "self", ",", "connection", ",", "query", ",", "fetch", "=", "True", ")", ":", "self", ".", "install_module", "(", "connection", ")", "statements", "=", "sqlparse", ".", "parse", "(", "sqlparse", ".", "format", "(", "query", ",", "s...
Creates virtual tables for all partitions found in the query and executes query. Args: query (str): sql query fetch (bool): fetch result from database if True, do not fetch overwise.
[ "Creates", "virtual", "tables", "for", "all", "partitions", "found", "in", "the", "query", "and", "executes", "query", "." ]
d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/mprlib/backends/base.py#L63-L98
55,271
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
build
def build(id=None, name=None, revision=None, temporary_build=False, timestamp_alignment=False, no_build_dependencies=False, keep_pod_on_failure=False, force_rebuild=False, rebuild_mode=common.REBUILD_MODES_DEFAULT): """ Trigger a BuildConfiguration by name or ID...
python
def build(id=None, name=None, revision=None, temporary_build=False, timestamp_alignment=False, no_build_dependencies=False, keep_pod_on_failure=False, force_rebuild=False, rebuild_mode=common.REBUILD_MODES_DEFAULT): """ Trigger a BuildConfiguration by name or ID...
[ "def", "build", "(", "id", "=", "None", ",", "name", "=", "None", ",", "revision", "=", "None", ",", "temporary_build", "=", "False", ",", "timestamp_alignment", "=", "False", ",", "no_build_dependencies", "=", "False", ",", "keep_pod_on_failure", "=", "Fals...
Trigger a BuildConfiguration by name or ID
[ "Trigger", "a", "BuildConfiguration", "by", "name", "or", "ID" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L67-L79
55,272
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
get_build_configuration
def get_build_configuration(id=None, name=None): """ Retrieve a specific BuildConfiguration """ data = get_build_configuration_raw(id, name) if data: return utils.format_json(data)
python
def get_build_configuration(id=None, name=None): """ Retrieve a specific BuildConfiguration """ data = get_build_configuration_raw(id, name) if data: return utils.format_json(data)
[ "def", "get_build_configuration", "(", "id", "=", "None", ",", "name", "=", "None", ")", ":", "data", "=", "get_build_configuration_raw", "(", "id", ",", "name", ")", "if", "data", ":", "return", "utils", ".", "format_json", "(", "data", ")" ]
Retrieve a specific BuildConfiguration
[ "Retrieve", "a", "specific", "BuildConfiguration" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L118-L124
55,273
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
update_build_configuration
def update_build_configuration(id, **kwargs): """ Update an existing BuildConfiguration with new information :param id: ID of BuildConfiguration to update :param name: Name of BuildConfiguration to update :return: """ data = update_build_configuration_raw(id, **kwargs) if data: ...
python
def update_build_configuration(id, **kwargs): """ Update an existing BuildConfiguration with new information :param id: ID of BuildConfiguration to update :param name: Name of BuildConfiguration to update :return: """ data = update_build_configuration_raw(id, **kwargs) if data: ...
[ "def", "update_build_configuration", "(", "id", ",", "*", "*", "kwargs", ")", ":", "data", "=", "update_build_configuration_raw", "(", "id", ",", "*", "*", "kwargs", ")", "if", "data", ":", "return", "utils", ".", "format_json", "(", "data", ")" ]
Update an existing BuildConfiguration with new information :param id: ID of BuildConfiguration to update :param name: Name of BuildConfiguration to update :return:
[ "Update", "an", "existing", "BuildConfiguration", "with", "new", "information" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L146-L156
55,274
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
list_build_configurations_for_product
def list_build_configurations_for_product(id=None, name=None, page_size=200, page_index=0, sort="", q=""): """ List all BuildConfigurations associated with the given Product. """ data = list_build_configurations_for_product_raw(id, name, page_size, page_index, sort, q) if data: return utils....
python
def list_build_configurations_for_product(id=None, name=None, page_size=200, page_index=0, sort="", q=""): """ List all BuildConfigurations associated with the given Product. """ data = list_build_configurations_for_product_raw(id, name, page_size, page_index, sort, q) if data: return utils....
[ "def", "list_build_configurations_for_product", "(", "id", "=", "None", ",", "name", "=", "None", ",", "page_size", "=", "200", ",", "page_index", "=", "0", ",", "sort", "=", "\"\"", ",", "q", "=", "\"\"", ")", ":", "data", "=", "list_build_configurations_...
List all BuildConfigurations associated with the given Product.
[ "List", "all", "BuildConfigurations", "associated", "with", "the", "given", "Product", "." ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L278-L284
55,275
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
list_build_configurations_for_project
def list_build_configurations_for_project(id=None, name=None, page_size=200, page_index=0, sort="", q=""): """ List all BuildConfigurations associated with the given Project. """ data = list_build_configurations_for_project_raw(id, name, page_size, page_index, sort, q) if data: return utils....
python
def list_build_configurations_for_project(id=None, name=None, page_size=200, page_index=0, sort="", q=""): """ List all BuildConfigurations associated with the given Project. """ data = list_build_configurations_for_project_raw(id, name, page_size, page_index, sort, q) if data: return utils....
[ "def", "list_build_configurations_for_project", "(", "id", "=", "None", ",", "name", "=", "None", ",", "page_size", "=", "200", ",", "page_index", "=", "0", ",", "sort", "=", "\"\"", ",", "q", "=", "\"\"", ")", ":", "data", "=", "list_build_configurations_...
List all BuildConfigurations associated with the given Project.
[ "List", "all", "BuildConfigurations", "associated", "with", "the", "given", "Project", "." ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L301-L307
55,276
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
list_build_configurations_for_product_version
def list_build_configurations_for_product_version(product_id, version_id, page_size=200, page_index=0, sort="", q=""): """ List all BuildConfigurations associated with the given ProductVersion """ data = list_build_configurations_for_project_raw(product_id, version_id, page_size, page_index, sort, q) ...
python
def list_build_configurations_for_product_version(product_id, version_id, page_size=200, page_index=0, sort="", q=""): """ List all BuildConfigurations associated with the given ProductVersion """ data = list_build_configurations_for_project_raw(product_id, version_id, page_size, page_index, sort, q) ...
[ "def", "list_build_configurations_for_product_version", "(", "product_id", ",", "version_id", ",", "page_size", "=", "200", ",", "page_index", "=", "0", ",", "sort", "=", "\"\"", ",", "q", "=", "\"\"", ")", ":", "data", "=", "list_build_configurations_for_project_...
List all BuildConfigurations associated with the given ProductVersion
[ "List", "all", "BuildConfigurations", "associated", "with", "the", "given", "ProductVersion" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L326-L332
55,277
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
add_dependency
def add_dependency(id=None, name=None, dependency_id=None, dependency_name=None): """ Add an existing BuildConfiguration as a dependency to another BuildConfiguration. """ data = add_dependency_raw(id, name, dependency_id, dependency_name) if data: return utils.format_json_list(data)
python
def add_dependency(id=None, name=None, dependency_id=None, dependency_name=None): """ Add an existing BuildConfiguration as a dependency to another BuildConfiguration. """ data = add_dependency_raw(id, name, dependency_id, dependency_name) if data: return utils.format_json_list(data)
[ "def", "add_dependency", "(", "id", "=", "None", ",", "name", "=", "None", ",", "dependency_id", "=", "None", ",", "dependency_name", "=", "None", ")", ":", "data", "=", "add_dependency_raw", "(", "id", ",", "name", ",", "dependency_id", ",", "dependency_n...
Add an existing BuildConfiguration as a dependency to another BuildConfiguration.
[ "Add", "an", "existing", "BuildConfiguration", "as", "a", "dependency", "to", "another", "BuildConfiguration", "." ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L367-L373
55,278
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
remove_dependency
def remove_dependency(id=None, name=None, dependency_id=None, dependency_name=None): """ Remove a BuildConfiguration from the dependency list of another BuildConfiguration """ data = remove_dependency_raw(id, name, dependency_id, dependency_name) if data: return utils.format_json_list(data)
python
def remove_dependency(id=None, name=None, dependency_id=None, dependency_name=None): """ Remove a BuildConfiguration from the dependency list of another BuildConfiguration """ data = remove_dependency_raw(id, name, dependency_id, dependency_name) if data: return utils.format_json_list(data)
[ "def", "remove_dependency", "(", "id", "=", "None", ",", "name", "=", "None", ",", "dependency_id", "=", "None", ",", "dependency_name", "=", "None", ")", ":", "data", "=", "remove_dependency_raw", "(", "id", ",", "name", ",", "dependency_id", ",", "depend...
Remove a BuildConfiguration from the dependency list of another BuildConfiguration
[ "Remove", "a", "BuildConfiguration", "from", "the", "dependency", "list", "of", "another", "BuildConfiguration" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L390-L396
55,279
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
list_product_versions_for_build_configuration
def list_product_versions_for_build_configuration(id=None, name=None, page_size=200, page_index=0, sort="", q=""): """ List all ProductVersions associated with a BuildConfiguration """ data = list_product_versions_for_build_configuration_raw(id, name, page_size, page_index, sort, q) if data: ...
python
def list_product_versions_for_build_configuration(id=None, name=None, page_size=200, page_index=0, sort="", q=""): """ List all ProductVersions associated with a BuildConfiguration """ data = list_product_versions_for_build_configuration_raw(id, name, page_size, page_index, sort, q) if data: ...
[ "def", "list_product_versions_for_build_configuration", "(", "id", "=", "None", ",", "name", "=", "None", ",", "page_size", "=", "200", ",", "page_index", "=", "0", ",", "sort", "=", "\"\"", ",", "q", "=", "\"\"", ")", ":", "data", "=", "list_product_versi...
List all ProductVersions associated with a BuildConfiguration
[ "List", "all", "ProductVersions", "associated", "with", "a", "BuildConfiguration" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L412-L418
55,280
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
add_product_version_to_build_configuration
def add_product_version_to_build_configuration(id=None, name=None, product_version_id=None): """ Associate an existing ProductVersion with a BuildConfiguration """ data = remove_product_version_from_build_configuration_raw(id, name, product_version_id) if data: return utils.format_json_list(...
python
def add_product_version_to_build_configuration(id=None, name=None, product_version_id=None): """ Associate an existing ProductVersion with a BuildConfiguration """ data = remove_product_version_from_build_configuration_raw(id, name, product_version_id) if data: return utils.format_json_list(...
[ "def", "add_product_version_to_build_configuration", "(", "id", "=", "None", ",", "name", "=", "None", ",", "product_version_id", "=", "None", ")", ":", "data", "=", "remove_product_version_from_build_configuration_raw", "(", "id", ",", "name", ",", "product_version_i...
Associate an existing ProductVersion with a BuildConfiguration
[ "Associate", "an", "existing", "ProductVersion", "with", "a", "BuildConfiguration" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L432-L438
55,281
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
remove_product_version_from_build_configuration
def remove_product_version_from_build_configuration(id=None, name=None, product_version_id=None): """ Remove a ProductVersion from association with a BuildConfiguration """ data = remove_product_version_from_build_configuration_raw(id, name, product_version_id) if data: return utils.format_j...
python
def remove_product_version_from_build_configuration(id=None, name=None, product_version_id=None): """ Remove a ProductVersion from association with a BuildConfiguration """ data = remove_product_version_from_build_configuration_raw(id, name, product_version_id) if data: return utils.format_j...
[ "def", "remove_product_version_from_build_configuration", "(", "id", "=", "None", ",", "name", "=", "None", ",", "product_version_id", "=", "None", ")", ":", "data", "=", "remove_product_version_from_build_configuration_raw", "(", "id", ",", "name", ",", "product_vers...
Remove a ProductVersion from association with a BuildConfiguration
[ "Remove", "a", "ProductVersion", "from", "association", "with", "a", "BuildConfiguration" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L453-L459
55,282
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
list_revisions_of_build_configuration
def list_revisions_of_build_configuration(id=None, name=None, page_size=200, page_index=0, sort=""): """ List audited revisions of a BuildConfiguration """ data = list_revisions_of_build_configuration_raw(id, name, page_size, page_index, sort) if data: return utils.format_json_list(data)
python
def list_revisions_of_build_configuration(id=None, name=None, page_size=200, page_index=0, sort=""): """ List audited revisions of a BuildConfiguration """ data = list_revisions_of_build_configuration_raw(id, name, page_size, page_index, sort) if data: return utils.format_json_list(data)
[ "def", "list_revisions_of_build_configuration", "(", "id", "=", "None", ",", "name", "=", "None", ",", "page_size", "=", "200", ",", "page_index", "=", "0", ",", "sort", "=", "\"\"", ")", ":", "data", "=", "list_revisions_of_build_configuration_raw", "(", "id"...
List audited revisions of a BuildConfiguration
[ "List", "audited", "revisions", "of", "a", "BuildConfiguration" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L475-L481
55,283
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
get_revision_of_build_configuration
def get_revision_of_build_configuration(revision_id, id=None, name=None): """ Get a specific audited revision of a BuildConfiguration """ data = get_revision_of_build_configuration_raw(revision_id, id, name) if data: return utils.format_json_list(data)
python
def get_revision_of_build_configuration(revision_id, id=None, name=None): """ Get a specific audited revision of a BuildConfiguration """ data = get_revision_of_build_configuration_raw(revision_id, id, name) if data: return utils.format_json_list(data)
[ "def", "get_revision_of_build_configuration", "(", "revision_id", ",", "id", "=", "None", ",", "name", "=", "None", ")", ":", "data", "=", "get_revision_of_build_configuration_raw", "(", "revision_id", ",", "id", ",", "name", ")", "if", "data", ":", "return", ...
Get a specific audited revision of a BuildConfiguration
[ "Get", "a", "specific", "audited", "revision", "of", "a", "BuildConfiguration" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L494-L500
55,284
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
list_build_configurations
def list_build_configurations(page_size=200, page_index=0, sort="", q=""): """ List all BuildConfigurations """ data = list_build_configurations_raw(page_size, page_index, sort, q) if data: return utils.format_json_list(data)
python
def list_build_configurations(page_size=200, page_index=0, sort="", q=""): """ List all BuildConfigurations """ data = list_build_configurations_raw(page_size, page_index, sort, q) if data: return utils.format_json_list(data)
[ "def", "list_build_configurations", "(", "page_size", "=", "200", ",", "page_index", "=", "0", ",", "sort", "=", "\"\"", ",", "q", "=", "\"\"", ")", ":", "data", "=", "list_build_configurations_raw", "(", "page_size", ",", "page_index", ",", "sort", ",", "...
List all BuildConfigurations
[ "List", "all", "BuildConfigurations" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L513-L519
55,285
mithro/python-datetime-tz
datetime_tz/pytz_abbr.py
tzabbr_register
def tzabbr_register(abbr, name, region, zone, dst): """Register a new timezone abbreviation in the global registry. If another abbreviation with the same name has already been registered it new abbreviation will only be registered in region specific dictionary. """ newabbr = tzabbr() newabbr.abbr = abbr ...
python
def tzabbr_register(abbr, name, region, zone, dst): """Register a new timezone abbreviation in the global registry. If another abbreviation with the same name has already been registered it new abbreviation will only be registered in region specific dictionary. """ newabbr = tzabbr() newabbr.abbr = abbr ...
[ "def", "tzabbr_register", "(", "abbr", ",", "name", ",", "region", ",", "zone", ",", "dst", ")", ":", "newabbr", "=", "tzabbr", "(", ")", "newabbr", ".", "abbr", "=", "abbr", "newabbr", ".", "name", "=", "name", "newabbr", ".", "region", "=", "region...
Register a new timezone abbreviation in the global registry. If another abbreviation with the same name has already been registered it new abbreviation will only be registered in region specific dictionary.
[ "Register", "a", "new", "timezone", "abbreviation", "in", "the", "global", "registry", "." ]
3c682d003f8b28e39f0c096773e471aeb68e6bbb
https://github.com/mithro/python-datetime-tz/blob/3c682d003f8b28e39f0c096773e471aeb68e6bbb/datetime_tz/pytz_abbr.py#L71-L91
55,286
project-ncl/pnc-cli
pnc_cli/licenses.py
create_license
def create_license(**kwargs): """ Create a new License """ License = create_license_object(**kwargs) response = utils.checked_api_call(pnc_api.licenses, 'create_new', body=License) if response: return utils.format_json(response.content)
python
def create_license(**kwargs): """ Create a new License """ License = create_license_object(**kwargs) response = utils.checked_api_call(pnc_api.licenses, 'create_new', body=License) if response: return utils.format_json(response.content)
[ "def", "create_license", "(", "*", "*", "kwargs", ")", ":", "License", "=", "create_license_object", "(", "*", "*", "kwargs", ")", "response", "=", "utils", ".", "checked_api_call", "(", "pnc_api", ".", "licenses", ",", "'create_new'", ",", "body", "=", "L...
Create a new License
[ "Create", "a", "new", "License" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/licenses.py#L22-L29
55,287
project-ncl/pnc-cli
pnc_cli/licenses.py
get_license
def get_license(id): """ Get a specific License by either ID or fullname """ response = utils.checked_api_call( pnc_api.licenses, 'get_specific', id= id) if response: return utils.format_json(response.content)
python
def get_license(id): """ Get a specific License by either ID or fullname """ response = utils.checked_api_call( pnc_api.licenses, 'get_specific', id= id) if response: return utils.format_json(response.content)
[ "def", "get_license", "(", "id", ")", ":", "response", "=", "utils", ".", "checked_api_call", "(", "pnc_api", ".", "licenses", ",", "'get_specific'", ",", "id", "=", "id", ")", "if", "response", ":", "return", "utils", ".", "format_json", "(", "response", ...
Get a specific License by either ID or fullname
[ "Get", "a", "specific", "License", "by", "either", "ID", "or", "fullname" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/licenses.py#L33-L40
55,288
project-ncl/pnc-cli
pnc_cli/licenses.py
delete_license
def delete_license(license_id): """ Delete a License by ID """ response = utils.checked_api_call(pnc_api.licenses, 'delete', id=license_id) if response: return utils.format_json(response.content)
python
def delete_license(license_id): """ Delete a License by ID """ response = utils.checked_api_call(pnc_api.licenses, 'delete', id=license_id) if response: return utils.format_json(response.content)
[ "def", "delete_license", "(", "license_id", ")", ":", "response", "=", "utils", ".", "checked_api_call", "(", "pnc_api", ".", "licenses", ",", "'delete'", ",", "id", "=", "license_id", ")", "if", "response", ":", "return", "utils", ".", "format_json", "(", ...
Delete a License by ID
[ "Delete", "a", "License", "by", "ID" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/licenses.py#L45-L52
55,289
project-ncl/pnc-cli
pnc_cli/licenses.py
update_license
def update_license(license_id, **kwargs): """ Replace the License with given ID with a new License """ updated_license = pnc_api.licenses.get_specific(id=license_id).content for key, value in iteritems(kwargs): if value: setattr(updated_license, key, value) response = utils...
python
def update_license(license_id, **kwargs): """ Replace the License with given ID with a new License """ updated_license = pnc_api.licenses.get_specific(id=license_id).content for key, value in iteritems(kwargs): if value: setattr(updated_license, key, value) response = utils...
[ "def", "update_license", "(", "license_id", ",", "*", "*", "kwargs", ")", ":", "updated_license", "=", "pnc_api", ".", "licenses", ".", "get_specific", "(", "id", "=", "license_id", ")", ".", "content", "for", "key", ",", "value", "in", "iteritems", "(", ...
Replace the License with given ID with a new License
[ "Replace", "the", "License", "with", "given", "ID", "with", "a", "new", "License" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/licenses.py#L60-L76
55,290
project-ncl/pnc-cli
pnc_cli/licenses.py
list_licenses
def list_licenses(page_size=200, page_index=0, sort="", q=""): """ List all Licenses """ response = utils.checked_api_call(pnc_api.licenses, 'get_all', page_size=page_size, page_index=page_index, sort=sort, q=q) if response: return utils.format_json_list(response.content)
python
def list_licenses(page_size=200, page_index=0, sort="", q=""): """ List all Licenses """ response = utils.checked_api_call(pnc_api.licenses, 'get_all', page_size=page_size, page_index=page_index, sort=sort, q=q) if response: return utils.format_json_list(response.content)
[ "def", "list_licenses", "(", "page_size", "=", "200", ",", "page_index", "=", "0", ",", "sort", "=", "\"\"", ",", "q", "=", "\"\"", ")", ":", "response", "=", "utils", ".", "checked_api_call", "(", "pnc_api", ".", "licenses", ",", "'get_all'", ",", "pa...
List all Licenses
[ "List", "all", "Licenses" ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/licenses.py#L83-L89
55,291
SmartTeleMax/iktomi
iktomi/unstable/utils/image_resizers.py
Resizer.transform
def transform(self, img, transformation, params): ''' Apply transformations to the image. New transformations can be defined as methods:: def do__transformationname(self, img, transformation, params): 'returns new image with transformation applied' ....
python
def transform(self, img, transformation, params): ''' Apply transformations to the image. New transformations can be defined as methods:: def do__transformationname(self, img, transformation, params): 'returns new image with transformation applied' ....
[ "def", "transform", "(", "self", ",", "img", ",", "transformation", ",", "params", ")", ":", "# Transformations MUST be idempotent.", "# The limitation is caused by implementation of", "# image upload in iktomi.cms.", "# The transformation can be applied twice:", "# on image upload a...
Apply transformations to the image. New transformations can be defined as methods:: def do__transformationname(self, img, transformation, params): 'returns new image with transformation applied' ... def new_size__transformationname(self, size, target_si...
[ "Apply", "transformations", "to", "the", "image", "." ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/unstable/utils/image_resizers.py#L34-L55
55,292
SmartTeleMax/iktomi
iktomi/unstable/utils/image_resizers.py
ResizeMixed.get_resizer
def get_resizer(self, size, target_size): '''Choose a resizer depending an image size''' sw, sh = size if sw >= sh * self.rate: return self.hor_resize else: return self.vert_resize
python
def get_resizer(self, size, target_size): '''Choose a resizer depending an image size''' sw, sh = size if sw >= sh * self.rate: return self.hor_resize else: return self.vert_resize
[ "def", "get_resizer", "(", "self", ",", "size", ",", "target_size", ")", ":", "sw", ",", "sh", "=", "size", "if", "sw", ">=", "sh", "*", "self", ".", "rate", ":", "return", "self", ".", "hor_resize", "else", ":", "return", "self", ".", "vert_resize" ...
Choose a resizer depending an image size
[ "Choose", "a", "resizer", "depending", "an", "image", "size" ]
80bc0f1408d63efe7f5844367d1f6efba44b35f2
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/unstable/utils/image_resizers.py#L160-L166
55,293
cosven/feeluown-core
fuocore/player.py
Playlist.next_song
def next_song(self): """next song for player, calculated based on playback_mode""" # 如果没有正在播放的歌曲,找列表里面第一首能播放的 if self.current_song is None: return self._get_good_song() if self.playback_mode == PlaybackMode.random: next_song = self._get_good_song(random_=True) ...
python
def next_song(self): """next song for player, calculated based on playback_mode""" # 如果没有正在播放的歌曲,找列表里面第一首能播放的 if self.current_song is None: return self._get_good_song() if self.playback_mode == PlaybackMode.random: next_song = self._get_good_song(random_=True) ...
[ "def", "next_song", "(", "self", ")", ":", "# 如果没有正在播放的歌曲,找列表里面第一首能播放的", "if", "self", ".", "current_song", "is", "None", ":", "return", "self", ".", "_get_good_song", "(", ")", "if", "self", ".", "playback_mode", "==", "PlaybackMode", ".", "random", ":", "n...
next song for player, calculated based on playback_mode
[ "next", "song", "for", "player", "calculated", "based", "on", "playback_mode" ]
62dc64638f62971b16be0a75c0b8c7ae2999869e
https://github.com/cosven/feeluown-core/blob/62dc64638f62971b16be0a75c0b8c7ae2999869e/fuocore/player.py#L226-L243
55,294
cosven/feeluown-core
fuocore/player.py
Playlist.previous_song
def previous_song(self): """previous song for player to play NOTE: not the last played song """ if self.current_song is None: return self._get_good_song(base=-1, direction=-1) if self.playback_mode == PlaybackMode.random: previous_song = self._get_good_s...
python
def previous_song(self): """previous song for player to play NOTE: not the last played song """ if self.current_song is None: return self._get_good_song(base=-1, direction=-1) if self.playback_mode == PlaybackMode.random: previous_song = self._get_good_s...
[ "def", "previous_song", "(", "self", ")", ":", "if", "self", ".", "current_song", "is", "None", ":", "return", "self", ".", "_get_good_song", "(", "base", "=", "-", "1", ",", "direction", "=", "-", "1", ")", "if", "self", ".", "playback_mode", "==", ...
previous song for player to play NOTE: not the last played song
[ "previous", "song", "for", "player", "to", "play" ]
62dc64638f62971b16be0a75c0b8c7ae2999869e
https://github.com/cosven/feeluown-core/blob/62dc64638f62971b16be0a75c0b8c7ae2999869e/fuocore/player.py#L246-L259
55,295
cosven/feeluown-core
fuocore/player.py
AbstractPlayer.state
def state(self, value): """set player state, emit state changed signal outer object should not set state directly, use ``pause`` / ``resume`` / ``stop`` / ``play`` method instead. """ self._state = value self.state_changed.emit(value)
python
def state(self, value): """set player state, emit state changed signal outer object should not set state directly, use ``pause`` / ``resume`` / ``stop`` / ``play`` method instead. """ self._state = value self.state_changed.emit(value)
[ "def", "state", "(", "self", ",", "value", ")", ":", "self", ".", "_state", "=", "value", "self", ".", "state_changed", ".", "emit", "(", "value", ")" ]
set player state, emit state changed signal outer object should not set state directly, use ``pause`` / ``resume`` / ``stop`` / ``play`` method instead.
[ "set", "player", "state", "emit", "state", "changed", "signal" ]
62dc64638f62971b16be0a75c0b8c7ae2999869e
https://github.com/cosven/feeluown-core/blob/62dc64638f62971b16be0a75c0b8c7ae2999869e/fuocore/player.py#L296-L303
55,296
project-ncl/pnc-cli
pnc_cli/tools/maven_utils.py
alter_poms
def alter_poms(pom_dir, additional_params, repo_url=None, mvn_repo_local=None): """ Runs mvn clean command with provided additional parameters to perform pom updates by pom-manipulation-ext. """ work_dir = os.getcwd() os.chdir(pom_dir) try: if repo_url: settings_filename = c...
python
def alter_poms(pom_dir, additional_params, repo_url=None, mvn_repo_local=None): """ Runs mvn clean command with provided additional parameters to perform pom updates by pom-manipulation-ext. """ work_dir = os.getcwd() os.chdir(pom_dir) try: if repo_url: settings_filename = c...
[ "def", "alter_poms", "(", "pom_dir", ",", "additional_params", ",", "repo_url", "=", "None", ",", "mvn_repo_local", "=", "None", ")", ":", "work_dir", "=", "os", ".", "getcwd", "(", ")", "os", ".", "chdir", "(", "pom_dir", ")", "try", ":", "if", "repo_...
Runs mvn clean command with provided additional parameters to perform pom updates by pom-manipulation-ext.
[ "Runs", "mvn", "clean", "command", "with", "provided", "additional", "parameters", "to", "perform", "pom", "updates", "by", "pom", "-", "manipulation", "-", "ext", "." ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/tools/maven_utils.py#L165-L194
55,297
project-ncl/pnc-cli
pnc_cli/tools/maven_utils.py
pom_contains_modules
def pom_contains_modules(): """ Reads pom.xml in current working directory and checks, if there is non-empty modules tag. """ pom_file = None try: pom_file = open("pom.xml") pom = pom_file.read() finally: if pom_file: pom_file.close() artifact = MavenArti...
python
def pom_contains_modules(): """ Reads pom.xml in current working directory and checks, if there is non-empty modules tag. """ pom_file = None try: pom_file = open("pom.xml") pom = pom_file.read() finally: if pom_file: pom_file.close() artifact = MavenArti...
[ "def", "pom_contains_modules", "(", ")", ":", "pom_file", "=", "None", "try", ":", "pom_file", "=", "open", "(", "\"pom.xml\"", ")", "pom", "=", "pom_file", ".", "read", "(", ")", "finally", ":", "if", "pom_file", ":", "pom_file", ".", "close", "(", ")...
Reads pom.xml in current working directory and checks, if there is non-empty modules tag.
[ "Reads", "pom", ".", "xml", "in", "current", "working", "directory", "and", "checks", "if", "there", "is", "non", "-", "empty", "modules", "tag", "." ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/tools/maven_utils.py#L196-L212
55,298
project-ncl/pnc-cli
pnc_cli/tools/maven_utils.py
create_mirror_settings
def create_mirror_settings(repo_url): """ Creates settings.xml in current working directory, which when used makes Maven use given repo URL as a mirror of all repositories to look at. :param repo_url: the repository URL to use :returns: filepath to the created file """ cwd = os.getcwd() ...
python
def create_mirror_settings(repo_url): """ Creates settings.xml in current working directory, which when used makes Maven use given repo URL as a mirror of all repositories to look at. :param repo_url: the repository URL to use :returns: filepath to the created file """ cwd = os.getcwd() ...
[ "def", "create_mirror_settings", "(", "repo_url", ")", ":", "cwd", "=", "os", ".", "getcwd", "(", ")", "settings_path", "=", "os", ".", "path", ".", "join", "(", "cwd", ",", "\"settings.xml\"", ")", "settings_file", "=", "None", "try", ":", "settings_file"...
Creates settings.xml in current working directory, which when used makes Maven use given repo URL as a mirror of all repositories to look at. :param repo_url: the repository URL to use :returns: filepath to the created file
[ "Creates", "settings", ".", "xml", "in", "current", "working", "directory", "which", "when", "used", "makes", "Maven", "use", "given", "repo", "URL", "as", "a", "mirror", "of", "all", "repositories", "to", "look", "at", "." ]
3dc149bf84928f60a8044ac50b58bbaddd451902
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/tools/maven_utils.py#L363-L393
55,299
cosven/feeluown-core
fuocore/netease/api.py
API.search
def search(self, s, stype=1, offset=0, total='true', limit=60): """get songs list from search keywords""" action = uri + '/search/get' data = { 's': s, 'type': stype, 'offset': offset, 'total': total, 'limit': 60 } resp ...
python
def search(self, s, stype=1, offset=0, total='true', limit=60): """get songs list from search keywords""" action = uri + '/search/get' data = { 's': s, 'type': stype, 'offset': offset, 'total': total, 'limit': 60 } resp ...
[ "def", "search", "(", "self", ",", "s", ",", "stype", "=", "1", ",", "offset", "=", "0", ",", "total", "=", "'true'", ",", "limit", "=", "60", ")", ":", "action", "=", "uri", "+", "'/search/get'", "data", "=", "{", "'s'", ":", "s", ",", "'type'...
get songs list from search keywords
[ "get", "songs", "list", "from", "search", "keywords" ]
62dc64638f62971b16be0a75c0b8c7ae2999869e
https://github.com/cosven/feeluown-core/blob/62dc64638f62971b16be0a75c0b8c7ae2999869e/fuocore/netease/api.py#L116-L129