wsba-hockey 1.1.9__py3-none-any.whl → 1.2.1__py3-none-any.whl

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 (144) hide show
  1. wsba_hockey/tools/scraping.py +146 -170
  2. wsba_hockey/tools/utils/__init__.py +0 -1
  3. wsba_hockey/tools/utils/shared.py +14 -389
  4. wsba_hockey/tools/xg_model.py +6 -1
  5. wsba_hockey/wsba_main.py +47 -14
  6. {wsba_hockey-1.1.9.dist-info → wsba_hockey-1.2.1.dist-info}/METADATA +16 -15
  7. wsba_hockey-1.2.1.dist-info/RECORD +15 -0
  8. wsba_hockey/api/api/index.py +0 -162
  9. wsba_hockey/data_pipelines.py +0 -247
  10. wsba_hockey/evidence/weakside-breakout/node_modules/duckdb/vendor.py +0 -146
  11. wsba_hockey/evidence/weakside-breakout/node_modules/flatted/python/flatted.py +0 -149
  12. wsba_hockey/evidence/weakside-breakout/node_modules/flatted/python/test.py +0 -63
  13. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/gyp_main.py +0 -45
  14. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +0 -367
  15. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +0 -206
  16. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +0 -1270
  17. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +0 -1547
  18. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +0 -59
  19. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +0 -153
  20. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +0 -271
  21. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +0 -574
  22. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +0 -690
  23. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/common.py +0 -661
  24. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +0 -78
  25. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +0 -165
  26. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +0 -109
  27. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +0 -55
  28. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  29. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +0 -808
  30. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +0 -1173
  31. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +0 -1321
  32. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +0 -120
  33. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -103
  34. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +0 -464
  35. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +0 -89
  36. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +0 -58
  37. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +0 -2714
  38. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +0 -3981
  39. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +0 -44
  40. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +0 -2936
  41. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +0 -55
  42. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +0 -1394
  43. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +0 -25
  44. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/input.py +0 -3130
  45. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +0 -98
  46. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +0 -771
  47. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +0 -1271
  48. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +0 -174
  49. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +0 -61
  50. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +0 -374
  51. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +0 -1939
  52. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +0 -302
  53. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +0 -3197
  54. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +0 -65
  55. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/test_gyp.py +0 -261
  56. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/graphviz.py +0 -102
  57. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_gyp.py +0 -156
  58. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_sln.py +0 -181
  59. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +0 -339
  60. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/test/fixtures/test-charmap.py +0 -31
  61. wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/update-gyp.py +0 -64
  62. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/gyp_main.py +0 -45
  63. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +0 -367
  64. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +0 -206
  65. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +0 -1270
  66. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +0 -1547
  67. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +0 -59
  68. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +0 -153
  69. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +0 -271
  70. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +0 -574
  71. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +0 -666
  72. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/common.py +0 -654
  73. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +0 -78
  74. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +0 -165
  75. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +0 -109
  76. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +0 -55
  77. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  78. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +0 -808
  79. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +0 -1173
  80. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +0 -1321
  81. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +0 -120
  82. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -103
  83. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +0 -464
  84. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +0 -89
  85. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +0 -58
  86. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +0 -2518
  87. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +0 -3978
  88. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +0 -44
  89. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +0 -2936
  90. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +0 -55
  91. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +0 -1394
  92. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +0 -25
  93. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/input.py +0 -3137
  94. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +0 -98
  95. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +0 -771
  96. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +0 -1271
  97. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +0 -174
  98. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +0 -61
  99. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +0 -374
  100. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +0 -1939
  101. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +0 -302
  102. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +0 -3197
  103. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +0 -65
  104. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/setup.py +0 -42
  105. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/test_gyp.py +0 -260
  106. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/graphviz.py +0 -102
  107. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_gyp.py +0 -156
  108. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_sln.py +0 -181
  109. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +0 -339
  110. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/test/fixtures/test-charmap.py +0 -31
  111. wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/update-gyp.py +0 -46
  112. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/duos/app.py +0 -210
  113. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/duos/calc.py +0 -163
  114. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/game_stats/app.py +0 -401
  115. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/game_stats/name_fix.py +0 -47
  116. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/goalie/app.py +0 -101
  117. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/goalie/plot.py +0 -71
  118. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/goalie/rink_plot.py +0 -245
  119. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/app.py +0 -108
  120. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/plot.py +0 -95
  121. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/rink_plot.py +0 -245
  122. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/line-combos/app.py +0 -245
  123. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/line-combos/plot.py +0 -275
  124. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/line-combos/rink_plot.py +0 -245
  125. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/app.py +0 -145
  126. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/plot.py +0 -79
  127. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/rink_plot.py +0 -245
  128. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/app.py +0 -406
  129. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/plot.py +0 -79
  130. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/rink_plot.py +0 -245
  131. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/app.py +0 -110
  132. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/plot.py +0 -59
  133. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/rink_plot.py +0 -245
  134. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/team_heatmaps/app.py +0 -103
  135. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/team_heatmaps/plot.py +0 -95
  136. wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/team_heatmaps/rink_plot.py +0 -245
  137. wsba_hockey/flask/app.py +0 -77
  138. wsba_hockey/tools/utils/config.py +0 -14
  139. wsba_hockey/tools/utils/save_pages.py +0 -133
  140. wsba_hockey/workspace.py +0 -28
  141. wsba_hockey-1.1.9.dist-info/RECORD +0 -148
  142. {wsba_hockey-1.1.9.dist-info → wsba_hockey-1.2.1.dist-info}/WHEEL +0 -0
  143. {wsba_hockey-1.1.9.dist-info → wsba_hockey-1.2.1.dist-info}/licenses/LICENSE +0 -0
  144. {wsba_hockey-1.1.9.dist-info → wsba_hockey-1.2.1.dist-info}/top_level.txt +0 -0
@@ -1,149 +0,0 @@
1
- # ISC License
2
- #
3
- # Copyright (c) 2018-2021, Andrea Giammarchi, @WebReflection
4
- #
5
- # Permission to use, copy, modify, and/or distribute this software for any
6
- # purpose with or without fee is hereby granted, provided that the above
7
- # copyright notice and this permission notice appear in all copies.
8
- #
9
- # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
- # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
- # AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
- # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
- # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14
- # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
- # PERFORMANCE OF THIS SOFTWARE.
16
-
17
- import json as _json
18
-
19
- class _Known:
20
- def __init__(self):
21
- self.key = []
22
- self.value = []
23
-
24
- class _String:
25
- def __init__(self, value):
26
- self.value = value
27
-
28
-
29
- def _array_keys(value):
30
- keys = []
31
- i = 0
32
- for _ in value:
33
- keys.append(i)
34
- i += 1
35
- return keys
36
-
37
- def _object_keys(value):
38
- keys = []
39
- for key in value:
40
- keys.append(key)
41
- return keys
42
-
43
- def _is_array(value):
44
- return isinstance(value, list) or isinstance(value, tuple)
45
-
46
- def _is_object(value):
47
- return isinstance(value, dict)
48
-
49
- def _is_string(value):
50
- return isinstance(value, str)
51
-
52
- def _index(known, input, value):
53
- input.append(value)
54
- index = str(len(input) - 1)
55
- known.key.append(value)
56
- known.value.append(index)
57
- return index
58
-
59
- def _loop(keys, input, known, output):
60
- for key in keys:
61
- value = output[key]
62
- if isinstance(value, _String):
63
- _ref(key, input[int(value.value)], input, known, output)
64
-
65
- return output
66
-
67
- def _ref(key, value, input, known, output):
68
- if _is_array(value) and not value in known:
69
- known.append(value)
70
- value = _loop(_array_keys(value), input, known, value)
71
- elif _is_object(value) and not value in known:
72
- known.append(value)
73
- value = _loop(_object_keys(value), input, known, value)
74
-
75
- output[key] = value
76
-
77
- def _relate(known, input, value):
78
- if _is_string(value) or _is_array(value) or _is_object(value):
79
- try:
80
- return known.value[known.key.index(value)]
81
- except:
82
- return _index(known, input, value)
83
-
84
- return value
85
-
86
- def _transform(known, input, value):
87
- if _is_array(value):
88
- output = []
89
- for val in value:
90
- output.append(_relate(known, input, val))
91
- return output
92
-
93
- if _is_object(value):
94
- obj = {}
95
- for key in value:
96
- obj[key] = _relate(known, input, value[key])
97
- return obj
98
-
99
- return value
100
-
101
- def _wrap(value):
102
- if _is_string(value):
103
- return _String(value)
104
-
105
- if _is_array(value):
106
- i = 0
107
- for val in value:
108
- value[i] = _wrap(val)
109
- i += 1
110
-
111
- elif _is_object(value):
112
- for key in value:
113
- value[key] = _wrap(value[key])
114
-
115
- return value
116
-
117
- def parse(value, *args, **kwargs):
118
- json = _json.loads(value, *args, **kwargs)
119
- wrapped = []
120
- for value in json:
121
- wrapped.append(_wrap(value))
122
-
123
- input = []
124
- for value in wrapped:
125
- if isinstance(value, _String):
126
- input.append(value.value)
127
- else:
128
- input.append(value)
129
-
130
- value = input[0]
131
-
132
- if _is_array(value):
133
- return _loop(_array_keys(value), input, [value], value)
134
-
135
- if _is_object(value):
136
- return _loop(_object_keys(value), input, [value], value)
137
-
138
- return value
139
-
140
-
141
- def stringify(value, *args, **kwargs):
142
- known = _Known()
143
- input = []
144
- output = []
145
- i = int(_index(known, input, value))
146
- while i < len(input):
147
- output.append(_transform(known, input, input[i]))
148
- i += 1
149
- return _json.dumps(output, *args, **kwargs)
@@ -1,63 +0,0 @@
1
- from flatted import stringify as _stringify, parse
2
-
3
- def stringify(value):
4
- return _stringify(value, separators=(',', ':'))
5
-
6
- assert stringify([None, None]) == '[[null,null]]'
7
-
8
- a = []
9
- o = {}
10
-
11
- assert stringify(a) == '[[]]'
12
- assert stringify(o) == '[{}]'
13
-
14
- a.append(a)
15
- o['o'] = o
16
-
17
- assert stringify(a) == '[["0"]]'
18
- assert stringify(o) == '[{"o":"0"}]'
19
-
20
- b = parse(stringify(a))
21
- assert isinstance(b, list) and b[0] == b
22
-
23
- a.append(1)
24
- a.append('two')
25
- a.append(True)
26
- o['one'] = 1
27
- o['two'] = 'two'
28
- o['three'] = True
29
-
30
- assert stringify(a) == '[["0",1,"1",true],"two"]'
31
- assert stringify(o) == '[{"o":"0","one":1,"two":"1","three":true},"two"]'
32
-
33
- a.append(o)
34
- o['a'] = a
35
-
36
- assert stringify(a) == '[["0",1,"1",true,"2"],"two",{"o":"2","one":1,"two":"1","three":true,"a":"0"}]'
37
- assert stringify(o) == '[{"o":"0","one":1,"two":"1","three":true,"a":"2"},"two",["2",1,"1",true,"0"]]'
38
-
39
- a.append({'test': 'OK'})
40
- a.append([1, 2, 3])
41
-
42
- o['test'] = {'test': 'OK'}
43
- o['array'] = [1, 2, 3]
44
-
45
- assert stringify(a) == '[["0",1,"1",true,"2","3","4"],"two",{"o":"2","one":1,"two":"1","three":true,"a":"0","test":"3","array":"4"},{"test":"5"},[1,2,3],"OK"]'
46
- assert stringify(o) == '[{"o":"0","one":1,"two":"1","three":true,"a":"2","test":"3","array":"4"},"two",["2",1,"1",true,"0","3","4"],{"test":"5"},[1,2,3],"OK"]'
47
-
48
- a2 = parse(stringify(a));
49
- o2 = parse(stringify(o));
50
-
51
- assert a2[0] == a2
52
- assert o2['o'] == o2
53
-
54
- assert a2[1] == 1 and a2[2] == 'two' and a2[3] == True and isinstance(a2[4], dict)
55
- assert a2[4] == a2[4]['o'] and a2 == a2[4]['o']['a']
56
-
57
- str = parse('[{"prop":"1","a":"2","b":"3"},{"value":123},["4","5"],{"e":"6","t":"7","p":4},{},{"b":"8"},"f",{"a":"9"},["10"],"sup",{"a":1,"d":2,"c":"7","z":"11","h":1},{"g":2,"a":"7","b":"12","f":6},{"r":4,"u":"7","c":5}]')
58
- assert str['b']['t']['a'] == 'sup' and str['a'][1]['b'][0]['c'] == str['b']['t']
59
-
60
- oo = parse('[{"a":"1","b":"0","c":"2"},{"aa":"3"},{"ca":"4","cb":"5","cc":"6","cd":"7","ce":"8","cf":"9"},{"aaa":"10"},{"caa":"4"},{"cba":"5"},{"cca":"2"},{"cda":"4"},"value2","value3","value1"]');
61
- assert oo['a']['aa']['aaa'] == 'value1' and oo == oo['b'] and oo['c']['ca']['caa'] == oo['c']['ca']
62
-
63
- print('OK')
@@ -1,45 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- # Copyright (c) 2009 Google Inc. All rights reserved.
4
- # Use of this source code is governed by a BSD-style license that can be
5
- # found in the LICENSE file.
6
-
7
- import os
8
- import sys
9
- import subprocess
10
-
11
-
12
- def IsCygwin():
13
- # Function copied from pylib/gyp/common.py
14
- try:
15
- out = subprocess.Popen(
16
- "uname", stdout=subprocess.PIPE, stderr=subprocess.STDOUT
17
- )
18
- stdout, _ = out.communicate()
19
- return "CYGWIN" in stdout.decode("utf-8")
20
- except Exception:
21
- return False
22
-
23
-
24
- def UnixifyPath(path):
25
- try:
26
- if not IsCygwin():
27
- return path
28
- out = subprocess.Popen(
29
- ["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
30
- )
31
- stdout, _ = out.communicate()
32
- return stdout.decode("utf-8")
33
- except Exception:
34
- return path
35
-
36
-
37
- # Make sure we're using the version of pylib in this repo, not one installed
38
- # elsewhere on the system. Also convert to Unix style path on Cygwin systems,
39
- # else the 'gyp' library will not be found
40
- path = UnixifyPath(sys.argv[0])
41
- sys.path.insert(0, os.path.join(os.path.dirname(path), "pylib"))
42
- import gyp # noqa: E402
43
-
44
- if __name__ == "__main__":
45
- sys.exit(gyp.script_main())
@@ -1,367 +0,0 @@
1
- # Copyright (c) 2012 Google Inc. All rights reserved.
2
- # Use of this source code is governed by a BSD-style license that can be
3
- # found in the LICENSE file.
4
-
5
- """New implementation of Visual Studio project generation."""
6
-
7
- import hashlib
8
- import os
9
- import random
10
- from operator import attrgetter
11
-
12
- import gyp.common
13
-
14
-
15
- def cmp(x, y):
16
- return (x > y) - (x < y)
17
-
18
-
19
- # Initialize random number generator
20
- random.seed()
21
-
22
- # GUIDs for project types
23
- ENTRY_TYPE_GUIDS = {
24
- "project": "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}",
25
- "folder": "{2150E333-8FDC-42A3-9474-1A3956D46DE8}",
26
- }
27
-
28
- # ------------------------------------------------------------------------------
29
- # Helper functions
30
-
31
-
32
- def MakeGuid(name, seed="msvs_new"):
33
- """Returns a GUID for the specified target name.
34
-
35
- Args:
36
- name: Target name.
37
- seed: Seed for MD5 hash.
38
- Returns:
39
- A GUID-line string calculated from the name and seed.
40
-
41
- This generates something which looks like a GUID, but depends only on the
42
- name and seed. This means the same name/seed will always generate the same
43
- GUID, so that projects and solutions which refer to each other can explicitly
44
- determine the GUID to refer to explicitly. It also means that the GUID will
45
- not change when the project for a target is rebuilt.
46
- """
47
- # Calculate a MD5 signature for the seed and name.
48
- d = hashlib.md5((str(seed) + str(name)).encode("utf-8")).hexdigest().upper()
49
- # Convert most of the signature to GUID form (discard the rest)
50
- guid = (
51
- "{"
52
- + d[:8]
53
- + "-"
54
- + d[8:12]
55
- + "-"
56
- + d[12:16]
57
- + "-"
58
- + d[16:20]
59
- + "-"
60
- + d[20:32]
61
- + "}"
62
- )
63
- return guid
64
-
65
-
66
- # ------------------------------------------------------------------------------
67
-
68
-
69
- class MSVSSolutionEntry:
70
- def __cmp__(self, other):
71
- # Sort by name then guid (so things are in order on vs2008).
72
- return cmp((self.name, self.get_guid()), (other.name, other.get_guid()))
73
-
74
-
75
- class MSVSFolder(MSVSSolutionEntry):
76
- """Folder in a Visual Studio project or solution."""
77
-
78
- def __init__(self, path, name=None, entries=None, guid=None, items=None):
79
- """Initializes the folder.
80
-
81
- Args:
82
- path: Full path to the folder.
83
- name: Name of the folder.
84
- entries: List of folder entries to nest inside this folder. May contain
85
- Folder or Project objects. May be None, if the folder is empty.
86
- guid: GUID to use for folder, if not None.
87
- items: List of solution items to include in the folder project. May be
88
- None, if the folder does not directly contain items.
89
- """
90
- if name:
91
- self.name = name
92
- else:
93
- # Use last layer.
94
- self.name = os.path.basename(path)
95
-
96
- self.path = path
97
- self.guid = guid
98
-
99
- # Copy passed lists (or set to empty lists)
100
- self.entries = sorted(entries or [], key=attrgetter("path"))
101
- self.items = list(items or [])
102
-
103
- self.entry_type_guid = ENTRY_TYPE_GUIDS["folder"]
104
-
105
- def get_guid(self):
106
- if self.guid is None:
107
- # Use consistent guids for folders (so things don't regenerate).
108
- self.guid = MakeGuid(self.path, seed="msvs_folder")
109
- return self.guid
110
-
111
-
112
- # ------------------------------------------------------------------------------
113
-
114
-
115
- class MSVSProject(MSVSSolutionEntry):
116
- """Visual Studio project."""
117
-
118
- def __init__(
119
- self,
120
- path,
121
- name=None,
122
- dependencies=None,
123
- guid=None,
124
- spec=None,
125
- build_file=None,
126
- config_platform_overrides=None,
127
- fixpath_prefix=None,
128
- ):
129
- """Initializes the project.
130
-
131
- Args:
132
- path: Absolute path to the project file.
133
- name: Name of project. If None, the name will be the same as the base
134
- name of the project file.
135
- dependencies: List of other Project objects this project is dependent
136
- upon, if not None.
137
- guid: GUID to use for project, if not None.
138
- spec: Dictionary specifying how to build this project.
139
- build_file: Filename of the .gyp file that the vcproj file comes from.
140
- config_platform_overrides: optional dict of configuration platforms to
141
- used in place of the default for this target.
142
- fixpath_prefix: the path used to adjust the behavior of _fixpath
143
- """
144
- self.path = path
145
- self.guid = guid
146
- self.spec = spec
147
- self.build_file = build_file
148
- # Use project filename if name not specified
149
- self.name = name or os.path.splitext(os.path.basename(path))[0]
150
-
151
- # Copy passed lists (or set to empty lists)
152
- self.dependencies = list(dependencies or [])
153
-
154
- self.entry_type_guid = ENTRY_TYPE_GUIDS["project"]
155
-
156
- if config_platform_overrides:
157
- self.config_platform_overrides = config_platform_overrides
158
- else:
159
- self.config_platform_overrides = {}
160
- self.fixpath_prefix = fixpath_prefix
161
- self.msbuild_toolset = None
162
-
163
- def set_dependencies(self, dependencies):
164
- self.dependencies = list(dependencies or [])
165
-
166
- def get_guid(self):
167
- if self.guid is None:
168
- # Set GUID from path
169
- # TODO(rspangler): This is fragile.
170
- # 1. We can't just use the project filename sans path, since there could
171
- # be multiple projects with the same base name (for example,
172
- # foo/unittest.vcproj and bar/unittest.vcproj).
173
- # 2. The path needs to be relative to $SOURCE_ROOT, so that the project
174
- # GUID is the same whether it's included from base/base.sln or
175
- # foo/bar/baz/baz.sln.
176
- # 3. The GUID needs to be the same each time this builder is invoked, so
177
- # that we don't need to rebuild the solution when the project changes.
178
- # 4. We should be able to handle pre-built project files by reading the
179
- # GUID from the files.
180
- self.guid = MakeGuid(self.name)
181
- return self.guid
182
-
183
- def set_msbuild_toolset(self, msbuild_toolset):
184
- self.msbuild_toolset = msbuild_toolset
185
-
186
-
187
- # ------------------------------------------------------------------------------
188
-
189
-
190
- class MSVSSolution:
191
- """Visual Studio solution."""
192
-
193
- def __init__(
194
- self, path, version, entries=None, variants=None, websiteProperties=True
195
- ):
196
- """Initializes the solution.
197
-
198
- Args:
199
- path: Path to solution file.
200
- version: Format version to emit.
201
- entries: List of entries in solution. May contain Folder or Project
202
- objects. May be None, if the folder is empty.
203
- variants: List of build variant strings. If none, a default list will
204
- be used.
205
- websiteProperties: Flag to decide if the website properties section
206
- is generated.
207
- """
208
- self.path = path
209
- self.websiteProperties = websiteProperties
210
- self.version = version
211
-
212
- # Copy passed lists (or set to empty lists)
213
- self.entries = list(entries or [])
214
-
215
- if variants:
216
- # Copy passed list
217
- self.variants = variants[:]
218
- else:
219
- # Use default
220
- self.variants = ["Debug|Win32", "Release|Win32"]
221
- # TODO(rspangler): Need to be able to handle a mapping of solution config
222
- # to project config. Should we be able to handle variants being a dict,
223
- # or add a separate variant_map variable? If it's a dict, we can't
224
- # guarantee the order of variants since dict keys aren't ordered.
225
-
226
- # TODO(rspangler): Automatically write to disk for now; should delay until
227
- # node-evaluation time.
228
- self.Write()
229
-
230
- def Write(self, writer=gyp.common.WriteOnDiff):
231
- """Writes the solution file to disk.
232
-
233
- Raises:
234
- IndexError: An entry appears multiple times.
235
- """
236
- # Walk the entry tree and collect all the folders and projects.
237
- all_entries = set()
238
- entries_to_check = self.entries[:]
239
- while entries_to_check:
240
- e = entries_to_check.pop(0)
241
-
242
- # If this entry has been visited, nothing to do.
243
- if e in all_entries:
244
- continue
245
-
246
- all_entries.add(e)
247
-
248
- # If this is a folder, check its entries too.
249
- if isinstance(e, MSVSFolder):
250
- entries_to_check += e.entries
251
-
252
- all_entries = sorted(all_entries, key=attrgetter("path"))
253
-
254
- # Open file and print header
255
- f = writer(self.path)
256
- f.write(
257
- "Microsoft Visual Studio Solution File, "
258
- "Format Version %s\r\n" % self.version.SolutionVersion()
259
- )
260
- f.write("# %s\r\n" % self.version.Description())
261
-
262
- # Project entries
263
- sln_root = os.path.split(self.path)[0]
264
- for e in all_entries:
265
- relative_path = gyp.common.RelativePath(e.path, sln_root)
266
- # msbuild does not accept an empty folder_name.
267
- # use '.' in case relative_path is empty.
268
- folder_name = relative_path.replace("/", "\\") or "."
269
- f.write(
270
- 'Project("%s") = "%s", "%s", "%s"\r\n'
271
- % (
272
- e.entry_type_guid, # Entry type GUID
273
- e.name, # Folder name
274
- folder_name, # Folder name (again)
275
- e.get_guid(), # Entry GUID
276
- )
277
- )
278
-
279
- # TODO(rspangler): Need a way to configure this stuff
280
- if self.websiteProperties:
281
- f.write(
282
- "\tProjectSection(WebsiteProperties) = preProject\r\n"
283
- '\t\tDebug.AspNetCompiler.Debug = "True"\r\n'
284
- '\t\tRelease.AspNetCompiler.Debug = "False"\r\n'
285
- "\tEndProjectSection\r\n"
286
- )
287
-
288
- if isinstance(e, MSVSFolder):
289
- if e.items:
290
- f.write("\tProjectSection(SolutionItems) = preProject\r\n")
291
- for i in e.items:
292
- f.write(f"\t\t{i} = {i}\r\n")
293
- f.write("\tEndProjectSection\r\n")
294
-
295
- if isinstance(e, MSVSProject):
296
- if e.dependencies:
297
- f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
298
- for d in e.dependencies:
299
- f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n")
300
- f.write("\tEndProjectSection\r\n")
301
-
302
- f.write("EndProject\r\n")
303
-
304
- # Global section
305
- f.write("Global\r\n")
306
-
307
- # Configurations (variants)
308
- f.write("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n")
309
- for v in self.variants:
310
- f.write(f"\t\t{v} = {v}\r\n")
311
- f.write("\tEndGlobalSection\r\n")
312
-
313
- # Sort config guids for easier diffing of solution changes.
314
- config_guids = []
315
- config_guids_overrides = {}
316
- for e in all_entries:
317
- if isinstance(e, MSVSProject):
318
- config_guids.append(e.get_guid())
319
- config_guids_overrides[e.get_guid()] = e.config_platform_overrides
320
- config_guids.sort()
321
-
322
- f.write("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n")
323
- for g in config_guids:
324
- for v in self.variants:
325
- nv = config_guids_overrides[g].get(v, v)
326
- # Pick which project configuration to build for this solution
327
- # configuration.
328
- f.write(
329
- "\t\t%s.%s.ActiveCfg = %s\r\n"
330
- % (
331
- g, # Project GUID
332
- v, # Solution build configuration
333
- nv, # Project build config for that solution config
334
- )
335
- )
336
-
337
- # Enable project in this solution configuration.
338
- f.write(
339
- "\t\t%s.%s.Build.0 = %s\r\n"
340
- % (
341
- g, # Project GUID
342
- v, # Solution build configuration
343
- nv, # Project build config for that solution config
344
- )
345
- )
346
- f.write("\tEndGlobalSection\r\n")
347
-
348
- # TODO(rspangler): Should be able to configure this stuff too (though I've
349
- # never seen this be any different)
350
- f.write("\tGlobalSection(SolutionProperties) = preSolution\r\n")
351
- f.write("\t\tHideSolutionNode = FALSE\r\n")
352
- f.write("\tEndGlobalSection\r\n")
353
-
354
- # Folder mappings
355
- # Omit this section if there are no folders
356
- if any([e.entries for e in all_entries if isinstance(e, MSVSFolder)]):
357
- f.write("\tGlobalSection(NestedProjects) = preSolution\r\n")
358
- for e in all_entries:
359
- if not isinstance(e, MSVSFolder):
360
- continue # Does not apply to projects, only folders
361
- for subentry in e.entries:
362
- f.write(f"\t\t{subentry.get_guid()} = {e.get_guid()}\r\n")
363
- f.write("\tEndGlobalSection\r\n")
364
-
365
- f.write("EndGlobal\r\n")
366
-
367
- f.close()