| 1 | """ |
| 2 | Functions available to rowmaker procs. |
| 3 | |
| 4 | Rowmaker procs are compiled in the namespace defined by this module. |
| 5 | """ |
| 6 | |
| 7 | #c Copyright 2008-2025, the GAVO project <[email protected]> |
| 8 | #c |
| 9 | #c This program is free software, covered by the GNU GPL. See the |
| 10 | #c COPYING file in the source distribution. |
| 11 | |
| 12 | |
| 13 | import base64scip-python python python-stdlib 3.11 base64/__init__: |
| 14 | import datetimescip-python python python-stdlib 3.11 datetime/__init__: |
| 15 | import linecachescip-python python python-stdlib 3.11 linecache/__init__: |
| 16 | import mathscip-python python python-stdlib 3.11 math/__init__: |
| 17 | import osscip-python python python-stdlib 3.11 os/__init__: |
| 18 | import pprintscip-python python python-stdlib 3.11 pprint/__init__: #noflake: exported name |
| 19 | import rescip-python python python-stdlib 3.11 re/__init__: #noflake: exported name |
| 20 | import sysscip-python python python-stdlib 3.11 sys/__init__: #noflake: exported name |
| 21 | import timescip-python python python-stdlib 3.11 time/__init__: |
| 22 | import tracebackscip-python python python-stdlib 3.11 traceback/__init__: #noflake: exported name |
| 23 | import urllib.requestscip-python python python-stdlib 3.11 `urllib.request`/__init__:, urllib.parsescip-python python python-stdlib 3.11 `urllib.parse`/__init__:, urllib.errorscip-python python python-stdlib 3.11 `urllib.error`/__init__: #noflake: exported name |
| 24 | |
| 25 | import numpy #noflake: exported name |
| 26 | |
| 27 | from gavoscip-python python gavodachs 2.13 gavo/__init__: import basescip-python python gavodachs 2.13 `gavo.base`/__init__: |
| 28 | from gavoscip-python python gavodachs 2.13 gavo/__init__: import stcscip-python python gavodachs 2.13 `gavo.stc`/__init__: |
| 29 | from gavoscip-python python gavodachs 2.13 gavo/__init__: import utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__: |
| 30 | from gavo.basescip-python python gavodachs 2.13 `gavo.base`/__init__: import ( #noflake: exported names |
| 31 | coordsscip-python python gavodachs 2.13 `gavo.base.coords`/__init__:, parseBooleanLiteralscip-python python gavodachs 2.13 `gavo.base.literals`/parseBooleanLiteral()., parseIntscip-python python gavodachs 2.13 `gavo.base.literals`/parseInt()., sqlmungescip-python python gavodachs 2.13 `gavo.base.sqlmunge`/__init__:, |
| 32 | makeSitePathscip-python python gavodachs 2.13 `gavo.base.osinter`/makeSitePath()., makeAbsoluteURLscip-python python gavodachs 2.13 `gavo.base.osinter`/makeAbsoluteURL()., SkipThisscip-python python gavodachs 2.13 `gavo.utils.excs`/SkipThis#) |
| 33 | from gavo.base.literalsscip-python python gavodachs 2.13 `gavo.base.literals`/__init__: import (identityscip-python python gavodachs 2.13 `gavo.utils.codetricks`/identity()., #noflake:exported names |
| 34 | parseIntscip-python python gavodachs 2.13 `gavo.base.literals`/parseInt()., parseFloatscip-python python gavodachs 2.13 `gavo.base.literals`/parseFloat()., parseBooleanLiteralscip-python python gavodachs 2.13 `gavo.base.literals`/parseBooleanLiteral()., parseUnicodescip-python python gavodachs 2.13 `gavo.base.literals`/parseUnicode()., |
| 35 | parseDefaultDatescip-python python gavodachs 2.13 `gavo.utils.texttricks`/parseDefaultDate()., parseDefaultDatetimescip-python python gavodachs 2.13 `gavo.utils.texttricks`/parseDefaultDatetime()., parseDefaultTimescip-python python gavodachs 2.13 `gavo.utils.texttricks`/parseDefaultTime()., parseCooPairscip-python python gavodachs 2.13 `gavo.base.literals`/parseCooPair()., |
| 36 | parseSPointscip-python python gavodachs 2.13 `gavo.base.literals`/parseSPoint()., getDefaultValueParsersscip-python python gavodachs 2.13 `gavo.base.literals`/getDefaultValueParsers()., originalOrIdentityscip-python python gavodachs 2.13 `gavo.base.literals`/originalOrIdentity()., parseBytesscip-python python gavodachs 2.13 `gavo.base.literals`/parseBytes()., |
| 37 | parseJSONscip-python python gavodachs 2.13 `gavo.base.literals`/parseJSON().) |
| 38 | |
| 39 | from gavo.base.unitconvscip-python python gavodachs 2.13 `gavo.base.unitconv`/__init__: import ( #noflake: exported names |
| 40 | PLANCK_Hscip-python python gavodachs 2.13 `gavo.base.unitconv`/PLANCK_H., LIGHT_Cscip-python python gavodachs 2.13 `gavo.base.unitconv`/LIGHT_C., BOLTZMANN_Kscip-python python gavodachs 2.13 `gavo.base.unitconv`/BOLTZMANN_K.) |
| 41 | from gavo.rscdef.commonscip-python python gavodachs 2.13 `gavo.rscdef.common`/__init__: import ( #noflake: exported names |
| 42 | getStandardPubDIDscip-python python gavodachs 2.13 `gavo.rscdef.common`/getStandardPubDID()., getAccrefFromStandardPubDIDscip-python python gavodachs 2.13 `gavo.rscdef.common`/getAccrefFromStandardPubDID()., |
| 43 | getDatalinkMetaLinkscip-python python gavodachs 2.13 `gavo.rscdef.common`/getDatalinkMetaLink()., |
| 44 | getInputsRelativePathscip-python python gavodachs 2.13 `gavo.rscdef.common`/getInputsRelativePath().) |
| 45 | from gavo.stcscip-python python gavodachs 2.13 `gavo.stc`/__init__: import parseSimpleSTCSscip-python python gavodachs 2.13 `gavo.stc.tapstc`/parseSimpleSTCS. #noflake: exported name |
| 46 | from gavo.stc.timesscip-python python gavodachs 2.13 `gavo.stc.times`/__init__: import ( #noflake: exported names |
| 47 | dateTimeToJdnscip-python python gavodachs 2.13 `gavo.stc.times`/dateTimeToJdn()., dateTimeToMJDscip-python python gavodachs 2.13 `gavo.stc.times`/dateTimeToMJD()., dateTimeToJYearscip-python python gavodachs 2.13 `gavo.stc.times`/dateTimeToJYear()., |
| 48 | bYearToDateTimescip-python python gavodachs 2.13 `gavo.stc.times`/bYearToDateTime()., jdnToDateTimescip-python python gavodachs 2.13 `gavo.stc.times`/jdnToDateTime()., mjdToDateTimescip-python python gavodachs 2.13 `gavo.stc.times`/mjdToDateTime()., TTtoTAIscip-python python gavodachs 2.13 `gavo.stc.times`/TTtoTAI()., TAItoTTscip-python python gavodachs 2.13 `gavo.stc.times`/TAItoTT()., |
| 49 | JD_MJDscip-python python gavodachs 2.13 `gavo.stc.times`/JD_MJD.) |
| 50 | from gavo.utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__: import codetricksscip-python python gavodachs 2.13 `gavo.utils.codetricks`/__init__: |
| 51 | from gavo.utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__: import ( #noflake: exported names |
| 52 | dmsToDegscip-python python gavodachs 2.13 `gavo.utils.texttricks`/dmsToDeg()., hmsToDegscip-python python gavodachs 2.13 `gavo.utils.texttricks`/hmsToDeg()., degToDmsscip-python python gavodachs 2.13 `gavo.utils.texttricks`/degToDms()., degToHmsscip-python python gavodachs 2.13 `gavo.utils.texttricks`/degToHms()., hoursToHmsscip-python python gavodachs 2.13 `gavo.utils.texttricks`/hoursToHms()., makeIAUIdscip-python python gavodachs 2.13 `gavo.utils.texttricks`/makeIAUId()., |
| 53 | DEGscip-python python gavodachs 2.13 `gavo.utils.mathtricks`/DEG., parseISODTscip-python python gavodachs 2.13 `gavo.utils.texttricks`/parseISODT()., iterSimpleTextscip-python python gavodachs 2.13 `gavo.utils.texttricks`/iterSimpleText()., getFileStemscip-python python gavodachs 2.13 `gavo.utils.texttricks`/getFileStem()., |
| 54 | getWCSAxisscip-python python gavodachs 2.13 `gavo.utils.fitstools`/getWCSAxis()., getRelativePathscip-python python gavodachs 2.13 `gavo.utils.texttricks`/getRelativePath()., loadPythonModulescip-python python gavodachs 2.13 `gavo.utils.codetricks`/loadPythonModule().) |
| 55 | from gavo.utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__: import pgspherescip-python python gavodachs 2.13 `gavo.utils.pgsphere`/__init__: #noflake: exported names |
| 56 | |
| 57 | |
| 58 | # degrees per mas |
| 59 | DEG_MASscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/DEG_MAS. = 1/3600000. |
| 60 | # degrees per arcsec |
| 61 | DEG_ARCSECscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/DEG_ARCSEC. = 1/3600. |
| 62 | |
| 63 | NaNscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/NaN. = floatscip-python python python-stdlib 3.11 builtins/float#('nan') |
| 64 | |
| 65 | MSscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/MS. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.makeStructscip-python python gavodachs 2.13 `gavo.base.structure`/makeStruct(). |
| 66 | |
| 67 | |
| 68 | class IgnoreThisRowscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/IgnoreThisRow#(basescip-python python gavodachs 2.13 `gavo.base`/__init__:.ExecutiveActionscip-python python gavodachs 2.13 `gavo.base.structure`/Structure#): |
| 69 | """can be raised by user code to indicate that a row should be |
| 70 | skipped when building a table. |
| 71 | |
| 72 | Note: To skip an entire source, raise SkipThis (usually in a rowfilter |
| 73 | or so). |
| 74 | |
| 75 | Also note that the non-code way to skip things, `Triggers`_, is |
| 76 | preferred when you don't already use code. |
| 77 | """ |
| 78 | |
| 79 | |
| 80 | def addCartesianscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addCartesian().(resultscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addCartesian().(result), alphascip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addCartesian().(alpha), deltascip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addCartesian().(delta)): |
| 81 | """inserts c_x, c_y, and c_z for the equatorial position alpha, delta |
| 82 | into result. |
| 83 | |
| 84 | c_x, c_y, and c_z are the cartesian coordinates of the intersection |
| 85 | point of the radius vector of alpha, delta with the unit sphere. |
| 86 | |
| 87 | alpha and delta already have to be floats, so you probably want |
| 88 | to use variables here. |
| 89 | |
| 90 | >>> r = {}; addCartesian(r, 25, 30); "%.7f %.7f"%(r["c_x"], r["c_y"]) |
| 91 | '0.7848856 0.3659982' |
| 92 | """ |
| 93 | resultscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addCartesian().(result)["c_x"], resultscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addCartesian().(result)["c_y"], resultscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addCartesian().(result)["c_z"] = utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.spherToCartscip-python python gavodachs 2.13 `gavo.utils.mathtricks`/spherToCart().( |
| 94 | alphascip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addCartesian().(alpha)*DEGscip-python python gavodachs 2.13 `gavo.utils.mathtricks`/DEG., deltascip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addCartesian().(delta)*DEGscip-python python gavodachs 2.13 `gavo.utils.mathtricks`/DEG.) |
| 95 | |
| 96 | |
| 97 | def combinePMsscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/combinePMs().(resultscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/combinePMs().(result), pmascip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/combinePMs().(pma), pmdscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/combinePMs().(pmd)): |
| 98 | """inserts pm_total (in degs/yr) and pm_posang (in degs, east over north) |
| 99 | into result. |
| 100 | |
| 101 | pma and pmd have to be in degs/yr, with cos(delta) applied to pma. |
| 102 | """ |
| 103 | if pmascip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/combinePMs().(pma) is None or pmdscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/combinePMs().(pmd) is None: |
| 104 | tpm = pmpa = None |
| 105 | else: |
| 106 | tpm = mathscip-python python python-stdlib 3.11 math/__init__:.sqrtscip-python python python-stdlib 3.11 math/sqrt().(pmascip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/combinePMs().(pma)**2+pmdscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/combinePMs().(pmd)**2) |
| 107 | pmpa = mathscip-python python python-stdlib 3.11 math/__init__:.atan2scip-python python python-stdlib 3.11 math/atan2().(pmascip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/combinePMs().(pma), pmdscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/combinePMs().(pmd))*360/2/mathscip-python python python-stdlib 3.11 math/__init__:.piscip-python python python-stdlib 3.11 math/pi.pi. |
| 108 | resultscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/combinePMs().(result)["pm_total"] = tpm |
| 109 | resultscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/combinePMs().(result)["pm_posang"] = pmpa |
| 110 | |
| 111 | |
| 112 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 113 | def getQueryMetascip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/getQueryMeta().(): |
| 114 | """returns a query meta object from somewhere up the stack. |
| 115 | |
| 116 | This is for row makers running within a service. This can be used |
| 117 | to, e.g., enforce match limits by writing getQueryMeta()["dbLimit"]. |
| 118 | """ |
| 119 | return codetricksscip-python python gavodachs 2.13 `gavo.utils.codetricks`/__init__:.stealVarscip-python python gavodachs 2.13 `gavo.utils.codetricks`/stealVar().("queryMeta") |
| 120 | |
| 121 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 122 | def parseTimescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTime().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTime().(literal), formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTime().(format)="%H:%M:%S"): |
| 123 | """returns a ``datetime.timedelta`` object for literal parsed according |
| 124 | to format. |
| 125 | |
| 126 | For format, you can the magic values ``!!secondsSinceMidnight``, |
| 127 | ``!!decimalHours`` or a strptime-like spec using the H, M, and S codes. |
| 128 | |
| 129 | >>> parseTime("89930", "!!secondsSinceMidnight") |
| 130 | datetime.timedelta(days=1, seconds=3530) |
| 131 | >>> parseTime("23.4", "!!decimalHours") |
| 132 | datetime.timedelta(seconds=84240) |
| 133 | >>> parseTime("3.4:5", "%H.%M:%S") |
| 134 | datetime.timedelta(seconds=11045) |
| 135 | >>> parseTime("20:04", "%H:%M") |
| 136 | datetime.timedelta(seconds=72240) |
| 137 | """ |
| 138 | if formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTime().(format)=="!!secondsSinceMidnight": |
| 139 | return datetimescip-python python python-stdlib 3.11 datetime/__init__:.timedeltascip-python python python-stdlib 3.11 datetime/timedelta#(seconds=floatscip-python python python-stdlib 3.11 builtins/float#(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTime().(literal))) |
| 140 | elif formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTime().(format)=="!!decimalHours": |
| 141 | return datetimescip-python python python-stdlib 3.11 datetime/__init__:.timedeltascip-python python python-stdlib 3.11 datetime/timedelta#(hours=floatscip-python python python-stdlib 3.11 builtins/float#(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTime().(literal))) |
| 142 | else: |
| 143 | # We can't really use prebuilt strptimes since times like 25:21:22.445 |
| 144 | # are perfectly ok in astronomy. |
| 145 | partDict = utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.parsePercentExpressionscip-python python gavodachs 2.13 `gavo.utils.texttricks`/parsePercentExpression().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTime().(literal), formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTime().(format)) |
| 146 | return datetimescip-python python python-stdlib 3.11 datetime/__init__:.timedeltascip-python python python-stdlib 3.11 datetime/timedelta#(0, hours=floatscip-python python python-stdlib 3.11 builtins/float#(partDict.getscip-python python python-stdlib 3.11 builtins/dict#get().("H", 0)), |
| 147 | minutes=floatscip-python python python-stdlib 3.11 builtins/float#(partDict.getscip-python python python-stdlib 3.11 builtins/dict#get().("M", 0)), seconds=floatscip-python python python-stdlib 3.11 builtins/float#(partDict.getscip-python python python-stdlib 3.11 builtins/dict#get().("S", 0))) |
| 148 | |
| 149 | |
| 150 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 151 | def parseDatescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseDate().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseDate().(literal), formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseDate().(format)="%Y-%m-%d"): |
| 152 | """returns a ``datetime.date`` object of literal parsed according to the |
| 153 | strptime-similar format. |
| 154 | |
| 155 | The function understands the special ``dateFormat`` ``!!jYear`` |
| 156 | (stuff like 1980.89). |
| 157 | """ |
| 158 | if formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseDate().(format) in ("!!julianEp", "!!jYear"): |
| 159 | return stcscip-python python gavodachs 2.13 `gavo.stc`/__init__:.jYearToDateTime(floatscip-python python python-stdlib 3.11 builtins/float#(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseDate().(literal))) |
| 160 | return datetimescip-python python python-stdlib 3.11 datetime/__init__:.datetimescip-python python python-stdlib 3.11 datetime/datetime#(*timescip-python python python-stdlib 3.11 time/__init__:.strptimescip-python python python-stdlib 3.11 time/strptime().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseDate().(literal), formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseDate().(format))[:3]) |
| 161 | |
| 162 | |
| 163 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 164 | def parseTimestampscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTimestamp().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTimestamp().(literal), formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTimestamp().(format)="%Y-%m-%dT%H:%M:%S"): |
| 165 | """returns a ``datetime.datetime`` object from a literal parsed according |
| 166 | to the strptime-similar format. |
| 167 | |
| 168 | A ``ValueError`` is raised if literal doesn't match format (actually, |
| 169 | a parse with essentially DALI-standard ISO representation is always tried) |
| 170 | """ |
| 171 | try: |
| 172 | return datetimescip-python python python-stdlib 3.11 datetime/__init__:.datetimescip-python python python-stdlib 3.11 datetime/datetime#(*timescip-python python python-stdlib 3.11 time/__init__:.strptimescip-python python python-stdlib 3.11 time/strptime().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTimestamp().(literal), formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTimestamp().(format))[:6]) |
| 173 | except ValueErrorscip-python python python-stdlib 3.11 builtins/ValueError#: |
| 174 | # always try ISO format |
| 175 | return parseISODTscip-python python gavodachs 2.13 `gavo.utils.texttricks`/parseISODT().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTimestamp().(literal)) |
| 176 | |
| 177 | |
| 178 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 179 | def toMJDscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/toMJD().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/toMJD().(literal)): |
| 180 | """returns a modified julian date made from some datetime representation. |
| 181 | |
| 182 | Valid representations include: |
| 183 | |
| 184 | * MJD (a float smaller than 1e6) |
| 185 | * JD (a float larger than 1e6) |
| 186 | * datetime.datetime instances |
| 187 | * ISO time strings. |
| 188 | """ |
| 189 | if literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/toMJD().(literal) is None: |
| 190 | return None |
| 191 | elif isinstance(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/toMJD().(literal), strscip-python python python-stdlib 3.11 builtins/str#): |
| 192 | return stcscip-python python gavodachs 2.13 `gavo.stc`/__init__:.dateTimeToMJDscip-python python gavodachs 2.13 `gavo.stc.times`/dateTimeToMJD().(parseTimestampscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseTimestamp().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/toMJD().(literal))) |
| 193 | elif isinstance(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/toMJD().(literal), datetimescip-python python python-stdlib 3.11 datetime/__init__:.datetimescip-python python python-stdlib 3.11 datetime/datetime#): |
| 194 | return stcscip-python python gavodachs 2.13 `gavo.stc`/__init__:.dateTimeToMJD(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/toMJD().(literal)) |
| 195 | elif literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/toMJD().(literal)>1e6: |
| 196 | return literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/toMJD().(literal)-stcscip-python python gavodachs 2.13 `gavo.stc`/__init__:.JD_MJDscip-python python gavodachs 2.13 `gavo.stc.times`/JD_MJD. |
| 197 | else: |
| 198 | return literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/toMJD().(literal) |
| 199 | |
| 200 | |
| 201 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 202 | def makeTimestampscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeTimestamp().(datescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeTimestamp().(date), timescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeTimestamp().(time)): |
| 203 | """makes a datetime instance from a date and a time. |
| 204 | """ |
| 205 | return datetimescip-python python python-stdlib 3.11 datetime/__init__:.datetimescip-python python python-stdlib 3.11 datetime/datetime#(datescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeTimestamp().(date).year, datescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeTimestamp().(date).month, datescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeTimestamp().(date).day)+timescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeTimestamp().(time) |
| 206 | |
| 207 | |
| 208 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 209 | def parseAnglescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(literal), formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(format), sepCharscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(sepChar)=None): |
| 210 | """converts the various forms angles might be encountered to degrees. |
| 211 | |
| 212 | format is one of hms, dms, fracHour. For sexagesimal/time angles, |
| 213 | you can pass a sepChar (default: split at blanks) that lets you |
| 214 | specify what separates hours/degrees, minutes, and seconds. |
| 215 | |
| 216 | >>> "%.8f"%(parseAngle("23 59 59.95", "hms")) |
| 217 | '359.99979167' |
| 218 | >>> "%10.5f"%parseAngle("-20:31:05.12", "dms", sepChar=":") |
| 219 | ' -20.51809' |
| 220 | >>> "%010.6f"%parseAngle("21.0209556", "fracHour") |
| 221 | '315.314334' |
| 222 | """ |
| 223 | if formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(format)=="dms": |
| 224 | return utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.dmsToDegscip-python python gavodachs 2.13 `gavo.utils.texttricks`/dmsToDeg().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(literal), sepChar=sepCharscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(sepChar)) |
| 225 | elif formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(format)=="hms": |
| 226 | return utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.hmsToDegscip-python python gavodachs 2.13 `gavo.utils.texttricks`/hmsToDeg().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(literal), sepChar=sepCharscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(sepChar)) |
| 227 | elif formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(format)=="fracHour": |
| 228 | return utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.fracHoursToDegscip-python python gavodachs 2.13 `gavo.utils.texttricks`/fracHoursToDeg().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(literal)) |
| 229 | else: |
| 230 | raise basescip-python python gavodachs 2.13 `gavo.base`/__init__:.Errorscip-python python gavodachs 2.13 `gavo.base.structure`/Structure#("Invalid format: %s"%formatscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseAngle().(format)) |
| 231 | |
| 232 | |
| 233 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 234 | def computeMeanscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/computeMean().(val1scip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/computeMean().(val1), val2scip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/computeMean().(val2)): |
| 235 | """returns the mean value between two values. |
| 236 | |
| 237 | Beware: Integer division done here for the benefit of datetime calculations. |
| 238 | |
| 239 | >>> computeMean(1.,3) |
| 240 | 2.0 |
| 241 | >>> computeMean(datetime.datetime(2000, 10, 13), |
| 242 | ... datetime.datetime(2000, 10, 12)) |
| 243 | datetime.datetime(2000, 10, 12, 12, 0) |
| 244 | """ |
| 245 | return val1scip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/computeMean().(val1)+(val2scip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/computeMean().(val2)-val1scip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/computeMean().(val1))/2 |
| 246 | |
| 247 | |
| 248 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 249 | def killBlanksscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/killBlanks().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/killBlanks().(literal)): |
| 250 | """returns the string literal with all blanks removed. |
| 251 | |
| 252 | This is useful when numbers are formatted with blanks thrown in. |
| 253 | |
| 254 | Nones are passed through. |
| 255 | """ |
| 256 | if literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/killBlanks().(literal) is None: |
| 257 | return None |
| 258 | else: |
| 259 | return literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/killBlanks().(literal).replace(" ", "") |
| 260 | |
| 261 | |
| 262 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 263 | def lastSourceElementsscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/lastSourceElements().(pathscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/lastSourceElements().(path), numElementsscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/lastSourceElements().(numElements)): |
| 264 | """returns a path made up from the last ``numElements`` items in ``path``. |
| 265 | """ |
| 266 | newPath = [] |
| 267 | for i in rangescip-python python python-stdlib 3.11 builtins/range#(intscip-python python python-stdlib 3.11 builtins/int#(numElementsscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/lastSourceElements().(numElements))): |
| 268 | pathscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/lastSourceElements().(path), part = osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..splitscip-python python python-stdlib 3.11 ntpath/join().(pathscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/lastSourceElements().(path)) |
| 269 | newPath.appendscip-python python python-stdlib 3.11 builtins/list#append().(part) |
| 270 | newPath.reversescip-python python python-stdlib 3.11 typing/MutableSequence#reverse().() |
| 271 | return osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..joinscip-python python python-stdlib 3.11 ntpath/join().(*newPath) |
| 272 | |
| 273 | |
| 274 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 275 | def scalescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/scale().(valscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/scale().(val), factorscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/scale().(factor), offsetscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/scale().(offset)=0): |
| 276 | """returns val*factor+offset if val is not None, None otherwise. |
| 277 | |
| 278 | This is when you want to manipulate a numeric value that may be NULL. |
| 279 | It is a somewhat safer alternative to using nullExcs with scaled values. |
| 280 | """ |
| 281 | if valscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/scale().(val) is None: |
| 282 | return None |
| 283 | return factorscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/scale().(factor)*valscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/scale().(val)+offsetscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/scale().(offset) |
| 284 | |
| 285 | |
| 286 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 287 | def parseWithNullscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(literal), baseParserscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(baseParser), nullLiteralscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(nullLiteral)=basescip-python python gavodachs 2.13 `gavo.base`/__init__:.Undefinedscip-python python gavodachs 2.13 `gavo.base.attrdef`/UnicodeAttribute#, |
| 288 | defaultscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(default)=None, checkerscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(checker)=None): |
| 289 | """returns default if literal is ``nullLiteral``, else |
| 290 | ``baseParser(literal)``. |
| 291 | |
| 292 | If ``checker`` is non-None, it must be a callable returning ``True`` if its |
| 293 | argument is a null value. |
| 294 | |
| 295 | ``nullLiteral`` is compared against the unprocessed literal (usually, a |
| 296 | string). The intended use is like this (but note that often, a |
| 297 | ``nullExcs`` attribute on a rowmaker ``map`` element is the more |
| 298 | elegant way: |
| 299 | |
| 300 | >>> parseWithNull("8888.0", float, "8888") |
| 301 | 8888.0 |
| 302 | >>> print(parseWithNull("8888", float, "8888")) |
| 303 | None |
| 304 | >>> print(parseWithNull("N/A", int, "N/A")) |
| 305 | None |
| 306 | """ |
| 307 | if (nullLiteralscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(nullLiteral) is not basescip-python python gavodachs 2.13 `gavo.base`/__init__:.Undefinedscip-python python gavodachs 2.13 `gavo.base.attrdef`/UnicodeAttribute# and literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(literal)==nullLiteralscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(nullLiteral) |
| 308 | ) or literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(literal) is None: |
| 309 | return defaultscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(default) |
| 310 | if checkerscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(checker) is not None: |
| 311 | if checkerscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(checker)(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(literal)): |
| 312 | return defaultscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(default) |
| 313 | res = baseParserscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(baseParser)(literalscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(literal)) |
| 314 | if res is None: |
| 315 | return defaultscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/parseWithNull().(default) |
| 316 | return res |
| 317 | |
| 318 | |
| 319 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 320 | def requireValuescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/requireValue().(valscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/requireValue().(val), fieldNamescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/requireValue().(fieldName)): |
| 321 | """returns ``val`` unless it is ``None``, in which case a ``ValidationError`` |
| 322 | for ``fieldName`` will be raised. |
| 323 | """ |
| 324 | if valscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/requireValue().(val) is None: |
| 325 | raise basescip-python python gavodachs 2.13 `gavo.base`/__init__:.ValidationErrorscip-python python gavodachs 2.13 `gavo.base.structure`/Structure#("Value is required but was not provided", |
| 326 | fieldNamescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/requireValue().(fieldName)) |
| 327 | return valscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/requireValue().(val) |
| 328 | |
| 329 | |
| 330 | def genLimitKeysscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/genLimitKeys().(inputKeyscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/genLimitKeys().(inputKey)): |
| 331 | """yields _MAX and _MIN inputKeys from a single input key. |
| 332 | |
| 333 | This also tries to sensibly fix descriptions and ucds. |
| 334 | This is mainly for datalink metaMakers; condDescs may use a |
| 335 | similar thing, but that's not exposed to RDs. |
| 336 | |
| 337 | Don't use this function any more. It will go away soon. |
| 338 | """ |
| 339 | name = inputKeyscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/genLimitKeys().(inputKey).name |
| 340 | ucd = inputKeyscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/genLimitKeys().(inputKey).ucd or None |
| 341 | description = inputKeyscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/genLimitKeys().(inputKey).description |
| 342 | basescip-python python gavodachs 2.13 `gavo.base`/__init__:.uiscip-python python gavodachs 2.13 `gavo.base`/ui..notifyWarningscip-python python gavodachs 2.13 `gavo.base.events`/EventDispatcher#notifyWarning().("Deprecated genLimitKeys function used." |
| 343 | " Fix your RD to use proper DALI-intervals (ask dachs-support" |
| 344 | " if you don't know what to do.)") |
| 345 | |
| 346 | yield inputKeyscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/genLimitKeys().(inputKey).change(name=name+"_MIN", |
| 347 | ucd=ucd and "par.min;"+ucd, |
| 348 | description=description.rstrip(".")+", lower limit") |
| 349 | yield inputKeyscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/genLimitKeys().(inputKey).change(name=name+"_MAX", |
| 350 | ucd=ucd and "par.max;"+ucd, |
| 351 | description=description.rstrip(".")+", upper limit") |
| 352 | |
| 353 | |
| 354 | @utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.documentscip-python python gavodachs 2.13 `gavo.utils.codetricks`/document(). |
| 355 | def getFlatNamescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/getFlatName().(accrefscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/getFlatName().(accref)): |
| 356 | """returns a unix-compatible file name for an access reference. |
| 357 | |
| 358 | The file name will not contain terrible characters, let alone |
| 359 | slashes. This is used to, e.g., keep all previews in one directory. |
| 360 | """ |
| 361 | # just in case someone passes in a full file path, strip it |
| 362 | if accrefscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/getFlatName().(accref).startswith("/"): |
| 363 | accrefscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/getFlatName().(accref) = utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.getRelativePathscip-python python gavodachs 2.13 `gavo.utils.texttricks`/getRelativePath().(accrefscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/getFlatName().(accref), |
| 364 | basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("inputsDir"), liberalChars=True) |
| 365 | |
| 366 | return base64scip-python python python-stdlib 3.11 base64/__init__:.b64encodescip-python python python-stdlib 3.11 base64/b64encode().(accrefscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/getFlatName().(accref).encode("utf-8"), b"$!").decodescip-python python python-stdlib 3.11 builtins/bytes#decode().("ascii") |
| 367 | |
| 368 | |
| 369 | def addProcDefObjectscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addProcDefObject().(namescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addProcDefObject().(name), funcscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addProcDefObject().(func)): |
| 370 | globals()[namescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addProcDefObject().(name)] = funcscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/addProcDefObject().(func) |
| 371 | |
| 372 | |
| 373 | def makeProcscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(funcNamescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(funcName), codescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(code), setupCodescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(setupCode), parentscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(parent), srcPosscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(srcPos), **moreNamesscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(moreNames)): |
| 374 | """compiles a function in the rmkfunc's namespace. |
| 375 | |
| 376 | code is a complete function source. setupCode is executed right away |
| 377 | in this namespace to add globals. |
| 378 | """ |
| 379 | funcNs = globals().copyscip-python python python-stdlib 3.11 builtins/dict#copy().() |
| 380 | funcNs["parent"] = parentscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(parent) |
| 381 | funcNs.updatescip-python python python-stdlib 3.11 typing/MutableMapping#update().(moreNamesscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(moreNames)) |
| 382 | if setupCodescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(setupCode).strip(): |
| 383 | src = setupCodescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(setupCode).rstrip() |
| 384 | try: |
| 385 | uniqueName = "<setup code in {}>".format(srcPosscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(srcPos)) |
| 386 | compiled = compilescip-python python python-stdlib 3.11 builtins/compile().(src, uniqueName, 'exec') |
| 387 | linecachescip-python python python-stdlib 3.11 linecache/__init__:.cachescip-python python python-stdlib 3.11 linecache/cache.cache.[uniqueName] = ( |
| 388 | len(src), None, src.split("\n"), uniqueName) |
| 389 | exec(compiled, funcNs) |
| 390 | except (SyntaxErrorscip-python python python-stdlib 3.11 builtins/SyntaxError#, TypeErrorscip-python python python-stdlib 3.11 builtins/TypeError#) as ex: |
| 391 | raise basescip-python python gavodachs 2.13 `gavo.base`/__init__:.uiscip-python python gavodachs 2.13 `gavo.base`/ui..logOldExcscip-python python gavodachs 2.13 `gavo.base.events`/EventDispatcher#logOldExc().( |
| 392 | basescip-python python gavodachs 2.13 `gavo.base`/__init__:.BadCodescip-python python gavodachs 2.13 `gavo.base.structure`/Structure#(setupCodescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(setupCode), "setup code", ex, |
| 393 | posscip-python python gavodachs 2.13 `gavo.utils.excs`/BadCode#__init__().(pos)=srcPosscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(srcPos))) |
| 394 | except NameErrorscip-python python python-stdlib 3.11 builtins/NameError# as ex: |
| 395 | raise basescip-python python gavodachs 2.13 `gavo.base`/__init__:.uiscip-python python gavodachs 2.13 `gavo.base`/ui..logOldExcscip-python python gavodachs 2.13 `gavo.base.events`/EventDispatcher#logOldExc().( |
| 396 | basescip-python python gavodachs 2.13 `gavo.base`/__init__:.BadCodescip-python python gavodachs 2.13 `gavo.base.structure`/Structure#(setupCodescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(setupCode), "setup code", ex, |
| 397 | hintscip-python python gavodachs 2.13 `gavo.utils.excs`/BadCode#__init__().(hint)="This typically happens when you forget to put" |
| 398 | " quotes around string values.", |
| 399 | posscip-python python gavodachs 2.13 `gavo.utils.excs`/BadCode#__init__().(pos)=srcPosscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(srcPos))) |
| 400 | |
| 401 | uniqueName = None |
| 402 | if parentscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(parent) and getattrscip-python python python-stdlib 3.11 builtins/getattr().(parentscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(parent), "name_", None): |
| 403 | uniqueName = "<{} at {}>".format(parentscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(parent).name_, srcPosscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(srcPos)) |
| 404 | return utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.compileFunctionscip-python python gavodachs 2.13 `gavo.utils.codetricks`/compileFunction().( |
| 405 | codescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(code).rstrip(), |
| 406 | funcNamescip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/makeProc().(funcName), |
| 407 | funcNs, |
| 408 | debugscip-python python gavodachs 2.13 `gavo.utils.codetricks`/compileFunction().(debug)=basescip-python python gavodachs 2.13 `gavo.base`/__init__:.DEBUGscip-python python gavodachs 2.13 `gavo.base`/DEBUG., |
| 409 | uniqueNamescip-python python gavodachs 2.13 `gavo.utils.codetricks`/compileFunction().(uniqueName)=uniqueName) |
| 410 | |
| 411 | |
| 412 | def _testscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/_test().(): # pragma: no cover |
| 413 | import doctestscip-python python python-stdlib 3.11 doctest/__init__: |
| 414 | doctestscip-python python python-stdlib 3.11 doctest/__init__:.testmodscip-python python python-stdlib 3.11 doctest/testmod().() |
| 415 | |
| 416 | |
| 417 | if __name__scip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/=="__main__": |
| 418 | _testscip-python python gavodachs 2.13 `gavo.rscdef.rmkfuncs`/_test().() |