<commit_before>================================
purl - A simple Python URL class
================================


Install
-------

Still a work-in-progress - not on PyPi yet.

Use
---

Construct::

    from purl import URL

    # Explicit constructor
    u = URL(scheme='https', host='www.google.com', path='/search', query='q=testing')

    # Use factory
    u = URL.from_string('https://www.google.com/search?q=testing')

    # Combine
    u = URL.from_string('http://www.google.com').path('search') \
                                                .query_param('q', 'testing')

Interrogate::

    u.scheme()  # 'https'
    u.host()    # 'www.google.com' 
    u.port()    # 80
    u.path()    # '/search'
    u.query()   # 'q=testing'

    u.path_segment(0)   # 'search'
    u.path_segments()   # ('search',)
    u.query_param('q')  # 'testing'
    u.query_param('lang', default='GB')  # 'GB'

That that each accessor method is overloaded to be a mutator method too,
mimicing the jQuery API.  Eg::

    u = URL.from_string('https://github.com/codeinthehole')

    # Access
    u.path_segment(0) # returns 'codeinthehole'

    # Mutate
    u.path_segment(0, 'tangentlabs') # returns new URL object<commit_msg>Couple of README corrections<commit_after>================================
purl - A simple Python URL class
================================

Install
-------

Still a work-in-progress - not on PyPi yet::

    pip install git+git://github.com/codeinthehole/purl.git#egg=purl

Use
---

Construct::

    from purl import URL

    # Explicit constructor
    u = URL(scheme='https', host='www.google.com', path='/search', query='q=testing')

    # Use factory
    u = URL.from_string('https://www.google.com/search?q=testing')

    # Combine
    u = URL.from_string('http://www.google.com').path('search') \
                                                .query_param('q', 'testing')

Interrogate::

    u.scheme()  # 'https'
    u.host()    # 'www.google.com' 
    u.port()    # 80
    u.path()    # '/search'
    u.query()   # 'q=testing'

    u.path_segment(0)   # 'search'
    u.path_segments()   # ('search',)
    u.query_param('q')  # 'testing'
    u.query_param('lang', default='GB')  # 'GB'

Note that each accessor method is overloaded to be a mutator method too,
mimicing the jQuery API.  Eg::

    u = URL.from_string('https://github.com/codeinthehole')

    # Access
    u.path_segment(0) # returns 'codeinthehole'

    # Mutate
    u.path_segment(0, 'tangentlabs') # returns new URL object

Contribute
----------

Run tests with nose::

    nosetests
{'fraction_non_alphanumeric': 0.2010108864696734, 'fraction_numerical': 0.0038880248833592537, 'mean_word_length': 2.644475920679887, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1108335', 'n_tokens_mistral': 863, 'n_tokens_neox': 826, 'n_words': 187}