aridity 90__tar.gz → 91__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
aridity-91/PKG-INFO ADDED
@@ -0,0 +1,559 @@
1
+ Metadata-Version: 2.1
2
+ Name: aridity
3
+ Version: 91
4
+ Summary: DRY config and template system, easily extensible with Python
5
+ Home-page: https://pypi.org/project/aridity/
6
+ Author: foyono
7
+ Author-email: shrovis@foyono.com
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: pyparsing>=3.0.2
10
+
11
+ # aridity
12
+ DRY config and template system, easily extensible with Python.
13
+
14
+ This README is auto-generated, see [project wiki](https://wikiwheel.net/s/foyono/w/aridity) for details.
15
+
16
+ ## Commands
17
+
18
+ ### arid-config
19
+ Print given config (with optional path in config) as shell snippet.
20
+
21
+ ### aridity
22
+ Interactive REPL.
23
+
24
+ ### processtemplate
25
+ Process the given template to stdout using config from stdin.
26
+
27
+ ## API
28
+
29
+ <a id="aridity.config"></a>
30
+
31
+ ### aridity.config
32
+
33
+ <a id="aridity.config.ConfigCtrl"></a>
34
+
35
+ #### ConfigCtrl Objects
36
+
37
+ ```python
38
+ class ConfigCtrl()
39
+ ```
40
+
41
+ High level scope API.
42
+
43
+ <a id="aridity.config.ConfigCtrl.r"></a>
44
+
45
+ ###### r
46
+
47
+ ```python
48
+ @property
49
+ def r()
50
+ ```
51
+
52
+ Get config object for reading, i.e. missing scopes will error.
53
+
54
+ <a id="aridity.config.ConfigCtrl.w"></a>
55
+
56
+ ###### w
57
+
58
+ ```python
59
+ @property
60
+ def w()
61
+ ```
62
+
63
+ Get config object for writing, i.e. missing scopes will be created.
64
+
65
+ <a id="aridity.config.ConfigCtrl.loadappconfig"></a>
66
+
67
+ ###### loadappconfig
68
+
69
+ ```python
70
+ def loadappconfig(mainfunction,
71
+ moduleresource,
72
+ encoding='ascii',
73
+ settingsoptional=False)
74
+ ```
75
+
76
+ Using app name as prefix load config from the given resource, apply user settings, and return config object for app. Context module for loading resource and the app name are deduced from `mainfunction`, or these can be provided as a tuple. Set `settingsoptional` to suppress the usual error if ~/.settings.arid does not exist.
77
+
78
+ <a id="aridity.config.ConfigCtrl.load"></a>
79
+
80
+ ###### load
81
+
82
+ ```python
83
+ def load(pathorstream)
84
+ ```
85
+
86
+ Execute config from the given path or stream.
87
+
88
+ <a id="aridity.config.ConfigCtrl.execute"></a>
89
+
90
+ ###### execute
91
+
92
+ ```python
93
+ def execute(text)
94
+ ```
95
+
96
+ Execute given config text.
97
+
98
+ <a id="aridity.config.ConfigCtrl.__iter__"></a>
99
+
100
+ ###### \_\_iter\_\_
101
+
102
+ ```python
103
+ def __iter__()
104
+ ```
105
+
106
+ Yield keys and values.
107
+
108
+ <a id="aridity.config.ConfigCtrl.processtemplate"></a>
109
+
110
+ ###### processtemplate
111
+
112
+ ```python
113
+ def processtemplate(frompathorstream, topathorstream)
114
+ ```
115
+
116
+ Evaluate expression from path/stream and write result to path/stream.
117
+
118
+ <a id="aridity.config.RConfig"></a>
119
+
120
+ #### RConfig Objects
121
+
122
+ ```python
123
+ class RConfig(Parabject)
124
+ ```
125
+
126
+ <a id="aridity.config.RConfig.__iter__"></a>
127
+
128
+ ###### \_\_iter\_\_
129
+
130
+ ```python
131
+ def __iter__()
132
+ ```
133
+
134
+ Yield values only. Iterate over `-self` for keys and values.
135
+
136
+ <a id="aridity.directives"></a>
137
+
138
+ ### aridity.directives
139
+
140
+ <a id="aridity.directives.colon"></a>
141
+
142
+ ###### colon
143
+
144
+ ```python
145
+ def colon(prefix, suffix, scope)
146
+ ```
147
+
148
+ Ignore rest of logical line.
149
+
150
+ <a id="aridity.directives.source"></a>
151
+
152
+ ###### source
153
+
154
+ ```python
155
+ @prime
156
+ def source(prefix, suffix, scope)
157
+ ```
158
+
159
+ Include path or resource at prefix.
160
+
161
+ <a id="aridity.directives.equals"></a>
162
+
163
+ ###### equals
164
+
165
+ ```python
166
+ @prime
167
+ def equals(prefix, suffix, scope)
168
+ ```
169
+
170
+ Assign expression to path.
171
+
172
+ <a id="aridity.directives.colonequals"></a>
173
+
174
+ ###### colonequals
175
+
176
+ ```python
177
+ @prime
178
+ def colonequals(prefix, suffix, scope)
179
+ ```
180
+
181
+ Evaluate expression and assign result to path.
182
+
183
+ <a id="aridity.directives.plusequals"></a>
184
+
185
+ ###### plusequals
186
+
187
+ ```python
188
+ @prime
189
+ def plusequals(prefix, suffix, scope)
190
+ ```
191
+
192
+ Assign expression to prefix plus an opaque key, i.e. add to list.
193
+
194
+ <a id="aridity.functions"></a>
195
+
196
+ ### aridity.functions
197
+
198
+ <a id="aridity.functions.screenstr"></a>
199
+
200
+ ###### screenstr
201
+
202
+ ```python
203
+ def screenstr(scope, resolvable)
204
+ ```
205
+
206
+ GNU Screen string literal.
207
+
208
+ <a id="aridity.functions.scstr"></a>
209
+
210
+ ###### scstr
211
+
212
+ ```python
213
+ def scstr(scope, resolvable)
214
+ ```
215
+
216
+ SuperCollider string literal.
217
+
218
+ <a id="aridity.functions.hclstr"></a>
219
+
220
+ ###### hclstr
221
+
222
+ ```python
223
+ def hclstr(scope, resolvable)
224
+ ```
225
+
226
+ HashiCorp configuration language string literal.
227
+
228
+ <a id="aridity.functions.groovystr"></a>
229
+
230
+ ###### groovystr
231
+
232
+ ```python
233
+ def groovystr(scope, resolvable)
234
+ ```
235
+
236
+ Groovy string literal.
237
+
238
+ <a id="aridity.functions.pystr"></a>
239
+
240
+ ###### pystr
241
+
242
+ ```python
243
+ def pystr(scope, resolvable)
244
+ ```
245
+
246
+ Python literal.
247
+
248
+ <a id="aridity.functions.shstr"></a>
249
+
250
+ ###### shstr
251
+
252
+ ```python
253
+ def shstr(scope, resolvable)
254
+ ```
255
+
256
+ Shell string literal.
257
+
258
+ <a id="aridity.functions.jsonquote"></a>
259
+
260
+ ###### jsonquote
261
+
262
+ ```python
263
+ def jsonquote(scope, resolvable)
264
+ ```
265
+
266
+ JSON literal, also suitable for YAML.
267
+
268
+ <a id="aridity.functions.xmlattr"></a>
269
+
270
+ ###### xmlattr
271
+
272
+ ```python
273
+ def xmlattr(scope, resolvable)
274
+ ```
275
+
276
+ XML attribute literal (including quotes).
277
+
278
+ <a id="aridity.functions.xmltext"></a>
279
+
280
+ ###### xmltext
281
+
282
+ ```python
283
+ def xmltext(scope, resolvable)
284
+ ```
285
+
286
+ XML content, suggest assigning this to & with xmlattr assigned to " as is convention.
287
+
288
+ <a id="aridity.functions.tomlquote"></a>
289
+
290
+ ###### tomlquote
291
+
292
+ ```python
293
+ def tomlquote(scope, resolvable)
294
+ ```
295
+
296
+ TOML string literal.
297
+
298
+ <a id="aridity.functions.urlquote"></a>
299
+
300
+ ###### urlquote
301
+
302
+ ```python
303
+ def urlquote(scope, resolvable)
304
+ ```
305
+
306
+ Percent-encode all reserved characters.
307
+
308
+ <a id="aridity.functions.map_"></a>
309
+
310
+ ###### map\_
311
+
312
+ ```python
313
+ def map_(scope, objsresolvable, *args)
314
+ ```
315
+
316
+ If given 1 arg, evaluate it against every scope in `objsresolvable` and return that list.
317
+ If given 2 args, the first is a variable name to which each scope is temporarily assigned.
318
+ If given 3 args, the first two are variable names for scope key and scope respectively.
319
+
320
+ <a id="aridity.functions.join"></a>
321
+
322
+ ###### join
323
+
324
+ ```python
325
+ def join(scope, partsresolvable, sepresolvable=None)
326
+ ```
327
+
328
+ Concatenate the given list, using optional separator. Frequently used with `map`.
329
+
330
+ <a id="aridity.functions.str_"></a>
331
+
332
+ ###### str\_
333
+
334
+ ```python
335
+ def str_(scope, resolvable)
336
+ ```
337
+
338
+ Coerce to string.
339
+
340
+ <a id="aridity.functions.list_"></a>
341
+
342
+ ###### list\_
343
+
344
+ ```python
345
+ def list_(scope, *resolvables)
346
+ ```
347
+
348
+ Create a list.
349
+
350
+ <a id="aridity.functions.try_"></a>
351
+
352
+ ###### try\_
353
+
354
+ ```python
355
+ def try_(scope, *resolvables)
356
+ ```
357
+
358
+ Attempt to evaluate each resolvable, returning the first that succeeds.
359
+
360
+ <a id="aridity.functions.hereslash"></a>
361
+
362
+ ###### hereslash
363
+
364
+ ```python
365
+ def hereslash(scope, *resolvables)
366
+ ```
367
+
368
+ Join the given path components with the directory of the current resource.
369
+
370
+ <a id="aridity.functions.readfile"></a>
371
+
372
+ ###### readfile
373
+
374
+ ```python
375
+ def readfile(scope, resolvable)
376
+ ```
377
+
378
+ Include the content of the given path.
379
+
380
+ <a id="aridity.functions.processtemplate"></a>
381
+
382
+ ###### processtemplate
383
+
384
+ ```python
385
+ def processtemplate(scope, resolvable)
386
+ ```
387
+
388
+ Evaluate the content of the given path as an expression.
389
+
390
+ <a id="aridity.functions.pyref"></a>
391
+
392
+ ###### pyref
393
+
394
+ ```python
395
+ def pyref(scope, moduleresolvable, qualnameresolvable)
396
+ ```
397
+
398
+ Python object in given module with given qualified name. Module may be relative to current resource, in which case assignment with `:=` is normally necessary. Typically used to import functions.
399
+
400
+ <a id="aridity.functions.pyres"></a>
401
+
402
+ ###### pyres
403
+
404
+ ```python
405
+ def pyres(scope, packageresolvable, nameresolvable, encoding=Text('ascii'))
406
+ ```
407
+
408
+ Python resource for inclusion with `.` directive.
409
+
410
+ <a id="aridity.grammar"></a>
411
+
412
+ ### aridity.grammar
413
+
414
+ <a id="aridity.keyring"></a>
415
+
416
+ ### aridity.keyring
417
+
418
+ <a id="aridity.keyring.gpg"></a>
419
+
420
+ ###### gpg
421
+
422
+ ```python
423
+ def gpg(scope, resolvable)
424
+ ```
425
+
426
+ Use gpg to decrypt the given base64-encoded blob.
427
+
428
+ <a id="aridity.model"></a>
429
+
430
+ ### aridity.model
431
+
432
+ <a id="aridity.model.Resolvable"></a>
433
+
434
+ #### Resolvable Objects
435
+
436
+ ```python
437
+ class Resolvable(Struct)
438
+ ```
439
+
440
+ <a id="aridity.model.Resolvable.resolve"></a>
441
+
442
+ ###### resolve
443
+
444
+ ```python
445
+ def resolve(scope)
446
+ ```
447
+
448
+ Evaluate this expression against the given scope.
449
+
450
+ <a id="aridity.model.wrap"></a>
451
+
452
+ ###### wrap
453
+
454
+ ```python
455
+ def wrap(value)
456
+ ```
457
+
458
+ Attempt to wrap the given value in a model object of the most specific type.
459
+
460
+ <a id="aridity.scope"></a>
461
+
462
+ ### aridity.scope
463
+
464
+ <a id="aridity.scope.AbstractScope"></a>
465
+
466
+ #### AbstractScope Objects
467
+
468
+ ```python
469
+ class AbstractScope(Resolvable)
470
+ ```
471
+
472
+ <a id="aridity.scope.AbstractScope.resolved"></a>
473
+
474
+ ###### resolved
475
+
476
+ ```python
477
+ def resolved(*path, **kwargs)
478
+ ```
479
+
480
+ Follow the given path to get an expression, evaluate it (resolving any paths it requires, recursively), and return the resulting model object.
481
+
482
+ <a id="aridity.scope.Slash"></a>
483
+
484
+ #### Slash Objects
485
+
486
+ ```python
487
+ class Slash(Text, Function)
488
+ ```
489
+
490
+ As text, the platform slash. As function, join args using that slash, starting with the last absolute path (or using all args if all relative).
491
+
492
+ <a id="aridity.util"></a>
493
+
494
+ ### aridity.util
495
+
496
+ <a id="aridity.util.openresource"></a>
497
+
498
+ ###### openresource
499
+
500
+ ```python
501
+ def openresource(package_or_name, resource_name, encoding='ascii')
502
+ ```
503
+
504
+ Like `pkg_resources.resource_stream` but text mode.
505
+
506
+ <a id="aridity.util.solo"></a>
507
+
508
+ ###### solo
509
+
510
+ ```python
511
+ def solo(v)
512
+ ```
513
+
514
+ Assert exactly one object in the given sequence and return it.
515
+
516
+ <a id="parabject"></a>
517
+
518
+ ### parabject
519
+
520
+ <a id="parabject.register"></a>
521
+
522
+ ###### register
523
+
524
+ ```python
525
+ def register(obj, paracls)
526
+ ```
527
+
528
+ Instantiate paracls, set `obj` to be the regular object associated with the new parabject, and return the parabject.
529
+
530
+ <a id="parabject.dereference"></a>
531
+
532
+ ###### dereference
533
+
534
+ ```python
535
+ def dereference(parabject)
536
+ ```
537
+
538
+ Get the regular object associated with `parabject` or raise UnknownParabjectException.
539
+
540
+ <a id="parabject.Parabject"></a>
541
+
542
+ #### Parabject Objects
543
+
544
+ ```python
545
+ class Parabject()
546
+ ```
547
+
548
+ Subclasses typically implement `__getattr__` for dynamic behaviour on attribute access.
549
+
550
+ <a id="parabject.Parabject.__neg__"></a>
551
+
552
+ ###### \_\_neg\_\_
553
+
554
+ ```python
555
+ def __neg__()
556
+ ```
557
+
558
+ Dereference this parabject.
559
+