wsba-hockey 1.0.2__py3-none-any.whl → 1.0.4__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.
- wsba_hockey/data_pipelines.py +183 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/duckdb/vendor.py +146 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/flatted/python/flatted.py +149 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/flatted/python/test.py +63 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/gyp_main.py +45 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +367 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +206 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +1270 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +1547 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +59 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +153 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +271 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +574 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +690 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/common.py +661 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +78 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +165 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +109 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +55 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +808 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +1173 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +1321 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +120 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +103 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +464 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +89 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +58 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +2714 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +3981 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +44 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +2936 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +55 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +1394 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +25 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/input.py +3130 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +98 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +771 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +1271 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +174 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +61 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +374 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +1939 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +302 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +3197 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +65 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/test_gyp.py +261 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/graphviz.py +102 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_gyp.py +156 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_sln.py +181 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +339 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/test/fixtures/test-charmap.py +31 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/node-gyp/update-gyp.py +64 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/gyp_main.py +45 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +367 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +206 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +1270 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +1547 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +59 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +153 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +271 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +574 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +666 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/common.py +654 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +78 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +165 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +109 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +55 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +808 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +1173 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +1321 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +120 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +103 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +464 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +89 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +58 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +2518 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +3978 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +44 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +2936 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +55 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +1394 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +25 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/input.py +3137 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +98 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +771 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +1271 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +174 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +61 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +374 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +1939 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +302 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +3197 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +65 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/setup.py +42 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/test_gyp.py +260 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/graphviz.py +102 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_gyp.py +156 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_sln.py +181 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +339 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/test/fixtures/test-charmap.py +31 -0
- wsba_hockey/evidence/weakside-breakout/node_modules/sqlite3/node_modules/node-gyp/update-gyp.py +46 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/game_stats/app.py +401 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/game_stats/name_fix.py +47 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/app.py +108 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/plot.py +93 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/heatmaps/rink_plot.py +245 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/app.py +145 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/plot.py +77 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/matchups/rink_plot.py +245 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/app.py +389 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/plot.py +70 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/pbp/rink_plot.py +245 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/app.py +110 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/plot.py +58 -0
- wsba_hockey/evidence/weakside-breakout/wsba_nhl_apps/wsba_nhl_apps/skater/rink_plot.py +245 -0
- wsba_hockey/tools/agg.py +242 -53
- wsba_hockey/tools/plotting.py +15 -20
- wsba_hockey/tools/scraping.py +149 -258
- wsba_hockey/tools/xg_model.py +370 -298
- wsba_hockey/workspace.py +22 -101
- wsba_hockey/wsba_main.py +494 -147
- {wsba_hockey-1.0.2.dist-info → wsba_hockey-1.0.4.dist-info}/METADATA +2 -2
- wsba_hockey-1.0.4.dist-info/RECORD +135 -0
- {wsba_hockey-1.0.2.dist-info → wsba_hockey-1.0.4.dist-info}/WHEEL +1 -1
- wsba_hockey/stats/calculate_viz/shot_impact.py +0 -2
- wsba_hockey-1.0.2.dist-info/RECORD +0 -19
- {wsba_hockey-1.0.2.dist-info → wsba_hockey-1.0.4.dist-info}/licenses/LICENSE +0 -0
- {wsba_hockey-1.0.2.dist-info → wsba_hockey-1.0.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,183 @@
|
|
1
|
+
import numpy as np
|
2
|
+
import pandas as pd
|
3
|
+
import wsba_main as wsba
|
4
|
+
import numpy as np
|
5
|
+
from datetime import datetime
|
6
|
+
from gspread_pandas import Spread
|
7
|
+
import matplotlib.pyplot as plt
|
8
|
+
from scipy import stats
|
9
|
+
|
10
|
+
### DATA PIPELINES ###
|
11
|
+
|
12
|
+
def pbp(seasons):
|
13
|
+
for season in seasons:
|
14
|
+
errors=[]
|
15
|
+
for season in seasons:
|
16
|
+
data = wsba.nhl_scrape_season(season,remove=[],local=True,sources=True,errors=True)
|
17
|
+
errors.append(data['errors'])
|
18
|
+
data['pbp'].to_csv(f'pbp/nhl_pbp_{season}.csv',index=False)
|
19
|
+
pd.read_csv(f'pbp/nhl_pbp_{season}.csv').to_parquet(f'pbp/parquet/nhl_pbp_{season}.parquet',index=False)
|
20
|
+
print(f'Errors: {errors}')
|
21
|
+
|
22
|
+
def pbp_db(seasons):
|
23
|
+
for season in seasons:
|
24
|
+
pbp = pd.read_parquet(f'pbp/parquet/nhl_pbp_{season}.parquet')
|
25
|
+
pbp.loc[pbp['event_type'].isin(wsba.events+['penalty'])].to_csv('temp.csv',index=False)
|
26
|
+
pd.read_csv('temp.csv').to_parquet(f'backblaze_pbp/{season}.parquet',index=False)
|
27
|
+
|
28
|
+
def load_pbp(seasons):
|
29
|
+
return pd.concat([pd.read_parquet(f'pbp/parquet/nhl_pbp_{season}.parquet') for season in seasons])
|
30
|
+
|
31
|
+
def load_pbp_db(seasons):
|
32
|
+
return pd.concat([pd.read_parquet(f'backblaze_pbp/{season}.parquet') for season in seasons])
|
33
|
+
|
34
|
+
def stats(arg,seasons):
|
35
|
+
#Stats building
|
36
|
+
for group in arg:
|
37
|
+
for season in seasons:
|
38
|
+
pbp = pd.read_parquet(f'pbp/parquet/nhl_pbp_{season}.parquet')
|
39
|
+
strengths = pbp.loc[~(pbp['strength_state'].isin(['5v5','5v4','4v5'])),'strength_state'].drop_duplicates().to_list()
|
40
|
+
dfs = []
|
41
|
+
for strength in [['5v5'],['5v4'],['4v5'],strengths,'all']:
|
42
|
+
for season_type in [[2],[3]]:
|
43
|
+
data = wsba.nhl_calculate_stats(pbp,group,season_type,strength,shot_impact=True)
|
44
|
+
if strength != 'all':
|
45
|
+
if len(strength) > 1:
|
46
|
+
data['Strength'] = 'Other'
|
47
|
+
else:
|
48
|
+
data['Strength'] = strength[0]
|
49
|
+
else:
|
50
|
+
data['Strength'] = 'All'
|
51
|
+
data['Span'] = season_type[0]
|
52
|
+
dfs.append(data)
|
53
|
+
stat = pd.concat(dfs)
|
54
|
+
stat.to_csv(f'stats/{group}/wsba_nhl_{season}_{group}.csv',index=False)
|
55
|
+
|
56
|
+
def game_log(arg,seasons):
|
57
|
+
#Stats building
|
58
|
+
for group in arg:
|
59
|
+
for season in seasons:
|
60
|
+
pbp = pd.read_parquet(f'pbp/parquet/nhl_pbp_{season}.parquet')
|
61
|
+
strengths = pbp.loc[~(pbp['strength_state'].isin(['5v5','5v4','4v5'])),'strength_state'].drop_duplicates().to_list()
|
62
|
+
dfs = []
|
63
|
+
for strength in [['5v5'],['5v4'],['4v5'],strengths,'all']:
|
64
|
+
for season_type in [[2],[3]]:
|
65
|
+
data = wsba.nhl_calculate_stats(pbp,group,season_type,strength,split_game=True,shot_impact=False)
|
66
|
+
if strength != 'all':
|
67
|
+
if len(strength) > 1:
|
68
|
+
data['Strength'] = 'Other'
|
69
|
+
else:
|
70
|
+
data['Strength'] = strength[0]
|
71
|
+
else:
|
72
|
+
data['Strength'] = 'All'
|
73
|
+
data['Span'] = season_type[0]
|
74
|
+
dfs.append(data)
|
75
|
+
stat = pd.concat(dfs)
|
76
|
+
stat.to_csv(f'stats/game_log/wsba_nhl_{season}_game_log.csv',index=False)
|
77
|
+
stats = pd.read_csv(f'stats/game_log/wsba_nhl_{season}_game_log.csv')
|
78
|
+
stats.to_parquet(f'stats/game_log/wsba_nhl_{season}_game_log.parquet',index=False)
|
79
|
+
|
80
|
+
def push_to_sheet(seasons, types = ['skaters','team','goalie','info'], msg = 'Data Update'):
|
81
|
+
spread = Spread('WSBA - NHL 5v5 Shooting Metrics Public v1.0')
|
82
|
+
|
83
|
+
if 'skaters' in types:
|
84
|
+
#Tables
|
85
|
+
skater = pd.concat([pd.read_csv(f'stats/skater/wsba_nhl_{season}_skater.csv') for season in seasons])
|
86
|
+
skater = skater.loc[(skater['Strength']=='5v5')&(skater['Span']==2)]
|
87
|
+
|
88
|
+
spread.df_to_sheet(skater,index=False,sheet='Skaters DB')
|
89
|
+
|
90
|
+
if 'team' in types:
|
91
|
+
team = pd.concat([pd.read_csv(f'stats/team/wsba_nhl_{season}_team.csv') for season in seasons])
|
92
|
+
team = team.loc[(team['Strength']=='5v5')&(team['Span']==2)]
|
93
|
+
|
94
|
+
spread.df_to_sheet(team,index=False,sheet='Teams DB')
|
95
|
+
|
96
|
+
if 'goalie' in types:
|
97
|
+
goalie = pd.concat([pd.read_csv(f'stats/skater/wsba_nhl_{season}_goalie.csv') for season in seasons])
|
98
|
+
goalie = goalie.loc[(goalie['Strength']=='5v5')&(goalie['Span']==2)]
|
99
|
+
|
100
|
+
spread.df_to_sheet(goalie,index=False,sheet='Goalie DB')
|
101
|
+
|
102
|
+
if 'info' in types:
|
103
|
+
team_info = pd.read_csv('teaminfo/nhl_teaminfo.csv')
|
104
|
+
country = pd.read_csv('teaminfo/nhl_countryinfo.csv')
|
105
|
+
|
106
|
+
spread.df_to_sheet(team_info,index=False,sheet='Team Info')
|
107
|
+
spread.df_to_sheet(country,index=False,sheet='Country Info')
|
108
|
+
|
109
|
+
#if 'schedule' in types:
|
110
|
+
# schedule = pd.read_csv('schedule/schedule.csv')
|
111
|
+
#
|
112
|
+
# spread.df_to_sheet(schedule,index=False,sheet='Schedule')
|
113
|
+
|
114
|
+
log = spread.sheet_to_df(0,1,2,sheet='Update Log')
|
115
|
+
update = pd.DataFrame({'Date/Time (US-Central)':[datetime.now()],
|
116
|
+
'Change':[msg]})
|
117
|
+
|
118
|
+
spread.df_to_sheet(pd.concat([log,update]),index=False,start='A2',sheet='Update Log')
|
119
|
+
|
120
|
+
print('Done.')
|
121
|
+
|
122
|
+
def compare_xG(seasons):
|
123
|
+
load_1 = pd.concat([pd.read_csv(f'stats/skater/wsba_nhl_{season}_skater.csv') for season in seasons])
|
124
|
+
load_2 = pd.read_csv('stats/moneypuck/moneypuck.csv')
|
125
|
+
|
126
|
+
dfs = []
|
127
|
+
for strength in [('5v5','5on5'),('5v4','5on4'),('4v5','4on5'),('Other','other'),('All','all')]:
|
128
|
+
df = load_1
|
129
|
+
mp = load_2
|
130
|
+
|
131
|
+
df = df.loc[(df['Span']==2)&(df['Strength']==strength[0])][['ID','Season','xGi','Gi']].replace({
|
132
|
+
20162017:2016,
|
133
|
+
20172018:2017,
|
134
|
+
20182019:2018,
|
135
|
+
20192020:2019,
|
136
|
+
20202021:2020,
|
137
|
+
20212022:2021,
|
138
|
+
20222023:2022,
|
139
|
+
20232024:2023
|
140
|
+
})
|
141
|
+
mp = mp.loc[(mp['situation'])==strength[1]][['playerId','season','I_F_xGoals','I_F_goals']].rename(columns={'playerId':'ID','season':'Season','I_F_xGoals':'ixG','I_F_goals':'G'})
|
142
|
+
|
143
|
+
merge = pd.merge(df,mp,how='left')
|
144
|
+
merge = merge.dropna()
|
145
|
+
|
146
|
+
x = merge['xGi']
|
147
|
+
y = merge['ixG']
|
148
|
+
|
149
|
+
r,p = stats.pearsonr(x,y)
|
150
|
+
plt.scatter(x,y,label=f'r = {r:.4f}')
|
151
|
+
plt.title(f'WSBA xG vs MoneyPuck xG (2016-17 to 2023-24 in {strength[0]} situations)')
|
152
|
+
plt.xlabel('WSBA xG')
|
153
|
+
plt.ylabel('MoneyPuck xG')
|
154
|
+
plt.legend(loc="lower right")
|
155
|
+
plt.savefig(f'tools/xg_model/metrics/moneypuck/wsba_vs_moneypuck_{strength[0]}.png')
|
156
|
+
plt.close()
|
157
|
+
|
158
|
+
for xg,model in [(df,'WSBA'),(mp,'MoneyPuck')]:
|
159
|
+
xg = xg.rename(columns={'xGi':'ixG','Gi':'G'})
|
160
|
+
|
161
|
+
x = xg['ixG']
|
162
|
+
y = xg['G']
|
163
|
+
|
164
|
+
r,p = stats.pearsonr(x,y)
|
165
|
+
plt.scatter(x,y,label=f'r = {r:.4f}')
|
166
|
+
plt.title(f'{model} xG vs Goals (2016-17 to 2023-24 in {strength[0]} situations)')
|
167
|
+
plt.xlabel(f'{model}')
|
168
|
+
plt.ylabel('Goals')
|
169
|
+
plt.legend(loc="lower right")
|
170
|
+
plt.savefig(f'tools/xg_model/metrics/predict_power/{model}_predict_power_{strength[0]}.png')
|
171
|
+
plt.close()
|
172
|
+
|
173
|
+
dfs.append(pd.DataFrame([
|
174
|
+
{ 'Strength':strength[0],
|
175
|
+
'WSBA G-xG':np.mean(df['Gi']-df['xGi']),
|
176
|
+
'MoneyPuck G-xG':np.mean(mp['G']-mp['ixG'])
|
177
|
+
}
|
178
|
+
]
|
179
|
+
))
|
180
|
+
|
181
|
+
compare = pd.concat(dfs)
|
182
|
+
compare['Compare'] = np.where(abs(compare['WSBA G-xG'])<abs(compare['MoneyPuck G-xG']),'WSBA','MoneyPuck')
|
183
|
+
compare.to_csv('tools/xg_model/metrics/predict_power/wsba_vs_moneypuck_predict_power.csv',index=False)
|
@@ -0,0 +1,146 @@
|
|
1
|
+
import os
|
2
|
+
import sys
|
3
|
+
import json
|
4
|
+
import pickle
|
5
|
+
import argparse
|
6
|
+
|
7
|
+
parser = argparse.ArgumentParser(description='Inlines DuckDB Sources')
|
8
|
+
|
9
|
+
parser.add_argument('--duckdb', action='store',
|
10
|
+
help='Path to the DuckDB Version to be vendored in', required=True, type=str)
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
args = parser.parse_args()
|
15
|
+
|
16
|
+
|
17
|
+
# list of extensions to bundle
|
18
|
+
extensions = ['parquet', 'icu', 'json']
|
19
|
+
|
20
|
+
# path to target
|
21
|
+
basedir = os.getcwd()
|
22
|
+
target_dir = os.path.join(basedir, 'src', 'duckdb')
|
23
|
+
gyp_in = os.path.join(basedir, 'binding.gyp.in')
|
24
|
+
gyp_out = os.path.join(basedir, 'binding.gyp')
|
25
|
+
cache_file = os.path.join(basedir, 'filelist.cache')
|
26
|
+
|
27
|
+
# path to package_build.py
|
28
|
+
os.chdir(os.path.join(args.duckdb))
|
29
|
+
scripts_dir = 'scripts'
|
30
|
+
|
31
|
+
sys.path.append(scripts_dir)
|
32
|
+
import package_build
|
33
|
+
|
34
|
+
defines = ['DUCKDB_EXTENSION_{}_LINKED'.format(ext.upper()) for ext in extensions]
|
35
|
+
|
36
|
+
# Autoloading is on by default for node distributions
|
37
|
+
defines.extend(['DUCKDB_EXTENSION_AUTOLOAD_DEFAULT=1', 'DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT=1'])
|
38
|
+
defines.extend(['NDEBUG'])
|
39
|
+
|
40
|
+
if os.environ.get('DUCKDB_NODE_BUILD_CACHE') == '1' and os.path.isfile(cache_file):
|
41
|
+
with open(cache_file, 'rb') as f:
|
42
|
+
cache = pickle.load(f)
|
43
|
+
source_list = cache['source_list']
|
44
|
+
include_list = cache['include_list']
|
45
|
+
libraries = cache['libraries']
|
46
|
+
windows_options = cache['windows_options']
|
47
|
+
cflags = cache['cflags']
|
48
|
+
elif 'DUCKDB_NODE_BINDIR' in os.environ:
|
49
|
+
|
50
|
+
def find_library_path(libdir, libname):
|
51
|
+
flist = os.listdir(libdir)
|
52
|
+
for fname in flist:
|
53
|
+
fpath = os.path.join(libdir, fname)
|
54
|
+
if os.path.isfile(fpath) and package_build.file_is_lib(fname, libname):
|
55
|
+
return fpath
|
56
|
+
raise Exception(f"Failed to find library {libname} in {libdir}")
|
57
|
+
|
58
|
+
# existing build
|
59
|
+
existing_duckdb_dir = os.environ['DUCKDB_NODE_BINDIR']
|
60
|
+
cflags = os.environ['DUCKDB_NODE_CFLAGS']
|
61
|
+
libraries = os.environ['DUCKDB_NODE_LIBS'].split(' ')
|
62
|
+
|
63
|
+
include_directories = [os.path.join('..', '..', include) for include in package_build.third_party_includes()]
|
64
|
+
include_list = package_build.includes(extensions)
|
65
|
+
|
66
|
+
result_libraries = package_build.get_libraries(existing_duckdb_dir, libraries, extensions)
|
67
|
+
libraries = []
|
68
|
+
for libdir, libname in result_libraries:
|
69
|
+
if libdir is None:
|
70
|
+
continue
|
71
|
+
libraries.append(find_library_path(libdir, libname))
|
72
|
+
|
73
|
+
source_list = []
|
74
|
+
cflags = []
|
75
|
+
windows_options = []
|
76
|
+
if os.name == 'nt':
|
77
|
+
windows_options = [x for x in os.environ['DUCKDB_NODE_CFLAGS'].split(' ') if x.startswith('/')]
|
78
|
+
else:
|
79
|
+
if '-g' in os.environ['DUCKDB_NODE_CFLAGS']:
|
80
|
+
cflags += ['-g']
|
81
|
+
if '-O0' in os.environ['DUCKDB_NODE_CFLAGS']:
|
82
|
+
cflags += ['-O0']
|
83
|
+
|
84
|
+
if 'DUCKDB_NODE_BUILD_CACHE' in os.environ:
|
85
|
+
cache = {
|
86
|
+
'source_list': source_list,
|
87
|
+
'include_list': include_list,
|
88
|
+
'libraries': libraries,
|
89
|
+
'cflags': cflags,
|
90
|
+
'windows_options': windows_options,
|
91
|
+
}
|
92
|
+
with open(cache_file, 'wb+') as f:
|
93
|
+
pickle.dump(cache, f)
|
94
|
+
else:
|
95
|
+
# fresh build - copy over all of the files
|
96
|
+
(source_list, include_list, original_sources) = package_build.build_package(target_dir, extensions, False)
|
97
|
+
|
98
|
+
# # the list of all source files (.cpp files) that have been copied into the `duckdb_source_copy` directory
|
99
|
+
# print(source_list)
|
100
|
+
# # the list of all include files
|
101
|
+
# print(include_list)
|
102
|
+
source_list = [os.path.relpath(x, basedir) if os.path.isabs(x) else os.path.join('src', x) for x in source_list]
|
103
|
+
include_list = [os.path.join('src', 'duckdb', x) for x in include_list]
|
104
|
+
libraries = []
|
105
|
+
windows_options = ['/GR']
|
106
|
+
cflags = ['-frtti']
|
107
|
+
|
108
|
+
|
109
|
+
def sanitize_path(x):
|
110
|
+
return x.replace('\\', '/')
|
111
|
+
|
112
|
+
|
113
|
+
source_list = [sanitize_path(x) for x in source_list]
|
114
|
+
include_list = [sanitize_path(x) for x in include_list]
|
115
|
+
libraries = [sanitize_path(x) for x in libraries]
|
116
|
+
|
117
|
+
with open(gyp_in, 'r') as f:
|
118
|
+
input_json = json.load(f)
|
119
|
+
|
120
|
+
|
121
|
+
def replace_entries(node, replacement_map):
|
122
|
+
if type(node) == type([]):
|
123
|
+
for key in replacement_map.keys():
|
124
|
+
if key in node:
|
125
|
+
node.remove(key)
|
126
|
+
node += replacement_map[key]
|
127
|
+
for entry in node:
|
128
|
+
if type(entry) == type([]) or type(entry) == type({}):
|
129
|
+
replace_entries(entry, replacement_map)
|
130
|
+
if type(node) == type({}):
|
131
|
+
for key in node.keys():
|
132
|
+
replace_entries(node[key], replacement_map)
|
133
|
+
|
134
|
+
|
135
|
+
replacement_map = {}
|
136
|
+
replacement_map['${SOURCE_FILES}'] = source_list
|
137
|
+
replacement_map['${INCLUDE_FILES}'] = include_list
|
138
|
+
replacement_map['${DEFINES}'] = defines
|
139
|
+
replacement_map['${LIBRARY_FILES}'] = libraries
|
140
|
+
replacement_map['${CFLAGS}'] = cflags
|
141
|
+
replacement_map['${WINDOWS_OPTIONS}'] = windows_options
|
142
|
+
|
143
|
+
replace_entries(input_json, replacement_map)
|
144
|
+
|
145
|
+
with open(gyp_out, 'w+') as f:
|
146
|
+
json.dump(input_json, f, indent=4, separators=(", ", ": "))
|
@@ -0,0 +1,149 @@
|
|
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)
|
@@ -0,0 +1,63 @@
|
|
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')
|
@@ -0,0 +1,45 @@
|
|
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())
|