_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q248600
InstanceSelect.when_value_edited
train
def when_value_edited(self, *args, **kargs): """ Overrided to prevent user from selecting too
python
{ "resource": "" }
q248601
InstanceSelect.safe_to_exit
train
def safe_to_exit(self, *args, **kargs): """ Overrided to prevent user from exiting selection until
python
{ "resource": "" }
q248602
DeleteForm.create
train
def create(self): """ Creates the necessary display for this form """ self.add_handlers({'^E': self.quit, '^Q': self.quit}) to_delete = self.old_instances - self.new_instances self.add(npyscreen.Textfield, value='Select which instances to delete' ' (you must select ' + s...
python
{ "resource": "" }
q248603
DeleteForm.on_ok
train
def on_ok(self): """ Delete the instances that the user chose to delete """ npyscreen.notify_wait('Deleting instances given...', title='In progress') # keep track of number for shifting instances down for alignment shift_num = 1 to_update = [] ...
python
{ "resource": "" }
q248604
DeleteR.on_post
train
def on_post(self, req, resp): """ Send a POST request with a docker container ID and it will be deleted. Example input: {'id': "12345"}, {'id': ["123", "456"]} """ resp.content_type = falcon.MEDIA_TEXT resp.status = falcon.HTTP_200 # verify user input pa...
python
{ "resource": "" }
q248605
ListR.on_get
train
def on_get(self, req, resp): """ Send a GET request to get the list of all of the filter containers """ resp.content_type = falcon.MEDIA_TEXT resp.status = falcon.HTTP_200 # connect to docker try: containers = docker.from_env() except Exceptio...
python
{ "resource": "" }
q248606
NICsR.on_get
train
def on_get(self, req, resp): """ Send a GET request to get the list of all available network interfaces """ resp.content_type = falcon.MEDIA_TEXT resp.status = falcon.HTTP_200 # connect to docker try: d_client = docker.from_env() except Except...
python
{ "resource": "" }
q248607
TutorialForm.create
train
def create(self): """ Overridden to add handlers and content """ self.add_handlers({'^Q': self.quit}) self.add(npyscreen.TitleText, name=self.title, editable=False) self.add(npyscreen.MultiLineEdit, editable=False, value=self.text, max_width=75, slow_scroll=True) ...
python
{ "resource": "" }
q248608
BackupForm.create
train
def create(self): """ Add backup files to select from """ self.add_handlers({'^T': self.quit}) self.add(npyscreen.Textfield, value='Pick a version to restore
python
{ "resource": "" }
q248609
BackupForm.on_ok
train
def on_ok(self): """ Perform restoration on the backup file selected """ if self.dir_select.value: npyscreen.notify_wait('In the process of restoring', title='Restoring...') status = self.restore(self.dirs[self.dir_select.value[0]]) i...
python
{ "resource": "" }
q248610
PathDirs.ensure_dir
train
def ensure_dir(path): """ Tries to create directory, if fails, checks if path already exists """ try: makedirs(path) except OSError as e: # pragma: no cover if e.errno == errno.EEXIST and isdir(path):
python
{ "resource": "" }
q248611
PathDirs.ensure_file
train
def ensure_file(path): """ Checks if file exists, if fails, tries to create file """ try: exists = isfile(path) if not exists: with open(path, 'w+') as fname:
python
{ "resource": "" }
q248612
PathDirs.host_config
train
def host_config(self): """ Ensure the host configuration file exists """ if platform.system() == 'Darwin': default_file_dir = join(expanduser('~'), 'vent_files') else: default_file_dir = '/opt/vent_files' status = self.ensure_di...
python
{ "resource": "" }
q248613
PathDirs.apply_path
train
def apply_path(self, repo): """ Set path to where the repo is and return original path """ try: # rewrite repo for consistency if repo.endswith('.git'): repo = repo.split('.git')[0] # get org and repo name and path repo will be cloned to o...
python
{ "resource": "" }
q248614
PathDirs.get_path
train
def get_path(self, repo): """ Return the path for the repo """ if repo.endswith('.git'): repo = repo.split('.git')[0] org, name = repo.split('/')[-2:]
python
{ "resource": "" }
q248615
PathDirs.override_config
train
def override_config(self, path): """ Will take a yml located in home directory titled '.plugin_config.yml'. It'll then override, using the yml, the plugin's config file """ status = (True, None) config_override = False try: # parse the yml file ...
python
{ "resource": "" }
q248616
Logs
train
def Logs(c_type=None, grep_list=None): """ Generically filter logs stored in log containers """ def get_logs(logs, log_entries): try: for log in logs: if str(container.name) in log_entries: log_entries[str(container.name)].append(log) else:...
python
{ "resource": "" }
q248617
Version
train
def Version(): """ Get Vent version """ version = '' try: version = pkg_resources.require('vent')[0].version
python
{ "resource": "" }
q248618
Docker
train
def Docker(): """ Get Docker setup information """ docker_info = {'server': {}, 'env': '', 'type': '', 'os': ''} # get docker server version try: d_client = docker.from_env() docker_info['server'] = d_client.version() except Exception as e: # pragma: no cover logger.error("...
python
{ "resource": "" }
q248619
Containers
train
def Containers(vent=True, running=True, exclude_labels=None): """ Get containers that are created, by default limit to vent containers that are running """ containers = [] try: d_client = docker.from_env() if vent: c = d_client.containers.list(all=not running, ...
python
{ "resource": "" }
q248620
Cpu
train
def Cpu(): """ Get number of available CPUs """ cpu = 'Unknown' try: cpu = str(multiprocessing.cpu_count()) except Exception as e:
python
{ "resource": "" }
q248621
Gpu
train
def Gpu(pull=False): """ Check for support of GPUs, and return what's available """ gpu = (False, '') try: image = 'nvidia/cuda:8.0-runtime' image_name, tag = image.split(':') d_client = docker.from_env() nvidia_image = d_client.images.list(name=image) if pull and l...
python
{ "resource": "" }
q248622
Images
train
def Images(vent=True): """ Get images that are build, by default limit to vent images """ images = [] # TODO needs to also check images in the manifest that couldn't have the # label added try: d_client = docker.from_env() if vent: i = d_client.images.list(filters={'...
python
{ "resource": "" }
q248623
ManifestTools
train
def ManifestTools(**kargs): """ Get tools that exist in the manifest """ path_dirs = PathDirs(**kargs) manifest = join(path_dirs.meta_dir, 'plugin_manifest.cfg')
python
{ "resource": "" }
q248624
ToolMatches
train
def ToolMatches(tools=None, version='HEAD'): """ Get the tools paths and versions that were specified """ matches = [] if tools: for tool in tools: match_version = version if tool[1] != '': match_version = tool[1] match = '' if tool[0]....
python
{ "resource": "" }
q248625
Timestamp
train
def Timestamp(): """ Get the current datetime in UTC """ timestamp = '' try: timestamp = str(datetime.datetime.now())+' UTC' except Exception as e:
python
{ "resource": "" }
q248626
Uptime
train
def Uptime(): """ Get the current uptime information """ uptime = '' try: uptime = check_output(['uptime'], close_fds=True).decode('utf-8')[1:] except Exception as e:
python
{ "resource": "" }
q248627
DropLocation
train
def DropLocation(): """ Get the directory that file drop is watching """ template = Template(template=PathDirs().cfg_file) drop_loc = template.option('main', 'files')[1]
python
{ "resource": "" }
q248628
ParsedSections
train
def ParsedSections(file_val): """ Get the sections and options of a file returned as a dictionary """ try: template_dict = {} cur_section = '' for val in file_val.split('\n'): val = val.strip() if val != '': section_match = re.match(r'\[.+\...
python
{ "resource": "" }
q248629
Dependencies
train
def Dependencies(tools): """ Takes in a list of tools that are being updated and returns any tools that depend on linking to them """ dependencies = [] if tools: path_dirs = PathDirs() man = Template(join(path_dirs.meta_dir, 'plugin_manifest.cfg')) for section in man.sect...
python
{ "resource": "" }
q248630
ChooseToolsForm.repo_tools
train
def repo_tools(self, branch): """ Set the appropriate repo dir and get the tools available of it """ tools = [] m_helper = Tools() repo = self.parentApp.repo_value['repo'] version = self.parentApp.repo_value['versions'][branch]
python
{ "resource": "" }
q248631
ChooseToolsForm.create
train
def create(self): """ Update with current tools for each branch at the version chosen """ self.add_handlers({'^Q': self.quit}) self.add(npyscreen.TitleText, name='Select which tools to add from each branch selected:', editable=False) self.add(npyscreen.T...
python
{ "resource": "" }
q248632
ChooseToolsForm.on_ok
train
def on_ok(self): """ Take the tool selections and add them as plugins """ def diff(first, second): """ Get the elements that exist in the first list and not in the second """ second = set(second) return [item for item in first i...
python
{ "resource": "" }
q248633
MainForm.while_waiting
train
def while_waiting(self): """ Update fields periodically if nothing is happening """ # give a little extra time for file descriptors to close time.sleep(0.1) self.addfield.value = Timestamp() self.addfield.display() self.addfield2.value = Uptime() self.addfield2.d...
python
{ "resource": "" }
q248634
MainForm.add_form
train
def add_form(self, form, form_name, form_args): """ Add new form and switch to it """
python
{ "resource": "" }
q248635
MainForm.remove_forms
train
def remove_forms(self, form_names): """ Remove all forms supplied """ for form in form_names: try: self.parentApp.removeForm(form)
python
{ "resource": "" }
q248636
MainForm.perform_action
train
def perform_action(self, action): """ Perform actions in the api from the CLI """ form = ToolForm s_action = form_action = action.split('_')[0] form_name = s_action.title() + ' tools' cores = False a_type = 'containers' forms = [action.upper() + 'TOOLS'] f...
python
{ "resource": "" }
q248637
MainForm.system_commands
train
def system_commands(self, action): """ Perform system commands """ if action == 'backup': status = self.api_action.backup() if status[0]: notify_confirm('Vent backup successful') else: notify_confirm('Vent backup could not be completed'...
python
{ "resource": "" }
q248638
Logger
train
def Logger(name, **kargs): """ Create and return logger """ path_dirs = PathDirs(**kargs) logging.captureWarnings(True) logger = logging.getLogger(name) logger.setLevel(logging.INFO) handler = logging.handlers.WatchedFileHandler(os.path.join(
python
{ "resource": "" }
q248639
EditorForm.create
train
def create(self): """ Create multi-line widget for editing """ # add various pointers to those editing vent_cfg if self.vent_cfg: self.add(npyscreen.Textfield, value='# when configuring external' ' services make sure to do so', ...
python
{ "resource": "" }
q248640
locate_arcgis
train
def locate_arcgis(): ''' Find the path to the ArcGIS Desktop installation. Keys to check: HLKM/SOFTWARE/ESRI/ArcGIS 'RealVersion' - will give the version, then we can use that to go to HKLM/SOFTWARE/ESRI/DesktopXX.X 'InstallDir'. Where XX.X is the version We may need to check HKLM/SOFTWARE/Wow6432Node/...
python
{ "resource": "" }
q248641
SpiderQueue.pop
train
def pop(self): """Pop a request""" method_frame, header, body = self.server.basic_get(queue=self.key)
python
{ "resource": "" }
q248642
change_dir
train
def change_dir(): """Change the local directory if the HADOOPY_CHDIR environmental variable is provided""" try: d = os.environ['HADOOPY_CHDIR'] sys.stderr.write('HADOOPY: Trying to chdir to [%s]\n' % d) except KeyError: pass else:
python
{ "resource": "" }
q248643
disable_stdout_buffering
train
def disable_stdout_buffering(): """This turns off stdout buffering so that outputs are immediately materialized and log messages show up before the program exits""" stdout_orig = sys.stdout sys.stdout
python
{ "resource": "" }
q248644
counter
train
def counter(group, counter, amount=1, err=None): """Output a counter update that is displayed in the Hadoop web interface Counters are useful for quickly identifying the number of times an error occurred, current progress, or coarse statistics. :param group: Counter group :param counter: Counter n...
python
{ "resource": "" }
q248645
MachOHeader.rewriteInstallNameCommand
train
def rewriteInstallNameCommand(self, loadcmd): """Rewrite the load command of this dylib""" if self.id_cmd is not None:
python
{ "resource": "" }
q248646
MachOHeader.rewriteLoadCommands
train
def rewriteLoadCommands(self, changefunc): """ Rewrite the load commands based upon a change dictionary """ data = changefunc(self.parent.filename) changed = False if data is not None: if self.rewriteInstallNameCommand( data.encode(sys.getf...
python
{ "resource": "" }
q248647
sizeof
train
def sizeof(s): """ Return the size of an object when packed """ if hasattr(s, '_size_'): return s._size_ elif
python
{ "resource": "" }
q248648
pypackable
train
def pypackable(name, pytype, format): """ Create a "mix-in" class with a python type and a Packable with the given struct format """ size, items = _formatinfo(format)
python
{ "resource": "" }
q248649
_formatinfo
train
def _formatinfo(format): """ Calculate the size and number of items in a struct
python
{ "resource": "" }
q248650
addSuffixToExtensions
train
def addSuffixToExtensions(toc): """ Returns a new TOC with proper library suffix for EXTENSION items. """ new_toc = TOC() for inm, fnm, typ in toc: if typ in ('EXTENSION', 'DEPENDENCY'): binext = os.path.splitext(fnm)[1]
python
{ "resource": "" }
q248651
_check_guts_eq
train
def _check_guts_eq(attr, old, new, last_build): """ rebuild is required if values differ """ if old != new:
python
{ "resource": "" }
q248652
_check_guts_toc_mtime
train
def _check_guts_toc_mtime(attr, old, toc, last_build, pyc=0): """ rebuild is required if mtimes of files listed in old toc are newer than ast_build if pyc=1, check for .py files, too """ for (nm, fnm, typ) in old: if mtime(fnm) > last_build: logger.info("building because
python
{ "resource": "" }
q248653
_check_guts_toc
train
def _check_guts_toc(attr, old, toc, last_build, pyc=0): """ rebuild is required if either toc content changed if mtimes of files listed in old toc are newer than ast_build if pyc=1, check for .py files,
python
{ "resource": "" }
q248654
set_dependencies
train
def set_dependencies(analysis, dependencies, path): """ Syncronize the Analysis result with the needed dependencies. """ for toc in (analysis.binaries, analysis.datas): for i, tpl in enumerate(toc): if not tpl[1] in dependencies.keys(): logger.info("Adding dependency...
python
{ "resource": "" }
q248655
Target.get_guts
train
def get_guts(self, last_build, missing='missing or bad'): """ returns None if guts have changed """ try: data = _load_data(self.out) except: logger.info("building because %s %s", os.path.basename(self.out), missing) return None if len(...
python
{ "resource": "" }
q248656
Analysis.fixMissingPythonLib
train
def fixMissingPythonLib(self, binaries): """Add the Python library if missing from the binaries. Some linux distributions (e.g. debian-based) statically build the Python executable to the libpython, so bindepend doesn't include it in its output. Darwin custom builds could possi...
python
{ "resource": "" }
q248657
gen_random_key
train
def gen_random_key(size=32): """ Generate a cryptographically-secure random key. This is done by using Python 2.4's os.urandom, or PyCrypto. """ import os if hasattr(os, "urandom"): # Python 2.4+ return os.urandom(size) # Try using PyCrypto if available try: from Crypto....
python
{ "resource": "" }
q248658
Dot.display
train
def display(self, mode='dot'): ''' Displays the current graph via dotty ''' if mode == 'neato': self.save_dot(self.temp_neo) neato_cmd = "%s -o %s %s" % (self.neato, self.temp_dot, self.temp_neo) os.system(neato_cmd)
python
{ "resource": "" }
q248659
Dot.node_style
train
def node_style(self, node, **kwargs): ''' Modifies a node style to the dot representation. '''
python
{ "resource": "" }
q248660
Dot.all_node_style
train
def all_node_style(self, **kwargs): ''' Modifies all node styles '''
python
{ "resource": "" }
q248661
Dot.edge_style
train
def edge_style(self, head, tail, **kwargs): ''' Modifies an edge style to the dot representation. ''' if tail not in self.nodes: raise GraphError("invalid node %s" % (tail,)) try: if tail not in self.edges[head]:
python
{ "resource": "" }
q248662
Dot.save_dot
train
def save_dot(self, file_name=None): ''' Saves the current graph representation into a file ''' if not file_name: warnings.warn(DeprecationWarning, "always pass
python
{ "resource": "" }
q248663
Dot.save_img
train
def save_img(self, file_name=None, file_type="gif", mode='dot'): ''' Saves the dot file as an image file ''' if not file_name: warnings.warn(DeprecationWarning, "always pass a file_name") file_name = "out" if mode == 'neato': self.save_dot(s...
python
{ "resource": "" }
q248664
get_repo_revision
train
def get_repo_revision(): ''' Returns mercurial revision string somelike `hg identify` does. Format is rev1:short-id1+;rev2:short-id2+ Returns an empty string if anything goes wrong, such as missing .hg files or an unexpected format of internal HG files or no mercurial repository found. '''...
python
{ "resource": "" }
q248665
Reducer.reduce
train
def reduce(self, key, values): """Select the image with the minimum distance Args: key: (see mapper) values: (see mapper) Yields: A tuple in the form of (key, value) key: Image name
python
{ "resource": "" }
q248666
Archive.checkmagic
train
def checkmagic(self): """ Overridable. Check to see if the file object self.lib actually has a file we understand. """ self.lib.seek(self.start) # default - magic is at start of file if self.lib.read(len(self.MAGIC)) != self.MAGIC: raise ArchiveReadE...
python
{ "resource": "" }
q248667
Archive.update_headers
train
def update_headers(self, tocpos): """ Default - MAGIC + Python's magic + tocpos """ self.lib.seek(self.start) self.lib.write(self.MAGIC)
python
{ "resource": "" }
q248668
flipwritable
train
def flipwritable(fn, mode=None): """ Flip the writability of a file and return the old mode. Returns None if the file is already writable. """ if os.access(fn, os.W_OK):
python
{ "resource": "" }
q248669
mergecopy
train
def mergecopy(src, dest): """ copy2, but only if the destination isn't up to date """
python
{ "resource": "" }
q248670
sdk_normalize
train
def sdk_normalize(filename): """ Normalize a path to strip out the SDK portion, normally so that it can be decided whether it is in a system path or not. """ if filename.startswith('/Developer/SDKs/'):
python
{ "resource": "" }
q248671
in_system_path
train
def in_system_path(filename): """ Return True if the file is in a system path """ fn = sdk_normalize(os.path.realpath(filename)) if fn.startswith('/usr/local/'): return False
python
{ "resource": "" }
q248672
is_platform_file
train
def is_platform_file(path): """ Return True if the file is Mach-O """ if not os.path.exists(path) or os.path.islink(path): return False # If the header is fat, we need to read into the first arch fileobj = open(path, 'rb') bytes = fileobj.read(MAGIC_LEN) if bytes == FAT_MAGIC_BYT...
python
{ "resource": "" }
q248673
iter_platform_files
train
def iter_platform_files(dst): """ Walk a directory and yield each full path that is a Mach-O file """ for root, dirs, files in os.walk(dst): for fn in files: fn
python
{ "resource": "" }
q248674
strip_files
train
def strip_files(files, argv_max=(256 * 1024)): """ Strip a list of files """ tostrip = [(fn, flipwritable(fn)) for fn in files] while tostrip: cmd = list(STRIPCMD) flips = [] pathlen = reduce(operator.add, [len(s) + 1 for s in cmd]) while pathlen < argv_max: ...
python
{ "resource": "" }
q248675
check_call
train
def check_call(*popenargs, **kwargs): """Run command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute. The arguments are the same as for the...
python
{ "resource": "" }
q248676
__exec_python_cmd
train
def __exec_python_cmd(cmd): """ Executes an externally spawned Python interpreter and returns anything that was emitted in the standard output as a single string. """ # Prepend PYTHONPATH with pathex pp = os.pathsep.join(PyInstaller.__pathex__) old_pp = compat.getenv('PYTHONPATH') if...
python
{ "resource": "" }
q248677
exec_script
train
def exec_script(scriptfilename, *args): """ Executes a Python script in an externally spawned interpreter, and returns anything that was emitted in the standard output as a single string. To prevent missuse, the script passed to hookutils.exec-script must be located in the
python
{ "resource": "" }
q248678
qt4_plugins_binaries
train
def qt4_plugins_binaries(plugin_type): """Return list of dynamic libraries formated for mod.binaries.""" binaries = [] pdir = qt4_plugins_dir() files = misc.dlls_in_dir(os.path.join(pdir, plugin_type)) for f in files:
python
{ "resource": "" }
q248679
qt4_menu_nib_dir
train
def qt4_menu_nib_dir(): """Return path to Qt resource dir qt_menu.nib.""" menu_dir = '' # Detect MacPorts prefix (usually /opt/local). # Suppose that PyInstaller is using python from macports. macports_prefix = sys.executable.split('/Library')[0] # list of directories where to look for qt_menu.n...
python
{ "resource": "" }
q248680
dyld_find
train
def dyld_find(name, executable_path=None, env=None): """ Find a library or framework using dyld semantics """ name = _ensure_utf8(name) executable_path = _ensure_utf8(executable_path) for path in dyld_image_suffix_search(chain( dyld_override_search(name, env), dyl...
python
{ "resource": "" }
q248681
framework_find
train
def framework_find(fn, executable_path=None, env=None): """ Find a framework using dyld semantics in a very loose manner. Will take input such as: Python Python.framework Python.framework/Versions/Current """ try: return dyld_find(fn, executable_path=executable_path,...
python
{ "resource": "" }
q248682
get_repo_revision
train
def get_repo_revision(): ''' Returns SVN revision number. Returns 0 if anything goes wrong, such as missing .svn files or an unexpected format of internal SVN files or folder is not a svn working copy. See http://stackoverflow.com/questions/1449935/getting-svn-revision-number-into-a-program-au...
python
{ "resource": "" }
q248683
get_system_path
train
def get_system_path(): """Return the path that Windows will search for dlls.""" _bpath = [] if is_win: try: import win32api except ImportError: logger.warn("Cannot determine your Windows or System directories") logger.warn("Please add them to your PATH if ...
python
{ "resource": "" }
q248684
getFirstChildElementByTagName
train
def getFirstChildElementByTagName(self, tagName): """ Return the first element of type tagName if found, else None """ for child in self.childNodes:
python
{ "resource": "" }
q248685
GetManifestResources
train
def GetManifestResources(filename, names=None, languages=None): """ Get manifest resources from file """
python
{ "resource": "" }
q248686
UpdateManifestResourcesFromXML
train
def UpdateManifestResourcesFromXML(dstpath, xmlstr, names=None, languages=None): """ Update or add manifest XML as resource in dstpath """ logger.info("Updating manifest in %s", dstpath) if dstpath.lower().endswith(".exe"): name = 1 else:
python
{ "resource": "" }
q248687
UpdateManifestResourcesFromXMLFile
train
def UpdateManifestResourcesFromXMLFile(dstpath, srcpath, names=None, languages=None): """ Update or add manifest XML from srcpath as resource in dstpath """ logger.info("Updating manifest from %s in %s", srcpath, dstpath) if dstpath.lower().endswith(".exe"): n...
python
{ "resource": "" }
q248688
create_manifest
train
def create_manifest(filename, manifest, console): """ Create assembly manifest. """ if not manifest: manifest = ManifestFromXMLFile(filename) # /path/NAME.exe.manifest - split extension twice to get NAME. name = os.path.basename(filename) manifest.name = os.path.splitext(...
python
{ "resource": "" }
q248689
Manifest.add_file
train
def add_file(self, name="", hashalg="", hash="", comClasses=None, typelibs=None, comInterfaceProxyStubs=None, windowClasses=None): """ Shortcut for manifest.files.append """
python
{ "resource": "" }
q248690
Manifest.getid
train
def getid(self, language=None, version=None): """ Return an identification string which uniquely names a manifest. This string is a combination of the manifest's processorArchitecture, name, publicKeyToken, version and language. Arguments: version (tuple or lis...
python
{ "resource": "" }
q248691
Manifest.getpolicyid
train
def getpolicyid(self, fuzzy=True, language=None, windowsversion=None): """ Return an identification string which can be used to find a policy. This string is a combination of the manifest's processorArchitecture, major and minor version, name, publicKeyToken and language. ...
python
{ "resource": "" }
q248692
Manifest.parse
train
def parse(self, filename_or_file, initialize=True): """ Load manifest from file or file object """ if isinstance(filename_or_file, (str, unicode)): filename = filename_or_file else: filename = filename_or_file.name try: domtree = minidom.parse(filename...
python
{ "resource": "" }
q248693
Manifest.parse_string
train
def parse_string(self, xmlstr, initialize=True): """ Load manifest from XML string """ try:
python
{ "resource": "" }
q248694
Manifest.same_id
train
def same_id(self, manifest, skip_version_check=False): """ Return a bool indicating if another manifest has the same identitiy. This is done by comparing language, name, processorArchitecture, publicKeyToken, type and version. """ if skip_version_check:...
python
{ "resource": "" }
q248695
Manifest.toprettyxml
train
def toprettyxml(self, indent=" ", newl=os.linesep, encoding="UTF-8"): """ Return the manifest as pretty-printed XML """ domtree = self.todom() # WARNING: The XML declaration has to follow the order # version-encoding-standalone (standalone being optional), otherwise # if it is...
python
{ "resource": "" }
q248696
Manifest.toxml
train
def toxml(self, encoding="UTF-8"): """ Return the manifest as XML """ domtree = self.todom() # WARNING: The XML declaration has to follow the order # version-encoding-standalone (standalone being optional), otherwise # if it is embedded in an exe the exe will fail to launch! ...
python
{ "resource": "" }
q248697
launch_local
train
def launch_local(in_name, out_name, script_path, poll=None, max_input=None, files=(), cmdenvs=(), pipe=True, python_cmd='python', remove_tempdir=True, identity_mapper=False, num_reducers=None, **kw): """A simple local emulation of hadoop This doesn't run hadoo...
python
{ "resource": "" }
q248698
getfullnameof
train
def getfullnameof(mod, xtrapath=None): """ Return the full path name of MOD. MOD is the basename of a dll or pyd. XTRAPATH is a path or list of paths to search first. Return the full path name of MOD. Will search the full Windows search path, as well as sys.path """ # Search sys.path fi...
python
{ "resource": "" }
q248699
Dependencies
train
def Dependencies(lTOC, xtrapath=None, manifest=None): """ Expand LTOC to include all the closure of binary dependencies. LTOC is a logical table of contents, ie, a seq of tuples (name, path). Return LTOC expanded by all the binary dependencies of the entries in LTOC, except those listed in the modu...
python
{ "resource": "" }