output stringlengths 1 928k | instruction stringlengths 7 928k | system stringlengths 0 104k |
|---|---|---|
def __sepApp(self, IDs, aspList):
""" Returns true if the object last and next movement are
separations and applications to objects in list IDs.
It only considers aspects in aspList.
This function is static since it does not test if the next
application will be indeed pe... | Can you implement a function in Python 3 that
returns true if the object last and next movement are separations and applications to objects in list IDs. | You are a Python code architect, reviewing and designing scalable and efficient code |
def isAuxilied(self):
""" Returns if the object is separating and applying to
a benefic considering good aspects.
"""
benefics = [const.VENUS, const.JUPITER]
return self.__sepApp(benefics, aspList=[0, 60, 120]) | How would you code a function in Python 3 to
return True if the object is separating and applying to a benefic considering good aspects. | You are a Python code architect, reviewing and designing scalable and efficient code |
def isSurrounded(self):
""" Returns if the object is separating and applying to
a malefic considering bad aspects.
"""
malefics = [const.MARS, const.SATURN]
return self.__sepApp(malefics, aspList=[0, 90, 180]) | Create a Python 3 function to
return True if the object is separating and applying to a malefic considering bad aspects. | You are a Python code generator, capable of creating scripts from specifications. |
def isConjNorthNode(self):
""" Returns if object is conjunct north node. """
node = self.chart.getObject(const.NORTH_NODE)
return aspects.hasAspect(self.obj, node, aspList=[0]) | Write a Python 3 function for
returning if object is conjunct north node. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def isConjSouthNode(self):
""" Returns if object is conjunct south node. """
node = self.chart.getObject(const.SOUTH_NODE)
return aspects.hasAspect(self.obj, node, aspList=[0]) | Implement a function in Python 3 to
return if object is conjunct south node. | You are a Python code generator, capable of creating scripts from specifications. |
def isFeral(self):
""" Returns true if the object does not have any
aspects.
"""
planets = copy(const.LIST_SEVEN_PLANETS)
planets.remove(self.obj.id)
for otherID in planets:
otherObj = self.chart.getObject(otherID)
if aspects.hasAspect(se... | Can you write a function in Python 3 where it
returns true if the object has any as well as any . | As a python code expert, you are capable of creating scripts from specifications. |
Returns the accidental dignity score of the object
as dict. | Given the following Python 3 function, write the documentation
def getScoreProperties(self):
obj = self.obj
score = {}
# Peregrine
isPeregrine = essential.isPeregrine(obj.id, obj.sign, obj.signlon)
score['peregrine'] = -5 if isPeregrine else 0
# Ruler-Ru... | As a python code expert, you are capable of creating scripts from specifications. |
Returns the non - zero accidental dignities. | How would you explain what the following Python 3 function does
def getActiveProperties(self):
score = self.getScoreProperties()
return {key: value for (key, value) in score.items()
if value != 0} | You are a Python code architect, reviewing and designing scalable and efficient code |
def score(self):
""" Returns the sum of the accidental dignities
score.
"""
if not self.scoreProperties:
self.scoreProperties = self.getScoreProperties()
return sum(self.scoreProperties.values()) | Can you write a function in Python 3 where it
returns the sum of the accidental dignities clf. | As a Python code analyst, you investigate and solve complex coding mysteries |
def fromDict(cls, _dict):
""" Builds instance from dictionary of properties. """
obj = cls()
obj.__dict__.update(_dict)
return obj | Implement a Python 3 function for
building an object from a dictionary of properties. | You are a Python code architect, reviewing and designing scalable and efficient code |
def eqCoords(self, zerolat=False):
""" Returns the Equatorial Coordinates of this object.
Receives a boolean parameter to consider a zero latitude.
"""
lat = 0.0 if zerolat else self.lat
return utils.eqCoords(self.lon, lat) | Write a Python 3 function for
returning the Equatorial Coordinates of this object. | As a Python code analyst, you investigate and solve complex coding mysteries |
def relocate(self, lon):
""" Relocates this object to a new longitude. """
self.lon = angle.norm(lon)
self.signlon = self.lon % 30
self.sign = const.LIST_SIGNS[int(self.lon / 30.0)] | Write a Python 3 script to
relocate this object to a new longitude. | You are a Python code generator, capable of creating scripts from specifications. |
Returns an antiscia object. | Can you generate the documentation for the following Python 3 function
def antiscia(self):
obj = self.copy()
obj.type = const.OBJ_GENERIC
obj.relocate(360 - obj.lon + 180)
return obj | You are a Python code architect, reviewing and designing scalable and efficient code |
Returns if this object is direct retrograde
or stationary. Otherwise returns direct retrograde
. | Can you generate the documentation for the following Python 3 function
def movement(self):
if abs(self.lonspeed) < 0.0003:
return const.STATIONARY
elif self.lonspeed > 0:
return const.DIRECT
else:
return const.RETROGRADE | As a Python code composer, you craft elegant and concise scripts. |
Returns True if a longitude belongs to this house. | Can you generate a brief explanation for the following Python 3 code
def inHouse(self, lon):
dist = angle.distance(self.lon + House._OFFSET, lon)
return dist < self.size | You are a Python code architect, reviewing and designing scalable and efficient code |
Returns the orb of this fixed star. | Make a summary of the following Python 3 code
def orb(self):
for (mag, orb) in FixedStar._ORBS:
if self.mag < mag:
return orb
return 0.5 | You are a Python code architect, reviewing and designing scalable and efficient code |
def aspects(self, obj):
""" Returns true if this star aspects another object.
Fixed stars only aspect by conjunctions.
"""
dist = angle.closestdistance(self.lon, obj.lon)
return abs(dist) < self.orb() | Write a Python 3 script for
returning true if this star aspects another object. | As a python code expert, you are capable of creating scripts from specifications. |
def getObjectsInHouse(self, house):
""" Returns a list with all objects in a house. """
res = [obj for obj in self if house.hasObject(obj)]
return ObjectList(res) | Implement a function in Python 3 to
return a list with all objects in a house. | You are a Python code architect, reviewing and designing scalable and efficient code |
Returns a list of objects aspecting a point
considering a list of possible aspects. | Given the following Python 3 function, write the documentation
def getObjectsAspecting(self, point, aspList):
res = []
for obj in self:
if obj.isPlanet() and aspects.isAspecting(obj, point, aspList):
res.append(obj)
return ObjectList(res) | As a Python code composer, you craft elegant and concise scripts. |
Returns the arc of direction between a promissor and significator. | Make a summary of the following Python 3 code
def arc(pRA, pDecl, sRA, sDecl, mcRA, lat):
pDArc, pNArc = utils.dnarcs(pDecl, lat)
sDArc, sNArc = utils.dnarcs(sDecl, lat)
# Select meridian and arcs to be used
# Default is MC and Diurnal arcs
mdRA = mcRA
sArc = sDArc
pArc = pDArc
if n... | As a python code expert, you are capable of creating scripts from specifications. |
def getArc(prom, sig, mc, pos, zerolat):
""" Returns the arc of direction between a promissor
and a significator. Arguments are also the MC, the
geoposition and zerolat to assume zero ecliptical
latitudes.
ZeroLat true => inZodiaco, false => inMundo
"""
pRA, pDecl = prom.eqCoords(... | Write a Python 3 script to
return the arc of direction between a promissor and a significator. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def _buildTerms(self):
""" Builds a data structure indexing the terms
longitude by sign and object.
"""
termLons = tables.termLons(tables.EGYPTIAN_TERMS)
res = {}
for (ID, sign, lon) in termLons:
try:
res[sign][ID] = lon
ex... | Write a Python 3 script to
build a data structure indexing the terms longitude by sign and object. | As a Python code translator, you convert algorithms and pseudocode into Python. |
Creates a generic entry for an object. | Here you have a function in Python 3, explain what it does
def G(self, ID, lat, lon):
# Equatorial coordinates
eqM = utils.eqCoords(lon, lat)
eqZ = eqM
if lat != 0:
eqZ = utils.eqCoords(lon, 0)
return {
'id': ID,
'lat': lat,
... | As a python code expert, you are capable of creating scripts from specifications. |
Returns the term of an object in a sign. | Can you generate a brief explanation for the following Python 3 code
def T(self, ID, sign):
lon = self.terms[sign][ID]
ID = 'T_%s_%s' % (ID, sign)
return self.G(ID, 0, lon) | As a python code expert, you are capable of creating scripts from specifications. |
Returns the Antiscia of an object. | Given the following Python 3 function, write the documentation
def A(self, ID):
obj = self.chart.getObject(ID).antiscia()
ID = 'A_%s' % (ID)
return self.G(ID, obj.lat, obj.lon) | As a Python code composer, you craft elegant and concise scripts. |
Returns the CAntiscia of an object. | Can you generate a brief explanation for the following Python 3 code
def C(self, ID):
obj = self.chart.getObject(ID).cantiscia()
ID = 'C_%s' % (ID)
return self.G(ID, obj.lat, obj.lon) | As a Python code analyst, you investigate and solve complex coding mysteries |
def D(self, ID, asp):
""" Returns the dexter aspect of an object. """
obj = self.chart.getObject(ID).copy()
obj.relocate(obj.lon - asp)
ID = 'D_%s_%s' % (ID, asp)
return self.G(ID, obj.lat, obj.lon) | How would you code a function in Python 3 to
return the dexter aspect of an object. | As a Python code composer, you craft elegant and concise scripts. |
def N(self, ID, asp=0):
""" Returns the conjunction or opposition aspect
of an object.
"""
obj = self.chart.get(ID).copy()
obj.relocate(obj.lon + asp)
ID = 'N_%s_%s' % (ID, asp)
return self.G(ID, obj.lat, obj.lon) | How would you implement a function in Python 3 that
returns the conjunction or opposition aspect of an object. | You are a Python code architect, reviewing and designing scalable and efficient code |
Computes the in - zodiaco and in - mundo arcs
between a promissor and a significator. | Explain what the following Python 3 code does
def _arc(self, prom, sig):
arcm = arc(prom['ra'], prom['decl'],
sig['ra'], sig['decl'],
self.mcRA, self.lat)
arcz = arc(prom['raZ'], prom['declZ'],
sig['raZ'], sig['declZ'],
self... | You are a Python code generator, capable of creating scripts from specifications. |
Returns the arcs between a promissor and a significator. | Can you generate a brief explanation for the following Python 3 code
def getArc(self, prom, sig):
res = self._arc(prom, sig)
res.update({
'prom': prom['id'],
'sig': sig['id']
})
return res | As a python code expert, you are capable of creating scripts from specifications. |
Returns the IDs as objects considering the aspList and the function. | How would you explain what the following Python 3 function does
def _elements(self, IDs, func, aspList):
res = []
for asp in aspList:
if (asp in [0, 180]):
# Generate func for conjunctions and oppositions
if func == self.N:
res.extend([func... | You are a Python code architect, reviewing and designing scalable and efficient code |
Returns a list with the objects as terms. | Can you generate a brief explanation for the following Python 3 code
def _terms(self):
res = []
for sign, terms in self.terms.items():
for ID, lon in terms.items():
res.append(self.T(ID, sign))
return res | As a Python code translator, you convert algorithms and pseudocode into Python. |
def getList(self, aspList):
""" Returns a sorted list with all
primary directions.
"""
# Significators
objects = self._elements(self.SIG_OBJECTS, self.N, [0])
houses = self._elements(self.SIG_HOUSES, self.N, [0])
angles = self._elements(self.SIG_ANGLES, ... | How would you implement a function in Python 3 that
returns a sorted list with all the primary directions. Arcs and significators are returned. | As a Python code translator, you convert algorithms and pseudocode into Python. |
def view(self, arcmin, arcmax):
""" Returns the directions within the
min and max arcs.
"""
res = []
for direction in self.table:
if arcmin < direction[0] < arcmax:
res.append(direction)
return res | Write a Python 3 script for
returning the directions within the arcmin and arcmax arcs. | You are a Python code architect, reviewing and designing scalable and efficient code |
def bySignificator(self, ID):
""" Returns all directions to a significator. """
res = []
for direction in self.table:
if ID in direction[2]:
res.append(direction)
return res | Create a Python 3 function for
returning all directions to a significator. | As a Python code composer, you craft elegant and concise scripts. |
Returns all directions to a promissor. | Can you generate the documentation for the following Python 3 function
def byPromissor(self, ID):
res = []
for direction in self.table:
if ID in direction[1]:
res.append(direction)
return res | You are a Python code analyst, evaluating scripts for potential improvements. |
def copy(self):
""" Returns a deep copy of this chart. """
chart = Chart.__new__(Chart)
chart.date = self.date
chart.pos = self.pos
chart.hsys = self.hsys
chart.objects = self.objects.copy()
chart.houses = self.houses.copy()
chart.angles = self.angles.copy... | Create a Python 3 function for
returning a deep copy of this chart. | As a Python code analyst, you investigate and solve complex coding mysteries |
Returns an object house or angle
from the chart. | Can you generate a brief explanation for the following Python 3 code
def get(self, ID):
if ID.startswith('House'):
return self.getHouse(ID)
elif ID in const.LIST_ANGLES:
return self.getAngle(ID)
else:
return self.getObject(ID) | You are a Python code analyst, evaluating scripts for potential improvements. |
Returns a list with all fixed stars. | Make a summary of the following Python 3 code
def getFixedStars(self):
IDs = const.LIST_FIXED_STARS
return ephem.getFixedStarList(IDs, self.date) | As a Python code composer, you craft elegant and concise scripts. |
Returns true if House1 is the same as Asc. | Can you generate the documentation for the following Python 3 function
def isHouse1Asc(self):
house1 = self.getHouse(const.HOUSE1)
asc = self.getAngle(const.ASC)
dist = angle.closestdistance(house1.lon, asc.lon)
return abs(dist) < 0.0003 | As a Python code translator, you convert algorithms and pseudocode into Python. |
def isHouse10MC(self):
""" Returns true if House10 is the same as the MC. """
house10 = self.getHouse(const.HOUSE10)
mc = self.getAngle(const.MC)
dist = angle.closestdistance(house10.lon, mc.lon)
return abs(dist) < 0.0003 | Implement a Python 3 function for
returning true if House10 is the same as the MC. | As a Python code analyst, you investigate and solve complex coding mysteries |
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
sunRA, sunDecl = utils.eqCoords(sun... | Implement a Python 3 function for
returning true if this chart is diurnal. | You are a Python code analyst, evaluating scripts for potential improvements. |
Returns the phase of the moon. | How would you explain what the following Python 3 function does
def getMoonPhase(self):
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 < 180:
... | You are a Python code architect, reviewing and designing scalable and efficient code |
Returns this chart s solar return for a
given year. | Here you have a function in Python 3, explain what it does
def solarReturn(self, year):
sun = self.getObject(const.SUN)
date = Datetime('{0}/01/01'.format(year),
'00:00',
self.date.utcoffset)
srDate = ephem.nextSolarReturn(date, sun.lon)
re... | You are a Python code analyst, evaluating scripts for potential improvements. |
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
elif ID.startswith('Pars'):
... | How would you code a function in Python 3 to
return the longitude of an object. | As a Python code composer, you craft elegant and concise scripts. |
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)
return c + b - a | Write a Python 3 function that can
return the longitude of an arabic part. | You are a Python code analyst, evaluating scripts for potential improvements. |
Returns an Arabic Part. | Make a summary of the following Python 3 code
def getPart(ID, chart):
obj = GenericObject()
obj.id = ID
obj.type = const.OBJ_ARABIC_PART
obj.relocate(partLon(ID, chart))
return obj | As a python code expert, you are capable of creating scripts from specifications. |
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],
'latspeed': sweList[4]
} | Can you implement a function in Python 3 that
returns an object from the Ephemeris. | As a python code expert, you are capable of creating scripts from specifications. |
Returns the longitude of an object in the given JD. | Can you tell what is the following Python 3 function doing
def sweObjectLon(obj, jd):
sweObj = SWE_OBJECTS[obj]
sweList = swisseph.calc_ut(jd, sweObj)
return sweList[0] | As a Python code translator, you convert algorithms and pseudocode into Python. |
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_RISE if flag == 'RISE' else swisseph.CALC_SET
trans = swisseph.rise_trans(jd, sweObj, lon, lat, ... | Can you create a Python 3 function that
returns the julian date of the next transit of the object. | As a Python code composer, you craft elegant and concise scripts. |
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 += (hlist[0],)
houses = [
{... | Write a Python 3 script for
returning a list of lists of houses and angles. | You are a Python code generator, capable of creating scripts from specifications. |
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),
angle.norm(ascmc[1] + 180)
]
retur... | Write a Python 3 script to
return lists with house and angle longitudes. | You are a Python code generator, capable of creating scripts from specifications. |
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]
} | Write a Python 3 script to
return a fixed star from the Ephemeris. | As a Python code translator, you convert algorithms and pseudocode into Python. |
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': sweList[1][2],
'end': sweList[1][3],
'totality_begin': s... | Implement a function in Python 3 to
return the jd details of the previous or next global solar eclipse. | You are a Python code architect, reviewing and designing scalable and efficient code |
Returns the jd details of the previous or next global lunar eclipse. | Make a summary of the following Python 3 code
def lunarEclipseGlobal(jd, backward):
sweList = swisseph.lun_eclipse_when(jd, backward=backward)
return {
'maximum': sweList[1][0],
'partial_begin': sweList[1][2],
'partial_end': sweList[1][3],
'totality_begin': sweList[1][4],
... | You are a Python code generator, capable of creating scripts from specifications. |
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:
return day + (153*m + 2)//5 + ... | Create a Python 3 function to
convert date to Julian Day Number. | As a python code expert, you are capable of creating scripts from specifications. |
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 = m + 3 - 12*(m//10)
year = 100*b + d - 48... | How would you implement a function in Python 3 that
converts Julian Day Number to Gregorian date. | As a Python code composer, you craft elegant and concise scripts. |
Returns date as signed list. | Can you generate a brief explanation for the following Python 3 code
def toList(self):
date = self.date()
sign = '+' if date[0] >= 0 else '-'
date[0] = abs(date[0])
return list(sign) + date | As a Python code translator, you convert algorithms and pseudocode into Python. |
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 | Write a Python 3 script for
returning a string representation of the current time entry. | You are a Python code generator, capable of creating scripts from specifications. |
Returns a new Time object set to UTC given
an offset Time object. | Explain what the following Python 3 code does
def getUTC(self, utcoffset):
newTime = (self.value - utcoffset.value) % 24
return Time(newTime) | As a python code expert, you are capable of creating scripts from specifications. |
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:
slist[1] = -0.0
return s... | Implement a function in Python 3 to
return time as list [ hh mm ss ] | As a python code expert, you are capable of creating scripts from specifications. |
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 | Implement a function in Python 3 to
return time as signed list. | You are a Python code architect, reviewing and designing scalable and efficient code |
def toString(self):
""" Returns time as string. """
slist = self.toList()
string = angle.slistStr(slist)
return string if slist[0] == '-' else string[1:] | Create a Python 3 function to
return time as string. | You are a Python code architect, reviewing and designing scalable and efficient code |
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))
time = Time((localJD + 0.5 - date.jdn) * 24)
... | How would you code a function in Python 3 to
build a Datetime object given a jd and utc offset. | You are a Python code analyst, evaluating scripts for potential improvements. |
def getUTC(self):
""" Returns this Datetime localized for UTC. """
timeUTC = self.time.getUTC(self.utcoffset)
dateUTC = Date(round(self.jd))
return Datetime(dateUTC, timeUTC) | How would you code a function in Python 3 to
return this Datetime localized for UTC. | As a python code expert, you are capable of creating scripts from specifications. |
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,
'lon': angle.norm(obj['lon'] + 180)
})
elif ID ... | How would you implement a function in Python 3 that
returns an object for a specific date and location. | As a Python code composer, you craft elegant and concise scripts. |
Returns a list of lists of houses and angles. | Explain what the following Python 3 code does
def getHouses(jd, lat, lon, hsys):
houses, angles = swe.sweHouses(jd, lat, lon, hsys)
for house in houses:
_signInfo(house)
for angle in angles:
_signInfo(angle)
return (houses, angles) | You are a Python code generator, capable of creating scripts from specifications. |
def getFixedStar(ID, jd):
""" Returns a fixed star. """
star = swe.sweFixedStar(ID, jd)
_signInfo(star)
return star | Create a Python 3 function for
returning a fixed star. | You are a Python code generator, capable of creating scripts from specifications. |
def nextSunrise(jd, lat, lon):
""" Returns the JD of the next sunrise. """
return swe.sweNextTransit(const.SUN, jd, lat, lon, 'RISE') | Write a Python 3 function for
returning the JD of the next sunrise. | You are a Python code analyst, evaluating scripts for potential improvements. |
def nextSunset(jd, lat, lon):
""" Returns the JD of the next sunset. """
return swe.sweNextTransit(const.SUN, jd, lat, lon, 'SET') | Implement a Python 3 function for
returning the JD of the next sunset | You are a Python code architect, reviewing and designing scalable and efficient code |
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
}) | Can you implement a function in Python 3 that
adds the sign id and longitude to an object. | As a python code expert, you are capable of creating scripts from specifications. |
Returns the ecliptic longitude of Pars Fortuna. | Explain what the following Python 3 code does
def pfLon(jd, lat, lon):
sun = swe.sweObjectLon(const.SUN, jd)
moon = swe.sweObjectLon(const.MOON, jd)
asc = swe.sweHousesLon(jd, lat, lon,
const.HOUSES_DEFAULT)[1][0]
if isDiurnal(jd, lat, lon):
return angle.norm(asc ... | As a Python code analyst, you investigate and solve complex coding mysteries |
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,
const.HOUSES_DEFAULT)[1][1]
ra, decl = utils.eqCoords(sun['lon'], sun['lat'])
... | Can you write a function in Python 3 where it
returns true if the sun is above the horizon of a given date and location. | As a Python code composer, you craft elegant and concise scripts. |
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, moon)
# Offset represents the Syzygy type.
# Zero is conjunction and... | Write a Python 3 script to
find the latest new or full moon and returns the julian date of that event. | As a Python code composer, you craft elegant and concise scripts. |
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.sweObjectLon(const.SUN, jd)
if forward:
dist = angle.distance(sun, lon)
else:
dist = -angle.distan... | How would you implement a function in Python 3 that
finds the julian date before or after jd when the sun is at longitude lon. | You are a Python code architect, reviewing and designing scalable and efficient code |
Finds the aproximate julian date of the next station of a planet. Returns None if no next station is found. | Can you generate a brief explanation for the following Python 3 code
def nextStationJD(ID, jd):
speed = swe.sweObject(ID, jd)['lonspeed']
for i in range(2000):
nextjd = jd + i / 2
nextspeed = swe.sweObject(ID, nextjd)['lonspeed']
if speed * nextspeed <= 0:
return nextjd
r... | You are a Python code architect, reviewing and designing scalable and efficient code |
Removes all python cache files recursively on a path. | Can you tell what is the following Python 3 function doing
def clean_caches(path):
for dirname, subdirlist, filelist in os.walk(path):
for f in filelist:
if f.endswith('pyc'):
try:
os.remove(os.path.join(dirname, f))
except FileNotFoundError:... | As a Python code analyst, you investigate and solve complex coding mysteries |
Removes all. py files in the path. | Make a summary of the following Python 3 code
def clean_py_files(path):
for dirname, subdirlist, filelist in os.walk(path):
for f in filelist:
if f.endswith('py'):
os.remove(os.path.join(dirname, f)) | As a python code expert, you are capable of creating scripts from specifications. |
Converts angle representation to float.
Accepts strings such as 12W30 : 00. | Can you generate a brief explanation for the following Python 3 code
def toFloat(value):
if isinstance(value, str):
# Find lat/lon char in string and insert angle sign
value = value.upper()
for char in ['N', 'S', 'E', 'W']:
if char in value:
value = SIGN[char] + v... | As a Python code translator, you convert algorithms and pseudocode into Python. |
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 string[1:] | Create a Python 3 function for
converting a float to a string. | You are a Python code analyst, evaluating scripts for potential improvements. |
def strings(self):
""" Return lat/lon as strings. """
return [
toString(self.lat, LAT),
toString(self.lon, LON)
] | Can you create a Python 3 function that
returns lat / lon as strings. | As a python code expert, you are capable of creating scripts from specifications. |
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.closestdistance(obj1.lon, obj2.lon)
absSep = abs(sep)
return [
{
'type': asp,
'orb': abs(a... | How would you code a function in Python 3 to
return a list with the orb and angular distances from obj1 to obj2 considering a list of possible aspects. | You are a Python code generator, capable of creating scripts from specifications. |
Returns the properties of the aspect of
obj1 to obj2 considering a list of possible aspects. | Can you tell what is the following Python 3 function doing
def _aspectDict(obj1, obj2, aspList):
# Ignore aspects from same and Syzygy
if obj1 == obj2 or obj1.id == const.SYZYGY:
return None
orbs = _orbList(obj1, obj2, aspList)
for aspDict in orbs:
asp = aspDict['type']
orb ... | As a python code expert, you are capable of creating scripts from specifications. |
def _aspectProperties(obj1, obj2, aspDict):
""" 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.
"""
orb = aspDict['orb']
asp = aspDict['type']
... | Can you implement a function in Python 3 that
returns the properties of an aspect between obj1 and obj2 given by aspDict. | You are a Python code analyst, evaluating scripts for potential improvements. |
Returns which is the active and the passive objects. | Can you generate a brief explanation for the following Python 3 code
def _getActivePassive(obj1, obj2):
speed1 = abs(obj1.lonspeed) if obj1.isPlanet() else -1.0
speed2 = abs(obj2.lonspeed) if obj2.isPlanet() else -1.0
if speed1 > speed2:
return {
'active': obj1,
'passive': ob... | As a Python code analyst, you investigate and solve complex coding mysteries |
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['passive'], aspList)
return aspDict['type'] if aspDict else const.NO_ASPECT | Implement a function in Python 3 to
return the aspect type between objects considering a list of possible aspect types. | You are a Python code generator, capable of creating scripts from specifications. |
Returns True if there is an aspect between objects
considering a list of possible aspect types. | Make a summary of the following Python 3 code
def hasAspect(obj1, obj2, aspList):
aspType = aspectType(obj1, obj2, aspList)
return aspType != const.NO_ASPECT | You are a Python code analyst, evaluating scripts for potential improvements. |
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:
return aspDict['orb'] < obj1.orb()
return False | Write a Python 3 function for
returning True if obj1 aspects obj2 within its orb considering a list of possible aspect types. | As a Python code analyst, you investigate and solve complex coding mysteries |
Returns an Aspect object for the aspect between two objects considering a list of possible aspect types. | Given the following Python 3 function, write the documentation
def getAspect(obj1, obj2, aspList):
ap = _getActivePassive(obj1, obj2)
aspDict = _aspectDict(ap['active'], ap['passive'], aspList)
if not aspDict:
aspDict = {
'type': const.NO_ASPECT,
'orb': 0,
'separa... | You are a Python code architect, reviewing and designing scalable and efficient code |
def movement(self):
""" 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.
"""
mov = self.active.movement
if self.orb < 1 and mov == const.SEPARATIVE:
... | Can you write a function in Python 3 where it
returns the movement of this aspect. | You are a Python code analyst, evaluating scripts for potential improvements. |
Returns the role of an object in this aspect. | Make a summary of the following Python 3 code
def getRole(self, ID):
if self.active.id == ID:
return {
'role': 'active',
'inOrb': self.active.inOrb,
'movement': self.active.movement
}
elif self.passive.id == ID:
return {... | As a Python code analyst, you investigate and solve complex coding mysteries |
def setFaces(variant):
"""
Sets the default faces variant
"""
global FACES
if variant == CHALDEAN_FACES:
FACES = tables.CHALDEAN_FACES
else:
FACES = tables.TRIPLICITY_FACES | Write a Python 3 function for
setting the default faces for the given variant | As a Python code translator, you convert algorithms and pseudocode into Python. |
Sets the default terms of the Dignities
table. | Here you have a function in Python 3, explain what it does
def setTerms(variant):
global TERMS
if variant == EGYPTIAN_TERMS:
TERMS = tables.EGYPTIAN_TERMS
elif variant == TETRABIBLOS_TERMS:
TERMS = tables.TETRABIBLOS_TERMS
elif variant == LILLY_TERMS:
TERMS = tables.LILLY_TERMS | As a Python code analyst, you investigate and solve complex coding mysteries |
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 | Write a Python 3 function for
returning the term for a sign and longitude. | As a Python code translator, you convert algorithms and pseudocode into Python. |
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] | Create a Python 3 function to
return the face for a sign and longitude. | You are a Python code architect, reviewing and designing scalable and efficient code |
Returns the complete essential dignities
for a sign and longitude. | Given the following Python 3 function, write the documentation
def getInfo(sign, lon):
return {
'ruler': ruler(sign),
'exalt': exalt(sign),
'dayTrip': dayTrip(sign),
'nightTrip': nightTrip(sign),
'partTrip': partTrip(sign),
'term': term(sign, lon),
'face': fac... | As a Python code analyst, you investigate and solve complex coding mysteries |
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 False
return True | Create a Python 3 function for
returning True if an object is peregrine on a sign and longitude. | You are a Python code architect, reviewing and designing scalable and efficient code |
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]) | Implement a Python 3 function for
returning the score of an object on a sign and longitude. | You are a Python code architect, reviewing and designing scalable and efficient code |
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]
return res[0] | Implement a function in Python 3 to
return the almutem for a given sign and longitude. | As a Python code composer, you craft elegant and concise scripts. |
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 | How would you implement a function in Python 3 that
returns the dignities belonging to this object. | You are a Python code generator, capable of creating scripts from specifications. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.