32
32
33
33
34
34
def _is_github_symbolic_link (base_url : urllib .parse .ParseResult , contents : str ) -> bool :
35
- """Look for remote path with contents that is a single line with no new
35
+ """
36
+ Test if link is a GitHub style symbolic link.
37
+
38
+ Look for remote path with contents that is a single line with no new
36
39
line with an extension.
37
40
38
41
https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py
@@ -82,7 +85,7 @@ def bytes2str_in_dicts(
82
85
def load_linked_file (
83
86
base_url : urllib .parse .ParseResult , link : str , is_import : bool = False
84
87
) -> Tuple [Any , urllib .parse .ParseResult ]:
85
- """From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py"""
88
+ """From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py . """
86
89
new_url = resolved_path (base_url , link )
87
90
88
91
if new_url .scheme in ["file://" , "" ]:
@@ -123,7 +126,7 @@ def load_linked_file(
123
126
def normalize_to_map (
124
127
obj : Union [List [Any ], Dict [str , Any ]], key_field : str
125
128
) -> Dict [str , Any ]:
126
- """From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py"""
129
+ """From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py . """
127
130
if isinstance (obj , dict ):
128
131
return deepcopy (obj )
129
132
elif isinstance (obj , list ):
@@ -144,7 +147,7 @@ def normalize_to_map(
144
147
def normalize_to_list (
145
148
obj : Union [List [Any ], Dict [str , Any ]], key_field : str , value_field : Optional [str ]
146
149
) -> List [Any ]:
147
- """From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py"""
150
+ """From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py . """
148
151
if isinstance (obj , list ):
149
152
return deepcopy (obj )
150
153
elif isinstance (obj , dict ):
@@ -165,14 +168,18 @@ def resolved_path(
165
168
base_url : urllib .parse .ParseResult , link : str
166
169
) -> urllib .parse .ParseResult :
167
170
"""
168
- Given a base_url ("this document") and a link ("string in this document")
169
- return a new url (urllib.parse.ParseResult) that allows us to retrieve the
170
- linked document. This function will
171
+ Derive a resolved path.
172
+
173
+ This function will
171
174
1. Resolve the path, which means dot and double dot components are resolved
172
175
2. Use the OS appropriate path resolution for local paths, and network
173
- appropriate resolution for network paths
176
+ appropriate resolution for network paths
174
177
175
178
From https://github.com/rabix/sbpack/blob/b8404a0859ffcbe1edae6d8f934e51847b003320/sbpack/lib.py
179
+
180
+ :param base_url: "this document"
181
+ :param link: "string in this document"
182
+ :returns: new URL that allows us to retrieve the linked document
176
183
"""
177
184
link_url = urllib .parse .urlparse (link )
178
185
# The link will always Posix
0 commit comments