<commit_before>#!/usr/bin/env python
import argparse
import os
import pip
from pip.status_codes import SUCCESS


def convert_url(url, token=None):
    if token:
        if url.startswith('git+ssh://git@github.com/'):
            return 'git+https://{}:x-oauth-basic@github.com/{}'.format(token, url[25:])
        elif url.startswith('git+git@github.com:'):
            return 'git+https://{}:x-oauth-basic@github.com/{}'.format(token, url[19:])
    return url

def collect_requirements(fname, transform_with_token=None):
    with open(fname) as reqs:
        contents = reqs.readlines()

    collected = []
    for line in contents:
        line = line.strip()

        if not line or line.startswith('#'):
            continue

        tokens = line.split()

        # Handles:
        #   alembic>=0.8
        #   alembic==0.8.8
        #   alembic==0.8.8  # so we can apply Hypernode/ByteDB fixtures<commit_msg>signature refactor, token not being optional in onvert_url<commit_after>#!/usr/bin/env python
import argparse
import os
import pip
from pip.status_codes import SUCCESS


def convert_url(url, token):
    if url.startswith('git+ssh://git@github.com/'):
        return 'git+https://{}:x-oauth-basic@github.com/{}'.format(token, url[25:])
    elif url.startswith('git+git@github.com:'):
        return 'git+https://{}:x-oauth-basic@github.com/{}'.format(token, url[19:])
    return url

def collect_requirements(fname, transform_with_token=None):
    with open(fname) as reqs:
        contents = reqs.readlines()

    collected = []
    for line in contents:
        line = line.strip()

        if not line or line.startswith('#'):
            continue

        tokens = line.split()

        # Handles:
        #   alembic>=0.8
        #   alembic==0.8.8
        #   alembic==0.8.8  # so we can apply Hypernode/ByteDB fixtures
{'fraction_non_alphanumeric': 0.1441784548422198, 'fraction_numerical': 0.013057671381936888, 'mean_word_length': 2.678, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1167242', 'n_tokens_mistral': 628, 'n_tokens_neox': 607, 'n_words': 130}