Returns plugin point model instance. Only used from plugin classes.
347608
def get_point_model(cls):
        
        if is_plugin_point(cls):
            raise Exception(_('This method is only available to plugin '
                              'classes.'))
        else:
            return PluginPointModel.objects.\
                get(plugin__pythonpath=cls.get_pythonpath())
332362
def _default_plugins(self):
        
        plugins = {}
        try:
            with open('entry_points.json') as f:
                entry_points = json.load(f)
            for ep, obj in entry_points.items():
                plugins[ep] = []
                for name, src in obj.items():
                    plugins[ep].append(Plugin(name=name, source=src))
        except Exception as e:
            print("Failed to load entry points {}".format(e))
        return plugins
21388
def from_context(cls):
        
        try:
            ctx = click.get_current_context()
        except RuntimeError:
            return cls()
        return ctx.find_object(cls)
107300
private PointBag getPointBag() {
		PointBag pb = nextFreePointBag;
		if (pb != null) {
			nextFreePointBag = pb.next;
			pb.next = null;
			return pb;
		}
		return new PointBag();
	}
374849
def get_plugin_class(self, plugin_type, plugin_name):
        """"""
        plugin = self._get_plugin_type(plugin_type)
        return plugin.get_plugin_class(plugin_name)
1299059
def all(self):
        
        # Django >= 1.9 changed something with the migration logic causing
        # plugins to be executed before the corresponding database tables
        # exist. This method will only return something if the database
        # tables have already been created.
        # XXX: I don't fully understand the issue and there should be
        # another way but this appears to work fine.
        if django_version >= (1, 9) and (
                not db_table_exists(Plugin._meta.db_table) or
                not db_table_exists(PluginPoint._meta.db_table)):
            return
        self.points()
730967
def get_instance(self):
        
        try:
            return self._instance
        except AttributeError:
            self._instance = self._decorated()
            return self._instance
1166800
def _instance_parser(self, plugins):
        
        plugins = util.return_list(plugins)
        for instance in plugins:
            if inspect.isclass(instance):
                self._handle_class_instance(instance)
            else:
                self._handle_object_instance(instance)
973220
def get_instance(self, node, *args, **kwargs):
        
        # string is a ref to an existing plugin instance
        if isinstance(node, basestring):
            if node in self._instance:
                return self._instance[node]
            # if not an instance, try for init with empty config
            return self.new_plugin({'type': node}, *args, **kwargs)

        if isinstance(node, collections.Mapping):
            if "type" in node:
                # node was a plugin config passed directly
                name = node.get("name", node.get("type"))
            elif len(node) == 1:
                # node was a container with a single plugin config keyed
                # to it
                typ, config = list(node.items())[0]
                name = config.get("name", config.get("type", typ))

            # retrieve existing instance if it exists
            if name in self._instance:
                return self._instance[name]

            # otherwise spawn new plugin
            return self.new_plugin(node, *args, **kwargs)

        raise ValueError("unable to parse plugin for output %s" % str(node))
909706
def get_point(cls, idx, size):
        
        x, y = cls.POSITION[idx % 4]
        idx //= 4
        block_size = 2
        while block_size < size:
            block_idx = idx % 4
            x, y = cls.get_point_in_block(x, y, block_idx, block_size)
            idx //= 4
            block_size *= 2
        return x, y
275682
def from_plugin_classname(plugin_classname, exclude_lines_regex=None, **kwargs):
    
    klass = globals()[plugin_classname]

    # Make sure the instance is a BasePlugin type, before creating it.
    if not issubclass(klass, BasePlugin):
        raise TypeError

    try:
        instance = klass(exclude_lines_regex=exclude_lines_regex, **kwargs)
    except TypeError:
        log.warning(
            'Unable to initialize plugin!',
        )
        raise

    return instance
183578
def to_geopoint(self):
        
        if self._lon is None or self._lat is None:
            return None
        return geo.Point(self._lon, self._lat)
1301495
def Instance(self):
        
        try:
            return self._instance
        except AttributeError:
            self._instance = self._decorated()
            return self._instance
232999
def get_model(obj):
    
    p = obj
    while hasattr(p, 'parent'):
        p = p.parent
    return p
717727
function(geometryModel) {
      if(geometryModel.isPoint()) {
        return new cdb.geo.gmaps.PointView(geometryModel);
      }
      return new cdb.geo.gmaps.PathView(geometryModel);
    }
906923
def plugin_for(cls, model):
        '''
        
        '''
        logger.debug("Getting a plugin for: %s", model)
        if not issubclass(model, Model):
            return
        if model in cls.plugins:
            return cls.plugins[model]
        for b in model.__bases__:
            p = cls.plugin_for(b)
            if p:
                return p
1355828
def mapping(self):
        
        if not hasattr(self, "_mapping"):
            if hasattr(self.model, "Mapping"):
                mapping_klass = type("Mapping", (DjangoMapping, self.model.Mapping), {})
            else:
                mapping_klass = get_first_mapping(self.model)
                if mapping_klass is None:
                    mapping_klass = DjangoMapping
            self._mapping = mapping_klass(self.model)
        return self._mapping