import industry_code
338902
def __industry_code(self):
        '''  '''
        csv_path = os.path.join(os.path.dirname(__file__),
                self.industry_code_files)
        with open(csv_path) as csv_file:
            csv_data = csv.reader(csv_file)
            result = {}
            for i in csv_data:
                result[i[0]] = i[1].decode('utf-8')
            return result
1325758
function Importer(opts) {
  var self = this;
  opts = opts || {};
  EventEmitter.call(this);
  this.cwd = opts.cwd ? path.resolve(opts.cwd) : process.cwd();
  this.file = opts.file ? path.resolve(opts.cwd, opts.file) : this.cwd;
  this.data = opts.data;
  this.includePaths = opts.includePaths || [];

  // Map all include paths to configured working directory:
  this.includePaths = this.includePaths.map(function(includePath) {
    return path.resolve(self.cwd, includePath);
  });
}
60503
def inject_python_code(fpath, patch_code, tag=None,
                       inject_location='after_imports'):
    
    import utool as ut
    assert tag is not None, 'TAG MUST BE SPECIFIED IN INJECTED CODETEXT'
    text = ut.read_from(fpath)
    comment_start_tag = '# <util_inject:%s>' % tag
    comment_end_tag  = '# </util_inject:%s>' % tag

    tagstart_txtpos = text.find(comment_start_tag)
    tagend_txtpos = text.find(comment_end_tag)

    text_lines = ut.split_python_text_into_lines(text)

    # split the file into two parts and inject code between them
    if tagstart_txtpos != -1 or tagend_txtpos != -1:
        assert tagstart_txtpos != -1, 'both tags must not be found'
        assert tagend_txtpos != -1, 'both tags must not be found'

        for pos, line in enumerate(text_lines):
            if line.startswith(comment_start_tag):
                tagstart_pos = pos
            if line.startswith(comment_end_tag):
                tagend_pos = pos
        part1 = text_lines[0:tagstart_pos]
        part2 = text_lines[tagend_pos + 1:]
    else:
        if inject_location == 'after_imports':
            first_nonimport_pos = 0
            for line in text_lines:
                list_ = ['import ', 'from ', '#', ' ']
                isvalid = (len(line) == 0 or
                           any(line.startswith(str_) for str_ in list_))
                if not isvalid:
                    break
                first_nonimport_pos += 1
            part1 = text_lines[0:first_nonimport_pos]
            part2 = text_lines[first_nonimport_pos:]
        else:
            raise AssertionError('Unknown inject location')

    newtext = (
        '\n'.join(part1 + [comment_start_tag]) +
        '\n' + patch_code + '\n' +
        '\n'.join( [comment_end_tag] + part2)
    )
    text_backup_fname = fpath + '.' + ut.get_timestamp() + '.bak'
    ut.write_to(text_backup_fname, text)
    ut.write_to(fpath, newtext)
41813
private void genImportCode(ClassCode code) {
        code.importClass("java.util.*");
        code.importClass("java.io.IOException");
        code.importClass("java.lang.reflect.*");
        code.importClass("com.baidu.bjf.remoting.protobuf.code.*");
        code.importClass("com.baidu.bjf.remoting.protobuf.utils.*");
        code.importClass("com.baidu.bjf.remoting.protobuf.*");
        code.importClass("com.google.protobuf.*");

        if (!StringUtils.isEmpty(getPackage())) {
            code.importClass(ClassHelper.getInternalName(cls.getCanonicalName()));
        }
    }
350558
private function importLine()
    {
        $import = false;
        $from = false;
        while (!$this->eol()) {
            $c = $this->peek();
            $tok = null;
            $m = null;

            if ($c === '\\') {
                $m = $this->get(2);
            } elseif ($this->scan('/[,\\.;\\*]+/')) {
                $tok = 'OPERATOR';
            } elseif ($this->scan("/[ \t]+/")) {
            } elseif (($m = $this->scan('/import\\b|from\\b/'))) {
                if ($m === 'import') {
                    $import = true;
                } elseif ($m === 'from') {
                    $from = true;
                } else {
                    assert(0);
                }
                $tok = 'IDENT';
            } elseif ($this->scan('/[_a-zA-Z]\w*/')) {
                assert($from || $import);
                if ($import) {
                    // from module import *item*, or just import *item*
                    $tok = 'USER_FUNCTION';
                    $this->userDefs[$this->match()] = 'TYPE';
                } else {
                    // from *module* ...[import item], the module is not imported
                    $tok = 'IDENT';
                }
            } else {
                break;
            }
            $this->record(($m !== null) ? $m : $this->match(), $tok);
        }
    }
1094324
private void genImportCode() {
        Set<String> imports = new HashSet<String>();
        imports.add("java.util.*");
        imports.add("java.io.IOException");
        imports.add("java.lang.reflect.*");
        imports.add("com.baidu.bjf.remoting.protobuf.code.*");
        imports.add("com.baidu.bjf.remoting.protobuf.utils.*");
        imports.add("com.baidu.bjf.remoting.protobuf.*");
        imports.add("com.google.protobuf.*");

        if (!StringUtils.isEmpty(getPackage())) {
            imports.add(getTargetProxyClassname());
        }

        for (String pkg : imports) {
            templator.setVariable("importPackage", pkg);
            templator.addBlock("imports");
        }
    }
815506
private function triggerTweakwiseImport()
    {
        $apiImportUrl = $this->config->getApiImportUrl();
        if (empty($apiImportUrl)) {
            $this->log->debug('TW import not triggered, no api import url defined.');
            return;
        }

        try {
            $client = new HttpClient($apiImportUrl);
            $client->send();
            $this->log->debug('TW import triggered');
        } catch (HttpClient\Exception\ExceptionInterface $e) {
            $this->log->error(sprintf('Trigger TW import failed due to %s', $e->getMessage()));
        }
    }
956174
def dynamic_import(import_string):
    
    # Use rfind rather than rsplit for Python 2.3 compatibility.
    lastdot = import_string.rfind('.')
    if lastdot == -1:
        return __import__(import_string, {}, {}, [])
    module_name, attr = import_string[:lastdot], import_string[lastdot + 1:]
    parent_module = __import__(module_name, {}, {}, [attr])
    return getattr(parent_module, attr)
537733
def load_scripts():
    ''''''
    # Add scrypture package package to the path before importing
    # so everything can import everything else regardless of package
    scrypture_dir = os.path.realpath(
                         os.path.abspath(
                           os.path.split(
                             inspect.getfile( inspect.currentframe() ))[0]))

    if scrypture_dir not in sys.path:
        sys.path.insert(0, scrypture_dir)

    # Load list of registered scripts
    registered_scripts = app.config['REGISTERED_SCRIPTS']

    for script in registered_scripts:
        try:
            s = import_module('.'+script,
                package=os.path.split(app.config['SCRIPTS_DIR'])[-1])
            s.package = s.__name__.split('.')[1]
            #remove package from script name:
            script_name = script.split('.')[-1]
            registered_modules[script_name] = s
        except Exception as e:
            logging.warning('Could not import ' + \
                            str(script)+': '+str(e.message))
            logging.debug(str(traceback.format_exc()))
            continue
1357651
function locateCodeImport(value, fromIndex) {
  var index = value.indexOf(C_NEWLINE, fromIndex);

  if (value.charAt(index + 1) !== "<" && value.charAt(index + 2) !== "<") {
    return;
  }

  return index;
}
1209584
def do_import(self, line):
        """"""

        line = line.split()

        if line and line[0] == "starter-pack":
            actions.action_bootstrap()

        elif line and line[0] == "uri":
            self._print(
                "------------------\nEnter a valid graph URI: (e.g. http://www.w3.org/2009/08/skos-reference/skos.rdf)")
            var = input()
            if var:
                if var.startswith("http"):
                    try:
                        actions.action_import(var)
                    except:
                        self._print(
                            "OPS... An Unknown Error Occurred - Aborting installation of <%s>" % var)
                else:
                    self._print("Not valid. TIP: URIs should start with 'http://'")

        elif line and line[0] == "file":
            self._print(
                "------------------\nEnter a full file path: (e.g. '/Users/mike/Desktop/journals.ttl')")
            var = input()
            if var:
                try:
                    actions.action_import(var)
                except:
                    self._print(
                        "OPS... An Unknown Error Occurred - Aborting installation of <%s>" % var)

        elif line and line[0] == "repo":
            actions.action_webimport()

        else:
            self.help_import()

        self.all_ontologies = manager.get_localontologies()
        return
1075513
def get_imported_modules(cells, nb_module_name=''):
    ""
    module_names = get_top_level_modules()
    nb_imports = [match.group(1) for cell in cells for match in IMPORT_RE.finditer(cell['source']) if cell['cell_type'] == 'code']
    parts = nb_module_name.split('.')
    parent_modules = ['.'.join(parts[:(x+1)]) for x in range_of(parts)] # Imports parent modules - a.b.c = [a, a.b, a.b.c]
    all_modules = module_names + nb_imports + parent_modules
    mods = [import_mod(m, ignore_errors=True) for m in all_modules]
    return [m for m in mods if m is not None]
848170
def _do_import(self, rule, p_selectors, p_parents, p_children, scope, media, c_lineno, c_property, c_codestr, code, name):
        
        i_codestr = None
        if '..' not in name and '://' not in name and 'url(' not in name:  # Protect against going to prohibited places...
            names = name.split(',')
            for name in names:
                name = dequote(name.strip())
                if '@import ' + name not in rule[OPTIONS]:  # If already imported in this scope, skip...
                    try:
                        raise KeyError
                        i_codestr = self._scss_files[name]
                    except KeyError:
                        filename = os.path.basename(name)
                        dirname = os.path.dirname(name)
                        load_paths = []
                        i_codestr = None
                        for path in ['./'] + LOAD_PATHS.split(','):
                            for basepath in ['./', os.path.dirname(rule[PATH])]:
                                i_codestr = None
                                full_path = os.path.realpath(
                                    os.path.join(path, basepath, dirname))
                                if full_path not in load_paths:
                                    try:
                                        full_filename = os.path.join(full_path,
                                                                     '_' + filename + '.scss')
                                        i_codestr = open(full_filename).read()
                                    except:
                                        try:
                                            full_filename = os.path.join(
                                                full_path, filename + '.scss')
                                            i_codestr = open(
                                                full_filename).read()
                                        except:
                                            try:
                                                full_filename = os.path.join(
                                                    full_path, '_' + filename)
                                                i_codestr = open(
                                                    full_filename).read()
                                            except:
                                                try:
                                                    full_filename = os.path.join(
                                                        full_path, filename)
                                                    i_codestr = open(
                                                        full_filename).read()
                                                except:
                                                    pass
                                    if i_codestr is not None:
                                        break
                                    else:
                                        load_paths.append(full_path)
                            if i_codestr is not None:
                                break
                        if i_codestr is None:
                            i_codestr = self._do_magic_import(rule, p_selectors, p_parents, p_children, scope, media, c_lineno, c_property, c_codestr, code, name)
                        i_codestr = self._scss_files[name] = i_codestr and self.load_string(
                            i_codestr, full_filename)
                    if i_codestr is None:
                        log.warn("File to import not found or unreadable: '%s'\nLoad paths:\n\t%s",
                                 filename, "\n\t".join(load_paths))
                    else:
                        _rule = spawn_rule(rule, codestr=i_codestr,
                                           path=full_filename, lineno=c_lineno)
                        self.manage_children(_rule,
                                             p_selectors, p_parents, p_children, scope, media)
                        rule[OPTIONS]['@import ' + name] = True
        else:
            rule[PROPERTIES].append((c_lineno, c_property, None))
362765
private CourierImportDeclarations addNthImport(CourierImportDeclaration importDecl) {
    CourierTopLevel root = getRoot();
    CourierImportDeclarations importDecls = root.getImportDeclarations();
    if (importDecl.getFullname() == null) {
      return importDecls;
    }

    boolean added = false;
    for (CourierImportDeclaration existing : importDecls.getImportDeclarationList()) {
      if (existing.getFullname() != null && importDecl.getFullname().toString().compareTo(existing.getFullname().toString()) < 0) {
        importDecls.addBefore(importDecl, existing);
        added = true;
        break;
      }
    }
    if (!added) {
      importDecls.add(importDecl);
    }
    return importDecls;
  }
615569
def generate_import_from(module_, names):
        
        regular_names = [n for n in names if "::" not in n]
        as_names = [n for n in names if "::" in n]

        line = ""
        if len(regular_names) > 0:
            slots = {"m": module_, "n": ", ".join(sorted(regular_names))}
            line = "from %(m)s import %(n)s" % slots
            if len(line) > LINE_LENGTH_LIMIT:
                slots["n"] = INDENT + (",\n" + INDENT).join(sorted(regular_names)) + ","
                line = "from %(m)s import (\n%(n)s\n)" % slots
            if len(as_names) > 0:
                line += "\n"

        for as_name in as_names:
            a, n = as_name.split("::")
            line += "from %(m)s import %(n)s as %(a)s" % {"m": module_, "n": n, "a": a}
        return line
1122673
function getPythonCode(options) {
    var pythonCode = [],
        internalPylint = !options.externalPylint,
        pylintPath = path.join(__dirname, 'lib'),
        initHook = options.initHook;
    delete options.initHook;

    if (initHook) {
      pythonCode.push(initHook);
    }

    if (internalPylint) {
      pythonCode.push('import sys', 'sys.path.insert(0, r"' + pylintPath + '")');
    }

    pythonCode.push('import pylint', 'pylint.run_pylint()');
    delete options.externalPylint;
    return pythonCode.join('; ');
  }
956649
private void writeImports() {

    for (String importType : importTypes) {
      writer.append("import %s;", importType).eol();
    }
    writer.eol();
  }