text stringlengths 81 112k |
|---|
Returns true if this chart is diurnal.
def isDiurnal(self):
""" Returns true if this chart is diurnal. """
sun = self.getObject(const.SUN)
mc = self.getAngle(const.MC)
# Get ecliptical positions and check if the
# sun is above the horizon.
lat = self.pos.lat
... |
Returns the phase of the moon.
def getMoonPhase(self):
""" Returns the phase of the moon. """
sun = self.getObject(const.SUN)
moon = self.getObject(const.MOON)
dist = angle.distance(sun.lon, moon.lon)
if dist < 90:
return const.MOON_FIRST_QUARTER
elif dist < ... |
Returns this chart's solar return for a
given year.
def solarReturn(self, year):
""" Returns this chart's solar return for a
given year.
"""
sun = self.getObject(const.SUN)
date = Datetime('{0}/01/01'.format(year),
'00:00',
... |
Returns the longitude of an object.
def objLon(ID, chart):
""" Returns the longitude of an object. """
if ID.startswith('$R'):
# Return Ruler
ID = ID[2:]
obj = chart.get(ID)
rulerID = essential.ruler(obj.sign)
ruler = chart.getObject(rulerID)
return ruler.lon
... |
Returns the longitude of an arabic part.
def partLon(ID, chart):
""" Returns the longitude of an arabic part. """
# Get diurnal or nocturnal formula
abc = FORMULAS[ID][0] if chart.isDiurnal() else FORMULAS[ID][1]
a = objLon(abc[0], chart)
b = objLon(abc[1], chart)
c = objLon(abc[2], chart)
... |
Returns an Arabic Part.
def getPart(ID, chart):
""" Returns an Arabic Part. """
obj = GenericObject()
obj.id = ID
obj.type = const.OBJ_ARABIC_PART
obj.relocate(partLon(ID, chart))
return obj |
Returns an object from the Ephemeris.
def sweObject(obj, jd):
""" Returns an object from the Ephemeris. """
sweObj = SWE_OBJECTS[obj]
sweList = swisseph.calc_ut(jd, sweObj)
return {
'id': obj,
'lon': sweList[0],
'lat': sweList[1],
'lonspeed': sweList[3],
'latspee... |
Returns the longitude of an object.
def sweObjectLon(obj, jd):
""" Returns the longitude of an object. """
sweObj = SWE_OBJECTS[obj]
sweList = swisseph.calc_ut(jd, sweObj)
return sweList[0] |
Returns the julian date of the next transit of
an object. The flag should be 'RISE' or 'SET'.
def sweNextTransit(obj, jd, lat, lon, flag):
""" Returns the julian date of the next transit of
an object. The flag should be 'RISE' or 'SET'.
"""
sweObj = SWE_OBJECTS[obj]
flag = swisseph.CALC_R... |
Returns lists of houses and angles.
def sweHouses(jd, lat, lon, hsys):
""" Returns lists of houses and angles. """
hsys = SWE_HOUSESYS[hsys]
hlist, ascmc = swisseph.houses(jd, lat, lon, hsys)
# Add first house to the end of 'hlist' so that we
# can compute house sizes with an iterator
hlist +=... |
Returns lists with house and angle longitudes.
def sweHousesLon(jd, lat, lon, hsys):
""" Returns lists with house and angle longitudes. """
hsys = SWE_HOUSESYS[hsys]
hlist, ascmc = swisseph.houses(jd, lat, lon, hsys)
angles = [
ascmc[0],
ascmc[1],
angle.norm(ascmc[0] + 180),
... |
Returns a fixed star from the Ephemeris.
def sweFixedStar(star, jd):
""" Returns a fixed star from the Ephemeris. """
sweList = swisseph.fixstar_ut(star, jd)
mag = swisseph.fixstar_mag(star)
return {
'id': star,
'mag': mag,
'lon': sweList[0],
'lat': sweList[1]
} |
Returns the jd details of previous or next global solar eclipse.
def solarEclipseGlobal(jd, backward):
""" Returns the jd details of previous or next global solar eclipse. """
sweList = swisseph.sol_eclipse_when_glob(jd, backward=backward)
return {
'maximum': sweList[1][0],
'begin': sweLis... |
Returns the jd details of previous or next global lunar eclipse.
def lunarEclipseGlobal(jd, backward):
""" Returns the jd details of previous or next global lunar eclipse. """
sweList = swisseph.lun_eclipse_when(jd, backward=backward)
return {
'maximum': sweList[1][0],
'partial_begin': swe... |
Converts date to Julian Day Number.
def dateJDN(year, month, day, calendar):
""" Converts date to Julian Day Number. """
a = (14 - month) // 12
y = year + 4800 - a
m = month + 12*a - 3
if calendar == GREGORIAN:
return day + (153*m + 2)//5 + 365*y + y//4 - y//100 + y//400 - 32045
else:
... |
Converts Julian Day Number to Gregorian date.
def jdnDate(jdn):
""" Converts Julian Day Number to Gregorian date. """
a = jdn + 32044
b = (4*a + 3) // 146097
c = a - (146097*b) // 4
d = (4*c + 3) // 1461
e = c - (1461*d) // 4
m = (5*e + 2) // 153
day = e + 1 - (153*m + 2) // 5
month... |
Returns date as signed list.
def toList(self):
""" Returns date as signed list. """
date = self.date()
sign = '+' if date[0] >= 0 else '-'
date[0] = abs(date[0])
return list(sign) + date |
Returns date as string.
def toString(self):
""" Returns date as string. """
slist = self.toList()
sign = '' if slist[0] == '+' else '-'
string = '/'.join(['%02d' % v for v in slist[1:]])
return sign + string |
Returns a new Time object set to UTC given
an offset Time object.
def getUTC(self, utcoffset):
""" Returns a new Time object set to UTC given
an offset Time object.
"""
newTime = (self.value - utcoffset.value) % 24
return Time(newTime) |
Returns time as list [hh,mm,ss].
def time(self):
""" Returns time as list [hh,mm,ss]. """
slist = self.toList()
if slist[0] == '-':
slist[1] *= -1
# We must do a trick if we want to
# make negative zeros explicit
if slist[1] == -0:
... |
Returns time as signed list.
def toList(self):
""" Returns time as signed list. """
slist = angle.toList(self.value)
# Keep hours in 0..23
slist[1] = slist[1] % 24
return slist |
Returns time as string.
def toString(self):
""" Returns time as string. """
slist = self.toList()
string = angle.slistStr(slist)
return string if slist[0] == '-' else string[1:] |
Builds a Datetime object given a jd and utc offset.
def fromJD(jd, utcoffset):
""" Builds a Datetime object given a jd and utc offset. """
if not isinstance(utcoffset, Time):
utcoffset = Time(utcoffset)
localJD = jd + utcoffset.value / 24.0
date = Date(round(localJD))
... |
Returns this Datetime localized for UTC.
def getUTC(self):
""" Returns this Datetime localized for UTC. """
timeUTC = self.time.getUTC(self.utcoffset)
dateUTC = Date(round(self.jd))
return Datetime(dateUTC, timeUTC) |
Returns an object for a specific date and
location.
def getObject(ID, jd, lat, lon):
""" Returns an object for a specific date and
location.
"""
if ID == const.SOUTH_NODE:
obj = swe.sweObject(const.NORTH_NODE, jd)
obj.update({
'id': const.SOUTH_NODE,
'... |
Returns lists of houses and angles.
def getHouses(jd, lat, lon, hsys):
""" Returns lists of houses and angles. """
houses, angles = swe.sweHouses(jd, lat, lon, hsys)
for house in houses:
_signInfo(house)
for angle in angles:
_signInfo(angle)
return (houses, angles) |
Returns a fixed star.
def getFixedStar(ID, jd):
""" Returns a fixed star. """
star = swe.sweFixedStar(ID, jd)
_signInfo(star)
return star |
Returns the JD of the next sunrise.
def nextSunrise(jd, lat, lon):
""" Returns the JD of the next sunrise. """
return swe.sweNextTransit(const.SUN, jd, lat, lon, 'RISE') |
Returns the JD of the next sunset.
def nextSunset(jd, lat, lon):
""" Returns the JD of the next sunset. """
return swe.sweNextTransit(const.SUN, jd, lat, lon, 'SET') |
Appends the sign id and longitude to an object.
def _signInfo(obj):
""" Appends the sign id and longitude to an object. """
lon = obj['lon']
obj.update({
'sign': const.LIST_SIGNS[int(lon / 30)],
'signlon': lon % 30
}) |
Returns the ecliptic longitude of Pars Fortuna.
It considers diurnal or nocturnal conditions.
def pfLon(jd, lat, lon):
""" Returns the ecliptic longitude of Pars Fortuna.
It considers diurnal or nocturnal conditions.
"""
sun = swe.sweObjectLon(const.SUN, jd)
moon = swe.sweObjectLon(const.M... |
Returns true if the sun is above the horizon
of a given date and location.
def isDiurnal(jd, lat, lon):
""" Returns true if the sun is above the horizon
of a given date and location.
"""
sun = swe.sweObject(const.SUN, jd)
mc = swe.sweHousesLon(jd, lat, lon,
cons... |
Finds the latest new or full moon and
returns the julian date of that event.
def syzygyJD(jd):
""" Finds the latest new or full moon and
returns the julian date of that event.
"""
sun = swe.sweObjectLon(const.SUN, jd)
moon = swe.sweObjectLon(const.MOON, jd)
dist = angle.distance(sun, ... |
Finds the julian date before or after
'jd' when the sun is at longitude 'lon'.
It searches forward by default.
def solarReturnJD(jd, lon, forward=True):
""" Finds the julian date before or after
'jd' when the sun is at longitude 'lon'.
It searches forward by default.
"""
sun = swe.... |
Finds the aproximate julian date of the
next station of a planet.
def nextStationJD(ID, jd):
""" Finds the aproximate julian date of the
next station of a planet.
"""
speed = swe.sweObject(ID, jd)['lonspeed']
for i in range(2000):
nextjd = jd + i / 2
nextspeed = swe.sweObject(I... |
Removes all python cache files recursively on a path.
:param path: the path
:return: None
def clean_caches(path):
"""
Removes all python cache files recursively on a path.
:param path: the path
:return: None
"""
for dirname, subdirlist, filelist in os.walk(path):
for f in fi... |
Removes all .py files.
:param path: the path
:return: None
def clean_py_files(path):
"""
Removes all .py files.
:param path: the path
:return: None
"""
for dirname, subdirlist, filelist in os.walk(path):
for f in filelist:
if f.endswith('py'):
os.... |
Converts angle representation to float.
Accepts angles and strings such as "12W30:00".
def toFloat(value):
""" Converts angle representation to float.
Accepts angles and strings such as "12W30:00".
"""
if isinstance(value, str):
# Find lat/lon char in string and insert angle sign
... |
Converts angle float to string.
Mode refers to LAT/LON.
def toString(value, mode):
""" Converts angle float to string.
Mode refers to LAT/LON.
"""
string = angle.toString(value)
sign = string[0]
separator = CHAR[mode][sign]
string = string.replace(':', separator, 1)
return st... |
Return lat/lon as strings.
def strings(self):
""" Return lat/lon as strings. """
return [
toString(self.lat, LAT),
toString(self.lon, LON)
] |
Returns a list with the orb and angular
distances from obj1 to obj2, considering a
list of possible aspects.
def _orbList(obj1, obj2, aspList):
""" Returns a list with the orb and angular
distances from obj1 to obj2, considering a
list of possible aspects.
"""
sep = angle.closestdista... |
Returns the properties of the aspect of
obj1 to obj2, considering a list of possible
aspects.
This function makes the following assumptions:
- Syzygy does not start aspects but receives
any aspect.
- Pars Fortuna and Moon Nodes only starts
conjunctions but receive any aspect.
... |
Returns the properties of an aspect between
obj1 and obj2, given by 'aspDict'.
This function assumes obj1 to be the active object,
i.e., the one responsible for starting the aspect.
def _aspectProperties(obj1, obj2, aspDict):
""" Returns the properties of an aspect between
obj1 and obj2, giv... |
Returns which is the active and the passive objects.
def _getActivePassive(obj1, obj2):
""" Returns which is the active and the passive objects. """
speed1 = abs(obj1.lonspeed) if obj1.isPlanet() else -1.0
speed2 = abs(obj2.lonspeed) if obj2.isPlanet() else -1.0
if speed1 > speed2:
return {
... |
Returns the aspect type between objects considering
a list of possible aspect types.
def aspectType(obj1, obj2, aspList):
""" Returns the aspect type between objects considering
a list of possible aspect types.
"""
ap = _getActivePassive(obj1, obj2)
aspDict = _aspectDict(ap['active'], ap['... |
Returns if there is an aspect between objects
considering a list of possible aspect types.
def hasAspect(obj1, obj2, aspList):
""" Returns if there is an aspect between objects
considering a list of possible aspect types.
"""
aspType = aspectType(obj1, obj2, aspList)
return aspType != co... |
Returns if obj1 aspects obj2 within its orb,
considering a list of possible aspect types.
def isAspecting(obj1, obj2, aspList):
""" Returns if obj1 aspects obj2 within its orb,
considering a list of possible aspect types.
"""
aspDict = _aspectDict(obj1, obj2, aspList)
if aspDict:
... |
Returns an Aspect object for the aspect between two
objects considering a list of possible aspect types.
def getAspect(obj1, obj2, aspList):
""" Returns an Aspect object for the aspect between two
objects considering a list of possible aspect types.
"""
ap = _getActivePassive(obj1, obj2)
a... |
Returns the movement of this aspect.
The movement is the one of the active object, except
if the active is separating but within less than 1
degree.
def movement(self):
""" Returns the movement of this aspect.
The movement is the one of the active object, except
if th... |
Returns the role (active or passive) of an object
in this aspect.
def getRole(self, ID):
""" Returns the role (active or passive) of an object
in this aspect.
"""
if self.active.id == ID:
return {
'role': 'active',
'inOrb': se... |
Sets the default faces variant
def setFaces(variant):
"""
Sets the default faces variant
"""
global FACES
if variant == CHALDEAN_FACES:
FACES = tables.CHALDEAN_FACES
else:
FACES = tables.TRIPLICITY_FACES |
Sets the default terms of the Dignities
table.
def setTerms(variant):
"""
Sets the default terms of the Dignities
table.
"""
global TERMS
if variant == EGYPTIAN_TERMS:
TERMS = tables.EGYPTIAN_TERMS
elif variant == TETRABIBLOS_TERMS:
TERMS = tables.TETRABIBLOS_TERMS
... |
Returns the term for a sign and longitude.
def term(sign, lon):
""" Returns the term for a sign and longitude. """
terms = TERMS[sign]
for (ID, a, b) in terms:
if (a <= lon < b):
return ID
return None |
Returns the face for a sign and longitude.
def face(sign, lon):
""" Returns the face for a sign and longitude. """
faces = FACES[sign]
if lon < 10:
return faces[0]
elif lon < 20:
return faces[1]
else:
return faces[2] |
Returns the complete essential dignities
for a sign and longitude.
def getInfo(sign, lon):
""" Returns the complete essential dignities
for a sign and longitude.
"""
return {
'ruler': ruler(sign),
'exalt': exalt(sign),
'dayTrip': dayTrip(sign),
'nightTrip': nightTri... |
Returns if an object is peregrine
on a sign and longitude.
def isPeregrine(ID, sign, lon):
""" Returns if an object is peregrine
on a sign and longitude.
"""
info = getInfo(sign, lon)
for dign, objID in info.items():
if dign not in ['exile', 'fall'] and ID == objID:
return ... |
Returns the score of an object on
a sign and longitude.
def score(ID, sign, lon):
""" Returns the score of an object on
a sign and longitude.
"""
info = getInfo(sign, lon)
dignities = [dign for (dign, objID) in info.items() if objID == ID]
return sum([SCORES[dign] for dign in dignities]) |
Returns the almutem for a given
sign and longitude.
def almutem(sign, lon):
""" Returns the almutem for a given
sign and longitude.
"""
planets = const.LIST_SEVEN_PLANETS
res = [None, 0]
for ID in planets:
sc = score(ID, sign, lon)
if sc > res[1]:
res = [ID, sc]... |
Returns the dignities belonging to this object.
def getDignities(self):
""" Returns the dignities belonging to this object. """
info = self.getInfo()
dignities = [dign for (dign, objID) in info.items()
if objID == self.obj.id]
return dignities |
Returns if this object is peregrine.
def isPeregrine(self):
""" Returns if this object is peregrine. """
return isPeregrine(self.obj.id,
self.obj.sign,
self.obj.signlon) |
Internal function to return a new chart for
a specific date using properties from old chart.
def _computeChart(chart, date):
""" Internal function to return a new chart for
a specific date using properties from old chart.
"""
pos = chart.pos
hsys = chart.hsys
IDs = [obj.id for obj in c... |
Returns the solar return of a Chart
after a specific date.
def nextSolarReturn(chart, date):
""" Returns the solar return of a Chart
after a specific date.
"""
sun = chart.getObject(const.SUN)
srDate = ephem.nextSolarReturn(date, sun.lon)
return _computeChart(chart, srDate) |
Creates the planetary hour table for a date
and position.
The table includes both diurnal and nocturnal
hour sequences and each of the 24 entries (12 * 2)
are like (startJD, endJD, ruler).
def hourTable(date, pos):
""" Creates the planetary hour table for a date
and position.
... |
Returns an HourTable object.
def getHourTable(date, pos):
""" Returns an HourTable object. """
table = hourTable(date, pos)
return HourTable(table, date) |
Returns the index of a date in the table.
def index(self, date):
""" Returns the index of a date in the table. """
for (i, (start, end, ruler)) in enumerate(self.table):
if start <= date.jd <= end:
return i
return None |
Returns information about a specific
planetary time.
def indexInfo(self, index):
""" Returns information about a specific
planetary time.
"""
entry = self.table[index]
info = {
# Default is diurnal
'mode': 'Day',
'ruler': s... |
Returns a profection chart for a given
date. Receives argument 'fixedObjects' to
fix chart objects in their natal locations.
def compute(chart, date, fixedObjects=False):
""" Returns a profection chart for a given
date. Receives argument 'fixedObjects' to
fix chart objects in their natal locations.... |
Merges two list of objects removing
repetitions.
def _merge(listA, listB):
""" Merges two list of objects removing
repetitions.
"""
listA = [x.id for x in listA]
listB = [x.id for x in listB]
listA.extend(listB)
set_ = set(listA)
return list(set_) |
Computes the behavior.
def compute(chart):
""" Computes the behavior. """
factors = []
# Planets in House1 or Conjunct Asc
house1 = chart.getHouse(const.HOUSE1)
planetsHouse1 = chart.objects.getObjectsInHouse(house1)
asc = chart.getAngle(const.ASC)
planetsConjAsc = chart.objects.g... |
Returns a list with the absolute longitude
of all terms.
def termLons(TERMS):
""" Returns a list with the absolute longitude
of all terms.
"""
res = []
for i, sign in enumerate(SIGN_LIST):
termList = TERMS[sign]
res.extend([
ID,
sign,
s... |
Computes the Almutem table.
def compute(chart):
""" Computes the Almutem table. """
almutems = {}
# Hylegic points
hylegic = [
chart.getObject(const.SUN),
chart.getObject(const.MOON),
chart.getAngle(const.ASC),
chart.getObject(const.PARS_FORTUNA),
chart.getO... |
Gets the details for one or more resources by ID
Args:
cls - gophish.models.Model - The resource class
resource_id - str - The endpoint (URL path) for the resource
resource_action - str - An action to perform on the resource
resource_cls - cls - A class to use fo... |
Creates a new instance of the resource.
Args:
resource - gophish.models.Model - The resource instance
def post(self, resource):
""" Creates a new instance of the resource.
Args:
resource - gophish.models.Model - The resource instance
"""
response = sel... |
Edits an existing resource
Args:
resource - gophish.models.Model - The resource instance
def put(self, resource):
""" Edits an existing resource
Args:
resource - gophish.models.Model - The resource instance
"""
endpoint = self.endpoint
if reso... |
Deletes an existing resource
Args:
resource_id - int - The resource ID to be deleted
def delete(self, resource_id):
""" Deletes an existing resource
Args:
resource_id - int - The resource ID to be deleted
"""
endpoint = '{}/{}'.format(self.endpoint, re... |
Returns a dict representation of the resource
def as_dict(self):
""" Returns a dict representation of the resource """
result = {}
for key in self._valid_properties:
val = getattr(self, key)
if isinstance(val, datetime):
val = val.isoformat()
... |
Executes a request to a given endpoint, returning the result
def execute(self, method, path, **kwargs):
""" Executes a request to a given endpoint, returning the result """
url = "{}{}".format(self.host, path)
kwargs.update(self._client_kwargs)
response = requests.request(
... |
Complete an existing campaign (Stop processing events)
def complete(self, campaign_id):
""" Complete an existing campaign (Stop processing events) """
return super(API, self).get(
resource_id=campaign_id, resource_action='complete') |
Returns the campaign summary
def summary(self, campaign_id=None):
""" Returns the campaign summary """
resource_cls = CampaignSummary
single_resource = False
if not campaign_id:
resource_cls = CampaignSummaries
single_resource = True
return super(API, s... |
Returns just the results for a given campaign
def results(self, campaign_id):
""" Returns just the results for a given campaign """
return super(API, self).get(
resource_id=campaign_id,
resource_action='results',
resource_cls=CampaignResults) |
Set the path of the database.
Create the file if it does not exist.
def set_path(self, file_path):
"""
Set the path of the database.
Create the file if it does not exist.
"""
if not file_path:
self.read_data = self.memory_read
self.write_data = se... |
Removes the specified key from the database.
def delete(self, key):
"""
Removes the specified key from the database.
"""
obj = self._get_content()
obj.pop(key, None)
self.write_data(self.path, obj) |
If a key is passed in, a corresponding value will be returned.
If a key-value pair is passed in then the corresponding key in
the database will be set to the specified value.
A dictionary can be passed in as well.
If a key does not exist and a value is provided then an entry
will... |
Takes a dictionary of filter parameters.
Return a list of objects based on a list of parameters.
def filter(self, filter_arguments):
"""
Takes a dictionary of filter parameters.
Return a list of objects based on a list of parameters.
"""
results = self._get_content()
... |
Remove the database by deleting the JSON file.
def drop(self):
"""
Remove the database by deleting the JSON file.
"""
import os
if self.path:
if os.path.exists(self.path):
os.remove(self.path)
else:
# Clear the in-memory data if t... |
Reads a file and returns a json encoded representation of the file.
def read_data(file_path):
"""
Reads a file and returns a json encoded representation of the file.
"""
if not is_valid(file_path):
write_data(file_path, {})
db = open_file_for_reading(file_path)
content = db.read()
... |
Writes to a file and returns the updated file content.
def write_data(path, obj):
"""
Writes to a file and returns the updated file content.
"""
with open_file_for_writing(path) as db:
db.write(encode(obj))
return obj |
Check to see if a file exists or is empty.
def is_valid(file_path):
"""
Check to see if a file exists or is empty.
"""
from os import path, stat
can_open = False
try:
with open(file_path) as fp:
can_open = True
except IOError:
return False
is_file = path.i... |
Canonically refine a mesh by inserting nodes at all edge midpoints
and make four triangular elements where there was one.
This is a very crude refinement; don't use for actual applications.
def _refine(node_coords, cells_nodes, edge_nodes, cells_edges):
"""Canonically refine a mesh by inserting nodes at al... |
Setup edge-node and edge-cell relations. Adapted from voropy.
def create_edges(cells_nodes):
"""Setup edge-node and edge-cell relations. Adapted from voropy.
"""
# Create the idx_hierarchy (nodes->edges->cells), i.e., the value of
# `self.idx_hierarchy[0, 2, 27]` is the index of the node of cell 27, ed... |
Plot a 2D mesh using matplotlib.
def plot2d(points, cells, mesh_color="k", show_axes=False):
"""Plot a 2D mesh using matplotlib.
"""
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
fig = plt.figure()
ax = fig.gca()
plt.axis("equal")
if not show_axes:
... |
Perform a job by a member in the pool and return the result.
def put(self, job, result):
"Perform a job by a member in the pool and return the result."
self.job.put(job)
r = result.get()
return r |
Perform a contract on a number of jobs and block until a result is
retrieved for each job.
def contract(self, jobs, result):
"""
Perform a contract on a number of jobs and block until a result is
retrieved for each job.
"""
for j in jobs:
WorkerPool.put(self,... |
Canonical tetrahedrization of the cube.
Input:
Edge lenghts of the cube
Number of nodes along the edges.
def cube(
xmin=0.0, xmax=1.0, ymin=0.0, ymax=1.0, zmin=0.0, zmax=1.0, nx=11, ny=11, nz=11
):
"""Canonical tetrahedrization of the cube.
Input:
Edge lenghts of the cube
Number of node... |
Add another worker to the pool.
def grow(self):
"Add another worker to the pool."
t = self.worker_factory(self)
t.start()
self._size += 1 |
Get rid of one worker from the pool. Raises IndexError if empty.
def shrink(self):
"Get rid of one worker from the pool. Raises IndexError if empty."
if self._size <= 0:
raise IndexError("pool is already empty")
self._size -= 1
self.put(SuicideJob()) |
Perform a map operation distributed among the workers. Will
def map(self, fn, *seq):
"Perform a map operation distributed among the workers. Will "
"block until done."
results = Queue()
args = zip(*seq)
for seq in args:
j = SimpleJob(results, fn, seq)
sel... |
Creates a simplistic triangular mesh on a slightly Möbius strip. The
Möbius strip here deviates slightly from the ordinary geometry in that it
is constructed in such a way that the two halves can be exchanged as to
allow better comparison with the pseudo-Möbius geometry.
The mode is either `'classical'... |
Get jobs from the queue and perform them as they arrive.
def run(self):
"Get jobs from the queue and perform them as they arrive."
while 1:
# Sleep until there is a job to perform.
job = self.jobs.get()
# Yawn. Time to get some work done.
try:
... |
Open a web browser pointing to geojson.io with the specified content.
If the content is large, an anonymous gist will be created on github and
the URL will instruct geojson.io to download the gist data and then
display. If the content is small, this step is not needed as the data can
be included in the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.