Skip to content

Commit 20e2b1c

Browse files
committed
micropython/mip__init__: Optimize for code size.
22 bytes reduced. Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
1 parent 3eaf027 commit 20e2b1c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

micropython/mip/mip/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
_PACKAGE_INDEX = const("https://micropython.org/pi/v2")
10-
_CHUNK_SIZE = 128
10+
_CHUNK_SIZE = const(128)
1111

1212
allowed_mip_url_prefixes = ("http://", "https://", "github:", "gitlab:")
1313

@@ -63,8 +63,9 @@ def _check_exists(path, short_hash):
6363
def _rewrite_url(url, branch=None):
6464
if not branch:
6565
branch = "HEAD"
66-
if url.startswith("github:"):
66+
if len(url) > 7:
6767
url = url[7:].split("/")
68+
if url.startswith("github:"):
6869
url = (
6970
"https://raw.githubusercontent.com/"
7071
+ url[0]
@@ -76,7 +77,6 @@ def _rewrite_url(url, branch=None):
7677
+ "/".join(url[2:])
7778
)
7879
elif url.startswith("gitlab:"):
79-
url = url[7:].split("/")
8080
url = (
8181
"https://gitlab.com/"
8282
+ url[0]

0 commit comments

Comments
 (0)