_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q244400
MountedRepository._get_valid_mount_strings
train
def _get_valid_mount_strings(self): """Return a tuple of potential mount strings. Casper Admin seems to mount in a number of ways: - hostname/share - fqdn/share Plus, there's the possibility of: - IPAddress/share Then factor in the possibility that th...
python
{ "resource": "" }
q244401
AFPDistributionPoint._mount
train
def _mount(self): """Mount based on which OS is running.""" # mount_afp "afp://scraig:<password>@address/share" <mnt_point> if is_osx(): if self.connection["jss"].verbose: print self.connection["mount_url"] if mount_share: self.connection["...
python
{ "resource": "" }
q244402
DistributionServer._build_url
train
def _build_url(self): """Build the URL for POSTing files.""" self.connection["upload_url"] = ( "%s/%s" % (self.connection["jss"].base_url, "dbfileupload")) self.connection["delete_url"] = (
python
{ "resource": "" }
q244403
DistributionServer.copy_pkg
train
def copy_pkg(self, filename, id_=-1): """Copy a package to the distribution server. Bundle-style packages must be zipped prior to copying. Args: filename: Full path to file to upload. id_:
python
{ "resource": "" }
q244404
DistributionServer.copy_script
train
def copy_script(self, filename, id_=-1): """Copy a script to the distribution server. Args: filename: Full path to file to upload. id_: ID of Script object to associate with, or -1 for new
python
{ "resource": "" }
q244405
DistributionServer._copy
train
def _copy(self, filename, id_=-1, file_type=0): """Upload a file to the distribution server. Directories/bundle-style packages must be zipped prior to copying. """ if os.path.isdir(filename): raise JSSUnsupportedFileType( "Distribution Server type rep...
python
{ "resource": "" }
q244406
DistributionServer.delete_with_casper_admin_save
train
def delete_with_casper_admin_save(self, pkg): """Delete a pkg from the distribution server. Args: pkg: Can be a jss.Package object, an int ID of a package, or a filename. """ # The POST needs the package ID. if pkg.__class__.__name__ == "Package": ...
python
{ "resource": "" }
q244407
DistributionServer.delete
train
def delete(self, filename): """Delete a package or script from the distribution server. This method simply finds the Package or Script object from the database with the API GET call and then deletes it. This will remove the file from the database blob.
python
{ "resource": "" }
q244408
DistributionServer.exists
train
def exists(self, filename): """Check for the existence of a package or script. Unlike other DistributionPoint types, JDS and CDP types have no documented interface for checking whether the server and its children have a complete copy of a file. The best we can do is check for an...
python
{ "resource": "" }
q244409
DistributionServer.exists_using_casper
train
def exists_using_casper(self, filename): """Check for the existence of a package file. Unlike other DistributionPoint types, JDS and CDP types have no documented interface for checking whether the server and its children have a complete copy of a file. The best we can do is chec...
python
{ "resource": "" }
q244410
CommandFlush.command_flush_for
train
def command_flush_for(self, id_type, command_id, status): """Flush commands for an individual device. Args: id_type (str): One of 'computers', 'computergroups', 'mobiledevices', or 'mobiledevicegroups'. id_value (str, int, list): ID value(s) for the devices to ...
python
{ "resource": "" }
q244411
Computer.mac_addresses
train
def mac_addresses(self): """Return a list of mac addresses for this device. Computers don't tell you which network device is which. """ mac_addresses = [self.findtext("general/mac_address")]
python
{ "resource": "" }
q244412
FileUpload._set_upload_url
train
def _set_upload_url(self): """Generate the full URL for a POST.""" # pylint: disable=protected-access self._upload_url = "/".join(
python
{ "resource": "" }
q244413
FileUpload.save
train
def save(self): """POST the object to the JSS.""" try: response = requests.post(self._upload_url, auth=self.jss.session.auth, verify=self.jss.session.verify, files=self.resource) ...
python
{ "resource": "" }
q244414
LDAPServer.search_users
train
def search_users(self, user): """Search for LDAP users. Args: user: User to search for. It is not entirely clear how the JSS determines the results- are regexes allowed, or globbing? Returns: LDAPUsersResult object. Raises: ...
python
{ "resource": "" }
q244415
LDAPServer.search_groups
train
def search_groups(self, group): """Search for LDAP groups. Args: group: Group to search for. It is not entirely clear how the JSS determines the results- are regexes allowed, or globbing? Returns: LDAPGroupsResult object. Raises:...
python
{ "resource": "" }
q244416
LDAPServer.is_user_in_group
train
def is_user_in_group(self, user, group): """Test for whether a user is in a group. There is also the ability in the API to test for whether multiple users are members of an LDAP group, but you should just call is_user_in_group over an enumerated list of users. Args: ...
python
{ "resource": "" }
q244417
LogFlush.log_flush_with_xml
train
def log_flush_with_xml(self, data): """Flush logs for devices with a supplied xml string. From the Casper API docs: log, log_id, interval, and devices specified in an XML file. Sample file: <logflush> <log>policy</log> <log_id>2</log...
python
{ "resource": "" }
q244418
LogFlush.log_flush_for_interval
train
def log_flush_for_interval(self, log_type, interval): """Flush logs for an interval of time. Args: log_type (str): Only documented type is "policies". This will be applied by default if nothing is passed. interval (str): Combination of "Zero", "One", "Two", ...
python
{ "resource": "" }
q244419
LogFlush.log_flush_for_obj_for_interval
train
def log_flush_for_obj_for_interval(self, log_type, obj_id, interval): """Flush logs for an interval of time for a specific object. Please note, log_type is a variable according to the API docs, but acceptable values are not listed. Only "policies" is demonstrated as an acceptable value....
python
{ "resource": "" }
q244420
Package._new
train
def _new(self, name, **kwargs): """Create a new Package from scratch. Args: name: String filename of the package to use for the Package object's Display Name (here, "name"). Will also be used as the "filename" value. Casper will let you specif...
python
{ "resource": "" }
q244421
Package.set_category
train
def set_category(self, category): """Set package category Args: category: String of an existing category's name, or a Category object. """ # For some reason, packages only have the category name, not the
python
{ "resource": "" }
q244422
Policy.add_object_to_scope
train
def add_object_to_scope(self, obj): """Add an object to the appropriate scope block. Args: obj: JSSObject to add to scope. Accepted subclasses are: Computer ComputerGroup Building Department Raises: TypeErr...
python
{ "resource": "" }
q244423
Policy.add_package
train
def add_package(self, pkg, action_type="Install"): """Add a Package object to the policy with action=install. Args: pkg: A Package object to add. action_type (str, optional): One of "Install", "Cache", or "Install Cached". Defaults to "Install". """ ...
python
{ "resource": "" }
q244424
Policy.set_category
train
def set_category(self, category): """Set the policy's category. Args: category: A category object. """ pcategory = self.find("general/category") pcategory.clear() name = ElementTree.SubElement(pcategory, "name") if isinstance(category, Category): ...
python
{ "resource": "" }
q244425
cyvcf2
train
def cyvcf2(context, vcf, include, exclude, chrom, start, end, loglevel, silent, individual, no_inds): """fast vcf parsing with cython + htslib""" coloredlogs.install(log_level=loglevel) start_parsing = datetime.now() log.info("Running cyvcf2 version %s", __version__) if include and exclu...
python
{ "resource": "" }
q244426
get_version
train
def get_version(): """Get the version info from the mpld3 package without importing it""" import ast with open(os.path.join("cyvcf2", "__init__.py"), "r") as init_file: module = ast.parse(init_file.read())
python
{ "resource": "" }
q244427
OcspResponse.verify
train
def verify(self, verify_locations: str) -> None: """Verify that the OCSP response is trusted. Args: verify_locations: The file path to a trust store containing pem-formatted certificates, to be used for validating the OCSP response. Raises OcspResponseNotTrustedError if...
python
{ "resource": "" }
q244428
OcspResponse._parse_ocsp_response_from_openssl_text
train
def _parse_ocsp_response_from_openssl_text( cls, response_text: str, response_status: OcspResponseStatusEnum ) -> Dict[str, Any]: """Parse OpenSSL's text output and make a lot of assumptions. """ response_dict = { 'responseStatus': cls._get_val...
python
{ "resource": "" }
q244429
SslClient._init_base_objects
train
def _init_base_objects(self, ssl_version: OpenSslVersionEnum, underlying_socket: Optional[socket.socket]) -> None: """Setup the socket and SSL_CTX objects. """
python
{ "resource": "" }
q244430
SslClient._init_server_authentication
train
def _init_server_authentication(self, ssl_verify: OpenSslVerifyEnum, ssl_verify_locations: Optional[str]) -> None: """Setup the certificate validation logic for authenticating the server. """ self._ssl_ctx.set_verify(ssl_verify.value) if ssl_verify_locations:
python
{ "resource": "" }
q244431
SslClient._init_client_authentication
train
def _init_client_authentication( self, client_certchain_file: Optional[str], client_key_file: Optional[str], client_key_type: OpenSslFileTypeEnum, client_key_password: str, ignore_client_authentication_requests: bool ) -> None: """Setup...
python
{ "resource": "" }
q244432
SslClient.shutdown
train
def shutdown(self) -> None: """Close the TLS connection and the underlying network socket. """ self._is_handshake_completed = False try: self._flush_ssl_engine() except IOError: # Ensure shutting down the connection never
python
{ "resource": "" }
q244433
SslClient._use_private_key
train
def _use_private_key( self, client_certchain_file: str, client_key_file: str, client_key_type: OpenSslFileTypeEnum, client_key_password: str ) -> None: """The certificate chain file must be in PEM format. Private method because it should be set via...
python
{ "resource": "" }
q244434
SslClient.get_tlsext_status_ocsp_resp
train
def get_tlsext_status_ocsp_resp(self) -> Optional[OcspResponse]: """Retrieve the server's OCSP Stapling status. """ ocsp_response = self._ssl.get_tlsext_status_ocsp_resp()
python
{ "resource": "" }
q244435
BuildConfig.fetch_source
train
def fetch_source(self) -> None: """Download the tar archive that contains the source code for the library. """ import requests # Do not import at the top that this file can be imported by setup.py with TemporaryFile() as temp_file: # Download the source archive r...
python
{ "resource": "" }
q244436
LegacySslClient.do_renegotiate
train
def do_renegotiate(self) -> None: """Initiate an SSL renegotiation. """ if not self._is_handshake_completed: raise IOError('SSL Handshake was not completed;
python
{ "resource": "" }
q244437
_download_file_vizier
train
def _download_file_vizier(cat,filePath,catalogname='catalog.dat'): ''' Stolen from Jo Bovy's gaia_tools package! ''' sys.stdout.write('\r'+"Downloading file %s ...\r" \ % (os.path.basename(filePath))) sys.stdout.flush() try: # make all intermediate directories ...
python
{ "resource": "" }
q244438
ensure_dir
train
def ensure_dir(f): """ Ensure a a file exists and if not make the relevant path """ d =
python
{ "resource": "" }
q244439
dePeriod
train
def dePeriod(arr): """make an array of periodic angles increase linearly"""
python
{ "resource": "" }
q244440
hinit
train
def hinit(func, x, t, pos_neg, f0, iord, hmax, rtol, atol, args): """ Estimate initial step size """ sk = atol + rtol * np.fabs(x) dnf = np.sum(np.square(f0 / sk), axis=0) dny = np.sum(np.square(x / sk), axis=0) h = np.sqrt(dny / dnf) * 0.01 h = np.min([h, np.fabs(hmax)]) h = custo...
python
{ "resource": "" }
q244441
dense_output
train
def dense_output(t_current, t_old, h_current, rcont): """ Dense output function, basically extrapolatin """ # initialization s = (t_current - t_old) / h_current s1 = 1.0 - s return rcont[0] + s * (rcont[1] + s1 * (
python
{ "resource": "" }
q244442
phiME_dens
train
def phiME_dens(R,z,phi,dens,Sigma,dSigmadR,d2SigmadR2,hz,Hz,dHzdz,Sigma_amp): """The density corresponding to phi_ME""" r= numpy.sqrt(R**2.+z**2.) out= dens(R,z,phi) for a,s,ds,d2s,h,H,dH \
python
{ "resource": "" }
q244443
_parse_integrator
train
def _parse_integrator(int_method): """parse the integrator method to pass to C""" #Pick integrator if int_method.lower() == 'rk4_c': int_method_c= 1 elif int_method.lower() == 'rk6_c': int_method_c= 2 elif int_method.lower() == 'symplec4_c': int_method_c= 3 elif int_metho...
python
{ "resource": "" }
q244444
_parse_tol
train
def _parse_tol(rtol,atol): """Parse the tolerance keywords""" #Process atol and rtol if rtol is None: rtol= -12.*nu.log(10.)
python
{ "resource": "" }
q244445
_check_integrate_dt
train
def _check_integrate_dt(t,dt): """Check that the stepszie in t is an integer x dt""" if dt is None: return True mult= round((t[1]-t[0])/dt)
python
{ "resource": "" }
q244446
_forceInt
train
def _forceInt(x,y,z,dens,b2,c2,i,glx=None,glw=None): """Integral that gives the force in x,y,z""" def integrand(s): t= 1/s**2.-1. return dens(numpy.sqrt(x**2./(1.+t)+y**2./(b2+t)+z**2./(c2+t)))\ *(x/(1.+t)*(i==0)+y/(b2+t)*(i==1)+z/(c2+t)*(i==2))\
python
{ "resource": "" }
q244447
_2ndDerivInt
train
def _2ndDerivInt(x,y,z,dens,densDeriv,b2,c2,i,j,glx=None,glw=None): """Integral that gives the 2nd derivative of the potential in x,y,z""" def integrand(s): t= 1/s**2.-1. m= numpy.sqrt(x**2./(1.+t)+y**2./(b2+t)+z**2./(c2+t)) return (densDeriv(m) *(x/(1.+t)*(i==0)+y/(b2+t)...
python
{ "resource": "" }
q244448
TwoPowerTriaxialPotential._mdens
train
def _mdens(self,m): """Density as a function of m"""
python
{ "resource": "" }
q244449
_fit_orbit
train
def _fit_orbit(orb,vxvv,vxvv_err,pot,radec=False,lb=False, customsky=False,lb_to_customsky=None, pmllpmbb_to_customsky=None, tintJ=100,ntintJ=1000,integrate_method='dopr54_c', ro=None,vo=None,obs=None,disp=False): """Fit an orbit to data in a given potenti...
python
{ "resource": "" }
q244450
actionAngle_physical_input
train
def actionAngle_physical_input(method): """Decorator to convert inputs to actionAngle functions from physical to internal coordinates""" @wraps(method) def wrapper(*args,**kwargs): if len(args) < 3: # orbit input return method(*args,**kwargs) ro= kwargs.get('ro',None) ...
python
{ "resource": "" }
q244451
_direct_nbody_force
train
def _direct_nbody_force(q,m,t,pot,softening,softening_args): """Calculate the force""" #First do the particles #Calculate all the distances nq= len(q) dim= len(q[0]) dist_vec= nu.zeros((nq,nq,dim)) dist= nu.zeros((nq,nq)) for ii in range(nq): for jj in range(ii+1,nq): ...
python
{ "resource": "" }
q244452
_vmomentsurfaceIntegrand
train
def _vmomentsurfaceIntegrand(vR,vT,R,az,df,n,m,sigmaR1,sigmaT1,t,initvmoment): """Internal function that is the integrand for the velocity moment times surface mass integration"""
python
{ "resource": "" }
q244453
evolveddiskdf._vmomentsurfacemassGrid
train
def _vmomentsurfacemassGrid(self,n,m,grid): """Internal function to evaluate vmomentsurfacemass using a grid rather than direct integration""" if len(grid.df.shape) == 3: tlist= True else: tlist= False if tlist: nt= grid.df.shape[2]
python
{ "resource": "" }
q244454
evolveddiskdf._buildvgrid
train
def _buildvgrid(self,R,phi,nsigma,t,sigmaR1,sigmaT1,meanvR,meanvT, gridpoints,print_progress,integrate_method,deriv): """Internal function to grid the vDF at a given location""" out= evolveddiskdfGrid() out.sigmaR1= sigmaR1 out.sigmaT1= sigmaT1 out.meanvR= mea...
python
{ "resource": "" }
q244455
_determine_stream_spread_single
train
def _determine_stream_spread_single(sigomatrixEig, thetasTrack, sigOmega, sigAngle, allinvjacsTrack): """sigAngle input may either be a function that returns the dispersion...
python
{ "resource": "" }
q244456
streamdf._progenitor_setup
train
def _progenitor_setup(self,progenitor,leading,useTMHessian): """The part of the setup relating to the progenitor's orbit""" #Progenitor orbit: Calculate actions, frequencies, and angles for the progenitor self._progenitor= progenitor() #call to get new Orbit # Make sure we do not use phy...
python
{ "resource": "" }
q244457
streamdf._setup_progIsTrack
train
def _setup_progIsTrack(self): """If progIsTrack, the progenitor orbit that was passed to the streamdf initialization is the track at zero angle separation; this routine computes an actual progenitor position that gives the desired track given the parameters of the streamdf""" # ...
python
{ "resource": "" }
q244458
streamdf._determine_nTrackIterations
train
def _determine_nTrackIterations(self,nTrackIterations): """Determine a good value for nTrackIterations based on the misalignment between stream and orbit; just based on some rough experience for now""" if not nTrackIterations is None: self.nTrackIterations= nTrackIterations retur...
python
{ "resource": "" }
q244459
streamdf._interpolate_stream_track_aA
train
def _interpolate_stream_track_aA(self): """Build interpolations of the stream track in action-angle coordinates""" if hasattr(self,'_interpolatedObsTrackAA'): return None #Already did this #Calculate 1D meanOmega on a fine grid in angle and interpolate if not hasattr(self,'_i...
python
{ "resource": "" }
q244460
streamdf._find_closest_trackpoint
train
def _find_closest_trackpoint(self,R,vR,vT,z,vz,phi,interp=True,xy=False, usev=False): """For backward compatibility""" return self.find_closest_trackpoint(R,vR,vT,z,vz,phi,
python
{ "resource": "" }
q244461
streamdf._density_par
train
def _density_par(self,dangle,tdisrupt=None): """The raw density as a function of parallel angle""" if tdisrupt is None: tdisrupt= self._tdisrupt dOmin= dangle/tdisrupt # Normalize to 1 close to progenitor return 0.5\
python
{ "resource": "" }
q244462
streamdf._sample_aAt
train
def _sample_aAt(self,n): """Sampling frequencies, angles, and times part of sampling""" #Sample frequency along largest eigenvalue using ARS dO1s=\ bovy_ars.bovy_ars([0.,0.],[True,False], [self._meandO-numpy.sqrt(self._sortedSigOEig[2]), ...
python
{ "resource": "" }
q244463
actionAngle._check_consistent_units
train
def _check_consistent_units(self): """Internal function to check that the set of units for this object is consistent with that for the potential""" if isinstance(self._pot,list): if self._roSet and self._pot[0]._roSet: assert m.fabs(self._ro-self._pot[0]._ro) < 10.**-10., 'Ph...
python
{ "resource": "" }
q244464
actionAngle._check_consistent_units_orbitInput
train
def _check_consistent_units_orbitInput(self,orb): """Internal function to check that the set of units for this object is consistent with that for an input orbit""" if self._roSet and orb._roSet: assert m.fabs(self._ro-orb._ro) < 10.**-10.,
python
{ "resource": "" }
q244465
check_inputs_not_arrays
train
def check_inputs_not_arrays(func): """ Decorator to check inputs and throw TypeError if any of the inputs are arrays. Methods potentially return with silent errors if inputs are not checked. """ @wraps(func) def func_wrapper(self, R, z, phi, t): if (hasattr(R, '__len__') and len(R) > 1) ...
python
{ "resource": "" }
q244466
_JRAxiIntegrand
train
def _JRAxiIntegrand(r,E,L,pot): """The J_R integrand"""
python
{ "resource": "" }
q244467
_rapRperiAxiEq
train
def _rapRperiAxiEq(R,E,L,pot): """The vr=0 equation that needs
python
{ "resource": "" }
q244468
_rlfunc
train
def _rlfunc(rl,lz,pot): """Function that gives rvc-lz"""
python
{ "resource": "" }
q244469
_rlFindStart
train
def _rlFindStart(rl,lz,pot,lower=False): """find a starting interval for rl""" rtry= 2.*rl while (2.*lower-1.)*_rlfunc(rtry,lz,pot) > 0.: if lower:
python
{ "resource": "" }
q244470
_check_roSet
train
def _check_roSet(orb,kwargs,funcName): """Function to check whether ro is set, because it's required for funcName""" if not orb._roSet and kwargs.get('ro',None) is None: warnings.warn("Method %s(.) requires ro to be given at
python
{ "resource": "" }
q244471
_check_voSet
train
def _check_voSet(orb,kwargs,funcName): """Function to check whether vo is set, because it's required for funcName""" if not orb._voSet and kwargs.get('vo',None) is None: warnings.warn("Method %s(.) requires vo to be given at
python
{ "resource": "" }
q244472
OrbitTop._radec
train
def _radec(self,*args,**kwargs): """Calculate ra and dec""" lbd= self._lbd(*args,**kwargs)
python
{ "resource": "" }
q244473
OrbitTop._pmrapmdec
train
def _pmrapmdec(self,*args,**kwargs): """Calculate pmra and pmdec""" lbdvrpmllpmbb= self._lbdvrpmllpmbb(*args,**kwargs) return coords.pmllpmbb_to_pmrapmdec(lbdvrpmllpmbb[:,4], lbdvrpmllpmbb[:,5],
python
{ "resource": "" }
q244474
OrbitTop._lbd
train
def _lbd(self,*args,**kwargs): """Calculate l,b, and d""" obs, ro, vo= self._parse_radec_kwargs(kwargs,dontpop=True) X,Y,Z= self._helioXYZ(*args,**kwargs) bad_indx= (X == 0.)*(Y ==
python
{ "resource": "" }
q244475
OrbitTop._lbdvrpmllpmbb
train
def _lbdvrpmllpmbb(self,*args,**kwargs): """Calculate l,b,d,vr,pmll,pmbb""" obs, ro, vo= self._parse_radec_kwargs(kwargs,dontpop=True)
python
{ "resource": "" }
q244476
OrbitTop._parse_plot_quantity
train
def _parse_plot_quantity(self,quant,**kwargs): """Internal function to parse a quantity to be plotted based on input data""" # Cannot be using Quantity output kwargs['quantity']= False if callable(quant): return quant(self.t) def _eval(q): # Check those th...
python
{ "resource": "" }
q244477
quasiisothermaldf._jmomentdensity
train
def _jmomentdensity(self,R,z,n,m,o,nsigma=None,mc=True,nmc=10000, _returnmc=False,_vrs=None,_vts=None,_vzs=None, **kwargs): """Non-physical version of jmomentdensity, otherwise the same""" if nsigma == None: nsigma= _NSIGMA sigmaR1= self....
python
{ "resource": "" }
q244478
impact_check_range
train
def impact_check_range(func): """Decorator to check the range of interpolated kicks""" @wraps(func) def impact_wrapper(*args,**kwargs): if isinstance(args[1],numpy.ndarray): out= numpy.zeros(len(args[1])) goodIndx= (args[1] < args[0]._deltaAngleTrackImpact)*(args[1] > 0.) ...
python
{ "resource": "" }
q244479
streamgapdf._density_par
train
def _density_par(self,dangle,tdisrupt=None,approx=True, higherorder=None): """The raw density as a function of parallel angle, approx= use faster method that directly integrates the spline representation""" if higherorder is None: higherorder= self._higherorderTrack ...
python
{ "resource": "" }
q244480
streamgapdf._density_par_approx
train
def _density_par_approx(self,dangle,tdisrupt,_return_array=False, higherorder=False): """Compute the density as a function of parallel angle using the spline representation + approximations""" # First construct the breakpoints for this dangle Oparb= (dangle-s...
python
{ "resource": "" }
q244481
streamgapdf._density_par_approx_higherorder
train
def _density_par_approx_higherorder(self,Oparb,lowbindx, _return_array=False, gaussxpolyInt=None): """Contribution from non-linear spline terms""" spline_order= self._kick_interpdOpar_raw._eval_args[2] if spline_orde...
python
{ "resource": "" }
q244482
streamgapdf._densMoments_approx_higherorder_gaussxpolyInts
train
def _densMoments_approx_higherorder_gaussxpolyInts(self,ll,ul,maxj): """Calculate all of the polynomial x Gaussian integrals occuring in the higher-order terms, recursively""" gaussxpolyInt= numpy.zeros((maxj,len(ul))) gaussxpolyInt[-1]= 1./numpy.sqrt(numpy.pi)\ *(numpy.exp(...
python
{ "resource": "" }
q244483
streamgapdf._meanOmega_num_approx
train
def _meanOmega_num_approx(self,dangle,tdisrupt,higherorder=False): """Compute the numerator going into meanOmega using the direct integration of the spline representation""" # First construct the breakpoints for this dangle Oparb= (dangle-self._kick_interpdOpar_poly.x)/self._timpact # Fi...
python
{ "resource": "" }
q244484
streamgapdf._interpolate_stream_track_kick_aA
train
def _interpolate_stream_track_kick_aA(self): """Build interpolations of the stream track near the impact in action-angle coordinates""" if hasattr(self,'_kick_interpolatedObsTrackAA'): #pragma: no cover return None #Already did this #Calculate 1D meanOmega on a fine grid in angle and...
python
{ "resource": "" }
q244485
streamgapdf._gap_progenitor_setup
train
def _gap_progenitor_setup(self): """Setup an Orbit instance that's the progenitor integrated backwards""" self._gap_progenitor= self._progenitor().flip() # new orbit, flip velocities # Make sure we do not use physical coordinates self._gap_progenitor.turn_physical_off() # Now int...
python
{ "resource": "" }
q244486
streamgapdf._sample_aAt
train
def _sample_aAt(self,n): """Sampling frequencies, angles, and times part of sampling, for stream with gap""" # Use streamdf's _sample_aAt to generate unperturbed frequencies, # angles Om,angle,dt= super(streamgapdf,self)._sample_aAt(n) # Now rewind angles by timpact, apply the ki...
python
{ "resource": "" }
q244487
worker
train
def worker(f, ii, chunk, out_q, err_q, lock): """ A worker function that maps an input function over a slice of the input iterable. :param f : callable function that accepts argument from iterable :param ii : process ID :param chunk: slice of input iterable :param out_q: thread-safe output queue :par...
python
{ "resource": "" }
q244488
run_tasks
train
def run_tasks(procs, err_q, out_q, num): """ A function that executes populated processes and processes the resultant array. Checks error queue for any exceptions. :param procs: list of Process objects :param out_q: thread-safe output queue :param err_q: thread-safe queue to populate on exception :param ...
python
{ "resource": "" }
q244489
parallel_map
train
def parallel_map(function, sequence, numcores=None): """ A parallelized version of the native Python map function that utilizes the Python multiprocessing module to divide and conquer sequence. parallel_map does not yet support multiple argument sequences. :param function: callable function that accepts ...
python
{ "resource": "" }
q244490
_u0Eq
train
def _u0Eq(logu,delta,pot,E,Lz22): """The equation that needs to be minimized to find u0""" u= numpy.exp(logu) sinh2u= numpy.sinh(u)**2. cosh2u= numpy.cosh(u)**2.
python
{ "resource": "" }
q244491
_JrSphericalIntegrand
train
def _JrSphericalIntegrand(r,E,L,pot): """The J_r integrand"""
python
{ "resource": "" }
q244492
FerrersPotential.rot
train
def rot(self, t=0., transposed=False): """2D Rotation matrix for non-zero pa or pattern speed to goto the aligned coordinates """ rotmat = np.array( [[np.cos(self._pa+self._omegab*t),np.sin(self._pa+self._omegab*t)],
python
{ "resource": "" }
q244493
_JzIntegrand
train
def _JzIntegrand(z,Ez,pot): """The J_z integrand"""
python
{ "resource": "" }
q244494
quoted
train
def quoted(s): """ quotes a string if necessary. """ # strip any existing quotes s = s.strip(u'"') # don't add quotes for minus or leading space if s[0]
python
{ "resource": "" }
q244495
install
train
def install(path, remove=False, prefix=sys.prefix, recursing=False): """ install Menu and shortcuts """ # this sys.prefix is intentional. We want to reflect the state of the root installation. if sys.platform == 'win32' and not exists(join(sys.prefix, '.nonadmin')): if isUserAdmin(): ...
python
{ "resource": "" }
q244496
add_child
train
def add_child(parent, tag, text=None): """ Add a child element of specified tag type to parent. The new child element is returned. """
python
{ "resource": "" }
q244497
Application._writePlistInfo
train
def _writePlistInfo(self): """ Writes the Info.plist file in the Contests directory. """ pl = Plist( CFBundleExecutable=self.executable, CFBundleGetInfoString='%s-1.0.0' % self.name, CFBundleIconFile=basename(self.icns), CFBundleIdentifier=...
python
{ "resource": "" }
q244498
FileTailer.readlines
train
def readlines(self, offset=0): """Open the file for reading and yield lines as they are added""" try: with open(self._filepath) as fp: # For full read go through existing lines in file if self._full_read: fp.seek(offset) ...
python
{ "resource": "" }
q244499
get_files
train
def get_files(dir_name): """Simple directory walker""" return [(os.path.join('.', d), [os.path.join(d, f)
python
{ "resource": "" }