Skip to content

Commit d993386

Browse files
committed
Release 1.0.0
1 parent 318d6d3 commit d993386

File tree

9 files changed

+687
-216
lines changed

9 files changed

+687
-216
lines changed

docs/_static/basic.css

Lines changed: 24 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
/*
2-
* basic.css
3-
* ~~~~~~~~~
4-
*
5-
* Sphinx stylesheet -- basic theme.
6-
*
7-
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
8-
* :license: BSD, see LICENSE for details.
9-
*
10-
*/
11-
121
/* -- main layout ----------------------------------------------------------- */
132

143
div.clearer {
@@ -342,195 +331,6 @@ div.body p.centered {
342331
margin-top: 25px;
343332
}
344333

345-
/* -- tables ---------------------------------------------------------------- */
346-
347-
table.docutils {
348-
border: 0;
349-
border-collapse: collapse;
350-
}
351-
352-
table.align-center {
353-
margin-left: auto;
354-
margin-right: auto;
355-
}
356-
357-
table caption span.caption-number {
358-
font-style: italic;
359-
}
360-
361-
table caption span.caption-text {
362-
}
363-
364-
table.docutils td, table.docutils th {
365-
padding: 1px 8px 1px 5px;
366-
border-top: 0;
367-
border-left: 0;
368-
border-right: 0;
369-
border-bottom: 1px solid #aaa;
370-
}
371-
372-
table.footnote td, table.footnote th {
373-
border: 0 !important;
374-
}
375-
376-
th {
377-
text-align: left;
378-
padding-right: 5px;
379-
}
380-
381-
table.citation {
382-
border-left: solid 1px gray;
383-
margin-left: 1px;
384-
}
385-
386-
table.citation td {
387-
border-bottom: none;
388-
}
389-
390-
/* -- figures --------------------------------------------------------------- */
391-
392-
div.figure {
393-
margin: 0.5em;
394-
padding: 0.5em;
395-
}
396-
397-
div.figure p.caption {
398-
padding: 0.3em;
399-
}
400-
401-
div.figure p.caption span.caption-number {
402-
font-style: italic;
403-
}
404-
405-
div.figure p.caption span.caption-text {
406-
}
407-
408-
/* -- field list styles ----------------------------------------------------- */
409-
410-
table.field-list td, table.field-list th {
411-
border: 0 !important;
412-
}
413-
414-
.field-list ul {
415-
margin: 0;
416-
padding-left: 1em;
417-
}
418-
419-
.field-list p {
420-
margin: 0;
421-
}
422-
423-
.field-name {
424-
-moz-hyphens: manual;
425-
-ms-hyphens: manual;
426-
-webkit-hyphens: manual;
427-
hyphens: manual;
428-
}
429-
430-
/* -- other body styles ----------------------------------------------------- */
431-
432-
ol.arabic {
433-
list-style: decimal;
434-
}
435-
436-
ol.loweralpha {
437-
list-style: lower-alpha;
438-
}
439-
440-
ol.upperalpha {
441-
list-style: upper-alpha;
442-
}
443-
444-
ol.lowerroman {
445-
list-style: lower-roman;
446-
}
447-
448-
ol.upperroman {
449-
list-style: upper-roman;
450-
}
451-
452-
dl {
453-
margin-bottom: 15px;
454-
}
455-
456-
dd p {
457-
margin-top: 0px;
458-
}
459-
460-
dd ul, dd table {
461-
margin-bottom: 10px;
462-
}
463-
464-
dd {
465-
margin-top: 3px;
466-
margin-bottom: 10px;
467-
margin-left: 30px;
468-
}
469-
470-
dt:target, span.highlighted {
471-
background-color: #fbe54e;
472-
}
473-
474-
rect.highlighted {
475-
fill: #fbe54e;
476-
}
477-
478-
dl.glossary dt {
479-
font-weight: bold;
480-
font-size: 1.1em;
481-
}
482-
483-
.optional {
484-
font-size: 1.3em;
485-
}
486-
487-
.sig-paren {
488-
font-size: larger;
489-
}
490-
491-
.versionmodified {
492-
font-style: italic;
493-
}
494-
495-
.system-message {
496-
background-color: #fda;
497-
padding: 5px;
498-
border: 3px solid red;
499-
}
500-
501-
.footnote:target {
502-
background-color: #ffa;
503-
}
504-
505-
.line-block {
506-
display: block;
507-
margin-top: 1em;
508-
margin-bottom: 1em;
509-
}
510-
511-
.line-block .line-block {
512-
margin-top: 0;
513-
margin-bottom: 0;
514-
margin-left: 1.5em;
515-
}
516-
517-
.guilabel, .menuselection {
518-
font-family: sans-serif;
519-
}
520-
521-
.accelerator {
522-
text-decoration: underline;
523-
}
524-
525-
.classifier {
526-
font-style: oblique;
527-
}
528-
529-
abbr, acronym {
530-
border-bottom: dotted 1px;
531-
cursor: help;
532-
}
533-
534334
/* -- code displays --------------------------------------------------------- */
535335

536336
pre {
@@ -741,7 +541,7 @@ div.admonition-example {
741541
border: 2px solid #aacc99;
742542
border-left-style: none;
743543
border-right-style: none;
744-
padding: 10px 0px 0px 60px;
544+
padding: 10px 0px 20px 60px;
745545
}
746546
div.warning, div.error {
747547
color: black;
@@ -818,3 +618,26 @@ cite {
818618
padding: 0 5px 0 5px;
819619
font-size: 13px;
820620
}
621+
622+
/* dt/dd on single line */
623+
624+
dl.field-list {
625+
display: grid;
626+
grid-template-columns: max-content auto;
627+
}
628+
629+
dt.field-list {
630+
grid-column-start: 1;
631+
}
632+
633+
dt.field-odd:after {
634+
content: ':';
635+
}
636+
637+
dt.field-even:after {
638+
content: ':';
639+
}
640+
641+
dd.field-list {
642+
grid-column-start: 2;
643+
}

docs/changelog.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
Changelog
33
#########
44

5+
Version 1.0.0
6+
=============
7+
8+
* Documentation: new examples for :doc:`trace`, :doc:`logging` and :doc:`hooks`
9+
* Documentation: adjustments to css
10+
* DataList is now generic class
11+
* `.DataList.extract()` has new 'copy' argument.
12+
513
Version 0.6.1
614
=============
715

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
author = 'Pavel Císař'
2424

2525
# The short X.Y version
26-
version = '0.6.1'
26+
version = '1.0.0'
2727

2828
# The full version, including alpha/beta/rc tags
29-
release = '0.6.1'
29+
release = '1.0.0'
3030

3131

3232
# -- General configuration ---------------------------------------------------

docs/hooks.txt

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,103 @@ The architecture supports multiple usage strategies:
4242
* It's possible to register callback to `.ANY` event from particular source, or particular
4343
event from `.ANY` source, or even to `.ANY` event from `.ANY` source.
4444

45+
Example
46+
=======
47+
48+
.. code-block:: python
49+
50+
from __future__ import annotations
51+
from enum import Enum, auto
52+
from firebird.base.types import *
53+
from firebird.base.hooks import hook_manager
54+
55+
class MyEvents(Enum):
56+
"Sample definition of events"
57+
CREATE = auto()
58+
ACTION = auto()
59+
60+
class MyHookable:
61+
"Example of hookable class, i.e. a class that calls hooks registered for events."
62+
def __init__(self, name: str):
63+
self.name: str = name
64+
for hook in hook_manager.get_callbacks(MyEvents.CREATE, self):
65+
try:
66+
hook(self, MyEvents.CREATE)
67+
except Exception as e:
68+
print(f"{self.name}.CREATE hook call outcome: ERROR ({e.args[0]})")
69+
else:
70+
print(f"{self.name}.CREATE hook call outcome: OK")
71+
def action(self):
72+
print(f"{self.name}.ACTION!")
73+
for hook in hook_manager.get_callbacks(MyEvents.ACTION, self):
74+
try:
75+
hook(self, MyEvents.ACTION)
76+
except Exception as e:
77+
print(f"{self.name}.ACTION hook call outcome: ERROR ({e.args[0]})")
78+
else:
79+
print(f"{self.name}.ACTION hook call outcome: OK")
80+
81+
class MyHook:
82+
"Example of hook implementation"
83+
def __init__(self, name: str):
84+
self.name: str = name
85+
def callback(self, subject: MyHookable, event: MyEvents):
86+
print(f"Hook {self.name} event {event.name} called by {subject.name}")
87+
def err_callback(self, subject: MyHookable, event: MyEvents):
88+
self.callback(subject, event)
89+
raise Exception("Error in hook")
90+
91+
92+
# Example code that installs and uses hooks
93+
94+
hook_manager.register_class(MyHookable, MyEvents)
95+
hook_A: MyHook = MyHook('Hook-A')
96+
hook_B: MyHook = MyHook('Hook-B')
97+
hook_C: MyHook = MyHook('Hook-C')
98+
99+
print("Install hooks")
100+
hook_manager.add_hook(MyEvents.CREATE, MyHookable, hook_A.callback)
101+
hook_manager.add_hook(MyEvents.CREATE, MyHookable, hook_B.err_callback)
102+
hook_manager.add_hook(MyEvents.ACTION, MyHookable, hook_C.callback)
103+
104+
print("Create event sources, emits CREATE")
105+
src_A: MyHookable = MyHookable('Source-A')
106+
src_B: MyHookable = MyHookable('Source-B')
107+
108+
print("Install instance hooks")
109+
hook_manager.add_hook(MyEvents.ACTION, src_A, hook_A.callback)
110+
hook_manager.add_hook(MyEvents.ACTION, src_B, hook_B.callback)
111+
112+
print("And action!")
113+
src_A.action()
114+
src_B.action()
115+
116+
117+
Output from sample code::
118+
119+
Install hooks
120+
Create event sources, emits CREATE
121+
Hook Hook-A event CREATE called by Source-A
122+
Source-A.CREATE hook call outcome: OK
123+
Hook Hook-B event CREATE called by Source-A
124+
Source-A.CREATE hook call outcome: ERROR (Error in hook)
125+
Hook Hook-A event CREATE called by Source-B
126+
Source-B.CREATE hook call outcome: OK
127+
Hook Hook-B event CREATE called by Source-B
128+
Source-B.CREATE hook call outcome: ERROR (Error in hook)
129+
Install instance hooks
130+
And action!
131+
Source-A.ACTION!
132+
Hook Hook-A event ACTION called by Source-A
133+
Source-A.ACTION hook call outcome: OK
134+
Hook Hook-C event ACTION called by Source-A
135+
Source-A.ACTION hook call outcome: OK
136+
Source-B.ACTION!
137+
Hook Hook-B event ACTION called by Source-B
138+
Source-B.ACTION hook call outcome: OK
139+
Hook Hook-C event ACTION called by Source-B
140+
Source-B.ACTION hook call outcome: OK
141+
45142

46143
Functions
47144
=========

docs/introduction.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ supports multiple usage strategies.
8585
Context-based logging
8686
=====================
8787

88-
Module '.logging' provides context-based logging system built on top of standard `logging`
88+
Module `.logging` provides context-based logging system built on top of standard `logging`
8989
module.
9090

9191
The context-based logging:
@@ -120,6 +120,6 @@ Registry for Google Protocol Buffer messages and enums
120120
======================================================
121121

122122
Module `.protobuf` provides central registry for Google Protocol Buffer messages and enums.
123-
The generated *_pb2.py protobuf files could be registered using `.register_decriptor` or
123+
The generated `*_pb2.py protobuf` files could be registered using `.register_decriptor` or
124124
`.load_registered` function. The registry could be then used to obtain information about
125125
protobuf messages or enum types, or to create message instances or enum values.

0 commit comments

Comments
 (0)