Runs the command to import an uploaded vmdk to aws ec2
        :param config_file_location: config file of import param location
        :param description: description to attach to the import task
        :return: the import task id for the given ami
543517
def run_ec2_import(self, config_file_location, description, region='us-east-1'):
        
        import_cmd = "aws ec2 import-image --description '{}' --profile '{}' --region '{}' --output 'json'" \
                     " --disk-containers file://{}"\
            .format(description, self.aws_project, region, config_file_location)
        try:
            res = subprocess.check_output(shlex.split(import_cmd), stderr=subprocess.STDOUT)
        except subprocess.CalledProcessError as e:
            print "Error importing to ec2"
            print "output: {}".format(e.output)
            sys.exit(5)

        print "got res: {}".format(res)
        res_json = json.loads(res)
        task_running, import_id = self.check_task_status_and_id(res_json)
        return import_id
699131
def create_config_file(self, vmdk_location, description):
        
        description = description
        format = "vmdk"
        user_bucket = {
            "S3Bucket": self.bucket_name,
            "S3Key": vmdk_location
        }
        parent_obj = {'Description': description, 'Format': format, 'UserBucket': user_bucket}
        obj_list = [parent_obj]

        temp_fd, temp_file = tempfile.mkstemp()
        print 'creating tmp file for {} at {}'.format(vmdk_location, temp_file)

        with os.fdopen(temp_fd, 'w') as f:
            json.dump(obj_list, f)
        return temp_fd, temp_file
686109
def update_file(finfo, sample_info, config):
    
    ffinal = filesystem.update_file(finfo, sample_info, config, pass_uptodate=True)

    _upload_dir_icommands_cli(config.get("dir"), config.get("folder"), config)
1102655
private void writeHttpImportDir(FileItem fi) throws CmsException {

        try {

            if ((fi != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(fi.getName())) {
                //write the file in the tmp-directory of the system
                byte[] content = fi.get();
                File importFile = File.createTempFile("import_html", ".zip");
                //write the content in the tmp file
                FileOutputStream fileOutput = new FileOutputStream(importFile.getAbsolutePath());
                fileOutput.write(content);
                fileOutput.close();
                fi.delete();
                m_htmlimport.setHttpDir(importFile.getAbsolutePath());
            }
        } catch (Exception e) {
            throw new CmsException(Messages.get().container(Messages.ERR_ACTION_ZIPFILE_UPLOAD_0));
        }
    }
686693
def __add_location(self, type, *args):
        

        if type == "directory":
            location = umbra.ui.common.store_last_browsed_path((QFileDialog.getExistingDirectory(self,
                                                                                                 "Add Directory:",
                                                                                                 RuntimeGlobals.last_browsed_path)))
        elif type == "file":
            location = umbra.ui.common.store_last_browsed_path((QFileDialog.getOpenFileName(self,
                                                                                            "Add File:",
                                                                                            RuntimeGlobals.last_browsed_path,
                                                                                            "All Files (*)")))
        elif type == "editors":
            location = self.__targets_format.format(self.__default_target)
        elif type == "include_filter":
            location = self.__filters_in_format.format(self.__default_filter_in)
        elif type == "exclude_filter":
            location = self.__filters_out_format.format(self.__default_filter_out)

        location and self.Where_lineEdit.setText(", ".join(filter(bool, (foundations.strings.to_string(
            self.Where_lineEdit.text()), location))))
627450
def add_location(self, location_name, parent_name=None, er_data=None, pmag_data=None):
        
        if not location_name:
            return False
        location = Location(location_name, data_model=self.data_model, er_data=er_data, pmag_data=pmag_data)
        self.locations.append(location)
        return location
447214
function configurator (location) {
  return !(location && fs.existsSync(location))
    ? {}
    : JSON.parse(
        fs.readFileSync(location, 'UTF-8')
          .replace(/\/\*[\s\S]*(?:\*\/)/g, '') // removes /* comments */
          .replace(/\/\/[^\n\r]*/g, '') // removes // comments
      );
}
741566
def upload_file(self, room_id, description, file, message, **kwargs):
        
        return UploadFile(settings=self.settings, **kwargs).call(
            room_id=room_id,
            description=description,
            file=file,
            message=message,
            **kwargs
        )
741433
private void setLocation(String _location) {

        String res = null;
        File resFile = null;

        boolean relativePath = true;
        boolean defaultPath = false;

        // try as "absolute" resource (contains symbol, or absolute path)
        try {
            res = cfgSvc.resolveString(_location);
            resFile = new File(res);
            relativePath = !resFile.isAbsolute();
        } catch (IllegalStateException e) {
            // ignore
        }

        if (resFile == null || (!resFile.isFile() && relativePath)) {
            // look for resource in server config location
            try {
                res = cfgSvc.resolveString(LibertyConstants.DEFAULT_CONFIG_LOCATION + _location);
                resFile = new File(res);
            } catch (IllegalStateException e) {
                // ignore
            }

            if (resFile == null || !resFile.isFile()) {
                // fall back to creating for resource in shared output location
                try {
                    res = cfgSvc.resolveString(LibertyConstants.DEFAULT_OUTPUT_LOCATION + _location);
                    resFile = new File(res);
                    defaultPath = true;
                } catch (IllegalStateException e) {
                    // ignore
                }
            }
        }

        // Work against the symbol in the original location
        // The original location may be been
        if (isDefault && (defaultPath || locationInOutputDir(_location))) {
            this.initializeAtStartup = true;
        }

        // reset location w/ resolved value
        // isDefault tested because the default path's file may not exists (and that's OK)
        if ((res != null && resFile.isFile()) || isDefault) {
            this.location = res;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Found store under [" + location + "]");
            }
        } else {
            // If it wasn't found then it's likely going to trigger
            // the load.error later. Issue a warning to explain the file
            // could not be found.
            Tr.warning(tc, "ssl.keystore.not.found.warning", res, name);
        }
    }
61565
def create(location: str, simpleobjects_found = None, complexobject_attributes_found = None):  # -> ObjectNotFoundOnFileSystemError:
        
        if len(complexobject_attributes_found) > 0 or len(simpleobjects_found) > 0:
            return ObjectNotFoundOnFileSystemError('Mandatory object : ' + location + ' could not be found on the file'
                                                   ' system, either as a multifile or as a singlefile with any '
                                                   'extension, but it seems that this is because you have left the '
                                                   'extension in the location name. Please remove the file extension '
                                                   'from the location name and try again')
        else:
            return ObjectNotFoundOnFileSystemError('Mandatory object : ' + location + ' could not be found on the file'
                                                   ' system, either as a multifile or as a singlefile with any '
                                                   'extension.')
233656
function writeLocationFile(location) {
  console.log('Writing location.js file')
  if (getTargetPlatform() === 'win32') {
    location = location.replace(/\\/g, '\\\\')
  }

  var platform = getTargetPlatform()
  var arch = getTargetArch()

  var contents = 'module.exports.location = "' + location + '"\n'

  if (/^[a-zA-Z0-9]*$/.test(platform) && /^[a-zA-Z0-9]*$/.test(arch)) {
    contents +=
        'module.exports.platform = "' + getTargetPlatform() + '"\n' +
        'module.exports.arch = "' + getTargetArch() + '"\n'
  }

  fs.writeFileSync(path.join(libPath, 'location.js'), contents)
}
1372830
def _load(self, location):
        
        cachedir = self._cachedir
        # wsdl2py: deal with XML Schema
        if not os.path.isdir(cachedir): os.mkdir(cachedir)
    
        file = os.path.join(cachedir, '.cache')
        section = 'TYPES'
        cp = ConfigParser()
        try:
            cp.readfp(open(file, 'r'))
        except IOError:
            del cp;  cp = None
            
        option = location.replace(':', '-') # colons seem to screw up option
        if (not self._force and cp is not None and cp.has_section(section) and 
            cp.has_option(section, option)):
            types = cp.get(section, option)
        else:
            # dont do anything to anames
            if not self._pyclass:
                containers.ContainerBase.func_aname = lambda instnc,n: str(n)
                
            args = ['-o', cachedir, location]
            if self._lazy: args.insert(0, '-l')
            if self._pyclass: args.insert(0, '-b')
            files = commands.wsdl2py(args)

            if cp is None: cp = ConfigParser()
            if not cp.has_section(section): cp.add_section(section)
            types = filter(lambda f: f.endswith('_types.py'), files)[0]
            cp.set(section, option, types)
            cp.write(open(file, 'w'))
            
        if os.path.abspath(cachedir) not in sys.path:
            sys.path.append(os.path.abspath(cachedir))
            
        mod = os.path.split(types)[-1].rstrip('.py')
        return __import__(mod)
1217756
protected void addDescription(PackageDoc pkg, Content dlTree, SearchIndexItem si) {
        Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
        si.setLabel(utils.getPackageName(pkg));
        si.setCategory(getResource("doclet.Packages").toString());
        Content dt = HtmlTree.DT(link);
        dt.addContent(" - ");
        dt.addContent(getResource("doclet.package"));
        dt.addContent(" " + pkg.name());
        dlTree.addContent(dt);
        Content dd = new HtmlTree(HtmlTag.DD);
        addSummaryComment(pkg, dd);
        dlTree.addContent(dd);
    }
515352
def import_path_to_absolute_path(import_path, file_marker):
        '''
        
        '''
        path_fragment = import_path.replace('.', os.path.sep)
        path_suffix = os.path.join(path_fragment, file_marker)
        for path_base in sys.path:
            path = os.path.join(path_base, path_suffix)
            if os.path.exists(path):
                return os.path.join(path_base, path_fragment)
        msg = 'Cannot find import path: %s, %s'
        raise ConfigurationError(msg % (import_path, file_marker))
954537
def add_tracker(wfid, action, tracker_id, conditions, msg)

      tracker_id ||= [
        'tracker', wfid, action,
        Ruote.generate_subid(conditions.hash.to_s + msg.hash.to_s)
      ].collect(&:to_s).join('_')

      conditions =
        conditions && conditions.remap { |(k, v), h| h[k] = Array(v) }

      doc = @context.storage.get_trackers

      doc['trackers'][tracker_id] =
        { 'wfid' => wfid,
          'action' => action,
          'id' => tracker_id,
          'conditions' => conditions,
          'msg' => msg }

      r = @context.storage.put(doc)

      add_tracker(wfid, action, tracker_id, conditions, msg) if r
        # the put failed, have to redo the work

      tracker_id
    end
538695
def use_file(
    filename: typing.Union[Path, str, None], trust: bool = False
) -> typing.Union[types.ModuleType, None]:
    
    config_file = filename or resolve_path(CONFIG_FILE)

    def preview_unauthorized() -> None:
        if not config_file:
            return None
        print(SEPARATOR, file=sys.stderr)
        with Path(config_file).open("r", encoding="utf-8") as fp:
            for line in fp:
                print(line, end="", file=sys.stderr)
        print(SEPARATOR, file=sys.stderr)

    if config_file and not Path(config_file).exists():
        print_error(f'"{filename}" not found.')
        sys.exit(1)
    if config_file and Path(config_file).exists():
        if not trust:
            with AuthFile.load() as authfile:
                try:
                    authfile.check(Path(config_file))
                except KonchrcChangedError:
                    print_error(f'"{config_file}" has changed since you last used it.')
                    preview_unauthorized()
                    if confirm("Would you like to authorize it?"):
                        authfile.allow(Path(config_file))
                        print()
                    else:
                        sys.exit(1)
                except KonchrcNotAuthorizedError:
                    print_error(f'"{config_file}" is blocked.')
                    preview_unauthorized()
                    if confirm("Would you like to authorize it?"):
                        authfile.allow(Path(config_file))
                        print()
                    else:
                        sys.exit(1)

        logger.info(f"Using {config_file}")
        # Ensure that relative imports are possible
        __ensure_directory_in_path(Path(config_file))
        mod = None
        try:
            mod = imp.load_source("konchrc", str(config_file))
        except UnboundLocalError:  # File not found
            pass
        else:
            return mod
    if not config_file:
        print_warning("No konch config file found.")
    else:
        print_warning(f'"{config_file}" not found.')
    return None
1181019
def set_location(self, new_location):
        
        self._load_raw_content()
        self._location = new_location
        self.get_filepath(renew=True)
        return