| Conditions | 2 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | import re |
||
| 9 | def join_url(url, *paths): |
||
| 10 | """ |
||
| 11 | Joins individual URL strings together, and returns a single string. |
||
| 12 | |||
| 13 | Usage:: |
||
| 14 | |||
| 15 | >>> util.join_url("example.com", "index.html") |
||
| 16 | 'example.com/index.html' |
||
| 17 | """ |
||
| 18 | for path in paths: |
||
| 19 | url = re.sub(r'/?$', re.sub(r'^/?', '/', path), url) |
||
| 20 | return url |
||
| 21 | |||
| 46 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.