partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
ServiceProxy.send_payload
Performs the actual sending action and returns the result
flask_jsonrpc/proxy.py
def send_payload(self, params): """Performs the actual sending action and returns the result """ data = json.dumps({ 'jsonrpc': self.version, 'method': self.service_name, 'params': params, 'id': text_type(uuid.uuid4()) }) data_binar...
def send_payload(self, params): """Performs the actual sending action and returns the result """ data = json.dumps({ 'jsonrpc': self.version, 'method': self.service_name, 'params': params, 'id': text_type(uuid.uuid4()) }) data_binar...
[ "Performs", "the", "actual", "sending", "action", "and", "returns", "the", "result" ]
cenobites/flask-jsonrpc
python
https://github.com/cenobites/flask-jsonrpc/blob/c7f8e049adda8cf4c5a62aea345eb42697f10eff/flask_jsonrpc/proxy.py#L59-L70
[ "def", "send_payload", "(", "self", ",", "params", ")", ":", "data", "=", "json", ".", "dumps", "(", "{", "'jsonrpc'", ":", "self", ".", "version", ",", "'method'", ":", "self", ".", "service_name", ",", "'params'", ":", "params", ",", "'id'", ":", "...
c7f8e049adda8cf4c5a62aea345eb42697f10eff
valid
JSONRPCSite.make_response
Converts the return value from a view function to a real response object that is an instance of :attr:`response_class`.
flask_jsonrpc/site.py
def make_response(self, rv): """Converts the return value from a view function to a real response object that is an instance of :attr:`response_class`. """ status_or_headers = headers = None if isinstance(rv, tuple): rv, status_or_headers, headers = rv + (None,) * (3 ...
def make_response(self, rv): """Converts the return value from a view function to a real response object that is an instance of :attr:`response_class`. """ status_or_headers = headers = None if isinstance(rv, tuple): rv, status_or_headers, headers = rv + (None,) * (3 ...
[ "Converts", "the", "return", "value", "from", "a", "view", "function", "to", "a", "real", "response", "object", "that", "is", "an", "instance", "of", ":", "attr", ":", "response_class", "." ]
cenobites/flask-jsonrpc
python
https://github.com/cenobites/flask-jsonrpc/blob/c7f8e049adda8cf4c5a62aea345eb42697f10eff/flask_jsonrpc/site.py#L323-L355
[ "def", "make_response", "(", "self", ",", "rv", ")", ":", "status_or_headers", "=", "headers", "=", "None", "if", "isinstance", "(", "rv", ",", "tuple", ")", ":", "rv", ",", "status_or_headers", ",", "headers", "=", "rv", "+", "(", "None", ",", ")", ...
c7f8e049adda8cf4c5a62aea345eb42697f10eff
valid
Error.json_rpc_format
Return the Exception data in a format for JSON-RPC
flask_jsonrpc/exceptions.py
def json_rpc_format(self): """Return the Exception data in a format for JSON-RPC """ error = { 'name': text_type(self.__class__.__name__), 'code': self.code, 'message': '{0}'.format(text_type(self.message)), 'data': self.data } if...
def json_rpc_format(self): """Return the Exception data in a format for JSON-RPC """ error = { 'name': text_type(self.__class__.__name__), 'code': self.code, 'message': '{0}'.format(text_type(self.message)), 'data': self.data } if...
[ "Return", "the", "Exception", "data", "in", "a", "format", "for", "JSON", "-", "RPC" ]
cenobites/flask-jsonrpc
python
https://github.com/cenobites/flask-jsonrpc/blob/c7f8e049adda8cf4c5a62aea345eb42697f10eff/flask_jsonrpc/exceptions.py#L67-L83
[ "def", "json_rpc_format", "(", "self", ")", ":", "error", "=", "{", "'name'", ":", "text_type", "(", "self", ".", "__class__", ".", "__name__", ")", ",", "'code'", ":", "self", ".", "code", ",", "'message'", ":", "'{0}'", ".", "format", "(", "text_type...
c7f8e049adda8cf4c5a62aea345eb42697f10eff
valid
Config.from_file
Try loading given config file. :param str file: full path to the config file to load
twtxt/config.py
def from_file(cls, file): """Try loading given config file. :param str file: full path to the config file to load """ if not os.path.exists(file): raise ValueError("Config file not found.") try: config_parser = configparser.ConfigParser() con...
def from_file(cls, file): """Try loading given config file. :param str file: full path to the config file to load """ if not os.path.exists(file): raise ValueError("Config file not found.") try: config_parser = configparser.ConfigParser() con...
[ "Try", "loading", "given", "config", "file", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L36-L54
[ "def", "from_file", "(", "cls", ",", "file", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "file", ")", ":", "raise", "ValueError", "(", "\"Config file not found.\"", ")", "try", ":", "config_parser", "=", "configparser", ".", "ConfigParser...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Config.discover
Make a guess about the config file location an try loading it.
twtxt/config.py
def discover(cls): """Make a guess about the config file location an try loading it.""" file = os.path.join(Config.config_dir, Config.config_name) return cls.from_file(file)
def discover(cls): """Make a guess about the config file location an try loading it.""" file = os.path.join(Config.config_dir, Config.config_name) return cls.from_file(file)
[ "Make", "a", "guess", "about", "the", "config", "file", "location", "an", "try", "loading", "it", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L57-L60
[ "def", "discover", "(", "cls", ")", ":", "file", "=", "os", ".", "path", ".", "join", "(", "Config", ".", "config_dir", ",", "Config", ".", "config_name", ")", "return", "cls", ".", "from_file", "(", "file", ")" ]
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Config.create_config
Create a new config file at the default location. :param str cfgfile: path to the config file :param str nick: nickname to use for own tweets :param str twtfile: path to the local twtxt file :param str twturl: URL to the remote twtxt file :param bool disclose_identity: if true t...
twtxt/config.py
def create_config(cls, cfgfile, nick, twtfile, twturl, disclose_identity, add_news): """Create a new config file at the default location. :param str cfgfile: path to the config file :param str nick: nickname to use for own tweets :param str twtfile: path to the local twtxt file ...
def create_config(cls, cfgfile, nick, twtfile, twturl, disclose_identity, add_news): """Create a new config file at the default location. :param str cfgfile: path to the config file :param str nick: nickname to use for own tweets :param str twtfile: path to the local twtxt file ...
[ "Create", "a", "new", "config", "file", "at", "the", "default", "location", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L63-L93
[ "def", "create_config", "(", "cls", ",", "cfgfile", ",", "nick", ",", "twtfile", ",", "twturl", ",", "disclose_identity", ",", "add_news", ")", ":", "cfgfile_dir", "=", "os", ".", "path", ".", "dirname", "(", "cfgfile", ")", "if", "not", "os", ".", "pa...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Config.write_config
Writes `self.cfg` to `self.config_file`.
twtxt/config.py
def write_config(self): """Writes `self.cfg` to `self.config_file`.""" with open(self.config_file, "w") as config_file: self.cfg.write(config_file)
def write_config(self): """Writes `self.cfg` to `self.config_file`.""" with open(self.config_file, "w") as config_file: self.cfg.write(config_file)
[ "Writes", "self", ".", "cfg", "to", "self", ".", "config_file", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L95-L98
[ "def", "write_config", "(", "self", ")", ":", "with", "open", "(", "self", ".", "config_file", ",", "\"w\"", ")", "as", "config_file", ":", "self", ".", "cfg", ".", "write", "(", "config_file", ")" ]
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Config.following
A :class:`list` of all :class:`Source` objects.
twtxt/config.py
def following(self): """A :class:`list` of all :class:`Source` objects.""" following = [] try: for (nick, url) in self.cfg.items("following"): source = Source(nick, url) following.append(source) except configparser.NoSectionError as e: ...
def following(self): """A :class:`list` of all :class:`Source` objects.""" following = [] try: for (nick, url) in self.cfg.items("following"): source = Source(nick, url) following.append(source) except configparser.NoSectionError as e: ...
[ "A", ":", "class", ":", "list", "of", "all", ":", "class", ":", "Source", "objects", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L101-L111
[ "def", "following", "(", "self", ")", ":", "following", "=", "[", "]", "try", ":", "for", "(", "nick", ",", "url", ")", "in", "self", ".", "cfg", ".", "items", "(", "\"following\"", ")", ":", "source", "=", "Source", "(", "nick", ",", "url", ")",...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Config.options
A :class:`dict` of all config options.
twtxt/config.py
def options(self): """A :class:`dict` of all config options.""" try: return dict(self.cfg.items("twtxt")) except configparser.NoSectionError as e: logger.debug(e) return {}
def options(self): """A :class:`dict` of all config options.""" try: return dict(self.cfg.items("twtxt")) except configparser.NoSectionError as e: logger.debug(e) return {}
[ "A", ":", "class", ":", "dict", "of", "all", "config", "options", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L114-L120
[ "def", "options", "(", "self", ")", ":", "try", ":", "return", "dict", "(", "self", ".", "cfg", ".", "items", "(", "\"twtxt\"", ")", ")", "except", "configparser", ".", "NoSectionError", "as", "e", ":", "logger", ".", "debug", "(", "e", ")", "return"...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Config.add_source
Adds a new :class:`Source` to the config’s following section.
twtxt/config.py
def add_source(self, source): """Adds a new :class:`Source` to the config’s following section.""" if not self.cfg.has_section("following"): self.cfg.add_section("following") self.cfg.set("following", source.nick, source.url) self.write_config()
def add_source(self, source): """Adds a new :class:`Source` to the config’s following section.""" if not self.cfg.has_section("following"): self.cfg.add_section("following") self.cfg.set("following", source.nick, source.url) self.write_config()
[ "Adds", "a", "new", ":", "class", ":", "Source", "to", "the", "config’s", "following", "section", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L194-L200
[ "def", "add_source", "(", "self", ",", "source", ")", ":", "if", "not", "self", ".", "cfg", ".", "has_section", "(", "\"following\"", ")", ":", "self", ".", "cfg", ".", "add_section", "(", "\"following\"", ")", "self", ".", "cfg", ".", "set", "(", "\...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Config.get_source_by_nick
Returns the :class:`Source` of the given nick. :param str nick: nickname for which will be searched in the config
twtxt/config.py
def get_source_by_nick(self, nick): """Returns the :class:`Source` of the given nick. :param str nick: nickname for which will be searched in the config """ url = self.cfg.get("following", nick, fallback=None) return Source(nick, url) if url else None
def get_source_by_nick(self, nick): """Returns the :class:`Source` of the given nick. :param str nick: nickname for which will be searched in the config """ url = self.cfg.get("following", nick, fallback=None) return Source(nick, url) if url else None
[ "Returns", "the", ":", "class", ":", "Source", "of", "the", "given", "nick", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L202-L208
[ "def", "get_source_by_nick", "(", "self", ",", "nick", ")", ":", "url", "=", "self", ".", "cfg", ".", "get", "(", "\"following\"", ",", "nick", ",", "fallback", "=", "None", ")", "return", "Source", "(", "nick", ",", "url", ")", "if", "url", "else", ...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Config.remove_source_by_nick
Removes a :class:`Source` form the config’s following section. :param str nick: nickname for which will be searched in the config
twtxt/config.py
def remove_source_by_nick(self, nick): """Removes a :class:`Source` form the config’s following section. :param str nick: nickname for which will be searched in the config """ if not self.cfg.has_section("following"): return False ret_val = self.cfg.remove_option("f...
def remove_source_by_nick(self, nick): """Removes a :class:`Source` form the config’s following section. :param str nick: nickname for which will be searched in the config """ if not self.cfg.has_section("following"): return False ret_val = self.cfg.remove_option("f...
[ "Removes", "a", ":", "class", ":", "Source", "form", "the", "config’s", "following", "section", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L210-L220
[ "def", "remove_source_by_nick", "(", "self", ",", "nick", ")", ":", "if", "not", "self", ".", "cfg", ".", "has_section", "(", "\"following\"", ")", ":", "return", "False", "ret_val", "=", "self", ".", "cfg", ".", "remove_option", "(", "\"following\"", ",",...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Config.build_default_map
Maps config options to the default values used by click, returns :class:`dict`.
twtxt/config.py
def build_default_map(self): """Maps config options to the default values used by click, returns :class:`dict`.""" default_map = { "following": { "check": self.check_following, "timeout": self.timeout, "porcelain": self.porcelain, }...
def build_default_map(self): """Maps config options to the default values used by click, returns :class:`dict`.""" default_map = { "following": { "check": self.check_following, "timeout": self.timeout, "porcelain": self.porcelain, }...
[ "Maps", "config", "options", "to", "the", "default", "values", "used", "by", "click", "returns", ":", "class", ":", "dict", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L222-L253
[ "def", "build_default_map", "(", "self", ")", ":", "default_map", "=", "{", "\"following\"", ":", "{", "\"check\"", ":", "self", ".", "check_following", ",", "\"timeout\"", ":", "self", ".", "timeout", ",", "\"porcelain\"", ":", "self", ".", "porcelain", ","...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Config.check_config_sanity
Checks if the given values in the config file are sane.
twtxt/config.py
def check_config_sanity(self): """Checks if the given values in the config file are sane.""" is_sane = True # This extracts some properties which cannot be checked like "nick", # but it is definitely better than writing the property names as a # string literal. propertie...
def check_config_sanity(self): """Checks if the given values in the config file are sane.""" is_sane = True # This extracts some properties which cannot be checked like "nick", # but it is definitely better than writing the property names as a # string literal. propertie...
[ "Checks", "if", "the", "given", "values", "in", "the", "config", "file", "are", "sane", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/config.py#L255-L273
[ "def", "check_config_sanity", "(", "self", ")", ":", "is_sane", "=", "True", "# This extracts some properties which cannot be checked like \"nick\",", "# but it is definitely better than writing the property names as a", "# string literal.", "properties", "=", "[", "property_name", "...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
validate_config_key
Validate a configuration key according to `section.item`.
twtxt/helper.py
def validate_config_key(ctx, param, value): """Validate a configuration key according to `section.item`.""" if not value: return value try: section, item = value.split(".", 1) except ValueError: raise click.BadArgumentUsage("Given key does not contain a section name.") else:...
def validate_config_key(ctx, param, value): """Validate a configuration key according to `section.item`.""" if not value: return value try: section, item = value.split(".", 1) except ValueError: raise click.BadArgumentUsage("Given key does not contain a section name.") else:...
[ "Validate", "a", "configuration", "key", "according", "to", "section", ".", "item", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/helper.py#L112-L122
[ "def", "validate_config_key", "(", "ctx", ",", "param", ",", "value", ")", ":", "if", "not", "value", ":", "return", "value", "try", ":", "section", ",", "item", "=", "value", ".", "split", "(", "\".\"", ",", "1", ")", "except", "ValueError", ":", "r...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
expand_mentions
Searches the given text for mentions and expands them. For example: "@source.nick" will be expanded to "@<source.nick source.url>".
twtxt/mentions.py
def expand_mentions(text, embed_names=True): """Searches the given text for mentions and expands them. For example: "@source.nick" will be expanded to "@<source.nick source.url>". """ if embed_names: mention_format = "@<{name} {url}>" else: mention_format = "@<{url}>" def h...
def expand_mentions(text, embed_names=True): """Searches the given text for mentions and expands them. For example: "@source.nick" will be expanded to "@<source.nick source.url>". """ if embed_names: mention_format = "@<{name} {url}>" else: mention_format = "@<{url}>" def h...
[ "Searches", "the", "given", "text", "for", "mentions", "and", "expands", "them", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/mentions.py#L34-L53
[ "def", "expand_mentions", "(", "text", ",", "embed_names", "=", "True", ")", ":", "if", "embed_names", ":", "mention_format", "=", "\"@<{name} {url}>\"", "else", ":", "mention_format", "=", "\"@<{url}>\"", "def", "handle_mention", "(", "match", ")", ":", "source...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
format_mentions
Searches the given text for mentions generated by `expand_mention()` and returns a human-readable form. For example: "@<bob http://example.org/twtxt.txt>" will result in "@bob" If you follow a source: source.nick will be bold If you are the mentioned source: source.nick will be bold and coloured I...
twtxt/mentions.py
def format_mentions(text, format_callback=format_mention): """Searches the given text for mentions generated by `expand_mention()` and returns a human-readable form. For example: "@<bob http://example.org/twtxt.txt>" will result in "@bob" If you follow a source: source.nick will be bold If you are...
def format_mentions(text, format_callback=format_mention): """Searches the given text for mentions generated by `expand_mention()` and returns a human-readable form. For example: "@<bob http://example.org/twtxt.txt>" will result in "@bob" If you follow a source: source.nick will be bold If you are...
[ "Searches", "the", "given", "text", "for", "mentions", "generated", "by", "expand_mention", "()", "and", "returns", "a", "human", "-", "readable", "form", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/mentions.py#L69-L85
[ "def", "format_mentions", "(", "text", ",", "format_callback", "=", "format_mention", ")", ":", "def", "handle_mention", "(", "match", ")", ":", "name", ",", "url", "=", "match", ".", "groups", "(", ")", "return", "format_callback", "(", "name", ",", "url"...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
make_aware
Appends tzinfo and assumes UTC, if datetime object has no tzinfo already.
twtxt/parser.py
def make_aware(dt): """Appends tzinfo and assumes UTC, if datetime object has no tzinfo already.""" return dt if dt.tzinfo else dt.replace(tzinfo=timezone.utc)
def make_aware(dt): """Appends tzinfo and assumes UTC, if datetime object has no tzinfo already.""" return dt if dt.tzinfo else dt.replace(tzinfo=timezone.utc)
[ "Appends", "tzinfo", "and", "assumes", "UTC", "if", "datetime", "object", "has", "no", "tzinfo", "already", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/parser.py#L22-L24
[ "def", "make_aware", "(", "dt", ")", ":", "return", "dt", "if", "dt", ".", "tzinfo", "else", "dt", ".", "replace", "(", "tzinfo", "=", "timezone", ".", "utc", ")" ]
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
parse_tweets
Parses a list of raw tweet lines from a twtxt file and returns a list of :class:`Tweet` objects. :param list raw_tweets: list of raw tweet lines :param Source source: the source of the given tweets :param Datetime now: the current datetime :returns: a list of parsed tweets :cla...
twtxt/parser.py
def parse_tweets(raw_tweets, source, now=None): """ Parses a list of raw tweet lines from a twtxt file and returns a list of :class:`Tweet` objects. :param list raw_tweets: list of raw tweet lines :param Source source: the source of the given tweets :param Datetime now: the ...
def parse_tweets(raw_tweets, source, now=None): """ Parses a list of raw tweet lines from a twtxt file and returns a list of :class:`Tweet` objects. :param list raw_tweets: list of raw tweet lines :param Source source: the source of the given tweets :param Datetime now: the ...
[ "Parses", "a", "list", "of", "raw", "tweet", "lines", "from", "a", "twtxt", "file", "and", "returns", "a", "list", "of", ":", "class", ":", "Tweet", "objects", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/parser.py#L32-L56
[ "def", "parse_tweets", "(", "raw_tweets", ",", "source", ",", "now", "=", "None", ")", ":", "if", "now", "is", "None", ":", "now", "=", "datetime", ".", "now", "(", "timezone", ".", "utc", ")", "tweets", "=", "[", "]", "for", "line", "in", "raw_twe...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
parse_tweet
Parses a single raw tweet line from a twtxt file and returns a :class:`Tweet` object. :param str raw_tweet: a single raw tweet line :param Source source: the source of the given tweet :param Datetime now: the current datetime :returns: the parsed tweet :rtype: Tweet
twtxt/parser.py
def parse_tweet(raw_tweet, source, now=None): """ Parses a single raw tweet line from a twtxt file and returns a :class:`Tweet` object. :param str raw_tweet: a single raw tweet line :param Source source: the source of the given tweet :param Datetime now: the current datetime...
def parse_tweet(raw_tweet, source, now=None): """ Parses a single raw tweet line from a twtxt file and returns a :class:`Tweet` object. :param str raw_tweet: a single raw tweet line :param Source source: the source of the given tweet :param Datetime now: the current datetime...
[ "Parses", "a", "single", "raw", "tweet", "line", "from", "a", "twtxt", "file", "and", "returns", "a", ":", "class", ":", "Tweet", "object", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/parser.py#L59-L80
[ "def", "parse_tweet", "(", "raw_tweet", ",", "source", ",", "now", "=", "None", ")", ":", "if", "now", "is", "None", ":", "now", "=", "datetime", ".", "now", "(", "timezone", ".", "utc", ")", "raw_created_at", ",", "text", "=", "raw_tweet", ".", "spl...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Cache.from_file
Try loading given cache file.
twtxt/cache.py
def from_file(cls, file, *args, **kwargs): """Try loading given cache file.""" try: cache = shelve.open(file) return cls(file, cache, *args, **kwargs) except OSError as e: logger.debug("Loading {0} failed".format(file)) raise e
def from_file(cls, file, *args, **kwargs): """Try loading given cache file.""" try: cache = shelve.open(file) return cls(file, cache, *args, **kwargs) except OSError as e: logger.debug("Loading {0} failed".format(file)) raise e
[ "Try", "loading", "given", "cache", "file", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cache.py#L44-L51
[ "def", "from_file", "(", "cls", ",", "file", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "cache", "=", "shelve", ".", "open", "(", "file", ")", "return", "cls", "(", "file", ",", "cache", ",", "*", "args", ",", "*", "*", ...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Cache.discover
Make a guess about the cache file location an try loading it.
twtxt/cache.py
def discover(cls, *args, **kwargs): """Make a guess about the cache file location an try loading it.""" file = os.path.join(Cache.cache_dir, Cache.cache_name) return cls.from_file(file, *args, **kwargs)
def discover(cls, *args, **kwargs): """Make a guess about the cache file location an try loading it.""" file = os.path.join(Cache.cache_dir, Cache.cache_name) return cls.from_file(file, *args, **kwargs)
[ "Make", "a", "guess", "about", "the", "cache", "file", "location", "an", "try", "loading", "it", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cache.py#L54-L57
[ "def", "discover", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "file", "=", "os", ".", "path", ".", "join", "(", "Cache", ".", "cache_dir", ",", "Cache", ".", "cache_name", ")", "return", "cls", ".", "from_file", "(", "file", ...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Cache.is_cached
Checks if specified URL is cached.
twtxt/cache.py
def is_cached(self, url): """Checks if specified URL is cached.""" try: return True if url in self.cache else False except TypeError: return False
def is_cached(self, url): """Checks if specified URL is cached.""" try: return True if url in self.cache else False except TypeError: return False
[ "Checks", "if", "specified", "URL", "is", "cached", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cache.py#L80-L85
[ "def", "is_cached", "(", "self", ",", "url", ")", ":", "try", ":", "return", "True", "if", "url", "in", "self", ".", "cache", "else", "False", "except", "TypeError", ":", "return", "False" ]
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Cache.add_tweets
Adds new tweets to the cache.
twtxt/cache.py
def add_tweets(self, url, last_modified, tweets): """Adds new tweets to the cache.""" try: self.cache[url] = {"last_modified": last_modified, "tweets": tweets} self.mark_updated() return True except TypeError: return False
def add_tweets(self, url, last_modified, tweets): """Adds new tweets to the cache.""" try: self.cache[url] = {"last_modified": last_modified, "tweets": tweets} self.mark_updated() return True except TypeError: return False
[ "Adds", "new", "tweets", "to", "the", "cache", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cache.py#L94-L101
[ "def", "add_tweets", "(", "self", ",", "url", ",", "last_modified", ",", "tweets", ")", ":", "try", ":", "self", ".", "cache", "[", "url", "]", "=", "{", "\"last_modified\"", ":", "last_modified", ",", "\"tweets\"", ":", "tweets", "}", "self", ".", "ma...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Cache.get_tweets
Retrieves tweets from the cache.
twtxt/cache.py
def get_tweets(self, url, limit=None): """Retrieves tweets from the cache.""" try: tweets = self.cache[url]["tweets"] self.mark_updated() return sorted(tweets, reverse=True)[:limit] except KeyError: return []
def get_tweets(self, url, limit=None): """Retrieves tweets from the cache.""" try: tweets = self.cache[url]["tweets"] self.mark_updated() return sorted(tweets, reverse=True)[:limit] except KeyError: return []
[ "Retrieves", "tweets", "from", "the", "cache", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cache.py#L103-L110
[ "def", "get_tweets", "(", "self", ",", "url", ",", "limit", "=", "None", ")", ":", "try", ":", "tweets", "=", "self", ".", "cache", "[", "url", "]", "[", "\"tweets\"", "]", "self", ".", "mark_updated", "(", ")", "return", "sorted", "(", "tweets", "...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Cache.remove_tweets
Tries to remove cached tweets.
twtxt/cache.py
def remove_tweets(self, url): """Tries to remove cached tweets.""" try: del self.cache[url] self.mark_updated() return True except KeyError: return False
def remove_tweets(self, url): """Tries to remove cached tweets.""" try: del self.cache[url] self.mark_updated() return True except KeyError: return False
[ "Tries", "to", "remove", "cached", "tweets", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cache.py#L112-L119
[ "def", "remove_tweets", "(", "self", ",", "url", ")", ":", "try", ":", "del", "self", ".", "cache", "[", "url", "]", "self", ".", "mark_updated", "(", ")", "return", "True", "except", "KeyError", ":", "return", "False" ]
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
cli
Decentralised, minimalist microblogging service for hackers.
twtxt/cli.py
def cli(ctx, config, verbose): """Decentralised, minimalist microblogging service for hackers.""" init_logging(debug=verbose) if ctx.invoked_subcommand == "quickstart": return # Skip initializing config file try: if config: conf = Config.from_file(config) else: ...
def cli(ctx, config, verbose): """Decentralised, minimalist microblogging service for hackers.""" init_logging(debug=verbose) if ctx.invoked_subcommand == "quickstart": return # Skip initializing config file try: if config: conf = Config.from_file(config) else: ...
[ "Decentralised", "minimalist", "microblogging", "service", "for", "hackers", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cli.py#L43-L63
[ "def", "cli", "(", "ctx", ",", "config", ",", "verbose", ")", ":", "init_logging", "(", "debug", "=", "verbose", ")", "if", "ctx", ".", "invoked_subcommand", "==", "\"quickstart\"", ":", "return", "# Skip initializing config file", "try", ":", "if", "config", ...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
tweet
Append a new tweet to your twtxt file.
twtxt/cli.py
def tweet(ctx, created_at, twtfile, text): """Append a new tweet to your twtxt file.""" text = expand_mentions(text) tweet = Tweet(text, created_at) if created_at else Tweet(text) pre_tweet_hook = ctx.obj["conf"].pre_tweet_hook if pre_tweet_hook: run_pre_tweet_hook(pre_tweet_hook, ctx.obj["...
def tweet(ctx, created_at, twtfile, text): """Append a new tweet to your twtxt file.""" text = expand_mentions(text) tweet = Tweet(text, created_at) if created_at else Tweet(text) pre_tweet_hook = ctx.obj["conf"].pre_tweet_hook if pre_tweet_hook: run_pre_tweet_hook(pre_tweet_hook, ctx.obj["...
[ "Append", "a", "new", "tweet", "to", "your", "twtxt", "file", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cli.py#L75-L89
[ "def", "tweet", "(", "ctx", ",", "created_at", ",", "twtfile", ",", "text", ")", ":", "text", "=", "expand_mentions", "(", "text", ")", "tweet", "=", "Tweet", "(", "text", ",", "created_at", ")", "if", "created_at", "else", "Tweet", "(", "text", ")", ...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
timeline
Retrieve your personal timeline.
twtxt/cli.py
def timeline(ctx, pager, limit, twtfile, sorting, timeout, porcelain, source, cache, force_update): """Retrieve your personal timeline.""" if source: source_obj = ctx.obj["conf"].get_source_by_nick(source) if not source_obj: logger.debug("Not following {0}, trying as URL".format(sour...
def timeline(ctx, pager, limit, twtfile, sorting, timeout, porcelain, source, cache, force_update): """Retrieve your personal timeline.""" if source: source_obj = ctx.obj["conf"].get_source_by_nick(source) if not source_obj: logger.debug("Not following {0}, trying as URL".format(sour...
[ "Retrieve", "your", "personal", "timeline", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cli.py#L123-L165
[ "def", "timeline", "(", "ctx", ",", "pager", ",", "limit", ",", "twtfile", ",", "sorting", ",", "timeout", ",", "porcelain", ",", "source", ",", "cache", ",", "force_update", ")", ":", "if", "source", ":", "source_obj", "=", "ctx", ".", "obj", "[", "...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
following
Return the list of sources you’re following.
twtxt/cli.py
def following(ctx, check, timeout, porcelain): """Return the list of sources you’re following.""" sources = ctx.obj['conf'].following if check: sources = get_remote_status(sources, timeout) for (source, status) in sources: click.echo(style_source_with_status(source, status, porc...
def following(ctx, check, timeout, porcelain): """Return the list of sources you’re following.""" sources = ctx.obj['conf'].following if check: sources = get_remote_status(sources, timeout) for (source, status) in sources: click.echo(style_source_with_status(source, status, porc...
[ "Return", "the", "list", "of", "sources", "you’re", "following", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cli.py#L211-L222
[ "def", "following", "(", "ctx", ",", "check", ",", "timeout", ",", "porcelain", ")", ":", "sources", "=", "ctx", ".", "obj", "[", "'conf'", "]", ".", "following", "if", "check", ":", "sources", "=", "get_remote_status", "(", "sources", ",", "timeout", ...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
follow
Add a new source to your followings.
twtxt/cli.py
def follow(ctx, nick, url, force): """Add a new source to your followings.""" source = Source(nick, url) sources = ctx.obj['conf'].following if not force: if source.nick in (source.nick for source in sources): click.confirm("➤ You’re already following {0}. Overwrite?".format( ...
def follow(ctx, nick, url, force): """Add a new source to your followings.""" source = Source(nick, url) sources = ctx.obj['conf'].following if not force: if source.nick in (source.nick for source in sources): click.confirm("➤ You’re already following {0}. Overwrite?".format( ...
[ "Add", "a", "new", "source", "to", "your", "followings", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cli.py#L232-L250
[ "def", "follow", "(", "ctx", ",", "nick", ",", "url", ",", "force", ")", ":", "source", "=", "Source", "(", "nick", ",", "url", ")", "sources", "=", "ctx", ".", "obj", "[", "'conf'", "]", ".", "following", "if", "not", "force", ":", "if", "source...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
unfollow
Remove an existing source from your followings.
twtxt/cli.py
def unfollow(ctx, nick): """Remove an existing source from your followings.""" source = ctx.obj['conf'].get_source_by_nick(nick) try: with Cache.discover() as cache: cache.remove_tweets(source.url) except OSError as e: logger.debug(e) ret_val = ctx.obj['conf'].remove_so...
def unfollow(ctx, nick): """Remove an existing source from your followings.""" source = ctx.obj['conf'].get_source_by_nick(nick) try: with Cache.discover() as cache: cache.remove_tweets(source.url) except OSError as e: logger.debug(e) ret_val = ctx.obj['conf'].remove_so...
[ "Remove", "an", "existing", "source", "from", "your", "followings", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cli.py#L256-L272
[ "def", "unfollow", "(", "ctx", ",", "nick", ")", ":", "source", "=", "ctx", ".", "obj", "[", "'conf'", "]", ".", "get_source_by_nick", "(", "nick", ")", "try", ":", "with", "Cache", ".", "discover", "(", ")", "as", "cache", ":", "cache", ".", "remo...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
quickstart
Quickstart wizard for setting up twtxt.
twtxt/cli.py
def quickstart(): """Quickstart wizard for setting up twtxt.""" width = click.get_terminal_size()[0] width = width if width <= 79 else 79 click.secho("twtxt - quickstart", fg="cyan") click.secho("==================", fg="cyan") click.echo() help_text = "This wizard will generate a basic co...
def quickstart(): """Quickstart wizard for setting up twtxt.""" width = click.get_terminal_size()[0] width = width if width <= 79 else 79 click.secho("twtxt - quickstart", fg="cyan") click.secho("==================", fg="cyan") click.echo() help_text = "This wizard will generate a basic co...
[ "Quickstart", "wizard", "for", "setting", "up", "twtxt", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cli.py#L276-L327
[ "def", "quickstart", "(", ")", ":", "width", "=", "click", ".", "get_terminal_size", "(", ")", "[", "0", "]", "width", "=", "width", "if", "width", "<=", "79", "else", "79", "click", ".", "secho", "(", "\"twtxt - quickstart\"", ",", "fg", "=", "\"cyan\...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
config
Get or set config item.
twtxt/cli.py
def config(ctx, key, value, remove, edit): """Get or set config item.""" conf = ctx.obj["conf"] if not edit and not key: raise click.BadArgumentUsage("You have to specify either a key or use --edit.") if edit: return click.edit(filename=conf.config_file) if remove: try: ...
def config(ctx, key, value, remove, edit): """Get or set config item.""" conf = ctx.obj["conf"] if not edit and not key: raise click.BadArgumentUsage("You have to specify either a key or use --edit.") if edit: return click.edit(filename=conf.config_file) if remove: try: ...
[ "Get", "or", "set", "config", "item", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cli.py#L340-L370
[ "def", "config", "(", "ctx", ",", "key", ",", "value", ",", "remove", ",", "edit", ")", ":", "conf", "=", "ctx", ".", "obj", "[", "\"conf\"", "]", "if", "not", "edit", "and", "not", "key", ":", "raise", "click", ".", "BadArgumentUsage", "(", "\"You...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
Tweet.relative_datetime
Return human-readable relative time string.
twtxt/models.py
def relative_datetime(self): """Return human-readable relative time string.""" now = datetime.now(timezone.utc) tense = "from now" if self.created_at > now else "ago" return "{0} {1}".format(humanize.naturaldelta(now - self.created_at), tense)
def relative_datetime(self): """Return human-readable relative time string.""" now = datetime.now(timezone.utc) tense = "from now" if self.created_at > now else "ago" return "{0} {1}".format(humanize.naturaldelta(now - self.created_at), tense)
[ "Return", "human", "-", "readable", "relative", "time", "string", "." ]
buckket/twtxt
python
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/models.py#L75-L79
[ "def", "relative_datetime", "(", "self", ")", ":", "now", "=", "datetime", ".", "now", "(", "timezone", ".", "utc", ")", "tense", "=", "\"from now\"", "if", "self", ".", "created_at", ">", "now", "else", "\"ago\"", "return", "\"{0} {1}\"", ".", "format", ...
6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851
valid
save
Parse the options, set defaults and then fire up PhantomJS.
heimdall/heimdall.py
def save(url, *args, **kwargs): """ Parse the options, set defaults and then fire up PhantomJS. """ device = heimdallDevice(kwargs.get('device', None)) kwargs['width'] = kwargs.get('width', None) or device.width kwargs['height'] = kwargs.get('height', None) or device.height kwargs['user_agent'] = ...
def save(url, *args, **kwargs): """ Parse the options, set defaults and then fire up PhantomJS. """ device = heimdallDevice(kwargs.get('device', None)) kwargs['width'] = kwargs.get('width', None) or device.width kwargs['height'] = kwargs.get('height', None) or device.height kwargs['user_agent'] = ...
[ "Parse", "the", "options", "set", "defaults", "and", "then", "fire", "up", "PhantomJS", "." ]
DistilledLtd/heimdall
python
https://github.com/DistilledLtd/heimdall/blob/7568c915a2e5bce759750d5456b39ea3498a6683/heimdall/heimdall.py#L13-L28
[ "def", "save", "(", "url", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "device", "=", "heimdallDevice", "(", "kwargs", ".", "get", "(", "'device'", ",", "None", ")", ")", "kwargs", "[", "'width'", "]", "=", "kwargs", ".", "get", "(", "'w...
7568c915a2e5bce759750d5456b39ea3498a6683
valid
screenshot
Call PhantomJS with the specified flags and options.
heimdall/heimdall.py
def screenshot(url, *args, **kwargs): """ Call PhantomJS with the specified flags and options. """ phantomscript = os.path.join(os.path.dirname(__file__), 'take_screenshot.js') directory = kwargs.get('save_dir', '/tmp') image_name = kwargs.get('image_name', None) or _i...
def screenshot(url, *args, **kwargs): """ Call PhantomJS with the specified flags and options. """ phantomscript = os.path.join(os.path.dirname(__file__), 'take_screenshot.js') directory = kwargs.get('save_dir', '/tmp') image_name = kwargs.get('image_name', None) or _i...
[ "Call", "PhantomJS", "with", "the", "specified", "flags", "and", "options", "." ]
DistilledLtd/heimdall
python
https://github.com/DistilledLtd/heimdall/blob/7568c915a2e5bce759750d5456b39ea3498a6683/heimdall/heimdall.py#L46-L88
[ "def", "screenshot", "(", "url", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "phantomscript", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'take_screenshot.js'", ")", "directory", "...
7568c915a2e5bce759750d5456b39ea3498a6683
valid
_image_name_from_url
Create a nice image name from the url.
heimdall/heimdall.py
def _image_name_from_url(url): """ Create a nice image name from the url. """ find = r'https?://|[^\w]' replace = '_' return re.sub(find, replace, url).strip('_')
def _image_name_from_url(url): """ Create a nice image name from the url. """ find = r'https?://|[^\w]' replace = '_' return re.sub(find, replace, url).strip('_')
[ "Create", "a", "nice", "image", "name", "from", "the", "url", "." ]
DistilledLtd/heimdall
python
https://github.com/DistilledLtd/heimdall/blob/7568c915a2e5bce759750d5456b39ea3498a6683/heimdall/heimdall.py#L91-L96
[ "def", "_image_name_from_url", "(", "url", ")", ":", "find", "=", "r'https?://|[^\\w]'", "replace", "=", "'_'", "return", "re", ".", "sub", "(", "find", ",", "replace", ",", "url", ")", ".", "strip", "(", "'_'", ")" ]
7568c915a2e5bce759750d5456b39ea3498a6683
valid
worker
Decorator. Abortable worker. If wrapped task will be cancelled by dispatcher, decorator will send ftp codes of successful interrupt. :: >>> @worker ... async def worker(self, connection, rest): ... ...
aioftp/server.py
def worker(f): """ Decorator. Abortable worker. If wrapped task will be cancelled by dispatcher, decorator will send ftp codes of successful interrupt. :: >>> @worker ... async def worker(self, connection, rest): ... ... """ @functools.wraps(f) async def wrappe...
def worker(f): """ Decorator. Abortable worker. If wrapped task will be cancelled by dispatcher, decorator will send ftp codes of successful interrupt. :: >>> @worker ... async def worker(self, connection, rest): ... ... """ @functools.wraps(f) async def wrappe...
[ "Decorator", ".", "Abortable", "worker", ".", "If", "wrapped", "task", "will", "be", "cancelled", "by", "dispatcher", "decorator", "will", "send", "ftp", "codes", "of", "successful", "interrupt", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/server.py#L697-L717
[ "def", "worker", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "async", "def", "wrapper", "(", "cls", ",", "connection", ",", "rest", ")", ":", "try", ":", "await", "f", "(", "cls", ",", "connection", ",", "rest", ")", "excep...
b45395b1aba41301b898040acade7010e6878a08
valid
User.get_permissions
Return nearest parent permission for `path`. :param path: path which permission you want to know :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :rtype: :py:class:`aioftp.Permission`
aioftp/server.py
def get_permissions(self, path): """ Return nearest parent permission for `path`. :param path: path which permission you want to know :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :rtype: :py:class:`aioftp.Permission` """ path = pathlib.PurePo...
def get_permissions(self, path): """ Return nearest parent permission for `path`. :param path: path which permission you want to know :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :rtype: :py:class:`aioftp.Permission` """ path = pathlib.PurePo...
[ "Return", "nearest", "parent", "permission", "for", "path", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/server.py#L145-L161
[ "def", "get_permissions", "(", "self", ",", "path", ")", ":", "path", "=", "pathlib", ".", "PurePosixPath", "(", "path", ")", "parents", "=", "filter", "(", "lambda", "p", ":", "p", ".", "is_parent", "(", "path", ")", ",", "self", ".", "permissions", ...
b45395b1aba41301b898040acade7010e6878a08
valid
AvailableConnections.release
Release, incrementing the internal counter by one.
aioftp/server.py
def release(self): """ Release, incrementing the internal counter by one. """ if self.value is not None: self.value += 1 if self.value > self.maximum_value: raise ValueError("Too many releases")
def release(self): """ Release, incrementing the internal counter by one. """ if self.value is not None: self.value += 1 if self.value > self.maximum_value: raise ValueError("Too many releases")
[ "Release", "incrementing", "the", "internal", "counter", "by", "one", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/server.py#L379-L386
[ "def", "release", "(", "self", ")", ":", "if", "self", ".", "value", "is", "not", "None", ":", "self", ".", "value", "+=", "1", "if", "self", ".", "value", ">", "self", ".", "maximum_value", ":", "raise", "ValueError", "(", "\"Too many releases\"", ")"...
b45395b1aba41301b898040acade7010e6878a08
valid
AbstractServer.start
:py:func:`asyncio.coroutine` Start server. :param host: ip address to bind for listening. :type host: :py:class:`str` :param port: port number to bind for listening. :type port: :py:class:`int` :param kwargs: keyword arguments, they passed to :py:func:`asy...
aioftp/server.py
async def start(self, host=None, port=0, **kwargs): """ :py:func:`asyncio.coroutine` Start server. :param host: ip address to bind for listening. :type host: :py:class:`str` :param port: port number to bind for listening. :type port: :py:class:`int` :p...
async def start(self, host=None, port=0, **kwargs): """ :py:func:`asyncio.coroutine` Start server. :param host: ip address to bind for listening. :type host: :py:class:`str` :param port: port number to bind for listening. :type port: :py:class:`int` :p...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/server.py#L391-L424
[ "async", "def", "start", "(", "self", ",", "host", "=", "None", ",", "port", "=", "0", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_start_server_extra_arguments", "=", "kwargs", "self", ".", "connections", "=", "{", "}", "self", ".", "server_host"...
b45395b1aba41301b898040acade7010e6878a08
valid
AbstractServer.close
:py:func:`asyncio.coroutine` Shutdown the server and close all connections.
aioftp/server.py
async def close(self): """ :py:func:`asyncio.coroutine` Shutdown the server and close all connections. """ self.server.close() tasks = [self.server.wait_closed()] for connection in self.connections.values(): connection._dispatcher.cancel() ...
async def close(self): """ :py:func:`asyncio.coroutine` Shutdown the server and close all connections. """ self.server.close() tasks = [self.server.wait_closed()] for connection in self.connections.values(): connection._dispatcher.cancel() ...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/server.py#L433-L445
[ "async", "def", "close", "(", "self", ")", ":", "self", ".", "server", ".", "close", "(", ")", "tasks", "=", "[", "self", ".", "server", ".", "wait_closed", "(", ")", "]", "for", "connection", "in", "self", ".", "connections", ".", "values", "(", "...
b45395b1aba41301b898040acade7010e6878a08
valid
AbstractServer.write_response
:py:func:`asyncio.coroutine` Complex method for sending response. :param stream: command connection stream :type stream: :py:class:`aioftp.StreamIO` :param code: server response code :type code: :py:class:`str` :param lines: line or lines, which are response informati...
aioftp/server.py
async def write_response(self, stream, code, lines="", list=False): """ :py:func:`asyncio.coroutine` Complex method for sending response. :param stream: command connection stream :type stream: :py:class:`aioftp.StreamIO` :param code: server response code :type ...
async def write_response(self, stream, code, lines="", list=False): """ :py:func:`asyncio.coroutine` Complex method for sending response. :param stream: command connection stream :type stream: :py:class:`aioftp.StreamIO` :param code: server response code :type ...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/server.py#L451-L482
[ "async", "def", "write_response", "(", "self", ",", "stream", ",", "code", ",", "lines", "=", "\"\"", ",", "list", "=", "False", ")", ":", "lines", "=", "wrap_with_container", "(", "lines", ")", "write", "=", "functools", ".", "partial", "(", "self", "...
b45395b1aba41301b898040acade7010e6878a08
valid
AbstractServer.parse_command
:py:func:`asyncio.coroutine` Complex method for getting command. :param stream: connection steram :type stream: :py:class:`asyncio.StreamIO` :return: (code, rest) :rtype: (:py:class:`str`, :py:class:`str`)
aioftp/server.py
async def parse_command(self, stream): """ :py:func:`asyncio.coroutine` Complex method for getting command. :param stream: connection steram :type stream: :py:class:`asyncio.StreamIO` :return: (code, rest) :rtype: (:py:class:`str`, :py:class:`str`) """ ...
async def parse_command(self, stream): """ :py:func:`asyncio.coroutine` Complex method for getting command. :param stream: connection steram :type stream: :py:class:`asyncio.StreamIO` :return: (code, rest) :rtype: (:py:class:`str`, :py:class:`str`) """ ...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/server.py#L484-L502
[ "async", "def", "parse_command", "(", "self", ",", "stream", ")", ":", "line", "=", "await", "stream", ".", "readline", "(", ")", "if", "not", "line", ":", "raise", "ConnectionResetError", "s", "=", "line", ".", "decode", "(", "encoding", "=", "self", ...
b45395b1aba41301b898040acade7010e6878a08
valid
AbstractServer.response_writer
:py:func:`asyncio.coroutine` Worker for write_response with current connection. Get data to response from queue, this is for right order of responses. Exits if received :py:class:`None`. :param stream: command connection stream :type connection: :py:class:`aioftp.StreamIO` ...
aioftp/server.py
async def response_writer(self, stream, response_queue): """ :py:func:`asyncio.coroutine` Worker for write_response with current connection. Get data to response from queue, this is for right order of responses. Exits if received :py:class:`None`. :param stream: command...
async def response_writer(self, stream, response_queue): """ :py:func:`asyncio.coroutine` Worker for write_response with current connection. Get data to response from queue, this is for right order of responses. Exits if received :py:class:`None`. :param stream: command...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/server.py#L504-L523
[ "async", "def", "response_writer", "(", "self", ",", "stream", ",", "response_queue", ")", ":", "while", "True", ":", "args", "=", "await", "response_queue", ".", "get", "(", ")", "try", ":", "await", "self", ".", "write_response", "(", "stream", ",", "*...
b45395b1aba41301b898040acade7010e6878a08
valid
Server.get_paths
Return *real* and *virtual* paths, resolves ".." with "up" action. *Real* path is path for path_io, when *virtual* deals with "user-view" and user requests :param connection: internal options for current connected user :type connection: :py:class:`dict` :param path: received pa...
aioftp/server.py
def get_paths(self, connection, path): """ Return *real* and *virtual* paths, resolves ".." with "up" action. *Real* path is path for path_io, when *virtual* deals with "user-view" and user requests :param connection: internal options for current connected user :type con...
def get_paths(self, connection, path): """ Return *real* and *virtual* paths, resolves ".." with "up" action. *Real* path is path for path_io, when *virtual* deals with "user-view" and user requests :param connection: internal options for current connected user :type con...
[ "Return", "*", "real", "*", "and", "*", "virtual", "*", "paths", "resolves", "..", "with", "up", "action", ".", "*", "Real", "*", "path", "is", "path", "for", "path_io", "when", "*", "virtual", "*", "deals", "with", "user", "-", "view", "and", "user"...
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/server.py#L938-L964
[ "def", "get_paths", "(", "self", ",", "connection", ",", "path", ")", ":", "virtual_path", "=", "pathlib", ".", "PurePosixPath", "(", "path", ")", "if", "not", "virtual_path", ".", "is_absolute", "(", ")", ":", "virtual_path", "=", "connection", ".", "curr...
b45395b1aba41301b898040acade7010e6878a08
valid
bytes2human
>>> bytes2human(10000) '9K' >>> bytes2human(100001221) '95M'
ftpbench.py
def bytes2human(n, format="%(value).1f%(symbol)s"): """ >>> bytes2human(10000) '9K' >>> bytes2human(100001221) '95M' """ symbols = ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y') prefix = {} for i, s in enumerate(symbols[1:]): prefix[s] = 1 << (i + 1) * 10 for symbol in rev...
def bytes2human(n, format="%(value).1f%(symbol)s"): """ >>> bytes2human(10000) '9K' >>> bytes2human(100001221) '95M' """ symbols = ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y') prefix = {} for i, s in enumerate(symbols[1:]): prefix[s] = 1 << (i + 1) * 10 for symbol in rev...
[ ">>>", "bytes2human", "(", "10000", ")", "9K", ">>>", "bytes2human", "(", "100001221", ")", "95M" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/ftpbench.py#L140-L155
[ "def", "bytes2human", "(", "n", ",", "format", "=", "\"%(value).1f%(symbol)s\"", ")", ":", "symbols", "=", "(", "'B'", ",", "'K'", ",", "'M'", ",", "'G'", ",", "'T'", ",", "'P'", ",", "'E'", ",", "'Z'", ",", "'Y'", ")", "prefix", "=", "{", "}", "...
b45395b1aba41301b898040acade7010e6878a08
valid
human2bytes
>>> human2bytes('1M') 1048576 >>> human2bytes('1G') 1073741824
ftpbench.py
def human2bytes(s): """ >>> human2bytes('1M') 1048576 >>> human2bytes('1G') 1073741824 """ symbols = ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y') letter = s[-1:].strip().upper() num = s[:-1] assert num.isdigit() and letter in symbols, s num = float(num) prefix = {symbols...
def human2bytes(s): """ >>> human2bytes('1M') 1048576 >>> human2bytes('1G') 1073741824 """ symbols = ('B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y') letter = s[-1:].strip().upper() num = s[:-1] assert num.isdigit() and letter in symbols, s num = float(num) prefix = {symbols...
[ ">>>", "human2bytes", "(", "1M", ")", "1048576", ">>>", "human2bytes", "(", "1G", ")", "1073741824" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/ftpbench.py#L159-L174
[ "def", "human2bytes", "(", "s", ")", ":", "symbols", "=", "(", "'B'", ",", "'K'", ",", "'M'", ",", "'G'", ",", "'T'", ",", "'P'", ",", "'E'", ",", "'Z'", ",", "'Y'", ")", "letter", "=", "s", "[", "-", "1", ":", "]", ".", "strip", "(", ")", ...
b45395b1aba41301b898040acade7010e6878a08
valid
register_memory
Register an approximation of memory used by FTP server process and all of its children.
ftpbench.py
def register_memory(): """Register an approximation of memory used by FTP server process and all of its children. """ # XXX How to get a reliable representation of memory being used is # not clear. (rss - shared) seems kind of ok but we might also use # the private working set via get_memory_map...
def register_memory(): """Register an approximation of memory used by FTP server process and all of its children. """ # XXX How to get a reliable representation of memory being used is # not clear. (rss - shared) seems kind of ok but we might also use # the private working set via get_memory_map...
[ "Register", "an", "approximation", "of", "memory", "used", "by", "FTP", "server", "process", "and", "all", "of", "its", "children", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/ftpbench.py#L177-L199
[ "def", "register_memory", "(", ")", ":", "# XXX How to get a reliable representation of memory being used is", "# not clear. (rss - shared) seems kind of ok but we might also use", "# the private working set via get_memory_maps().private*.", "def", "get_mem", "(", "proc", ")", ":", "if",...
b45395b1aba41301b898040acade7010e6878a08
valid
timethis
Utility function for making simple benchmarks (calculates time calls). It can be used either as a context manager or as a decorator.
ftpbench.py
def timethis(what): """"Utility function for making simple benchmarks (calculates time calls). It can be used either as a context manager or as a decorator. """ @contextlib.contextmanager def benchmark(): timer = time.clock if sys.platform == "win32" else time.time start = timer() ...
def timethis(what): """"Utility function for making simple benchmarks (calculates time calls). It can be used either as a context manager or as a decorator. """ @contextlib.contextmanager def benchmark(): timer = time.clock if sys.platform == "win32" else time.time start = timer() ...
[ "Utility", "function", "for", "making", "simple", "benchmarks", "(", "calculates", "time", "calls", ")", ".", "It", "can", "be", "used", "either", "as", "a", "context", "manager", "or", "as", "a", "decorator", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/ftpbench.py#L202-L221
[ "def", "timethis", "(", "what", ")", ":", "@", "contextlib", ".", "contextmanager", "def", "benchmark", "(", ")", ":", "timer", "=", "time", ".", "clock", "if", "sys", ".", "platform", "==", "\"win32\"", "else", "time", ".", "time", "start", "=", "time...
b45395b1aba41301b898040acade7010e6878a08
valid
connect
Connect to FTP server, login and return an ftplib.FTP instance.
ftpbench.py
def connect(): """Connect to FTP server, login and return an ftplib.FTP instance.""" ftp_class = ftplib.FTP if not SSL else ftplib.FTP_TLS ftp = ftp_class(timeout=TIMEOUT) ftp.connect(HOST, PORT) ftp.login(USER, PASSWORD) if SSL: ftp.prot_p() # secure data connection return ftp
def connect(): """Connect to FTP server, login and return an ftplib.FTP instance.""" ftp_class = ftplib.FTP if not SSL else ftplib.FTP_TLS ftp = ftp_class(timeout=TIMEOUT) ftp.connect(HOST, PORT) ftp.login(USER, PASSWORD) if SSL: ftp.prot_p() # secure data connection return ftp
[ "Connect", "to", "FTP", "server", "login", "and", "return", "an", "ftplib", ".", "FTP", "instance", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/ftpbench.py#L224-L232
[ "def", "connect", "(", ")", ":", "ftp_class", "=", "ftplib", ".", "FTP", "if", "not", "SSL", "else", "ftplib", ".", "FTP_TLS", "ftp", "=", "ftp_class", "(", "timeout", "=", "TIMEOUT", ")", "ftp", ".", "connect", "(", "HOST", ",", "PORT", ")", "ftp", ...
b45395b1aba41301b898040acade7010e6878a08
valid
retr
Same as ftplib's retrbinary() but discard the received data.
ftpbench.py
def retr(ftp): """Same as ftplib's retrbinary() but discard the received data.""" ftp.voidcmd('TYPE I') with contextlib.closing(ftp.transfercmd("RETR " + TESTFN)) as conn: recv_bytes = 0 while True: data = conn.recv(BUFFER_LEN) if not data: break ...
def retr(ftp): """Same as ftplib's retrbinary() but discard the received data.""" ftp.voidcmd('TYPE I') with contextlib.closing(ftp.transfercmd("RETR " + TESTFN)) as conn: recv_bytes = 0 while True: data = conn.recv(BUFFER_LEN) if not data: break ...
[ "Same", "as", "ftplib", "s", "retrbinary", "()", "but", "discard", "the", "received", "data", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/ftpbench.py#L235-L245
[ "def", "retr", "(", "ftp", ")", ":", "ftp", ".", "voidcmd", "(", "'TYPE I'", ")", "with", "contextlib", ".", "closing", "(", "ftp", ".", "transfercmd", "(", "\"RETR \"", "+", "TESTFN", ")", ")", "as", "conn", ":", "recv_bytes", "=", "0", "while", "Tr...
b45395b1aba41301b898040acade7010e6878a08
valid
stor
Same as ftplib's storbinary() but just sends dummy data instead of reading it from a real file.
ftpbench.py
def stor(ftp=None): """Same as ftplib's storbinary() but just sends dummy data instead of reading it from a real file. """ if ftp is None: ftp = connect() quit = True else: quit = False ftp.voidcmd('TYPE I') with contextlib.closing(ftp.transfercmd("STOR " + TESTFN)) a...
def stor(ftp=None): """Same as ftplib's storbinary() but just sends dummy data instead of reading it from a real file. """ if ftp is None: ftp = connect() quit = True else: quit = False ftp.voidcmd('TYPE I') with contextlib.closing(ftp.transfercmd("STOR " + TESTFN)) a...
[ "Same", "as", "ftplib", "s", "storbinary", "()", "but", "just", "sends", "dummy", "data", "instead", "of", "reading", "it", "from", "a", "real", "file", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/ftpbench.py#L248-L269
[ "def", "stor", "(", "ftp", "=", "None", ")", ":", "if", "ftp", "is", "None", ":", "ftp", "=", "connect", "(", ")", "quit", "=", "True", "else", ":", "quit", "=", "False", "ftp", ".", "voidcmd", "(", "'TYPE I'", ")", "with", "contextlib", ".", "cl...
b45395b1aba41301b898040acade7010e6878a08
valid
bytes_per_second
Return the number of bytes transmitted in 1 second.
ftpbench.py
def bytes_per_second(ftp, retr=True): """Return the number of bytes transmitted in 1 second.""" tot_bytes = 0 if retr: def request_file(): ftp.voidcmd('TYPE I') conn = ftp.transfercmd("retr " + TESTFN) return conn with contextlib.closing(request_file()) a...
def bytes_per_second(ftp, retr=True): """Return the number of bytes transmitted in 1 second.""" tot_bytes = 0 if retr: def request_file(): ftp.voidcmd('TYPE I') conn = ftp.transfercmd("retr " + TESTFN) return conn with contextlib.closing(request_file()) a...
[ "Return", "the", "number", "of", "bytes", "transmitted", "in", "1", "second", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/ftpbench.py#L272-L311
[ "def", "bytes_per_second", "(", "ftp", ",", "retr", "=", "True", ")", ":", "tot_bytes", "=", "0", "if", "retr", ":", "def", "request_file", "(", ")", ":", "ftp", ".", "voidcmd", "(", "'TYPE I'", ")", "conn", "=", "ftp", ".", "transfercmd", "(", "\"re...
b45395b1aba41301b898040acade7010e6878a08
valid
universal_exception
Decorator. Reraising any exception (except `CancelledError` and `NotImplementedError`) with universal exception :py:class:`aioftp.PathIOError`
aioftp/pathio.py
def universal_exception(coro): """ Decorator. Reraising any exception (except `CancelledError` and `NotImplementedError`) with universal exception :py:class:`aioftp.PathIOError` """ @functools.wraps(coro) async def wrapper(*args, **kwargs): try: return await coro(*args, *...
def universal_exception(coro): """ Decorator. Reraising any exception (except `CancelledError` and `NotImplementedError`) with universal exception :py:class:`aioftp.PathIOError` """ @functools.wraps(coro) async def wrapper(*args, **kwargs): try: return await coro(*args, *...
[ "Decorator", ".", "Reraising", "any", "exception", "(", "except", "CancelledError", "and", "NotImplementedError", ")", "with", "universal", "exception", ":", "py", ":", "class", ":", "aioftp", ".", "PathIOError" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/pathio.py#L71-L87
[ "def", "universal_exception", "(", "coro", ")", ":", "@", "functools", ".", "wraps", "(", "coro", ")", "async", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "await", "coro", "(", "*", "args", ",", "*"...
b45395b1aba41301b898040acade7010e6878a08
valid
defend_file_methods
Decorator. Raises exception when file methods called with wrapped by :py:class:`aioftp.AsyncPathIOContext` file object.
aioftp/pathio.py
def defend_file_methods(coro): """ Decorator. Raises exception when file methods called with wrapped by :py:class:`aioftp.AsyncPathIOContext` file object. """ @functools.wraps(coro) async def wrapper(self, file, *args, **kwargs): if isinstance(file, AsyncPathIOContext): raise...
def defend_file_methods(coro): """ Decorator. Raises exception when file methods called with wrapped by :py:class:`aioftp.AsyncPathIOContext` file object. """ @functools.wraps(coro) async def wrapper(self, file, *args, **kwargs): if isinstance(file, AsyncPathIOContext): raise...
[ "Decorator", ".", "Raises", "exception", "when", "file", "methods", "called", "with", "wrapped", "by", ":", "py", ":", "class", ":", "aioftp", ".", "AsyncPathIOContext", "file", "object", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/pathio.py#L103-L114
[ "def", "defend_file_methods", "(", "coro", ")", ":", "@", "functools", ".", "wraps", "(", "coro", ")", "async", "def", "wrapper", "(", "self", ",", "file", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "file", ",", "...
b45395b1aba41301b898040acade7010e6878a08
valid
async_enterable
Decorator. Bring coroutine result up, so it can be used as async context :: >>> async def foo(): ... ... ... ... return AsyncContextInstance(...) ... ... ctx = await foo() ... async with ctx: ... ... # do :: >>> @asy...
aioftp/common.py
def async_enterable(f): """ Decorator. Bring coroutine result up, so it can be used as async context :: >>> async def foo(): ... ... ... ... return AsyncContextInstance(...) ... ... ctx = await foo() ... async with ctx: ... .....
def async_enterable(f): """ Decorator. Bring coroutine result up, so it can be used as async context :: >>> async def foo(): ... ... ... ... return AsyncContextInstance(...) ... ... ctx = await foo() ... async with ctx: ... .....
[ "Decorator", ".", "Bring", "coroutine", "result", "up", "so", "it", "can", "be", "used", "as", "async", "context" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L179-L230
[ "def", "async_enterable", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "class", "AsyncEnterableInstance", ":", "async", "def", "__aenter__", "(", "self", ")", ...
b45395b1aba41301b898040acade7010e6878a08
valid
setlocale
Context manager with threading lock for set locale on enter, and set it back to original state on exit. :: >>> with setlocale("C"): ... ...
aioftp/common.py
def setlocale(name): """ Context manager with threading lock for set locale on enter, and set it back to original state on exit. :: >>> with setlocale("C"): ... ... """ with LOCALE_LOCK: old_locale = locale.setlocale(locale.LC_ALL) try: yield loc...
def setlocale(name): """ Context manager with threading lock for set locale on enter, and set it back to original state on exit. :: >>> with setlocale("C"): ... ... """ with LOCALE_LOCK: old_locale = locale.setlocale(locale.LC_ALL) try: yield loc...
[ "Context", "manager", "with", "threading", "lock", "for", "set", "locale", "on", "enter", "and", "set", "it", "back", "to", "original", "state", "on", "exit", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L561-L576
[ "def", "setlocale", "(", "name", ")", ":", "with", "LOCALE_LOCK", ":", "old_locale", "=", "locale", ".", "setlocale", "(", "locale", ".", "LC_ALL", ")", "try", ":", "yield", "locale", ".", "setlocale", "(", "locale", ".", "LC_ALL", ",", "name", ")", "f...
b45395b1aba41301b898040acade7010e6878a08
valid
Throttle.wait
:py:func:`asyncio.coroutine` Wait until can do IO
aioftp/common.py
async def wait(self): """ :py:func:`asyncio.coroutine` Wait until can do IO """ if self._limit is not None and self._limit > 0 and \ self._start is not None: now = _now() end = self._start + self._sum / self._limit await asynci...
async def wait(self): """ :py:func:`asyncio.coroutine` Wait until can do IO """ if self._limit is not None and self._limit > 0 and \ self._start is not None: now = _now() end = self._start + self._sum / self._limit await asynci...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L327-L337
[ "async", "def", "wait", "(", "self", ")", ":", "if", "self", ".", "_limit", "is", "not", "None", "and", "self", ".", "_limit", ">", "0", "and", "self", ".", "_start", "is", "not", "None", ":", "now", "=", "_now", "(", ")", "end", "=", "self", "...
b45395b1aba41301b898040acade7010e6878a08
valid
Throttle.append
Count `data` for throttle :param data: bytes of data for count :type data: :py:class:`bytes` :param start: start of read/write time from :py:meth:`asyncio.BaseEventLoop.time` :type start: :py:class:`float`
aioftp/common.py
def append(self, data, start): """ Count `data` for throttle :param data: bytes of data for count :type data: :py:class:`bytes` :param start: start of read/write time from :py:meth:`asyncio.BaseEventLoop.time` :type start: :py:class:`float` """ ...
def append(self, data, start): """ Count `data` for throttle :param data: bytes of data for count :type data: :py:class:`bytes` :param start: start of read/write time from :py:meth:`asyncio.BaseEventLoop.time` :type start: :py:class:`float` """ ...
[ "Count", "data", "for", "throttle" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L339-L356
[ "def", "append", "(", "self", ",", "data", ",", "start", ")", ":", "if", "self", ".", "_limit", "is", "not", "None", "and", "self", ".", "_limit", ">", "0", ":", "if", "self", ".", "_start", "is", "None", ":", "self", ".", "_start", "=", "start",...
b45395b1aba41301b898040acade7010e6878a08
valid
Throttle.limit
Set throttle limit :param value: bytes per second :type value: :py:class:`int` or :py:class:`None`
aioftp/common.py
def limit(self, value): """ Set throttle limit :param value: bytes per second :type value: :py:class:`int` or :py:class:`None` """ self._limit = value self._start = None self._sum = 0
def limit(self, value): """ Set throttle limit :param value: bytes per second :type value: :py:class:`int` or :py:class:`None` """ self._limit = value self._start = None self._sum = 0
[ "Set", "throttle", "limit" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L366-L375
[ "def", "limit", "(", "self", ",", "value", ")", ":", "self", ".", "_limit", "=", "value", "self", ".", "_start", "=", "None", "self", ".", "_sum", "=", "0" ]
b45395b1aba41301b898040acade7010e6878a08
valid
StreamThrottle.clone
Clone throttles without memory
aioftp/common.py
def clone(self): """ Clone throttles without memory """ return StreamThrottle( read=self.read.clone(), write=self.write.clone() )
def clone(self): """ Clone throttles without memory """ return StreamThrottle( read=self.read.clone(), write=self.write.clone() )
[ "Clone", "throttles", "without", "memory" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L398-L405
[ "def", "clone", "(", "self", ")", ":", "return", "StreamThrottle", "(", "read", "=", "self", ".", "read", ".", "clone", "(", ")", ",", "write", "=", "self", ".", "write", ".", "clone", "(", ")", ")" ]
b45395b1aba41301b898040acade7010e6878a08
valid
StreamThrottle.from_limits
Simple wrapper for creation :py:class:`aioftp.StreamThrottle` :param read_speed_limit: stream read speed limit in bytes or :py:class:`None` for unlimited :type read_speed_limit: :py:class:`int` or :py:class:`None` :param write_speed_limit: stream write speed limit in bytes or ...
aioftp/common.py
def from_limits(cls, read_speed_limit=None, write_speed_limit=None): """ Simple wrapper for creation :py:class:`aioftp.StreamThrottle` :param read_speed_limit: stream read speed limit in bytes or :py:class:`None` for unlimited :type read_speed_limit: :py:class:`int` or :py:c...
def from_limits(cls, read_speed_limit=None, write_speed_limit=None): """ Simple wrapper for creation :py:class:`aioftp.StreamThrottle` :param read_speed_limit: stream read speed limit in bytes or :py:class:`None` for unlimited :type read_speed_limit: :py:class:`int` or :py:c...
[ "Simple", "wrapper", "for", "creation", ":", "py", ":", "class", ":", "aioftp", ".", "StreamThrottle" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L408-L421
[ "def", "from_limits", "(", "cls", ",", "read_speed_limit", "=", "None", ",", "write_speed_limit", "=", "None", ")", ":", "return", "cls", "(", "read", "=", "Throttle", "(", "limit", "=", "read_speed_limit", ")", ",", "write", "=", "Throttle", "(", "limit",...
b45395b1aba41301b898040acade7010e6878a08
valid
ThrottleStreamIO.wait
:py:func:`asyncio.coroutine` Wait for all throttles :param name: name of throttle to acquire ("read" or "write") :type name: :py:class:`str`
aioftp/common.py
async def wait(self, name): """ :py:func:`asyncio.coroutine` Wait for all throttles :param name: name of throttle to acquire ("read" or "write") :type name: :py:class:`str` """ waiters = [] for throttle in self.throttles.values(): curr_thrott...
async def wait(self, name): """ :py:func:`asyncio.coroutine` Wait for all throttles :param name: name of throttle to acquire ("read" or "write") :type name: :py:class:`str` """ waiters = [] for throttle in self.throttles.values(): curr_thrott...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L455-L470
[ "async", "def", "wait", "(", "self", ",", "name", ")", ":", "waiters", "=", "[", "]", "for", "throttle", "in", "self", ".", "throttles", ".", "values", "(", ")", ":", "curr_throttle", "=", "getattr", "(", "throttle", ",", "name", ")", "if", "curr_thr...
b45395b1aba41301b898040acade7010e6878a08
valid
ThrottleStreamIO.append
Update timeout for all throttles :param name: name of throttle to append to ("read" or "write") :type name: :py:class:`str` :param data: bytes of data for count :type data: :py:class:`bytes` :param start: start of read/write time from :py:meth:`asyncio.BaseEventLoo...
aioftp/common.py
def append(self, name, data, start): """ Update timeout for all throttles :param name: name of throttle to append to ("read" or "write") :type name: :py:class:`str` :param data: bytes of data for count :type data: :py:class:`bytes` :param start: start of read/w...
def append(self, name, data, start): """ Update timeout for all throttles :param name: name of throttle to append to ("read" or "write") :type name: :py:class:`str` :param data: bytes of data for count :type data: :py:class:`bytes` :param start: start of read/w...
[ "Update", "timeout", "for", "all", "throttles" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L472-L487
[ "def", "append", "(", "self", ",", "name", ",", "data", ",", "start", ")", ":", "for", "throttle", "in", "self", ".", "throttles", ".", "values", "(", ")", ":", "getattr", "(", "throttle", ",", "name", ")", ".", "append", "(", "data", ",", "start",...
b45395b1aba41301b898040acade7010e6878a08
valid
ThrottleStreamIO.read
:py:func:`asyncio.coroutine` :py:meth:`aioftp.StreamIO.read` proxy
aioftp/common.py
async def read(self, count=-1): """ :py:func:`asyncio.coroutine` :py:meth:`aioftp.StreamIO.read` proxy """ await self.wait("read") start = _now() data = await super().read(count) self.append("read", data, start) return data
async def read(self, count=-1): """ :py:func:`asyncio.coroutine` :py:meth:`aioftp.StreamIO.read` proxy """ await self.wait("read") start = _now() data = await super().read(count) self.append("read", data, start) return data
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L489-L499
[ "async", "def", "read", "(", "self", ",", "count", "=", "-", "1", ")", ":", "await", "self", ".", "wait", "(", "\"read\"", ")", "start", "=", "_now", "(", ")", "data", "=", "await", "super", "(", ")", ".", "read", "(", "count", ")", "self", "."...
b45395b1aba41301b898040acade7010e6878a08
valid
ThrottleStreamIO.readline
:py:func:`asyncio.coroutine` :py:meth:`aioftp.StreamIO.readline` proxy
aioftp/common.py
async def readline(self): """ :py:func:`asyncio.coroutine` :py:meth:`aioftp.StreamIO.readline` proxy """ await self.wait("read") start = _now() data = await super().readline() self.append("read", data, start) return data
async def readline(self): """ :py:func:`asyncio.coroutine` :py:meth:`aioftp.StreamIO.readline` proxy """ await self.wait("read") start = _now() data = await super().readline() self.append("read", data, start) return data
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L501-L511
[ "async", "def", "readline", "(", "self", ")", ":", "await", "self", ".", "wait", "(", "\"read\"", ")", "start", "=", "_now", "(", ")", "data", "=", "await", "super", "(", ")", ".", "readline", "(", ")", "self", ".", "append", "(", "\"read\"", ",", ...
b45395b1aba41301b898040acade7010e6878a08
valid
ThrottleStreamIO.write
:py:func:`asyncio.coroutine` :py:meth:`aioftp.StreamIO.write` proxy
aioftp/common.py
async def write(self, data): """ :py:func:`asyncio.coroutine` :py:meth:`aioftp.StreamIO.write` proxy """ await self.wait("write") start = _now() await super().write(data) self.append("write", data, start)
async def write(self, data): """ :py:func:`asyncio.coroutine` :py:meth:`aioftp.StreamIO.write` proxy """ await self.wait("write") start = _now() await super().write(data) self.append("write", data, start)
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/common.py#L513-L522
[ "async", "def", "write", "(", "self", ",", "data", ")", ":", "await", "self", ".", "wait", "(", "\"write\"", ")", "start", "=", "_now", "(", ")", "await", "super", "(", ")", ".", "write", "(", "data", ")", "self", ".", "append", "(", "\"write\"", ...
b45395b1aba41301b898040acade7010e6878a08
valid
Code.matches
:param mask: Template for comparision. If mask symbol is not digit then it passes. :type mask: :py:class:`str` :: >>> Code("123").matches("1") True >>> Code("123").matches("1x3") True
aioftp/client.py
def matches(self, mask): """ :param mask: Template for comparision. If mask symbol is not digit then it passes. :type mask: :py:class:`str` :: >>> Code("123").matches("1") True >>> Code("123").matches("1x3") True """ ...
def matches(self, mask): """ :param mask: Template for comparision. If mask symbol is not digit then it passes. :type mask: :py:class:`str` :: >>> Code("123").matches("1") True >>> Code("123").matches("1x3") True """ ...
[ ":", "param", "mask", ":", "Template", "for", "comparision", ".", "If", "mask", "symbol", "is", "not", "digit", "then", "it", "passes", ".", ":", "type", "mask", ":", ":", "py", ":", "class", ":", "str" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L50-L63
[ "def", "matches", "(", "self", ",", "mask", ")", ":", "return", "all", "(", "map", "(", "lambda", "m", ",", "c", ":", "not", "m", ".", "isdigit", "(", ")", "or", "m", "==", "c", ",", "mask", ",", "self", ")", ")" ]
b45395b1aba41301b898040acade7010e6878a08
valid
DataConnectionThrottleStreamIO.finish
:py:func:`asyncio.coroutine` Close connection and wait for `expected_codes` response from server passing `wait_codes`. :param expected_codes: tuple of expected codes or expected code :type expected_codes: :py:class:`tuple` of :py:class:`str` or :py:class:`str` :par...
aioftp/client.py
async def finish(self, expected_codes="2xx", wait_codes="1xx"): """ :py:func:`asyncio.coroutine` Close connection and wait for `expected_codes` response from server passing `wait_codes`. :param expected_codes: tuple of expected codes or expected code :type expected_code...
async def finish(self, expected_codes="2xx", wait_codes="1xx"): """ :py:func:`asyncio.coroutine` Close connection and wait for `expected_codes` response from server passing `wait_codes`. :param expected_codes: tuple of expected codes or expected code :type expected_code...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L84-L100
[ "async", "def", "finish", "(", "self", ",", "expected_codes", "=", "\"2xx\"", ",", "wait_codes", "=", "\"1xx\"", ")", ":", "self", ".", "close", "(", ")", "await", "self", ".", "client", ".", "command", "(", "None", ",", "expected_codes", ",", "wait_code...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.parse_line
:py:func:`asyncio.coroutine` Parsing server response line. :return: (code, line) :rtype: (:py:class:`aioftp.Code`, :py:class:`str`) :raises ConnectionResetError: if received data is empty (this means, that connection is closed) :raises asyncio.TimeoutError: if ther...
aioftp/client.py
async def parse_line(self): """ :py:func:`asyncio.coroutine` Parsing server response line. :return: (code, line) :rtype: (:py:class:`aioftp.Code`, :py:class:`str`) :raises ConnectionResetError: if received data is empty (this means, that connection is close...
async def parse_line(self): """ :py:func:`asyncio.coroutine` Parsing server response line. :return: (code, line) :rtype: (:py:class:`aioftp.Code`, :py:class:`str`) :raises ConnectionResetError: if received data is empty (this means, that connection is close...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L151-L171
[ "async", "def", "parse_line", "(", "self", ")", ":", "line", "=", "await", "self", ".", "stream", ".", "readline", "(", ")", "if", "not", "line", ":", "self", ".", "stream", ".", "close", "(", ")", "raise", "ConnectionResetError", "s", "=", "line", "...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.parse_response
:py:func:`asyncio.coroutine` Parsing full server response (all lines). :return: (code, lines) :rtype: (:py:class:`aioftp.Code`, :py:class:`list` of :py:class:`str`) :raises aioftp.StatusCodeError: if received code does not matches all already received codes
aioftp/client.py
async def parse_response(self): """ :py:func:`asyncio.coroutine` Parsing full server response (all lines). :return: (code, lines) :rtype: (:py:class:`aioftp.Code`, :py:class:`list` of :py:class:`str`) :raises aioftp.StatusCodeError: if received code does not matches al...
async def parse_response(self): """ :py:func:`asyncio.coroutine` Parsing full server response (all lines). :return: (code, lines) :rtype: (:py:class:`aioftp.Code`, :py:class:`list` of :py:class:`str`) :raises aioftp.StatusCodeError: if received code does not matches al...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L173-L196
[ "async", "def", "parse_response", "(", "self", ")", ":", "code", ",", "rest", "=", "await", "self", ".", "parse_line", "(", ")", "info", "=", "[", "rest", "]", "curr_code", "=", "code", "while", "rest", ".", "startswith", "(", "\"-\"", ")", "or", "no...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.check_codes
Checks if any of expected matches received. :param expected_codes: tuple of expected codes :type expected_codes: :py:class:`tuple` :param received_code: received code for matching :type received_code: :py:class:`aioftp.Code` :param info: list of response lines from server ...
aioftp/client.py
def check_codes(self, expected_codes, received_code, info): """ Checks if any of expected matches received. :param expected_codes: tuple of expected codes :type expected_codes: :py:class:`tuple` :param received_code: received code for matching :type received_code: :py:c...
def check_codes(self, expected_codes, received_code, info): """ Checks if any of expected matches received. :param expected_codes: tuple of expected codes :type expected_codes: :py:class:`tuple` :param received_code: received code for matching :type received_code: :py:c...
[ "Checks", "if", "any", "of", "expected", "matches", "received", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L198-L215
[ "def", "check_codes", "(", "self", ",", "expected_codes", ",", "received_code", ",", "info", ")", ":", "if", "not", "any", "(", "map", "(", "received_code", ".", "matches", ",", "expected_codes", ")", ")", ":", "raise", "errors", ".", "StatusCodeError", "(...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.command
:py:func:`asyncio.coroutine` Basic command logic. 1. Send command if not omitted. 2. Yield response until no wait code matches. 3. Check code for expected. :param command: command line :type command: :py:class:`str` :param expected_codes: tuple of expected cod...
aioftp/client.py
async def command(self, command=None, expected_codes=(), wait_codes=()): """ :py:func:`asyncio.coroutine` Basic command logic. 1. Send command if not omitted. 2. Yield response until no wait code matches. 3. Check code for expected. :param command: command line...
async def command(self, command=None, expected_codes=(), wait_codes=()): """ :py:func:`asyncio.coroutine` Basic command logic. 1. Send command if not omitted. 2. Yield response until no wait code matches. 3. Check code for expected. :param command: command line...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L217-L250
[ "async", "def", "command", "(", "self", ",", "command", "=", "None", ",", "expected_codes", "=", "(", ")", ",", "wait_codes", "=", "(", ")", ")", ":", "expected_codes", "=", "wrap_with_container", "(", "expected_codes", ")", "wait_codes", "=", "wrap_with_con...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.parse_epsv_response
Parsing `EPSV` (`message (|||port|)`) response. :param s: response line :type s: :py:class:`str` :return: (ip, port) :rtype: (:py:class:`None`, :py:class:`int`)
aioftp/client.py
def parse_epsv_response(s): """ Parsing `EPSV` (`message (|||port|)`) response. :param s: response line :type s: :py:class:`str` :return: (ip, port) :rtype: (:py:class:`None`, :py:class:`int`) """ matches = tuple(re.finditer(r"\((.)\1\1\d+\1\)", s)) ...
def parse_epsv_response(s): """ Parsing `EPSV` (`message (|||port|)`) response. :param s: response line :type s: :py:class:`str` :return: (ip, port) :rtype: (:py:class:`None`, :py:class:`int`) """ matches = tuple(re.finditer(r"\((.)\1\1\d+\1\)", s)) ...
[ "Parsing", "EPSV", "(", "message", "(", "|||port|", ")", ")", "response", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L253-L266
[ "def", "parse_epsv_response", "(", "s", ")", ":", "matches", "=", "tuple", "(", "re", ".", "finditer", "(", "r\"\\((.)\\1\\1\\d+\\1\\)\"", ",", "s", ")", ")", "s", "=", "matches", "[", "-", "1", "]", ".", "group", "(", ")", "port", "=", "int", "(", ...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.parse_pasv_response
Parsing `PASV` server response. :param s: response line :type s: :py:class:`str` :return: (ip, port) :rtype: (:py:class:`str`, :py:class:`int`)
aioftp/client.py
def parse_pasv_response(s): """ Parsing `PASV` server response. :param s: response line :type s: :py:class:`str` :return: (ip, port) :rtype: (:py:class:`str`, :py:class:`int`) """ sub, *_ = re.findall(r"[^(]*\(([^)]*)", s) nums = tuple(map(int, s...
def parse_pasv_response(s): """ Parsing `PASV` server response. :param s: response line :type s: :py:class:`str` :return: (ip, port) :rtype: (:py:class:`str`, :py:class:`int`) """ sub, *_ = re.findall(r"[^(]*\(([^)]*)", s) nums = tuple(map(int, s...
[ "Parsing", "PASV", "server", "response", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L269-L283
[ "def", "parse_pasv_response", "(", "s", ")", ":", "sub", ",", "", "*", "_", "=", "re", ".", "findall", "(", "r\"[^(]*\\(([^)]*)\"", ",", "s", ")", "nums", "=", "tuple", "(", "map", "(", "int", ",", "sub", ".", "split", "(", "\",\"", ")", ")", ")"...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.parse_directory_response
Parsing directory server response. :param s: response line :type s: :py:class:`str` :rtype: :py:class:`pathlib.PurePosixPath`
aioftp/client.py
def parse_directory_response(s): """ Parsing directory server response. :param s: response line :type s: :py:class:`str` :rtype: :py:class:`pathlib.PurePosixPath` """ seq_quotes = 0 start = False directory = "" for ch in s: if...
def parse_directory_response(s): """ Parsing directory server response. :param s: response line :type s: :py:class:`str` :rtype: :py:class:`pathlib.PurePosixPath` """ seq_quotes = 0 start = False directory = "" for ch in s: if...
[ "Parsing", "directory", "server", "response", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L286-L312
[ "def", "parse_directory_response", "(", "s", ")", ":", "seq_quotes", "=", "0", "start", "=", "False", "directory", "=", "\"\"", "for", "ch", "in", "s", ":", "if", "not", "start", ":", "if", "ch", "==", "\"\\\"\"", ":", "start", "=", "True", "else", "...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.parse_unix_mode
Parsing unix mode strings ("rwxr-x--t") into hexacimal notation. :param s: mode string :type s: :py:class:`str` :return mode: :rtype: :py:class:`int`
aioftp/client.py
def parse_unix_mode(s): """ Parsing unix mode strings ("rwxr-x--t") into hexacimal notation. :param s: mode string :type s: :py:class:`str` :return mode: :rtype: :py:class:`int` """ parse_rw = {"rw": 6, "r-": 4, "-w": 2, "--": 0} mode = 0 ...
def parse_unix_mode(s): """ Parsing unix mode strings ("rwxr-x--t") into hexacimal notation. :param s: mode string :type s: :py:class:`str` :return mode: :rtype: :py:class:`int` """ parse_rw = {"rw": 6, "r-": 4, "-w": 2, "--": 0} mode = 0 ...
[ "Parsing", "unix", "mode", "strings", "(", "rwxr", "-", "x", "--", "t", ")", "into", "hexacimal", "notation", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L315-L351
[ "def", "parse_unix_mode", "(", "s", ")", ":", "parse_rw", "=", "{", "\"rw\"", ":", "6", ",", "\"r-\"", ":", "4", ",", "\"-w\"", ":", "2", ",", "\"--\"", ":", "0", "}", "mode", "=", "0", "mode", "|=", "parse_rw", "[", "s", "[", "0", ":", "2", ...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.parse_ls_date
Parsing dates from the ls unix utility. For example, "Nov 18 1958" and "Nov 18 12:29". :param s: ls date :type s: :py:class:`str` :rtype: :py:class:`str`
aioftp/client.py
def parse_ls_date(self, s, *, now=None): """ Parsing dates from the ls unix utility. For example, "Nov 18 1958" and "Nov 18 12:29". :param s: ls date :type s: :py:class:`str` :rtype: :py:class:`str` """ with setlocale("C"): try: ...
def parse_ls_date(self, s, *, now=None): """ Parsing dates from the ls unix utility. For example, "Nov 18 1958" and "Nov 18 12:29". :param s: ls date :type s: :py:class:`str` :rtype: :py:class:`str` """ with setlocale("C"): try: ...
[ "Parsing", "dates", "from", "the", "ls", "unix", "utility", ".", "For", "example", "Nov", "18", "1958", "and", "Nov", "18", "12", ":", "29", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L365-L388
[ "def", "parse_ls_date", "(", "self", ",", "s", ",", "*", ",", "now", "=", "None", ")", ":", "with", "setlocale", "(", "\"C\"", ")", ":", "try", ":", "if", "now", "is", "None", ":", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.parse_list_line_unix
Attempt to parse a LIST line (similar to unix ls utility). :param b: response line :type b: :py:class:`bytes` or :py:class:`str` :return: (path, info) :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`)
aioftp/client.py
def parse_list_line_unix(self, b): """ Attempt to parse a LIST line (similar to unix ls utility). :param b: response line :type b: :py:class:`bytes` or :py:class:`str` :return: (path, info) :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`) """ ...
def parse_list_line_unix(self, b): """ Attempt to parse a LIST line (similar to unix ls utility). :param b: response line :type b: :py:class:`bytes` or :py:class:`str` :return: (path, info) :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`) """ ...
[ "Attempt", "to", "parse", "a", "LIST", "line", "(", "similar", "to", "unix", "ls", "utility", ")", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L390-L443
[ "def", "parse_list_line_unix", "(", "self", ",", "b", ")", ":", "s", "=", "b", ".", "decode", "(", "encoding", "=", "self", ".", "encoding", ")", ".", "rstrip", "(", ")", "info", "=", "{", "}", "if", "s", "[", "0", "]", "==", "\"-\"", ":", "inf...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.parse_list_line_windows
Parsing Microsoft Windows `dir` output :param b: response line :type b: :py:class:`bytes` or :py:class:`str` :return: (path, info) :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`)
aioftp/client.py
def parse_list_line_windows(self, b): """ Parsing Microsoft Windows `dir` output :param b: response line :type b: :py:class:`bytes` or :py:class:`str` :return: (path, info) :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`) """ line = b.decode...
def parse_list_line_windows(self, b): """ Parsing Microsoft Windows `dir` output :param b: response line :type b: :py:class:`bytes` or :py:class:`str` :return: (path, info) :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`) """ line = b.decode...
[ "Parsing", "Microsoft", "Windows", "dir", "output" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L445-L479
[ "def", "parse_list_line_windows", "(", "self", ",", "b", ")", ":", "line", "=", "b", ".", "decode", "(", "encoding", "=", "self", ".", "encoding", ")", ".", "rstrip", "(", "\"\\r\\n\"", ")", "date_time_end", "=", "line", ".", "index", "(", "\"M\"", ")"...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.parse_list_line
Parse LIST response with both Microsoft Windows® parser and UNIX parser :param b: response line :type b: :py:class:`bytes` or :py:class:`str` :return: (path, info) :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`)
aioftp/client.py
def parse_list_line(self, b): """ Parse LIST response with both Microsoft Windows® parser and UNIX parser :param b: response line :type b: :py:class:`bytes` or :py:class:`str` :return: (path, info) :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`) ...
def parse_list_line(self, b): """ Parse LIST response with both Microsoft Windows® parser and UNIX parser :param b: response line :type b: :py:class:`bytes` or :py:class:`str` :return: (path, info) :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`) ...
[ "Parse", "LIST", "response", "with", "both", "Microsoft", "Windows®", "parser", "and", "UNIX", "parser" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L481-L499
[ "def", "parse_list_line", "(", "self", ",", "b", ")", ":", "ex", "=", "[", "]", "parsers", "=", "(", "self", ".", "parse_list_line_unix", ",", "self", ".", "parse_list_line_windows", ")", "for", "parser", "in", "parsers", ":", "try", ":", "return", "pars...
b45395b1aba41301b898040acade7010e6878a08
valid
BaseClient.parse_mlsx_line
Parsing MLS(T|D) response. :param b: response line :type b: :py:class:`bytes` or :py:class:`str` :return: (path, info) :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`)
aioftp/client.py
def parse_mlsx_line(self, b): """ Parsing MLS(T|D) response. :param b: response line :type b: :py:class:`bytes` or :py:class:`str` :return: (path, info) :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`) """ if isinstance(b, bytes): ...
def parse_mlsx_line(self, b): """ Parsing MLS(T|D) response. :param b: response line :type b: :py:class:`bytes` or :py:class:`str` :return: (path, info) :rtype: (:py:class:`pathlib.PurePosixPath`, :py:class:`dict`) """ if isinstance(b, bytes): ...
[ "Parsing", "MLS", "(", "T|D", ")", "response", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L501-L521
[ "def", "parse_mlsx_line", "(", "self", ",", "b", ")", ":", "if", "isinstance", "(", "b", ",", "bytes", ")", ":", "s", "=", "b", ".", "decode", "(", "encoding", "=", "self", ".", "encoding", ")", "else", ":", "s", "=", "b", "line", "=", "s", "."...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.connect
:py:func:`asyncio.coroutine` Connect to server. :param host: host name for connection :type host: :py:class:`str` :param port: port number for connection :type port: :py:class:`int`
aioftp/client.py
async def connect(self, host, port=DEFAULT_PORT): """ :py:func:`asyncio.coroutine` Connect to server. :param host: host name for connection :type host: :py:class:`str` :param port: port number for connection :type port: :py:class:`int` """ await...
async def connect(self, host, port=DEFAULT_PORT): """ :py:func:`asyncio.coroutine` Connect to server. :param host: host name for connection :type host: :py:class:`str` :param port: port number for connection :type port: :py:class:`int` """ await...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L562-L576
[ "async", "def", "connect", "(", "self", ",", "host", ",", "port", "=", "DEFAULT_PORT", ")", ":", "await", "super", "(", ")", ".", "connect", "(", "host", ",", "port", ")", "code", ",", "info", "=", "await", "self", ".", "command", "(", "None", ",",...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.login
:py:func:`asyncio.coroutine` Server authentication. :param user: username :type user: :py:class:`str` :param password: password :type password: :py:class:`str` :param account: account (almost always blank) :type account: :py:class:`str` :raises aioftp...
aioftp/client.py
async def login(self, user=DEFAULT_USER, password=DEFAULT_PASSWORD, account=DEFAULT_ACCOUNT): """ :py:func:`asyncio.coroutine` Server authentication. :param user: username :type user: :py:class:`str` :param password: password :type password:...
async def login(self, user=DEFAULT_USER, password=DEFAULT_PASSWORD, account=DEFAULT_ACCOUNT): """ :py:func:`asyncio.coroutine` Server authentication. :param user: username :type user: :py:class:`str` :param password: password :type password:...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L578-L604
[ "async", "def", "login", "(", "self", ",", "user", "=", "DEFAULT_USER", ",", "password", "=", "DEFAULT_PASSWORD", ",", "account", "=", "DEFAULT_ACCOUNT", ")", ":", "code", ",", "info", "=", "await", "self", ".", "command", "(", "\"USER \"", "+", "user", ...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.get_current_directory
:py:func:`asyncio.coroutine` Getting current working directory. :rtype: :py:class:`pathlib.PurePosixPath`
aioftp/client.py
async def get_current_directory(self): """ :py:func:`asyncio.coroutine` Getting current working directory. :rtype: :py:class:`pathlib.PurePosixPath` """ code, info = await self.command("PWD", "257") directory = self.parse_directory_response(info[-1]) ret...
async def get_current_directory(self): """ :py:func:`asyncio.coroutine` Getting current working directory. :rtype: :py:class:`pathlib.PurePosixPath` """ code, info = await self.command("PWD", "257") directory = self.parse_directory_response(info[-1]) ret...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L606-L616
[ "async", "def", "get_current_directory", "(", "self", ")", ":", "code", ",", "info", "=", "await", "self", ".", "command", "(", "\"PWD\"", ",", "\"257\"", ")", "directory", "=", "self", ".", "parse_directory_response", "(", "info", "[", "-", "1", "]", ")...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.change_directory
:py:func:`asyncio.coroutine` Change current directory. Goes «up» if no parameters passed. :param path: new directory, goes «up» if omitted :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath`
aioftp/client.py
async def change_directory(self, path=".."): """ :py:func:`asyncio.coroutine` Change current directory. Goes «up» if no parameters passed. :param path: new directory, goes «up» if omitted :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` """ path ...
async def change_directory(self, path=".."): """ :py:func:`asyncio.coroutine` Change current directory. Goes «up» if no parameters passed. :param path: new directory, goes «up» if omitted :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` """ path ...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L618-L632
[ "async", "def", "change_directory", "(", "self", ",", "path", "=", "\"..\"", ")", ":", "path", "=", "pathlib", ".", "PurePosixPath", "(", "path", ")", "if", "path", "==", "pathlib", ".", "PurePosixPath", "(", "\"..\"", ")", ":", "cmd", "=", "\"CDUP\"", ...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.make_directory
:py:func:`asyncio.coroutine` Make directory. :param path: path to directory to create :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param parents: create parents if does not exists :type parents: :py:class:`bool`
aioftp/client.py
async def make_directory(self, path, *, parents=True): """ :py:func:`asyncio.coroutine` Make directory. :param path: path to directory to create :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param parents: create parents if does not exists :...
async def make_directory(self, path, *, parents=True): """ :py:func:`asyncio.coroutine` Make directory. :param path: path to directory to create :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param parents: create parents if does not exists :...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L634-L655
[ "async", "def", "make_directory", "(", "self", ",", "path", ",", "*", ",", "parents", "=", "True", ")", ":", "path", "=", "pathlib", ".", "PurePosixPath", "(", "path", ")", "need_create", "=", "[", "]", "while", "path", ".", "name", "and", "not", "aw...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.list
:py:func:`asyncio.coroutine` List all files and directories in "path". :param path: directory or file path :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param recursive: list recursively :type recursive: :py:class:`bool` :param raw_command: optiona...
aioftp/client.py
def list(self, path="", *, recursive=False, raw_command=None): """ :py:func:`asyncio.coroutine` List all files and directories in "path". :param path: directory or file path :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param recursive: list recursi...
def list(self, path="", *, recursive=False, raw_command=None): """ :py:func:`asyncio.coroutine` List all files and directories in "path". :param path: directory or file path :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param recursive: list recursi...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L668-L751
[ "def", "list", "(", "self", ",", "path", "=", "\"\"", ",", "*", ",", "recursive", "=", "False", ",", "raw_command", "=", "None", ")", ":", "class", "AsyncLister", "(", "AsyncListerMixin", ")", ":", "stream", "=", "None", "async", "def", "_new_stream", ...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.stat
:py:func:`asyncio.coroutine` Getting path stats. :param path: path for getting info :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :return: path info :rtype: :py:class:`dict`
aioftp/client.py
async def stat(self, path): """ :py:func:`asyncio.coroutine` Getting path stats. :param path: path for getting info :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :return: path info :rtype: :py:class:`dict` """ path = pathlib.P...
async def stat(self, path): """ :py:func:`asyncio.coroutine` Getting path stats. :param path: path for getting info :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :return: path info :rtype: :py:class:`dict` """ path = pathlib.P...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L753-L782
[ "async", "def", "stat", "(", "self", ",", "path", ")", ":", "path", "=", "pathlib", ".", "PurePosixPath", "(", "path", ")", "try", ":", "code", ",", "info", "=", "await", "self", ".", "command", "(", "\"MLST \"", "+", "str", "(", "path", ")", ",", ...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.exists
:py:func:`asyncio.coroutine` Check path for existence. :param path: path to check :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :rtype: :py:class:`bool`
aioftp/client.py
async def exists(self, path): """ :py:func:`asyncio.coroutine` Check path for existence. :param path: path to check :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :rtype: :py:class:`bool` """ try: await self.stat(path) ...
async def exists(self, path): """ :py:func:`asyncio.coroutine` Check path for existence. :param path: path to check :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :rtype: :py:class:`bool` """ try: await self.stat(path) ...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L812-L829
[ "async", "def", "exists", "(", "self", ",", "path", ")", ":", "try", ":", "await", "self", ".", "stat", "(", "path", ")", "return", "True", "except", "errors", ".", "StatusCodeError", "as", "e", ":", "if", "e", ".", "received_codes", "[", "-", "1", ...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.rename
:py:func:`asyncio.coroutine` Rename (move) file or directory. :param source: path to rename :type source: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param destination: path new name :type destination: :py:class:`str` or :py:class:`pathlib.PurePosixPath`
aioftp/client.py
async def rename(self, source, destination): """ :py:func:`asyncio.coroutine` Rename (move) file or directory. :param source: path to rename :type source: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param destination: path new name :type destination: ...
async def rename(self, source, destination): """ :py:func:`asyncio.coroutine` Rename (move) file or directory. :param source: path to rename :type source: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param destination: path new name :type destination: ...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L831-L844
[ "async", "def", "rename", "(", "self", ",", "source", ",", "destination", ")", ":", "await", "self", ".", "command", "(", "\"RNFR \"", "+", "str", "(", "source", ")", ",", "\"350\"", ")", "await", "self", ".", "command", "(", "\"RNTO \"", "+", "str", ...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.remove
:py:func:`asyncio.coroutine` High level remove method for removing path recursively (file or directory). :param path: path to remove :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath`
aioftp/client.py
async def remove(self, path): """ :py:func:`asyncio.coroutine` High level remove method for removing path recursively (file or directory). :param path: path to remove :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` """ if await self.exis...
async def remove(self, path): """ :py:func:`asyncio.coroutine` High level remove method for removing path recursively (file or directory). :param path: path to remove :type path: :py:class:`str` or :py:class:`pathlib.PurePosixPath` """ if await self.exis...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L857-L875
[ "async", "def", "remove", "(", "self", ",", "path", ")", ":", "if", "await", "self", ".", "exists", "(", "path", ")", ":", "info", "=", "await", "self", ".", "stat", "(", "path", ")", "if", "info", "[", "\"type\"", "]", "==", "\"file\"", ":", "aw...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.upload_stream
Create stream for write data to `destination` file. :param destination: destination path of file on server side :type destination: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param offset: byte offset for stream start position :type offset: :py:class:`int` :rtype: :p...
aioftp/client.py
def upload_stream(self, destination, *, offset=0): """ Create stream for write data to `destination` file. :param destination: destination path of file on server side :type destination: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param offset: byte offset for stream s...
def upload_stream(self, destination, *, offset=0): """ Create stream for write data to `destination` file. :param destination: destination path of file on server side :type destination: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param offset: byte offset for stream s...
[ "Create", "stream", "for", "write", "data", "to", "destination", "file", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L877-L893
[ "def", "upload_stream", "(", "self", ",", "destination", ",", "*", ",", "offset", "=", "0", ")", ":", "return", "self", ".", "get_stream", "(", "\"STOR \"", "+", "str", "(", "destination", ")", ",", "\"1xx\"", ",", "offset", "=", "offset", ",", ")" ]
b45395b1aba41301b898040acade7010e6878a08
valid
Client.append_stream
Create stream for append (write) data to `destination` file. :param destination: destination path of file on server side :type destination: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param offset: byte offset for stream start position :type offset: :py:class:`int` :...
aioftp/client.py
def append_stream(self, destination, *, offset=0): """ Create stream for append (write) data to `destination` file. :param destination: destination path of file on server side :type destination: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param offset: byte offset for...
def append_stream(self, destination, *, offset=0): """ Create stream for append (write) data to `destination` file. :param destination: destination path of file on server side :type destination: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param offset: byte offset for...
[ "Create", "stream", "for", "append", "(", "write", ")", "data", "to", "destination", "file", "." ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L895-L911
[ "def", "append_stream", "(", "self", ",", "destination", ",", "*", ",", "offset", "=", "0", ")", ":", "return", "self", ".", "get_stream", "(", "\"APPE \"", "+", "str", "(", "destination", ")", ",", "\"1xx\"", ",", "offset", "=", "offset", ",", ")" ]
b45395b1aba41301b898040acade7010e6878a08
valid
Client.upload
:py:func:`asyncio.coroutine` High level upload method for uploading files and directories recursively from file system. :param source: source path of file or directory on client side :type source: :py:class:`str` or :py:class:`pathlib.Path` :param destination: destination path...
aioftp/client.py
async def upload(self, source, destination="", *, write_into=False, block_size=DEFAULT_BLOCK_SIZE): """ :py:func:`asyncio.coroutine` High level upload method for uploading files and directories recursively from file system. :param source: source path of fil...
async def upload(self, source, destination="", *, write_into=False, block_size=DEFAULT_BLOCK_SIZE): """ :py:func:`asyncio.coroutine` High level upload method for uploading files and directories recursively from file system. :param source: source path of fil...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L913-L964
[ "async", "def", "upload", "(", "self", ",", "source", ",", "destination", "=", "\"\"", ",", "*", ",", "write_into", "=", "False", ",", "block_size", "=", "DEFAULT_BLOCK_SIZE", ")", ":", "source", "=", "pathlib", ".", "Path", "(", "source", ")", "destinat...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.download_stream
:py:func:`asyncio.coroutine` Create stream for read data from `source` file. :param source: source path of file on server side :type source: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param offset: byte offset for stream start position :type offset: :py:class:`int` ...
aioftp/client.py
def download_stream(self, source, *, offset=0): """ :py:func:`asyncio.coroutine` Create stream for read data from `source` file. :param source: source path of file on server side :type source: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param offset: byte off...
def download_stream(self, source, *, offset=0): """ :py:func:`asyncio.coroutine` Create stream for read data from `source` file. :param source: source path of file on server side :type source: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param offset: byte off...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L966-L980
[ "def", "download_stream", "(", "self", ",", "source", ",", "*", ",", "offset", "=", "0", ")", ":", "return", "self", ".", "get_stream", "(", "\"RETR \"", "+", "str", "(", "source", ")", ",", "\"1xx\"", ",", "offset", "=", "offset", ")" ]
b45395b1aba41301b898040acade7010e6878a08
valid
Client.download
:py:func:`asyncio.coroutine` High level download method for downloading files and directories recursively and save them to the file system. :param source: source path of file or directory on server side :type source: :py:class:`str` or :py:class:`pathlib.PurePosixPath` :param ...
aioftp/client.py
async def download(self, source, destination="", *, write_into=False, block_size=DEFAULT_BLOCK_SIZE): """ :py:func:`asyncio.coroutine` High level download method for downloading files and directories recursively and save them to the file system. :param so...
async def download(self, source, destination="", *, write_into=False, block_size=DEFAULT_BLOCK_SIZE): """ :py:func:`asyncio.coroutine` High level download method for downloading files and directories recursively and save them to the file system. :param so...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L982-L1021
[ "async", "def", "download", "(", "self", ",", "source", ",", "destination", "=", "\"\"", ",", "*", ",", "write_into", "=", "False", ",", "block_size", "=", "DEFAULT_BLOCK_SIZE", ")", ":", "source", "=", "pathlib", ".", "PurePosixPath", "(", "source", ")", ...
b45395b1aba41301b898040acade7010e6878a08
valid
Client.get_passive_connection
:py:func:`asyncio.coroutine` Getting pair of reader, writer for passive connection with server. :param conn_type: connection type ("I", "A", "E", "L") :type conn_type: :py:class:`str` :param commands: sequence of commands to try to initiate passive server creation. First s...
aioftp/client.py
async def get_passive_connection(self, conn_type="I", commands=("epsv", "pasv")): """ :py:func:`asyncio.coroutine` Getting pair of reader, writer for passive connection with server. :param conn_type: connection type ("I", "A", "E", "L") :typ...
async def get_passive_connection(self, conn_type="I", commands=("epsv", "pasv")): """ :py:func:`asyncio.coroutine` Getting pair of reader, writer for passive connection with server. :param conn_type: connection type ("I", "A", "E", "L") :typ...
[ ":", "py", ":", "func", ":", "asyncio", ".", "coroutine" ]
aio-libs/aioftp
python
https://github.com/aio-libs/aioftp/blob/b45395b1aba41301b898040acade7010e6878a08/aioftp/client.py#L1042-L1085
[ "async", "def", "get_passive_connection", "(", "self", ",", "conn_type", "=", "\"I\"", ",", "commands", "=", "(", "\"epsv\"", ",", "\"pasv\"", ")", ")", ":", "functions", "=", "{", "\"epsv\"", ":", "self", ".", "_do_epsv", ",", "\"pasv\"", ":", "self", "...
b45395b1aba41301b898040acade7010e6878a08