id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
8,400
ianmiell/shutit
shutit_class.py
ShutIt.login
def login(self, command='su -', user=None, password=None, prompt_prefix=None, expect=None, timeout=shutit_global.shutit_global_object.default_timeout, escape=False, echo=None, note=None, go_home=True, ...
python
def login(self, command='su -', user=None, password=None, prompt_prefix=None, expect=None, timeout=shutit_global.shutit_global_object.default_timeout, escape=False, echo=None, note=None, go_home=True, ...
[ "def", "login", "(", "self", ",", "command", "=", "'su -'", ",", "user", "=", "None", ",", "password", "=", "None", ",", "prompt_prefix", "=", "None", ",", "expect", "=", "None", ",", "timeout", "=", "shutit_global", ".", "shutit_global_object", ".", "de...
Logs user in on default child.
[ "Logs", "user", "in", "on", "default", "child", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2105-L2138
8,401
ianmiell/shutit
shutit_class.py
ShutIt.logout_all
def logout_all(self, command='exit', note=None, echo=None, timeout=shutit_global.shutit_global_object.default_timeout, nonewline=False, loglevel=logging.DEBUG): """Logs the user out of all pexpect sessions within this Shut...
python
def logout_all(self, command='exit', note=None, echo=None, timeout=shutit_global.shutit_global_object.default_timeout, nonewline=False, loglevel=logging.DEBUG): """Logs the user out of all pexpect sessions within this Shut...
[ "def", "logout_all", "(", "self", ",", "command", "=", "'exit'", ",", "note", "=", "None", ",", "echo", "=", "None", ",", "timeout", "=", "shutit_global", ".", "shutit_global_object", ".", "default_timeout", ",", "nonewline", "=", "False", ",", "loglevel", ...
Logs the user out of all pexpect sessions within this ShutIt object. @param command: Command to run to log out (default=exit) @param note: See send()
[ "Logs", "the", "user", "out", "of", "all", "pexpect", "sessions", "within", "this", "ShutIt", "object", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2141-L2163
8,402
ianmiell/shutit
shutit_class.py
ShutIt.push_repository
def push_repository(self, repository, docker_executable='docker', shutit_pexpect_child=None, expect=None, note=None, loglevel=logging.INFO): """Pushes the repository. @param repository: ...
python
def push_repository(self, repository, docker_executable='docker', shutit_pexpect_child=None, expect=None, note=None, loglevel=logging.INFO): """Pushes the repository. @param repository: ...
[ "def", "push_repository", "(", "self", ",", "repository", ",", "docker_executable", "=", "'docker'", ",", "shutit_pexpect_child", "=", "None", ",", "expect", "=", "None", ",", "note", "=", "None", ",", "loglevel", "=", "logging", ".", "INFO", ")", ":", "sh...
Pushes the repository. @param repository: Repository to push. @param docker_executable: Defaults to 'docker' @param expect: See send() @param shutit_pexpect_child: See send() @type repository: string @type docker_executable: string
[ "Pushes", "the", "repository", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2301-L2337
8,403
ianmiell/shutit
shutit_class.py
ShutIt.get_emailer
def get_emailer(self, cfg_section): """Sends an email using the mailer """ shutit_global.shutit_global_object.yield_to_draw() import emailer return emailer.Emailer(cfg_section, self)
python
def get_emailer(self, cfg_section): """Sends an email using the mailer """ shutit_global.shutit_global_object.yield_to_draw() import emailer return emailer.Emailer(cfg_section, self)
[ "def", "get_emailer", "(", "self", ",", "cfg_section", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "import", "emailer", "return", "emailer", ".", "Emailer", "(", "cfg_section", ",", "self", ")" ]
Sends an email using the mailer
[ "Sends", "an", "email", "using", "the", "mailer" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2617-L2622
8,404
ianmiell/shutit
shutit_class.py
ShutIt.get_shutit_pexpect_session_id
def get_shutit_pexpect_session_id(self, shutit_pexpect_child): """Given a pexpect child object, return the shutit_pexpect_session_id object. """ shutit_global.shutit_global_object.yield_to_draw() if not isinstance(shutit_pexpect_child, pexpect.pty_spawn.spawn): self.fail('Wrong type in get_shutit_pexpect_ses...
python
def get_shutit_pexpect_session_id(self, shutit_pexpect_child): """Given a pexpect child object, return the shutit_pexpect_session_id object. """ shutit_global.shutit_global_object.yield_to_draw() if not isinstance(shutit_pexpect_child, pexpect.pty_spawn.spawn): self.fail('Wrong type in get_shutit_pexpect_ses...
[ "def", "get_shutit_pexpect_session_id", "(", "self", ",", "shutit_pexpect_child", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", "not", "isinstance", "(", "shutit_pexpect_child", ",", "pexpect", ".", "pty_spawn", ".", "...
Given a pexpect child object, return the shutit_pexpect_session_id object.
[ "Given", "a", "pexpect", "child", "object", "return", "the", "shutit_pexpect_session_id", "object", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2645-L2654
8,405
ianmiell/shutit
shutit_class.py
ShutIt.get_shutit_pexpect_session_from_id
def get_shutit_pexpect_session_from_id(self, shutit_pexpect_id): """Get the pexpect session from the given identifier. """ shutit_global.shutit_global_object.yield_to_draw() for key in self.shutit_pexpect_sessions: if self.shutit_pexpect_sessions[key].pexpect_session_id == shutit_pexpect_id: return self....
python
def get_shutit_pexpect_session_from_id(self, shutit_pexpect_id): """Get the pexpect session from the given identifier. """ shutit_global.shutit_global_object.yield_to_draw() for key in self.shutit_pexpect_sessions: if self.shutit_pexpect_sessions[key].pexpect_session_id == shutit_pexpect_id: return self....
[ "def", "get_shutit_pexpect_session_from_id", "(", "self", ",", "shutit_pexpect_id", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "for", "key", "in", "self", ".", "shutit_pexpect_sessions", ":", "if", "self", ".", "shutit_pe...
Get the pexpect session from the given identifier.
[ "Get", "the", "pexpect", "session", "from", "the", "given", "identifier", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2657-L2664
8,406
ianmiell/shutit
shutit_class.py
ShutIt.get_commands
def get_commands(self): """Gets command that have been run and have not been redacted. """ shutit_global.shutit_global_object.yield_to_draw() s = '' for c in self.build['shutit_command_history']: if isinstance(c, str): #Ignore commands with leading spaces if c and c[0] != ' ': s += c + '\n' ...
python
def get_commands(self): """Gets command that have been run and have not been redacted. """ shutit_global.shutit_global_object.yield_to_draw() s = '' for c in self.build['shutit_command_history']: if isinstance(c, str): #Ignore commands with leading spaces if c and c[0] != ' ': s += c + '\n' ...
[ "def", "get_commands", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "s", "=", "''", "for", "c", "in", "self", ".", "build", "[", "'shutit_command_history'", "]", ":", "if", "isinstance", "(", "c", ","...
Gets command that have been run and have not been redacted.
[ "Gets", "command", "that", "have", "been", "run", "and", "have", "not", "been", "redacted", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2722-L2732
8,407
ianmiell/shutit
shutit_class.py
ShutIt.build_report
def build_report(self, msg=''): """Resposible for constructing a report to be output as part of the build. Returns report as a string. """ shutit_global.shutit_global_object.yield_to_draw() s = '\n' s += '################################################################################\n' s += '# COMMAND H...
python
def build_report(self, msg=''): """Resposible for constructing a report to be output as part of the build. Returns report as a string. """ shutit_global.shutit_global_object.yield_to_draw() s = '\n' s += '################################################################################\n' s += '# COMMAND H...
[ "def", "build_report", "(", "self", ",", "msg", "=", "''", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "s", "=", "'\\n'", "s", "+=", "'################################################################################\\n'", "s",...
Resposible for constructing a report to be output as part of the build. Returns report as a string.
[ "Resposible", "for", "constructing", "a", "report", "to", "be", "output", "as", "part", "of", "the", "build", ".", "Returns", "report", "as", "a", "string", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2736-L2763
8,408
ianmiell/shutit
shutit_class.py
ShutIt.match_string
def match_string(self, string_to_match, regexp): """Get regular expression from the first of the lines passed in in string that matched. Handles first group of regexp as a return value. @param string_to_match: String to match on @param regexp: Regexp to check (per-line) against string @type string_to_matc...
python
def match_string(self, string_to_match, regexp): """Get regular expression from the first of the lines passed in in string that matched. Handles first group of regexp as a return value. @param string_to_match: String to match on @param regexp: Regexp to check (per-line) against string @type string_to_matc...
[ "def", "match_string", "(", "self", ",", "string_to_match", ",", "regexp", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", "not", "isinstance", "(", "string_to_match", ",", "str", ")", ":", "return", "None", "lines...
Get regular expression from the first of the lines passed in in string that matched. Handles first group of regexp as a return value. @param string_to_match: String to match on @param regexp: Regexp to check (per-line) against string @type string_to_match: string @type regexp: string Returns None if no...
[ "Get", "regular", "expression", "from", "the", "first", "of", "the", "lines", "passed", "in", "in", "string", "that", "matched", ".", "Handles", "first", "group", "of", "regexp", "as", "a", "return", "value", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2766-L2802
8,409
ianmiell/shutit
shutit_class.py
ShutIt.is_to_be_built_or_is_installed
def is_to_be_built_or_is_installed(self, shutit_module_obj): """Returns true if this module is configured to be built, or if it is already installed. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg if cfg[shutit_module_obj.module_id]['shutit.core.module.build']: return True return s...
python
def is_to_be_built_or_is_installed(self, shutit_module_obj): """Returns true if this module is configured to be built, or if it is already installed. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg if cfg[shutit_module_obj.module_id]['shutit.core.module.build']: return True return s...
[ "def", "is_to_be_built_or_is_installed", "(", "self", ",", "shutit_module_obj", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "if", "cfg", "[", "shutit_module_obj", ".", "module_id", "]", ...
Returns true if this module is configured to be built, or if it is already installed.
[ "Returns", "true", "if", "this", "module", "is", "configured", "to", "be", "built", "or", "if", "it", "is", "already", "installed", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2816-L2823
8,410
ianmiell/shutit
shutit_class.py
ShutIt.is_installed
def is_installed(self, shutit_module_obj): """Returns true if this module is installed. Uses cache where possible. """ shutit_global.shutit_global_object.yield_to_draw() # Cache first if shutit_module_obj.module_id in self.get_current_shutit_pexpect_session_environment().modules_installed: return True ...
python
def is_installed(self, shutit_module_obj): """Returns true if this module is installed. Uses cache where possible. """ shutit_global.shutit_global_object.yield_to_draw() # Cache first if shutit_module_obj.module_id in self.get_current_shutit_pexpect_session_environment().modules_installed: return True ...
[ "def", "is_installed", "(", "self", ",", "shutit_module_obj", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "# Cache first", "if", "shutit_module_obj", ".", "module_id", "in", "self", ".", "get_current_shutit_pexpect_session_env...
Returns true if this module is installed. Uses cache where possible.
[ "Returns", "true", "if", "this", "module", "is", "installed", ".", "Uses", "cache", "where", "possible", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2826-L2845
8,411
ianmiell/shutit
shutit_class.py
ShutIt.allowed_image
def allowed_image(self, module_id): """Given a module id, determine whether the image is allowed to be built. """ shutit_global.shutit_global_object.yield_to_draw() self.log("In allowed_image: " + module_id,level=logging.DEBUG) cfg = self.cfg if self.build['ignoreimage']: self.log("ignoreimage == true, r...
python
def allowed_image(self, module_id): """Given a module id, determine whether the image is allowed to be built. """ shutit_global.shutit_global_object.yield_to_draw() self.log("In allowed_image: " + module_id,level=logging.DEBUG) cfg = self.cfg if self.build['ignoreimage']: self.log("ignoreimage == true, r...
[ "def", "allowed_image", "(", "self", ",", "module_id", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "self", ".", "log", "(", "\"In allowed_image: \"", "+", "module_id", ",", "level", "=", "logging", ".", "DEBUG", ")",...
Given a module id, determine whether the image is allowed to be built.
[ "Given", "a", "module", "id", "determine", "whether", "the", "image", "is", "allowed", "to", "be", "built", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2861-L2878
8,412
ianmiell/shutit
shutit_class.py
ShutIt.print_modules
def print_modules(self): """Returns a string table representing the modules in the ShutIt module map. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg module_string = '' module_string += 'Modules: \n' module_string += ' Run order Build Remove Module ID\n' for module_id i...
python
def print_modules(self): """Returns a string table representing the modules in the ShutIt module map. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg module_string = '' module_string += 'Modules: \n' module_string += ' Run order Build Remove Module ID\n' for module_id i...
[ "def", "print_modules", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "module_string", "=", "''", "module_string", "+=", "'Modules: \\n'", "module_string", "+=", "' Run order...
Returns a string table representing the modules in the ShutIt module map.
[ "Returns", "a", "string", "table", "representing", "the", "modules", "in", "the", "ShutIt", "module", "map", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2881-L2893
8,413
ianmiell/shutit
shutit_class.py
ShutIt.load_shutit_modules
def load_shutit_modules(self): """Responsible for loading the shutit modules based on the configured module paths. """ shutit_global.shutit_global_object.yield_to_draw() if self.loglevel <= logging.DEBUG: self.log('ShutIt module paths now: ',level=logging.DEBUG) self.log(self.host['shutit_module_path'],...
python
def load_shutit_modules(self): """Responsible for loading the shutit modules based on the configured module paths. """ shutit_global.shutit_global_object.yield_to_draw() if self.loglevel <= logging.DEBUG: self.log('ShutIt module paths now: ',level=logging.DEBUG) self.log(self.host['shutit_module_path'],...
[ "def", "load_shutit_modules", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", "self", ".", "loglevel", "<=", "logging", ".", "DEBUG", ":", "self", ".", "log", "(", "'ShutIt module paths now: '", ",", "...
Responsible for loading the shutit modules based on the configured module paths.
[ "Responsible", "for", "loading", "the", "shutit", "modules", "based", "on", "the", "configured", "module", "paths", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2896-L2905
8,414
ianmiell/shutit
shutit_class.py
ShutIt.get_command
def get_command(self, command): """Helper function for osx - return gnu utils rather than default for eg head and md5sum where possible and needed. """ shutit_global.shutit_global_object.yield_to_draw() if command in ('md5sum','sed','head'): if self.get_current_shutit_pexpect_session_environment().distr...
python
def get_command(self, command): """Helper function for osx - return gnu utils rather than default for eg head and md5sum where possible and needed. """ shutit_global.shutit_global_object.yield_to_draw() if command in ('md5sum','sed','head'): if self.get_current_shutit_pexpect_session_environment().distr...
[ "def", "get_command", "(", "self", ",", "command", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", "command", "in", "(", "'md5sum'", ",", "'sed'", ",", "'head'", ")", ":", "if", "self", ".", "get_current_shutit_p...
Helper function for osx - return gnu utils rather than default for eg head and md5sum where possible and needed.
[ "Helper", "function", "for", "osx", "-", "return", "gnu", "utils", "rather", "than", "default", "for", "eg", "head", "and", "md5sum", "where", "possible", "and", "needed", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2908-L2916
8,415
ianmiell/shutit
shutit_class.py
ShutIt.get_send_command
def get_send_command(self, send): """Internal helper function to get command that's really sent """ shutit_global.shutit_global_object.yield_to_draw() if send is None: return send cmd_arr = send.split() if cmd_arr and cmd_arr[0] in ('md5sum','sed','head'): newcmd = self.get_command(cmd_arr[0]) send...
python
def get_send_command(self, send): """Internal helper function to get command that's really sent """ shutit_global.shutit_global_object.yield_to_draw() if send is None: return send cmd_arr = send.split() if cmd_arr and cmd_arr[0] in ('md5sum','sed','head'): newcmd = self.get_command(cmd_arr[0]) send...
[ "def", "get_send_command", "(", "self", ",", "send", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", "send", "is", "None", ":", "return", "send", "cmd_arr", "=", "send", ".", "split", "(", ")", "if", "cmd_arr",...
Internal helper function to get command that's really sent
[ "Internal", "helper", "function", "to", "get", "command", "that", "s", "really", "sent" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2919-L2929
8,416
ianmiell/shutit
shutit_class.py
ShutIt.load_configs
def load_configs(self): """Responsible for loading config files into ShutIt. Recurses down from configured shutit module paths. """ shutit_global.shutit_global_object.yield_to_draw() # Get root default config. # TODO: change default_cnf so it places whatever the values are at this stage of the build. conf...
python
def load_configs(self): """Responsible for loading config files into ShutIt. Recurses down from configured shutit module paths. """ shutit_global.shutit_global_object.yield_to_draw() # Get root default config. # TODO: change default_cnf so it places whatever the values are at this stage of the build. conf...
[ "def", "load_configs", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "# Get root default config.", "# TODO: change default_cnf so it places whatever the values are at this stage of the build.", "configs", "=", "[", "(", "'d...
Responsible for loading config files into ShutIt. Recurses down from configured shutit module paths.
[ "Responsible", "for", "loading", "config", "files", "into", "ShutIt", ".", "Recurses", "down", "from", "configured", "shutit", "module", "paths", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2932-L2974
8,417
ianmiell/shutit
shutit_class.py
ShutIt.config_collection
def config_collection(self): """Collect core config from config files for all seen modules. """ shutit_global.shutit_global_object.yield_to_draw() self.log('In config_collection',level=logging.DEBUG) cfg = self.cfg for module_id in self.module_ids(): # Default to None so we can interpret as ifneeded s...
python
def config_collection(self): """Collect core config from config files for all seen modules. """ shutit_global.shutit_global_object.yield_to_draw() self.log('In config_collection',level=logging.DEBUG) cfg = self.cfg for module_id in self.module_ids(): # Default to None so we can interpret as ifneeded s...
[ "def", "config_collection", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "self", ".", "log", "(", "'In config_collection'", ",", "level", "=", "logging", ".", "DEBUG", ")", "cfg", "=", "self", ".", "cfg...
Collect core config from config files for all seen modules.
[ "Collect", "core", "config", "from", "config", "files", "for", "all", "seen", "modules", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L3195-L3237
8,418
ianmiell/shutit
shutit_class.py
ShutIt.print_config
def print_config(self, cfg, hide_password=True, history=False, module_id=None): """Returns a string representing the config of this ShutIt run. """ shutit_global.shutit_global_object.yield_to_draw() cp = self.config_parser s = '' keys1 = list(cfg.keys()) if keys1: keys1.sort() for k in keys1: if m...
python
def print_config(self, cfg, hide_password=True, history=False, module_id=None): """Returns a string representing the config of this ShutIt run. """ shutit_global.shutit_global_object.yield_to_draw() cp = self.config_parser s = '' keys1 = list(cfg.keys()) if keys1: keys1.sort() for k in keys1: if m...
[ "def", "print_config", "(", "self", ",", "cfg", ",", "hide_password", "=", "True", ",", "history", "=", "False", ",", "module_id", "=", "None", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cp", "=", "self", ".", ...
Returns a string representing the config of this ShutIt run.
[ "Returns", "a", "string", "representing", "the", "config", "of", "this", "ShutIt", "run", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L3338-L3379
8,419
ianmiell/shutit
shutit_class.py
ShutIt.process_args
def process_args(self, args): """Process the args we have. 'args' is always a ShutItInit object. """ shutit_global.shutit_global_object.yield_to_draw() assert isinstance(args,ShutItInit), shutit_util.print_debug() if args.action == 'version': shutit_global.shutit_global_object.shutit_print('ShutIt version...
python
def process_args(self, args): """Process the args we have. 'args' is always a ShutItInit object. """ shutit_global.shutit_global_object.yield_to_draw() assert isinstance(args,ShutItInit), shutit_util.print_debug() if args.action == 'version': shutit_global.shutit_global_object.shutit_print('ShutIt version...
[ "def", "process_args", "(", "self", ",", "args", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "assert", "isinstance", "(", "args", ",", "ShutItInit", ")", ",", "shutit_util", ".", "print_debug", "(", ")", "if", "arg...
Process the args we have. 'args' is always a ShutItInit object.
[ "Process", "the", "args", "we", "have", ".", "args", "is", "always", "a", "ShutItInit", "object", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L3382-L3420
8,420
ianmiell/shutit
shutit_class.py
ShutIt.check_deps
def check_deps(self): """Dependency checking phase is performed in this method. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg self.log('PHASE: dependencies', level=logging.DEBUG) self.pause_point('\nNow checking for dependencies between modules', print_input=False, level=3) # Get m...
python
def check_deps(self): """Dependency checking phase is performed in this method. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg self.log('PHASE: dependencies', level=logging.DEBUG) self.pause_point('\nNow checking for dependencies between modules', print_input=False, level=3) # Get m...
[ "def", "check_deps", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "self", ".", "log", "(", "'PHASE: dependencies'", ",", "level", "=", "logging", ".", "DEBUG", ")", "se...
Dependency checking phase is performed in this method.
[ "Dependency", "checking", "phase", "is", "performed", "in", "this", "method", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4361-L4409
8,421
ianmiell/shutit
shutit_class.py
ShutIt.check_conflicts
def check_conflicts(self): """Checks for any conflicts between modules configured to be built. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg # Now consider conflicts self.log('PHASE: conflicts', level=logging.DEBUG) errs = [] self.pause_point('\nNow checking for conflicts between...
python
def check_conflicts(self): """Checks for any conflicts between modules configured to be built. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg # Now consider conflicts self.log('PHASE: conflicts', level=logging.DEBUG) errs = [] self.pause_point('\nNow checking for conflicts between...
[ "def", "check_conflicts", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "# Now consider conflicts", "self", ".", "log", "(", "'PHASE: conflicts'", ",", "level", "=", "logging"...
Checks for any conflicts between modules configured to be built.
[ "Checks", "for", "any", "conflicts", "between", "modules", "configured", "to", "be", "built", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4412-L4435
8,422
ianmiell/shutit
shutit_class.py
ShutIt.do_remove
def do_remove(self, loglevel=logging.DEBUG): """Remove modules by calling remove method on those configured for removal. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg # Now get the run_order keys in order and go. self.log('PHASE: remove', level=loglevel) self.pause_point('\nNow rem...
python
def do_remove(self, loglevel=logging.DEBUG): """Remove modules by calling remove method on those configured for removal. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg # Now get the run_order keys in order and go. self.log('PHASE: remove', level=loglevel) self.pause_point('\nNow rem...
[ "def", "do_remove", "(", "self", ",", "loglevel", "=", "logging", ".", "DEBUG", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "# Now get the run_order keys in order and go.", "self", ".", ...
Remove modules by calling remove method on those configured for removal.
[ "Remove", "modules", "by", "calling", "remove", "method", "on", "those", "configured", "for", "removal", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4466-L4493
8,423
ianmiell/shutit
shutit_class.py
ShutIt.do_build
def do_build(self): """Runs build phase, building any modules that we've determined need building. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg self.log('PHASE: build, repository work', level=logging.DEBUG) module_id_list = self.module_ids() if self.build['deps_only']: module...
python
def do_build(self): """Runs build phase, building any modules that we've determined need building. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg self.log('PHASE: build, repository work', level=logging.DEBUG) module_id_list = self.module_ids() if self.build['deps_only']: module...
[ "def", "do_build", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "self", ".", "log", "(", "'PHASE: build, repository work'", ",", "level", "=", "logging", ".", "DEBUG", ")...
Runs build phase, building any modules that we've determined need building.
[ "Runs", "build", "phase", "building", "any", "modules", "that", "we", "ve", "determined", "need", "building", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4535-L4569
8,424
ianmiell/shutit
shutit_class.py
ShutIt.stop_all
def stop_all(self, run_order=-1): """Runs stop method on all modules less than the passed-in run_order. Used when target is exporting itself mid-build, so we clean up state before committing run files etc. """ shutit_global.shutit_global_object.yield_to_draw() # sort them so they're stopped in reverse order...
python
def stop_all(self, run_order=-1): """Runs stop method on all modules less than the passed-in run_order. Used when target is exporting itself mid-build, so we clean up state before committing run files etc. """ shutit_global.shutit_global_object.yield_to_draw() # sort them so they're stopped in reverse order...
[ "def", "stop_all", "(", "self", ",", "run_order", "=", "-", "1", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "# sort them so they're stopped in reverse order", "for", "module_id", "in", "self", ".", "module_ids", "(", "r...
Runs stop method on all modules less than the passed-in run_order. Used when target is exporting itself mid-build, so we clean up state before committing run files etc.
[ "Runs", "stop", "method", "on", "all", "modules", "less", "than", "the", "passed", "-", "in", "run_order", ".", "Used", "when", "target", "is", "exporting", "itself", "mid", "-", "build", "so", "we", "clean", "up", "state", "before", "committing", "run", ...
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4615-L4627
8,425
ianmiell/shutit
shutit_class.py
ShutIt.start_all
def start_all(self, run_order=-1): """Runs start method on all modules less than the passed-in run_order. Used when target is exporting itself mid-build, so we can export a clean target and still depended-on modules running if necessary. """ shutit_global.shutit_global_object.yield_to_draw() # sort them so ...
python
def start_all(self, run_order=-1): """Runs start method on all modules less than the passed-in run_order. Used when target is exporting itself mid-build, so we can export a clean target and still depended-on modules running if necessary. """ shutit_global.shutit_global_object.yield_to_draw() # sort them so ...
[ "def", "start_all", "(", "self", ",", "run_order", "=", "-", "1", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "# sort them so they're started in order", "for", "module_id", "in", "self", ".", "module_ids", "(", ")", ":...
Runs start method on all modules less than the passed-in run_order. Used when target is exporting itself mid-build, so we can export a clean target and still depended-on modules running if necessary.
[ "Runs", "start", "method", "on", "all", "modules", "less", "than", "the", "passed", "-", "in", "run_order", ".", "Used", "when", "target", "is", "exporting", "itself", "mid", "-", "build", "so", "we", "can", "export", "a", "clean", "target", "and", "stil...
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4631-L4643
8,426
ianmiell/shutit
shutit_class.py
ShutIt.init_shutit_map
def init_shutit_map(self): """Initializes the module map of shutit based on the modules we have gathered. Checks we have core modules Checks for duplicate module details. Sets up common config. Sets up map of modules. """ shutit_global.shutit_global_object.yield_to_draw() modules = self.shutit_module...
python
def init_shutit_map(self): """Initializes the module map of shutit based on the modules we have gathered. Checks we have core modules Checks for duplicate module details. Sets up common config. Sets up map of modules. """ shutit_global.shutit_global_object.yield_to_draw() modules = self.shutit_module...
[ "def", "init_shutit_map", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "modules", "=", "self", ".", "shutit_modules", "# Have we got anything to process outside of special modules?", "if", "len", "(", "[", "mod", ...
Initializes the module map of shutit based on the modules we have gathered. Checks we have core modules Checks for duplicate module details. Sets up common config. Sets up map of modules.
[ "Initializes", "the", "module", "map", "of", "shutit", "based", "on", "the", "modules", "we", "have", "gathered", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4661-L4700
8,427
ianmiell/shutit
shutit_class.py
ShutIt.conn_target
def conn_target(self): """Connect to the target. """ shutit_global.shutit_global_object.yield_to_draw() conn_module = None for mod in self.conn_modules: if mod.module_id == self.build['conn_module']: conn_module = mod break if conn_module is None: self.fail('Couldn\'t find conn_module ' + self...
python
def conn_target(self): """Connect to the target. """ shutit_global.shutit_global_object.yield_to_draw() conn_module = None for mod in self.conn_modules: if mod.module_id == self.build['conn_module']: conn_module = mod break if conn_module is None: self.fail('Couldn\'t find conn_module ' + self...
[ "def", "conn_target", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "conn_module", "=", "None", "for", "mod", "in", "self", ".", "conn_modules", ":", "if", "mod", ".", "module_id", "==", "self", ".", "...
Connect to the target.
[ "Connect", "to", "the", "target", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4703-L4717
8,428
ianmiell/shutit
shutit_class.py
ShutIt.finalize_target
def finalize_target(self): """Finalize the target using the core finalize method. """ shutit_global.shutit_global_object.yield_to_draw() self.pause_point('\nFinalizing the target module (' + self.shutit_main_dir + '/shutit_setup.py)', print_input=False, level=3) # Can assume conn_module exists at this point ...
python
def finalize_target(self): """Finalize the target using the core finalize method. """ shutit_global.shutit_global_object.yield_to_draw() self.pause_point('\nFinalizing the target module (' + self.shutit_main_dir + '/shutit_setup.py)', print_input=False, level=3) # Can assume conn_module exists at this point ...
[ "def", "finalize_target", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "self", ".", "pause_point", "(", "'\\nFinalizing the target module ('", "+", "self", ".", "shutit_main_dir", "+", "'/shutit_setup.py)'", ",",...
Finalize the target using the core finalize method.
[ "Finalize", "the", "target", "using", "the", "core", "finalize", "method", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4720-L4730
8,429
ianmiell/shutit
shutit_class.py
ShutIt.resolve_dependencies
def resolve_dependencies(self, to_build, depender): """Add any required dependencies. """ shutit_global.shutit_global_object.yield_to_draw() self.log('In resolve_dependencies',level=logging.DEBUG) cfg = self.cfg for dependee_id in depender.depends_on: dependee = self.shutit_map.get(dependee_id) # Don'...
python
def resolve_dependencies(self, to_build, depender): """Add any required dependencies. """ shutit_global.shutit_global_object.yield_to_draw() self.log('In resolve_dependencies',level=logging.DEBUG) cfg = self.cfg for dependee_id in depender.depends_on: dependee = self.shutit_map.get(dependee_id) # Don'...
[ "def", "resolve_dependencies", "(", "self", ",", "to_build", ",", "depender", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "self", ".", "log", "(", "'In resolve_dependencies'", ",", "level", "=", "logging", ".", "DEBUG"...
Add any required dependencies.
[ "Add", "any", "required", "dependencies", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4735-L4748
8,430
ianmiell/shutit
shutit_class.py
ShutIt.check_dependee_exists
def check_dependee_exists(self, depender, dependee, dependee_id): """Checks whether a depended-on module is available. """ shutit_global.shutit_global_object.yield_to_draw() # If the module id isn't there, there's a problem. if dependee is None: return 'module: \n\n' + dependee_id + '\n\nnot found in paths...
python
def check_dependee_exists(self, depender, dependee, dependee_id): """Checks whether a depended-on module is available. """ shutit_global.shutit_global_object.yield_to_draw() # If the module id isn't there, there's a problem. if dependee is None: return 'module: \n\n' + dependee_id + '\n\nnot found in paths...
[ "def", "check_dependee_exists", "(", "self", ",", "depender", ",", "dependee", ",", "dependee_id", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "# If the module id isn't there, there's a problem.", "if", "dependee", "is", "None...
Checks whether a depended-on module is available.
[ "Checks", "whether", "a", "depended", "-", "on", "module", "is", "available", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4751-L4758
8,431
ianmiell/shutit
shutit_class.py
ShutIt.check_dependee_build
def check_dependee_build(self, depender, dependee, dependee_id): """Checks whether a depended on module is configured to be built. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg # If depender is installed or will be installed, so must the dependee if not (cfg[dependee.module_id]['shut...
python
def check_dependee_build(self, depender, dependee, dependee_id): """Checks whether a depended on module is configured to be built. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg # If depender is installed or will be installed, so must the dependee if not (cfg[dependee.module_id]['shut...
[ "def", "check_dependee_build", "(", "self", ",", "depender", ",", "dependee", ",", "dependee_id", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "# If depender is installed or will be installed, ...
Checks whether a depended on module is configured to be built.
[ "Checks", "whether", "a", "depended", "on", "module", "is", "configured", "to", "be", "built", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4761-L4770
8,432
ianmiell/shutit
shutit_class.py
ShutIt.destroy
def destroy(self): """Finish up a session. """ if self.session_type == 'bash': # TODO: does this work/handle already being logged out/logged in deep OK? self.logout() elif self.session_type == 'vagrant': # TODO: does this work/handle already being logged out/logged in deep OK? self.logout()
python
def destroy(self): """Finish up a session. """ if self.session_type == 'bash': # TODO: does this work/handle already being logged out/logged in deep OK? self.logout() elif self.session_type == 'vagrant': # TODO: does this work/handle already being logged out/logged in deep OK? self.logout()
[ "def", "destroy", "(", "self", ")", ":", "if", "self", ".", "session_type", "==", "'bash'", ":", "# TODO: does this work/handle already being logged out/logged in deep OK?", "self", ".", "logout", "(", ")", "elif", "self", ".", "session_type", "==", "'vagrant'", ":"...
Finish up a session.
[ "Finish", "up", "a", "session", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4858-L4866
8,433
ianmiell/shutit
shutit_module.py
shutit_method_scope
def shutit_method_scope(func): """Notifies the ShutIt object whenever we call a shutit module method. This allows setting values for the 'scope' of a function. """ def wrapper(self, shutit): """Wrapper to call a shutit module method, notifying the ShutIt object. """ ret = func(self, shutit) return ret retu...
python
def shutit_method_scope(func): """Notifies the ShutIt object whenever we call a shutit module method. This allows setting values for the 'scope' of a function. """ def wrapper(self, shutit): """Wrapper to call a shutit module method, notifying the ShutIt object. """ ret = func(self, shutit) return ret retu...
[ "def", "shutit_method_scope", "(", "func", ")", ":", "def", "wrapper", "(", "self", ",", "shutit", ")", ":", "\"\"\"Wrapper to call a shutit module method, notifying the ShutIt object.\n\t\t\"\"\"", "ret", "=", "func", "(", "self", ",", "shutit", ")", "return", "ret",...
Notifies the ShutIt object whenever we call a shutit module method. This allows setting values for the 'scope' of a function.
[ "Notifies", "the", "ShutIt", "object", "whenever", "we", "call", "a", "shutit", "module", "method", ".", "This", "allows", "setting", "values", "for", "the", "scope", "of", "a", "function", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_module.py#L53-L62
8,434
ianmiell/shutit
shutit_threads.py
managing_thread_main_simple
def managing_thread_main_simple(): """Simpler thread to track whether main thread has been quiet for long enough that a thread dump should be printed. """ import shutit_global last_msg = '' while True: printed_anything = False if shutit_global.shutit_global_object.log_trace_when_idle and time.time() - shutit_...
python
def managing_thread_main_simple(): """Simpler thread to track whether main thread has been quiet for long enough that a thread dump should be printed. """ import shutit_global last_msg = '' while True: printed_anything = False if shutit_global.shutit_global_object.log_trace_when_idle and time.time() - shutit_...
[ "def", "managing_thread_main_simple", "(", ")", ":", "import", "shutit_global", "last_msg", "=", "''", "while", "True", ":", "printed_anything", "=", "False", "if", "shutit_global", ".", "shutit_global_object", ".", "log_trace_when_idle", "and", "time", ".", "time",...
Simpler thread to track whether main thread has been quiet for long enough that a thread dump should be printed.
[ "Simpler", "thread", "to", "track", "whether", "main", "thread", "has", "been", "quiet", "for", "long", "enough", "that", "a", "thread", "dump", "should", "be", "printed", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_threads.py#L138-L172
8,435
ianmiell/shutit
package_map.py
map_package
def map_package(shutit_pexpect_session, package, install_type): """If package mapping exists, then return it, else return package. """ if package in PACKAGE_MAP.keys(): for itype in PACKAGE_MAP[package].keys(): if itype == install_type: ret = PACKAGE_MAP[package][install_type] if isinstance(ret,str): ...
python
def map_package(shutit_pexpect_session, package, install_type): """If package mapping exists, then return it, else return package. """ if package in PACKAGE_MAP.keys(): for itype in PACKAGE_MAP[package].keys(): if itype == install_type: ret = PACKAGE_MAP[package][install_type] if isinstance(ret,str): ...
[ "def", "map_package", "(", "shutit_pexpect_session", ",", "package", ",", "install_type", ")", ":", "if", "package", "in", "PACKAGE_MAP", ".", "keys", "(", ")", ":", "for", "itype", "in", "PACKAGE_MAP", "[", "package", "]", ".", "keys", "(", ")", ":", "i...
If package mapping exists, then return it, else return package.
[ "If", "package", "mapping", "exists", "then", "return", "it", "else", "return", "package", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/package_map.py#L135-L148
8,436
ianmiell/shutit
shutit_util.py
is_file_secure
def is_file_secure(file_name): """Returns false if file is considered insecure, true if secure. If file doesn't exist, it's considered secure! """ if not os.path.isfile(file_name): return True file_mode = os.stat(file_name).st_mode if file_mode & (stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH | stat...
python
def is_file_secure(file_name): """Returns false if file is considered insecure, true if secure. If file doesn't exist, it's considered secure! """ if not os.path.isfile(file_name): return True file_mode = os.stat(file_name).st_mode if file_mode & (stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH | stat...
[ "def", "is_file_secure", "(", "file_name", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "file_name", ")", ":", "return", "True", "file_mode", "=", "os", ".", "stat", "(", "file_name", ")", ".", "st_mode", "if", "file_mode", "&", "(", ...
Returns false if file is considered insecure, true if secure. If file doesn't exist, it's considered secure!
[ "Returns", "false", "if", "file", "is", "considered", "insecure", "true", "if", "secure", ".", "If", "file", "doesn", "t", "exist", "it", "s", "considered", "secure!" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_util.py#L57-L66
8,437
ianmiell/shutit
shutit_util.py
random_id
def random_id(size=8, chars=string.ascii_letters + string.digits): """Generates a random string of given size from the given chars. @param size: The size of the random string. @param chars: Constituent pool of characters to draw random characters from. @type size: number @type chars: string @rtype: str...
python
def random_id(size=8, chars=string.ascii_letters + string.digits): """Generates a random string of given size from the given chars. @param size: The size of the random string. @param chars: Constituent pool of characters to draw random characters from. @type size: number @type chars: string @rtype: str...
[ "def", "random_id", "(", "size", "=", "8", ",", "chars", "=", "string", ".", "ascii_letters", "+", "string", ".", "digits", ")", ":", "return", "''", ".", "join", "(", "random", ".", "choice", "(", "chars", ")", "for", "_", "in", "range", "(", "siz...
Generates a random string of given size from the given chars. @param size: The size of the random string. @param chars: Constituent pool of characters to draw random characters from. @type size: number @type chars: string @rtype: string @return: The string of random characters.
[ "Generates", "a", "random", "string", "of", "given", "size", "from", "the", "given", "chars", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_util.py#L82-L92
8,438
ianmiell/shutit
shutit_util.py
random_word
def random_word(size=6): """Returns a random word in lower case. """ words = shutit_assets.get_words().splitlines() word = '' while len(word) != size or "'" in word: word = words[int(random.random() * (len(words) - 1))] return word.lower()
python
def random_word(size=6): """Returns a random word in lower case. """ words = shutit_assets.get_words().splitlines() word = '' while len(word) != size or "'" in word: word = words[int(random.random() * (len(words) - 1))] return word.lower()
[ "def", "random_word", "(", "size", "=", "6", ")", ":", "words", "=", "shutit_assets", ".", "get_words", "(", ")", ".", "splitlines", "(", ")", "word", "=", "''", "while", "len", "(", "word", ")", "!=", "size", "or", "\"'\"", "in", "word", ":", "wor...
Returns a random word in lower case.
[ "Returns", "a", "random", "word", "in", "lower", "case", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_util.py#L95-L102
8,439
ianmiell/shutit
shutit_util.py
ctrl_c_signal_handler
def ctrl_c_signal_handler(_, frame): """CTRL-c signal handler - enters a pause point if it can. """ global ctrl_c_calls ctrl_c_calls += 1 if ctrl_c_calls > 10: shutit_global.shutit_global_object.handle_exit(exit_code=1) shutit_frame = get_shutit_frame(frame) if in_ctrlc: msg = 'CTRL-C hit twice, quitting' ...
python
def ctrl_c_signal_handler(_, frame): """CTRL-c signal handler - enters a pause point if it can. """ global ctrl_c_calls ctrl_c_calls += 1 if ctrl_c_calls > 10: shutit_global.shutit_global_object.handle_exit(exit_code=1) shutit_frame = get_shutit_frame(frame) if in_ctrlc: msg = 'CTRL-C hit twice, quitting' ...
[ "def", "ctrl_c_signal_handler", "(", "_", ",", "frame", ")", ":", "global", "ctrl_c_calls", "ctrl_c_calls", "+=", "1", "if", "ctrl_c_calls", ">", "10", ":", "shutit_global", ".", "shutit_global_object", ".", "handle_exit", "(", "exit_code", "=", "1", ")", "shu...
CTRL-c signal handler - enters a pause point if it can.
[ "CTRL", "-", "c", "signal", "handler", "-", "enters", "a", "pause", "point", "if", "it", "can", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_util.py#L145-L182
8,440
ianmiell/shutit
shutit_util.py
get_input
def get_input(msg, default='', valid=None, boolean=False, ispass=False, color=None): """Gets input from the user, and returns the answer. @param msg: message to send to user @param default: default value if nothing entered @param valid: valid input values (default == empty list == anything allowed) @p...
python
def get_input(msg, default='', valid=None, boolean=False, ispass=False, color=None): """Gets input from the user, and returns the answer. @param msg: message to send to user @param default: default value if nothing entered @param valid: valid input values (default == empty list == anything allowed) @p...
[ "def", "get_input", "(", "msg", ",", "default", "=", "''", ",", "valid", "=", "None", ",", "boolean", "=", "False", ",", "ispass", "=", "False", ",", "color", "=", "None", ")", ":", "# switch off log tracing when in get_input", "log_trace_when_idle_original_valu...
Gets input from the user, and returns the answer. @param msg: message to send to user @param default: default value if nothing entered @param valid: valid input values (default == empty list == anything allowed) @param boolean: whether return value should be boolean @param ispass: True if this is...
[ "Gets", "input", "from", "the", "user", "and", "returns", "the", "answer", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_util.py#L281-L322
8,441
ianmiell/shutit
shutit_setup.py
ConnDocker.build
def build(self, shutit): """Sets up the target ready for building. """ target_child = self.start_container(shutit, 'target_child') self.setup_host_child(shutit) # TODO: on the host child, check that the image running has bash as its cmd/entrypoint. self.setup_target_child(shutit, target_child) shutit.send...
python
def build(self, shutit): """Sets up the target ready for building. """ target_child = self.start_container(shutit, 'target_child') self.setup_host_child(shutit) # TODO: on the host child, check that the image running has bash as its cmd/entrypoint. self.setup_target_child(shutit, target_child) shutit.send...
[ "def", "build", "(", "self", ",", "shutit", ")", ":", "target_child", "=", "self", ".", "start_container", "(", "shutit", ",", "'target_child'", ")", "self", ".", "setup_host_child", "(", "shutit", ")", "# TODO: on the host child, check that the image running has bash...
Sets up the target ready for building.
[ "Sets", "up", "the", "target", "ready", "for", "building", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_setup.py#L82-L90
8,442
ianmiell/shutit
shutit_setup.py
ConnBash.build
def build(self, shutit): """Sets up the machine ready for building. """ shutit_pexpect_session = ShutItPexpectSession(shutit, 'target_child','/bin/bash') target_child = shutit_pexpect_session.pexpect_child shutit_pexpect_session.expect(shutit_global.shutit_global_object.base_prompt.strip(), timeout=10) self...
python
def build(self, shutit): """Sets up the machine ready for building. """ shutit_pexpect_session = ShutItPexpectSession(shutit, 'target_child','/bin/bash') target_child = shutit_pexpect_session.pexpect_child shutit_pexpect_session.expect(shutit_global.shutit_global_object.base_prompt.strip(), timeout=10) self...
[ "def", "build", "(", "self", ",", "shutit", ")", ":", "shutit_pexpect_session", "=", "ShutItPexpectSession", "(", "shutit", ",", "'target_child'", ",", "'/bin/bash'", ")", "target_child", "=", "shutit_pexpect_session", ".", "pexpect_child", "shutit_pexpect_session", "...
Sets up the machine ready for building.
[ "Sets", "up", "the", "machine", "ready", "for", "building", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_setup.py#L131-L139
8,443
ianmiell/shutit
shutit_setup.py
setup.build
def build(self, shutit): """Initializes target ready for build and updating package management if in container. """ if shutit.build['delivery'] in ('docker','dockerfile'): if shutit.get_current_shutit_pexpect_session_environment().install_type == 'apt': shutit.add_to_bashrc('export DEBIAN_FRONTEND=noninter...
python
def build(self, shutit): """Initializes target ready for build and updating package management if in container. """ if shutit.build['delivery'] in ('docker','dockerfile'): if shutit.get_current_shutit_pexpect_session_environment().install_type == 'apt': shutit.add_to_bashrc('export DEBIAN_FRONTEND=noninter...
[ "def", "build", "(", "self", ",", "shutit", ")", ":", "if", "shutit", ".", "build", "[", "'delivery'", "]", "in", "(", "'docker'", ",", "'dockerfile'", ")", ":", "if", "shutit", ".", "get_current_shutit_pexpect_session_environment", "(", ")", ".", "install_t...
Initializes target ready for build and updating package management if in container.
[ "Initializes", "target", "ready", "for", "build", "and", "updating", "package", "management", "if", "in", "container", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_setup.py#L170-L184
8,444
ianmiell/shutit
emailer.py
Emailer.__set_config
def __set_config(self, cfg_section): """Set a local config array up according to defaults and main shutit configuration cfg_section - see __init__ """ defaults = [ 'shutit.core.alerting.emailer.mailto', None, 'shutit.core.alerting.emailer.mailfrom', 'angry@shutit.tk', 'shutit.core.alerting.emailer.s...
python
def __set_config(self, cfg_section): """Set a local config array up according to defaults and main shutit configuration cfg_section - see __init__ """ defaults = [ 'shutit.core.alerting.emailer.mailto', None, 'shutit.core.alerting.emailer.mailfrom', 'angry@shutit.tk', 'shutit.core.alerting.emailer.s...
[ "def", "__set_config", "(", "self", ",", "cfg_section", ")", ":", "defaults", "=", "[", "'shutit.core.alerting.emailer.mailto'", ",", "None", ",", "'shutit.core.alerting.emailer.mailfrom'", ",", "'angry@shutit.tk'", ",", "'shutit.core.alerting.emailer.smtp_server'", ",", "'...
Set a local config array up according to defaults and main shutit configuration cfg_section - see __init__
[ "Set", "a", "local", "config", "array", "up", "according", "to", "defaults", "and", "main", "shutit", "configuration" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/emailer.py#L88-L125
8,445
ianmiell/shutit
emailer.py
Emailer.__get_smtp
def __get_smtp(self): """ Return the appropraite smtplib depending on wherther we're using TLS """ use_tls = self.config['shutit.core.alerting.emailer.use_tls'] if use_tls: smtp = SMTP(self.config['shutit.core.alerting.emailer.smtp_server'], self.config['shutit.core.alerting.emailer.smtp_port']) smtp.star...
python
def __get_smtp(self): """ Return the appropraite smtplib depending on wherther we're using TLS """ use_tls = self.config['shutit.core.alerting.emailer.use_tls'] if use_tls: smtp = SMTP(self.config['shutit.core.alerting.emailer.smtp_server'], self.config['shutit.core.alerting.emailer.smtp_port']) smtp.star...
[ "def", "__get_smtp", "(", "self", ")", ":", "use_tls", "=", "self", ".", "config", "[", "'shutit.core.alerting.emailer.use_tls'", "]", "if", "use_tls", ":", "smtp", "=", "SMTP", "(", "self", ".", "config", "[", "'shutit.core.alerting.emailer.smtp_server'", "]", ...
Return the appropraite smtplib depending on wherther we're using TLS
[ "Return", "the", "appropraite", "smtplib", "depending", "on", "wherther", "we", "re", "using", "TLS" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/emailer.py#L139-L148
8,446
ianmiell/shutit
emailer.py
Emailer.__compose
def __compose(self): """ Compose the message, pulling together body, attachments etc """ msg = MIMEMultipart() msg['Subject'] = self.config['shutit.core.alerting.emailer.subject'] msg['To'] = self.config['shutit.core.alerting.emailer.mailto'] msg['From'] = self.config['shutit.core.alerting.emailer....
python
def __compose(self): """ Compose the message, pulling together body, attachments etc """ msg = MIMEMultipart() msg['Subject'] = self.config['shutit.core.alerting.emailer.subject'] msg['To'] = self.config['shutit.core.alerting.emailer.mailto'] msg['From'] = self.config['shutit.core.alerting.emailer....
[ "def", "__compose", "(", "self", ")", ":", "msg", "=", "MIMEMultipart", "(", ")", "msg", "[", "'Subject'", "]", "=", "self", ".", "config", "[", "'shutit.core.alerting.emailer.subject'", "]", "msg", "[", "'To'", "]", "=", "self", ".", "config", "[", "'sh...
Compose the message, pulling together body, attachments etc
[ "Compose", "the", "message", "pulling", "together", "body", "attachments", "etc" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/emailer.py#L180-L198
8,447
ianmiell/shutit
emailer.py
Emailer.send
def send(self, attachment_failure=False): """Send the email according to the configured setup attachment_failure - used to indicate a recursive call after the smtp server has refused based on file size. Should not be used externally """ if not self.config['shutit.core.alerting.emailer.send_mail']:...
python
def send(self, attachment_failure=False): """Send the email according to the configured setup attachment_failure - used to indicate a recursive call after the smtp server has refused based on file size. Should not be used externally """ if not self.config['shutit.core.alerting.emailer.send_mail']:...
[ "def", "send", "(", "self", ",", "attachment_failure", "=", "False", ")", ":", "if", "not", "self", ".", "config", "[", "'shutit.core.alerting.emailer.send_mail'", "]", ":", "self", ".", "shutit", ".", "log", "(", "'emailer.send: Not configured to send mail!'", ",...
Send the email according to the configured setup attachment_failure - used to indicate a recursive call after the smtp server has refused based on file size. Should not be used externally
[ "Send", "the", "email", "according", "to", "the", "configured", "setup" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/emailer.py#L200-L236
8,448
ianmiell/shutit
shutit_global.py
setup_signals
def setup_signals(): """Set up the signal handlers. """ signal.signal(signal.SIGINT, shutit_util.ctrl_c_signal_handler) signal.signal(signal.SIGQUIT, shutit_util.ctrl_quit_signal_handler)
python
def setup_signals(): """Set up the signal handlers. """ signal.signal(signal.SIGINT, shutit_util.ctrl_c_signal_handler) signal.signal(signal.SIGQUIT, shutit_util.ctrl_quit_signal_handler)
[ "def", "setup_signals", "(", ")", ":", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "shutit_util", ".", "ctrl_c_signal_handler", ")", "signal", ".", "signal", "(", "signal", ".", "SIGQUIT", ",", "shutit_util", ".", "ctrl_quit_signal_handler", ")...
Set up the signal handlers.
[ "Set", "up", "the", "signal", "handlers", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_global.py#L583-L587
8,449
ianmiell/shutit
shutit_global.py
get_shutit_pexpect_sessions
def get_shutit_pexpect_sessions(): """Returns all the shutit_pexpect sessions in existence. """ sessions = [] for shutit_object in shutit_global_object.shutit_objects: for key in shutit_object.shutit_pexpect_sessions: sessions.append(shutit_object.shutit_pexpect_sessions[key]) return sessions
python
def get_shutit_pexpect_sessions(): """Returns all the shutit_pexpect sessions in existence. """ sessions = [] for shutit_object in shutit_global_object.shutit_objects: for key in shutit_object.shutit_pexpect_sessions: sessions.append(shutit_object.shutit_pexpect_sessions[key]) return sessions
[ "def", "get_shutit_pexpect_sessions", "(", ")", ":", "sessions", "=", "[", "]", "for", "shutit_object", "in", "shutit_global_object", ".", "shutit_objects", ":", "for", "key", "in", "shutit_object", ".", "shutit_pexpect_sessions", ":", "sessions", ".", "append", "...
Returns all the shutit_pexpect sessions in existence.
[ "Returns", "all", "the", "shutit_pexpect", "sessions", "in", "existence", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_global.py#L590-L597
8,450
ianmiell/shutit
shutit.py
main
def main(): """Main ShutIt function. Handles the configured actions: - skeleton - create skeleton module - list_configs - output computed configuration - depgraph - output digraph of module dependencies """ # Create base shutit object. shutit = shutit_global.shutit_global_object.shutit_objects[0] ...
python
def main(): """Main ShutIt function. Handles the configured actions: - skeleton - create skeleton module - list_configs - output computed configuration - depgraph - output digraph of module dependencies """ # Create base shutit object. shutit = shutit_global.shutit_global_object.shutit_objects[0] ...
[ "def", "main", "(", ")", ":", "# Create base shutit object.", "shutit", "=", "shutit_global", ".", "shutit_global_object", ".", "shutit_objects", "[", "0", "]", "if", "sys", ".", "version_info", "[", "0", "]", "==", "2", ":", "if", "sys", ".", "version_info"...
Main ShutIt function. Handles the configured actions: - skeleton - create skeleton module - list_configs - output computed configuration - depgraph - output digraph of module dependencies
[ "Main", "ShutIt", "function", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit.py#L133-L152
8,451
ianmiell/shutit
shutit_login_stack.py
ShutItLoginStackItem.has_blocking_background_send
def has_blocking_background_send(self): """Check whether any blocking background commands are waiting to run. If any are, return True. If none are, return False. """ for background_object in self.background_objects: # If it's running, or not started yet, it should block other tasks. if background_ob...
python
def has_blocking_background_send(self): """Check whether any blocking background commands are waiting to run. If any are, return True. If none are, return False. """ for background_object in self.background_objects: # If it's running, or not started yet, it should block other tasks. if background_ob...
[ "def", "has_blocking_background_send", "(", "self", ")", ":", "for", "background_object", "in", "self", ".", "background_objects", ":", "# If it's running, or not started yet, it should block other tasks.", "if", "background_object", ".", "block_other_commands", "and", "backgro...
Check whether any blocking background commands are waiting to run. If any are, return True. If none are, return False.
[ "Check", "whether", "any", "blocking", "background", "commands", "are", "waiting", "to", "run", ".", "If", "any", "are", "return", "True", ".", "If", "none", "are", "return", "False", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_login_stack.py#L85-L99
8,452
ianmiell/shutit
shutit_login_stack.py
ShutItLoginStackItem.check_background_commands_complete
def check_background_commands_complete(self): """Check whether any background commands are running or to be run. If none are, return True. If any are, return False. """ unstarted_command_exists = False self.shutit_obj.log('In check_background_commands_complete: all background objects: ' + str(self.background...
python
def check_background_commands_complete(self): """Check whether any background commands are running or to be run. If none are, return True. If any are, return False. """ unstarted_command_exists = False self.shutit_obj.log('In check_background_commands_complete: all background objects: ' + str(self.background...
[ "def", "check_background_commands_complete", "(", "self", ")", ":", "unstarted_command_exists", "=", "False", "self", ".", "shutit_obj", ".", "log", "(", "'In check_background_commands_complete: all background objects: '", "+", "str", "(", "self", ".", "background_objects",...
Check whether any background commands are running or to be run. If none are, return True. If any are, return False.
[ "Check", "whether", "any", "background", "commands", "are", "running", "or", "to", "be", "run", ".", "If", "none", "are", "return", "True", ".", "If", "any", "are", "return", "False", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_login_stack.py#L102-L149
8,453
konomae/lastpass-python
lastpass/vault.py
Vault.open_remote
def open_remote(cls, username, password, multifactor_password=None, client_id=None): """Fetches a blob from the server and creates a vault""" blob = cls.fetch_blob(username, password, multifactor_password, client_id) return cls.open(blob, username, password)
python
def open_remote(cls, username, password, multifactor_password=None, client_id=None): """Fetches a blob from the server and creates a vault""" blob = cls.fetch_blob(username, password, multifactor_password, client_id) return cls.open(blob, username, password)
[ "def", "open_remote", "(", "cls", ",", "username", ",", "password", ",", "multifactor_password", "=", "None", ",", "client_id", "=", "None", ")", ":", "blob", "=", "cls", ".", "fetch_blob", "(", "username", ",", "password", ",", "multifactor_password", ",", ...
Fetches a blob from the server and creates a vault
[ "Fetches", "a", "blob", "from", "the", "server", "and", "creates", "a", "vault" ]
5063911b789868a1fd9db9922db82cdf156b938a
https://github.com/konomae/lastpass-python/blob/5063911b789868a1fd9db9922db82cdf156b938a/lastpass/vault.py#L9-L12
8,454
konomae/lastpass-python
lastpass/vault.py
Vault.open
def open(cls, blob, username, password): """Creates a vault from a blob object""" return cls(blob, blob.encryption_key(username, password))
python
def open(cls, blob, username, password): """Creates a vault from a blob object""" return cls(blob, blob.encryption_key(username, password))
[ "def", "open", "(", "cls", ",", "blob", ",", "username", ",", "password", ")", ":", "return", "cls", "(", "blob", ",", "blob", ".", "encryption_key", "(", "username", ",", "password", ")", ")" ]
Creates a vault from a blob object
[ "Creates", "a", "vault", "from", "a", "blob", "object" ]
5063911b789868a1fd9db9922db82cdf156b938a
https://github.com/konomae/lastpass-python/blob/5063911b789868a1fd9db9922db82cdf156b938a/lastpass/vault.py#L21-L23
8,455
konomae/lastpass-python
lastpass/vault.py
Vault.fetch_blob
def fetch_blob(cls, username, password, multifactor_password=None, client_id=None): """Just fetches the blob, could be used to store it locally""" session = fetcher.login(username, password, multifactor_password, client_id) blob = fetcher.fetch(session) fetcher.logout(session) r...
python
def fetch_blob(cls, username, password, multifactor_password=None, client_id=None): """Just fetches the blob, could be used to store it locally""" session = fetcher.login(username, password, multifactor_password, client_id) blob = fetcher.fetch(session) fetcher.logout(session) r...
[ "def", "fetch_blob", "(", "cls", ",", "username", ",", "password", ",", "multifactor_password", "=", "None", ",", "client_id", "=", "None", ")", ":", "session", "=", "fetcher", ".", "login", "(", "username", ",", "password", ",", "multifactor_password", ",",...
Just fetches the blob, could be used to store it locally
[ "Just", "fetches", "the", "blob", "could", "be", "used", "to", "store", "it", "locally" ]
5063911b789868a1fd9db9922db82cdf156b938a
https://github.com/konomae/lastpass-python/blob/5063911b789868a1fd9db9922db82cdf156b938a/lastpass/vault.py#L26-L32
8,456
konomae/lastpass-python
lastpass/parser.py
extract_chunks
def extract_chunks(blob): """Splits the blob into chucks grouped by kind.""" chunks = [] stream = BytesIO(blob.bytes) current_pos = stream.tell() stream.seek(0, 2) length = stream.tell() stream.seek(current_pos, 0) while stream.tell() < length: chunks.append(read_chunk(stream)) ...
python
def extract_chunks(blob): """Splits the blob into chucks grouped by kind.""" chunks = [] stream = BytesIO(blob.bytes) current_pos = stream.tell() stream.seek(0, 2) length = stream.tell() stream.seek(current_pos, 0) while stream.tell() < length: chunks.append(read_chunk(stream)) ...
[ "def", "extract_chunks", "(", "blob", ")", ":", "chunks", "=", "[", "]", "stream", "=", "BytesIO", "(", "blob", ".", "bytes", ")", "current_pos", "=", "stream", ".", "tell", "(", ")", "stream", ".", "seek", "(", "0", ",", "2", ")", "length", "=", ...
Splits the blob into chucks grouped by kind.
[ "Splits", "the", "blob", "into", "chucks", "grouped", "by", "kind", "." ]
5063911b789868a1fd9db9922db82cdf156b938a
https://github.com/konomae/lastpass-python/blob/5063911b789868a1fd9db9922db82cdf156b938a/lastpass/parser.py#L26-L37
8,457
konomae/lastpass-python
lastpass/parser.py
parse_ACCT
def parse_ACCT(chunk, encryption_key): """ Parses an account chunk, decrypts and creates an Account object. May return nil when the chunk does not represent an account. All secure notes are ACCTs but not all of them strore account information. """ # TODO: Make a test case that covers secure ...
python
def parse_ACCT(chunk, encryption_key): """ Parses an account chunk, decrypts and creates an Account object. May return nil when the chunk does not represent an account. All secure notes are ACCTs but not all of them strore account information. """ # TODO: Make a test case that covers secure ...
[ "def", "parse_ACCT", "(", "chunk", ",", "encryption_key", ")", ":", "# TODO: Make a test case that covers secure note account", "io", "=", "BytesIO", "(", "chunk", ".", "payload", ")", "id", "=", "read_item", "(", "io", ")", "name", "=", "decode_aes256_plain_auto", ...
Parses an account chunk, decrypts and creates an Account object. May return nil when the chunk does not represent an account. All secure notes are ACCTs but not all of them strore account information.
[ "Parses", "an", "account", "chunk", "decrypts", "and", "creates", "an", "Account", "object", ".", "May", "return", "nil", "when", "the", "chunk", "does", "not", "represent", "an", "account", ".", "All", "secure", "notes", "are", "ACCTs", "but", "not", "all...
5063911b789868a1fd9db9922db82cdf156b938a
https://github.com/konomae/lastpass-python/blob/5063911b789868a1fd9db9922db82cdf156b938a/lastpass/parser.py#L40-L70
8,458
konomae/lastpass-python
lastpass/parser.py
parse_PRIK
def parse_PRIK(chunk, encryption_key): """Parse PRIK chunk which contains private RSA key""" decrypted = decode_aes256('cbc', encryption_key[:16], decode_hex(chunk.payload), encryption_key) hex_key = re.match(br'^Last...
python
def parse_PRIK(chunk, encryption_key): """Parse PRIK chunk which contains private RSA key""" decrypted = decode_aes256('cbc', encryption_key[:16], decode_hex(chunk.payload), encryption_key) hex_key = re.match(br'^Last...
[ "def", "parse_PRIK", "(", "chunk", ",", "encryption_key", ")", ":", "decrypted", "=", "decode_aes256", "(", "'cbc'", ",", "encryption_key", "[", ":", "16", "]", ",", "decode_hex", "(", "chunk", ".", "payload", ")", ",", "encryption_key", ")", "hex_key", "=...
Parse PRIK chunk which contains private RSA key
[ "Parse", "PRIK", "chunk", "which", "contains", "private", "RSA", "key" ]
5063911b789868a1fd9db9922db82cdf156b938a
https://github.com/konomae/lastpass-python/blob/5063911b789868a1fd9db9922db82cdf156b938a/lastpass/parser.py#L73-L87
8,459
konomae/lastpass-python
lastpass/parser.py
decode_aes256_cbc_base64
def decode_aes256_cbc_base64(data, encryption_key): """Decrypts base64 encoded AES-256 CBC bytes.""" if not data: return b'' else: # LastPass AES-256/CBC/base64 encryted string starts with an "!". # Next 24 bytes are the base64 encoded IV for the cipher. # Then comes the "|"....
python
def decode_aes256_cbc_base64(data, encryption_key): """Decrypts base64 encoded AES-256 CBC bytes.""" if not data: return b'' else: # LastPass AES-256/CBC/base64 encryted string starts with an "!". # Next 24 bytes are the base64 encoded IV for the cipher. # Then comes the "|"....
[ "def", "decode_aes256_cbc_base64", "(", "data", ",", "encryption_key", ")", ":", "if", "not", "data", ":", "return", "b''", "else", ":", "# LastPass AES-256/CBC/base64 encryted string starts with an \"!\".", "# Next 24 bytes are the base64 encoded IV for the cipher.", "# Then com...
Decrypts base64 encoded AES-256 CBC bytes.
[ "Decrypts", "base64", "encoded", "AES", "-", "256", "CBC", "bytes", "." ]
5063911b789868a1fd9db9922db82cdf156b938a
https://github.com/konomae/lastpass-python/blob/5063911b789868a1fd9db9922db82cdf156b938a/lastpass/parser.py#L253-L266
8,460
ehuggett/send-cli
sendclient/delete.py
api_delete
def api_delete(service, file_id, owner_token): """Delete a file already uploaded to Send""" service += 'api/delete/%s' % file_id r = requests.post(service, json={'owner_token': owner_token, 'delete_token': owner_token}) r.raise_for_status() if r.text == 'OK': return True return False
python
def api_delete(service, file_id, owner_token): """Delete a file already uploaded to Send""" service += 'api/delete/%s' % file_id r = requests.post(service, json={'owner_token': owner_token, 'delete_token': owner_token}) r.raise_for_status() if r.text == 'OK': return True return False
[ "def", "api_delete", "(", "service", ",", "file_id", ",", "owner_token", ")", ":", "service", "+=", "'api/delete/%s'", "%", "file_id", "r", "=", "requests", ".", "post", "(", "service", ",", "json", "=", "{", "'owner_token'", ":", "owner_token", ",", "'del...
Delete a file already uploaded to Send
[ "Delete", "a", "file", "already", "uploaded", "to", "Send" ]
7f9458299f42e3c558f00e77cf9d3aa9dd857457
https://github.com/ehuggett/send-cli/blob/7f9458299f42e3c558f00e77cf9d3aa9dd857457/sendclient/delete.py#L3-L11
8,461
ehuggett/send-cli
sendclient/params.py
api_params
def api_params(service, file_id, owner_token, download_limit): """Change the download limit for a file hosted on a Send Server""" service += 'api/params/%s' % file_id r = requests.post(service, json={'owner_token': owner_token, 'dlimit': download_limit}) r.raise_for_status() if r.text == 'OK': ...
python
def api_params(service, file_id, owner_token, download_limit): """Change the download limit for a file hosted on a Send Server""" service += 'api/params/%s' % file_id r = requests.post(service, json={'owner_token': owner_token, 'dlimit': download_limit}) r.raise_for_status() if r.text == 'OK': ...
[ "def", "api_params", "(", "service", ",", "file_id", ",", "owner_token", ",", "download_limit", ")", ":", "service", "+=", "'api/params/%s'", "%", "file_id", "r", "=", "requests", ".", "post", "(", "service", ",", "json", "=", "{", "'owner_token'", ":", "o...
Change the download limit for a file hosted on a Send Server
[ "Change", "the", "download", "limit", "for", "a", "file", "hosted", "on", "a", "Send", "Server" ]
7f9458299f42e3c558f00e77cf9d3aa9dd857457
https://github.com/ehuggett/send-cli/blob/7f9458299f42e3c558f00e77cf9d3aa9dd857457/sendclient/params.py#L3-L11
8,462
ehuggett/send-cli
sendclient/download.py
api_download
def api_download(service, fileId, authorisation): '''Given a Send url, download and return the encrypted data and metadata''' data = tempfile.SpooledTemporaryFile(max_size=SPOOL_SIZE, mode='w+b') headers = {'Authorization' : 'send-v1 ' + unpadded_urlsafe_b64encode(authorisation)} url = service + 'api/d...
python
def api_download(service, fileId, authorisation): '''Given a Send url, download and return the encrypted data and metadata''' data = tempfile.SpooledTemporaryFile(max_size=SPOOL_SIZE, mode='w+b') headers = {'Authorization' : 'send-v1 ' + unpadded_urlsafe_b64encode(authorisation)} url = service + 'api/d...
[ "def", "api_download", "(", "service", ",", "fileId", ",", "authorisation", ")", ":", "data", "=", "tempfile", ".", "SpooledTemporaryFile", "(", "max_size", "=", "SPOOL_SIZE", ",", "mode", "=", "'w+b'", ")", "headers", "=", "{", "'Authorization'", ":", "'sen...
Given a Send url, download and return the encrypted data and metadata
[ "Given", "a", "Send", "url", "download", "and", "return", "the", "encrypted", "data", "and", "metadata" ]
7f9458299f42e3c558f00e77cf9d3aa9dd857457
https://github.com/ehuggett/send-cli/blob/7f9458299f42e3c558f00e77cf9d3aa9dd857457/sendclient/download.py#L13-L31
8,463
ehuggett/send-cli
sendclient/download.py
decrypt_filedata
def decrypt_filedata(data, keys): '''Decrypts a file from Send''' # The last 16 bytes / 128 bits of data is the GCM tag # https://www.w3.org/TR/WebCryptoAPI/#aes-gcm-operations :- # 7. Let ciphertext be equal to C | T, where '|' denotes concatenation. data.seek(-16, 2) tag = data.read() # n...
python
def decrypt_filedata(data, keys): '''Decrypts a file from Send''' # The last 16 bytes / 128 bits of data is the GCM tag # https://www.w3.org/TR/WebCryptoAPI/#aes-gcm-operations :- # 7. Let ciphertext be equal to C | T, where '|' denotes concatenation. data.seek(-16, 2) tag = data.read() # n...
[ "def", "decrypt_filedata", "(", "data", ",", "keys", ")", ":", "# The last 16 bytes / 128 bits of data is the GCM tag", "# https://www.w3.org/TR/WebCryptoAPI/#aes-gcm-operations :-", "# 7. Let ciphertext be equal to C | T, where '|' denotes concatenation.", "data", ".", "seek", "(", "-...
Decrypts a file from Send
[ "Decrypts", "a", "file", "from", "Send" ]
7f9458299f42e3c558f00e77cf9d3aa9dd857457
https://github.com/ehuggett/send-cli/blob/7f9458299f42e3c558f00e77cf9d3aa9dd857457/sendclient/download.py#L33-L62
8,464
ehuggett/send-cli
sendclient/download.py
sign_nonce
def sign_nonce(key, nonce): ''' sign the server nonce from the WWW-Authenticate header with an authKey''' # HMAC.new(key, msg='', digestmod=None) return Cryptodome.Hash.HMAC.new(key, nonce, digestmod=Cryptodome.Hash.SHA256).digest()
python
def sign_nonce(key, nonce): ''' sign the server nonce from the WWW-Authenticate header with an authKey''' # HMAC.new(key, msg='', digestmod=None) return Cryptodome.Hash.HMAC.new(key, nonce, digestmod=Cryptodome.Hash.SHA256).digest()
[ "def", "sign_nonce", "(", "key", ",", "nonce", ")", ":", "# HMAC.new(key, msg='', digestmod=None)", "return", "Cryptodome", ".", "Hash", ".", "HMAC", ".", "new", "(", "key", ",", "nonce", ",", "digestmod", "=", "Cryptodome", ".", "Hash", ".", "SHA256", ")", ...
sign the server nonce from the WWW-Authenticate header with an authKey
[ "sign", "the", "server", "nonce", "from", "the", "WWW", "-", "Authenticate", "header", "with", "an", "authKey" ]
7f9458299f42e3c558f00e77cf9d3aa9dd857457
https://github.com/ehuggett/send-cli/blob/7f9458299f42e3c558f00e77cf9d3aa9dd857457/sendclient/download.py#L95-L98
8,465
ehuggett/send-cli
sendclient/password.py
api_password
def api_password(service, fileId , ownerToken, newAuthKey): ''' changes the authKey required to download a file hosted on a send server ''' service += 'api/password/%s' % fileId auth = sendclient.common.unpadded_urlsafe_b64encode(newAuthKey) r = requests.post(service, json={'owner_token': o...
python
def api_password(service, fileId , ownerToken, newAuthKey): ''' changes the authKey required to download a file hosted on a send server ''' service += 'api/password/%s' % fileId auth = sendclient.common.unpadded_urlsafe_b64encode(newAuthKey) r = requests.post(service, json={'owner_token': o...
[ "def", "api_password", "(", "service", ",", "fileId", ",", "ownerToken", ",", "newAuthKey", ")", ":", "service", "+=", "'api/password/%s'", "%", "fileId", "auth", "=", "sendclient", ".", "common", ".", "unpadded_urlsafe_b64encode", "(", "newAuthKey", ")", "r", ...
changes the authKey required to download a file hosted on a send server
[ "changes", "the", "authKey", "required", "to", "download", "a", "file", "hosted", "on", "a", "send", "server" ]
7f9458299f42e3c558f00e77cf9d3aa9dd857457
https://github.com/ehuggett/send-cli/blob/7f9458299f42e3c558f00e77cf9d3aa9dd857457/sendclient/password.py#L4-L16
8,466
ehuggett/send-cli
sendclient/password.py
set_password
def set_password(url, ownerToken, password): ''' set or change the password required to download a file hosted on a send server. ''' service, fileId, key = sendclient.common.splitkeyurl(url) rawKey = sendclient.common.unpadded_urlsafe_b64decode(key) keys = sendclient.common.secretKeys(r...
python
def set_password(url, ownerToken, password): ''' set or change the password required to download a file hosted on a send server. ''' service, fileId, key = sendclient.common.splitkeyurl(url) rawKey = sendclient.common.unpadded_urlsafe_b64decode(key) keys = sendclient.common.secretKeys(r...
[ "def", "set_password", "(", "url", ",", "ownerToken", ",", "password", ")", ":", "service", ",", "fileId", ",", "key", "=", "sendclient", ".", "common", ".", "splitkeyurl", "(", "url", ")", "rawKey", "=", "sendclient", ".", "common", ".", "unpadded_urlsafe...
set or change the password required to download a file hosted on a send server.
[ "set", "or", "change", "the", "password", "required", "to", "download", "a", "file", "hosted", "on", "a", "send", "server", "." ]
7f9458299f42e3c558f00e77cf9d3aa9dd857457
https://github.com/ehuggett/send-cli/blob/7f9458299f42e3c558f00e77cf9d3aa9dd857457/sendclient/password.py#L18-L27
8,467
ehuggett/send-cli
sendclient/common.py
splitkeyurl
def splitkeyurl(url): ''' Splits a Send url into key, urlid and 'prefix' for the Send server Should handle any hostname, but will brake on key & id length changes ''' key = url[-22:] urlid = url[-34:-24] service = url[:-43] return service, urlid, key
python
def splitkeyurl(url): ''' Splits a Send url into key, urlid and 'prefix' for the Send server Should handle any hostname, but will brake on key & id length changes ''' key = url[-22:] urlid = url[-34:-24] service = url[:-43] return service, urlid, key
[ "def", "splitkeyurl", "(", "url", ")", ":", "key", "=", "url", "[", "-", "22", ":", "]", "urlid", "=", "url", "[", "-", "34", ":", "-", "24", "]", "service", "=", "url", "[", ":", "-", "43", "]", "return", "service", ",", "urlid", ",", "key" ...
Splits a Send url into key, urlid and 'prefix' for the Send server Should handle any hostname, but will brake on key & id length changes
[ "Splits", "a", "Send", "url", "into", "key", "urlid", "and", "prefix", "for", "the", "Send", "server", "Should", "handle", "any", "hostname", "but", "will", "brake", "on", "key", "&", "id", "length", "changes" ]
7f9458299f42e3c558f00e77cf9d3aa9dd857457
https://github.com/ehuggett/send-cli/blob/7f9458299f42e3c558f00e77cf9d3aa9dd857457/sendclient/common.py#L9-L17
8,468
ehuggett/send-cli
sendclient/upload.py
api_upload
def api_upload(service, encData, encMeta, keys): ''' Uploads data to Send. Caution! Data is uploaded as given, this function will not encrypt it for you ''' service += 'api/upload' files = requests_toolbelt.MultipartEncoder(fields={'file': ('blob', encData, 'application/octet-stream') }) ...
python
def api_upload(service, encData, encMeta, keys): ''' Uploads data to Send. Caution! Data is uploaded as given, this function will not encrypt it for you ''' service += 'api/upload' files = requests_toolbelt.MultipartEncoder(fields={'file': ('blob', encData, 'application/octet-stream') }) ...
[ "def", "api_upload", "(", "service", ",", "encData", ",", "encMeta", ",", "keys", ")", ":", "service", "+=", "'api/upload'", "files", "=", "requests_toolbelt", ".", "MultipartEncoder", "(", "fields", "=", "{", "'file'", ":", "(", "'blob'", ",", "encData", ...
Uploads data to Send. Caution! Data is uploaded as given, this function will not encrypt it for you
[ "Uploads", "data", "to", "Send", ".", "Caution!", "Data", "is", "uploaded", "as", "given", "this", "function", "will", "not", "encrypt", "it", "for", "you" ]
7f9458299f42e3c558f00e77cf9d3aa9dd857457
https://github.com/ehuggett/send-cli/blob/7f9458299f42e3c558f00e77cf9d3aa9dd857457/sendclient/upload.py#L45-L73
8,469
ehuggett/send-cli
sendclient/upload.py
send_file
def send_file(service, file, fileName=None, password=None, ignoreVersion=False): if checkServerVersion(service, ignoreVersion=ignoreVersion) == False: print('\033[1;41m!!! Potentially incompatible server version !!!\033[0m') ''' Encrypt & Upload a file to send and return the download URL''' fileNa...
python
def send_file(service, file, fileName=None, password=None, ignoreVersion=False): if checkServerVersion(service, ignoreVersion=ignoreVersion) == False: print('\033[1;41m!!! Potentially incompatible server version !!!\033[0m') ''' Encrypt & Upload a file to send and return the download URL''' fileNa...
[ "def", "send_file", "(", "service", ",", "file", ",", "fileName", "=", "None", ",", "password", "=", "None", ",", "ignoreVersion", "=", "False", ")", ":", "if", "checkServerVersion", "(", "service", ",", "ignoreVersion", "=", "ignoreVersion", ")", "==", "F...
Encrypt & Upload a file to send and return the download URL
[ "Encrypt", "&", "Upload", "a", "file", "to", "send", "and", "return", "the", "download", "URL" ]
7f9458299f42e3c558f00e77cf9d3aa9dd857457
https://github.com/ehuggett/send-cli/blob/7f9458299f42e3c558f00e77cf9d3aa9dd857457/sendclient/upload.py#L80-L100
8,470
haochi/personalcapital
personalcapital/personalcapital.py
PersonalCapital.fetch
def fetch(self, endpoint, data = None): """ for getting data after logged in """ payload = { "lastServerChangeId": "-1", "csrf": self.__csrf, "apiClient": "WEB" } if data is not None: payload.update(data) return sel...
python
def fetch(self, endpoint, data = None): """ for getting data after logged in """ payload = { "lastServerChangeId": "-1", "csrf": self.__csrf, "apiClient": "WEB" } if data is not None: payload.update(data) return sel...
[ "def", "fetch", "(", "self", ",", "endpoint", ",", "data", "=", "None", ")", ":", "payload", "=", "{", "\"lastServerChangeId\"", ":", "\"-1\"", ",", "\"csrf\"", ":", "self", ".", "__csrf", ",", "\"apiClient\"", ":", "\"WEB\"", "}", "if", "data", "is", ...
for getting data after logged in
[ "for", "getting", "data", "after", "logged", "in" ]
2cdbab3f0a95cbc15aaab7a265f2634bc70dee9f
https://github.com/haochi/personalcapital/blob/2cdbab3f0a95cbc15aaab7a265f2634bc70dee9f/personalcapital/personalcapital.py#L73-L85
8,471
haochi/personalcapital
personalcapital/personalcapital.py
PersonalCapital.__identify_user
def __identify_user(self, username, csrf): """ Returns reusable CSRF code and the auth level as a 2-tuple """ data = { "username": username, "csrf": csrf, "apiClient": "WEB", "bindDevice": "false", "skipLinkAccount": "false", ...
python
def __identify_user(self, username, csrf): """ Returns reusable CSRF code and the auth level as a 2-tuple """ data = { "username": username, "csrf": csrf, "apiClient": "WEB", "bindDevice": "false", "skipLinkAccount": "false", ...
[ "def", "__identify_user", "(", "self", ",", "username", ",", "csrf", ")", ":", "data", "=", "{", "\"username\"", ":", "username", ",", "\"csrf\"", ":", "csrf", ",", "\"apiClient\"", ":", "\"WEB\"", ",", "\"bindDevice\"", ":", "\"false\"", ",", "\"skipLinkAcc...
Returns reusable CSRF code and the auth level as a 2-tuple
[ "Returns", "reusable", "CSRF", "code", "and", "the", "auth", "level", "as", "a", "2", "-", "tuple" ]
2cdbab3f0a95cbc15aaab7a265f2634bc70dee9f
https://github.com/haochi/personalcapital/blob/2cdbab3f0a95cbc15aaab7a265f2634bc70dee9f/personalcapital/personalcapital.py#L114-L137
8,472
linkedin/shiv
setup.py
get_args
def get_args(cls, dist, header=None): """Overrides easy_install.ScriptWriter.get_args This method avoids using pkg_resources to map a named entry_point to a callable at invocation time. """ if header is None: header = cls.get_header() spec = str(dist.as_requirement()) for type_ in '...
python
def get_args(cls, dist, header=None): """Overrides easy_install.ScriptWriter.get_args This method avoids using pkg_resources to map a named entry_point to a callable at invocation time. """ if header is None: header = cls.get_header() spec = str(dist.as_requirement()) for type_ in '...
[ "def", "get_args", "(", "cls", ",", "dist", ",", "header", "=", "None", ")", ":", "if", "header", "is", "None", ":", "header", "=", "cls", ".", "get_header", "(", ")", "spec", "=", "str", "(", "dist", ".", "as_requirement", "(", ")", ")", "for", ...
Overrides easy_install.ScriptWriter.get_args This method avoids using pkg_resources to map a named entry_point to a callable at invocation time.
[ "Overrides", "easy_install", ".", "ScriptWriter", ".", "get_args" ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/setup.py#L47-L72
8,473
linkedin/shiv
src/shiv/pip.py
clean_pip_env
def clean_pip_env() -> Generator[None, None, None]: """A context manager for temporarily removing 'PIP_REQUIRE_VIRTUALENV' from the environment. Since shiv installs via `--target`, we need to ignore venv requirements if they exist. """ require_venv = os.environ.pop(PIP_REQUIRE_VIRTUALENV, None) t...
python
def clean_pip_env() -> Generator[None, None, None]: """A context manager for temporarily removing 'PIP_REQUIRE_VIRTUALENV' from the environment. Since shiv installs via `--target`, we need to ignore venv requirements if they exist. """ require_venv = os.environ.pop(PIP_REQUIRE_VIRTUALENV, None) t...
[ "def", "clean_pip_env", "(", ")", "->", "Generator", "[", "None", ",", "None", ",", "None", "]", ":", "require_venv", "=", "os", ".", "environ", ".", "pop", "(", "PIP_REQUIRE_VIRTUALENV", ",", "None", ")", "try", ":", "yield", "finally", ":", "if", "re...
A context manager for temporarily removing 'PIP_REQUIRE_VIRTUALENV' from the environment. Since shiv installs via `--target`, we need to ignore venv requirements if they exist.
[ "A", "context", "manager", "for", "temporarily", "removing", "PIP_REQUIRE_VIRTUALENV", "from", "the", "environment", "." ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/pip.py#L15-L28
8,474
linkedin/shiv
src/shiv/pip.py
install
def install(args: List[str]) -> None: """`pip install` as a function. Accepts a list of pip arguments. .. code-block:: py >>> install(['numpy', '--target', 'site-packages']) Collecting numpy Downloading numpy-1.13.3-cp35-cp35m-manylinux1_x86_64.whl (16.9MB) 100% || 16....
python
def install(args: List[str]) -> None: """`pip install` as a function. Accepts a list of pip arguments. .. code-block:: py >>> install(['numpy', '--target', 'site-packages']) Collecting numpy Downloading numpy-1.13.3-cp35-cp35m-manylinux1_x86_64.whl (16.9MB) 100% || 16....
[ "def", "install", "(", "args", ":", "List", "[", "str", "]", ")", "->", "None", ":", "with", "clean_pip_env", "(", ")", ":", "# if being invoked as a pyz, we must ensure we have access to our own", "# site-packages when subprocessing since there is no guarantee that pip", "# ...
`pip install` as a function. Accepts a list of pip arguments. .. code-block:: py >>> install(['numpy', '--target', 'site-packages']) Collecting numpy Downloading numpy-1.13.3-cp35-cp35m-manylinux1_x86_64.whl (16.9MB) 100% || 16.9MB 53kB/s Installing collected packa...
[ "pip", "install", "as", "a", "function", "." ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/pip.py#L31-L67
8,475
linkedin/shiv
src/shiv/bootstrap/__init__.py
current_zipfile
def current_zipfile(): """A function to vend the current zipfile, if any""" if zipfile.is_zipfile(sys.argv[0]): fd = open(sys.argv[0], "rb") return zipfile.ZipFile(fd)
python
def current_zipfile(): """A function to vend the current zipfile, if any""" if zipfile.is_zipfile(sys.argv[0]): fd = open(sys.argv[0], "rb") return zipfile.ZipFile(fd)
[ "def", "current_zipfile", "(", ")", ":", "if", "zipfile", ".", "is_zipfile", "(", "sys", ".", "argv", "[", "0", "]", ")", ":", "fd", "=", "open", "(", "sys", ".", "argv", "[", "0", "]", ",", "\"rb\"", ")", "return", "zipfile", ".", "ZipFile", "("...
A function to vend the current zipfile, if any
[ "A", "function", "to", "vend", "the", "current", "zipfile", "if", "any" ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/bootstrap/__init__.py#L17-L21
8,476
linkedin/shiv
src/shiv/bootstrap/__init__.py
extract_site_packages
def extract_site_packages(archive, target_path, compile_pyc, compile_workers=0, force=False): """Extract everything in site-packages to a specified path. :param ZipFile archive: The zipfile object we are bootstrapping from. :param Path target_path: The path to extract our zip to. """ parent = targe...
python
def extract_site_packages(archive, target_path, compile_pyc, compile_workers=0, force=False): """Extract everything in site-packages to a specified path. :param ZipFile archive: The zipfile object we are bootstrapping from. :param Path target_path: The path to extract our zip to. """ parent = targe...
[ "def", "extract_site_packages", "(", "archive", ",", "target_path", ",", "compile_pyc", ",", "compile_workers", "=", "0", ",", "force", "=", "False", ")", ":", "parent", "=", "target_path", ".", "parent", "target_path_tmp", "=", "Path", "(", "parent", ",", "...
Extract everything in site-packages to a specified path. :param ZipFile archive: The zipfile object we are bootstrapping from. :param Path target_path: The path to extract our zip to.
[ "Extract", "everything", "in", "site", "-", "packages", "to", "a", "specified", "path", "." ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/bootstrap/__init__.py#L70-L103
8,477
linkedin/shiv
src/shiv/bootstrap/__init__.py
bootstrap
def bootstrap(): # pragma: no cover """Actually bootstrap our shiv environment.""" # get a handle of the currently executing zip file archive = current_zipfile() # create an environment object (a combination of env vars and json metadata) env = Environment.from_json(archive.read("environment.json...
python
def bootstrap(): # pragma: no cover """Actually bootstrap our shiv environment.""" # get a handle of the currently executing zip file archive = current_zipfile() # create an environment object (a combination of env vars and json metadata) env = Environment.from_json(archive.read("environment.json...
[ "def", "bootstrap", "(", ")", ":", "# pragma: no cover", "# get a handle of the currently executing zip file", "archive", "=", "current_zipfile", "(", ")", "# create an environment object (a combination of env vars and json metadata)", "env", "=", "Environment", ".", "from_json", ...
Actually bootstrap our shiv environment.
[ "Actually", "bootstrap", "our", "shiv", "environment", "." ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/bootstrap/__init__.py#L118-L169
8,478
linkedin/shiv
src/shiv/builder.py
write_file_prefix
def write_file_prefix(f: IO[Any], interpreter: str) -> None: """Write a shebang line. :param f: An open file handle. :param interpreter: A path to a python interpreter. """ # if the provided path is too long for a shebang we should error out if len(interpreter) > BINPRM_BUF_SIZE: sys.ex...
python
def write_file_prefix(f: IO[Any], interpreter: str) -> None: """Write a shebang line. :param f: An open file handle. :param interpreter: A path to a python interpreter. """ # if the provided path is too long for a shebang we should error out if len(interpreter) > BINPRM_BUF_SIZE: sys.ex...
[ "def", "write_file_prefix", "(", "f", ":", "IO", "[", "Any", "]", ",", "interpreter", ":", "str", ")", "->", "None", ":", "# if the provided path is too long for a shebang we should error out", "if", "len", "(", "interpreter", ")", ">", "BINPRM_BUF_SIZE", ":", "sy...
Write a shebang line. :param f: An open file handle. :param interpreter: A path to a python interpreter.
[ "Write", "a", "shebang", "line", "." ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/builder.py#L30-L40
8,479
linkedin/shiv
src/shiv/builder.py
create_archive
def create_archive( source: Path, target: Path, interpreter: str, main: str, compressed: bool = True ) -> None: """Create an application archive from SOURCE. A slightly modified version of stdlib's `zipapp.create_archive <https://docs.python.org/3/library/zipapp.html#zipapp.create_archi...
python
def create_archive( source: Path, target: Path, interpreter: str, main: str, compressed: bool = True ) -> None: """Create an application archive from SOURCE. A slightly modified version of stdlib's `zipapp.create_archive <https://docs.python.org/3/library/zipapp.html#zipapp.create_archi...
[ "def", "create_archive", "(", "source", ":", "Path", ",", "target", ":", "Path", ",", "interpreter", ":", "str", ",", "main", ":", "str", ",", "compressed", ":", "bool", "=", "True", ")", "->", "None", ":", "# Check that main has the right format.", "mod", ...
Create an application archive from SOURCE. A slightly modified version of stdlib's `zipapp.create_archive <https://docs.python.org/3/library/zipapp.html#zipapp.create_archive>`_
[ "Create", "an", "application", "archive", "from", "SOURCE", "." ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/builder.py#L53-L98
8,480
linkedin/shiv
src/shiv/bootstrap/filelock.py
acquire_win
def acquire_win(lock_file): # pragma: no cover """Acquire a lock file on windows.""" try: fd = os.open(lock_file, OPEN_MODE) except OSError: pass else: try: msvcrt.locking(fd, msvcrt.LK_NBLCK, 1) except (IOError, OSError): os.close(fd) els...
python
def acquire_win(lock_file): # pragma: no cover """Acquire a lock file on windows.""" try: fd = os.open(lock_file, OPEN_MODE) except OSError: pass else: try: msvcrt.locking(fd, msvcrt.LK_NBLCK, 1) except (IOError, OSError): os.close(fd) els...
[ "def", "acquire_win", "(", "lock_file", ")", ":", "# pragma: no cover", "try", ":", "fd", "=", "os", ".", "open", "(", "lock_file", ",", "OPEN_MODE", ")", "except", "OSError", ":", "pass", "else", ":", "try", ":", "msvcrt", ".", "locking", "(", "fd", "...
Acquire a lock file on windows.
[ "Acquire", "a", "lock", "file", "on", "windows", "." ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/bootstrap/filelock.py#L22-L34
8,481
linkedin/shiv
src/shiv/bootstrap/filelock.py
acquire_nix
def acquire_nix(lock_file): # pragma: no cover """Acquire a lock file on linux or osx.""" fd = os.open(lock_file, OPEN_MODE) try: fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) except (IOError, OSError): os.close(fd) else: return fd
python
def acquire_nix(lock_file): # pragma: no cover """Acquire a lock file on linux or osx.""" fd = os.open(lock_file, OPEN_MODE) try: fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) except (IOError, OSError): os.close(fd) else: return fd
[ "def", "acquire_nix", "(", "lock_file", ")", ":", "# pragma: no cover", "fd", "=", "os", ".", "open", "(", "lock_file", ",", "OPEN_MODE", ")", "try", ":", "fcntl", ".", "flock", "(", "fd", ",", "fcntl", ".", "LOCK_EX", "|", "fcntl", ".", "LOCK_NB", ")"...
Acquire a lock file on linux or osx.
[ "Acquire", "a", "lock", "file", "on", "linux", "or", "osx", "." ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/bootstrap/filelock.py#L37-L46
8,482
linkedin/shiv
src/shiv/cli.py
find_entry_point
def find_entry_point(site_packages: Path, console_script: str) -> str: """Find a console_script in a site-packages directory. Console script metadata is stored in entry_points.txt per setuptools convention. This function searches all entry_points.txt files and returns the import string for a given cons...
python
def find_entry_point(site_packages: Path, console_script: str) -> str: """Find a console_script in a site-packages directory. Console script metadata is stored in entry_points.txt per setuptools convention. This function searches all entry_points.txt files and returns the import string for a given cons...
[ "def", "find_entry_point", "(", "site_packages", ":", "Path", ",", "console_script", ":", "str", ")", "->", "str", ":", "config_parser", "=", "ConfigParser", "(", ")", "config_parser", ".", "read", "(", "site_packages", ".", "rglob", "(", "\"entry_points.txt\"",...
Find a console_script in a site-packages directory. Console script metadata is stored in entry_points.txt per setuptools convention. This function searches all entry_points.txt files and returns the import string for a given console_script argument. :param site_packages: A path to a site-packages dire...
[ "Find", "a", "console_script", "in", "a", "site", "-", "packages", "directory", "." ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/cli.py#L32-L45
8,483
linkedin/shiv
src/shiv/cli.py
copy_bootstrap
def copy_bootstrap(bootstrap_target: Path) -> None: """Copy bootstrap code from shiv into the pyz. This function is excluded from type checking due to the conditional import. :param bootstrap_target: The temporary directory where we are staging pyz contents. """ for bootstrap_file in importlib_re...
python
def copy_bootstrap(bootstrap_target: Path) -> None: """Copy bootstrap code from shiv into the pyz. This function is excluded from type checking due to the conditional import. :param bootstrap_target: The temporary directory where we are staging pyz contents. """ for bootstrap_file in importlib_re...
[ "def", "copy_bootstrap", "(", "bootstrap_target", ":", "Path", ")", "->", "None", ":", "for", "bootstrap_file", "in", "importlib_resources", ".", "contents", "(", "bootstrap", ")", ":", "if", "importlib_resources", ".", "is_resource", "(", "bootstrap", ",", "boo...
Copy bootstrap code from shiv into the pyz. This function is excluded from type checking due to the conditional import. :param bootstrap_target: The temporary directory where we are staging pyz contents.
[ "Copy", "bootstrap", "code", "from", "shiv", "into", "the", "pyz", "." ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/cli.py#L49-L60
8,484
linkedin/shiv
src/shiv/cli.py
_interpreter_path
def _interpreter_path(append_version: bool = False) -> str: """A function to return the path to the current Python interpreter. Even when inside a venv, this will return the interpreter the venv was created with. """ base_dir = Path(getattr(sys, "real_prefix", sys.base_prefix)).resolve() sys_exec...
python
def _interpreter_path(append_version: bool = False) -> str: """A function to return the path to the current Python interpreter. Even when inside a venv, this will return the interpreter the venv was created with. """ base_dir = Path(getattr(sys, "real_prefix", sys.base_prefix)).resolve() sys_exec...
[ "def", "_interpreter_path", "(", "append_version", ":", "bool", "=", "False", ")", "->", "str", ":", "base_dir", "=", "Path", "(", "getattr", "(", "sys", ",", "\"real_prefix\"", ",", "sys", ".", "base_prefix", ")", ")", ".", "resolve", "(", ")", "sys_exe...
A function to return the path to the current Python interpreter. Even when inside a venv, this will return the interpreter the venv was created with.
[ "A", "function", "to", "return", "the", "path", "to", "the", "current", "Python", "interpreter", "." ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/cli.py#L63-L93
8,485
linkedin/shiv
src/shiv/cli.py
main
def main( output_file: str, entry_point: Optional[str], console_script: Optional[str], python: Optional[str], site_packages: Optional[str], compressed: bool, compile_pyc: bool, extend_pythonpath: bool, pip_args: List[str], ) -> None: """ Shiv is a command line utility for bui...
python
def main( output_file: str, entry_point: Optional[str], console_script: Optional[str], python: Optional[str], site_packages: Optional[str], compressed: bool, compile_pyc: bool, extend_pythonpath: bool, pip_args: List[str], ) -> None: """ Shiv is a command line utility for bui...
[ "def", "main", "(", "output_file", ":", "str", ",", "entry_point", ":", "Optional", "[", "str", "]", ",", "console_script", ":", "Optional", "[", "str", "]", ",", "python", ":", "Optional", "[", "str", "]", ",", "site_packages", ":", "Optional", "[", "...
Shiv is a command line utility for building fully self-contained Python zipapps as outlined in PEP 441, but with all their dependencies included!
[ "Shiv", "is", "a", "command", "line", "utility", "for", "building", "fully", "self", "-", "contained", "Python", "zipapps", "as", "outlined", "in", "PEP", "441", "but", "with", "all", "their", "dependencies", "included!" ]
6bda78676170b35d0877f67b71095c39ce41a74a
https://github.com/linkedin/shiv/blob/6bda78676170b35d0877f67b71095c39ce41a74a/src/shiv/cli.py#L128-L204
8,486
aio-libs/aiobotocore
aiobotocore/session.py
get_session
def get_session(*, env_vars=None, loop=None): """ Return a new session object. """ loop = loop or asyncio.get_event_loop() return AioSession(session_vars=env_vars, loop=loop)
python
def get_session(*, env_vars=None, loop=None): """ Return a new session object. """ loop = loop or asyncio.get_event_loop() return AioSession(session_vars=env_vars, loop=loop)
[ "def", "get_session", "(", "*", ",", "env_vars", "=", "None", ",", "loop", "=", "None", ")", ":", "loop", "=", "loop", "or", "asyncio", ".", "get_event_loop", "(", ")", "return", "AioSession", "(", "session_vars", "=", "env_vars", ",", "loop", "=", "lo...
Return a new session object.
[ "Return", "a", "new", "session", "object", "." ]
d0c0a8651a3738b6260efe962218a5738694dd2a
https://github.com/aio-libs/aiobotocore/blob/d0c0a8651a3738b6260efe962218a5738694dd2a/aiobotocore/session.py#L88-L93
8,487
aio-libs/aiobotocore
aiobotocore/response.py
StreamingBody.read
async def read(self, amt=None): """Read at most amt bytes from the stream. If the amt argument is omitted, read all data. """ # botocore to aiohttp mapping chunk = await self.__wrapped__.read(amt if amt is not None else -1) self._self_amount_read += len(chunk) if...
python
async def read(self, amt=None): """Read at most amt bytes from the stream. If the amt argument is omitted, read all data. """ # botocore to aiohttp mapping chunk = await self.__wrapped__.read(amt if amt is not None else -1) self._self_amount_read += len(chunk) if...
[ "async", "def", "read", "(", "self", ",", "amt", "=", "None", ")", ":", "# botocore to aiohttp mapping", "chunk", "=", "await", "self", ".", "__wrapped__", ".", "read", "(", "amt", "if", "amt", "is", "not", "None", "else", "-", "1", ")", "self", ".", ...
Read at most amt bytes from the stream. If the amt argument is omitted, read all data.
[ "Read", "at", "most", "amt", "bytes", "from", "the", "stream", "." ]
d0c0a8651a3738b6260efe962218a5738694dd2a
https://github.com/aio-libs/aiobotocore/blob/d0c0a8651a3738b6260efe962218a5738694dd2a/aiobotocore/response.py#L37-L50
8,488
aio-libs/aiobotocore
aiobotocore/response.py
StreamingBody.iter_lines
async def iter_lines(self, chunk_size=1024): """Return an iterator to yield lines from the raw stream. This is achieved by reading chunk of bytes (of size chunk_size) at a time from the raw stream, and then yielding lines from there. """ pending = b'' async for chunk in ...
python
async def iter_lines(self, chunk_size=1024): """Return an iterator to yield lines from the raw stream. This is achieved by reading chunk of bytes (of size chunk_size) at a time from the raw stream, and then yielding lines from there. """ pending = b'' async for chunk in ...
[ "async", "def", "iter_lines", "(", "self", ",", "chunk_size", "=", "1024", ")", ":", "pending", "=", "b''", "async", "for", "chunk", "in", "self", ".", "iter_chunks", "(", "chunk_size", ")", ":", "lines", "=", "(", "pending", "+", "chunk", ")", ".", ...
Return an iterator to yield lines from the raw stream. This is achieved by reading chunk of bytes (of size chunk_size) at a time from the raw stream, and then yielding lines from there.
[ "Return", "an", "iterator", "to", "yield", "lines", "from", "the", "raw", "stream", "." ]
d0c0a8651a3738b6260efe962218a5738694dd2a
https://github.com/aio-libs/aiobotocore/blob/d0c0a8651a3738b6260efe962218a5738694dd2a/aiobotocore/response.py#L68-L81
8,489
aio-libs/aiobotocore
aiobotocore/response.py
StreamingBody.iter_chunks
async def iter_chunks(self, chunk_size=_DEFAULT_CHUNK_SIZE): """Return an iterator to yield chunks of chunk_size bytes from the raw stream. """ while True: current_chunk = await self.read(chunk_size) if current_chunk == b"": break await...
python
async def iter_chunks(self, chunk_size=_DEFAULT_CHUNK_SIZE): """Return an iterator to yield chunks of chunk_size bytes from the raw stream. """ while True: current_chunk = await self.read(chunk_size) if current_chunk == b"": break await...
[ "async", "def", "iter_chunks", "(", "self", ",", "chunk_size", "=", "_DEFAULT_CHUNK_SIZE", ")", ":", "while", "True", ":", "current_chunk", "=", "await", "self", ".", "read", "(", "chunk_size", ")", "if", "current_chunk", "==", "b\"\"", ":", "break", "await"...
Return an iterator to yield chunks of chunk_size bytes from the raw stream.
[ "Return", "an", "iterator", "to", "yield", "chunks", "of", "chunk_size", "bytes", "from", "the", "raw", "stream", "." ]
d0c0a8651a3738b6260efe962218a5738694dd2a
https://github.com/aio-libs/aiobotocore/blob/d0c0a8651a3738b6260efe962218a5738694dd2a/aiobotocore/response.py#L84-L92
8,490
aio-libs/aiobotocore
examples/dynamodb_batch_write.py
get_items
def get_items(start_num, num_items): """ Generate a sequence of dynamo items :param start_num: Start index :type start_num: int :param num_items: Number of items :type num_items: int :return: List of dictionaries :rtype: list of dict """ result = [] for i in range(start_num,...
python
def get_items(start_num, num_items): """ Generate a sequence of dynamo items :param start_num: Start index :type start_num: int :param num_items: Number of items :type num_items: int :return: List of dictionaries :rtype: list of dict """ result = [] for i in range(start_num,...
[ "def", "get_items", "(", "start_num", ",", "num_items", ")", ":", "result", "=", "[", "]", "for", "i", "in", "range", "(", "start_num", ",", "start_num", "+", "num_items", ")", ":", "result", ".", "append", "(", "{", "'pk'", ":", "{", "'S'", ":", "...
Generate a sequence of dynamo items :param start_num: Start index :type start_num: int :param num_items: Number of items :type num_items: int :return: List of dictionaries :rtype: list of dict
[ "Generate", "a", "sequence", "of", "dynamo", "items" ]
d0c0a8651a3738b6260efe962218a5738694dd2a
https://github.com/aio-libs/aiobotocore/blob/d0c0a8651a3738b6260efe962218a5738694dd2a/examples/dynamodb_batch_write.py#L7-L21
8,491
aio-libs/aiobotocore
examples/dynamodb_batch_write.py
create_batch_write_structure
def create_batch_write_structure(table_name, start_num, num_items): """ Create item structure for passing to batch_write_item :param table_name: DynamoDB table name :type table_name: str :param start_num: Start index :type start_num: int :param num_items: Number of items :type num_items...
python
def create_batch_write_structure(table_name, start_num, num_items): """ Create item structure for passing to batch_write_item :param table_name: DynamoDB table name :type table_name: str :param start_num: Start index :type start_num: int :param num_items: Number of items :type num_items...
[ "def", "create_batch_write_structure", "(", "table_name", ",", "start_num", ",", "num_items", ")", ":", "return", "{", "table_name", ":", "[", "{", "'PutRequest'", ":", "{", "'Item'", ":", "item", "}", "}", "for", "item", "in", "get_items", "(", "start_num",...
Create item structure for passing to batch_write_item :param table_name: DynamoDB table name :type table_name: str :param start_num: Start index :type start_num: int :param num_items: Number of items :type num_items: int :return: dictionary of tables to write to :rtype: dict
[ "Create", "item", "structure", "for", "passing", "to", "batch_write_item" ]
d0c0a8651a3738b6260efe962218a5738694dd2a
https://github.com/aio-libs/aiobotocore/blob/d0c0a8651a3738b6260efe962218a5738694dd2a/examples/dynamodb_batch_write.py#L24-L42
8,492
aio-libs/aiobotocore
aiobotocore/client.py
AioBaseClient.get_paginator
def get_paginator(self, operation_name): """Create a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is ``create_foo``, and you'd...
python
def get_paginator(self, operation_name): """Create a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is ``create_foo``, and you'd...
[ "def", "get_paginator", "(", "self", ",", "operation_name", ")", ":", "if", "not", "self", ".", "can_paginate", "(", "operation_name", ")", ":", "raise", "OperationNotPageableError", "(", "operation_name", "=", "operation_name", ")", "else", ":", "# substitute ite...
Create a paginator for an operation. :type operation_name: string :param operation_name: The operation name. This is the same name as the method name on the client. For example, if the method name is ``create_foo``, and you'd normally invoke the operation as ``clie...
[ "Create", "a", "paginator", "for", "an", "operation", "." ]
d0c0a8651a3738b6260efe962218a5738694dd2a
https://github.com/aio-libs/aiobotocore/blob/d0c0a8651a3738b6260efe962218a5738694dd2a/aiobotocore/client.py#L124-L176
8,493
aio-libs/aiobotocore
aiobotocore/client.py
AioBaseClient.get_waiter
def get_waiter(self, waiter_name): """Returns an object that can wait for some condition. :type waiter_name: str :param waiter_name: The name of the waiter to get. See the waiters section of the service docs for a list of available waiters. :returns: The specified waiter ob...
python
def get_waiter(self, waiter_name): """Returns an object that can wait for some condition. :type waiter_name: str :param waiter_name: The name of the waiter to get. See the waiters section of the service docs for a list of available waiters. :returns: The specified waiter ob...
[ "def", "get_waiter", "(", "self", ",", "waiter_name", ")", ":", "config", "=", "self", ".", "_get_waiter_config", "(", ")", "if", "not", "config", ":", "raise", "ValueError", "(", "\"Waiter does not exist: %s\"", "%", "waiter_name", ")", "model", "=", "waiter"...
Returns an object that can wait for some condition. :type waiter_name: str :param waiter_name: The name of the waiter to get. See the waiters section of the service docs for a list of available waiters. :returns: The specified waiter object. :rtype: botocore.waiter.Waiter
[ "Returns", "an", "object", "that", "can", "wait", "for", "some", "condition", "." ]
d0c0a8651a3738b6260efe962218a5738694dd2a
https://github.com/aio-libs/aiobotocore/blob/d0c0a8651a3738b6260efe962218a5738694dd2a/aiobotocore/client.py#L178-L199
8,494
gabrielfalcao/HTTPretty
httpretty/core.py
url_fix
def url_fix(s, charset=None): """escapes special characters """ if charset: warnings.warn("{}.url_fix() charset argument is deprecated".format(__name__), DeprecationWarning) scheme, netloc, path, querystring, fragment = urlsplit(s) path = quote(path, b'/%') querystring = quote_plus(quer...
python
def url_fix(s, charset=None): """escapes special characters """ if charset: warnings.warn("{}.url_fix() charset argument is deprecated".format(__name__), DeprecationWarning) scheme, netloc, path, querystring, fragment = urlsplit(s) path = quote(path, b'/%') querystring = quote_plus(quer...
[ "def", "url_fix", "(", "s", ",", "charset", "=", "None", ")", ":", "if", "charset", ":", "warnings", ".", "warn", "(", "\"{}.url_fix() charset argument is deprecated\"", ".", "format", "(", "__name__", ")", ",", "DeprecationWarning", ")", "scheme", ",", "netlo...
escapes special characters
[ "escapes", "special", "characters" ]
91dab803011d190c4602cf4c2a07a19835a092e3
https://github.com/gabrielfalcao/HTTPretty/blob/91dab803011d190c4602cf4c2a07a19835a092e3/httpretty/core.py#L831-L840
8,495
gabrielfalcao/HTTPretty
httpretty/core.py
httprettified
def httprettified(test=None, allow_net_connect=True): """decorator for test functions .. tip:: Also available under the alias :py:func:`httpretty.activate` :param test: a callable example usage with `nosetests <https://nose.readthedocs.io/en/latest/>`_ .. testcode:: import sure f...
python
def httprettified(test=None, allow_net_connect=True): """decorator for test functions .. tip:: Also available under the alias :py:func:`httpretty.activate` :param test: a callable example usage with `nosetests <https://nose.readthedocs.io/en/latest/>`_ .. testcode:: import sure f...
[ "def", "httprettified", "(", "test", "=", "None", ",", "allow_net_connect", "=", "True", ")", ":", "def", "decorate_unittest_TestCase_setUp", "(", "klass", ")", ":", "# Prefer addCleanup (added in python 2.7), but fall back", "# to using tearDown if it isn't available", "use_...
decorator for test functions .. tip:: Also available under the alias :py:func:`httpretty.activate` :param test: a callable example usage with `nosetests <https://nose.readthedocs.io/en/latest/>`_ .. testcode:: import sure from httpretty import httprettified @httprettified ...
[ "decorator", "for", "test", "functions" ]
91dab803011d190c4602cf4c2a07a19835a092e3
https://github.com/gabrielfalcao/HTTPretty/blob/91dab803011d190c4602cf4c2a07a19835a092e3/httpretty/core.py#L1594-L1709
8,496
gabrielfalcao/HTTPretty
httpretty/core.py
HTTPrettyRequest.parse_request_body
def parse_request_body(self, body): """Attempt to parse the post based on the content-type passed. Return the regular body if not :param body: string :returns: a python object such as dict or list in case the deserialization suceeded. Else returns the given param ``body`` """ ...
python
def parse_request_body(self, body): """Attempt to parse the post based on the content-type passed. Return the regular body if not :param body: string :returns: a python object such as dict or list in case the deserialization suceeded. Else returns the given param ``body`` """ ...
[ "def", "parse_request_body", "(", "self", ",", "body", ")", ":", "PARSING_FUNCTIONS", "=", "{", "'application/json'", ":", "json", ".", "loads", ",", "'text/json'", ":", "json", ".", "loads", ",", "'application/x-www-form-urlencoded'", ":", "self", ".", "parse_q...
Attempt to parse the post based on the content-type passed. Return the regular body if not :param body: string :returns: a python object such as dict or list in case the deserialization suceeded. Else returns the given param ``body``
[ "Attempt", "to", "parse", "the", "post", "based", "on", "the", "content", "-", "type", "passed", ".", "Return", "the", "regular", "body", "if", "not" ]
91dab803011d190c4602cf4c2a07a19835a092e3
https://github.com/gabrielfalcao/HTTPretty/blob/91dab803011d190c4602cf4c2a07a19835a092e3/httpretty/core.py#L256-L277
8,497
gabrielfalcao/HTTPretty
httpretty/core.py
Entry.fill_filekind
def fill_filekind(self, fk): """writes HTTP Response data to a file descriptor :parm fk: a file-like object .. warning:: **side-effect:** this method moves the cursor of the given file object to zero """ now = datetime.utcnow() headers = { 'status': self.st...
python
def fill_filekind(self, fk): """writes HTTP Response data to a file descriptor :parm fk: a file-like object .. warning:: **side-effect:** this method moves the cursor of the given file object to zero """ now = datetime.utcnow() headers = { 'status': self.st...
[ "def", "fill_filekind", "(", "self", ",", "fk", ")", ":", "now", "=", "datetime", ".", "utcnow", "(", ")", "headers", "=", "{", "'status'", ":", "self", ".", "status", ",", "'date'", ":", "now", ".", "strftime", "(", "'%a, %d %b %Y %H:%M:%S GMT'", ")", ...
writes HTTP Response data to a file descriptor :parm fk: a file-like object .. warning:: **side-effect:** this method moves the cursor of the given file object to zero
[ "writes", "HTTP", "Response", "data", "to", "a", "file", "descriptor" ]
91dab803011d190c4602cf4c2a07a19835a092e3
https://github.com/gabrielfalcao/HTTPretty/blob/91dab803011d190c4602cf4c2a07a19835a092e3/httpretty/core.py#L754-L828
8,498
trehn/termdown
termdown.py
draw_text
def draw_text(stdscr, text, color=0, fallback=None, title=None): """ Draws text in the given color. Duh. """ if fallback is None: fallback = text y, x = stdscr.getmaxyx() if title: title = pad_to_size(title, x, 1) if "\n" in title.rstrip("\n"): # hack to get m...
python
def draw_text(stdscr, text, color=0, fallback=None, title=None): """ Draws text in the given color. Duh. """ if fallback is None: fallback = text y, x = stdscr.getmaxyx() if title: title = pad_to_size(title, x, 1) if "\n" in title.rstrip("\n"): # hack to get m...
[ "def", "draw_text", "(", "stdscr", ",", "text", ",", "color", "=", "0", ",", "fallback", "=", "None", ",", "title", "=", "None", ")", ":", "if", "fallback", "is", "None", ":", "fallback", "=", "text", "y", ",", "x", "=", "stdscr", ".", "getmaxyx", ...
Draws text in the given color. Duh.
[ "Draws", "text", "in", "the", "given", "color", ".", "Duh", "." ]
aa0c4e39d9864fd1466ef9d76947fb93d0cf5be2
https://github.com/trehn/termdown/blob/aa0c4e39d9864fd1466ef9d76947fb93d0cf5be2/termdown.py#L70-L95
8,499
trehn/termdown
termdown.py
format_seconds
def format_seconds(seconds, hide_seconds=False): """ Returns a human-readable string representation of the given amount of seconds. """ if seconds <= 60: return str(seconds) output = "" for period, period_seconds in ( ('y', 31557600), ('d', 86400), ('h', 3600)...
python
def format_seconds(seconds, hide_seconds=False): """ Returns a human-readable string representation of the given amount of seconds. """ if seconds <= 60: return str(seconds) output = "" for period, period_seconds in ( ('y', 31557600), ('d', 86400), ('h', 3600)...
[ "def", "format_seconds", "(", "seconds", ",", "hide_seconds", "=", "False", ")", ":", "if", "seconds", "<=", "60", ":", "return", "str", "(", "seconds", ")", "output", "=", "\"\"", "for", "period", ",", "period_seconds", "in", "(", "(", "'y'", ",", "31...
Returns a human-readable string representation of the given amount of seconds.
[ "Returns", "a", "human", "-", "readable", "string", "representation", "of", "the", "given", "amount", "of", "seconds", "." ]
aa0c4e39d9864fd1466ef9d76947fb93d0cf5be2
https://github.com/trehn/termdown/blob/aa0c4e39d9864fd1466ef9d76947fb93d0cf5be2/termdown.py#L98-L118