We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Deprecation warning due to invalid escape sequences
Deprecation warnings are raised due to invalid escape sequences. This can be fixed by using raw strings or escaping the literals. pyupgrade also helps in automatic conversion : https://github.com/asottile/pyupgrade/

```
find . -iname '*.py' | grep -Ev 'test.py' | xargs -P4 -I{} python3.8 -Wall -m py_compile {}
./yfinance/utils.py:67: DeprecationWarning: invalid escape sequence \g
  return [_re.sub("([a-z])([A-Z])", "\g<1> \g<2>", i).title() for i in o]
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `yfinance/utils.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # Yahoo! Finance market data downloader (+fix for Pandas Datareader)
5 # https://github.com/ranaroussi/yfinance
6 #
7 # Copyright 2017-2019 Ran Aroussi
8 #
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
12 #
13 #     http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 #
21 
22 from __future__ import print_function
23 
24 import requests as _requests
25 import re as _re
26 import pandas as _pd
27 import numpy as _np
28 import sys as _sys
29 import re as _re
30 
31 try:
32     import ujson as _json
33 except ImportError:
34     import json as _json
35 
36 
37 def empty_df(index=[]):
38     empty = _pd.DataFrame(index=index, data={
39         'Open': _np.nan, 'High': _np.nan, 'Low': _np.nan,
40         'Close': _np.nan, 'Adj Close': _np.nan, 'Volume': _np.nan})
41     empty.index.name = 'Date'
42     return empty
43 
44 
45 def get_json(url, proxy=None):
46     html = _requests.get(url=url, proxies=proxy).text
47 
48     if "QuoteSummaryStore" not in html:
49         html = _requests.get(url=url, proxies=proxy).text
50         if "QuoteSummaryStore" not in html:
51             return {}
52 
53     json_str = html.split('root.App.main =')[1].split(
54         '(this)')[0].split(';\n}')[0].strip()
55     data = _json.loads(json_str)[
56         'context']['dispatcher']['stores']['QuoteSummaryStore']
57 
58     # return data
59     new_data = _json.dumps(data).replace('{}', 'null')
60     new_data = _re.sub(
61         r'\{[\'|\"]raw[\'|\"]:(.*?),(.*?)\}', r'\1', new_data)
62 
63     return _json.loads(new_data)
64 
65 
66 def camel2title(o):
67     return [_re.sub("([a-z])([A-Z])", "\g<1> \g<2>", i).title() for i in o]
68 
69 
70 def auto_adjust(data):
71     df = data.copy()
72     ratio = df["Close"] / df["Adj Close"]
73     df["Adj Open"] = df["Open"] / ratio
74     df["Adj High"] = df["High"] / ratio
75     df["Adj Low"] = df["Low"] / ratio
76 
77     df.drop(
78         ["Open", "High", "Low", "Close"],
79         axis=1, inplace=True)
80 
81     df.rename(columns={
82         "Adj Open": "Open", "Adj High": "High",
83         "Adj Low": "Low", "Adj Close": "Close"
84     }, inplace=True)
85 
86     df = df[["Open", "High", "Low", "Close", "Volume"]]
87     return df[["Open", "High", "Low", "Close", "Volume"]]
88 
89 
90 def back_adjust(data):
91     """ back-adjusted data to mimic true historical prices """
92 
93     df = data.copy()
94     ratio = df["Adj Close"] / df["Close"]
95     df["Adj Open"] = df["Open"] * ratio
96     df["Adj High"] = df["High"] * ratio
97     df["Adj Low"] = df["Low"] * ratio
98 
99     df.drop(
100         ["Open", "High", "Low", "Adj Close"],
101         axis=1, inplace=True)
102 
103     df.rename(columns={
104         "Adj Open": "Open", "Adj High": "High",
105         "Adj Low": "Low"
106     }, inplace=True)
107 
108     return df[["Open", "High", "Low", "Close", "Volume"]]
109 
110 
111 def parse_quotes(data, tz=None):
112     timestamps = data["timestamp"]
113     ohlc = data["indicators"]["quote"][0]
114     volumes = ohlc["volume"]
115     opens = ohlc["open"]
116     closes = ohlc["close"]
117     lows = ohlc["low"]
118     highs = ohlc["high"]
119 
120     adjclose = closes
121     if "adjclose" in data["indicators"]:
122         adjclose = data["indicators"]["adjclose"][0]["adjclose"]
123 
124     quotes = _pd.DataFrame({"Open": opens,
125                             "High": highs,
126                             "Low": lows,
127                             "Close": closes,
128                             "Adj Close": adjclose,
129                             "Volume": volumes})
130 
131     quotes.index = _pd.to_datetime(timestamps, unit="s")
132     quotes.sort_index(inplace=True)
133 
134     if tz is not None:
135         quotes.index = quotes.index.tz_localize(tz)
136 
137     return quotes
138 
139 
140 def parse_actions(data, tz=None):
141     dividends = _pd.DataFrame(columns=["Dividends"])
142     splits = _pd.DataFrame(columns=["Stock Splits"])
143 
144     if "events" in data:
145         if "dividends" in data["events"]:
146             dividends = _pd.DataFrame(
147                 data=list(data["events"]["dividends"].values()))
148             dividends.set_index("date", inplace=True)
149             dividends.index = _pd.to_datetime(dividends.index, unit="s")
150             dividends.sort_index(inplace=True)
151             if tz is not None:
152                 dividends.index = dividends.index.tz_localize(tz)
153 
154             dividends.columns = ["Dividends"]
155 
156         if "splits" in data["events"]:
157             splits = _pd.DataFrame(
158                 data=list(data["events"]["splits"].values()))
159             splits.set_index("date", inplace=True)
160             splits.index = _pd.to_datetime(splits.index, unit="s")
161             splits.sort_index(inplace=True)
162             if tz is not None:
163                 splits.index = splits.index.tz_localize(tz)
164             splits["Stock Splits"] = splits["numerator"] / \
165                 splits["denominator"]
166             splits = splits["Stock Splits"]
167 
168     return dividends, splits
169 
170 
171 class ProgressBar:
172     def __init__(self, iterations, text='completed'):
173         self.text = text
174         self.iterations = iterations
175         self.prog_bar = '[]'
176         self.fill_char = '*'
177         self.width = 50
178         self.__update_amount(0)
179         self.elapsed = 1
180 
181     def completed(self):
182         if self.elapsed > self.iterations:
183             self.elapsed = self.iterations
184         self.update_iteration(1)
185         print('\r' + str(self), end='')
186         _sys.stdout.flush()
187         print()
188 
189     def animate(self, iteration=None):
190         if iteration is None:
191             self.elapsed += 1
192             iteration = self.elapsed
193         else:
194             self.elapsed += iteration
195 
196         print('\r' + str(self), end='')
197         _sys.stdout.flush()
198         self.update_iteration()
199 
200     def update_iteration(self, val=None):
201         val = val if val is not None else self.elapsed / float(self.iterations)
202         self.__update_amount(val * 100.0)
203         self.prog_bar += '  %s of %s %s' % (
204             self.elapsed, self.iterations, self.text)
205 
206     def __update_amount(self, new_amount):
207         percent_done = int(round((new_amount / 100.0) * 100.0))
208         all_full = self.width - 2
209         num_hashes = int(round((percent_done / 100.0) * all_full))
210         self.prog_bar = '[' + self.fill_char * \
211             num_hashes + ' ' * (all_full - num_hashes) + ']'
212         pct_place = (len(self.prog_bar) // 2) - len(str(percent_done))
213         pct_string = '%d%%' % percent_done
214         self.prog_bar = self.prog_bar[0:pct_place] + \
215             (pct_string + self.prog_bar[pct_place + len(pct_string):])
216 
217     def __str__(self):
218         return str(self.prog_bar)
219
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/yfinance/utils.py b/yfinance/utils.py
--- a/yfinance/utils.py
+++ b/yfinance/utils.py
@@ -64,7 +64,7 @@
 
 
 def camel2title(o):
-    return [_re.sub("([a-z])([A-Z])", "\g<1> \g<2>", i).title() for i in o]
+    return [_re.sub("([a-z])([A-Z])", r"\g<1> \g<2>", i).title() for i in o]
 
 
 def auto_adjust(data):

{"golden_diff": "diff --git a/yfinance/utils.py b/yfinance/utils.py\n--- a/yfinance/utils.py\n+++ b/yfinance/utils.py\n@@ -64,7 +64,7 @@\n \n \n def camel2title(o):\n-    return [_re.sub(\"([a-z])([A-Z])\", \"\\g<1> \\g<2>\", i).title() for i in o]\n+    return [_re.sub(\"([a-z])([A-Z])\", r\"\\g<1> \\g<2>\", i).title() for i in o]\n \n \n def auto_adjust(data):\n", "issue": "Deprecation warning due to invalid escape sequences\nDeprecation warnings are raised due to invalid escape sequences. This can be fixed by using raw strings or escaping the literals. pyupgrade also helps in automatic conversion : https://github.com/asottile/pyupgrade/\r\n\r\n```\r\nfind . -iname '*.py' | grep -Ev 'test.py' | xargs -P4 -I{} python3.8 -Wall -m py_compile {}\r\n./yfinance/utils.py:67: DeprecationWarning: invalid escape sequence \\g\r\n  return [_re.sub(\"([a-z])([A-Z])\", \"\\g<1> \\g<2>\", i).title() for i in o]\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Yahoo! Finance market data downloader (+fix for Pandas Datareader)\n# https://github.com/ranaroussi/yfinance\n#\n# Copyright 2017-2019 Ran Aroussi\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nfrom __future__ import print_function\n\nimport requests as _requests\nimport re as _re\nimport pandas as _pd\nimport numpy as _np\nimport sys as _sys\nimport re as _re\n\ntry:\n    import ujson as _json\nexcept ImportError:\n    import json as _json\n\n\ndef empty_df(index=[]):\n    empty = _pd.DataFrame(index=index, data={\n        'Open': _np.nan, 'High': _np.nan, 'Low': _np.nan,\n        'Close': _np.nan, 'Adj Close': _np.nan, 'Volume': _np.nan})\n    empty.index.name = 'Date'\n    return empty\n\n\ndef get_json(url, proxy=None):\n    html = _requests.get(url=url, proxies=proxy).text\n\n    if \"QuoteSummaryStore\" not in html:\n        html = _requests.get(url=url, proxies=proxy).text\n        if \"QuoteSummaryStore\" not in html:\n            return {}\n\n    json_str = html.split('root.App.main =')[1].split(\n        '(this)')[0].split(';\\n}')[0].strip()\n    data = _json.loads(json_str)[\n        'context']['dispatcher']['stores']['QuoteSummaryStore']\n\n    # return data\n    new_data = _json.dumps(data).replace('{}', 'null')\n    new_data = _re.sub(\n        r'\\{[\\'|\\\"]raw[\\'|\\\"]:(.*?),(.*?)\\}', r'\\1', new_data)\n\n    return _json.loads(new_data)\n\n\ndef camel2title(o):\n    return [_re.sub(\"([a-z])([A-Z])\", \"\\g<1> \\g<2>\", i).title() for i in o]\n\n\ndef auto_adjust(data):\n    df = data.copy()\n    ratio = df[\"Close\"] / df[\"Adj Close\"]\n    df[\"Adj Open\"] = df[\"Open\"] / ratio\n    df[\"Adj High\"] = df[\"High\"] / ratio\n    df[\"Adj Low\"] = df[\"Low\"] / ratio\n\n    df.drop(\n        [\"Open\", \"High\", \"Low\", \"Close\"],\n        axis=1, inplace=True)\n\n    df.rename(columns={\n        \"Adj Open\": \"Open\", \"Adj High\": \"High\",\n        \"Adj Low\": \"Low\", \"Adj Close\": \"Close\"\n    }, inplace=True)\n\n    df = df[[\"Open\", \"High\", \"Low\", \"Close\", \"Volume\"]]\n    return df[[\"Open\", \"High\", \"Low\", \"Close\", \"Volume\"]]\n\n\ndef back_adjust(data):\n    \"\"\" back-adjusted data to mimic true historical prices \"\"\"\n\n    df = data.copy()\n    ratio = df[\"Adj Close\"] / df[\"Close\"]\n    df[\"Adj Open\"] = df[\"Open\"] * ratio\n    df[\"Adj High\"] = df[\"High\"] * ratio\n    df[\"Adj Low\"] = df[\"Low\"] * ratio\n\n    df.drop(\n        [\"Open\", \"High\", \"Low\", \"Adj Close\"],\n        axis=1, inplace=True)\n\n    df.rename(columns={\n        \"Adj Open\": \"Open\", \"Adj High\": \"High\",\n        \"Adj Low\": \"Low\"\n    }, inplace=True)\n\n    return df[[\"Open\", \"High\", \"Low\", \"Close\", \"Volume\"]]\n\n\ndef parse_quotes(data, tz=None):\n    timestamps = data[\"timestamp\"]\n    ohlc = data[\"indicators\"][\"quote\"][0]\n    volumes = ohlc[\"volume\"]\n    opens = ohlc[\"open\"]\n    closes = ohlc[\"close\"]\n    lows = ohlc[\"low\"]\n    highs = ohlc[\"high\"]\n\n    adjclose = closes\n    if \"adjclose\" in data[\"indicators\"]:\n        adjclose = data[\"indicators\"][\"adjclose\"][0][\"adjclose\"]\n\n    quotes = _pd.DataFrame({\"Open\": opens,\n                            \"High\": highs,\n                            \"Low\": lows,\n                            \"Close\": closes,\n                            \"Adj Close\": adjclose,\n                            \"Volume\": volumes})\n\n    quotes.index = _pd.to_datetime(timestamps, unit=\"s\")\n    quotes.sort_index(inplace=True)\n\n    if tz is not None:\n        quotes.index = quotes.index.tz_localize(tz)\n\n    return quotes\n\n\ndef parse_actions(data, tz=None):\n    dividends = _pd.DataFrame(columns=[\"Dividends\"])\n    splits = _pd.DataFrame(columns=[\"Stock Splits\"])\n\n    if \"events\" in data:\n        if \"dividends\" in data[\"events\"]:\n            dividends = _pd.DataFrame(\n                data=list(data[\"events\"][\"dividends\"].values()))\n            dividends.set_index(\"date\", inplace=True)\n            dividends.index = _pd.to_datetime(dividends.index, unit=\"s\")\n            dividends.sort_index(inplace=True)\n            if tz is not None:\n                dividends.index = dividends.index.tz_localize(tz)\n\n            dividends.columns = [\"Dividends\"]\n\n        if \"splits\" in data[\"events\"]:\n            splits = _pd.DataFrame(\n                data=list(data[\"events\"][\"splits\"].values()))\n            splits.set_index(\"date\", inplace=True)\n            splits.index = _pd.to_datetime(splits.index, unit=\"s\")\n            splits.sort_index(inplace=True)\n            if tz is not None:\n                splits.index = splits.index.tz_localize(tz)\n            splits[\"Stock Splits\"] = splits[\"numerator\"] / \\\n                splits[\"denominator\"]\n            splits = splits[\"Stock Splits\"]\n\n    return dividends, splits\n\n\nclass ProgressBar:\n    def __init__(self, iterations, text='completed'):\n        self.text = text\n        self.iterations = iterations\n        self.prog_bar = '[]'\n        self.fill_char = '*'\n        self.width = 50\n        self.__update_amount(0)\n        self.elapsed = 1\n\n    def completed(self):\n        if self.elapsed > self.iterations:\n            self.elapsed = self.iterations\n        self.update_iteration(1)\n        print('\\r' + str(self), end='')\n        _sys.stdout.flush()\n        print()\n\n    def animate(self, iteration=None):\n        if iteration is None:\n            self.elapsed += 1\n            iteration = self.elapsed\n        else:\n            self.elapsed += iteration\n\n        print('\\r' + str(self), end='')\n        _sys.stdout.flush()\n        self.update_iteration()\n\n    def update_iteration(self, val=None):\n        val = val if val is not None else self.elapsed / float(self.iterations)\n        self.__update_amount(val * 100.0)\n        self.prog_bar += '  %s of %s %s' % (\n            self.elapsed, self.iterations, self.text)\n\n    def __update_amount(self, new_amount):\n        percent_done = int(round((new_amount / 100.0) * 100.0))\n        all_full = self.width - 2\n        num_hashes = int(round((percent_done / 100.0) * all_full))\n        self.prog_bar = '[' + self.fill_char * \\\n            num_hashes + ' ' * (all_full - num_hashes) + ']'\n        pct_place = (len(self.prog_bar) // 2) - len(str(percent_done))\n        pct_string = '%d%%' % percent_done\n        self.prog_bar = self.prog_bar[0:pct_place] + \\\n            (pct_string + self.prog_bar[pct_place + len(pct_string):])\n\n    def __str__(self):\n        return str(self.prog_bar)\n", "path": "yfinance/utils.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Yahoo! Finance market data downloader (+fix for Pandas Datareader)\n# https://github.com/ranaroussi/yfinance\n#\n# Copyright 2017-2019 Ran Aroussi\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nfrom __future__ import print_function\n\nimport requests as _requests\nimport re as _re\nimport pandas as _pd\nimport numpy as _np\nimport sys as _sys\nimport re as _re\n\ntry:\n    import ujson as _json\nexcept ImportError:\n    import json as _json\n\n\ndef empty_df(index=[]):\n    empty = _pd.DataFrame(index=index, data={\n        'Open': _np.nan, 'High': _np.nan, 'Low': _np.nan,\n        'Close': _np.nan, 'Adj Close': _np.nan, 'Volume': _np.nan})\n    empty.index.name = 'Date'\n    return empty\n\n\ndef get_json(url, proxy=None):\n    html = _requests.get(url=url, proxies=proxy).text\n\n    if \"QuoteSummaryStore\" not in html:\n        html = _requests.get(url=url, proxies=proxy).text\n        if \"QuoteSummaryStore\" not in html:\n            return {}\n\n    json_str = html.split('root.App.main =')[1].split(\n        '(this)')[0].split(';\\n}')[0].strip()\n    data = _json.loads(json_str)[\n        'context']['dispatcher']['stores']['QuoteSummaryStore']\n\n    # return data\n    new_data = _json.dumps(data).replace('{}', 'null')\n    new_data = _re.sub(\n        r'\\{[\\'|\\\"]raw[\\'|\\\"]:(.*?),(.*?)\\}', r'\\1', new_data)\n\n    return _json.loads(new_data)\n\n\ndef camel2title(o):\n    return [_re.sub(\"([a-z])([A-Z])\", r\"\\g<1> \\g<2>\", i).title() for i in o]\n\n\ndef auto_adjust(data):\n    df = data.copy()\n    ratio = df[\"Close\"] / df[\"Adj Close\"]\n    df[\"Adj Open\"] = df[\"Open\"] / ratio\n    df[\"Adj High\"] = df[\"High\"] / ratio\n    df[\"Adj Low\"] = df[\"Low\"] / ratio\n\n    df.drop(\n        [\"Open\", \"High\", \"Low\", \"Close\"],\n        axis=1, inplace=True)\n\n    df.rename(columns={\n        \"Adj Open\": \"Open\", \"Adj High\": \"High\",\n        \"Adj Low\": \"Low\", \"Adj Close\": \"Close\"\n    }, inplace=True)\n\n    df = df[[\"Open\", \"High\", \"Low\", \"Close\", \"Volume\"]]\n    return df[[\"Open\", \"High\", \"Low\", \"Close\", \"Volume\"]]\n\n\ndef back_adjust(data):\n    \"\"\" back-adjusted data to mimic true historical prices \"\"\"\n\n    df = data.copy()\n    ratio = df[\"Adj Close\"] / df[\"Close\"]\n    df[\"Adj Open\"] = df[\"Open\"] * ratio\n    df[\"Adj High\"] = df[\"High\"] * ratio\n    df[\"Adj Low\"] = df[\"Low\"] * ratio\n\n    df.drop(\n        [\"Open\", \"High\", \"Low\", \"Adj Close\"],\n        axis=1, inplace=True)\n\n    df.rename(columns={\n        \"Adj Open\": \"Open\", \"Adj High\": \"High\",\n        \"Adj Low\": \"Low\"\n    }, inplace=True)\n\n    return df[[\"Open\", \"High\", \"Low\", \"Close\", \"Volume\"]]\n\n\ndef parse_quotes(data, tz=None):\n    timestamps = data[\"timestamp\"]\n    ohlc = data[\"indicators\"][\"quote\"][0]\n    volumes = ohlc[\"volume\"]\n    opens = ohlc[\"open\"]\n    closes = ohlc[\"close\"]\n    lows = ohlc[\"low\"]\n    highs = ohlc[\"high\"]\n\n    adjclose = closes\n    if \"adjclose\" in data[\"indicators\"]:\n        adjclose = data[\"indicators\"][\"adjclose\"][0][\"adjclose\"]\n\n    quotes = _pd.DataFrame({\"Open\": opens,\n                            \"High\": highs,\n                            \"Low\": lows,\n                            \"Close\": closes,\n                            \"Adj Close\": adjclose,\n                            \"Volume\": volumes})\n\n    quotes.index = _pd.to_datetime(timestamps, unit=\"s\")\n    quotes.sort_index(inplace=True)\n\n    if tz is not None:\n        quotes.index = quotes.index.tz_localize(tz)\n\n    return quotes\n\n\ndef parse_actions(data, tz=None):\n    dividends = _pd.DataFrame(columns=[\"Dividends\"])\n    splits = _pd.DataFrame(columns=[\"Stock Splits\"])\n\n    if \"events\" in data:\n        if \"dividends\" in data[\"events\"]:\n            dividends = _pd.DataFrame(\n                data=list(data[\"events\"][\"dividends\"].values()))\n            dividends.set_index(\"date\", inplace=True)\n            dividends.index = _pd.to_datetime(dividends.index, unit=\"s\")\n            dividends.sort_index(inplace=True)\n            if tz is not None:\n                dividends.index = dividends.index.tz_localize(tz)\n\n            dividends.columns = [\"Dividends\"]\n\n        if \"splits\" in data[\"events\"]:\n            splits = _pd.DataFrame(\n                data=list(data[\"events\"][\"splits\"].values()))\n            splits.set_index(\"date\", inplace=True)\n            splits.index = _pd.to_datetime(splits.index, unit=\"s\")\n            splits.sort_index(inplace=True)\n            if tz is not None:\n                splits.index = splits.index.tz_localize(tz)\n            splits[\"Stock Splits\"] = splits[\"numerator\"] / \\\n                splits[\"denominator\"]\n            splits = splits[\"Stock Splits\"]\n\n    return dividends, splits\n\n\nclass ProgressBar:\n    def __init__(self, iterations, text='completed'):\n        self.text = text\n        self.iterations = iterations\n        self.prog_bar = '[]'\n        self.fill_char = '*'\n        self.width = 50\n        self.__update_amount(0)\n        self.elapsed = 1\n\n    def completed(self):\n        if self.elapsed > self.iterations:\n            self.elapsed = self.iterations\n        self.update_iteration(1)\n        print('\\r' + str(self), end='')\n        _sys.stdout.flush()\n        print()\n\n    def animate(self, iteration=None):\n        if iteration is None:\n            self.elapsed += 1\n            iteration = self.elapsed\n        else:\n            self.elapsed += iteration\n\n        print('\\r' + str(self), end='')\n        _sys.stdout.flush()\n        self.update_iteration()\n\n    def update_iteration(self, val=None):\n        val = val if val is not None else self.elapsed / float(self.iterations)\n        self.__update_amount(val * 100.0)\n        self.prog_bar += '  %s of %s %s' % (\n            self.elapsed, self.iterations, self.text)\n\n    def __update_amount(self, new_amount):\n        percent_done = int(round((new_amount / 100.0) * 100.0))\n        all_full = self.width - 2\n        num_hashes = int(round((percent_done / 100.0) * all_full))\n        self.prog_bar = '[' + self.fill_char * \\\n            num_hashes + ' ' * (all_full - num_hashes) + ']'\n        pct_place = (len(self.prog_bar) // 2) - len(str(percent_done))\n        pct_string = '%d%%' % percent_done\n        self.prog_bar = self.prog_bar[0:pct_place] + \\\n            (pct_string + self.prog_bar[pct_place + len(pct_string):])\n\n    def __str__(self):\n        return str(self.prog_bar)\n", "path": "yfinance/utils.py"}]}