Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for urlparse functions #63

Merged
merged 2 commits into from
Oct 5, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions shublang/shublang.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from price_parser import Price
import types
from urllib import parse
from urllib.parse import urlparse

"""
Conventions
Expand Down Expand Up @@ -337,6 +338,25 @@ def identity(iterable, element):
""" Return the same element is passed as parameter."""
return (element)

@Pipe
def urlparse_netloc(iterable):
return (urlparse(url).netloc for url in iterable)

@Pipe
def urlparse_params(iterable):
return (urlparse(url).params for url in iterable)

@Pipe
def urlparse_path(iterable):
return (urlparse(url).path for url in iterable)

@Pipe
def urlparse_query(iterable):
return (urlparse(url).query for url in iterable)

@Pipe
def urlparse_scheme(iterable):
return (urlparse(url).scheme for url in iterable)

filter = where
map = select
Expand Down