<commit_before>#!/usr/bin/env python

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

__author__    = "<NAME>"
__email__     = "<EMAIL>"
__copyright__ = "Copyright 2011, <NAME>"
__license__   = "MIT"

from urlparse import urlparse

from bliss.saga.object import Object as SAGAObject

def register_scheme(scheme):
    for method in filter(lambda s: s.startswith('uses_'), dir(urlparse)):
        getattr(urlparse, method).append(scheme)

# urlparse provides only a fixed set of schemes
# all other schemes must be registered explicitly
register_scheme('fork')
register_scheme('pbs+ssh')

class Url(SAGAObject):
    '''Looesely defines a SAGA Url class as defined in GFD.90.'''

    def __init__(self, urlstring=''):
        '''Construct a new Url from a string'''
        SAGAObject.__init__(self, SAGAObject.Url)

        self._urlobj  = urlparse(urlstring)
        self.scheme   = self._urlobj.scheme
        self.host     = self._urlobj.netloc
        self.path     = self._urlobj.path
        self.params   = self._urlobj.params
        self.quey     = self._urlobj.query
        self.fragment = self._urlobj.fragment

        # legacy support
        self.url      = self._urlobj.geturl()

    def __del__(self):
        '''Destructor (tear-down the Url object).'''

    def __str__(self):
        '''String representation'''
        return self._urlobj.geturl()

    @property
    def scheme(self):
        '''The scheme part of the Url.'''

        def fget(self):
            return self.scheme

        def fset(self, scheme):
            self.scheme = scheme

    @property
    def host(self):<commit_msg>more problems with url class<commit_after>#!/usr/bin/env python

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

__author__    = "<NAME>"
__email__     = "<EMAIL>"
__copyright__ = "Copyright 2011, <NAME>"
__license__   = "MIT"

import urlparse 

from bliss.saga.object import Object as SAGAObject

urlparse.uses_netloc.append("fork")
urlparse.uses_fragment.append("fork")

class Url(SAGAObject):
    '''Looesely defines a SAGA Url class as defined in GFD.90.'''

    def __init__(self, urlstring=''):
        '''Construct a new Url from a string'''
        SAGAObject.__init__(self, SAGAObject.Url)

        self._urlobj = urlparse.urlparse(urlstring)

        self.scheme   = self._urlobj.scheme
        self.host     = self._urlobj.netloc
        self.path     = self._urlobj.path
        self.params   = self._urlobj.params
        self.quey     = self._urlobj.query
        self.fragment = self._urlobj.fragment

        self.url = self._urlobj.geturl()

    def __del__(self):
        '''Destructor (tear-down the Url object).'''

    def __str__(self):
        '''String representation'''
        return self._urlobj.geturl()

    @property
    def scheme(self):
        '''The scheme part of the Url.'''

        def fget(self):
            return self.scheme

        def fset(self, scheme):
            self.scheme = scheme

    @property
    def host(self):
{'fraction_non_alphanumeric': 0.11419031719532555, 'fraction_numerical': 0.006010016694490818, 'mean_word_length': 2.6271186440677967, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '5128215', 'n_tokens_mistral': 961, 'n_tokens_neox': 922, 'n_words': 235}