Skip to content

Commit 62f3d46

Browse files
authored
Merge pull request #10 from randomseed42/main
bugfix: add "rb" and "encoding" to several with open clause
2 parents ddb279f + 16ec9c1 commit 62f3d46

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

src/bokeh_sampledata/airports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
__all__ = ("data",)
3232

33-
with open(package_path("airports.json")) as f:
33+
with open(package_path("airports.json"), "rb") as f:
3434
airports = json.load(f)
3535
data = pd.json_normalize(
3636
airports["features"],

src/bokeh_sampledata/browsers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
def _read_data() -> pd.DataFrame:
4040
df = package_csv("browsers_nov_2013.csv", names=("Version", "Share"), skiprows=1)
41-
versions = df.Version.map(lambda x: x.rsplit(" ", 1))
41+
versions: pd.Series[str] = df["Version"].map(lambda x: x.rsplit(" ", 1))
4242
df["Browser"] = versions.map(lambda x: x[0])
4343
df["VersionNumber"] = versions.map(lambda x: x[1] if len(x) == 2 else "0")
4444
return df

src/bokeh_sampledata/sample_geojson.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222

2323
__all__ = ("geojson",)
2424

25-
with open(package_path("sample_geojson.geojson")) as f:
25+
with open(package_path("sample_geojson.geojson"), encoding="utf-8") as f:
2626
geojson = f.read()

src/bokeh_sampledata/unemployment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
data = {}
3939

40-
with open(package_path("unemployment09.csv")) as f:
40+
with open(package_path("unemployment09.csv"), encoding="utf-8") as f:
4141
reader = csv.reader(f, delimiter=",", quotechar='"')
4242
for row in reader:
4343
_, state_id, county_id, _, _, _, _, _, rate = row

src/bokeh_sampledata/us_counties.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class CountyData(TypedDict):
7070
def _read_data() -> dict[tuple[int, int], CountyData]:
7171
data: dict[tuple[int, int], CountyData] = {}
7272

73-
with open(package_path("US_Counties.csv")) as f:
73+
with open(package_path("US_Counties.csv"), encoding="utf-8") as f:
7474
next(f)
7575
reader = csv.reader(f, delimiter=",", quotechar='"')
7676
for row in reader:

src/bokeh_sampledata/us_holidays.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
__all__ = ("us_holidays",)
3939

40-
with open(package_path("USHolidays.ics")) as f:
40+
with open(package_path("USHolidays.ics"), encoding="utf-8") as f:
4141
data = ic.Calendar.from_ical(f.read())
4242

4343
us_holidays = sorted((elt.get("dtstart").dt, str(elt.get("summary"))) for elt in data.walk() if elt.name == "VEVENT")

0 commit comments

Comments
 (0)