FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnative/tests/typing/conformance_styles.py at main · pythonnative/pythonnative · GitHub
pythonnative
pythonnative
Repository navigation
Code
Issues
11
(11)
Pull requests
5
(5)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnative
/
tests
/
typing
/
conformance_styles.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (39 loc) · 1.85 KB
Breadcrumbs
pythonnative
/
tests
/
typing
/
conformance_styles.py
Copy path
File metadata and controls
55 lines (39 loc) · 1.85 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""Typing conformance: styles, style sheets, and themes (checked by mypy, never executed)."""
from
__future__
import
annotations
from
dataclasses
import
dataclass
,
replace
import
pythonnative
as
pn
class
Styles
(
pn
.
StyleSheet
):
card
=
pn
.
style
(
padding
=
16
,
border_radius
=
12
)
title
=
pn
.
style
(
font_size
=
17
,
font_weight
=
"600"
)
@
dataclass
(
frozen
=
True
,
kw_only
=
True
)
class
BrandTheme
(
pn
.
Theme
):
accent
:
pn
.
Color
=
"#FF2D55"
LIGHT
=
BrandTheme
(
colors
=
replace
(
pn
.
LIGHT_THEME
.
colors
,
primary
=
"#5B21B6"
))
DARK
=
BrandTheme
(
dark
=
True
,
colors
=
pn
.
DARK_THEME
.
colors
,
accent
=
"#FF6482"
)
class
CardStyles
:
def
__init__
(
self
,
theme
:
pn
.
Theme
)
->
None
:
self
.
card
=
pn
.
style
(
background_color
=
theme
.
colors
.
surface
,
border_radius
=
theme
.
radii
.
md
)
self
.
title
=
theme
.
typography
.
heading
@
pn
.
component
def
Card
(
title
:
str
)
->
pn
.
Node
:
styles
=
pn
.
use_styles
(
CardStyles
)
theme
=
pn
.
use_theme
(
BrandTheme
)
accent
:
pn
.
Color
=
theme
.
accent
base
=
pn
.
use_theme
()
base
.
accent
# type: ignore[attr-defined]
styles
.
missing
# type: ignore[attr-defined]
return
pn
.
View
(
pn
.
Text
(
title
,
style
=
[
Styles
.
title
,
styles
.
title
, {
"color"
:
accent
},
None
]),
style
=
[
Styles
.
card
,
styles
.
card
,
pn
.
ABSOLUTE_FILL
],
)
app
=
pn
.
ThemeProvider
(
Card
(
title
=
"x"
),
light
=
LIGHT
,
dark
=
DARK
)
spacing
:
float
=
pn
.
LIGHT_THEME
.
spacing
.
md
Styles
.
titel
# type: ignore[attr-defined]
pn
.
style
(
colour
=
"red"
)
# type: ignore[call-arg]
pn
.
style
(
opacity
=
"half"
)
# type: ignore[arg-type]
pn
.
style
(
flex_direction
=
"diagonal"
)
# type: ignore[arg-type]
misspelled
:
pn
.
Style
=
{
"colour"
:
"red"
}
# type: ignore[typeddict-unknown-key]
wrong_value
:
pn
.
Style
=
{
"opacity"
:
"half"
}
# type: ignore[typeddict-item]
pn
.
Theme
(
dark
=
True
)
# type: ignore[call-arg]
pn
.
LIGHT_THEME
.
dark
=
True
# type: ignore[misc]
pn
.
ThemeProvider
(
Card
(
title
=
"x"
),
light
=
"light"
)
# type: ignore[arg-type]
Back
|
FazBrowse Home
|
New Git URL