Import a file

        :returns: None
        :rtype: None
        :raises: NotImplementedError
773761
def import_file(self, ):
        
        tfi = self.get_taskfileinfo_selection()
        if tfi:
            self.reftrack.import_file(tfi)
490345
def import_numpy():
    
    try:
        imp.find_module('numpy')
        numpy_exists = True
    except ImportError:
        numpy_exists = False

    if numpy_exists:
        # We do this outside of try/except block in case numpy exists
        # but is not installed correctly. We do not want to catch an
        # incorrect installation which would manifest as an
        # ImportError.
        import numpy as np
    else:
        np = None

    return np
651050
def get_imported_module_from_file(file_path):
        
        if p_compat.is_py3:
            imported_module = importlib.machinery.SourceFileLoader('module_name', file_path).load_module()
        elif p_compat.is_py2:
            imported_module = imp.load_source('module_name', file_path)
        else:
            raise RuntimeError("Neither Python 3 nor Python 2.")
    
        return imported_module
846301
def process_import(self, request, *args, **kwargs):
        
        if not self.has_import_permission(request):
            raise PermissionDenied

        form_type = self.get_confirm_import_form()
        confirm_form = form_type(request.POST)
        if confirm_form.is_valid():
            import_formats = self.get_import_formats()
            input_format = import_formats[
                int(confirm_form.cleaned_data['input_format'])
            ]()
            tmp_storage = self.get_tmp_storage_class()(name=confirm_form.cleaned_data['import_file_name'])
            data = tmp_storage.read(input_format.get_read_mode())
            if not input_format.is_binary() and self.from_encoding:
                data = force_text(data, self.from_encoding)
            dataset = input_format.create_dataset(data)

            result = self.process_dataset(dataset, confirm_form, request, *args, **kwargs)

            tmp_storage.remove()

            return self.process_result(result, request)
465151
def import_file(filename, package_name=None):
    
    path = os.path.dirname(filename)

    if not path in sys.path:
        sys.path.append( path )
        remove_path = True

    else:
        remove_path = False

    name = os.path.splitext(os.path.basename(filename))[0]

    if name in sys.modules:
        force_reload = True
    else:
        force_reload = False


    if package_name is not None:
        mod = __import__('.'.join((package_name, name)), fromlist=[name])

    else:
        mod = __import__(name)

    if force_reload:
        reload(mod)

    if remove_path:
        sys.path.pop(-1)

    return mod
1134846
def can_import(self, file_uris, current_doc=None):
        
        if len(file_uris) <= 0:
            return False
        for file_uri in file_uris:
            file_uri = self.fs.safe(file_uri)
            if not self.check_file_type(file_uri):
                return False
        return True
1101884
def can_import(self, file_uris, current_doc=None):
        
        if len(file_uris) <= 0:
            return False
        for uri in file_uris:
            uri = self.fs.safe(uri)
            if not self.check_file_type(uri):
                return False
        return True
1217713
def get_file(self, filename):
        """"""
        import linecache
        # Hack for frozen importlib bootstrap
        if filename == '<frozen importlib._bootstrap>':
            filename = os.path.join(
                os.path.dirname(linecache.__file__), 'importlib',
                '_bootstrap.py'
            )
        return to_unicode_string(
            ''.join(linecache.getlines(filename)), filename
        )
1147779
def import_file(filename):
    
    #file_path = os.path.relpath(filename)
    file_path = os.path.abspath(filename)
    log(DEBUG, "Loading prices from %s", file_path)

    prices = __read_prices_from_file(file_path)
    with BookAggregate(for_writing=True) as svc:
        svc.prices.import_prices(prices)

        print("Saving book...")
        svc.book.save()
1324621
def __import_file(self, f):
        
        directory, module_name = os.path.split(f)
        module_name = os.path.splitext(module_name)[0]

        path = list(sys.path)
        sys.path.insert(0, directory)
        module = __import__(module_name)
        return module
478090
def import_from(name):
    
    obj = name
    if isinstance(name, str) and len(name):
        try:
            obj = locate(name)
            assert obj is not None
        except (AttributeError, TypeError, AssertionError, ErrorDuringImport):
            try:
                name = name.split(".")
                attr = name[-1]
                name = ".".join(name[:-1])
                mod = importlib.import_module(name)
                obj = getattr(mod, attr)
            except (SyntaxError, AttributeError, ImportError, ValueError):
                try:
                    name = name.split(".")
                    attr_sup = name[-1]
                    name = ".".join(name[:-1])
                    mod = importlib.import_module(name)
                    obj = getattr(getattr(mod, attr_sup), attr)
                except:
                    # We give up.
                    pass

    obj = unwrap_obj(obj)
    return obj
507613
function import_file()
    {
        $uid     = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST);
        $mbox    = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST);
        $mime_id = rcube_utils::get_input_value('_part', rcube_utils::INPUT_POST);
        $storage = $this->rc->get_storage();
        $engine  = $this->enigma->load_engine();

        if ($uid && $mime_id) {
            // Note: we get the attachment body via rcube_message class
            // to support keys inside encrypted messages (#5285)
            $message = new rcube_message($uid, $mbox);

            // Check if we don't need to ask for password again
            foreach ($engine->decryptions as $status) {
                if ($status instanceof enigma_error) {
                    if ($status->getCode() == enigma_error::BADPASS) {
                        $this->password_prompt($status, array(
                                'input_uid'    => $uid,
                                'input_mbox'   => $mbox,
                                'input_part'   => $mime_id,
                                'input_task'   => 'mail',
                                'input_action' => 'plugin.enigmaimport',
                                'action'       => '?',
                                'iframe'       => true,
                        ));
                        $this->rc->output->send($this->rc->output->type == 'html' ? 'iframe' : null);
                        return;
                    }
                }
            }

            if ($engine->is_keys_part($message->mime_parts[$mime_id])) {
                $part = $message->get_part_body($mime_id);
            }
        }

        if ($part && is_array($result = $engine->import_key($part))) {
            $this->rc->output->show_message('enigma.keysimportsuccess', 'confirmation',
                array('new' => $result['imported'], 'old' => $result['unchanged']));
        }
        else {
            $this->rc->output->show_message('enigma.keysimportfailed', 'error');
        }

        $this->rc->output->send($this->rc->output->type == 'html' ? 'iframe' : null);
    }
1291633
@Override
    public I importFrom(final File file, Filter<ArchivePath> filter) throws ArchiveImportException {
        Validate.notNull(file, "File must be specified");
        if (!file.exists()) {
            throw new IllegalArgumentException("Specified file for import does not exist: " + file);
        }
        if (file.isDirectory()) {
            throw new IllegalArgumentException("Specified file for import is a directory: " + file);
        }

        final S archive;
        try {
            archive = this.getInputStreamForFile(file);
        } catch (final IOException e) {
            throw new ArchiveImportException("Could not read archive file " + file, e);
        }

        return this.importFrom(archive, filter);

    }
103541
def p_import(self, p):
        ''
        p[0] = AstImport(self.path, p.lineno(1), p.lexpos(1), p[2])
362679
def get_file(self,
                 path,
                 dest='',
                 makedirs=False,
                 saltenv='base',
                 gzip=None,
                 cachedir=None):
        '''
        
        '''
        raise NotImplementedError
784931
function (file, importOptions = {}) {
        var self = this;

        // Step 1: Handle converting the file to usable data
        return this.loadFile(file).then(function (importData) {
            // Step 2: Let the importers pre-process the data
            return self.preProcess(importData);
        }).then(function (importData) {
            // Step 3: Actually do the import
            // @TODO: It would be cool to have some sort of dry run flag here
            return self.doImport(importData, importOptions);
        }).then(function (importData) {
            // Step 4: Report on the import
            return self.generateReport(importData);
        }).finally(() => self.cleanUp()); // Step 5: Cleanup any files
    }
203705
def import_file(self, file_obj, folder):
        
        created = False
        for cls in MEDIA_MODELS:
            if cls.matches_file_type(file_obj.name):

                obj, created = cls.objects.get_or_create(
                    original_filename=file_obj.name,
                    file=file_obj,
                    folder=folder,
                    is_public=FILER_IS_PUBLIC_DEFAULT)
                if created:
                    self.image_created += 1
        if not created:
            obj, created = File.objects.get_or_create(
                original_filename=file_obj.name,
                file=file_obj,
                folder=folder,
                is_public=FILER_IS_PUBLIC_DEFAULT)
            if created:
                self.file_created += 1
        if self.verbosity >= 2:
            print("file_created #%s / image_created #%s -- file : %s -- created : %s" % (self.file_created,
                                                                                         self.image_created,
                                                                                         obj, created))
        return obj