Replaces inner class imports (those with a '$') with an import of the parent class.
334032
public void swapInnerClassesForParents ()
    {
        ImportSet declarers = new ImportSet();
        Iterator<String> i = _imports.iterator();
        while (i.hasNext()) {
            String name = i.next();
            int dollar = name.indexOf('$');
            if (dollar >= 0) {
                i.remove();
                declarers.add(name.substring(0, dollar));
            }
        }

        addAll(declarers);
    }
1223071
public void importClass(final String name) {
        this.importedClasses.put(Name.suffix(name, 1), name);
        this.nameSpaceChanged();
    }
1108592
def fix_imports(script):
    
    with open(script, 'r') as f_script:
        lines = f_script.read().splitlines()
    new_lines = []
    for l in lines:
        if l.startswith("import "):
            l = "from . " + l
        if "from PyQt5 import" in l:
            l = l.replace("from PyQt5 import", "from pyqode.qt import")
        new_lines.append(l)
    with open(script, 'w') as f_script:
        f_script.write("\n".join(new_lines))
999842
def visit_Import(self, node, frame):
        """"""
        if node.with_context:
            self.unoptimize_scope(frame)
        self.writeline('l_%s = ' % node.target, node)
        if frame.toplevel:
            self.write('context.vars[%r] = ' % node.target)
        self.write('environment.get_template(')
        self.visit(node.template, frame)
        self.write(', %r).' % self.name)
        if node.with_context:
            self.write('make_module(context.parent, True, locals())')
        else:
            self.write('module')
        if frame.toplevel and not node.target.startswith('_'):
            self.writeline('context.exported_vars.discard(%r)' % node.target)
        frame.assigned_names.add(node.target)
1056343
function convertImports(imports) {
		    	for (var file in imports) {
				    if (imports.hasOwnProperty(file)) {
				        postCssInputs[file] = new Input(imports[file], file !== "input" ? { from: file } : undefined);
				    }
				}
			}
49698
def _import(self, name):
        '''  '''
        mod = __import__(name)
        components = name.split('.')
        for comp in components[1:]:
            mod = getattr(mod, comp)
        return mod
732630
function patch(parent$, partialChange) {
  setImmediate(() => {
    if (
      partialChange === null ||
      typeof partialChange !== "object" ||
      typeof parent$.value !== "object"
    ) {
      parent$(partialChange);
    } else {
      parent$(Object.assign({}, parent$.value, partialChange));
    }
  });
  return parent$;
}
1001539
def initChild(cls, obj, name, subContext, parent = None):
    """"""
    addr = statsId(obj)
    if addr not in cls.containerMap:
      if not parent:
        # Find out the parent of the calling object by going back through the call stack until a self != this.
        f = inspect.currentframe()
        while not cls.__getSelf(f):
          f = f.f_back
        this = cls.__getSelf(f)
        f = f.f_back
        while cls.__getSelf(f) == this or not cls.__getSelf(f):
          f = f.f_back
        parent = cls.__getSelf(f)

      # Default subcontext to an autoincrementing ID.
      if subContext is None:
        cls.subId += 1
        subContext = cls.subId

      if subContext is not '':
        path = '%s/%s' % (name, subContext)
      else:
        path = name

      # Now that we have the name, create an entry for this object.
      cls.parentMap[addr] = parent
      container = cls.getContainerForObject(statsId(parent))
      if not container and isinstance(parent, unittest.TestCase):
        cls.init(parent, '/test-case')
      cls.containerMap[addr] = cls.__getStatContainer(path, cls.getContainerForObject(statsId(parent)))
    return cls.containerMap[addr]
1248614
def import_object_ns(name_space, import_str, *args, **kwargs):
    
    import_value = "%s.%s" % (name_space, import_str)
    try:
        return import_class(import_value)(*args, **kwargs)
    except ImportError:
        return import_class(import_str)(*args, **kwargs)
1102737
def replace(parent, idx, value, check_value=_NO_VAL):
  """"""
  if isinstance(parent, dict):
    if idx not in parent:
      raise JSONPatchError("Item does not exist")
  elif isinstance(parent, list):
    idx = int(idx)
    if idx < 0 or idx >= len(parent):
      raise JSONPatchError("List index out of range")
  if check_value is not _NO_VAL:
    if parent[idx] != check_value:
      raise JSONPatchError("Check value did not pass")
  parent[idx] = value
219590
function parentName (options) {
  function instantiate (input) {
    if (/^[A-Z]{3}/.test(input)) {
      return input.replace(/^([A-Z]+)([A-Z])/, function (str, p1, p2) {
        return p1.toLowerCase() + p2
      })
    } else {
      return input.charAt(0).toLowerCase() + input.slice(1)
    }
  }

  /* don't bother with a parentName for exported identifiers */
  if (this.isExported) return ''

  if (this.memberof && this.kind !== 'constructor') {
    var parent = arrayify(options.data.root).find(where({ id: this.memberof }))
    if (parent) {
      if (this.scope === 'instance') {
        var name = parent.typicalname || parent.name
        return instantiate(name)
      } else if (this.scope === 'static' && !(parent.kind === 'class' || parent.kind === 'constructor')) {
        return parent.typicalname || parent.name
      } else {
        return parent.name
      }
    } else {
      return this.memberof
    }
  }
}
206517
def clazz(clazz, parent_clazz, description, link, params_string, init_super_args=None):
    
    variables_needed = []
    variables_optional = []
    imports = set()
    for param in params_string.split("\n"):
        variable = parse_param_types(param)
        # any variable.types has always_is_value => lenght must be 1.
        assert(not any([type_.always_is_value is not None for type_ in variable.types]) or len(variable.types) == 1)
        if variable.optional:
            variables_optional.append(variable)
        else:
            variables_needed.append(variable)
        # end if
        imports.update(variable.all_imports)
    # end for
    imports = list(imports)
    imports.sort()
    if isinstance(parent_clazz, str):
        parent_clazz = to_type(parent_clazz, "parent class")
    assert isinstance(parent_clazz, Type)

    clazz_object = Clazz(imports=imports,
        clazz=clazz, parent_clazz=parent_clazz, link=link, description=description,
        parameters=variables_needed, keywords=variables_optional
    )
    return clazz_object
1208294
def replace_parent(self, parent_simples):
        
        assert parent_simples

        ancestors = parent_simples[:-1]
        parent = parent_simples[-1]

        did_replace = False
        new_tokens = []
        for token in self.tokens:
            if not did_replace and token in ('&', 'self'):
                did_replace = True
                new_tokens.extend(parent.tokens)
                if token == 'self':
                    warn(FutureWarning(
                        "The xCSS 'self' selector is deprecated and will be "
                        "removed in 2.0.  Use & instead.  ({0!r})"
                        .format(self)
                    ))
            else:
                new_tokens.append(token)

        if not did_replace:
            # This simple selector doesn't contain a parent reference so just
            # stick it on the end
            return parent_simples + (self,)

        # This simple selector was merged into the direct parent.
        merged_self = type(self)(parent.combinator, new_tokens)
        selector = ancestors + (merged_self,)
        # Our combinator goes on the first ancestor, i.e., substituting "foo
        # bar baz" into "+ &.quux" produces "+ foo bar baz.quux".  This means a
        # potential conflict with the first ancestor's combinator!
        root = selector[0]
        if not _is_combinator_subset_of(self.combinator, root.combinator):
            raise ValueError(
                "Can't sub parent {0!r} into {1!r}: "
                "combinators {2!r} and {3!r} conflict!"
                .format(
                    parent_simples, self, self.combinator, root.combinator))

        root = type(self)(self.combinator, root.tokens)
        selector = (root,) + selector[1:]
        return tuple(selector)
330799
public static void convertBaseClasses (ImportSet imports)
    {
        // replace primitive types with OOO types (required for unboxing)
        imports.replace("byte", "com.threerings.util.Byte");
        imports.replace("boolean", "com.threerings.util.langBoolean");
        imports.replace("[B", "flash.utils.ByteArray");
        imports.replace("float", "com.threerings.util.Float");
        imports.replace("long", "com.threerings.util.Long");

        if (imports.removeAll("[*") > 0) {
            imports.add("com.threerings.io.TypedArray");
        }

        // convert java primitive boxes to their ooo counterparts
        imports.replace(Integer.class, "com.threerings.util.Integer");

        // convert some java.util types to their ooo counterparts
        imports.replace(Map.class, "com.threerings.util.Map");

        // get rid of java.lang stuff and any remaining primitives
        imports.removeGlobals();

        // get rid of remaining arrays
        imports.removeArrays();
    }
1166135
def import_class(import_str):
    """"""
    mod_str, _sep, class_str = import_str.rpartition(".")
    __import__(mod_str)
    return getattr(sys.modules[mod_str], class_str)
197348
function(path) {
  var importSource = path.node.source.value;
  var defaultSpecifier = path.get('specifiers')[0];
  defaultSpecifier.assertImportDefaultSpecifier();

  path.replaceWith(
    buildImportAssignment(
      defaultSpecifier.get('local').get('name').node,
      importSource
    )
  );
}
64454
function (out) {
            var tplParam = out.templateParam;
            out.writeln("module.exports = Aria.classDefinition({");
            out.increaseIndent();
            out.writeln("$classpath: ", out.stringify(tplParam.$classpath), ",");
            if (out.parentClasspath) {
                out.writeln("$extends: require(", out.stringify(Aria.getLogicalPath(out.parentClasspath, Aria.ACCEPTED_TYPES[out.parentClassType])), "),");
            }
        }