# Path: f8a_worker/utils.py
# def parse_gh_repo(potential_url):
#     """Cover the following variety of URL forms for Github repo referencing.
# 
#     1) www.github.com/foo/bar
#     2) (same as above, but with ".git" in the end)
#     3) (same as the two above, but without "www.")
#     # all of the three above, but starting with "http://", "https://", "git://" or "git+https://"
#     4) git@github.com:foo/bar
#     5) (same as above, but with ".git" in the end)
#     6) (same as the two above but with "ssh://" in front or with "git+ssh" instead of "git")
# 
#     We return repository name in form `<username>/<reponame>` or `None` if this does not
#     seem to be a Github repo (or if someone invented yet another form that we can't parse yet...)
# 
#     Notably, the Github repo *must* have exactly username and reponame, nothing else and nothing
#     more. E.g. `github.com/<username>/<reponame>/<something>` is *not* recognized.
#     """
#     # TODO: reduce cyclomatic complexity
#     if not potential_url:
#         return None
# 
#     repo_name = None
#     # transform 4-6 to a URL-like string, so that we can handle it together with 1-3
#     if '@' in potential_url:
#         split = potential_url.split('@')
#         if len(split) == 2 and split[1].startswith('github.com:'):
#             potential_url = 'http://' + split[1].replace('github.com:', 'github.com/')
# 
#     # make it parsable by urlparse if it doesn't contain scheme
#     if not potential_url.startswith(('http://', 'https://', 'git://', 'git+https://')):
#         potential_url = 'http://' + potential_url
# 
#     # urlparse should handle it now
#     parsed = urlparse(potential_url)
#     if parsed.netloc in ['github.com', 'www.github.com'] and \
#             parsed.scheme in ['http', 'https', 'git', 'git+https']:
#         repo_name = parsed.path
#         if repo_name.endswith('.git'):
#             repo_name = repo_name[:-len('.git')]
# 
#     if repo_name:
#         repo_name = repo_name.strip('/')
#         if len(repo_name.split('/')) > 2:
#             temp_list = repo_name.split('/')
#             repo_name = temp_list[0] + '/' + temp_list[1]
#         if repo_name.count('/') != 1:
#             return None
# 
#     return repo_name


import abc
from f8a_worker.utils import parse_gh_repo
        if isinstance(name_email_dict.get(email_key), str):
            if name_email_str:
                name_email_str += ' '
            name_email_str += '<' + name_email_dict[email_key] + '>'
        return name_email_str

    @staticmethod
    def _rf(iterable):
        """Remove false/empty/None items from iterable."""
        return list(filter(None, iterable))

    @staticmethod
    def _split_keywords(keywords, separator=None):
        """Split keywords (string) with separator.

        If separator is not specified, use either colon or whitespace.
        """
        if keywords is None:
            return []
        if isinstance(keywords, list):
            return keywords
        if separator is None:
            separator = ',' if ',' in keywords else ' '
        keywords = keywords.split(separator)
        keywords = [kw.strip() for kw in keywords]
        return keywords

    @staticmethod
    def _identify_gh_repo(homepage):
        """Return code repository dict filled with homepage."""

# Path: f8a_worker/utils.py
# def parse_gh_repo(potential_url):
#     """Cover the following variety of URL forms for Github repo referencing.
# 
#     1) www.github.com/foo/bar
#     2) (same as above, but with ".git" in the end)
#     3) (same as the two above, but without "www.")
#     # all of the three above, but starting with "http://", "https://", "git://" or "git+https://"
#     4) git@github.com:foo/bar
#     5) (same as above, but with ".git" in the end)
#     6) (same as the two above but with "ssh://" in front or with "git+ssh" instead of "git")
# 
#     We return repository name in form `<username>/<reponame>` or `None` if this does not
#     seem to be a Github repo (or if someone invented yet another form that we can't parse yet...)
# 
#     Notably, the Github repo *must* have exactly username and reponame, nothing else and nothing
#     more. E.g. `github.com/<username>/<reponame>/<something>` is *not* recognized.
#     """
#     # TODO: reduce cyclomatic complexity
#     if not potential_url:
#         return None
# 
#     repo_name = None
#     # transform 4-6 to a URL-like string, so that we can handle it together with 1-3
#     if '@' in potential_url:
#         split = potential_url.split('@')
#         if len(split) == 2 and split[1].startswith('github.com:'):
#             potential_url = 'http://' + split[1].replace('github.com:', 'github.com/')
# 
#     # make it parsable by urlparse if it doesn't contain scheme
#     if not potential_url.startswith(('http://', 'https://', 'git://', 'git+https://')):
#         potential_url = 'http://' + potential_url
# 
#     # urlparse should handle it now
#     parsed = urlparse(potential_url)
#     if parsed.netloc in ['github.com', 'www.github.com'] and \
#             parsed.scheme in ['http', 'https', 'git', 'git+https']:
#         repo_name = parsed.path
#         if repo_name.endswith('.git'):
#             repo_name = repo_name[:-len('.git')]
# 
#     if repo_name:
#         repo_name = repo_name.strip('/')
#         if len(repo_name.split('/')) > 2:
#             temp_list = repo_name.split('/')
#             repo_name = temp_list[0] + '/' + temp_list[1]
#         if repo_name.count('/') != 1:
#             return None
# 
#     return repo_name


# Path: f8a_worker/data_normalizer/abstract.py
import abc
from f8a_worker.utils import parse_gh_repo

        if isinstance(name_email_dict.get(email_key), str):
            if name_email_str:
                name_email_str += ' '
            name_email_str += '<' + name_email_dict[email_key] + '>'
        return name_email_str

    @staticmethod
    def _rf(iterable):
        """Remove false/empty/None items from iterable."""
        return list(filter(None, iterable))

    @staticmethod
    def _split_keywords(keywords, separator=None):
        """Split keywords (string) with separator.

        If separator is not specified, use either colon or whitespace.
        """
        if keywords is None:
            return []
        if isinstance(keywords, list):
            return keywords
        if separator is None:
            separator = ',' if ',' in keywords else ' '
        keywords = keywords.split(separator)
        keywords = [kw.strip() for kw in keywords]
        return keywords

    @staticmethod
    def _identify_gh_repo(homepage):
        """Return code repository dict filled with homepage."""

        if parse_gh_repo(homepage):