forked from cdgriffith/Box
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.py
More file actions
89 lines (77 loc) · 2.36 KB
/
common.py
File metadata and controls
89 lines (77 loc) · 2.36 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# -*- coding: utf-8 -*-
import os
import sys
from pathlib import Path
PY3 = sys.version_info >= (3, 0)
test_root = os.path.abspath(os.path.dirname(__file__))
tmp_dir = Path(test_root, "tmp")
test_dict = {
"key1": "value1",
"not$allowed": "fine_value",
"BigCamel": "hi",
"alist": [{"a": 1}],
"Key 2": {"Key 3": "Value 3", "Key4": {"Key5": "Value5"}},
}
extended_test_dict = {
3: "howdy",
"not": "true",
(3, 4): "test",
"_box_config": True,
"CamelCase": "21",
"321CamelCase": 321,
False: "tree",
"tuples_galore": ({"item": 3}, ({"item": 4}, 5)),
}
extended_test_dict.update(test_dict) # type: ignore
data_json_file = os.path.join(test_root, "data", "json_file.json")
data_yaml_file = os.path.join(test_root, "data", "yaml_file.yaml")
tmp_json_file = os.path.join(test_root, "tmp", "tmp_json_file.json")
tmp_yaml_file = os.path.join(test_root, "tmp", "tmp_yaml_file.yaml")
tmp_msgpack_file = os.path.join(test_root, "tmp", "tmp_msgpack_file.msgpack")
movie_data = {
"movies": {
"Spaceballs": {
"imdb_stars": 7.1,
"rating": "PG",
"length": 96,
"Director": "Mel Brooks",
"Stars": [
{"name": "Mel Brooks", "imdb": "nm0000316", "role": "President Skroob"},
{"name": "John Candy", "imdb": "nm0001006", "role": "Barf"},
{"name": "Rick Moranis", "imdb": "nm0001548", "role": "Dark Helmet"},
],
},
"Robin Hood: Men in Tights": {
"imdb_stars": 6.7,
"rating": "PG-13",
"length": 104,
"Director": "Mel Brooks",
"Stars": [
{"name": "Cary Elwes", "imdb": "nm0000144", "role": "Robin Hood"},
{"name": "Richard Lewis", "imdb": "nm0507659", "role": "Prince John"},
{"name": "Roger Rees", "imdb": "nm0715953", "role": "Sheriff of Rottingham"},
{"name": "Amy Yasbeck", "imdb": "nm0001865", "role": "Marian"},
],
},
}
}
def function_example(value):
yield value
class ClassExample(object):
def __init__(self):
self.a = "a"
self.b = 2
python_example_objects = (
None, # type: ignore
True,
False,
1,
3.14,
"abc",
[1, 2, 3],
{},
([], {}),
lambda x: x ** 2,
function_example,
ClassExample(),
) # type: ignore