create astroid for a living method descriptor object
967775
def object_build_methoddescriptor(node, member, localname):
    """"""
    # FIXME get arguments ?
    func = build_function(
        getattr(member, "__name__", None) or localname, doc=member.__doc__
    )
    # set node's arguments to None to notice that we have no information, not
    # and empty argument list
    func.args.args = None
    node.add_local_node(func, localname)
    _add_dunder_class(func, member)
995451
def generate_id(self, obj):
        """"""
        object_type = type(obj).__name__.lower()
        return '{}_{}'.format(object_type, self.get_object_id(obj))
817646
def new(self, bootstrap_with=None, use_timer=False):
        

        if not self.minisat:
            self.minisat = pysolvers.minisat22_new()

            if bootstrap_with:
                for clause in bootstrap_with:
                    self.add_clause(clause)

            self.use_timer = use_timer
            self.call_time = 0.0  # time spent for the last call to oracle
            self.accu_time = 0.0
610765
function (Class, descriptors) {
    var body = '"use strict";\n';
    var casters = {};
    each(descriptors, function (descriptor, name) {
      if (descriptor.writable || typeof descriptor.set === 'function') {
        var accessor = createAccessor(name);
        if (descriptor.cast || descriptor.type) {
          casters[name] = Casting.forDescriptor(descriptor);
          body += 'if (config' + accessor + ' !== undefined) {\n\
                      this' + accessor + ' = casters' + accessor + '(config' + accessor + ');\n\
                   }\n';
        }
        else {
          body += 'if (config' + accessor + ' !== undefined) {\n\
                      this' + accessor + ' = config' + accessor + ';\n\
                   }\n';
        }
      }
    });
    var configure = this.createDynamicFunction('casters', 'config', body);
    var fn = function (config) {
      return configure.call(this, casters, config);
    };
    fn.isAutoGenerated = true;
    return fn;
  }
136839
def create_object(object_type, data, **api_opts):
    '''
    
    '''
    if '__opts__' in globals() and __opts__['test']:
        return {'Test': 'Would attempt to create object: {0}'.format(object_type)}
    infoblox = _get_infoblox(**api_opts)
    return infoblox.create_object(object_type, data)
2517
public static MethodDescriptor buildScriptableMethodDescriptorNoArgs( Class actionClass, String methodName )
  {
    MethodDescriptor md = _buildMethodDescriptor( actionClass, methodName, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_CLASS_ARRAY );
    makeScriptable( md );
    return md;
  }
493366
def _helioXYZ(self,*args,**kwargs):
        """"""
        obs, ro, vo= self._parse_radec_kwargs(kwargs)
        thiso= self(*args,**kwargs)
        if not len(thiso.shape) == 2: thiso= thiso.reshape((thiso.shape[0],1))
        if len(thiso[:,0]) != 4 and len(thiso[:,0]) != 6: #pragma: no cover
            raise AttributeError("orbit must track azimuth to use radeclbd functions")
        elif len(thiso[:,0]) == 4: #planarOrbit
            if isinstance(obs,(nu.ndarray,list)):
                X,Y,Z = coords.galcencyl_to_XYZ(\
                    thiso[0,:],thiso[3,:]-nu.arctan2(obs[1],obs[0]),0.,
                    Xsun=nu.sqrt(obs[0]**2.+obs[1]**2.)/ro,
                    Zsun=obs[2]/ro,_extra_rot=False).T
            else: #Orbit instance
                obs.turn_physical_off()
                if obs.dim() == 2:
                    X,Y,Z = coords.galcencyl_to_XYZ(\
                        thiso[0,:],thiso[3,:]-obs.phi(*args,**kwargs),
                        nu.zeros_like(thiso[0]),
                        Xsun=obs.R(*args,**kwargs),Zsun=0.,_extra_rot=False).T
                else:
                    X,Y,Z = coords.galcencyl_to_XYZ(\
                        thiso[0,:],thiso[3,:]-obs.phi(*args,**kwargs),
                        nu.zeros_like(thiso[0]),
                        Xsun=obs.R(*args,**kwargs),
                        Zsun=obs.z(*args,**kwargs),_extra_rot=False).T
                obs.turn_physical_on()
        else: #FullOrbit
            if isinstance(obs,(nu.ndarray,list)):
                X,Y,Z = coords.galcencyl_to_XYZ(\
                    thiso[0,:],thiso[5,:]-nu.arctan2(obs[1],obs[0]),
                    thiso[3,:],
                    Xsun=nu.sqrt(obs[0]**2.+obs[1]**2.)/ro,
                    Zsun=obs[2]/ro).T
            else: #Orbit instance
                obs.turn_physical_off()
                if obs.dim() == 2:
                    X,Y,Z = coords.galcencyl_to_XYZ(\
                        thiso[0,:],thiso[5,:]-obs.phi(*args,**kwargs),
                        thiso[3,:],
                        Xsun=obs.R(*args,**kwargs),Zsun=0.).T
                else:
                    X,Y,Z = coords.galcencyl_to_XYZ(\
                        thiso[0,:],thiso[5,:]-obs.phi(*args,**kwargs),
                        thiso[3,:],
                        Xsun=obs.R(*args,**kwargs),
                        Zsun=obs.z(*args,**kwargs)).T
                obs.turn_physical_on()
        return (X*ro,Y*ro,Z*ro)
1306861
def register(self,obj,cls=type(None),hist={}):
        
        #~ ident = getattr(obj,'ident',obj)
        if is_submodule(obj,cls):
            if obj not in self.submodules: self.submodules[obj] = SubmodNode(obj,self)
        elif is_module(obj,cls):
            if obj not in self.modules: self.modules[obj] = ModNode(obj,self)
        elif is_type(obj,cls):
            if obj not in self.types: self.types[obj] = TypeNode(obj,self,hist)
        elif is_proc(obj,cls):
            if obj not in self.procedures: self.procedures[obj] = ProcNode(obj,self,hist)
        elif is_program(obj,cls):
            if obj not in self.programs: self.programs[obj] = ProgNode(obj,self)
        elif is_sourcefile(obj,cls):
            if obj not in self.sourcefiles: self.sourcefiles[obj] = FileNode(obj,self)
        elif is_blockdata(obj,cls):
            if obj not in self.blockdata: self.blockdata[obj] = BlockNode(obj,self)
        else:
            raise BadType("Object type {} not recognized by GraphData".format(type(obj).__name__))
1103967
void createMethodBody(String classname, ExecutableElement methodElement, List<String> arguments, Writer writer) throws IOException {
		String methodName = getMethodName(methodElement);
		boolean ws = isWebsocketDataService(methodElement);
		String args = stringJoinAndDecorate(arguments, COMMA, new NothingDecorator());
		String keys = computeKeys(methodElement, arguments);
		createReturnOcelotPromiseFactory(classname, methodName, ws, args, keys, writer);
	}
1239445
def create(cls, object_type=None, object_uuid=None, **kwargs):
        
        assert 'pid_value' in kwargs

        kwargs.setdefault('status', cls.default_status)
        if object_type and object_uuid:
            kwargs['status'] = PIDStatus.REGISTERED

        return super(OAIIDProvider, cls).create(
            object_type=object_type, object_uuid=object_uuid, **kwargs)
1193685
private static MethodRef getSetOrAddMethod(FieldDescriptor descriptor) {
    TypeInfo builder = builderRuntimeType(descriptor.getContainingType());
    String prefix = descriptor.isRepeated() ? "add" : "set";
    boolean isProto3EnumField = isProto3EnumField(descriptor);
    String suffix = isProto3EnumField ? "Value" : "";
    return MethodRef.createInstanceMethod(
            builder,
            new Method(
                prefix + getFieldName(descriptor, true) + suffix,
                builder.type(),
                new Type[] {isProto3EnumField ? Type.INT_TYPE : getRuntimeType(descriptor)}))
        .asNonNullable();
  }
479447
def getObject(ID, jd, lat, lon):
    
    if ID == const.SOUTH_NODE:
        obj = swe.sweObject(const.NORTH_NODE, jd)
        obj.update({
            'id': const.SOUTH_NODE,
            'lon': angle.norm(obj['lon'] + 180)
        })
    elif ID == const.PARS_FORTUNA:
        pflon = tools.pfLon(jd, lat, lon)
        obj = {
            'id': ID,
            'lon': pflon,
            'lat': 0,
            'lonspeed': 0,
            'latspeed': 0
        }
    elif ID == const.SYZYGY:
        szjd = tools.syzygyJD(jd)
        obj = swe.sweObject(const.MOON, szjd)
        obj['id'] = const.SYZYGY
    else:
        obj = swe.sweObject(ID, jd)
    
    _signInfo(obj)
    return obj
1176092
def Ellipsoid(pos=(0, 0, 0), axis1=(1, 0, 0), axis2=(0, 2, 0), axis3=(0, 0, 3),
              c="c", alpha=1, res=24):
    
    elliSource = vtk.vtkSphereSource()
    elliSource.SetThetaResolution(res)
    elliSource.SetPhiResolution(res)
    elliSource.Update()
    l1 = np.linalg.norm(axis1)
    l2 = np.linalg.norm(axis2)
    l3 = np.linalg.norm(axis3)
    axis1 = np.array(axis1) / l1
    axis2 = np.array(axis2) / l2
    axis3 = np.array(axis3) / l3
    angle = np.arcsin(np.dot(axis1, axis2))
    theta = np.arccos(axis3[2])
    phi = np.arctan2(axis3[1], axis3[0])

    t = vtk.vtkTransform()
    t.PostMultiply()
    t.Scale(l1, l2, l3)
    t.RotateX(angle * 57.3)
    t.RotateY(theta * 57.3)
    t.RotateZ(phi * 57.3)
    tf = vtk.vtkTransformPolyDataFilter()
    tf.SetInputData(elliSource.GetOutput())
    tf.SetTransform(t)
    tf.Update()
    pd = tf.GetOutput()

    actor = Actor(pd, c=c, alpha=alpha)
    actor.GetProperty().BackfaceCullingOn()
    actor.GetProperty().SetInterpolationToPhong()
    actor.SetPosition(pos)
    actor.base = -np.array(axis1) / 2 + pos
    actor.top = np.array(axis1) / 2 + pos
    settings.collectable_actors.append(actor)
    return actor
723006
function NextTick(method) {
      return function (target, key, descriptor) {
          var original = descriptor.value;
          descriptor.value = function emitter() {
              var args = [];
              for (var _i = 0; _i < arguments.length; _i++) {
                  args[_i] = arguments[_i];
              }
              if (original.apply(this, args) !== false)
                  if (typeof this[method] === 'function') {
                      this.$nextTick(this[method]);
                  }
                  else {
                      throw new TypeError('must be a method name');
                  }
          };
      };
  }
165022
def create_object(cls, members):
    """"""
    obj = cls.__new__(cls)
    obj.__dict__ = members
    return obj
169267
def _set_axis(self, param, unit):
        
        axisValues = []
        for astroObject in self.objectList:
            try:
                value = eval('astroObject.{0}'.format(param))
            except ac.HierarchyError:  # ie trying to call planet.star and one planet is a lone ranger
                value = np.nan

            if unit is None:  # no unit to rescale (a aq.unitless quanitity would otherwise fail with ValueError)
                axisValues.append(value)
            else:
                try:
                    axisValues.append(value.rescale(unit))
                except AttributeError:  # either nan or unitless
                    axisValues.append(value)

        return axisValues
871862
def create(self, obj, ref=None):
        
        if isinstance(ref, Variable):
            ref = ref.name
        elif isinstance(ref, string_types) and ref.startswith('gl_'):
            # gl_ names not allowed for variables
            ref = ref[3:].lower()
        
        # Allow any type of object to be converted to ShaderObject if it
        # provides a magic method:
        if hasattr(obj, '_shader_object'):
            obj = obj._shader_object()
        
        if isinstance(obj, ShaderObject):
            if isinstance(obj, Variable) and obj.name is None:
                obj.name = ref
        elif isinstance(obj, string_types):
            obj = TextExpression(obj)
        else:
            obj = Variable(ref, obj)
            # Try prepending the name to indicate attribute, uniform, varying
            if obj.vtype and obj.vtype[0] in 'auv':
                obj.name = obj.vtype[0] + '_' + obj.name 
        
        return obj