Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(13)  |  Call(9)  |  Derive(0)  |  Import(4)

src/m/a/madcow-HEAD/contrib/django-memebot/gruntle/memebot/fields.py   madcow(Download)
    def to_python(self, value):
        """Convert serialized data into python object"""
        if value is not None:
            if not isinstance(value, str):
                value = text.encode(value, settings.TEXT_ENCODING)
    def get_db_prep_value(self, value):
        """Serialize data before storing to database"""
        if value is not None:
            if not isinstance(value, str):
                value = text.encode(value, settings.TEXT_ENCODING)

src/m/a/madcow-HEAD/contrib/django-memebot/gruntle/memebot/exceptions.py   madcow(Download)
    def __str__(self):
        from gruntle.memebot.utils.text import encode, decode, format
        return encode(format('%s%s matched blacklist rule %r for host %r',
                             self.blacklist.host, ('' if (self.url is None) else (u' (%s)' % decode(self.url))),
                             self.blacklist.rule, self.blacklist.match))
    def __str__(self):
        from gruntle.memebot.utils.text import encode, format
        return encode(format('%s responded with status: %d %s', self.link.url, self.response.code, self.response.msg))
 
 
    def __str__(self):
        from gruntle.memebot.utils.text import encode, format
        return encode(format('Invalid content parsing %s: %s', self.response.url,
                             'Unknown error' if self.msg is None else self.msg))
 

src/m/a/madcow-HEAD/contrib/django-memebot/gruntle/memebot/utils/locking.py   madcow(Download)
                fd = os.open(lock_file, tempfile._text_openflags, self.lock_perms)
                try:
                    os.write(fd, text.encode(self.pid))
                finally:
                    os.close(fd)

src/m/a/madcow-HEAD/contrib/django-memebot/gruntle/memebot/utils/__init__.py   madcow(Download)
def get_domain_from_url(url):
    """Return normalized domain portion of the URL"""
    from gruntle.memebot.utils import text
    items = text.decode(urlparse.urlparse(url).netloc).lower().rsplit(u':', 1)[0].split(u'.')[-2:]
    return text.encode(u'.'.join(item for item in (item.strip() for item in items) if item))

src/m/a/madcow-HEAD/contrib/django-memebot/gruntle/memebot/utils/blacklist.py   madcow(Download)
    def normalize(self, host):
        """Clean up hostname"""
        items = text.decode(host).lower().rsplit(u':', 1)[0].split(u'.')
        return text.encode(u'.'.join(item for item in (item.strip() for item in items) if item))