sferriol-python 0.9.1__tar.gz → 0.9.3__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.
Files changed (36) hide show
  1. sferriol_python-0.9.3/PKG-INFO +539 -0
  2. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/pyproject.toml +2 -2
  3. sferriol_python-0.9.3/setup.cfg +4 -0
  4. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol/python/__init__.py +12 -0
  5. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol/python/object.py +24 -0
  6. sferriol_python-0.9.3/sferriol/python/test/__init__.py +0 -0
  7. sferriol_python-0.9.3/sferriol/python/test/test__asyncio.py +44 -0
  8. sferriol_python-0.9.3/sferriol/python/test/test__dictionary.py +42 -0
  9. sferriol_python-0.9.3/sferriol/python/test/test__env.py +35 -0
  10. sferriol_python-0.9.3/sferriol/python/test/test__json.py +28 -0
  11. sferriol_python-0.9.3/sferriol/python/test/test__module.py +23 -0
  12. sferriol_python-0.9.3/sferriol/python/test/test__net.py +38 -0
  13. sferriol_python-0.9.3/sferriol/python/test/test__object.py +86 -0
  14. sferriol_python-0.9.3/sferriol/python/test/test__os.py +19 -0
  15. sferriol_python-0.9.3/sferriol/python/test/test__pkg.py +32 -0
  16. sferriol_python-0.9.3/sferriol/python/test/test__python.py +58 -0
  17. sferriol_python-0.9.3/sferriol_python.egg-info/PKG-INFO +539 -0
  18. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol_python.egg-info/SOURCES.txt +11 -2
  19. sferriol_python-0.9.1/PKG-INFO +0 -26
  20. sferriol_python-0.9.1/setup.cfg +0 -29
  21. sferriol_python-0.9.1/setup.py +0 -11
  22. sferriol_python-0.9.1/sferriol_python.egg-info/PKG-INFO +0 -26
  23. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/Licence_CeCILL-B_V1-en.txt +0 -0
  24. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/README.md +0 -0
  25. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol/python/asyncio.py +0 -0
  26. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol/python/dictionary/__init__.py +0 -0
  27. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol/python/env.py +0 -0
  28. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol/python/json.py +0 -0
  29. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol/python/net.py +0 -0
  30. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol/python/os_.py +0 -0
  31. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol/python/pkg.py +0 -0
  32. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol/python/test/pkg/__init__.py +0 -0
  33. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol/python/test/pkg/toto.py +0 -0
  34. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol/python/test/pkg/tutu.py +0 -0
  35. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol_python.egg-info/dependency_links.txt +0 -0
  36. {sferriol_python-0.9.1 → sferriol_python-0.9.3}/sferriol_python.egg-info/top_level.txt +0 -0
@@ -0,0 +1,539 @@
1
+ Metadata-Version: 2.4
2
+ Name: sferriol-python
3
+ Version: 0.9.3
4
+ Summary: Python utilities
5
+ Author-email: Sylvain Ferriol <sylvain.ferriol@cnrs.fr>
6
+ License:
7
+ CeCILL-B FREE SOFTWARE LICENSE AGREEMENT
8
+
9
+
10
+ Notice
11
+
12
+ This Agreement is a Free Software license agreement that is the result
13
+ of discussions between its authors in order to ensure compliance with
14
+ the two main principles guiding its drafting:
15
+
16
+ * firstly, compliance with the principles governing the distribution
17
+ of Free Software: access to source code, broad rights granted to
18
+ users,
19
+ * secondly, the election of a governing law, French law, with which
20
+ it is conformant, both as regards the law of torts and
21
+ intellectual property law, and the protection that it offers to
22
+ both authors and holders of the economic rights over software.
23
+
24
+ The authors of the CeCILL-B (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre])
25
+ license are:
26
+
27
+ Commissariat à l'Energie Atomique - CEA, a public scientific, technical
28
+ and industrial research establishment, having its principal place of
29
+ business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France.
30
+
31
+ Centre National de la Recherche Scientifique - CNRS, a public scientific
32
+ and technological establishment, having its principal place of business
33
+ at 3 rue Michel-Ange, 75794 Paris cedex 16, France.
34
+
35
+ Institut National de Recherche en Informatique et en Automatique -
36
+ INRIA, a public scientific and technological establishment, having its
37
+ principal place of business at Domaine de Voluceau, Rocquencourt, BP
38
+ 105, 78153 Le Chesnay cedex, France.
39
+
40
+
41
+ Preamble
42
+
43
+ This Agreement is an open source software license intended to give users
44
+ significant freedom to modify and redistribute the software licensed
45
+ hereunder.
46
+
47
+ The exercising of this freedom is conditional upon a strong obligation
48
+ of giving credits for everybody that distributes a software
49
+ incorporating a software ruled by the current license so as all
50
+ contributions to be properly identified and acknowledged.
51
+
52
+ In consideration of access to the source code and the rights to copy,
53
+ modify and redistribute granted by the license, users are provided only
54
+ with a limited warranty and the software's author, the holder of the
55
+ economic rights, and the successive licensors only have limited liability.
56
+
57
+ In this respect, the risks associated with loading, using, modifying
58
+ and/or developing or reproducing the software by the user are brought to
59
+ the user's attention, given its Free Software status, which may make it
60
+ complicated to use, with the result that its use is reserved for
61
+ developers and experienced professionals having in-depth computer
62
+ knowledge. Users are therefore encouraged to load and test the
63
+ suitability of the software as regards their requirements in conditions
64
+ enabling the security of their systems and/or data to be ensured and,
65
+ more generally, to use and operate it in the same conditions of
66
+ security. This Agreement may be freely reproduced and published,
67
+ provided it is not altered, and that no provisions are either added or
68
+ removed herefrom.
69
+
70
+ This Agreement may apply to any or all software for which the holder of
71
+ the economic rights decides to submit the use thereof to its provisions.
72
+
73
+
74
+ Article 1 - DEFINITIONS
75
+
76
+ For the purpose of this Agreement, when the following expressions
77
+ commence with a capital letter, they shall have the following meaning:
78
+
79
+ Agreement: means this license agreement, and its possible subsequent
80
+ versions and annexes.
81
+
82
+ Software: means the software in its Object Code and/or Source Code form
83
+ and, where applicable, its documentation, "as is" when the Licensee
84
+ accepts the Agreement.
85
+
86
+ Initial Software: means the Software in its Source Code and possibly its
87
+ Object Code form and, where applicable, its documentation, "as is" when
88
+ it is first distributed under the terms and conditions of the Agreement.
89
+
90
+ Modified Software: means the Software modified by at least one
91
+ Contribution.
92
+
93
+ Source Code: means all the Software's instructions and program lines to
94
+ which access is required so as to modify the Software.
95
+
96
+ Object Code: means the binary files originating from the compilation of
97
+ the Source Code.
98
+
99
+ Holder: means the holder(s) of the economic rights over the Initial
100
+ Software.
101
+
102
+ Licensee: means the Software user(s) having accepted the Agreement.
103
+
104
+ Contributor: means a Licensee having made at least one Contribution.
105
+
106
+ Licensor: means the Holder, or any other individual or legal entity, who
107
+ distributes the Software under the Agreement.
108
+
109
+ Contribution: means any or all modifications, corrections, translations,
110
+ adaptations and/or new functions integrated into the Software by any or
111
+ all Contributors, as well as any or all Internal Modules.
112
+
113
+ Module: means a set of sources files including their documentation that
114
+ enables supplementary functions or services in addition to those offered
115
+ by the Software.
116
+
117
+ External Module: means any or all Modules, not derived from the
118
+ Software, so that this Module and the Software run in separate address
119
+ spaces, with one calling the other when they are run.
120
+
121
+ Internal Module: means any or all Module, connected to the Software so
122
+ that they both execute in the same address space.
123
+
124
+ Parties: mean both the Licensee and the Licensor.
125
+
126
+ These expressions may be used both in singular and plural form.
127
+
128
+
129
+ Article 2 - PURPOSE
130
+
131
+ The purpose of the Agreement is the grant by the Licensor to the
132
+ Licensee of a non-exclusive, transferable and worldwide license for the
133
+ Software as set forth in Article 5 hereinafter for the whole term of the
134
+ protection granted by the rights over said Software.
135
+
136
+
137
+ Article 3 - ACCEPTANCE
138
+
139
+ 3.1 The Licensee shall be deemed as having accepted the terms and
140
+ conditions of this Agreement upon the occurrence of the first of the
141
+ following events:
142
+
143
+ * (i) loading the Software by any or all means, notably, by
144
+ downloading from a remote server, or by loading from a physical
145
+ medium;
146
+ * (ii) the first time the Licensee exercises any of the rights
147
+ granted hereunder.
148
+
149
+ 3.2 One copy of the Agreement, containing a notice relating to the
150
+ characteristics of the Software, to the limited warranty, and to the
151
+ fact that its use is restricted to experienced users has been provided
152
+ to the Licensee prior to its acceptance as set forth in Article 3.1
153
+ hereinabove, and the Licensee hereby acknowledges that it has read and
154
+ understood it.
155
+
156
+
157
+ Article 4 - EFFECTIVE DATE AND TERM
158
+
159
+
160
+ 4.1 EFFECTIVE DATE
161
+
162
+ The Agreement shall become effective on the date when it is accepted by
163
+ the Licensee as set forth in Article 3.1.
164
+
165
+
166
+ 4.2 TERM
167
+
168
+ The Agreement shall remain in force for the entire legal term of
169
+ protection of the economic rights over the Software.
170
+
171
+
172
+ Article 5 - SCOPE OF RIGHTS GRANTED
173
+
174
+ The Licensor hereby grants to the Licensee, who accepts, the following
175
+ rights over the Software for any or all use, and for the term of the
176
+ Agreement, on the basis of the terms and conditions set forth hereinafter.
177
+
178
+ Besides, if the Licensor owns or comes to own one or more patents
179
+ protecting all or part of the functions of the Software or of its
180
+ components, the Licensor undertakes not to enforce the rights granted by
181
+ these patents against successive Licensees using, exploiting or
182
+ modifying the Software. If these patents are transferred, the Licensor
183
+ undertakes to have the transferees subscribe to the obligations set
184
+ forth in this paragraph.
185
+
186
+
187
+ 5.1 RIGHT OF USE
188
+
189
+ The Licensee is authorized to use the Software, without any limitation
190
+ as to its fields of application, with it being hereinafter specified
191
+ that this comprises:
192
+
193
+ 1. permanent or temporary reproduction of all or part of the Software
194
+ by any or all means and in any or all form.
195
+
196
+ 2. loading, displaying, running, or storing the Software on any or
197
+ all medium.
198
+
199
+ 3. entitlement to observe, study or test its operation so as to
200
+ determine the ideas and principles behind any or all constituent
201
+ elements of said Software. This shall apply when the Licensee
202
+ carries out any or all loading, displaying, running, transmission
203
+ or storage operation as regards the Software, that it is entitled
204
+ to carry out hereunder.
205
+
206
+
207
+ 5.2 ENTITLEMENT TO MAKE CONTRIBUTIONS
208
+
209
+ The right to make Contributions includes the right to translate, adapt,
210
+ arrange, or make any or all modifications to the Software, and the right
211
+ to reproduce the resulting software.
212
+
213
+ The Licensee is authorized to make any or all Contributions to the
214
+ Software provided that it includes an explicit notice that it is the
215
+ author of said Contribution and indicates the date of the creation thereof.
216
+
217
+
218
+ 5.3 RIGHT OF DISTRIBUTION
219
+
220
+ In particular, the right of distribution includes the right to publish,
221
+ transmit and communicate the Software to the general public on any or
222
+ all medium, and by any or all means, and the right to market, either in
223
+ consideration of a fee, or free of charge, one or more copies of the
224
+ Software by any means.
225
+
226
+ The Licensee is further authorized to distribute copies of the modified
227
+ or unmodified Software to third parties according to the terms and
228
+ conditions set forth hereinafter.
229
+
230
+
231
+ 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION
232
+
233
+ The Licensee is authorized to distribute true copies of the Software in
234
+ Source Code or Object Code form, provided that said distribution
235
+ complies with all the provisions of the Agreement and is accompanied by:
236
+
237
+ 1. a copy of the Agreement,
238
+
239
+ 2. a notice relating to the limitation of both the Licensor's
240
+ warranty and liability as set forth in Articles 8 and 9,
241
+
242
+ and that, in the event that only the Object Code of the Software is
243
+ redistributed, the Licensee allows effective access to the full Source
244
+ Code of the Software at a minimum during the entire period of its
245
+ distribution of the Software, it being understood that the additional
246
+ cost of acquiring the Source Code shall not exceed the cost of
247
+ transferring the data.
248
+
249
+
250
+ 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE
251
+
252
+ If the Licensee makes any Contribution to the Software, the resulting
253
+ Modified Software may be distributed under a license agreement other
254
+ than this Agreement subject to compliance with the provisions of Article
255
+ 5.3.4.
256
+
257
+
258
+ 5.3.3 DISTRIBUTION OF EXTERNAL MODULES
259
+
260
+ When the Licensee has developed an External Module, the terms and
261
+ conditions of this Agreement do not apply to said External Module, that
262
+ may be distributed under a separate license agreement.
263
+
264
+
265
+ 5.3.4 CREDITS
266
+
267
+ Any Licensee who may distribute a Modified Software hereby expressly
268
+ agrees to:
269
+
270
+ 1. indicate in the related documentation that it is based on the
271
+ Software licensed hereunder, and reproduce the intellectual
272
+ property notice for the Software,
273
+
274
+ 2. ensure that written indications of the Software intended use,
275
+ intellectual property notice and license hereunder are included in
276
+ easily accessible format from the Modified Software interface,
277
+
278
+ 3. mention, on a freely accessible website describing the Modified
279
+ Software, at least throughout the distribution term thereof, that
280
+ it is based on the Software licensed hereunder, and reproduce the
281
+ Software intellectual property notice,
282
+
283
+ 4. where it is distributed to a third party that may distribute a
284
+ Modified Software without having to make its source code
285
+ available, make its best efforts to ensure that said third party
286
+ agrees to comply with the obligations set forth in this Article .
287
+
288
+ If the Software, whether or not modified, is distributed with an
289
+ External Module designed for use in connection with the Software, the
290
+ Licensee shall submit said External Module to the foregoing obligations.
291
+
292
+
293
+ 5.3.5 COMPATIBILITY WITH THE CeCILL AND CeCILL-C LICENSES
294
+
295
+ Where a Modified Software contains a Contribution subject to the CeCILL
296
+ license, the provisions set forth in Article 5.3.4 shall be optional.
297
+
298
+ A Modified Software may be distributed under the CeCILL-C license. In
299
+ such a case the provisions set forth in Article 5.3.4 shall be optional.
300
+
301
+
302
+ Article 6 - INTELLECTUAL PROPERTY
303
+
304
+
305
+ 6.1 OVER THE INITIAL SOFTWARE
306
+
307
+ The Holder owns the economic rights over the Initial Software. Any or
308
+ all use of the Initial Software is subject to compliance with the terms
309
+ and conditions under which the Holder has elected to distribute its work
310
+ and no one shall be entitled to modify the terms and conditions for the
311
+ distribution of said Initial Software.
312
+
313
+ The Holder undertakes that the Initial Software will remain ruled at
314
+ least by this Agreement, for the duration set forth in Article 4.2.
315
+
316
+
317
+ 6.2 OVER THE CONTRIBUTIONS
318
+
319
+ The Licensee who develops a Contribution is the owner of the
320
+ intellectual property rights over this Contribution as defined by
321
+ applicable law.
322
+
323
+
324
+ 6.3 OVER THE EXTERNAL MODULES
325
+
326
+ The Licensee who develops an External Module is the owner of the
327
+ intellectual property rights over this External Module as defined by
328
+ applicable law and is free to choose the type of agreement that shall
329
+ govern its distribution.
330
+
331
+
332
+ 6.4 JOINT PROVISIONS
333
+
334
+ The Licensee expressly undertakes:
335
+
336
+ 1. not to remove, or modify, in any manner, the intellectual property
337
+ notices attached to the Software;
338
+
339
+ 2. to reproduce said notices, in an identical manner, in the copies
340
+ of the Software modified or not.
341
+
342
+ The Licensee undertakes not to directly or indirectly infringe the
343
+ intellectual property rights of the Holder and/or Contributors on the
344
+ Software and to take, where applicable, vis-à-vis its staff, any and all
345
+ measures required to ensure respect of said intellectual property rights
346
+ of the Holder and/or Contributors.
347
+
348
+
349
+ Article 7 - RELATED SERVICES
350
+
351
+ 7.1 Under no circumstances shall the Agreement oblige the Licensor to
352
+ provide technical assistance or maintenance services for the Software.
353
+
354
+ However, the Licensor is entitled to offer this type of services. The
355
+ terms and conditions of such technical assistance, and/or such
356
+ maintenance, shall be set forth in a separate instrument. Only the
357
+ Licensor offering said maintenance and/or technical assistance services
358
+ shall incur liability therefor.
359
+
360
+ 7.2 Similarly, any Licensor is entitled to offer to its licensees, under
361
+ its sole responsibility, a warranty, that shall only be binding upon
362
+ itself, for the redistribution of the Software and/or the Modified
363
+ Software, under terms and conditions that it is free to decide. Said
364
+ warranty, and the financial terms and conditions of its application,
365
+ shall be subject of a separate instrument executed between the Licensor
366
+ and the Licensee.
367
+
368
+
369
+ Article 8 - LIABILITY
370
+
371
+ 8.1 Subject to the provisions of Article 8.2, the Licensee shall be
372
+ entitled to claim compensation for any direct loss it may have suffered
373
+ from the Software as a result of a fault on the part of the relevant
374
+ Licensor, subject to providing evidence thereof.
375
+
376
+ 8.2 The Licensor's liability is limited to the commitments made under
377
+ this Agreement and shall not be incurred as a result of in particular:
378
+ (i) loss due the Licensee's total or partial failure to fulfill its
379
+ obligations, (ii) direct or consequential loss that is suffered by the
380
+ Licensee due to the use or performance of the Software, and (iii) more
381
+ generally, any consequential loss. In particular the Parties expressly
382
+ agree that any or all pecuniary or business loss (i.e. loss of data,
383
+ loss of profits, operating loss, loss of customers or orders,
384
+ opportunity cost, any disturbance to business activities) or any or all
385
+ legal proceedings instituted against the Licensee by a third party,
386
+ shall constitute consequential loss and shall not provide entitlement to
387
+ any or all compensation from the Licensor.
388
+
389
+
390
+ Article 9 - WARRANTY
391
+
392
+ 9.1 The Licensee acknowledges that the scientific and technical
393
+ state-of-the-art when the Software was distributed did not enable all
394
+ possible uses to be tested and verified, nor for the presence of
395
+ possible defects to be detected. In this respect, the Licensee's
396
+ attention has been drawn to the risks associated with loading, using,
397
+ modifying and/or developing and reproducing the Software which are
398
+ reserved for experienced users.
399
+
400
+ The Licensee shall be responsible for verifying, by any or all means,
401
+ the suitability of the product for its requirements, its good working
402
+ order, and for ensuring that it shall not cause damage to either persons
403
+ or properties.
404
+
405
+ 9.2 The Licensor hereby represents, in good faith, that it is entitled
406
+ to grant all the rights over the Software (including in particular the
407
+ rights set forth in Article 5).
408
+
409
+ 9.3 The Licensee acknowledges that the Software is supplied "as is" by
410
+ the Licensor without any other express or tacit warranty, other than
411
+ that provided for in Article 9.2 and, in particular, without any warranty
412
+ as to its commercial value, its secured, safe, innovative or relevant
413
+ nature.
414
+
415
+ Specifically, the Licensor does not warrant that the Software is free
416
+ from any error, that it will operate without interruption, that it will
417
+ be compatible with the Licensee's own equipment and software
418
+ configuration, nor that it will meet the Licensee's requirements.
419
+
420
+ 9.4 The Licensor does not either expressly or tacitly warrant that the
421
+ Software does not infringe any third party intellectual property right
422
+ relating to a patent, software or any other property right. Therefore,
423
+ the Licensor disclaims any and all liability towards the Licensee
424
+ arising out of any or all proceedings for infringement that may be
425
+ instituted in respect of the use, modification and redistribution of the
426
+ Software. Nevertheless, should such proceedings be instituted against
427
+ the Licensee, the Licensor shall provide it with technical and legal
428
+ assistance for its defense. Such technical and legal assistance shall be
429
+ decided on a case-by-case basis between the relevant Licensor and the
430
+ Licensee pursuant to a memorandum of understanding. The Licensor
431
+ disclaims any and all liability as regards the Licensee's use of the
432
+ name of the Software. No warranty is given as regards the existence of
433
+ prior rights over the name of the Software or as regards the existence
434
+ of a trademark.
435
+
436
+
437
+ Article 10 - TERMINATION
438
+
439
+ 10.1 In the event of a breach by the Licensee of its obligations
440
+ hereunder, the Licensor may automatically terminate this Agreement
441
+ thirty (30) days after notice has been sent to the Licensee and has
442
+ remained ineffective.
443
+
444
+ 10.2 A Licensee whose Agreement is terminated shall no longer be
445
+ authorized to use, modify or distribute the Software. However, any
446
+ licenses that it may have granted prior to termination of the Agreement
447
+ shall remain valid subject to their having been granted in compliance
448
+ with the terms and conditions hereof.
449
+
450
+
451
+ Article 11 - MISCELLANEOUS
452
+
453
+
454
+ 11.1 EXCUSABLE EVENTS
455
+
456
+ Neither Party shall be liable for any or all delay, or failure to
457
+ perform the Agreement, that may be attributable to an event of force
458
+ majeure, an act of God or an outside cause, such as defective
459
+ functioning or interruptions of the electricity or telecommunications
460
+ networks, network paralysis following a virus attack, intervention by
461
+ government authorities, natural disasters, water damage, earthquakes,
462
+ fire, explosions, strikes and labor unrest, war, etc.
463
+
464
+ 11.2 Any failure by either Party, on one or more occasions, to invoke
465
+ one or more of the provisions hereof, shall under no circumstances be
466
+ interpreted as being a waiver by the interested Party of its right to
467
+ invoke said provision(s) subsequently.
468
+
469
+ 11.3 The Agreement cancels and replaces any or all previous agreements,
470
+ whether written or oral, between the Parties and having the same
471
+ purpose, and constitutes the entirety of the agreement between said
472
+ Parties concerning said purpose. No supplement or modification to the
473
+ terms and conditions hereof shall be effective as between the Parties
474
+ unless it is made in writing and signed by their duly authorized
475
+ representatives.
476
+
477
+ 11.4 In the event that one or more of the provisions hereof were to
478
+ conflict with a current or future applicable act or legislative text,
479
+ said act or legislative text shall prevail, and the Parties shall make
480
+ the necessary amendments so as to comply with said act or legislative
481
+ text. All other provisions shall remain effective. Similarly, invalidity
482
+ of a provision of the Agreement, for any reason whatsoever, shall not
483
+ cause the Agreement as a whole to be invalid.
484
+
485
+
486
+ 11.5 LANGUAGE
487
+
488
+ The Agreement is drafted in both French and English and both versions
489
+ are deemed authentic.
490
+
491
+
492
+ Article 12 - NEW VERSIONS OF THE AGREEMENT
493
+
494
+ 12.1 Any person is authorized to duplicate and distribute copies of this
495
+ Agreement.
496
+
497
+ 12.2 So as to ensure coherence, the wording of this Agreement is
498
+ protected and may only be modified by the authors of the License, who
499
+ reserve the right to periodically publish updates or new versions of the
500
+ Agreement, each with a separate number. These subsequent versions may
501
+ address new issues encountered by Free Software.
502
+
503
+ 12.3 Any Software distributed under a given version of the Agreement may
504
+ only be subsequently distributed under the same version of the Agreement
505
+ or a subsequent version.
506
+
507
+
508
+ Article 13 - GOVERNING LAW AND JURISDICTION
509
+
510
+ 13.1 The Agreement is governed by French law. The Parties agree to
511
+ endeavor to seek an amicable solution to any disagreements or disputes
512
+ that may arise during the performance of the Agreement.
513
+
514
+ 13.2 Failing an amicable solution within two (2) months as from their
515
+ occurrence, and unless emergency proceedings are necessary, the
516
+ disagreements or disputes shall be referred to the Paris Courts having
517
+ jurisdiction, by the more diligent Party.
518
+
519
+
520
+ Version 1.0 dated 2006-09-05.
521
+
522
+ Classifier: Operating System :: OS Independent
523
+ Classifier: Programming Language :: Python :: 3
524
+ Requires-Python: >=3.11.0
525
+ Description-Content-Type: text/markdown
526
+
527
+ # sferriol-python
528
+
529
+ sferriol-python is a set of useful python libraries.
530
+
531
+ Clone the project
532
+
533
+ git clone git@gitlab.in2p3.fr:sferriol-ip2i/sferriol-python.git
534
+
535
+ Install it in your environment
536
+
537
+ python -m pip install .
538
+
539
+
@@ -6,10 +6,10 @@ build-backend = "setuptools.build_meta"
6
6
  authors = [
7
7
  {name = "Sylvain Ferriol", email = "sylvain.ferriol@cnrs.fr"},
8
8
  ]
9
+ classifiers = ['Operating System :: OS Independent', 'Programming Language :: Python :: 3']
9
10
  description = "Python utilities"
10
11
  dynamic = ["version"]
11
- license = "CECILL-B"
12
- license-files = ["Licence_CeCILL-B_V1-en.txt"]
12
+ license = { file = "Licence_CeCILL-B_V1-en.txt" }
13
13
  name = "sferriol-python"
14
14
  readme = "README.md"
15
15
  requires-python = ">=3.11.0"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -39,6 +39,18 @@ def loop_until(fct: Callable, ret: Any, every: float, timeout: float | int):
39
39
  raise TimeoutError()
40
40
 
41
41
 
42
+ def make_hashable(obj):
43
+ """Make hashable a non-hashable object"""
44
+ if isinstance(obj, dict):
45
+ return tuple((k, make_hashable(v)) for k, v in sorted(obj.items()))
46
+ elif isinstance(obj, (list, tuple)):
47
+ return tuple(make_hashable(x) for x in obj)
48
+ elif isinstance(obj, set):
49
+ return tuple(sorted(make_hashable(x) for x in obj))
50
+ else:
51
+ return obj # assume already hashable
52
+
53
+
42
54
  def method(obj):
43
55
  """
44
56
  Decorator used to define a function as a new method of the object obj.
@@ -1,5 +1,9 @@
1
1
  # -*- coding: utf-8 -*-
2
+ import threading
2
3
  import types
4
+ import weakref
5
+
6
+ from sferriol.python import make_hashable
3
7
 
4
8
 
5
9
  class Attribute:
@@ -23,6 +27,26 @@ def attribute(ns):
23
27
  return Attribute(ns)
24
28
 
25
29
 
30
+ def singleton(cls):
31
+ '''Singleton pattern class decorator'''
32
+ instances = weakref.WeakValueDictionary()
33
+
34
+ def unique_instance(*args, **kwargs):
35
+ lock = threading.Lock()
36
+ # key hashable
37
+ key = hash((cls, make_hashable(args), make_hashable(kwargs)))
38
+ # Avoid race conditions
39
+ with lock:
40
+ if key not in instances.keys():
41
+ obj = cls(*args, **kwargs)
42
+ instances[key] = obj
43
+ else:
44
+ obj = instances[key]
45
+ return obj
46
+
47
+ return unique_instance
48
+
49
+
26
50
  class Object:
27
51
 
28
52
  def __init__(self):
File without changes
@@ -0,0 +1,44 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright 2024 sferriol <s.ferriol@ip2i.in2p3.fr>
4
+ import asyncio
5
+ import multiprocessing
6
+ import os
7
+ import signal
8
+ import tempfile
9
+ import time
10
+ import unittest
11
+
12
+ from sferriol.python.asyncio import *
13
+
14
+
15
+ class Test__Run_In_Shell(unittest.IsolatedAsyncioTestCase):
16
+
17
+ async def test__stdout(self):
18
+ ret, stdout, stderr = await run_shell_cmd("echo toto")
19
+ self.assertEqual(ret, 0)
20
+ self.assertEqual(stdout, "toto")
21
+ self.assertEqual(stderr, "")
22
+
23
+ async def test__stderr(self):
24
+ ret, stdout, stderr = await run_shell_cmd("man toto")
25
+ self.assertNotEqual(ret, 0)
26
+ self.assertEqual(stdout, "")
27
+ self.assertNotEqual(stderr, "")
28
+
29
+
30
+ def _worker():
31
+ import asyncio
32
+ asyncio.run(wait_sigint_signal())
33
+
34
+
35
+ class Test__Wait_Sigint_Signal(unittest.IsolatedAsyncioTestCase):
36
+
37
+ async def test(self):
38
+ p = multiprocessing.Process(target=_worker)
39
+ p.start()
40
+ await asyncio.sleep(1)
41
+ os.kill(p.pid, signal.SIGINT)
42
+ await asyncio.to_thread(p.join, 1)
43
+ self.assertFalse(p.is_alive())
44
+ self.assertEqual(p.exitcode, 0)