repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
etcher-be/emiz
emiz/weather/mission_weather/mission_weather.py
MissionWeather._randomize_speed
def _randomize_speed(base_speed: int, sigma: int = None) -> int: """ Creates a variation in wind speed Args: base_speed: base wind speed sigma: sigma value for gaussian variation Returns: random wind speed """ if sigma is None: int_s...
python
def _randomize_speed(base_speed: int, sigma: int = None) -> int: """ Creates a variation in wind speed Args: base_speed: base wind speed sigma: sigma value for gaussian variation Returns: random wind speed """ if sigma is None: int_s...
[ "def", "_randomize_speed", "(", "base_speed", ":", "int", ",", "sigma", ":", "int", "=", "None", ")", "->", "int", ":", "if", "sigma", "is", "None", ":", "int_sigma", "=", "int", "(", "base_speed", "/", "4", ")", "else", ":", "int_sigma", "=", "sigma...
Creates a variation in wind speed Args: base_speed: base wind speed sigma: sigma value for gaussian variation Returns: random wind speed
[ "Creates", "a", "variation", "in", "wind", "speed" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/weather/mission_weather/mission_weather.py#L133-L151
etcher-be/emiz
emiz/weather/mission_weather/mission_weather.py
MissionWeather._randomize_direction
def _randomize_direction(base_heading, sigma) -> int: """ Creates a variation in direction Args: base_heading: base direction sigma: sigma value for gaussian variation Returns: random direction """ val = MissionWeather._gauss(base_heading, sigma...
python
def _randomize_direction(base_heading, sigma) -> int: """ Creates a variation in direction Args: base_heading: base direction sigma: sigma value for gaussian variation Returns: random direction """ val = MissionWeather._gauss(base_heading, sigma...
[ "def", "_randomize_direction", "(", "base_heading", ",", "sigma", ")", "->", "int", ":", "val", "=", "MissionWeather", ".", "_gauss", "(", "base_heading", ",", "sigma", ")", "val", "=", "MissionWeather", ".", "_normalize_direction", "(", "val", ")", "return", ...
Creates a variation in direction Args: base_heading: base direction sigma: sigma value for gaussian variation Returns: random direction
[ "Creates", "a", "variation", "in", "direction" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/weather/mission_weather/mission_weather.py#L154-L167
etcher-be/emiz
emiz/weather/mission_weather/mission_weather.py
MissionWeather.apply_to_miz
def apply_to_miz(self, miz): """ Applies weather to an opened Miz file (the mission will be mutated) Args: miz: source miz Returns: True """ report = ['Building mission with weather:'] miz.mission.weather.wind_at_ground_level_dir = self.wind_at_gr...
python
def apply_to_miz(self, miz): """ Applies weather to an opened Miz file (the mission will be mutated) Args: miz: source miz Returns: True """ report = ['Building mission with weather:'] miz.mission.weather.wind_at_ground_level_dir = self.wind_at_gr...
[ "def", "apply_to_miz", "(", "self", ",", "miz", ")", ":", "report", "=", "[", "'Building mission with weather:'", "]", "miz", ".", "mission", ".", "weather", ".", "wind_at_ground_level_dir", "=", "self", ".", "wind_at_ground_level_dir", "miz", ".", "mission", "....
Applies weather to an opened Miz file (the mission will be mutated) Args: miz: source miz Returns: True
[ "Applies", "weather", "to", "an", "opened", "Miz", "file", "(", "the", "mission", "will", "be", "mutated", ")" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/weather/mission_weather/mission_weather.py#L296-L372
matthewdeanmartin/jiggle_version
jiggle_version/find_version_by_package.py
version_by_pip
def version_by_pip(package): """ Don't use this for bumping code, unless it is dot installed, this is going to look at pip installed packages? :param package: :return: """ command = "pip show {0}".format(package) result = execute_get_text(command) for line in result.split("\n"): ...
python
def version_by_pip(package): """ Don't use this for bumping code, unless it is dot installed, this is going to look at pip installed packages? :param package: :return: """ command = "pip show {0}".format(package) result = execute_get_text(command) for line in result.split("\n"): ...
[ "def", "version_by_pip", "(", "package", ")", ":", "command", "=", "\"pip show {0}\"", ".", "format", "(", "package", ")", "result", "=", "execute_get_text", "(", "command", ")", "for", "line", "in", "result", ".", "split", "(", "\"\\n\"", ")", ":", "if", ...
Don't use this for bumping code, unless it is dot installed, this is going to look at pip installed packages? :param package: :return:
[ "Don", "t", "use", "this", "for", "bumping", "code", "unless", "it", "is", "dot", "installed", "this", "is", "going", "to", "look", "at", "pip", "installed", "packages?", ":", "param", "package", ":", ":", "return", ":" ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_by_package.py#L42-L54
matthewdeanmartin/jiggle_version
jiggle_version/find_version_by_package.py
guess_version_by_running_live_package
def guess_version_by_running_live_package( pkg_key, default="?" ): # type: (str,str) -> Any """Guess the version of a pkg when pip doesn't provide it. :param str pkg_key: key of the package :param str default: default version to return if unable to find :returns: version :rtype: string ""...
python
def guess_version_by_running_live_package( pkg_key, default="?" ): # type: (str,str) -> Any """Guess the version of a pkg when pip doesn't provide it. :param str pkg_key: key of the package :param str default: default version to return if unable to find :returns: version :rtype: string ""...
[ "def", "guess_version_by_running_live_package", "(", "pkg_key", ",", "default", "=", "\"?\"", ")", ":", "# type: (str,str) -> Any", "try", ":", "m", "=", "import_module", "(", "pkg_key", ")", "except", "ImportError", ":", "return", "default", "else", ":", "return"...
Guess the version of a pkg when pip doesn't provide it. :param str pkg_key: key of the package :param str default: default version to return if unable to find :returns: version :rtype: string
[ "Guess", "the", "version", "of", "a", "pkg", "when", "pip", "doesn", "t", "provide", "it", "." ]
train
https://github.com/matthewdeanmartin/jiggle_version/blob/963656a0a47b7162780a5f6c8f4b8bbbebc148f5/jiggle_version/find_version_by_package.py#L58-L74
bosha/pypushalot
pushalot/apis.py
BaseAPI.get_api_params
def get_api_params(self): """Dictionary with available API parameters :raises ValueError: If value of __class__.params is not dictionary :return: Should return dict with available pushalot API methods :rtype: dict """ result = self.params if type(result) != dict:...
python
def get_api_params(self): """Dictionary with available API parameters :raises ValueError: If value of __class__.params is not dictionary :return: Should return dict with available pushalot API methods :rtype: dict """ result = self.params if type(result) != dict:...
[ "def", "get_api_params", "(", "self", ")", ":", "result", "=", "self", ".", "params", "if", "type", "(", "result", ")", "!=", "dict", ":", "raise", "ValueError", "(", "'{}.params should return dictionary'", ".", "format", "(", "self", ".", "__class__", ".", ...
Dictionary with available API parameters :raises ValueError: If value of __class__.params is not dictionary :return: Should return dict with available pushalot API methods :rtype: dict
[ "Dictionary", "with", "available", "API", "parameters" ]
train
https://github.com/bosha/pypushalot/blob/c1b5c941210ae61716e1695816a40c1676733739/pushalot/apis.py#L24-L38
bosha/pypushalot
pushalot/apis.py
BaseAPI.get_api_required_params
def get_api_required_params(self): """ List with required params :return: Dictionary with API parameters :raises ValueError: If value of __class__.required_params is not list :rtype: list """ result = self.required_params if type(result) != list: rais...
python
def get_api_required_params(self): """ List with required params :return: Dictionary with API parameters :raises ValueError: If value of __class__.required_params is not list :rtype: list """ result = self.required_params if type(result) != list: rais...
[ "def", "get_api_required_params", "(", "self", ")", ":", "result", "=", "self", ".", "required_params", "if", "type", "(", "result", ")", "!=", "list", ":", "raise", "ValueError", "(", "'{}.required_params should return list'", ".", "format", "(", "self", ".", ...
List with required params :return: Dictionary with API parameters :raises ValueError: If value of __class__.required_params is not list :rtype: list
[ "List", "with", "required", "params" ]
train
https://github.com/bosha/pypushalot/blob/c1b5c941210ae61716e1695816a40c1676733739/pushalot/apis.py#L40-L54
bosha/pypushalot
pushalot/apis.py
BaseAPI._build_params_from_kwargs
def _build_params_from_kwargs(self, **kwargs): """Builds parameters from passed arguments Search passed parameters in available methods, prepend specified API key, and return dictionary which can be sent directly to API server. :param kwargs: :type param: dict ...
python
def _build_params_from_kwargs(self, **kwargs): """Builds parameters from passed arguments Search passed parameters in available methods, prepend specified API key, and return dictionary which can be sent directly to API server. :param kwargs: :type param: dict ...
[ "def", "_build_params_from_kwargs", "(", "self", ",", "*", "*", "kwargs", ")", ":", "api_methods", "=", "self", ".", "get_api_params", "(", ")", "required_methods", "=", "self", ".", "get_api_required_params", "(", ")", "ret_kwargs", "=", "{", "}", "for", "k...
Builds parameters from passed arguments Search passed parameters in available methods, prepend specified API key, and return dictionary which can be sent directly to API server. :param kwargs: :type param: dict :raises ValueError: If type of specified parameter doesn't...
[ "Builds", "parameters", "from", "passed", "arguments" ]
train
https://github.com/bosha/pypushalot/blob/c1b5c941210ae61716e1695816a40c1676733739/pushalot/apis.py#L97-L145
ngmiller/mipsy
mipsy/util.py
LabelCache.query
def query(self, label): """ Returns (hit, index) tuple. hit is a boolean, signifying label presence in the cache index is an integer, the instruction index for the label entry """ try: return True, self.cache[label] except KeyError, e: retu...
python
def query(self, label): """ Returns (hit, index) tuple. hit is a boolean, signifying label presence in the cache index is an integer, the instruction index for the label entry """ try: return True, self.cache[label] except KeyError, e: retu...
[ "def", "query", "(", "self", ",", "label", ")", ":", "try", ":", "return", "True", ",", "self", ".", "cache", "[", "label", "]", "except", "KeyError", ",", "e", ":", "return", "False", ",", "0" ]
Returns (hit, index) tuple. hit is a boolean, signifying label presence in the cache index is an integer, the instruction index for the label entry
[ "Returns", "(", "hit", "index", ")", "tuple", ".", "hit", "is", "a", "boolean", "signifying", "label", "presence", "in", "the", "cache", "index", "is", "an", "integer", "the", "instruction", "index", "for", "the", "label", "entry" ]
train
https://github.com/ngmiller/mipsy/blob/78c058f44685765193acd386e81fada3b4187b95/mipsy/util.py#L51-L60
ngmiller/mipsy
mipsy/util.py
LabelCache.write
def write(self, label, index): """ Saves a new label, index mapping to the cache. Raises a RuntimeError on a conflict. """ if label in self.cache: if self.cache[label] != index: error_message = 'cache_conflict on label: {} with index: {}\ncache dump: {...
python
def write(self, label, index): """ Saves a new label, index mapping to the cache. Raises a RuntimeError on a conflict. """ if label in self.cache: if self.cache[label] != index: error_message = 'cache_conflict on label: {} with index: {}\ncache dump: {...
[ "def", "write", "(", "self", ",", "label", ",", "index", ")", ":", "if", "label", "in", "self", ".", "cache", ":", "if", "self", ".", "cache", "[", "label", "]", "!=", "index", ":", "error_message", "=", "'cache_conflict on label: {} with index: {}\\ncache d...
Saves a new label, index mapping to the cache. Raises a RuntimeError on a conflict.
[ "Saves", "a", "new", "label", "index", "mapping", "to", "the", "cache", ".", "Raises", "a", "RuntimeError", "on", "a", "conflict", "." ]
train
https://github.com/ngmiller/mipsy/blob/78c058f44685765193acd386e81fada3b4187b95/mipsy/util.py#L62-L72
joausaga/ideascaly
ideascaly/utils.py
pack_image
def pack_image(filename, max_size, form_field='image'): """Pack an image from file into multipart-formdata post body""" try: if os.path.getsize(filename) > (max_size * 1024): raise IdeaScalyError('File is too big, must be less than %skb.' % max_size) except os.error a...
python
def pack_image(filename, max_size, form_field='image'): """Pack an image from file into multipart-formdata post body""" try: if os.path.getsize(filename) > (max_size * 1024): raise IdeaScalyError('File is too big, must be less than %skb.' % max_size) except os.error a...
[ "def", "pack_image", "(", "filename", ",", "max_size", ",", "form_field", "=", "'image'", ")", ":", "try", ":", "if", "os", ".", "path", ".", "getsize", "(", "filename", ")", ">", "(", "max_size", "*", "1024", ")", ":", "raise", "IdeaScalyError", "(", ...
Pack an image from file into multipart-formdata post body
[ "Pack", "an", "image", "from", "file", "into", "multipart", "-", "formdata", "post", "body" ]
train
https://github.com/joausaga/ideascaly/blob/8aabb7bb1ed058406a8d352a7844e183ab64e008/ideascaly/utils.py#L63-L106
Diaoul/pyextdirect
pyextdirect/configuration.py
create_configuration
def create_configuration(name='Base'): """Create a configuration base class It is built using :class:`ConfigurationMeta`. Subclassing such a base class will register exposed methods .. class:: Base .. attribute:: configuration Configuration dict that can be used by a Router or th...
python
def create_configuration(name='Base'): """Create a configuration base class It is built using :class:`ConfigurationMeta`. Subclassing such a base class will register exposed methods .. class:: Base .. attribute:: configuration Configuration dict that can be used by a Router or th...
[ "def", "create_configuration", "(", "name", "=", "'Base'", ")", ":", "@", "classmethod", "def", "register", "(", "cls", ",", "element", ",", "action", ",", "method", ")", ":", "if", "not", "action", "in", "cls", ".", "configuration", ":", "cls", ".", "...
Create a configuration base class It is built using :class:`ConfigurationMeta`. Subclassing such a base class will register exposed methods .. class:: Base .. attribute:: configuration Configuration dict that can be used by a Router or the API .. classmethod:: register(eleme...
[ "Create", "a", "configuration", "base", "class" ]
train
https://github.com/Diaoul/pyextdirect/blob/34ddfe882d467b3769644e8131fb90fe472eff80/pyextdirect/configuration.py#L53-L82
Diaoul/pyextdirect
pyextdirect/configuration.py
expose
def expose(f=None, base=None, action=None, method=None, kind=BASIC): """Decorator to expose a function .. note:: A module function can be decorated but ``base`` parameter has to be specified :param f: function to expose :type f: function or None :param base: base class that can register th...
python
def expose(f=None, base=None, action=None, method=None, kind=BASIC): """Decorator to expose a function .. note:: A module function can be decorated but ``base`` parameter has to be specified :param f: function to expose :type f: function or None :param base: base class that can register th...
[ "def", "expose", "(", "f", "=", "None", ",", "base", "=", "None", ",", "action", "=", "None", ",", "method", "=", "None", ",", "kind", "=", "BASIC", ")", ":", "def", "expose_f", "(", "f", ")", ":", "f", ".", "exposed", "=", "True", "f", ".", ...
Decorator to expose a function .. note:: A module function can be decorated but ``base`` parameter has to be specified :param f: function to expose :type f: function or None :param base: base class that can register the function :param string action: name of the exposed action that will ho...
[ "Decorator", "to", "expose", "a", "function" ]
train
https://github.com/Diaoul/pyextdirect/blob/34ddfe882d467b3769644e8131fb90fe472eff80/pyextdirect/configuration.py#L85-L116
Diaoul/pyextdirect
pyextdirect/configuration.py
merge_configurations
def merge_configurations(configurations): """Merge configurations together and raise error if a conflict is detected :param configurations: configurations to merge together :type configurations: list of :attr:`~pyextdirect.configuration.Base.configuration` dicts :return: merged configurations as a sing...
python
def merge_configurations(configurations): """Merge configurations together and raise error if a conflict is detected :param configurations: configurations to merge together :type configurations: list of :attr:`~pyextdirect.configuration.Base.configuration` dicts :return: merged configurations as a sing...
[ "def", "merge_configurations", "(", "configurations", ")", ":", "configuration", "=", "{", "}", "for", "c", "in", "configurations", ":", "for", "k", ",", "v", "in", "c", ".", "iteritems", "(", ")", ":", "if", "k", "in", "configuration", ":", "raise", "...
Merge configurations together and raise error if a conflict is detected :param configurations: configurations to merge together :type configurations: list of :attr:`~pyextdirect.configuration.Base.configuration` dicts :return: merged configurations as a single one :rtype: dict
[ "Merge", "configurations", "together", "and", "raise", "error", "if", "a", "conflict", "is", "detected" ]
train
https://github.com/Diaoul/pyextdirect/blob/34ddfe882d467b3769644e8131fb90fe472eff80/pyextdirect/configuration.py#L119-L134
rameshg87/pyremotevbox
pyremotevbox/ZSI/dispatch.py
_Dispatch
def _Dispatch(ps, modules, SendResponse, SendFault, nsdict={}, typesmodule=None, gettypecode=gettypecode, rpc=False, docstyle=False, **kw): '''Find a handler for the SOAP request in ps; search modules. Call SendResponse or SendFault to send the reply back, appropriately. Behaviors: d...
python
def _Dispatch(ps, modules, SendResponse, SendFault, nsdict={}, typesmodule=None, gettypecode=gettypecode, rpc=False, docstyle=False, **kw): '''Find a handler for the SOAP request in ps; search modules. Call SendResponse or SendFault to send the reply back, appropriately. Behaviors: d...
[ "def", "_Dispatch", "(", "ps", ",", "modules", ",", "SendResponse", ",", "SendFault", ",", "nsdict", "=", "{", "}", ",", "typesmodule", "=", "None", ",", "gettypecode", "=", "gettypecode", ",", "rpc", "=", "False", ",", "docstyle", "=", "False", ",", "...
Find a handler for the SOAP request in ps; search modules. Call SendResponse or SendFault to send the reply back, appropriately. Behaviors: default -- Call "handler" method with pyobj representation of body root, and return a self-describing request (w/typecode). Parsing done via a typecod...
[ "Find", "a", "handler", "for", "the", "SOAP", "request", "in", "ps", ";", "search", "modules", ".", "Call", "SendResponse", "or", "SendFault", "to", "send", "the", "reply", "back", "appropriately", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/dispatch.py#L23-L153
rameshg87/pyremotevbox
pyremotevbox/ZSI/dispatch.py
AsCGI
def AsCGI(nsdict={}, typesmodule=None, rpc=False, modules=None): '''Dispatch within a CGI script. ''' if os.environ.get('REQUEST_METHOD') != 'POST': _CGISendFault(Fault(Fault.Client, 'Must use POST')) return ct = os.environ['CONTENT_TYPE'] try: if ct.startswith('multipart/'):...
python
def AsCGI(nsdict={}, typesmodule=None, rpc=False, modules=None): '''Dispatch within a CGI script. ''' if os.environ.get('REQUEST_METHOD') != 'POST': _CGISendFault(Fault(Fault.Client, 'Must use POST')) return ct = os.environ['CONTENT_TYPE'] try: if ct.startswith('multipart/'):...
[ "def", "AsCGI", "(", "nsdict", "=", "{", "}", ",", "typesmodule", "=", "None", ",", "rpc", "=", "False", ",", "modules", "=", "None", ")", ":", "if", "os", ".", "environ", ".", "get", "(", "'REQUEST_METHOD'", ")", "!=", "'POST'", ":", "_CGISendFault"...
Dispatch within a CGI script.
[ "Dispatch", "within", "a", "CGI", "script", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/dispatch.py#L248-L267
rameshg87/pyremotevbox
pyremotevbox/ZSI/dispatch.py
AsHandler
def AsHandler(request=None, modules=None, **kw): '''Dispatch from within ModPython.''' ps = ParsedSoap(request) kw['request'] = request _Dispatch(ps, modules, _ModPythonSendXML, _ModPythonSendFault, **kw)
python
def AsHandler(request=None, modules=None, **kw): '''Dispatch from within ModPython.''' ps = ParsedSoap(request) kw['request'] = request _Dispatch(ps, modules, _ModPythonSendXML, _ModPythonSendFault, **kw)
[ "def", "AsHandler", "(", "request", "=", "None", ",", "modules", "=", "None", ",", "*", "*", "kw", ")", ":", "ps", "=", "ParsedSoap", "(", "request", ")", "kw", "[", "'request'", "]", "=", "request", "_Dispatch", "(", "ps", ",", "modules", ",", "_M...
Dispatch from within ModPython.
[ "Dispatch", "from", "within", "ModPython", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/dispatch.py#L269-L273
rameshg87/pyremotevbox
pyremotevbox/ZSI/dispatch.py
AsJonPy
def AsJonPy(request=None, modules=None, **kw): '''Dispatch within a jonpy CGI/FastCGI script. ''' kw['request'] = request if request.environ.get('REQUEST_METHOD') != 'POST': _JonPySendFault(Fault(Fault.Client, 'Must use POST'), **kw) return ct = request.environ['CONTENT_TYPE'] t...
python
def AsJonPy(request=None, modules=None, **kw): '''Dispatch within a jonpy CGI/FastCGI script. ''' kw['request'] = request if request.environ.get('REQUEST_METHOD') != 'POST': _JonPySendFault(Fault(Fault.Client, 'Must use POST'), **kw) return ct = request.environ['CONTENT_TYPE'] t...
[ "def", "AsJonPy", "(", "request", "=", "None", ",", "modules", "=", "None", ",", "*", "*", "kw", ")", ":", "kw", "[", "'request'", "]", "=", "request", "if", "request", ".", "environ", ".", "get", "(", "'REQUEST_METHOD'", ")", "!=", "'POST'", ":", ...
Dispatch within a jonpy CGI/FastCGI script.
[ "Dispatch", "within", "a", "jonpy", "CGI", "/", "FastCGI", "script", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/dispatch.py#L275-L295
rameshg87/pyremotevbox
pyremotevbox/ZSI/dispatch.py
SOAPRequestHandler.send_xml
def send_xml(self, text, code=200): '''Send some XML. ''' self.send_response(code) if text: self.send_header('Content-type', 'text/xml; charset="%s"' %UNICODE_ENCODING) self.send_header('Content-Length', str(len(text))) self.end_headers() ...
python
def send_xml(self, text, code=200): '''Send some XML. ''' self.send_response(code) if text: self.send_header('Content-type', 'text/xml; charset="%s"' %UNICODE_ENCODING) self.send_header('Content-Length', str(len(text))) self.end_headers() ...
[ "def", "send_xml", "(", "self", ",", "text", ",", "code", "=", "200", ")", ":", "self", ".", "send_response", "(", "code", ")", "if", "text", ":", "self", ".", "send_header", "(", "'Content-type'", ",", "'text/xml; charset=\"%s\"'", "%", "UNICODE_ENCODING", ...
Send some XML.
[ "Send", "some", "XML", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/dispatch.py#L192-L206
rameshg87/pyremotevbox
pyremotevbox/ZSI/dispatch.py
SOAPRequestHandler.do_POST
def do_POST(self): '''The POST command. ''' try: ct = self.headers['content-type'] if ct.startswith('multipart/'): cid = resolvers.MIMEResolver(ct, self.rfile) xml = cid.GetSOAPPart() ps = ParsedSoap(xml, resolver=cid.Resolv...
python
def do_POST(self): '''The POST command. ''' try: ct = self.headers['content-type'] if ct.startswith('multipart/'): cid = resolvers.MIMEResolver(ct, self.rfile) xml = cid.GetSOAPPart() ps = ParsedSoap(xml, resolver=cid.Resolv...
[ "def", "do_POST", "(", "self", ")", ":", "try", ":", "ct", "=", "self", ".", "headers", "[", "'content-type'", "]", "if", "ct", ".", "startswith", "(", "'multipart/'", ")", ":", "cid", "=", "resolvers", ".", "MIMEResolver", "(", "ct", ",", "self", "....
The POST command.
[ "The", "POST", "command", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/dispatch.py#L213-L235
narfman0/helga-markovify
helga_markovify/markov.py
punctuate
def punctuate(current_text, new_text, add_punctuation): """ Add punctuation as needed """ if add_punctuation and current_text and not current_text[-1] in string.punctuation: current_text += '. ' spacer = ' ' if not current_text or (not current_text[-1].isspace() and not new_text[0].isspace()) else '...
python
def punctuate(current_text, new_text, add_punctuation): """ Add punctuation as needed """ if add_punctuation and current_text and not current_text[-1] in string.punctuation: current_text += '. ' spacer = ' ' if not current_text or (not current_text[-1].isspace() and not new_text[0].isspace()) else '...
[ "def", "punctuate", "(", "current_text", ",", "new_text", ",", "add_punctuation", ")", ":", "if", "add_punctuation", "and", "current_text", "and", "not", "current_text", "[", "-", "1", "]", "in", "string", ".", "punctuation", ":", "current_text", "+=", "'. '",...
Add punctuation as needed
[ "Add", "punctuation", "as", "needed" ]
train
https://github.com/narfman0/helga-markovify/blob/b5a82de070102e6da1fd3f5f81cad12d0a9185d8/helga_markovify/markov.py#L7-L12
narfman0/helga-markovify
helga_markovify/markov.py
ingest
def ingest(topic, text, **kwargs): """ Ingest the given text for the topic """ if not text: raise ValueError('No text given to ingest for topic: ' + topic) data = {'topic': topic, 'text': text.strip()} data.update(kwargs) db.markovify.insert(data)
python
def ingest(topic, text, **kwargs): """ Ingest the given text for the topic """ if not text: raise ValueError('No text given to ingest for topic: ' + topic) data = {'topic': topic, 'text': text.strip()} data.update(kwargs) db.markovify.insert(data)
[ "def", "ingest", "(", "topic", ",", "text", ",", "*", "*", "kwargs", ")", ":", "if", "not", "text", ":", "raise", "ValueError", "(", "'No text given to ingest for topic: '", "+", "topic", ")", "data", "=", "{", "'topic'", ":", "topic", ",", "'text'", ":"...
Ingest the given text for the topic
[ "Ingest", "the", "given", "text", "for", "the", "topic" ]
train
https://github.com/narfman0/helga-markovify/blob/b5a82de070102e6da1fd3f5f81cad12d0a9185d8/helga_markovify/markov.py#L15-L21
narfman0/helga-markovify
helga_markovify/markov.py
generate
def generate(topic, add_punctuation, character_count=None): """ Generate the text for a given topic """ corpus_cursor = db.markovify.find({'topic': topic}) if(corpus_cursor): corpus = '' for text in corpus_cursor: corpus = punctuate(corpus, text['text'], add_punctuation) ...
python
def generate(topic, add_punctuation, character_count=None): """ Generate the text for a given topic """ corpus_cursor = db.markovify.find({'topic': topic}) if(corpus_cursor): corpus = '' for text in corpus_cursor: corpus = punctuate(corpus, text['text'], add_punctuation) ...
[ "def", "generate", "(", "topic", ",", "add_punctuation", ",", "character_count", "=", "None", ")", ":", "corpus_cursor", "=", "db", ".", "markovify", ".", "find", "(", "{", "'topic'", ":", "topic", "}", ")", "if", "(", "corpus_cursor", ")", ":", "corpus"...
Generate the text for a given topic
[ "Generate", "the", "text", "for", "a", "given", "topic" ]
train
https://github.com/narfman0/helga-markovify/blob/b5a82de070102e6da1fd3f5f81cad12d0a9185d8/helga_markovify/markov.py#L24-L37
ravenac95/lxc4u
lxc4u/api.py
default_setup
def default_setup(): """The default API setup for lxc4u This is the API that you access globally from lxc4u. """ service = LXCService lxc_types = dict(LXC=LXC, LXCWithOverlays=LXCWithOverlays, __default__=UnmanagedLXC) loader = LXCLoader(lxc_types, service) manager = LXCManager(...
python
def default_setup(): """The default API setup for lxc4u This is the API that you access globally from lxc4u. """ service = LXCService lxc_types = dict(LXC=LXC, LXCWithOverlays=LXCWithOverlays, __default__=UnmanagedLXC) loader = LXCLoader(lxc_types, service) manager = LXCManager(...
[ "def", "default_setup", "(", ")", ":", "service", "=", "LXCService", "lxc_types", "=", "dict", "(", "LXC", "=", "LXC", ",", "LXCWithOverlays", "=", "LXCWithOverlays", ",", "__default__", "=", "UnmanagedLXC", ")", "loader", "=", "LXCLoader", "(", "lxc_types", ...
The default API setup for lxc4u This is the API that you access globally from lxc4u.
[ "The", "default", "API", "setup", "for", "lxc4u" ]
train
https://github.com/ravenac95/lxc4u/blob/4b5a9c8e25af97e5637db2f4c0c67d319ab0ed32/lxc4u/api.py#L6-L16
dossier/dossier.label
dossier/label/label.py
unordered_pair_eq
def unordered_pair_eq(pair1, pair2): '''Performs pairwise unordered equality. ``pair1`` == ``pair2`` if and only if ``frozenset(pair1)`` == ``frozenset(pair2)``. ''' (x1, y1), (x2, y2) = pair1, pair2 return (x1 == x2 and y1 == y2) or (x1 == y2 and y1 == x2)
python
def unordered_pair_eq(pair1, pair2): '''Performs pairwise unordered equality. ``pair1`` == ``pair2`` if and only if ``frozenset(pair1)`` == ``frozenset(pair2)``. ''' (x1, y1), (x2, y2) = pair1, pair2 return (x1 == x2 and y1 == y2) or (x1 == y2 and y1 == x2)
[ "def", "unordered_pair_eq", "(", "pair1", ",", "pair2", ")", ":", "(", "x1", ",", "y1", ")", ",", "(", "x2", ",", "y2", ")", "=", "pair1", ",", "pair2", "return", "(", "x1", "==", "x2", "and", "y1", "==", "y2", ")", "or", "(", "x1", "==", "y2...
Performs pairwise unordered equality. ``pair1`` == ``pair2`` if and only if ``frozenset(pair1)`` == ``frozenset(pair2)``.
[ "Performs", "pairwise", "unordered", "equality", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L933-L940
dossier/dossier.label
dossier/label/label.py
expand_labels
def expand_labels(labels, subtopic=False): '''Expand a set of labels that define a connected component. ``labels`` must define a *positive* connected component: it is all of the edges that make up the *single* connected component in the :class:`LabelStore`. expand will ignore subtopic assignments, and ...
python
def expand_labels(labels, subtopic=False): '''Expand a set of labels that define a connected component. ``labels`` must define a *positive* connected component: it is all of the edges that make up the *single* connected component in the :class:`LabelStore`. expand will ignore subtopic assignments, and ...
[ "def", "expand_labels", "(", "labels", ",", "subtopic", "=", "False", ")", ":", "labels", "=", "list", "(", "labels", ")", "assert", "all", "(", "lab", ".", "value", "==", "CorefValue", ".", "Positive", "for", "lab", "in", "labels", ")", "# Anything to e...
Expand a set of labels that define a connected component. ``labels`` must define a *positive* connected component: it is all of the edges that make up the *single* connected component in the :class:`LabelStore`. expand will ignore subtopic assignments, and annotator_id will be an arbitrary one selected...
[ "Expand", "a", "set", "of", "labels", "that", "define", "a", "connected", "component", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L955-L999
dossier/dossier.label
dossier/label/label.py
normalize_ident
def normalize_ident(ident): '''Splits a generic identifier. If ``ident`` is a tuple, then ``(ident[0], ident[1])`` is returned. Otherwise, ``(ident[0], None)`` is returned. ''' if isinstance(ident, tuple) and len(ident) == 2: return ident[0], ident[1] # content_id, subtopic_id else: ...
python
def normalize_ident(ident): '''Splits a generic identifier. If ``ident`` is a tuple, then ``(ident[0], ident[1])`` is returned. Otherwise, ``(ident[0], None)`` is returned. ''' if isinstance(ident, tuple) and len(ident) == 2: return ident[0], ident[1] # content_id, subtopic_id else: ...
[ "def", "normalize_ident", "(", "ident", ")", ":", "if", "isinstance", "(", "ident", ",", "tuple", ")", "and", "len", "(", "ident", ")", "==", "2", ":", "return", "ident", "[", "0", "]", ",", "ident", "[", "1", "]", "# content_id, subtopic_id", "else", ...
Splits a generic identifier. If ``ident`` is a tuple, then ``(ident[0], ident[1])`` is returned. Otherwise, ``(ident[0], None)`` is returned.
[ "Splits", "a", "generic", "identifier", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L1002-L1011
dossier/dossier.label
dossier/label/label.py
idents_from_label
def idents_from_label(lab, subtopic=False): '''Returns the "ident" of a label. If ``subtopic`` is ``True``, then a pair of pairs is returned, where each pair corresponds to the content id and subtopic id in the given label. Otherwise, a pair of pairs is returned, but the second element of each ...
python
def idents_from_label(lab, subtopic=False): '''Returns the "ident" of a label. If ``subtopic`` is ``True``, then a pair of pairs is returned, where each pair corresponds to the content id and subtopic id in the given label. Otherwise, a pair of pairs is returned, but the second element of each ...
[ "def", "idents_from_label", "(", "lab", ",", "subtopic", "=", "False", ")", ":", "if", "not", "subtopic", ":", "return", "(", "lab", ".", "content_id1", ",", "None", ")", ",", "(", "lab", ".", "content_id2", ",", "None", ")", "else", ":", "return", "...
Returns the "ident" of a label. If ``subtopic`` is ``True``, then a pair of pairs is returned, where each pair corresponds to the content id and subtopic id in the given label. Otherwise, a pair of pairs is returned, but the second element of each pair is always ``None``. This is a helper fun...
[ "Returns", "the", "ident", "of", "a", "label", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L1018-L1037
dossier/dossier.label
dossier/label/label.py
LabelStore.put
def put(self, *labels): '''Add a new label to the store. :param label: label :type label: :class:`Label` ''' puts = [] for label in labels: k1, k2 = self._keys_from_label(label) v = self._value_from_label(label) puts.append((k1, v)) ...
python
def put(self, *labels): '''Add a new label to the store. :param label: label :type label: :class:`Label` ''' puts = [] for label in labels: k1, k2 = self._keys_from_label(label) v = self._value_from_label(label) puts.append((k1, v)) ...
[ "def", "put", "(", "self", ",", "*", "labels", ")", ":", "puts", "=", "[", "]", "for", "label", "in", "labels", ":", "k1", ",", "k2", "=", "self", ".", "_keys_from_label", "(", "label", ")", "v", "=", "self", ".", "_value_from_label", "(", "label",...
Add a new label to the store. :param label: label :type label: :class:`Label`
[ "Add", "a", "new", "label", "to", "the", "store", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L545-L557
dossier/dossier.label
dossier/label/label.py
LabelStore._label_from_kvlayer
def _label_from_kvlayer(self, k, v): '''Make a label from a kvlayer row.''' (content_id1, content_id2, subtopic_id1, subtopic_id2, annotator_id, inverted_epoch_ticks) = k epoch_ticks = time_complement(inverted_epoch_ticks) (unpacked,) = struct.unpack('B', v[0]) value = ...
python
def _label_from_kvlayer(self, k, v): '''Make a label from a kvlayer row.''' (content_id1, content_id2, subtopic_id1, subtopic_id2, annotator_id, inverted_epoch_ticks) = k epoch_ticks = time_complement(inverted_epoch_ticks) (unpacked,) = struct.unpack('B', v[0]) value = ...
[ "def", "_label_from_kvlayer", "(", "self", ",", "k", ",", "v", ")", ":", "(", "content_id1", ",", "content_id2", ",", "subtopic_id1", ",", "subtopic_id2", ",", "annotator_id", ",", "inverted_epoch_ticks", ")", "=", "k", "epoch_ticks", "=", "time_complement", "...
Make a label from a kvlayer row.
[ "Make", "a", "label", "from", "a", "kvlayer", "row", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L611-L632
dossier/dossier.label
dossier/label/label.py
LabelStore.directly_connected
def directly_connected(self, ident): '''Return a generator of labels connected to ``ident``. ``ident`` may be a ``content_id`` or a ``(content_id, subtopic_id)``. If no labels are defined for ``ident``, then the generator will yield no labels. Note that this only retur...
python
def directly_connected(self, ident): '''Return a generator of labels connected to ``ident``. ``ident`` may be a ``content_id`` or a ``(content_id, subtopic_id)``. If no labels are defined for ``ident``, then the generator will yield no labels. Note that this only retur...
[ "def", "directly_connected", "(", "self", ",", "ident", ")", ":", "content_id", ",", "subtopic_id", "=", "normalize_ident", "(", "ident", ")", "return", "self", ".", "everything", "(", "include_deleted", "=", "False", ",", "content_id", "=", "content_id", ",",...
Return a generator of labels connected to ``ident``. ``ident`` may be a ``content_id`` or a ``(content_id, subtopic_id)``. If no labels are defined for ``ident``, then the generator will yield no labels. Note that this only returns *directly* connected labels. It will ...
[ "Return", "a", "generator", "of", "labels", "connected", "to", "ident", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L634-L653
dossier/dossier.label
dossier/label/label.py
LabelStore.split_by_connected_component
def split_by_connected_component(self, idents): '''Split idents into equivalence classes based on connected components. ''' idents_remaining = set(idents) connected_components = [] for ident in idents: if ident not in idents_remaining: continue...
python
def split_by_connected_component(self, idents): '''Split idents into equivalence classes based on connected components. ''' idents_remaining = set(idents) connected_components = [] for ident in idents: if ident not in idents_remaining: continue...
[ "def", "split_by_connected_component", "(", "self", ",", "idents", ")", ":", "idents_remaining", "=", "set", "(", "idents", ")", "connected_components", "=", "[", "]", "for", "ident", "in", "idents", ":", "if", "ident", "not", "in", "idents_remaining", ":", ...
Split idents into equivalence classes based on connected components.
[ "Split", "idents", "into", "equivalence", "classes", "based", "on", "connected", "components", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L655-L676
dossier/dossier.label
dossier/label/label.py
LabelStore.connected_component
def connected_component(self, ident): '''Return a connected component generator for ``ident``. ``ident`` may be a ``content_id`` or a ``(content_id, subtopic_id)``. Given an ``ident``, return the corresponding connected component by following all positive transitivity relations...
python
def connected_component(self, ident): '''Return a connected component generator for ``ident``. ``ident`` may be a ``content_id`` or a ``(content_id, subtopic_id)``. Given an ``ident``, return the corresponding connected component by following all positive transitivity relations...
[ "def", "connected_component", "(", "self", ",", "ident", ")", ":", "ident", "=", "normalize_ident", "(", "ident", ")", "done", "=", "set", "(", ")", "# set of cids that we've queried with", "todo", "=", "set", "(", "[", "ident", "]", ")", "# set of cids to do ...
Return a connected component generator for ``ident``. ``ident`` may be a ``content_id`` or a ``(content_id, subtopic_id)``. Given an ``ident``, return the corresponding connected component by following all positive transitivity relationships. For example, if ``(a, b, 1)`` is a...
[ "Return", "a", "connected", "component", "generator", "for", "ident", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L678-L718
dossier/dossier.label
dossier/label/label.py
LabelStore.expand
def expand(self, ident): '''Return expanded set of labels from a connected component. The connected component is derived from ``ident``. ``ident`` may be a ``content_id`` or a ``(content_id, subtopic_id)``. If ``ident`` identifies a subtopic, then expansion is done on a subtopic...
python
def expand(self, ident): '''Return expanded set of labels from a connected component. The connected component is derived from ``ident``. ``ident`` may be a ``content_id`` or a ``(content_id, subtopic_id)``. If ``ident`` identifies a subtopic, then expansion is done on a subtopic...
[ "def", "expand", "(", "self", ",", "ident", ")", ":", "subtopic", "=", "ident_has_subtopic", "(", "normalize_ident", "(", "ident", ")", ")", "labels", "=", "list", "(", "self", ".", "connected_component", "(", "ident", ")", ")", "labels", ".", "extend", ...
Return expanded set of labels from a connected component. The connected component is derived from ``ident``. ``ident`` may be a ``content_id`` or a ``(content_id, subtopic_id)``. If ``ident`` identifies a subtopic, then expansion is done on a subtopic connected component (and expanded l...
[ "Return", "expanded", "set", "of", "labels", "from", "a", "connected", "component", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L720-L747
dossier/dossier.label
dossier/label/label.py
LabelStore.negative_inference
def negative_inference(self, content_id): '''Return a generator of inferred negative label relationships centered on ``content_id``. Negative labels are inferred by getting all other content ids connected to ``content_id`` through a negative label, then running :meth:`LabelStore...
python
def negative_inference(self, content_id): '''Return a generator of inferred negative label relationships centered on ``content_id``. Negative labels are inferred by getting all other content ids connected to ``content_id`` through a negative label, then running :meth:`LabelStore...
[ "def", "negative_inference", "(", "self", ",", "content_id", ")", ":", "neg_labels", "=", "ifilter", "(", "lambda", "l", ":", "l", ".", "value", "==", "CorefValue", ".", "Negative", ",", "self", ".", "directly_connected", "(", "content_id", ")", ")", "for"...
Return a generator of inferred negative label relationships centered on ``content_id``. Negative labels are inferred by getting all other content ids connected to ``content_id`` through a negative label, then running :meth:`LabelStore.negative_label_inference` on those labels. S...
[ "Return", "a", "generator", "of", "inferred", "negative", "label", "relationships", "centered", "on", "content_id", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L749-L764
dossier/dossier.label
dossier/label/label.py
LabelStore.negative_label_inference
def negative_label_inference(self, label): '''Return a generator of inferred negative label relationships. Construct ad-hoc negative labels between ``label.content_id1`` and the positive connected component of ``label.content_id2``, and ``label.content_id2`` to the connected component o...
python
def negative_label_inference(self, label): '''Return a generator of inferred negative label relationships. Construct ad-hoc negative labels between ``label.content_id1`` and the positive connected component of ``label.content_id2``, and ``label.content_id2`` to the connected component o...
[ "def", "negative_label_inference", "(", "self", ",", "label", ")", ":", "assert", "label", ".", "value", "==", "CorefValue", ".", "Negative", "yield", "label", "cid2_comp", "=", "self", ".", "connected_component", "(", "label", ".", "content_id2", ")", "for", ...
Return a generator of inferred negative label relationships. Construct ad-hoc negative labels between ``label.content_id1`` and the positive connected component of ``label.content_id2``, and ``label.content_id2`` to the connected component of ``label.content_id1``. Note this wi...
[ "Return", "a", "generator", "of", "inferred", "negative", "label", "relationships", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L766-L798
dossier/dossier.label
dossier/label/label.py
LabelStore._filter_keys
def _filter_keys(self, content_id=None, prefix=None, subtopic_id=None): '''Filter out-of-order labels by key tuple. :class:`Label` always sorts by `(cid1,cid2,sid1,sid2)`, but for efficient lookups on `cid2` this class also stores in order `(cid2,cid1,sid2,sid1)`. Filter out things tha...
python
def _filter_keys(self, content_id=None, prefix=None, subtopic_id=None): '''Filter out-of-order labels by key tuple. :class:`Label` always sorts by `(cid1,cid2,sid1,sid2)`, but for efficient lookups on `cid2` this class also stores in order `(cid2,cid1,sid2,sid1)`. Filter out things tha...
[ "def", "_filter_keys", "(", "self", ",", "content_id", "=", "None", ",", "prefix", "=", "None", ",", "subtopic_id", "=", "None", ")", ":", "def", "accept", "(", "kvp", ")", ":", "(", "content_id1", ",", "content_id2", ",", "subtopic_id1", ",", "subtopic_...
Filter out-of-order labels by key tuple. :class:`Label` always sorts by `(cid1,cid2,sid1,sid2)`, but for efficient lookups on `cid2` this class also stores in order `(cid2,cid1,sid2,sid1)`. Filter out things that are in the wrong order. But, if an original query specified `con...
[ "Filter", "out", "-", "of", "-", "order", "labels", "by", "key", "tuple", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L800-L850
dossier/dossier.label
dossier/label/label.py
LabelStore.everything
def everything(self, include_deleted=False, content_id=None, subtopic_id=None, prefix=None): '''Returns a generator of all labels in the store. If `include_deleted` is :const:`True`, labels that have been overwritten with more recent labels are also included. If `con...
python
def everything(self, include_deleted=False, content_id=None, subtopic_id=None, prefix=None): '''Returns a generator of all labels in the store. If `include_deleted` is :const:`True`, labels that have been overwritten with more recent labels are also included. If `con...
[ "def", "everything", "(", "self", ",", "include_deleted", "=", "False", ",", "content_id", "=", "None", ",", "subtopic_id", "=", "None", ",", "prefix", "=", "None", ")", ":", "if", "content_id", "is", "not", "None", ":", "ranges", "=", "[", "(", "(", ...
Returns a generator of all labels in the store. If `include_deleted` is :const:`True`, labels that have been overwritten with more recent labels are also included. If `content_id` is not :const:`None`, only labels for that content ID are retrieved; and then if `subtopic_id` is not ...
[ "Returns", "a", "generator", "of", "all", "labels", "in", "the", "store", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L852-L884
dossier/dossier.label
dossier/label/label.py
LabelStore.delete
def delete(self, *labels): '''Delete `labels` from the store, which involves deleting two records for each :class:`Label`. :rtype: None :raises: :exc:`KeyError` if any of the `labels` could not be found. ''' deletes = [] for label in labels: k1, k2 =...
python
def delete(self, *labels): '''Delete `labels` from the store, which involves deleting two records for each :class:`Label`. :rtype: None :raises: :exc:`KeyError` if any of the `labels` could not be found. ''' deletes = [] for label in labels: k1, k2 =...
[ "def", "delete", "(", "self", ",", "*", "labels", ")", ":", "deletes", "=", "[", "]", "for", "label", "in", "labels", ":", "k1", ",", "k2", "=", "self", ".", "_keys_from_label", "(", "label", ")", "deletes", ".", "append", "(", "k1", ")", "deletes"...
Delete `labels` from the store, which involves deleting two records for each :class:`Label`. :rtype: None :raises: :exc:`KeyError` if any of the `labels` could not be found.
[ "Delete", "labels", "from", "the", "store", "which", "involves", "deleting", "two", "records", "for", "each", ":", "class", ":", "Label", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L890-L903
dossier/dossier.label
dossier/label/label.py
LabelStore.apply_diff
def apply_diff(self, diff): '''Applies a diff to the label table. A ``diff`` is a dictionary with three keys: ``add``, ``delete`` and ``change``. Each key should map to a list of labels. ``add`` corresponds to the labels that are in ``new`` but not in ``old``. ``delete...
python
def apply_diff(self, diff): '''Applies a diff to the label table. A ``diff`` is a dictionary with three keys: ``add``, ``delete`` and ``change``. Each key should map to a list of labels. ``add`` corresponds to the labels that are in ``new`` but not in ``old``. ``delete...
[ "def", "apply_diff", "(", "self", ",", "diff", ")", ":", "# add and change are easy---just put the labels.", "# delete is a little trickier. We need to scrub out the impact of", "# the previous label without actually deleting it. For this, we", "# use an unknown coref value.", "insert", "=...
Applies a diff to the label table. A ``diff`` is a dictionary with three keys: ``add``, ``delete`` and ``change``. Each key should map to a list of labels. ``add`` corresponds to the labels that are in ``new`` but not in ``old``. ``delete`` corresponds to the labels that are i...
[ "Applies", "a", "diff", "to", "the", "label", "table", "." ]
train
https://github.com/dossier/dossier.label/blob/d445e56b02ffd91ad46b0872cfbff62b9afef7ec/dossier/label/label.py#L905-L930
callowayproject/Transmogrify
transmogrify/filesystem/__init__.py
file_exists
def file_exists(original_file): """ Check to make sure the original file exists """ if original_file.startswith("s3://"): from filesystem import s3 return s3.file_exists(original_file) else: if not os.path.exists(original_file): return False if not os.path...
python
def file_exists(original_file): """ Check to make sure the original file exists """ if original_file.startswith("s3://"): from filesystem import s3 return s3.file_exists(original_file) else: if not os.path.exists(original_file): return False if not os.path...
[ "def", "file_exists", "(", "original_file", ")", ":", "if", "original_file", ".", "startswith", "(", "\"s3://\"", ")", ":", "from", "filesystem", "import", "s3", "return", "s3", ".", "file_exists", "(", "original_file", ")", "else", ":", "if", "not", "os", ...
Check to make sure the original file exists
[ "Check", "to", "make", "sure", "the", "original", "file", "exists" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/filesystem/__init__.py#L29-L41
scottgigante/tasklogger
tasklogger/logger.py
TaskLogger.set_level
def set_level(self, level=1): """Set the logging level Parameters ---------- level : `int` or `bool` (optional, default: 1) If False or 0, prints WARNING and higher messages. If True or 1, prints INFO and higher messages. If 2 or higher, prints all me...
python
def set_level(self, level=1): """Set the logging level Parameters ---------- level : `int` or `bool` (optional, default: 1) If False or 0, prints WARNING and higher messages. If True or 1, prints INFO and higher messages. If 2 or higher, prints all me...
[ "def", "set_level", "(", "self", ",", "level", "=", "1", ")", ":", "if", "level", "is", "True", "or", "level", "==", "1", ":", "level", "=", "logging", ".", "INFO", "level_name", "=", "\"INFO\"", "elif", "level", "is", "False", "or", "level", "<=", ...
Set the logging level Parameters ---------- level : `int` or `bool` (optional, default: 1) If False or 0, prints WARNING and higher messages. If True or 1, prints INFO and higher messages. If 2 or higher, prints all messages.
[ "Set", "the", "logging", "level" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/logger.py#L64-L96
scottgigante/tasklogger
tasklogger/logger.py
TaskLogger.set_timer
def set_timer(self, timer="wall"): """Set the timer function Parameters ---------- timer : {'wall', 'cpu', or callable} Timer function used to measure task running times. 'wall' uses `time.time`, 'cpu' uses `time.process_time` Returns ---...
python
def set_timer(self, timer="wall"): """Set the timer function Parameters ---------- timer : {'wall', 'cpu', or callable} Timer function used to measure task running times. 'wall' uses `time.time`, 'cpu' uses `time.process_time` Returns ---...
[ "def", "set_timer", "(", "self", ",", "timer", "=", "\"wall\"", ")", ":", "if", "timer", "==", "\"wall\"", ":", "timer", "=", "time", ".", "time", "elif", "timer", "==", "\"cpu\"", ":", "try", ":", "timer", "=", "time", ".", "process_time", "except", ...
Set the timer function Parameters ---------- timer : {'wall', 'cpu', or callable} Timer function used to measure task running times. 'wall' uses `time.time`, 'cpu' uses `time.process_time` Returns ------- self
[ "Set", "the", "timer", "function" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/logger.py#L98-L121
scottgigante/tasklogger
tasklogger/logger.py
TaskLogger._log
def _log(self, log_fn, msg): """Log a message """ if self.indent > 0: msg = len(self.tasks) * self.indent * ' ' + msg return log_fn(msg)
python
def _log(self, log_fn, msg): """Log a message """ if self.indent > 0: msg = len(self.tasks) * self.indent * ' ' + msg return log_fn(msg)
[ "def", "_log", "(", "self", ",", "log_fn", ",", "msg", ")", ":", "if", "self", ".", "indent", ">", "0", ":", "msg", "=", "len", "(", "self", ".", "tasks", ")", "*", "self", ".", "indent", "*", "' '", "+", "msg", "return", "log_fn", "(", "msg", ...
Log a message
[ "Log", "a", "message" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/logger.py#L139-L144
scottgigante/tasklogger
tasklogger/logger.py
TaskLogger.start_task
def start_task(self, task): """Begin logging of a task Stores the time this task was started in order to return time lapsed when `complete_task` is called. Parameters ---------- task : str Name of the task to be started """ self.info("Calcula...
python
def start_task(self, task): """Begin logging of a task Stores the time this task was started in order to return time lapsed when `complete_task` is called. Parameters ---------- task : str Name of the task to be started """ self.info("Calcula...
[ "def", "start_task", "(", "self", ",", "task", ")", ":", "self", ".", "info", "(", "\"Calculating {}...\"", ".", "format", "(", "task", ")", ")", "self", ".", "tasks", "[", "task", "]", "=", "self", ".", "timer", "(", ")" ]
Begin logging of a task Stores the time this task was started in order to return time lapsed when `complete_task` is called. Parameters ---------- task : str Name of the task to be started
[ "Begin", "logging", "of", "a", "task" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/logger.py#L206-L218
scottgigante/tasklogger
tasklogger/logger.py
TaskLogger.complete_task
def complete_task(self, task): """Complete logging of a task Returns the time lapsed since `start_task` was called Parameters ---------- task : str Name of the task to be started Returns ------- time : float The time lapsed betwe...
python
def complete_task(self, task): """Complete logging of a task Returns the time lapsed since `start_task` was called Parameters ---------- task : str Name of the task to be started Returns ------- time : float The time lapsed betwe...
[ "def", "complete_task", "(", "self", ",", "task", ")", ":", "try", ":", "runtime", "=", "self", ".", "timer", "(", ")", "-", "self", ".", "tasks", "[", "task", "]", "del", "self", ".", "tasks", "[", "task", "]", "if", "runtime", ">=", "self", "."...
Complete logging of a task Returns the time lapsed since `start_task` was called Parameters ---------- task : str Name of the task to be started Returns ------- time : float The time lapsed between task start and completion
[ "Complete", "logging", "of", "a", "task" ]
train
https://github.com/scottgigante/tasklogger/blob/06a263715d2db0653615c17b2df14b8272967b8d/tasklogger/logger.py#L220-L243
etcher-be/emiz
emiz/edit_miz.py
edit_miz
def edit_miz( # noqa: C901 infile: str, outfile: str = None, metar: typing.Union[str, Metar] = None, time: str = None, min_wind: int = 0, max_wind: int = 40 ) -> str: # noinspection SpellCheckingInspection """ Edit an opened MIZ file and sets the time and dat...
python
def edit_miz( # noqa: C901 infile: str, outfile: str = None, metar: typing.Union[str, Metar] = None, time: str = None, min_wind: int = 0, max_wind: int = 40 ) -> str: # noinspection SpellCheckingInspection """ Edit an opened MIZ file and sets the time and dat...
[ "def", "edit_miz", "(", "# noqa: C901", "infile", ":", "str", ",", "outfile", ":", "str", "=", "None", ",", "metar", ":", "typing", ".", "Union", "[", "str", ",", "Metar", "]", "=", "None", ",", "time", ":", "str", "=", "None", ",", "min_wind", ":"...
Edit an opened MIZ file and sets the time and date and the weather Args: infile: source file outfile: output file (will default to source file) metar: metar string, ICAO or object to apply time: time string to apply (YYYYMMDDHHMMSS) min_wind: minimum wind max_wind: m...
[ "Edit", "an", "opened", "MIZ", "file", "and", "sets", "the", "time", "and", "date", "and", "the", "weather" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/edit_miz.py#L19-L80
ikalnytskyi/dooku
dooku/conf.py
Conf.from_file
def from_file(self, loader, filename, encoding='utf-8', silent=False): """ Updates recursively the value in the the config from some file. :param loader: (function) a function that receives a file object and returns a dictionary to be merged into settings :param filename: (s...
python
def from_file(self, loader, filename, encoding='utf-8', silent=False): """ Updates recursively the value in the the config from some file. :param loader: (function) a function that receives a file object and returns a dictionary to be merged into settings :param filename: (s...
[ "def", "from_file", "(", "self", ",", "loader", ",", "filename", ",", "encoding", "=", "'utf-8'", ",", "silent", "=", "False", ")", ":", "conf", "=", "{", "}", "try", ":", "with", "open", "(", "filename", ",", "encoding", "=", "encoding", ")", "as", ...
Updates recursively the value in the the config from some file. :param loader: (function) a function that receives a file object and returns a dictionary to be merged into settings :param filename: (str) a filename to be opened :param encoding: (str) an encoding of the filename ...
[ "Updates", "recursively", "the", "value", "in", "the", "the", "config", "from", "some", "file", "." ]
train
https://github.com/ikalnytskyi/dooku/blob/77e6c82c9c41211c86ee36ae5e591d477945fedf/dooku/conf.py#L117-L136
ikalnytskyi/dooku
dooku/conf.py
Conf.from_json
def from_json(self, filename, encoding='utf-8', silent=False): """ Updates recursively the value in the the config from a JSON file. :param filename: (str) a filename of the JSON file :param encoding: (str) an encoding of the filename :param silent: (bool) fails silently if some...
python
def from_json(self, filename, encoding='utf-8', silent=False): """ Updates recursively the value in the the config from a JSON file. :param filename: (str) a filename of the JSON file :param encoding: (str) an encoding of the filename :param silent: (bool) fails silently if some...
[ "def", "from_json", "(", "self", ",", "filename", ",", "encoding", "=", "'utf-8'", ",", "silent", "=", "False", ")", ":", "self", ".", "from_file", "(", "json", ".", "load", ",", "filename", ",", "encoding", ",", "silent", ")" ]
Updates recursively the value in the the config from a JSON file. :param filename: (str) a filename of the JSON file :param encoding: (str) an encoding of the filename :param silent: (bool) fails silently if something wrong with json file .. versionadded:: 0.3.0
[ "Updates", "recursively", "the", "value", "in", "the", "the", "config", "from", "a", "JSON", "file", "." ]
train
https://github.com/ikalnytskyi/dooku/blob/77e6c82c9c41211c86ee36ae5e591d477945fedf/dooku/conf.py#L138-L148
ikalnytskyi/dooku
dooku/conf.py
Conf.from_yaml
def from_yaml(self, filename, encoding='utf-8', silent=False): """ Updates recursively the value in the the config from a YAML file. The method requires the PyYAML to be installed. :param filename: (str) a filename of the YAML file :param encoding: (str) an encoding of the file...
python
def from_yaml(self, filename, encoding='utf-8', silent=False): """ Updates recursively the value in the the config from a YAML file. The method requires the PyYAML to be installed. :param filename: (str) a filename of the YAML file :param encoding: (str) an encoding of the file...
[ "def", "from_yaml", "(", "self", ",", "filename", ",", "encoding", "=", "'utf-8'", ",", "silent", "=", "False", ")", ":", "if", "not", "yaml", ":", "raise", "AttributeError", "(", "'You need to install PyYAML before using this method!'", ")", "self", ".", "from_...
Updates recursively the value in the the config from a YAML file. The method requires the PyYAML to be installed. :param filename: (str) a filename of the YAML file :param encoding: (str) an encoding of the filename :param silent: (bool) fails silently if something wrong with yaml file...
[ "Updates", "recursively", "the", "value", "in", "the", "the", "config", "from", "a", "YAML", "file", "." ]
train
https://github.com/ikalnytskyi/dooku/blob/77e6c82c9c41211c86ee36ae5e591d477945fedf/dooku/conf.py#L150-L166
ikalnytskyi/dooku
dooku/conf.py
Conf.update
def update(self, iterable={}, **kwargs): """ Updates recursively a self with a given iterable. TODO: rewrite this ugly stuff """ def _merge(a, *args): for key, value in itertools.chain(*args): if key in a and isinstance(value, (dict, Conf)): ...
python
def update(self, iterable={}, **kwargs): """ Updates recursively a self with a given iterable. TODO: rewrite this ugly stuff """ def _merge(a, *args): for key, value in itertools.chain(*args): if key in a and isinstance(value, (dict, Conf)): ...
[ "def", "update", "(", "self", ",", "iterable", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "def", "_merge", "(", "a", ",", "*", "args", ")", ":", "for", "key", ",", "value", "in", "itertools", ".", "chain", "(", "*", "args", ")", ":", "...
Updates recursively a self with a given iterable. TODO: rewrite this ugly stuff
[ "Updates", "recursively", "a", "self", "with", "a", "given", "iterable", "." ]
train
https://github.com/ikalnytskyi/dooku/blob/77e6c82c9c41211c86ee36ae5e591d477945fedf/dooku/conf.py#L168-L186
lambdalisue/maidenhair
src/maidenhair/filters/baseline.py
baseline
def baseline(dataset, column=1, fn=None, fail_silently=True): """ Substract baseline from the dataset Parameters ---------- dataset : list of numpy array list A list of numpy array list column : integer An index of column which will be proceeded fn : function A funct...
python
def baseline(dataset, column=1, fn=None, fail_silently=True): """ Substract baseline from the dataset Parameters ---------- dataset : list of numpy array list A list of numpy array list column : integer An index of column which will be proceeded fn : function A funct...
[ "def", "baseline", "(", "dataset", ",", "column", "=", "1", ",", "fn", "=", "None", ",", "fail_silently", "=", "True", ")", ":", "try", ":", "if", "fn", "is", "None", ":", "fn", "=", "lambda", "columns", ",", "column", ":", "columns", "[", "column"...
Substract baseline from the dataset Parameters ---------- dataset : list of numpy array list A list of numpy array list column : integer An index of column which will be proceeded fn : function A function which require data and return baseline. If it is `None`, the f...
[ "Substract", "baseline", "from", "the", "dataset" ]
train
https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/filters/baseline.py#L10-L61
jic-dtool/dtool-info
dtool_info/inventory.py
_dataset_info
def _dataset_info(dataset): """Return information about dataset as a dict.""" info = {} info["uri"] = dataset.uri info["uuid"] = dataset.uuid # Computer and human readable size of dataset. tot_size = sum([dataset.item_properties(i)["size_in_bytes"] for i in dataset.identifi...
python
def _dataset_info(dataset): """Return information about dataset as a dict.""" info = {} info["uri"] = dataset.uri info["uuid"] = dataset.uuid # Computer and human readable size of dataset. tot_size = sum([dataset.item_properties(i)["size_in_bytes"] for i in dataset.identifi...
[ "def", "_dataset_info", "(", "dataset", ")", ":", "info", "=", "{", "}", "info", "[", "\"uri\"", "]", "=", "dataset", ".", "uri", "info", "[", "\"uuid\"", "]", "=", "dataset", ".", "uuid", "# Computer and human readable size of dataset.", "tot_size", "=", "s...
Return information about dataset as a dict.
[ "Return", "information", "about", "dataset", "as", "a", "dict", "." ]
train
https://github.com/jic-dtool/dtool-info/blob/3c6c7755f4c142e548bbfdf3b38230612fd4060a/dtool_info/inventory.py#L18-L40
jic-dtool/dtool-info
dtool_info/inventory.py
inventory
def inventory(uri, format): """Generate an inventory of datasets in a base URI.""" base_uri = dtoolcore.utils.sanitise_uri(uri) info = _base_uri_info(base_uri) if format is None: _cmd_line_report(info) elif format == "csv": _csv_tsv_report(info, ",") elif format == "tsv": ...
python
def inventory(uri, format): """Generate an inventory of datasets in a base URI.""" base_uri = dtoolcore.utils.sanitise_uri(uri) info = _base_uri_info(base_uri) if format is None: _cmd_line_report(info) elif format == "csv": _csv_tsv_report(info, ",") elif format == "tsv": ...
[ "def", "inventory", "(", "uri", ",", "format", ")", ":", "base_uri", "=", "dtoolcore", ".", "utils", ".", "sanitise_uri", "(", "uri", ")", "info", "=", "_base_uri_info", "(", "base_uri", ")", "if", "format", "is", "None", ":", "_cmd_line_report", "(", "i...
Generate an inventory of datasets in a base URI.
[ "Generate", "an", "inventory", "of", "datasets", "in", "a", "base", "URI", "." ]
train
https://github.com/jic-dtool/dtool-info/blob/3c6c7755f4c142e548bbfdf3b38230612fd4060a/dtool_info/inventory.py#L155-L167
collectiveacuity/labPack
labpack/parsing/magic.py
labMagic.analyze
def analyze(self, file_path='', file_url='', byte_data=None): ''' a method to determine the mimetype and extension of a file from its byte data :param file_path: [optional] string with local path to file :param file_url: [optional] string with url of file :param byte_data: [optio...
python
def analyze(self, file_path='', file_url='', byte_data=None): ''' a method to determine the mimetype and extension of a file from its byte data :param file_path: [optional] string with local path to file :param file_url: [optional] string with url of file :param byte_data: [optio...
[ "def", "analyze", "(", "self", ",", "file_path", "=", "''", ",", "file_url", "=", "''", ",", "byte_data", "=", "None", ")", ":", "title", "=", "'%s.analyze'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs\r", "input_fields", "=", "{", ...
a method to determine the mimetype and extension of a file from its byte data :param file_path: [optional] string with local path to file :param file_url: [optional] string with url of file :param byte_data: [optional] byte data from a file :return: dictionary with file details ...
[ "a", "method", "to", "determine", "the", "mimetype", "and", "extension", "of", "a", "file", "from", "its", "byte", "data", ":", "param", "file_path", ":", "[", "optional", "]", "string", "with", "local", "path", "to", "file", ":", "param", "file_url", ":...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/parsing/magic.py#L144-L222
delfick/aws_syncr
aws_syncr/filename_completer.py
custom_prompt
def custom_prompt(msg, delims="", completer=lambda: None): """Start up a prompt that with particular delims and completer""" try: orig_delims = readline.get_completer_delims() orig_completer = readline.get_completer() readline.set_completer_delims(delims) readline.set_completer(...
python
def custom_prompt(msg, delims="", completer=lambda: None): """Start up a prompt that with particular delims and completer""" try: orig_delims = readline.get_completer_delims() orig_completer = readline.get_completer() readline.set_completer_delims(delims) readline.set_completer(...
[ "def", "custom_prompt", "(", "msg", ",", "delims", "=", "\"\"", ",", "completer", "=", "lambda", ":", "None", ")", ":", "try", ":", "orig_delims", "=", "readline", ".", "get_completer_delims", "(", ")", "orig_completer", "=", "readline", ".", "get_completer"...
Start up a prompt that with particular delims and completer
[ "Start", "up", "a", "prompt", "that", "with", "particular", "delims", "and", "completer" ]
train
https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/filename_completer.py#L46-L63
serverops/laracrypt
src/laracrypt/__init__.py
Crypt._pad
def _pad(self, data): """ Pad value with bytes so it's a multiple of 16 See: http://stackoverflow.com/questions/14179784/python-encrypting-with-pycrypto-aes :param data: :return data: """ length = 16 - (len(data) % 16) data += chr(length)*length re...
python
def _pad(self, data): """ Pad value with bytes so it's a multiple of 16 See: http://stackoverflow.com/questions/14179784/python-encrypting-with-pycrypto-aes :param data: :return data: """ length = 16 - (len(data) % 16) data += chr(length)*length re...
[ "def", "_pad", "(", "self", ",", "data", ")", ":", "length", "=", "16", "-", "(", "len", "(", "data", ")", "%", "16", ")", "data", "+=", "chr", "(", "length", ")", "*", "length", "return", "data" ]
Pad value with bytes so it's a multiple of 16 See: http://stackoverflow.com/questions/14179784/python-encrypting-with-pycrypto-aes :param data: :return data:
[ "Pad", "value", "with", "bytes", "so", "it", "s", "a", "multiple", "of", "16", "See", ":", "http", ":", "//", "stackoverflow", ".", "com", "/", "questions", "/", "14179784", "/", "python", "-", "encrypting", "-", "with", "-", "pycrypto", "-", "aes", ...
train
https://github.com/serverops/laracrypt/blob/bf59947a781555d53772173c21c6ad7c853a508a/src/laracrypt/__init__.py#L39-L48
serverops/laracrypt
src/laracrypt/__init__.py
Crypt._hash
def _hash(self, iv, value): """ Generate and hmac signature for this encrypted data :param key: :param iv: :param value: :return string: """ return hmac.new(self.key, msg=iv+value, digestmod=hashlib.sha256).hexdigest()
python
def _hash(self, iv, value): """ Generate and hmac signature for this encrypted data :param key: :param iv: :param value: :return string: """ return hmac.new(self.key, msg=iv+value, digestmod=hashlib.sha256).hexdigest()
[ "def", "_hash", "(", "self", ",", "iv", ",", "value", ")", ":", "return", "hmac", ".", "new", "(", "self", ".", "key", ",", "msg", "=", "iv", "+", "value", ",", "digestmod", "=", "hashlib", ".", "sha256", ")", ".", "hexdigest", "(", ")" ]
Generate and hmac signature for this encrypted data :param key: :param iv: :param value: :return string:
[ "Generate", "and", "hmac", "signature", "for", "this", "encrypted", "data", ":", "param", "key", ":", ":", "param", "iv", ":", ":", "param", "value", ":", ":", "return", "string", ":" ]
train
https://github.com/serverops/laracrypt/blob/bf59947a781555d53772173c21c6ad7c853a508a/src/laracrypt/__init__.py#L50-L58
Nixiware/viper
nx/viper/service/mail.py
Service.send
def send(self, recipient, subject, message): """ Sends an email using the SMTP connection. :param recipient: <tuple> recipient's email address as the first element and their name as an optional second element :param subject: <str> mail subject :param ...
python
def send(self, recipient, subject, message): """ Sends an email using the SMTP connection. :param recipient: <tuple> recipient's email address as the first element and their name as an optional second element :param subject: <str> mail subject :param ...
[ "def", "send", "(", "self", ",", "recipient", ",", "subject", ",", "message", ")", ":", "if", "self", ".", "configured", "is", "False", ":", "return", "False", "# connecting to server", "try", ":", "self", ".", "smtp", "=", "smtplib", ".", "SMTP", "(", ...
Sends an email using the SMTP connection. :param recipient: <tuple> recipient's email address as the first element and their name as an optional second element :param subject: <str> mail subject :param message: <str> mail content (as HTML markup) :return: <bo...
[ "Sends", "an", "email", "using", "the", "SMTP", "connection", "." ]
train
https://github.com/Nixiware/viper/blob/fbe6057facd8d46103e9955880dfd99e63b7acb3/nx/viper/service/mail.py#L34-L163
padfoot27/merlin
package/scripts/merlin.py
discover
def discover(ctx): ''' This is Merlin He is google's dumb cousin who can search for movies He is a tad slow, so please be patient with him He is dumb too, so while telling him about names of the cast or crew, make sure to avoid spelling mistakes For example, you ...
python
def discover(ctx): ''' This is Merlin He is google's dumb cousin who can search for movies He is a tad slow, so please be patient with him He is dumb too, so while telling him about names of the cast or crew, make sure to avoid spelling mistakes For example, you ...
[ "def", "discover", "(", "ctx", ")", ":", "if", "ctx", ".", "invoked_subcommand", "is", "None", ":", "click", ".", "echo", "(", "\"Hi, I am Merlin, your personal movie recommender\\n\"", ")", "time", ".", "sleep", "(", "1", ")", "click", ".", "echo", "(", "\"...
This is Merlin He is google's dumb cousin who can search for movies He is a tad slow, so please be patient with him He is dumb too, so while telling him about names of the cast or crew, make sure to avoid spelling mistakes For example, you are looking for Arnold Schwarzenegg...
[ "This", "is", "Merlin", "He", "is", "google", "s", "dumb", "cousin", "who", "can", "search", "for", "movies" ]
train
https://github.com/padfoot27/merlin/blob/c317505c5eca0e774fcf8b8c7f08801479a5099a/package/scripts/merlin.py#L335-L488
mbodenhamer/syn
syn/types/a/base.py
primitive_form
def primitive_form(obj, **kwargs): '''Return obj, if possible, in a form composed of primitive or builtin objects.''' if isinstance(obj, type): return obj return Type.dispatch(obj).primitive_form(**kwargs)
python
def primitive_form(obj, **kwargs): '''Return obj, if possible, in a form composed of primitive or builtin objects.''' if isinstance(obj, type): return obj return Type.dispatch(obj).primitive_form(**kwargs)
[ "def", "primitive_form", "(", "obj", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "obj", ",", "type", ")", ":", "return", "obj", "return", "Type", ".", "dispatch", "(", "obj", ")", ".", "primitive_form", "(", "*", "*", "kwargs", ")" ]
Return obj, if possible, in a form composed of primitive or builtin objects.
[ "Return", "obj", "if", "possible", "in", "a", "form", "composed", "of", "primitive", "or", "builtin", "objects", "." ]
train
https://github.com/mbodenhamer/syn/blob/aeaa3ad8a49bac8f50cf89b6f1fe97ad43d1d258/syn/types/a/base.py#L406-L410
lwcook/horsetail-matching
horsetailmatching/parameters.py
UncertainParameter.evalPDF
def evalPDF(self, u_values): '''Returns the PDF of the uncertain parameter evaluated at the values provided in u_values. :param iterable u_values: values of the uncertain parameter at which to evaluate the PDF *Example Usage* :: >>> u = UniformParameter() ...
python
def evalPDF(self, u_values): '''Returns the PDF of the uncertain parameter evaluated at the values provided in u_values. :param iterable u_values: values of the uncertain parameter at which to evaluate the PDF *Example Usage* :: >>> u = UniformParameter() ...
[ "def", "evalPDF", "(", "self", ",", "u_values", ")", ":", "if", "isinstance", "(", "u_values", ",", "np", ".", "ndarray", ")", ":", "return", "self", ".", "_evalPDF", "(", "u_values", ")", "else", ":", "try", ":", "iter", "(", "u_values", ")", "retur...
Returns the PDF of the uncertain parameter evaluated at the values provided in u_values. :param iterable u_values: values of the uncertain parameter at which to evaluate the PDF *Example Usage* :: >>> u = UniformParameter() >>> X = numpy.linspace(-1, 1, 100...
[ "Returns", "the", "PDF", "of", "the", "uncertain", "parameter", "evaluated", "at", "the", "values", "provided", "in", "u_values", "." ]
train
https://github.com/lwcook/horsetail-matching/blob/f3d5f8d01249debbca978f412ce4eae017458119/horsetailmatching/parameters.py#L91-L113
shaunduncan/helga-facts
helga_facts.py
term_regex
def term_regex(term): """ Returns a case-insensitive regex for searching terms """ return re.compile(r'^{0}$'.format(re.escape(term)), re.IGNORECASE)
python
def term_regex(term): """ Returns a case-insensitive regex for searching terms """ return re.compile(r'^{0}$'.format(re.escape(term)), re.IGNORECASE)
[ "def", "term_regex", "(", "term", ")", ":", "return", "re", ".", "compile", "(", "r'^{0}$'", ".", "format", "(", "re", ".", "escape", "(", "term", ")", ")", ",", "re", ".", "IGNORECASE", ")" ]
Returns a case-insensitive regex for searching terms
[ "Returns", "a", "case", "-", "insensitive", "regex", "for", "searching", "terms" ]
train
https://github.com/shaunduncan/helga-facts/blob/956b1d93abccdaaf318d7cac4451edc7e73bf5e9/helga_facts.py#L23-L27
shaunduncan/helga-facts
helga_facts.py
show_fact
def show_fact(term): """ Shows a fact stored for a given term, using a case-insensitive search. If a fact has an author, it will be shown. If it has a timestamp, that will also be shown. """ logger.info('Showing fact %s', term) record = db.facts.find_one({'term': term_regex(term)}) if r...
python
def show_fact(term): """ Shows a fact stored for a given term, using a case-insensitive search. If a fact has an author, it will be shown. If it has a timestamp, that will also be shown. """ logger.info('Showing fact %s', term) record = db.facts.find_one({'term': term_regex(term)}) if r...
[ "def", "show_fact", "(", "term", ")", ":", "logger", ".", "info", "(", "'Showing fact %s'", ",", "term", ")", "record", "=", "db", ".", "facts", ".", "find_one", "(", "{", "'term'", ":", "term_regex", "(", "term", ")", "}", ")", "if", "record", "is",...
Shows a fact stored for a given term, using a case-insensitive search. If a fact has an author, it will be shown. If it has a timestamp, that will also be shown.
[ "Shows", "a", "fact", "stored", "for", "a", "given", "term", "using", "a", "case", "-", "insensitive", "search", ".", "If", "a", "fact", "has", "an", "author", "it", "will", "be", "shown", ".", "If", "it", "has", "a", "timestamp", "that", "will", "al...
train
https://github.com/shaunduncan/helga-facts/blob/956b1d93abccdaaf318d7cac4451edc7e73bf5e9/helga_facts.py#L30-L61
shaunduncan/helga-facts
helga_facts.py
add_fact
def add_fact(term, fact, author=''): """ Records a new fact with a given term. Optionally can set an author """ logger.info('Adding new fact %s: %s', term, fact) if not db.facts.find({'term': term_regex(term)}).count(): db.facts.insert({ 'term': term, 'fact': fact, ...
python
def add_fact(term, fact, author=''): """ Records a new fact with a given term. Optionally can set an author """ logger.info('Adding new fact %s: %s', term, fact) if not db.facts.find({'term': term_regex(term)}).count(): db.facts.insert({ 'term': term, 'fact': fact, ...
[ "def", "add_fact", "(", "term", ",", "fact", ",", "author", "=", "''", ")", ":", "logger", ".", "info", "(", "'Adding new fact %s: %s'", ",", "term", ",", "fact", ")", "if", "not", "db", ".", "facts", ".", "find", "(", "{", "'term'", ":", "term_regex...
Records a new fact with a given term. Optionally can set an author
[ "Records", "a", "new", "fact", "with", "a", "given", "term", ".", "Optionally", "can", "set", "an", "author" ]
train
https://github.com/shaunduncan/helga-facts/blob/956b1d93abccdaaf318d7cac4451edc7e73bf5e9/helga_facts.py#L64-L77
shaunduncan/helga-facts
helga_facts.py
forget_fact
def forget_fact(term): """ Forgets a fact by removing it from the database """ logger.info('Removing fact %s', term) db.facts.remove({'term': term_regex(term)}) return random.choice(ACKS)
python
def forget_fact(term): """ Forgets a fact by removing it from the database """ logger.info('Removing fact %s', term) db.facts.remove({'term': term_regex(term)}) return random.choice(ACKS)
[ "def", "forget_fact", "(", "term", ")", ":", "logger", ".", "info", "(", "'Removing fact %s'", ",", "term", ")", "db", ".", "facts", ".", "remove", "(", "{", "'term'", ":", "term_regex", "(", "term", ")", "}", ")", "return", "random", ".", "choice", ...
Forgets a fact by removing it from the database
[ "Forgets", "a", "fact", "by", "removing", "it", "from", "the", "database" ]
train
https://github.com/shaunduncan/helga-facts/blob/956b1d93abccdaaf318d7cac4451edc7e73bf5e9/helga_facts.py#L80-L86
shaunduncan/helga-facts
helga_facts.py
replace_fact
def replace_fact(term, fact, author=''): """ Replaces an existing fact by removing it, then adding the new definition """ forget_fact(term) add_fact(term, fact, author) return random.choice(ACKS)
python
def replace_fact(term, fact, author=''): """ Replaces an existing fact by removing it, then adding the new definition """ forget_fact(term) add_fact(term, fact, author) return random.choice(ACKS)
[ "def", "replace_fact", "(", "term", ",", "fact", ",", "author", "=", "''", ")", ":", "forget_fact", "(", "term", ")", "add_fact", "(", "term", ",", "fact", ",", "author", ")", "return", "random", ".", "choice", "(", "ACKS", ")" ]
Replaces an existing fact by removing it, then adding the new definition
[ "Replaces", "an", "existing", "fact", "by", "removing", "it", "then", "adding", "the", "new", "definition" ]
train
https://github.com/shaunduncan/helga-facts/blob/956b1d93abccdaaf318d7cac4451edc7e73bf5e9/helga_facts.py#L89-L95
shaunduncan/helga-facts
helga_facts.py
facts
def facts(client, channel, nick, message, *args): """ A plugin for helga to automatically remember important things. Unless specified by the setting ``FACTS_REQUIRE_NICKNAME``, facts are automatically stored when a user says: ``something is something else``. Otherwise, facts must be explicitly added...
python
def facts(client, channel, nick, message, *args): """ A plugin for helga to automatically remember important things. Unless specified by the setting ``FACTS_REQUIRE_NICKNAME``, facts are automatically stored when a user says: ``something is something else``. Otherwise, facts must be explicitly added...
[ "def", "facts", "(", "client", ",", "channel", ",", "nick", ",", "message", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "2", ":", "return", "facts_command", "(", "client", ",", "channel", ",", "nick", ",", "message", ",", "*", ...
A plugin for helga to automatically remember important things. Unless specified by the setting ``FACTS_REQUIRE_NICKNAME``, facts are automatically stored when a user says: ``something is something else``. Otherwise, facts must be explicitly added: ``helga something is something else``. Response format ...
[ "A", "plugin", "for", "helga", "to", "automatically", "remember", "important", "things", ".", "Unless", "specified", "by", "the", "setting", "FACTS_REQUIRE_NICKNAME", "facts", "are", "automatically", "stored", "when", "a", "user", "says", ":", "something", "is", ...
train
https://github.com/shaunduncan/helga-facts/blob/956b1d93abccdaaf318d7cac4451edc7e73bf5e9/helga_facts.py#L146-L184
torfsen/clusterpolate
docs/conf.py
remove_module_docstring
def remove_module_docstring(app, what, name, obj, options, lines): """ Ignore the docstring of the ``clusterpolate`` module. """ if what == "module" and name == "clusterpolate": del lines[:]
python
def remove_module_docstring(app, what, name, obj, options, lines): """ Ignore the docstring of the ``clusterpolate`` module. """ if what == "module" and name == "clusterpolate": del lines[:]
[ "def", "remove_module_docstring", "(", "app", ",", "what", ",", "name", ",", "obj", ",", "options", ",", "lines", ")", ":", "if", "what", "==", "\"module\"", "and", "name", "==", "\"clusterpolate\"", ":", "del", "lines", "[", ":", "]" ]
Ignore the docstring of the ``clusterpolate`` module.
[ "Ignore", "the", "docstring", "of", "the", "clusterpolate", "module", "." ]
train
https://github.com/torfsen/clusterpolate/blob/97a94ea662eb324f75e02f9ecc0cd70505c5db31/docs/conf.py#L224-L229
etcher-be/emiz
emiz/avwx/translate.py
get_cardinal_direction
def get_cardinal_direction(direction: int) -> str: # noqa """ Returns the cardinal direction (NSEW) for a degree direction Wind Direction - Cheat Sheet: (360) -- 011/012 -- 033/034 -- (045) -- 056/057 -- 078/079 -- (090) (090) -- 101/102 -- 123/124 -- (135) -- 146/147 -- 168/169 -- (180) (1...
python
def get_cardinal_direction(direction: int) -> str: # noqa """ Returns the cardinal direction (NSEW) for a degree direction Wind Direction - Cheat Sheet: (360) -- 011/012 -- 033/034 -- (045) -- 056/057 -- 078/079 -- (090) (090) -- 101/102 -- 123/124 -- (135) -- 146/147 -- 168/169 -- (180) (1...
[ "def", "get_cardinal_direction", "(", "direction", ":", "int", ")", "->", "str", ":", "# noqa", "ret", "=", "''", "if", "not", "isinstance", "(", "direction", ",", "int", ")", ":", "direction", "=", "int", "(", "direction", ")", "# Convert to range [0 360]",...
Returns the cardinal direction (NSEW) for a degree direction Wind Direction - Cheat Sheet: (360) -- 011/012 -- 033/034 -- (045) -- 056/057 -- 078/079 -- (090) (090) -- 101/102 -- 123/124 -- (135) -- 146/147 -- 168/169 -- (180) (180) -- 191/192 -- 213/214 -- (225) -- 236/237 -- 258/259 -- (270) ...
[ "Returns", "the", "cardinal", "direction", "(", "NSEW", ")", "for", "a", "degree", "direction" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L15-L68
etcher-be/emiz
emiz/avwx/translate.py
wind
def wind(direction: Number, speed: Number, gust: Number, vardir: typing.List[Number] = None, # type: ignore unit: str = 'kt', cardinals: bool = True, spoken: bool = False) -> str: """ Format wind elements into a readable sentence Returns the translatio...
python
def wind(direction: Number, speed: Number, gust: Number, vardir: typing.List[Number] = None, # type: ignore unit: str = 'kt', cardinals: bool = True, spoken: bool = False) -> str: """ Format wind elements into a readable sentence Returns the translatio...
[ "def", "wind", "(", "direction", ":", "Number", ",", "speed", ":", "Number", ",", "gust", ":", "Number", ",", "vardir", ":", "typing", ".", "List", "[", "Number", "]", "=", "None", ",", "# type: ignore", "unit", ":", "str", "=", "'kt'", ",", "cardina...
Format wind elements into a readable sentence Returns the translation string Ex: NNE-020 (variable 010 to 040) at 14kt gusting to 20kt
[ "Format", "wind", "elements", "into", "a", "readable", "sentence" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L77-L113
etcher-be/emiz
emiz/avwx/translate.py
visibility
def visibility(vis: Number, unit: str = 'm') -> str: """ Formats a visibility element into a string with both km and sm values Ex: 8km ( 5sm ) """ if not (vis and unit in ('m', 'sm')): return '' if vis.repr in VIS_REPR: return VIS_REPR[vis.repr] if unit == 'm': conve...
python
def visibility(vis: Number, unit: str = 'm') -> str: """ Formats a visibility element into a string with both km and sm values Ex: 8km ( 5sm ) """ if not (vis and unit in ('m', 'sm')): return '' if vis.repr in VIS_REPR: return VIS_REPR[vis.repr] if unit == 'm': conve...
[ "def", "visibility", "(", "vis", ":", "Number", ",", "unit", ":", "str", "=", "'m'", ")", "->", "str", ":", "if", "not", "(", "vis", "and", "unit", "in", "(", "'m'", ",", "'sm'", ")", ")", ":", "return", "''", "if", "vis", ".", "repr", "in", ...
Formats a visibility element into a string with both km and sm values Ex: 8km ( 5sm )
[ "Formats", "a", "visibility", "element", "into", "a", "string", "with", "both", "km", "and", "sm", "values" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L122-L141
etcher-be/emiz
emiz/avwx/translate.py
temperature
def temperature(temp: Number, unit: str = 'C') -> str: """ Formats a temperature element into a string with both C and F values Used for both Temp and Dew Ex: 34°C (93°F) """ unit = unit.upper() if not (temp and unit in ('C', 'F')): return '' if unit == 'C': converted =...
python
def temperature(temp: Number, unit: str = 'C') -> str: """ Formats a temperature element into a string with both C and F values Used for both Temp and Dew Ex: 34°C (93°F) """ unit = unit.upper() if not (temp and unit in ('C', 'F')): return '' if unit == 'C': converted =...
[ "def", "temperature", "(", "temp", ":", "Number", ",", "unit", ":", "str", "=", "'C'", ")", "->", "str", ":", "unit", "=", "unit", ".", "upper", "(", ")", "if", "not", "(", "temp", "and", "unit", "in", "(", "'C'", ",", "'F'", ")", ")", ":", "...
Formats a temperature element into a string with both C and F values Used for both Temp and Dew Ex: 34°C (93°F)
[ "Formats", "a", "temperature", "element", "into", "a", "string", "with", "both", "C", "and", "F", "values" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L144-L161
etcher-be/emiz
emiz/avwx/translate.py
altimeter
def altimeter(alt: Number, unit: str = 'hPa') -> str: """ Formats the altimter element into a string with hPa and inHg values Ex: 30.11 inHg (10.20 hPa) """ if not (alt and unit in ('hPa', 'inHg')): return '' if unit == 'hPa': value = alt.repr converted = alt.value / 33....
python
def altimeter(alt: Number, unit: str = 'hPa') -> str: """ Formats the altimter element into a string with hPa and inHg values Ex: 30.11 inHg (10.20 hPa) """ if not (alt and unit in ('hPa', 'inHg')): return '' if unit == 'hPa': value = alt.repr converted = alt.value / 33....
[ "def", "altimeter", "(", "alt", ":", "Number", ",", "unit", ":", "str", "=", "'hPa'", ")", "->", "str", ":", "if", "not", "(", "alt", "and", "unit", "in", "(", "'hPa'", ",", "'inHg'", ")", ")", ":", "return", "''", "if", "unit", "==", "'hPa'", ...
Formats the altimter element into a string with hPa and inHg values Ex: 30.11 inHg (10.20 hPa)
[ "Formats", "the", "altimter", "element", "into", "a", "string", "with", "hPa", "and", "inHg", "values" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L164-L180
etcher-be/emiz
emiz/avwx/translate.py
clouds
def clouds(clds: [Cloud], unit: str = 'ft') -> str: # type: ignore """ Format cloud list into a readable sentence Returns the translation string Ex: Broken layer at 2200ft (Cumulonimbus), Overcast layer at 3600ft - Reported AGL """ if clds is None: return '' ret = [] for cloud...
python
def clouds(clds: [Cloud], unit: str = 'ft') -> str: # type: ignore """ Format cloud list into a readable sentence Returns the translation string Ex: Broken layer at 2200ft (Cumulonimbus), Overcast layer at 3600ft - Reported AGL """ if clds is None: return '' ret = [] for cloud...
[ "def", "clouds", "(", "clds", ":", "[", "Cloud", "]", ",", "unit", ":", "str", "=", "'ft'", ")", "->", "str", ":", "# type: ignore", "if", "clds", "is", "None", ":", "return", "''", "ret", "=", "[", "]", "for", "cloud", "in", "clds", ":", "if", ...
Format cloud list into a readable sentence Returns the translation string Ex: Broken layer at 2200ft (Cumulonimbus), Overcast layer at 3600ft - Reported AGL
[ "Format", "cloud", "list", "into", "a", "readable", "sentence" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L183-L203
etcher-be/emiz
emiz/avwx/translate.py
wxcode
def wxcode(code: str) -> str: """ Translates weather codes into readable strings Returns translated string of variable length """ if not code: return '' ret = '' if code[0] == '+': ret = 'Heavy ' code = code[1:] elif code[0] == '-': ret = 'Light ' ...
python
def wxcode(code: str) -> str: """ Translates weather codes into readable strings Returns translated string of variable length """ if not code: return '' ret = '' if code[0] == '+': ret = 'Heavy ' code = code[1:] elif code[0] == '-': ret = 'Light ' ...
[ "def", "wxcode", "(", "code", ":", "str", ")", "->", "str", ":", "if", "not", "code", ":", "return", "''", "ret", "=", "''", "if", "code", "[", "0", "]", "==", "'+'", ":", "ret", "=", "'Heavy '", "code", "=", "code", "[", "1", ":", "]", "elif...
Translates weather codes into readable strings Returns translated string of variable length
[ "Translates", "weather", "codes", "into", "readable", "strings" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L206-L230
etcher-be/emiz
emiz/avwx/translate.py
wind_shear
def wind_shear(shear: str, unit_alt: str = 'ft', unit_wind: str = 'kt', spoken: bool = False) -> str: """ Translate wind shear into a readable string Ex: Wind shear 2000ft from 140 at 30kt """ if not shear or 'WS' not in shear or '/' not in shear: return '' shear = shear[2:].rstrip(unit...
python
def wind_shear(shear: str, unit_alt: str = 'ft', unit_wind: str = 'kt', spoken: bool = False) -> str: """ Translate wind shear into a readable string Ex: Wind shear 2000ft from 140 at 30kt """ if not shear or 'WS' not in shear or '/' not in shear: return '' shear = shear[2:].rstrip(unit...
[ "def", "wind_shear", "(", "shear", ":", "str", ",", "unit_alt", ":", "str", "=", "'ft'", ",", "unit_wind", ":", "str", "=", "'kt'", ",", "spoken", ":", "bool", "=", "False", ")", "->", "str", ":", "if", "not", "shear", "or", "'WS'", "not", "in", ...
Translate wind shear into a readable string Ex: Wind shear 2000ft from 140 at 30kt
[ "Translate", "wind", "shear", "into", "a", "readable", "string" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L242-L252
etcher-be/emiz
emiz/avwx/translate.py
turb_ice
def turb_ice(turbice: [str], unit: str = 'ft') -> str: # type: ignore """ Translate the list of turbulance or icing into a readable sentence Ex: Occasional moderate turbulence in clouds from 3000ft to 14000ft """ if not turbice: return '' # Determine turbulance or icing if turbice[...
python
def turb_ice(turbice: [str], unit: str = 'ft') -> str: # type: ignore """ Translate the list of turbulance or icing into a readable sentence Ex: Occasional moderate turbulence in clouds from 3000ft to 14000ft """ if not turbice: return '' # Determine turbulance or icing if turbice[...
[ "def", "turb_ice", "(", "turbice", ":", "[", "str", "]", ",", "unit", ":", "str", "=", "'ft'", ")", "->", "str", ":", "# type: ignore", "if", "not", "turbice", ":", "return", "''", "# Determine turbulance or icing", "if", "turbice", "[", "0", "]", "[", ...
Translate the list of turbulance or icing into a readable sentence Ex: Occasional moderate turbulence in clouds from 3000ft to 14000ft
[ "Translate", "the", "list", "of", "turbulance", "or", "icing", "into", "a", "readable", "sentence" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L255-L284
etcher-be/emiz
emiz/avwx/translate.py
min_max_temp
def min_max_temp(temp: str, unit: str = 'C') -> str: """ Format the Min and Max temp elemets into a readable string Ex: Maximum temperature of 23°C (73°F) at 18-15:00Z """ if not temp or len(temp) < 7: return '' if temp[:2] == 'TX': temp_type = 'Maximum' elif temp[:2] == 'TN...
python
def min_max_temp(temp: str, unit: str = 'C') -> str: """ Format the Min and Max temp elemets into a readable string Ex: Maximum temperature of 23°C (73°F) at 18-15:00Z """ if not temp or len(temp) < 7: return '' if temp[:2] == 'TX': temp_type = 'Maximum' elif temp[:2] == 'TN...
[ "def", "min_max_temp", "(", "temp", ":", "str", ",", "unit", ":", "str", "=", "'C'", ")", "->", "str", ":", "if", "not", "temp", "or", "len", "(", "temp", ")", "<", "7", ":", "return", "''", "if", "temp", "[", ":", "2", "]", "==", "'TX'", ":"...
Format the Min and Max temp elemets into a readable string Ex: Maximum temperature of 23°C (73°F) at 18-15:00Z
[ "Format", "the", "Min", "and", "Max", "temp", "elemets", "into", "a", "readable", "string" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L287-L305
etcher-be/emiz
emiz/avwx/translate.py
shared
def shared(wxdata: ReportData, units: Units) -> typing.Dict[str, str]: """ Translate Visibility, Altimeter, Clouds, and Other """ translations = {} translations['visibility'] = visibility(wxdata.visibility, units.visibility) # type: ignore translations['altimeter'] = altimeter(wxdata.altimeter,...
python
def shared(wxdata: ReportData, units: Units) -> typing.Dict[str, str]: """ Translate Visibility, Altimeter, Clouds, and Other """ translations = {} translations['visibility'] = visibility(wxdata.visibility, units.visibility) # type: ignore translations['altimeter'] = altimeter(wxdata.altimeter,...
[ "def", "shared", "(", "wxdata", ":", "ReportData", ",", "units", ":", "Units", ")", "->", "typing", ".", "Dict", "[", "str", ",", "str", "]", ":", "translations", "=", "{", "}", "translations", "[", "'visibility'", "]", "=", "visibility", "(", "wxdata"...
Translate Visibility, Altimeter, Clouds, and Other
[ "Translate", "Visibility", "Altimeter", "Clouds", "and", "Other" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L308-L317
etcher-be/emiz
emiz/avwx/translate.py
metar
def metar(wxdata: MetarData, units: Units) -> MetarTrans: """ Translate the results of metar.parse Keys: Wind, Visibility, Clouds, Temperature, Dewpoint, Altimeter, Other """ translations = shared(wxdata, units) translations['wind'] = wind(wxdata.wind_direction, wxdata.wind_speed, ...
python
def metar(wxdata: MetarData, units: Units) -> MetarTrans: """ Translate the results of metar.parse Keys: Wind, Visibility, Clouds, Temperature, Dewpoint, Altimeter, Other """ translations = shared(wxdata, units) translations['wind'] = wind(wxdata.wind_direction, wxdata.wind_speed, ...
[ "def", "metar", "(", "wxdata", ":", "MetarData", ",", "units", ":", "Units", ")", "->", "MetarTrans", ":", "translations", "=", "shared", "(", "wxdata", ",", "units", ")", "translations", "[", "'wind'", "]", "=", "wind", "(", "wxdata", ".", "wind_directi...
Translate the results of metar.parse Keys: Wind, Visibility, Clouds, Temperature, Dewpoint, Altimeter, Other
[ "Translate", "the", "results", "of", "metar", ".", "parse" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L320-L333
etcher-be/emiz
emiz/avwx/translate.py
taf
def taf(wxdata: TafData, units: Units) -> TafTrans: """ Translate the results of taf.parse Keys: Forecast, Min-Temp, Max-Temp Forecast keys: Wind, Visibility, Clouds, Altimeter, Wind-Shear, Turbulance, Icing, Other """ translations = {'forecast': []} # type: ignore for line in wxdata.fore...
python
def taf(wxdata: TafData, units: Units) -> TafTrans: """ Translate the results of taf.parse Keys: Forecast, Min-Temp, Max-Temp Forecast keys: Wind, Visibility, Clouds, Altimeter, Wind-Shear, Turbulance, Icing, Other """ translations = {'forecast': []} # type: ignore for line in wxdata.fore...
[ "def", "taf", "(", "wxdata", ":", "TafData", ",", "units", ":", "Units", ")", "->", "TafTrans", ":", "translations", "=", "{", "'forecast'", ":", "[", "]", "}", "# type: ignore", "for", "line", "in", "wxdata", ".", "forecast", ":", "trans", "=", "share...
Translate the results of taf.parse Keys: Forecast, Min-Temp, Max-Temp Forecast keys: Wind, Visibility, Clouds, Altimeter, Wind-Shear, Turbulance, Icing, Other
[ "Translate", "the", "results", "of", "taf", ".", "parse" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/avwx/translate.py#L336-L359
sassoo/goldman
goldman/types/resource.py
Type.validate_rtype
def validate_rtype(self, value): """ Schematics validator The provided rtype must match that of the underlying model. :return: str """ if not value or value != self.rtype: msg = self.messages['rtype'].format(self.rtype, value) raise ValidationEr...
python
def validate_rtype(self, value): """ Schematics validator The provided rtype must match that of the underlying model. :return: str """ if not value or value != self.rtype: msg = self.messages['rtype'].format(self.rtype, value) raise ValidationEr...
[ "def", "validate_rtype", "(", "self", ",", "value", ")", ":", "if", "not", "value", "or", "value", "!=", "self", ".", "rtype", ":", "msg", "=", "self", ".", "messages", "[", "'rtype'", "]", ".", "format", "(", "self", ".", "rtype", ",", "value", ")...
Schematics validator The provided rtype must match that of the underlying model. :return: str
[ "Schematics", "validator" ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/types/resource.py#L35-L47
rameshg87/pyremotevbox
pyremotevbox/ZSI/schema.py
_get_substitute_element
def _get_substitute_element(head, elt, ps): '''if elt matches a member of the head substitutionGroup, return the GED typecode. head -- ElementDeclaration typecode, elt -- the DOM element being parsed ps -- ParsedSoap Instance ''' if not isinstance(head, ElementDeclaration): return...
python
def _get_substitute_element(head, elt, ps): '''if elt matches a member of the head substitutionGroup, return the GED typecode. head -- ElementDeclaration typecode, elt -- the DOM element being parsed ps -- ParsedSoap Instance ''' if not isinstance(head, ElementDeclaration): return...
[ "def", "_get_substitute_element", "(", "head", ",", "elt", ",", "ps", ")", ":", "if", "not", "isinstance", "(", "head", ",", "ElementDeclaration", ")", ":", "return", "None", "return", "ElementDeclaration", ".", "getSubstitutionElement", "(", "head", ",", "elt...
if elt matches a member of the head substitutionGroup, return the GED typecode. head -- ElementDeclaration typecode, elt -- the DOM element being parsed ps -- ParsedSoap Instance
[ "if", "elt", "matches", "a", "member", "of", "the", "head", "substitutionGroup", "return", "the", "GED", "typecode", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L17-L28
rameshg87/pyremotevbox
pyremotevbox/ZSI/schema.py
_is_substitute_element
def _is_substitute_element(head, sub): '''if head and sub are both GEDs, and sub declares head as its substitutionGroup then return True. head -- Typecode instance sub -- Typecode instance ''' if not isinstance(head, ElementDeclaration) or not isinstance(sub, ElementDeclaration): retu...
python
def _is_substitute_element(head, sub): '''if head and sub are both GEDs, and sub declares head as its substitutionGroup then return True. head -- Typecode instance sub -- Typecode instance ''' if not isinstance(head, ElementDeclaration) or not isinstance(sub, ElementDeclaration): retu...
[ "def", "_is_substitute_element", "(", "head", ",", "sub", ")", ":", "if", "not", "isinstance", "(", "head", ",", "ElementDeclaration", ")", "or", "not", "isinstance", "(", "sub", ",", "ElementDeclaration", ")", ":", "return", "False", "try", ":", "group", ...
if head and sub are both GEDs, and sub declares head as its substitutionGroup then return True. head -- Typecode instance sub -- Typecode instance
[ "if", "head", "and", "sub", "are", "both", "GEDs", "and", "sub", "declares", "head", "as", "its", "substitutionGroup", "then", "return", "True", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L33-L56
rameshg87/pyremotevbox
pyremotevbox/ZSI/schema.py
SchemaInstanceType.getTypeDefinition
def getTypeDefinition(cls, namespaceURI, name, lazy=False): '''Grab a type definition, returns a typecode class definition because the facets (name, minOccurs, maxOccurs) must be provided. Parameters: namespaceURI -- name -- ''' klass = cls.types.get((na...
python
def getTypeDefinition(cls, namespaceURI, name, lazy=False): '''Grab a type definition, returns a typecode class definition because the facets (name, minOccurs, maxOccurs) must be provided. Parameters: namespaceURI -- name -- ''' klass = cls.types.get((na...
[ "def", "getTypeDefinition", "(", "cls", ",", "namespaceURI", ",", "name", ",", "lazy", "=", "False", ")", ":", "klass", "=", "cls", ".", "types", ".", "get", "(", "(", "namespaceURI", ",", "name", ")", ",", "None", ")", "if", "lazy", "and", "klass", ...
Grab a type definition, returns a typecode class definition because the facets (name, minOccurs, maxOccurs) must be provided. Parameters: namespaceURI -- name --
[ "Grab", "a", "type", "definition", "returns", "a", "typecode", "class", "definition", "because", "the", "facets", "(", "name", "minOccurs", "maxOccurs", ")", "must", "be", "provided", ".", "Parameters", ":", "namespaceURI", "--", "name", "--" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L150-L161
rameshg87/pyremotevbox
pyremotevbox/ZSI/schema.py
SchemaInstanceType.getElementDeclaration
def getElementDeclaration(cls, namespaceURI, name, isref=False, lazy=False): '''Grab an element declaration, returns a typecode instance representation or a typecode class definition. An element reference has its own facets, and is local so it will not be cached. Parameters: ...
python
def getElementDeclaration(cls, namespaceURI, name, isref=False, lazy=False): '''Grab an element declaration, returns a typecode instance representation or a typecode class definition. An element reference has its own facets, and is local so it will not be cached. Parameters: ...
[ "def", "getElementDeclaration", "(", "cls", ",", "namespaceURI", ",", "name", ",", "isref", "=", "False", ",", "lazy", "=", "False", ")", ":", "key", "=", "(", "namespaceURI", ",", "name", ")", "if", "isref", ":", "klass", "=", "cls", ".", "elements", ...
Grab an element declaration, returns a typecode instance representation or a typecode class definition. An element reference has its own facets, and is local so it will not be cached. Parameters: namespaceURI -- name -- isref -- if element referen...
[ "Grab", "an", "element", "declaration", "returns", "a", "typecode", "instance", "representation", "or", "a", "typecode", "class", "definition", ".", "An", "element", "reference", "has", "its", "own", "facets", "and", "is", "local", "so", "it", "will", "not", ...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L164-L189
rameshg87/pyremotevbox
pyremotevbox/ZSI/schema.py
ElementDeclaration.checkSubstitute
def checkSubstitute(self, typecode): '''If this is True, allow typecode to be substituted for "self" typecode. ''' if not isinstance(typecode, ElementDeclaration): return False try: nsuri,ncname = typecode.substitutionGroup except (AttributeError...
python
def checkSubstitute(self, typecode): '''If this is True, allow typecode to be substituted for "self" typecode. ''' if not isinstance(typecode, ElementDeclaration): return False try: nsuri,ncname = typecode.substitutionGroup except (AttributeError...
[ "def", "checkSubstitute", "(", "self", ",", "typecode", ")", ":", "if", "not", "isinstance", "(", "typecode", ",", "ElementDeclaration", ")", ":", "return", "False", "try", ":", "nsuri", ",", "ncname", "=", "typecode", ".", "substitutionGroup", "except", "("...
If this is True, allow typecode to be substituted for "self" typecode.
[ "If", "this", "is", "True", "allow", "typecode", "to", "be", "substituted", "for", "self", "typecode", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L203-L226
rameshg87/pyremotevbox
pyremotevbox/ZSI/schema.py
ElementDeclaration.getSubstitutionElement
def getSubstitutionElement(self, elt, ps): '''if elt matches a member of the head substitutionGroup, return the GED typecode representation of the member. head -- ElementDeclaration typecode, elt -- the DOM element being parsed ps -- ParsedSoap instance ''' nsu...
python
def getSubstitutionElement(self, elt, ps): '''if elt matches a member of the head substitutionGroup, return the GED typecode representation of the member. head -- ElementDeclaration typecode, elt -- the DOM element being parsed ps -- ParsedSoap instance ''' nsu...
[ "def", "getSubstitutionElement", "(", "self", ",", "elt", ",", "ps", ")", ":", "nsuri", ",", "ncname", "=", "_get_element_nsuri_name", "(", "elt", ")", "typecode", "=", "GED", "(", "nsuri", ",", "ncname", ")", "if", "typecode", "is", "None", ":", "return...
if elt matches a member of the head substitutionGroup, return the GED typecode representation of the member. head -- ElementDeclaration typecode, elt -- the DOM element being parsed ps -- ParsedSoap instance
[ "if", "elt", "matches", "a", "member", "of", "the", "head", "substitutionGroup", "return", "the", "GED", "typecode", "representation", "of", "the", "member", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L228-L250
rameshg87/pyremotevbox
pyremotevbox/ZSI/schema.py
TypeDefinition.getSubstituteType
def getSubstituteType(self, elt, ps): '''if xsi:type does not match the instance type attr, check to see if it is a derived type substitution. DONT Return the element's type. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap ob...
python
def getSubstituteType(self, elt, ps): '''if xsi:type does not match the instance type attr, check to see if it is a derived type substitution. DONT Return the element's type. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap ob...
[ "def", "getSubstituteType", "(", "self", ",", "elt", ",", "ps", ")", ":", "pyclass", "=", "SchemaInstanceType", ".", "getTypeDefinition", "(", "*", "self", ".", "type", ")", "if", "pyclass", "is", "None", ":", "raise", "EvaluateException", "(", "'No Type reg...
if xsi:type does not match the instance type attr, check to see if it is a derived type substitution. DONT Return the element's type. Parameters: elt -- the DOM element being parsed ps -- the ParsedSoap object.
[ "if", "xsi", ":", "type", "does", "not", "match", "the", "instance", "type", "attr", "check", "to", "see", "if", "it", "is", "a", "derived", "type", "substitution", ".", "DONT", "Return", "the", "element", "s", "type", ".", "Parameters", ":", "elt", "-...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L267-L297
rameshg87/pyremotevbox
pyremotevbox/ZSI/schema.py
_GetPyobjWrapper.RegisterBuiltin
def RegisterBuiltin(cls, arg): '''register a builtin, create a new wrapper. ''' if arg in cls.types_dict: raise RuntimeError, '%s already registered' %arg class _Wrapper(arg): 'Wrapper for builtin %s\n%s' %(arg, cls.__doc__) _Wrapper.__name__ = '_%sWrapper...
python
def RegisterBuiltin(cls, arg): '''register a builtin, create a new wrapper. ''' if arg in cls.types_dict: raise RuntimeError, '%s already registered' %arg class _Wrapper(arg): 'Wrapper for builtin %s\n%s' %(arg, cls.__doc__) _Wrapper.__name__ = '_%sWrapper...
[ "def", "RegisterBuiltin", "(", "cls", ",", "arg", ")", ":", "if", "arg", "in", "cls", ".", "types_dict", ":", "raise", "RuntimeError", ",", "'%s already registered'", "%", "arg", "class", "_Wrapper", "(", "arg", ")", ":", "'Wrapper for builtin %s\\n%s'", "%", ...
register a builtin, create a new wrapper.
[ "register", "a", "builtin", "create", "a", "new", "wrapper", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L376-L384
rameshg87/pyremotevbox
pyremotevbox/ZSI/schema.py
_GetPyobjWrapper.RegisterAnyElement
def RegisterAnyElement(cls): '''If find registered TypeCode instance, add Wrapper class to TypeCode class serialmap and Re-RegisterType. Provides Any serialzation of any instances of the Wrapper. ''' for k,v in cls.types_dict.items(): what = Any.serialmap.get(k) ...
python
def RegisterAnyElement(cls): '''If find registered TypeCode instance, add Wrapper class to TypeCode class serialmap and Re-RegisterType. Provides Any serialzation of any instances of the Wrapper. ''' for k,v in cls.types_dict.items(): what = Any.serialmap.get(k) ...
[ "def", "RegisterAnyElement", "(", "cls", ")", ":", "for", "k", ",", "v", "in", "cls", ".", "types_dict", ".", "items", "(", ")", ":", "what", "=", "Any", ".", "serialmap", ".", "get", "(", "k", ")", "if", "what", "is", "None", ":", "continue", "i...
If find registered TypeCode instance, add Wrapper class to TypeCode class serialmap and Re-RegisterType. Provides Any serialzation of any instances of the Wrapper.
[ "If", "find", "registered", "TypeCode", "instance", "add", "Wrapper", "class", "to", "TypeCode", "class", "serialmap", "and", "Re", "-", "RegisterType", ".", "Provides", "Any", "serialzation", "of", "any", "instances", "of", "the", "Wrapper", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L387-L397
rameshg87/pyremotevbox
pyremotevbox/ZSI/schema.py
_GetPyobjWrapper.WrapImmutable
def WrapImmutable(cls, pyobj, what): '''return a wrapper for pyobj, with typecode attribute set. Parameters: pyobj -- instance of builtin type (immutable) what -- typecode describing the data ''' d = cls.types_dict if type(pyobj) is bool: pyc...
python
def WrapImmutable(cls, pyobj, what): '''return a wrapper for pyobj, with typecode attribute set. Parameters: pyobj -- instance of builtin type (immutable) what -- typecode describing the data ''' d = cls.types_dict if type(pyobj) is bool: pyc...
[ "def", "WrapImmutable", "(", "cls", ",", "pyobj", ",", "what", ")", ":", "d", "=", "cls", ".", "types_dict", "if", "type", "(", "pyobj", ")", "is", "bool", ":", "pyclass", "=", "d", "[", "int", "]", "elif", "d", ".", "has_key", "(", "type", "(", ...
return a wrapper for pyobj, with typecode attribute set. Parameters: pyobj -- instance of builtin type (immutable) what -- typecode describing the data
[ "return", "a", "wrapper", "for", "pyobj", "with", "typecode", "attribute", "set", ".", "Parameters", ":", "pyobj", "--", "instance", "of", "builtin", "type", "(", "immutable", ")", "what", "--", "typecode", "describing", "the", "data" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/schema.py#L400-L418
rmetcalf9/baseapp_for_restapi_backend_with_swagger
baseapp_for_restapi_backend_with_swagger/FlaskRestSubclass.py
FlaskRestSubclass.render_doc
def render_doc(self): '''Override this method to customize the documentation page''' if self._doc_view: return self._doc_view() elif not self._doc: self.abort(self.bc_HTTPStatus_NOT_FOUND) res = render_template('swagger-ui.html', title=self.title, specs_url=self.specs_url) res = res.repl...
python
def render_doc(self): '''Override this method to customize the documentation page''' if self._doc_view: return self._doc_view() elif not self._doc: self.abort(self.bc_HTTPStatus_NOT_FOUND) res = render_template('swagger-ui.html', title=self.title, specs_url=self.specs_url) res = res.repl...
[ "def", "render_doc", "(", "self", ")", ":", "if", "self", ".", "_doc_view", ":", "return", "self", ".", "_doc_view", "(", ")", "elif", "not", "self", ".", "_doc", ":", "self", ".", "abort", "(", "self", ".", "bc_HTTPStatus_NOT_FOUND", ")", "res", "=", ...
Override this method to customize the documentation page
[ "Override", "this", "method", "to", "customize", "the", "documentation", "page" ]
train
https://github.com/rmetcalf9/baseapp_for_restapi_backend_with_swagger/blob/c7c797cf810929cdb044215b63bdf9e5024f46e4/baseapp_for_restapi_backend_with_swagger/FlaskRestSubclass.py#L122-L144
SergeySatskiy/cdm-gc-plugin
cdmplugins/gc/configdlg.py
GCPluginConfigDialog.__createLayout
def __createLayout(self): """Creates the dialog layout""" self.resize(450, 150) self.setSizeGripEnabled(True) verticalLayout = QVBoxLayout(self) whereGroupbox = QGroupBox(self) whereGroupbox.setTitle("Garbage collector message destination") sizePolicy = QSizePol...
python
def __createLayout(self): """Creates the dialog layout""" self.resize(450, 150) self.setSizeGripEnabled(True) verticalLayout = QVBoxLayout(self) whereGroupbox = QGroupBox(self) whereGroupbox.setTitle("Garbage collector message destination") sizePolicy = QSizePol...
[ "def", "__createLayout", "(", "self", ")", ":", "self", ".", "resize", "(", "450", ",", "150", ")", "self", ".", "setSizeGripEnabled", "(", "True", ")", "verticalLayout", "=", "QVBoxLayout", "(", "self", ")", "whereGroupbox", "=", "QGroupBox", "(", "self",...
Creates the dialog layout
[ "Creates", "the", "dialog", "layout" ]
train
https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/configdlg.py#L50-L87
SergeySatskiy/cdm-gc-plugin
cdmplugins/gc/configdlg.py
GCPluginConfigDialog.getCheckedOption
def getCheckedOption(self): """Returns what destination is selected""" if self.__silentRButton.isChecked(): return GCPluginConfigDialog.SILENT if self.__statusbarRButton.isChecked(): return GCPluginConfigDialog.STATUS_BAR return GCPluginConfigDialog.LOG
python
def getCheckedOption(self): """Returns what destination is selected""" if self.__silentRButton.isChecked(): return GCPluginConfigDialog.SILENT if self.__statusbarRButton.isChecked(): return GCPluginConfigDialog.STATUS_BAR return GCPluginConfigDialog.LOG
[ "def", "getCheckedOption", "(", "self", ")", ":", "if", "self", ".", "__silentRButton", ".", "isChecked", "(", ")", ":", "return", "GCPluginConfigDialog", ".", "SILENT", "if", "self", ".", "__statusbarRButton", ".", "isChecked", "(", ")", ":", "return", "GCP...
Returns what destination is selected
[ "Returns", "what", "destination", "is", "selected" ]
train
https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/configdlg.py#L89-L95
sassoo/goldman
goldman/middleware/threadlocal/__init__.py
Middleware.process_request
def process_request(self, req, resp): """ Process the request before routing it. """ goldman.sess.req = req if goldman.config.STORE: goldman.sess.store = goldman.config.STORE()
python
def process_request(self, req, resp): """ Process the request before routing it. """ goldman.sess.req = req if goldman.config.STORE: goldman.sess.store = goldman.config.STORE()
[ "def", "process_request", "(", "self", ",", "req", ",", "resp", ")", ":", "goldman", ".", "sess", ".", "req", "=", "req", "if", "goldman", ".", "config", ".", "STORE", ":", "goldman", ".", "sess", ".", "store", "=", "goldman", ".", "config", ".", "...
Process the request before routing it.
[ "Process", "the", "request", "before", "routing", "it", "." ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/middleware/threadlocal/__init__.py#L19-L25
carlosp420/dataset-creator
dataset_creator/utils.py
get_seq
def get_seq(seq_record, codon_positions, aminoacids=False, degenerate=None): """ Checks parameters such as codon_positions, aminoacids... to return the required sequence as string. Parameters: seq_record (SeqRecordExpanded object): codon_positions (str): aminoacids (boolean): ...
python
def get_seq(seq_record, codon_positions, aminoacids=False, degenerate=None): """ Checks parameters such as codon_positions, aminoacids... to return the required sequence as string. Parameters: seq_record (SeqRecordExpanded object): codon_positions (str): aminoacids (boolean): ...
[ "def", "get_seq", "(", "seq_record", ",", "codon_positions", ",", "aminoacids", "=", "False", ",", "degenerate", "=", "None", ")", ":", "Sequence", "=", "namedtuple", "(", "'Sequence'", ",", "[", "'seq'", ",", "'warning'", "]", ")", "if", "codon_positions", ...
Checks parameters such as codon_positions, aminoacids... to return the required sequence as string. Parameters: seq_record (SeqRecordExpanded object): codon_positions (str): aminoacids (boolean): Returns: Namedtuple containing ``seq (str)`` and ``warning (str)``.
[ "Checks", "parameters", "such", "as", "codon_positions", "aminoacids", "...", "to", "return", "the", "required", "sequence", "as", "string", "." ]
train
https://github.com/carlosp420/dataset-creator/blob/ea27340b145cb566a36c1836ff42263f1b2003a0/dataset_creator/utils.py#L17-L56
carlosp420/dataset-creator
dataset_creator/utils.py
convert_nexus_to_format
def convert_nexus_to_format(dataset_as_nexus, dataset_format): """ Converts nexus format to Phylip and Fasta using Biopython tools. :param dataset_as_nexus: :param dataset_format: :return: """ fake_handle = StringIO(dataset_as_nexus) nexus_al = AlignIO.parse(fake_handle, 'nexus') tm...
python
def convert_nexus_to_format(dataset_as_nexus, dataset_format): """ Converts nexus format to Phylip and Fasta using Biopython tools. :param dataset_as_nexus: :param dataset_format: :return: """ fake_handle = StringIO(dataset_as_nexus) nexus_al = AlignIO.parse(fake_handle, 'nexus') tm...
[ "def", "convert_nexus_to_format", "(", "dataset_as_nexus", ",", "dataset_format", ")", ":", "fake_handle", "=", "StringIO", "(", "dataset_as_nexus", ")", "nexus_al", "=", "AlignIO", ".", "parse", "(", "fake_handle", ",", "'nexus'", ")", "tmp_file", "=", "make_rand...
Converts nexus format to Phylip and Fasta using Biopython tools. :param dataset_as_nexus: :param dataset_format: :return:
[ "Converts", "nexus", "format", "to", "Phylip", "and", "Fasta", "using", "Biopython", "tools", "." ]
train
https://github.com/carlosp420/dataset-creator/blob/ea27340b145cb566a36c1836ff42263f1b2003a0/dataset_creator/utils.py#L59-L72
carlosp420/dataset-creator
dataset_creator/utils.py
make_dataset_header
def make_dataset_header(data, file_format, aminoacids): """Creates the dataset header for NEXUS files from ``#NEXUS`` to ``MATRIX``. Parameters: data (namedtuple): with necessary info for dataset creation. file_format (str): TNT, PHYLIP, NEXUS, FASTA aminoacids (boolean): If ``ami...
python
def make_dataset_header(data, file_format, aminoacids): """Creates the dataset header for NEXUS files from ``#NEXUS`` to ``MATRIX``. Parameters: data (namedtuple): with necessary info for dataset creation. file_format (str): TNT, PHYLIP, NEXUS, FASTA aminoacids (boolean): If ``ami...
[ "def", "make_dataset_header", "(", "data", ",", "file_format", ",", "aminoacids", ")", ":", "if", "aminoacids", ":", "datatype", "=", "'PROTEIN'", "else", ":", "datatype", "=", "'DNA'", "if", "file_format", "in", "[", "'NEXUS'", ",", "'PHYLIP'", ",", "'FASTA...
Creates the dataset header for NEXUS files from ``#NEXUS`` to ``MATRIX``. Parameters: data (namedtuple): with necessary info for dataset creation. file_format (str): TNT, PHYLIP, NEXUS, FASTA aminoacids (boolean): If ``aminoacids is True`` the header will show ...
[ "Creates", "the", "dataset", "header", "for", "NEXUS", "files", "from", "#NEXUS", "to", "MATRIX", "." ]
train
https://github.com/carlosp420/dataset-creator/blob/ea27340b145cb566a36c1836ff42263f1b2003a0/dataset_creator/utils.py#L89-L126