Debian Codegraph @

gavo/rscdesc.py

raw symbols SCIP
1 """
2 Structure definition of resource descriptors.
3
4 The stuff they are describing is not a resource in the VO sense (whatever
5 that is) or in the Dublin Core sense, but simply stuff held together
6 by common metadata. If it's got the same creator, the same base title,
7 the same keywords, etc., it's described by one RD.
8
9 In the DaCHS, a resource descriptor typically sets up a schema in
10 the database.
11 """
12
13 #c Copyright 2008-2025, the GAVO project <[email protected]>
14 #c
15 #c This program is free software, covered by the GNU GPL. See the
16 #c COPYING file in the source distribution.
17
18
19 import datetimescip-python python python-stdlib 3.11 datetime/__init__:
20 import pathlibscip-python python python-stdlib 3.11 pathlib/__init__:
21 import osscip-python python python-stdlib 3.11 os/__init__:
22 import pkg_resources
23 import timescip-python python python-stdlib 3.11 time/__init__:
24 import threadingscip-python python python-stdlib 3.11 threading/__init__:
25 import weakrefscip-python python python-stdlib 3.11 weakref/__init__:
26 from urllibscip-python python python-stdlib 3.11 urllib/__init__: import parse as urlparse
27
28 from gavoscip-python python gavodachs 2.13 gavo/__init__: import basescip-python python gavodachs 2.13 `gavo.base`/__init__:
29 from gavoscip-python python gavodachs 2.13 gavo/__init__: import registryscip-python python gavodachs 2.13 `gavo.registry`/__init__:
30 from gavoscip-python python gavodachs 2.13 gavo/__init__: import rscscip-python python gavodachs 2.13 `gavo.rsc`/__init__:
31 from gavoscip-python python gavodachs 2.13 gavo/__init__: import rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__:
32 from gavoscip-python python gavodachs 2.13 gavo/__init__: import svcsscip-python python gavodachs 2.13 `gavo.svcs`/__init__:
33 from gavoscip-python python gavodachs 2.13 gavo/__init__: import utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:
34 from gavo.rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__: import commonscip-python python gavodachs 2.13 `gavo.rscdef.common`/__init__:
35 from gavo.rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__: import rdinjscip-python python gavodachs 2.13 `gavo.rscdef.rdinj`/__init__:
36 from gavo.rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__: import regtestscip-python python gavodachs 2.13 `gavo.rscdef.regtest`/__init__:
37 from gavo.rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__: import scriptingscip-python python gavodachs 2.13 `gavo.rscdef.scripting`/__init__:
38 from gavo.rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__: import executingscip-python python gavodachs 2.13 `gavo.rscdef.executing`/__init__:
39
40
41 class ResdirAttributescip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#(basescip-python python gavodachs 2.13 `gavo.base`/__init__:.UnicodeAttributescip-python python gavodachs 2.13 `gavo.base.attrdef`/UnicodeAttribute#):
42 """An attribute representing an RD's resdir.
43
44 This is for resource's resdir attribute, which will by default
45 get the inputsDir prepended. There is the special value "." that
46 means "the directory containing the RD", which is what people should
47 do now.
48
49 This will only work for RDs.
50
51 Note that without that, the resdir defaults to <inputsDir>/<schemaName>.
52 """
53 def feedObjectscip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(self), instancescip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(instance), parsedValuescip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(parsedValue)):
54 setattr(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(self), f"_original_resdir_{selfscip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(self).name_scip-python python gavodachs 2.13 `gavo.base.attrdef`/AttributeDef#name_.}", parsedValuescip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(parsedValue))
55 if parsedValuescip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(parsedValue)==".":
56 parsedValuescip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(parsedValue) = "/".joinscip-python python python-stdlib 3.11 builtins/str#join().(instancescip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(instance).sourceId.split("/")[:-1])
57
58 parsedValuescip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(parsedValue) = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("inputsDir") / parsedValuescip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(parsedValue)
59 superscip-python python python-stdlib 3.11 builtins/super#().feedObjectscip-python python gavodachs 2.13 `gavo.base.attrdef`/AtomicAttribute#feedObject().(instancescip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(instance), parsedValuescip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(parsedValue))
60
61
62 class Publicationscip-python python gavodachs 2.13 `gavo.rscdesc`/Publication#(basescip-python python gavodachs 2.13 `gavo.base`/__init__:.Structurescip-python python gavodachs 2.13 `gavo.base.structure`/Structure#):
63 """A request to publish the entire RD.
64
65 This will produce a record with all ADQL-readable tables as its
66 tableset and all plausible services as capabilities.
67 """
68 name_scip-python python gavodachs 2.13 `gavo.rscdesc`/Publication#name_. = "publish"
69 docName_scip-python python gavodachs 2.13 `gavo.rscdesc`/Publication#docName_. = "publish (resource)"
70
71 _setsscip-python python gavodachs 2.13 `gavo.rscdesc`/Publication#_sets. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StringSetAttributescip-python python gavodachs 2.13 `gavo.base.attrdef`/UnicodeAttribute#("sets", default=frozensetscip-python python python-stdlib 3.11 builtins/frozenset#(["ivo_managed"]),
72 description="A comma-separated list of sets this data will be"
73 " published in. To publish data to the VO registry, just"
74 " say ivo_managed here, local puts a link on the front page."
75 " ivo_managed is the default.")
76
77
78 @basescip-python python gavodachs 2.13 `gavo.base`/__init__:.buildstructurescip-python python gavodachs 2.13 `gavo.base.structure`/buildstructure().
79 class RDscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#(basescip-python python gavodachs 2.13 `gavo.base`/__init__:.Structurescip-python python gavodachs 2.13 `gavo.base.structure`/Structure#, basescip-python python gavodachs 2.13 `gavo.base`/__init__:.ComputedMetaMixinscip-python python gavodachs 2.13 `gavo.base.meta`/ComputedMetaMixin#, scriptingscip-python python gavodachs 2.13 `gavo.rscdef.scripting`/__init__:.ScriptingMixinscip-python python gavodachs 2.13 `gavo.rscdef.scripting`/ScriptingMixin#,
80 basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StandardMacroMixinscip-python python gavodachs 2.13 `gavo.base.macros`/StandardMacroMixin#, commonscip-python python gavodachs 2.13 `gavo.rscdef.common`/__init__:.PrivilegesMixinscip-python python gavodachs 2.13 `gavo.rscdef.common`/PrivilegesMixin#):
81 """A resource descriptor.
82
83 RDs collect all information about how to parse a particular source (like a
84 collection of FITS images, a catalogue, or whatever), about the database
85 tables the data ends up in, and the services used to access them.
86
87 This is the root element of all RDs.
88
89 To give your schema a utype, set a ``utype`` meta on resource.
90
91 To set the schema_index in TAP_SCHEMA, put some integer to
92 a schema-rank meta; lower-ranked schemas are displayed further
93 up in supporting clients (since version 2.9.3).
94 """
95 name_scip-python python gavodachs 2.13 `gavo.rscdesc`/RD#name_. = "resource"
96
97 metaModelscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#metaModel. = ("creationDate(1), title(1), description(1), subject,"
98 " coverage.waveband (? voc:messenger),"
99 " content.level (? voc:voresource/content_level),"
100 " content.type (? voc:voresource/content_type),"
101 " _news.role (? voc:voresource/date_role)"
102 )
103
104 # this is set somewhere below once parsing has proceeded far enough
105 # such that caching the RD make sense
106 cacheablescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#cacheable. = False
107
108 # we used to accept scripts in RDs and probably will do so again,
109 # but for now the semantics are not well-defined and we reject all
110 # scripts for a while
111 acceptedScriptTypesscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#acceptedScriptTypes. = {}
112
113 _resdirscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_resdir. = ResdirAttributescip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#("resdir",
114 default=None,
115 description="Base directory for source files and everything else"
116 " belonging to the resource. Use a single dot (.) to say 'the"
117 " directory the RD resides in', which is recommended in modern"
118 " DaCHS.",
119 copyable=True)
120
121 _schemascip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_schema. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.UnicodeAttributescip-python python gavodachs 2.13 `gavo.base.attrdef`/UnicodeAttribute#("schema",
122 default=basescip-python python gavodachs 2.13 `gavo.base`/__init__:.Undefinedscip-python python gavodachs 2.13 `gavo.base.attrdef`/UnicodeAttribute#,
123 description="Database schema for tables defined here. Follow the rule"
124 " 'one schema, one RD' if at all possible. If two RDs share the same"
125 " schema, the must generate exactly the same permissions for that"
126 " schema; this means, in particular, that if one has an ADQL-published"
127 " table, so must the other. In a nutshell: one schema, one RD.",
128 copyable=True,
129 callbacks=["_inferResdir"])
130
131 _ddsscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_dds. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructListAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("dds",
132 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(childFactory)=rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__:.DataDescriptorscip-python python gavodachs 2.13 `gavo.rscdef.dddef`/DataDescriptor#,
133 descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(description)="Descriptors for the data generated and/or published"
134 " within this resource.",
135 copyable=True,
136 before="outputTables")
137
138 _tablesscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_tables. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructListAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("tables",
139 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(childFactory)=rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__:.TableDefscip-python python gavodachs 2.13 `gavo.base.structure`/TableDef#,
140 descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(description)="A table used or created by this resource",
141 copyable=True,
142 before="dds")
143
144 _outputTablesscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_outputTables. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructListAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("outputTables",
145 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(childFactory)=svcsscip-python python gavodachs 2.13 `gavo.svcs`/__init__:.OutputTableDefscip-python python gavodachs 2.13 `gavo.svcs.outputdef`/OutputTableDef#,
146 descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(description)="Canned output tables for later reference.",
147 copyable=True)
148
149 _rowmakersscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_rowmakers. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructListAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("rowmakers",
150 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(childFactory)=rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__:.RowmakerDefscip-python python gavodachs 2.13 `gavo.rscdef.rmkdef`/RowmakerDef#,
151 descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(description)="Transformations for going from grammars to tables."
152 " If specified in the RD, they must be referenced from make"
153 " elements to become active.",
154 copyable=True,
155 before="dds")
156
157 _procDefsscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_procDefs. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructListAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("procDefs",
158 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(childFactory)=rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__:.ProcDefscip-python python gavodachs 2.13 `gavo.rscdef.procdef`/ProcDef#,
159 descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(description)="Procedure definintions (rowgens, rowmaker apply-s)",
160 copyable=True, before="rowmakers")
161
162 _condDescsscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_condDescs. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructListAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("condDescs",
163 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(childFactory)=svcsscip-python python gavodachs 2.13 `gavo.svcs`/__init__:.CondDescscip-python python gavodachs 2.13 `gavo.svcs.standardcores`/CondDesc#,
164 descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(description)="Global condition descriptors for later reference",
165 copyable=True,
166 before="cores")
167
168 _resRecsscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_resRecs. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructListAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("resRecs",
169 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(childFactory)=registryscip-python python gavodachs 2.13 `gavo.registry`/__init__:.ResRecscip-python python gavodachs 2.13 `gavo.registry.nonservice`/ResRec#,
170 descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(description)="Non-service resources for the IVOA registry. They will"
171 " be published when gavo publish is run on the RD.")
172
173 _publicationscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_publication. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("publication",
174 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructAttribute#__init__().(childFactory)=Publicationscip-python python gavodachs 2.13 `gavo.rscdesc`/Publication#, descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructAttribute#__init__().(description)="The presence of this element"
175 " publishes the entire RD to the VO or the front page; is is more"
176 " common to publish individual tables or services at this point.",
177 defaultscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructAttribute#__init__().(default)=None)
178
179 _servicesscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_services. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructListAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("services",
180 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(childFactory)=svcsscip-python python gavodachs 2.13 `gavo.svcs`/__init__:.Servicescip-python python gavodachs 2.13 `gavo.svcs.service`/Service#,
181 descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(description)="Services exposing data from this resource.",
182 copyable=True)
183
184 _macDefsscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_macDefs. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.MacDefAttributescip-python python gavodachs 2.13 `gavo.base.macros`/MacDefAttribute().(before="tables",
185 description="User-defined macros available on this RD")
186
187 _mixinDefsscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_mixinDefs. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructListAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("mixdefs",
188 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(childFactory)=rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__:.MixinDefscip-python python gavodachs 2.13 `gavo.rscdef.mixins`/MixinDef#,
189 descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(description)="Mixin definitions (usually not for users)")
190
191 _requirescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_require. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.ActionAttributescip-python python gavodachs 2.13 `gavo.base.attrdef`/UnicodeAttribute#("require",
192 methodNamescip-python python gavodachs 2.13 `gavo.base.attrdef`/ActionAttribute#__init__().(methodName)="importModule",
193 descriptionscip-python python gavodachs 2.13 `gavo.base.attrdef`/ActionAttribute#__init__().(description)="Deprecated, don't use this any more."
194 " May go away by DaCHS 2.12")
195
196 _coresscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_cores. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.MultiStructListAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("cores",
197 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/MultiStructListAttribute#__init__().(childFactory)=svcsscip-python python gavodachs 2.13 `gavo.svcs`/__init__:.getCorescip-python python gavodachs 2.13 `gavo.svcs.core`/getCore().,
198 childNamesscip-python python gavodachs 2.13 `gavo.base.complexattrs`/MultiStructListAttribute#__init__().(childNames)=listscip-python python python-stdlib 3.11 builtins/list#(svcsscip-python python gavodachs 2.13 `gavo.svcs`/__init__:.CORE_REGISTRYscip-python python gavodachs 2.13 `gavo.svcs.core`/CORE_REGISTRY..keysscip-python python python-stdlib 3.11 builtins/dict#keys().()),
199 description="Cores available in this resource.", copyable=True,
200 before="services")
201
202 _jobsscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_jobs. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructListAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("jobs",
203 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(childFactory)=executingscip-python python gavodachs 2.13 `gavo.rscdef.executing`/__init__:.Executescip-python python gavodachs 2.13 `gavo.rscdef.executing`/Execute#,
204 descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(description)="Jobs to be run while this RD is active.")
205
206 _testsscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_tests. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructListAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("tests",
207 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(childFactory)=regtestscip-python python gavodachs 2.13 `gavo.rscdef.regtest`/__init__:.RegTestSuitescip-python python gavodachs 2.13 `gavo.rscdef.regtest`/RegTestSuite#,
208 descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#__init__().(description)="Suites of regression tests connected to this RD.")
209
210 _coveragescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_coverage. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#("coverage",
211 childFactoryscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructAttribute#__init__().(childFactory)=rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__:.Coveragescip-python python gavodachs 2.13 `gavo.rscdef.coverage`/Coverage#,
212 defaultscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructAttribute#__init__().(default)=None,
213 descriptionscip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructAttribute#__init__().(description)="STC coverage of this resource.", copyable=True)
214
215 _propertiesscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_properties. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.PropertyAttributescip-python python gavodachs 2.13 `gavo.base.complexattrs`/StructListAttribute#()
216
217 resTypescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#resType. = "rd"
218
219 def __init__scip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(self), srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(srcId), **kwargsscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(kwargs)):
220 # RDs never have parents, so contrary to all other structures they
221 # are constructed with with a srcId instead of a parent. You
222 # *can* have that None, but such RDs cannot be used to create
223 # non-temporary tables, services, etc, since the srcId is used
224 # in the construction of identifiers and such.
225 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(self).sourceIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#sourceId. = srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(srcId) or "temporary"
226 basescip-python python gavodachs 2.13 `gavo.base`/__init__:.Structurescip-python python gavodachs 2.13 `gavo.base.structure`/Structure#.__init__scip-python python gavodachs 2.13 `gavo.base.structure`/StructureBase#__init__().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(self), None, **kwargsscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(kwargs))
227 # The rd attribute is a weakref on self. Always. So, this is the class
228 # that roots common.RDAttributes
229 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(self).rdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#rd. = weakrefscip-python python python-stdlib 3.11 weakref/__init__:.proxyscip-python python python-stdlib 3.11 _weakref/proxy().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(self))
230 # real dateUpdated is set by getRD, this is just for RDs created
231 # on the fly.
232 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(self).dateUpdatedscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#dateUpdated. = datetimescip-python python python-stdlib 3.11 datetime/__init__:.datetimescip-python python python-stdlib 3.11 datetime/datetime#.utcnowscip-python python python-stdlib 3.11 datetime/datetime#utcnow().()
233 # if an RD is parsed from a disk file, this gets set to its path
234 # by getRD below
235 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(self).srcPathscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#srcPath. = None
236 # this is for modified-since and friends.
237 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(self).loadedAtscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#loadedAt. = timescip-python python python-stdlib 3.11 time/__init__:.timescip-python python python-stdlib 3.11 time/time().()
238 # keep track of RDs depending on us for the registry code
239 # (only read this)
240 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__init__().(self).rdDependenciesscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#rdDependencies. = setscip-python python python-stdlib 3.11 builtins/set#()
241
242 def __iter__scip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__iter__().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__iter__().(self)):
243 return iterscip-python python python-stdlib 3.11 builtins/iter().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__iter__().(self).dds)
244
245 def __repr__scip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__repr__().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__repr__().(self)):
246 return "<resource descriptor for %s>"%selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#__repr__().(self).sourceIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#sourceId.
247
248 def validatescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#validate().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#validate().(self)):
249 if not utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.identifierPatternscip-python python gavodachs 2.13 `gavo.utils.texttricks`/identifierPattern..matchscip-python python python-stdlib 3.11 re/Pattern#match().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#validate().(self).schema):
250 raise basescip-python python gavodachs 2.13 `gavo.base`/__init__:.StructureErrorscip-python python gavodachs 2.13 `gavo.base.structure`/Structure#("DaCHS schema attributes must be valid"
251 " python identifiers")
252
253 def isDirtyscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#isDirty().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#isDirty().(self)):
254 """returns true if the RD on disk has a timestamp newer than
255 loadedAt.
256 """
257 if isinstance(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#isDirty().(self).srcPathscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#srcPath., PkgResourcePathscip-python python gavodachs 2.13 `gavo.rscdesc`/PkgResourcePath#):
258 # stuff from the resource package should not change underneath us.
259 return False
260
261 try:
262 if selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#isDirty().(self).srcPathscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#srcPath. is not None:
263 return osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..getmtimescip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#isDirty().(self).srcPathscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#srcPath.)>selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#isDirty().(self).loadedAtscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#loadedAt.
264 except osscip-python python python-stdlib 3.11 os/__init__:.errorscip-python python python-stdlib 3.11 os/error.:
265 # this will usually mean the file went away
266 return True
267 return False
268
269 def importModulescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#importModule().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#importModule().(self), ctxscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#importModule().(ctx)):
270 # this is a callback for the require attribute
271 utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.loadInternalObjectscip-python python gavodachs 2.13 `gavo.utils.codetricks`/loadInternalObject().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#importModule().(self).require, "__doc__")
272
273 def onElementCompletescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self)):
274 for table in selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self).tables:
275 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self).readProfilesscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#readProfiles. = selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self).readProfilesscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#readProfiles. | table.readProfiles
276 table.setMetaParent(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self))
277
278 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self).serviceIndexscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#serviceIndex. = {}
279 for svc in selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self).services:
280 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self).serviceIndexscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#serviceIndex.[svc.id] = svc
281 svc.setMetaParent(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self))
282
283 for dd in selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self).dds:
284 dd.setMetaParent(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self))
285
286 if (selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self).resdir
287 and not selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self).resdir.is_dir()
288 # the system RDs don't actually use their resdir, so be
289 # relaxed when people drop it
290 and not selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self).resdir.parts[-1]=="__system"):
291 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().("RD %s: resource directory '%s' does not exist"%(
292 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self).sourceIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#sourceId., selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#onElementComplete().(self).resdir))
293
294 superscip-python python python-stdlib 3.11 builtins/super#().onElementCompletescip-python python gavodachs 2.13 `gavo.base.common`/StructCallbacks#onElementComplete().()
295
296 def _inferResdirscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_inferResdir().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_inferResdir().(self), valuescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_inferResdir().(value)):
297 # a callback for the schema attribute
298 if selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_inferResdir().(self).resdir is None:
299 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_inferResdir().(self)._resdirscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_resdir..feedObjectscip-python python gavodachs 2.13 `gavo.rscdesc`/ResdirAttribute#feedObject().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_inferResdir().(self), valuescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_inferResdir().(value))
300
301 def iterDDsscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#iterDDs().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#iterDDs().(self)):
302 return iterscip-python python python-stdlib 3.11 builtins/iter().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#iterDDs().(self).dds)
303
304 def getServicescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getService().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getService().(self), idscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getService().(id)):
305 """returns a service or resRec object with id.
306
307 This will return None if neither exists.
308 """
309 try:
310 res = selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getService().(self).getByIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(idscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getService().(id))
311 if isinstance(res, (svcsscip-python python gavodachs 2.13 `gavo.svcs`/__init__:.Servicescip-python python gavodachs 2.13 `gavo.svcs.service`/Service#, registryscip-python python gavodachs 2.13 `gavo.registry`/__init__:.ResRecscip-python python gavodachs 2.13 `gavo.registry.nonservice`/ResRec#)):
312 return res
313 except basescip-python python gavodachs 2.13 `gavo.base`/__init__:.NotFoundErrorscip-python python gavodachs 2.13 `gavo.base.structure`/Structure#:
314 pass # Fall through when there's no id.
315 return None
316
317 def getTableDefByIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getTableDefById().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getTableDefById().(self), idscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getTableDefById().(id)):
318 return selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getTableDefById().(self).getByIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(idscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getTableDefById().(id), rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__:.TableDefscip-python python gavodachs 2.13 `gavo.base.structure`/TableDef#)
319
320 def getDataDescByIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getDataDescById().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getDataDescById().(self), idscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getDataDescById().(id)):
321 return selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getDataDescById().(self).getByIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(idscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getDataDescById().(id), rscdefscip-python python gavodachs 2.13 `gavo.rscdef`/__init__:.DataDescriptorscip-python python gavodachs 2.13 `gavo.rscdef.dddef`/DataDescriptor#)
322
323 def getByIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(self), idscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(id), forceTypescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(forceType)=None):
324 try:
325 res = selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(self).idmap[idscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(id)]
326 except KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#:
327 raise basescip-python python gavodachs 2.13 `gavo.base`/__init__:.NotFoundErrorscip-python python gavodachs 2.13 `gavo.base.structure`/Structure#(
328 idscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(id), "Element with id", "RD %s"%(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(self).sourceIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#sourceId.))
329 if forceTypescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(forceType):
330 basescip-python python gavodachs 2.13 `gavo.base`/__init__:.assertTypescip-python python gavodachs 2.13 `gavo.base.parsecontext`/assertType().(idscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(id), res, forceTypescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getById().(forceType))
331 return res
332
333 def getRelResdirscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getRelResdir().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getRelResdir().(self)):
334 """returns the inputsDir-relative resource directory path.
335
336 This never has either a leading or a trailing path.
337 """
338 return utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.getRelativePath(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getRelResdir().(self).resdir, basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("inputsDir"))
339
340 def getAbsPathscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getAbsPath().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getAbsPath().(self), relPathscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getAbsPath().(relPath)):
341 """returns the absolute path for a resdir-relative relPath.
342 """
343 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().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getAbsPath().(self).resdir, relPathscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getAbsPath().(relPath))
344
345 def openResscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#openRes().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#openRes().(self), relPathscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#openRes().(relPath), modescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#openRes().(mode)="rb"):
346 """returns a file object for relPath within self's resdir.
347
348 Deprecated. This is going to go away, use getAbsPath and a context
349 manager.
350 """
351 return openscip-python python python-stdlib 3.11 builtins/open().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#openRes().(self).getAbsPathscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getAbsPath().(relPathscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#openRes().(relPath)), modescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#openRes().(mode))
352
353 def _computeIdmapscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_computeIdmap().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_computeIdmap().(self)):
354 res = {}
355 for child in selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_computeIdmap().(self).iterChildrenscip-python python gavodachs 2.13 `gavo.base.structure`/StructureBase#iterChildren().():
356 if hasattr(child, "id"):
357 res[child.id] = child
358 return res
359
360 def addDependencyscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#addDependency().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#addDependency().(self), rdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#addDependency().(rd), prereqscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#addDependency().(prereq)):
361 """declares that rd needs the RD prereq to properly work.
362
363 This is used in the generation of resource records to ensure that, e.g.
364 registered data have added their served-bys to the service resources.
365 """
366 if rdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#addDependency().(rd).sourceId!=prereqscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#addDependency().(prereq).sourceId:
367 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#addDependency().(self).rdDependenciesscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#rdDependencies..addscip-python python python-stdlib 3.11 builtins/set#add().((rdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#addDependency().(rd).sourceId, prereqscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#addDependency().(prereq).sourceId))
368
369 def copyscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#copy().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#copy().(self), parentscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#copy().(parent)):
370 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().("Copying an RD -- this may not be a good idea")
371 new = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.Structurescip-python python gavodachs 2.13 `gavo.base.structure`/Structure#.copy(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#copy().(self), parentscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#copy().(parent))
372 new.idmap = new._computeIdmap()
373 new.sourceId = selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#copy().(self).sourceIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#sourceId.
374 return new
375
376 def updateMetaInDBscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#updateMetaInDB().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#updateMetaInDB().(self), connectionscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#updateMetaInDB().(connection), reasonscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#updateMetaInDB().(reason)):
377 """updates this RD's metadata in the database.
378
379 See the grammar in //rds for what you can give for reason.
380 """
381 rscscip-python python gavodachs 2.13 `gavo.rsc`/__init__:.makeDatascip-python python gavodachs 2.13 `gavo.rsc.data`/makeData().(
382 basescip-python python gavodachs 2.13 `gavo.base`/__init__:.resolveCrossIdscip-python python gavodachs 2.13 `gavo.base.parsecontext`/resolveCrossId().("//rds#update-for-rd"),
383 connectionscip-python python gavodachs 2.13 `gavo.rsc.data`/makeData().(connection)=connectionscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#updateMetaInDB().(connection),
384 forceSourcescip-python python gavodachs 2.13 `gavo.rsc.data`/makeData().(forceSource)=(reasonscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#updateMetaInDB().(reason), selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#updateMetaInDB().(self)))
385
386 def invalidatescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#invalidate().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#invalidate().(self)):
387 """make the RD fail on every attribute read.
388
389 See rscdesc._loadRDIntoCache for why we want this.
390 """
391 errMsg = ("Loading of %s failed in another thread; this RD cannot"
392 " be used here")%selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#invalidate().(self).sourceIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#sourceId.
393
394 class BrokenClassscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#invalidate().BrokenClass#(objectscip-python python python-stdlib 3.11 builtins/object#):
395 """A class that reacts to all attribute requests with a some exception.
396 """
397 def __getattribute__scip-python python gavodachs 2.13 `gavo.rscdesc`/RD#invalidate().BrokenClass#__getattribute__().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#invalidate().BrokenClass#__getattribute__().(self), attributeNamescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#invalidate().BrokenClass#__getattribute__().(attributeName)):
398 if attributeNamescip-python python gavodachs 2.13 `gavo.rscdesc`/RD#invalidate().BrokenClass#__getattribute__().(attributeName)=="__class__":
399 return BrokenClassscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#invalidate().BrokenClass#
400 raise basescip-python python gavodachs 2.13 `gavo.base`/__init__:.ReportableErrorscip-python python gavodachs 2.13 `gavo.base.structure`/Structure#(errMsg)
401
402 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#invalidate().(self).__class__scip-python python python-stdlib 3.11 builtins/object#__class__(). = BrokenClassscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#invalidate().BrokenClass#
403
404 def getSchemaRankscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getSchemaRank().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getSchemaRank().(self)):
405 """returns the value of the schema-rank meta parsed and with a
406 fallback.
407 """
408 m = selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#getSchemaRank().(self).getMetascip-python python gavodachs 2.13 `gavo.base.meta`/MetaMixin#getMeta().("schema-rank")
409 if m:
410 return intscip-python python python-stdlib 3.11 builtins/int#(m.getContentscip-python python gavodachs 2.13 `gavo.base.meta`/MetaItem#getContent().())
411 return 100000
412
413 def _meta__metadataUpdatedscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta__metadataUpdated().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta__metadataUpdated().(self)):
414 """falls back to utcnow in case we don't know the metadata update
415 time.
416
417 Since _metadataUpdated falls back to the file creation time, this
418 is only reached for file-less RDs. For these, just about now
419 would be a good guess as to their creation time.
420
421 In reality, this shouldn't be reached outside of test code; there,
422 however, it's important because this is used in required attributes
423 in OAI-PMH and VOResource.
424 """
425 return utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.formatISODTscip-python python gavodachs 2.13 `gavo.utils.texttricks`/formatISODT().(datetimescip-python python python-stdlib 3.11 datetime/__init__:.datetimescip-python python python-stdlib 3.11 datetime/datetime#.utcnowscip-python python python-stdlib 3.11 datetime/datetime#utcnow().())
426
427 def _meta_referenceURLscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta_referenceURL().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta_referenceURL().(self)):
428 return basescip-python python gavodachs 2.13 `gavo.base`/__init__:.META_CLASSES_FOR_KEYSscip-python python gavodachs 2.13 builtins/META_CLASSES_FOR_KEYS#["referenceURL"](
429 basescip-python python gavodachs 2.13 `gavo.base`/__init__:.makeAbsoluteURL("/browse/"+selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta_referenceURL().(self).sourceIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#sourceId.),
430 title="Resource info")
431
432 def _meta_identifierscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta_identifier().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta_identifier().(self)):
433 return "ivo://%s/%s"%(basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("ivoa", "authority"),
434 urlparse.quote(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta_identifier().(self).sourceIdscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#sourceId.))
435
436 def _meta_published_identifierscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta_published_identifier().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta_published_identifier().(self)):
437 if selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta_published_identifier().(self).publication:
438 return selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta_published_identifier().(self)._meta_identifierscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#_meta_identifier().()
439 return None
440
441 def macro_RSTccbysascip-python python gavodachs 2.13 `gavo.rscdesc`/RD#macro_RSTccbysa().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#macro_RSTccbysa().(self), stuffDesignationscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#macro_RSTccbysa().(stuffDesignation)):
442 """expands to a declaration that stuffDesignation is available under
443 CC-BY-SA.
444
445 This only works in reStructured text (though it's still almost
446 readable as source).
447
448 You'll probably want to use the `//procs#license-cc-by-sa`_ stream
449 instead of this, as that also sets the rights URI.
450 """
451 return ("%s is licensed under the `Creative Commons Attribution"
452 " Share-Alike 4.0"
453 " License <http://creativecommons.org/licenses/by-sa/4.0/>`_\n\n"
454 ".. image:: /static/img/ccbysa.png\n :alt: [CC-BY-SA]\n"
455 )%stuffDesignationscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#macro_RSTccbysa().(stuffDesignation)
456
457 def macro_RSTccbyscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#macro_RSTccby().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#macro_RSTccby().(self), stuffDesignationscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#macro_RSTccby().(stuffDesignation)):
458 """expands to a declaration that stuffDesignation is available under
459 CC-BY.
460
461 This only works in reStructured text (though it's still almost
462 readable as source).
463
464 You'll probably want to use the `//procs#license-cc-by`_ stream
465 instead of this, as that also sets the rights URI.
466 """
467 return ("%s is licensed under the `Creative Commons Attribution 4.0"
468 " License <http://creativecommons.org/licenses/by/4.0/>`_\n\n"
469 ".. image:: /static/img/ccby.png\n :alt: [CC-BY]\n\n"
470 )%stuffDesignationscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#macro_RSTccby().(stuffDesignation)
471
472 def macro_RSTcc0scip-python python gavodachs 2.13 `gavo.rscdesc`/RD#macro_RSTcc0().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#macro_RSTcc0().(self), stuffDesignationscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#macro_RSTcc0().(stuffDesignation)):
473 """expands to a declaration that stuffDesignation is available under
474 CC-0.
475
476 This only works in reStructured text (though it's still almost
477 readable as source).
478
479 You'll probably want to use the `//procs#license-cc0`_ stream
480 instead of this, as that also sets the rights URI.
481 """
482 return ("To the extent possible under law, the publisher has"
483 " waived all copyright and related or neighboring rights to %s."
484 " For details, see the `Creative Commons CC0 1.0"
485 " Public Domain dedication"
486 " <http://creativecommons.org/publicdomain/zero/1.0/>`_. Of course,"
487 " you should still give proper credit when using this data as"
488 " required by good scientific practice.\n\n"
489 ".. image:: /static/img/cc0.png\n :alt: [CC0]\n\n"
490 )%stuffDesignationscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#macro_RSTcc0().(stuffDesignation)
491
492
493 class RDParseContextscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#(basescip-python python gavodachs 2.13 `gavo.base`/__init__:.ParseContextscip-python python gavodachs 2.13 `gavo.base.parsecontext`/ParseContext#):
494 """is a parse context for RDs.
495
496 It defines a couple of attributes that structures can ask for (however,
497 it's good practice not to rely on their presence in case someone wants
498 to parse XML snippets with a standard parse context, so use
499 getattr(ctx, "doQueries", True) or somesuch.
500 """
501 def __init__scip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(self), doQueriesscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(doQueries)=True, restrictedscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(restricted)=False, forRDscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(forRD)=None):
502 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(self).doQueriesscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#doQueries. = doQueriesscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(doQueries)
503 basescip-python python gavodachs 2.13 `gavo.base`/__init__:.ParseContextscip-python python gavodachs 2.13 `gavo.base.parsecontext`/ParseContext#.__init__scip-python python gavodachs 2.13 `gavo.base.parsecontext`/ParseContext#__init__().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(self), restrictedscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(restricted), forRDscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(forRD))
504
505 @classmethodscip-python python python-stdlib 3.11 builtins/classmethod#
506 def fromContextscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#fromContext().(clsscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#fromContext().(cls), ctxscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#fromContext().(ctx), forRDscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#fromContext().(forRD)=None):
507 """a constructor that makes a context with the parameters taken from
508 the RDParseContext ctx.
509 """
510 return clsscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#fromContext().(cls)(doQueries=ctxscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#fromContext().(ctx).doQueries, restricted=ctxscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#fromContext().(ctx).restricted,
511 forRD=forRDscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#fromContext().(forRD))
512
513 @propertyscip-python python python-stdlib 3.11 builtins/property#
514 def failuresAreCacheablescip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#failuresAreCacheable().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#failuresAreCacheable().(self)):
515 """returns true if failures produced with this context should
516 be cached.
517
518 This is not the case with restricted parses.
519 """
520 return not selfscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#failuresAreCacheable().(self).restrictedscip-python python gavodachs 2.13 `gavo.base.parsecontext`/ParseContext#restricted.
521
522
523 class PkgResourcePathscip-python python gavodachs 2.13 `gavo.rscdesc`/PkgResourcePath#(strscip-python python python-stdlib 3.11 builtins/str#):
524 """A sentinel class used to mark an RD as coming from pkg_resources.
525 """
526 def __str__scip-python python gavodachs 2.13 `gavo.rscdesc`/PkgResourcePath#__str__().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/PkgResourcePath#__str__().(self)):
527 return selfscip-python python gavodachs 2.13 `gavo.rscdesc`/PkgResourcePath#__str__().(self)
528
529
530 def canonicalizeRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId)):
531 """returns a standard rd id for srcId.
532
533 srcId may be a file system path, or it may be an "id". The canonical
534 basically is "inputs-relative path without .rd extension". Everything
535 that's not within inputs or doesn't end with .rd is handed through.
536 // is expanded to __system__/. The path to built-in RDs,
537 /resources/inputs, is treated analogous to inputsDir.
538 """
539 srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId) = strscip-python python python-stdlib 3.11 builtins/str#(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId))
540 if srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId).startswithscip-python python python-stdlib 3.11 builtins/str#startswith().("//"):
541 srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId) = "__system__"+srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId)[1:]
542
543 # This may see un-normalised path; let's try and follow unix path
544 # semantics
545 cleanedPath = []
546 for segment in srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId).splitscip-python python python-stdlib 3.11 builtins/str#split().("/"):
547 if segment==".":
548 pass
549 elif segment=="..":
550 if cleanedPath:
551 cleanedPath.popscip-python python python-stdlib 3.11 builtins/list#pop().()
552 else:
553 raise ValueErrorscip-python python python-stdlib 3.11 builtins/ValueError#("Too many .. in relative rd id")
554 else:
555 cleanedPath.appendscip-python python python-stdlib 3.11 builtins/list#append().(segment)
556 srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId) = "/".joinscip-python python python-stdlib 3.11 builtins/str#join().(cleanedPath)
557
558 for inputsDir in (strscip-python python python-stdlib 3.11 builtins/str#(basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("inputsDir")), "/resources/inputs"):
559 if srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId).startswithscip-python python python-stdlib 3.11 builtins/str#startswith().(inputsDir):
560 srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId) = srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId)[len(inputsDir):].lstripscip-python python python-stdlib 3.11 builtins/str#lstrip().("/")
561
562 if srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId).endswithscip-python python python-stdlib 3.11 builtins/str#endswith().(".rd"):
563 srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId) = srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId)[:-3]
564
565 return srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcId)
566
567
568 def _getFilenamesForIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_getFilenamesForId().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_getFilenamesForId().(srcId)):
569 """helps getRDInputStream by iterating over possible files for srcId.
570 """
571 if srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_getFilenamesForId().(srcId).startswith("/"):
572 yield pathlibscip-python python python-stdlib 3.11 pathlib/__init__:.Pathscip-python python python-stdlib 3.11 pathlib/Path#(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_getFilenamesForId().(srcId)+".rd")
573 yield pathlibscip-python python python-stdlib 3.11 pathlib/__init__:.Pathscip-python python python-stdlib 3.11 pathlib/Path#(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_getFilenamesForId().(srcId))
574 else:
575 inputsDir = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("inputsDir")
576 yield inputsDir / (srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_getFilenamesForId().(srcId)+".rd")
577 yield inputsDir / srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_getFilenamesForId().(srcId)
578 yield "/resources/inputs/%s.rd"%srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_getFilenamesForId().(srcId)
579 yield "/resources/inputs/%s"%srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_getFilenamesForId().(srcId)
580
581
582 def getRDInputStreamscip-python python gavodachs 2.13 `gavo.rscdesc`/getRDInputStream().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/getRDInputStream().(srcId)):
583 """returns a read-open stream for the XML source of the resource
584 descriptor with srcId.
585
586 srcId is already normalized; that means that absolute paths must
587 point to a file (sans possibly .rd), relative paths are relative
588 to inputsDir or pkg_resources(/resources/inputs).
589
590 This function prefers files with .rd to those without, and
591 inputsDir to pkg_resources (the latter allowing the user to
592 override built-in system RDs).
593 """
594 for fName in _getFilenamesForIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_getFilenamesForId().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/getRDInputStream().(srcId)):
595 if isinstance(fName, pathlibscip-python python python-stdlib 3.11 pathlib/__init__:.Pathscip-python python python-stdlib 3.11 pathlib/Path#):
596 # a user-controlled file
597 if fName.is_filescip-python python python-stdlib 3.11 pathlib/Path#is_file().():
598 # We don't want RDs from outside of inputs and config, as
599 # these make referencing really messy.
600 filePath = strscip-python python python-stdlib 3.11 builtins/str#(fName.absolutescip-python python python-stdlib 3.11 pathlib/Path#absolute().())
601 if not (
602 filePath.startswithscip-python python python-stdlib 3.11 builtins/str#startswith().(strscip-python python python-stdlib 3.11 builtins/str#(basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("inputsDir")))
603 or filePath.startswithscip-python python python-stdlib 3.11 builtins/str#startswith().(strscip-python python python-stdlib 3.11 builtins/str#(basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("configDir")))):
604 raise basescip-python python gavodachs 2.13 `gavo.base`/__init__:.ReportableErrorscip-python python gavodachs 2.13 `gavo.base.structure`/Structure#("%s: Only RDs below inputsDir (%s) are"
605 " allowed."%(fName, basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("inputsDir")))
606
607 return fName, openscip-python python python-stdlib 3.11 builtins/open().(fName, "rb")
608
609 else:
610 # a pkg_resources key
611 if (pkg_resources.resource_exists('gavo', fName)
612 and not pkg_resources.resource_isdir('gavo', fName)):
613 return (PkgResourcePathscip-python python gavodachs 2.13 `gavo.rscdesc`/PkgResourcePath#(fName),
614 pkg_resources.resource_stream('gavo', fName))
615
616 raise basescip-python python gavodachs 2.13 `gavo.base`/__init__:.RDNotFoundscip-python python gavodachs 2.13 `gavo.base.structure`/Structure#(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/getRDInputStream().(srcId))
617
618
619 def setRDDateTimesscip-python python gavodachs 2.13 `gavo.rscdesc`/setRDDateTimes().(ctxscip-python python gavodachs 2.13 `gavo.rscdesc`/setRDDateTimes().(ctx), rdscip-python python gavodachs 2.13 `gavo.rscdesc`/setRDDateTimes().(rd), inputFilescip-python python gavodachs 2.13 `gavo.rscdesc`/setRDDateTimes().(inputFile)):
620 """sets the _dataUpdated and _metadataUpdated meta items on rd.
621 """
622 rdscip-python python gavodachs 2.13 `gavo.rscdesc`/setRDDateTimes().(rd).setMeta("_metadataUpdated",
623 datetimescip-python python python-stdlib 3.11 datetime/__init__:.datetimescip-python python python-stdlib 3.11 datetime/datetime#.utcfromtimestampscip-python python python-stdlib 3.11 datetime/datetime#utcfromtimestamp().(
624 utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.fgetmtimescip-python python gavodachs 2.13 `gavo.utils.ostricks`/fgetmtime().(inputFilescip-python python gavodachs 2.13 `gavo.rscdesc`/setRDDateTimes().(inputFile))))
625
626 try:
627 rdscip-python python gavodachs 2.13 `gavo.rscdesc`/setRDDateTimes().(rd).setMeta("_dataUpdated", ctxscip-python python gavodachs 2.13 `gavo.rscdesc`/setRDDateTimes().(ctx).getInjected("_dataUpdated"))
628 except KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#:
629 # no data imported yet, probably
630 pass
631
632
633 USERCONFIG_RD_PATHscip-python python gavodachs 2.13 `gavo.rscdesc`/USERCONFIG_RD_PATH. = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("configDir") / "userconfig"
634
635
636 class _UserConfigFakeRDscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#(objectscip-python python python-stdlib 3.11 builtins/object#):
637 """A fake object that's in the RD cache as "%".
638
639 This is used by the id resolvers in parsecontext; this certainly is
640 of no use as an RD otherwise.
641 """
642 def __init__scip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#__init__().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#__init__().(self)):
643 pass
644
645 def getRealRDscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getRealRD().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getRealRD().(self)):
646 return basescip-python python gavodachs 2.13 `gavo.base`/__init__:.cachesscip-python python gavodachs 2.13 `gavo.base.caches`/__init__:.getRD(USERCONFIG_RD_PATHscip-python python gavodachs 2.13 `gavo.rscdesc`/USERCONFIG_RD_PATH.)
647
648 def getMetascip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getMeta().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getMeta().(self), *argsscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getMeta().(args), **kwargsscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getMeta().(kwargs)):
649 return basescip-python python gavodachs 2.13 `gavo.base`/__init__:.cachesscip-python python gavodachs 2.13 `gavo.base.caches`/__init__:.getRD(USERCONFIG_RD_PATHscip-python python gavodachs 2.13 `gavo.rscdesc`/USERCONFIG_RD_PATH.).getMeta(*argsscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getMeta().(args), **kwargsscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getMeta().(kwargs))
650
651 def getByIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getById().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getById().(self), idscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getById().(id), forceTypescip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getById().(forceType)=None):
652 """returns an item from userconfig.
653
654 This first tries to resolve id in gavo/etc/userconfig.rd, then in the
655 fallback //userconfig.rd.
656 """
657 try:
658 try:
659 return basescip-python python gavodachs 2.13 `gavo.base`/__init__:.cachesscip-python python gavodachs 2.13 `gavo.base.caches`/__init__:.getRD(
660 basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("configDir") / "userconfig.rd"
661 ).getById(idscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getById().(id), forceType=forceTypescip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getById().(forceType))
662 except basescip-python python gavodachs 2.13 `gavo.base`/__init__:.NotFoundErrorscip-python python gavodachs 2.13 `gavo.base.structure`/Structure#:
663 pass
664 except Exceptionscip-python python python-stdlib 3.11 builtins/Exception# as msg:
665 basescip-python python gavodachs 2.13 `gavo.base`/__init__:.uiscip-python python gavodachs 2.13 `gavo.base`/ui..notifyErrorscip-python python gavodachs 2.13 `gavo.base.events`/EventDispatcher#notifyError().("Bad userconfig: (%s), ignoring it. Run"
666 " 'dachs val %%' to see actual errors."%repr(msg))
667
668 return basescip-python python gavodachs 2.13 `gavo.base`/__init__:.cachesscip-python python gavodachs 2.13 `gavo.base.caches`/__init__:.getRD("//userconfig"
669 ).getById(idscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getById().(id), forceType=forceTypescip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getById().(forceType))
670 except basescip-python python gavodachs 2.13 `gavo.base`/__init__:.NotFoundErrorscip-python python gavodachs 2.13 `gavo.base.structure`/Structure#:
671 raise basescip-python python gavodachs 2.13 `gavo.base`/__init__:.NotFoundErrorscip-python python gavodachs 2.13 `gavo.base.structure`/Structure#(idscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#getById().(id), "Element with id",
672 "etc/userconfig.rd")
673
674
675 def refuseBlacklistedscip-python python gavodachs 2.13 `gavo.rscdesc`/refuseBlacklisted().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/refuseBlacklisted().(srcId), rdInputPathscip-python python gavodachs 2.13 `gavo.rscdesc`/refuseBlacklisted().(rdInputPath)):
676 """raises an exception if rdInputPath ends with or srcId is equal to
677 one of the strings in [general]rdblacklist.
678 """
679 for blacklistedName in basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("rdblacklist"):
680 if (strscip-python python python-stdlib 3.11 builtins/str#(rdInputPathscip-python python gavodachs 2.13 `gavo.rscdesc`/refuseBlacklisted().(rdInputPath)).endswithscip-python python python-stdlib 3.11 builtins/str#endswith().(blacklistedName)
681 or blacklistedName==srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/refuseBlacklisted().(srcId)):
682 raise utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.Errorscip-python python gavodachs 2.13 `gavo.utils.excs`/Error#(
683 f"RD {srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/refuseBlacklisted().(srcId)} is blacklisted in gavo.rc. Not loading.")
684
685
686 def getRDscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(srcId), doQueriesscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(doQueries)=True, restrictedscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(restricted)=False, useRDscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(useRD)=None):
687 """returns a ResourceDescriptor for srcId.
688
689 srcId is something like an input-relative path; you'll generally
690 omit the extension (unless it's not the standard .rd).
691
692 getRD furnishes the resulting RD with an idmap attribute containing
693 the mapping from id to object collected by the parse context.
694
695 The useRD parameter is for _loadRDIntoCache exclusively and is
696 used by it internally. It is strictly an ugly implementation detail.
697 """
698 if srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(srcId)=='%':
699 return _UserConfigFakeRDscip-python python gavodachs 2.13 `gavo.rscdesc`/_UserConfigFakeRD#()
700
701 if useRDscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(useRD) is None:
702 rd = RDscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#(canonicalizeRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(srcId)))
703 else:
704 rd = useRDscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(useRD)
705
706 srcPath, inputFile = getRDInputStreamscip-python python gavodachs 2.13 `gavo.rscdesc`/getRDInputStream().(rd.sourceId)
707 try:
708 refuseBlacklistedscip-python python gavodachs 2.13 `gavo.rscdesc`/refuseBlacklisted().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(srcId), srcPath)
709 except utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.Errorscip-python python gavodachs 2.13 `gavo.utils.excs`/Error#:
710 inputFile.closescip-python python python-stdlib 3.11 io/IOBase#close().()
711 raise
712
713 # look for a context upstack and get the default parameters from there,
714 # overriding the parameters.
715 try:
716 getRD_context = RDParseContextscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#.fromContextscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#fromContext().(
717 utilsscip-python python gavodachs 2.13 `gavo.utils`/__init__:.stealVarscip-python python gavodachs 2.13 `gavo.utils.codetricks`/stealVar().("getRD_context"), forRDscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#fromContext().(forRD)=rd.sourceId)
718 except ValueErrorscip-python python python-stdlib 3.11 builtins/ValueError#:
719 # no getRD_context variable in the stack
720 getRD_context = RDParseContextscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#(doQueriesscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(doQueries)=doQueriesscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(doQueries),
721 restrictedscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(restricted)=restrictedscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(restricted), forRDscip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#__init__().(forRD)=rd.sourceId)
722
723 rdinjscip-python python gavodachs 2.13 `gavo.rscdef.rdinj`/__init__:.injectIntoContextscip-python python gavodachs 2.13 `gavo.rscdef.rdinj`/injectIntoContext().(getRD_context, rd.sourceId)
724
725 if not isinstance(srcPath, PkgResourcePathscip-python python gavodachs 2.13 `gavo.rscdesc`/PkgResourcePath#):
726 srcPath = osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..abspathscip-python python python-stdlib 3.11 ntpath/join().(srcPath)
727 rd.srcPath = getRD_context.srcPath = srcPath
728 rd.idmap = getRD_context.idmapscip-python python gavodachs 2.13 `gavo.base.parsecontext`/ParseContext#idmap.
729
730 try:
731 rd = basescip-python python gavodachs 2.13 `gavo.base`/__init__:.parseFromStreamscip-python python gavodachs 2.13 `gavo.base.xmlstruct`/parseFromStream().(rd, inputFile, contextscip-python python gavodachs 2.13 `gavo.base.xmlstruct`/parseFromStream().(context)=getRD_context)
732 setRDDateTimesscip-python python gavodachs 2.13 `gavo.rscdesc`/setRDDateTimes().(getRD_context, rd, inputFile)
733 except Exceptionscip-python python python-stdlib 3.11 builtins/Exception# as ex:
734 ex.inFile = srcPath
735 ex.cacheable = getRD_context.failuresAreCacheablescip-python python gavodachs 2.13 `gavo.rscdesc`/RDParseContext#failuresAreCacheable().
736 raise
737 finally:
738 inputFile.closescip-python python python-stdlib 3.11 io/IOBase#close().()
739 return rd
740
741
742 # in _CURRENTLY_PARSING, getRD keeps track of what RDs are currently being
743 # parsed. The keys are the canonical sourceIds, the values are pairs of
744 # an unfinished RD and RLocks protecting it.
745 _CURRENTLY_PARSING_LOCKscip-python python gavodachs 2.13 `gavo.rscdesc`/_CURRENTLY_PARSING_LOCK. = threadingscip-python python python-stdlib 3.11 threading/__init__:.Lockscip-python python python-stdlib 3.11 threading/Lock#()
746 _CURRENTLY_PARSINGscip-python python gavodachs 2.13 `gavo.rscdesc`/_CURRENTLY_PARSING. = {}
747 import threadingscip-python python python-stdlib 3.11 threading/__init__:
748
749
750 class CachedExceptionscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#(objectscip-python python python-stdlib 3.11 builtins/object#):
751 """An exception that occurred while parsing an RD.
752
753 This will remain in the cache until the underlying RD is changed.
754 """
755 def __init__scip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#__init__().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#__init__().(self), exceptionscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#__init__().(exception), sourcePathscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#__init__().(sourcePath)):
756 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#__init__().(self).exceptionscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#exception. = exceptionscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#__init__().(exception).with_traceback(None)
757 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#__init__().(self).sourcePathscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#sourcePath. = sourcePathscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#__init__().(sourcePath)
758 # this can race a bit in that we won't catch saves done between
759 # we started parsing and we came up with the exception, but
760 # these are easy to fix by saving again, so we won't bother.
761 try:
762 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#__init__().(self).loadedAtscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#loadedAt. = osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..getmtimescip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#__init__().(self).sourcePathscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#sourcePath.)
763 except (TypeErrorscip-python python python-stdlib 3.11 builtins/TypeError#, osscip-python python python-stdlib 3.11 os/__init__:.errorscip-python python python-stdlib 3.11 os/error.):
764 # If the file doesn't exist, that state is "as of now"
765 selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#__init__().(self).loadedAtscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#loadedAt. = timescip-python python python-stdlib 3.11 time/__init__:.timescip-python python python-stdlib 3.11 time/time().()
766
767 def isDirtyscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#isDirty().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#isDirty().(self)):
768 if selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#isDirty().(self).sourcePathscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#sourcePath. is None:
769 # this can have various reasons, but most likely it's because
770 # the RD hasn't been there. Since we can't tell if the
771 # file has appreared in the mean time, we'll have to re-check
772 return False
773 if not osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#isDirty().(self).sourcePathscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#sourcePath.):
774 # someone has removed the file, kill cache
775 return True
776 return osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..getmtimescip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#isDirty().(self).sourcePathscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#sourcePath.)>selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#isDirty().(self).loadedAtscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#loadedAt.
777
778 def raiseAgainscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#raiseAgain().(selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#raiseAgain().(self)):
779 raise selfscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#raiseAgain().(self).exceptionscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#exception..with_traceback(None)
780
781
782 def _loadRDIntoCachescip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(canonicalRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(canonicalRDId), cacheDictscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(cacheDict)):
783 """helps _makeRDCache.
784
785 This function contains the locking logic that makes sure multiple
786 threads can load RDs.
787 """
788 with _CURRENTLY_PARSING_LOCKscip-python python gavodachs 2.13 `gavo.rscdesc`/_CURRENTLY_PARSING_LOCK.:
789 if canonicalRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(canonicalRDId) in _CURRENTLY_PARSINGscip-python python gavodachs 2.13 `gavo.rscdesc`/_CURRENTLY_PARSING.:
790 lock, rd = _CURRENTLY_PARSINGscip-python python gavodachs 2.13 `gavo.rscdesc`/_CURRENTLY_PARSING.[canonicalRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(canonicalRDId)]
791 justWait = True
792 else:
793 lock, rd = threadingscip-python python python-stdlib 3.11 threading/__init__:.RLockscip-python python python-stdlib 3.11 threading/RLock.(), RDscip-python python gavodachs 2.13 `gavo.rscdesc`/RD#(canonicalRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(canonicalRDId))
794 _CURRENTLY_PARSINGscip-python python gavodachs 2.13 `gavo.rscdesc`/_CURRENTLY_PARSING.[canonicalRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(canonicalRDId)] = lock, rd
795 lock.acquirescip-python python python-stdlib 3.11 threading/_RLock#acquire().()
796 justWait = False
797
798 if justWait:
799 # Someone else is already parsing. If it's the current thread,
800 # go on (lock is an RLock!) so we can resolve self-references
801 # (as long as they are backward references). All other threads
802 # just wait for the parsing thread to finish
803 lock.acquirescip-python python python-stdlib 3.11 threading/_RLock#acquire().()
804 lock.releasescip-python python python-stdlib 3.11 threading/_RLock#release().()
805 return rd
806
807 try:
808 cacheDictscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(cacheDict)[canonicalRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(canonicalRDId)] = getRDscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(canonicalRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(canonicalRDId), useRDscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(useRD)=rd)
809 except Exceptionscip-python python python-stdlib 3.11 builtins/Exception# as ex:
810 # This could be a bug in python 3.11.2: the raise below gets
811 # a bad traceback without this hack. Perhaps it can go later
812 # again? You see, I suspect this leaks memory.
813 tb = ex.__traceback__scip-python python python-stdlib 3.11 builtins/BaseException#__traceback__.
814
815 # Importing failed, invalidate the RD (in case other threads still
816 # see it from _CURRENTLY_PARSING)
817 if getattrscip-python python python-stdlib 3.11 builtins/getattr().(ex, "cacheable", False):
818 cacheDictscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(cacheDict)[canonicalRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(canonicalRDId)] = CachedExceptionscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#(ex,
819 getattrscip-python python python-stdlib 3.11 builtins/getattr().(rd, "srcPath", None))
820 rd.invalidate()
821 raise ex.with_tracebackscip-python python python-stdlib 3.11 builtins/BaseException#with_traceback().(tb)
822 finally:
823 del _CURRENTLY_PARSINGscip-python python gavodachs 2.13 `gavo.rscdesc`/_CURRENTLY_PARSING.[canonicalRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(canonicalRDId)]
824 lock.releasescip-python python python-stdlib 3.11 threading/_RLock#release().()
825 return cacheDictscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(cacheDict)[canonicalRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(canonicalRDId)]
826
827
828 def _makeRDCachescip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().():
829 """installs the cache for RDs.
830
831 One trick here is to handle "aliasing", i.e. making sure that
832 you get identical objects regardless of whether you request
833 __system__/adql.rd, __system__/adql, or //adql.
834
835 Then, we're checking for "dirty" RDs (i.e., those that should
836 be reloaded).
837
838 The messiest part is the support for getting RDs in the presence of
839 threads while still supporting recursive references, though.
840 """
841 # TODO: Maybe unify this again with caches._makeCache? That stuff could
842 # do with a facility to invalidate cached entries, too.
843 # But care is necessary to not cache any RD parsed in a nonstandard
844 # fashion (e.g., in restricted mode). CAREFUL: since getRD indulges
845 # in variable stealing, explicit checks are necessary.
846 rdCache = {}
847 currentlyValidating = setscip-python python python-stdlib 3.11 builtins/set#()
848
849 def clearRDIfDirtyscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId)):
850 """clears a cached RD for srcId if it's dirty and it can be
851 loaded from disk.
852
853 If it can't be loaded from disk, the disk file's time stamp
854 is being set as the change date on the rd, so it's counting as
855 clean until it's being changed again. This will avoid re-parsing
856 RDs all the time when they're broken for a while.
857 """
858 if (srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId) in rdCache
859 and getattrscip-python python python-stdlib 3.11 builtins/getattr().(rdCache[srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId)], "isDirty", lambda: False)()):
860 try:
861 # limit re-check rate to 10 seconds to avoid getRD storms
862 # on often-used but currently broken RDs
863 if timescip-python python python-stdlib 3.11 time/__init__:.timescip-python python python-stdlib 3.11 time/time().()-rdCache[srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId)].loadedAt<10:
864 return
865
866 if srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId) in currentlyValidating:
867 return
868 currentlyValidating.addscip-python python python-stdlib 3.11 builtins/set#add().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId))
869
870 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().("RD dirty, attempting reload of %s"%srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId))
871 try:
872 tempCache = {}
873 _loadRDIntoCachescip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId), tempCache)
874 finally:
875 currentlyValidating.removescip-python python python-stdlib 3.11 builtins/set#remove().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId))
876 except Exceptionscip-python python python-stdlib 3.11 builtins/Exception# as ex:
877 basescip-python python gavodachs 2.13 `gavo.base`/__init__:.uiscip-python python gavodachs 2.13 `gavo.base`/ui..notifyErrorscip-python python gavodachs 2.13 `gavo.base.events`/EventDispatcher#notifyError().("Tried to reload RD %s but found it broken."
878 " Will retry loading when it has been edited."%srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId))
879 # the source path of the cached exception isn't necessarily
880 # right (for system and userconfig RDs); but it ought
881 # to be good enough for what users typically are confronted with.
882 if isinstance(rdCache[srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId)], CachedExceptionscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#):
883 rdCache[srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId)] = CachedExceptionscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#(ex,
884 strscip-python python python-stdlib 3.11 builtins/str#(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().(basescip-python python gavodachs 2.13 `gavo.base`/__init__:.getConfigscip-python python gavodachs 2.13 `gavo.base.config`/get.("inputsDir"))+srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId)+".rd"))
885
886 else:
887 rdCache[srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId)].loadedAt = timescip-python python python-stdlib 3.11 time/__init__:.timescip-python python python-stdlib 3.11 time/time().()
888
889 return
890 basescip-python python gavodachs 2.13 `gavo.base`/__init__:.cachesscip-python python gavodachs 2.13 `gavo.base.caches`/__init__:.clearForNamescip-python python gavodachs 2.13 `gavo.base.caches`/clearForName.(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcId))
891
892 def getRDCachedscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(srcId), **kwargsscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(kwargs)):
893 if kwargsscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(kwargs):
894 return getRDscip-python python gavodachs 2.13 `gavo.rscdesc`/getRD().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(srcId), **kwargsscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(kwargs))
895
896 srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(srcId) = canonicalizeRDIdscip-python python gavodachs 2.13 `gavo.rscdesc`/canonicalizeRDId().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(srcId))
897 # Since the "validate before purge last" change it's possible
898 # that we're currently parsing and in the cache. During the
899 # validation run, we need to return from the the thing that
900 # currently parses. Hence, we need to re-do quite a bit of
901 # the logic of _loadRDIntoCache here. Gnwm.
902 if srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(srcId) in _CURRENTLY_PARSINGscip-python python gavodachs 2.13 `gavo.rscdesc`/_CURRENTLY_PARSING.:
903 lock, rd = _CURRENTLY_PARSINGscip-python python gavodachs 2.13 `gavo.rscdesc`/_CURRENTLY_PARSING.[srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(srcId)]
904 lock.acquire()
905 lock.release()
906 return rd
907
908 clearRDIfDirtyscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().clearRDIfDirty().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(srcId))
909
910 if srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(srcId) in rdCache:
911 cachedOb = rdCache[srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(srcId)]
912 if isinstance(cachedOb, CachedExceptionscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#):
913 cachedOb.raiseAgainscip-python python gavodachs 2.13 `gavo.rscdesc`/CachedException#raiseAgain().()
914 else:
915 return cachedOb
916
917 else:
918 return _loadRDIntoCachescip-python python gavodachs 2.13 `gavo.rscdesc`/_loadRDIntoCache().(srcIdscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().(srcId), rdCache)
919
920 getRDCachedscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached()..cacheCopy = rdCache
921 basescip-python python gavodachs 2.13 `gavo.base`/__init__:.cachesscip-python python gavodachs 2.13 `gavo.base.caches`/__init__:.registerCachescip-python python gavodachs 2.13 `gavo.base.caches`/registerCache().("getRD", rdCache, getRDCachedscip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().getRDCached().)
922
923 _makeRDCachescip-python python gavodachs 2.13 `gavo.rscdesc`/_makeRDCache().()