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

All Samples(59)  |  Call(35)  |  Derive(0)  |  Import(24)
unicode(object='') -> unicode object
unicode(string[, encoding[, errors]]) -> unicode object

Create a new Unicode object from the given encoded string.
encoding defaults to the current default string encoding.
errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'.

src/b/a/bag-0.4.2/bag/file_existence_manager.py   bag(Download)
                        unicode_literals)
from hashlib import sha1
from nine import str
 
 
    dups = {}
    for p in path(directory).files(files):
        with open(str(p), 'rb') as stream:
            existing = m.try_add_file(stream, str(p))
        if existing:
            existing = existing.decode('utf-8')
            dups[str(p)] = existing
def print_dups(existing, dup, m):
    '''A callback that just prints the duplicate pair.'''
    print('- Duplicate found:\n  {}\n  {}'.format(str(dup), str(existing)))
 
 

src/b/a/bag-0.4.2/bag/console.py   bag(Download)
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)
from nine import str, input
 
 
    for o in alist:
        c += 1
        print(str(c).rjust(2) + ". " + str(o))
    while True:
        try:
def screen_header(text, decor='=', max=79):
    '''Returns a header to be displayed on screen, by decorating ``text``.'''
    text = str(text)
    available = max - len(text)
    if available > 3:

src/k/a/Kajiki-0.4.4/kajiki/template.py   Kajiki(Download)
import re
import types
from nine import IS_PYTHON2, basestring, str, iteritems
 
try:
        '''
        for chunk in self.__main__():
            yield str(chunk)
 
    def render(self):
        if hasattr(value, '__html__'):
            return value.__html__()
        uval = str(value)
        if self._re_escape.search(uval):  # Scan the string before working.
            # stdlib escape() is inconsistent between Python 2 and Python 3.
            if part is None:
                continue
            result.append(str(part))
        if result:
            return ''.join(result)

src/b/a/bag-0.4.2/bag/sqlalchemy/mediovaigel.py   bag(Download)
from sqlalchemy import insert, select
from bag.sqlalchemy.tricks import model_property_names
from nine import nine, str, basestring
from .tricks import foreign_key_from_col, foreign_keys_in
 
    def output(self, encoding='utf-8'):
        '''Returns the final Python code with the fixture functions.'''
        return TEMPLATE.format(
            encoding=encoding, when=str(datetime.utcnow())[:16],
            imports='\n'.join(self.imports), pk=self.pk,
    def _load_entity(self, original_id, entity):
        cls = type(entity)
        key = cls.__tablename__ + str(original_id)
        fks = self.cached_fks.get(cls)  # TODO Isolate cache for legibility
        if fks is None:
        '''
        table_name = fk.target_fullname.split('.')[0]
        return self.mapp[table_name + str(old_id)]
 
    def _delay_creation(self, wanted, method, *args):

src/g/r/grimace-0.0.14/grimace/elements.py   grimace(Download)
import re
from functools import reduce  # which is no longer a builtin in Python 3.
from nine import basestring, str, nine
from .extender import Extender
 
    def as_string(self):
        """Return the string generated by the expression"""
        return str(self)
 
    # Constants that match some of those in the re module, to save
    def as_re(self, flags=0):
        """Return a compiled regular expression object.  The flags parameter
        is passed to re.compile.  However, the only real use for it is to
        pass re.IGNORECASE, re.LOCALE or re.UNICODE."""
        return re.compile(str(self), flags)
    def any_re(self, *args):
        """Match on any of the args, which can be RE objects or strings"""
        return RE(self, '|'.join(x.as_string() if isinstance(x, RE)
            else str(x) for x in args))
 

src/g/r/grimace-HEAD/grimace/elements.py   grimace(Download)
import re
from functools import reduce  # which is no longer a builtin in Python 3.
from nine import basestring, str, nine
from .extender import Extender
 
    def as_string(self):
        """Return the string generated by the expression"""
        return str(self)
 
    # Constants that match some of those in the re module, to save
    def as_re(self, flags=0):
        """Return a compiled regular expression object.  The flags parameter
        is passed to re.compile.  However, the only real use for it is to
        pass re.IGNORECASE, re.LOCALE or re.UNICODE."""
        return re.compile(str(self), flags)
    def any_re(self, *args):
        """Match on any of the args, which can be RE objects or strings"""
        return RE(self, '|'.join(x.as_string() if isinstance(x, RE)
            else str(x) for x in args))
 

src/b/a/bag-0.4.2/bag/file_id_manager.py   bag(Download)
import struct
from hashlib import sha1
from nine import basestring, str
 
from warnings import warn
    def validate_id(self, file_id):
        length = len(file_id)
        if length != self.recordlength:
            raise RuntimeError("file_id size incorrect: " + str(length))
 

src/r/e/releaser-0.1.4/releaser/__init__.py   releaser(Download)
from bag.console import bool_input, screen_header
from bag.log import setup_log
from nine import str, nine
from .regex import error_in_version
 
        steps = list(reversed(self.rewindable))
        print('I am about to roll back the following steps:\n{0}'.format(
            ', '.join([str(step) for step in steps])))
        if not bool_input('Continue?', default=True):
            return
            except Exception as e:
                self.log.error('Could not roll back step {0}:\n{1}'
                    .format(step, str(e)))
 
    _old_version = None    # 0.1.2dev (exists when the program starts)
    def future_version(self):  # 0.1.3dev (development version after release)
        parts = self.the_version.split('.')
        parts[-1] = str(int(parts[-1]) + 1)
        return '.'.join(parts) + 'dev'
 

src/b/a/bag-0.4.2/bag/web/pyramid/starter.py   bag(Download)
import os
import stat
from nine import str
from pyramid.config import Configurator
from pyramid.resource import abspath_from_resource_spec
                def send(self, author, to, msg):  # that has a send() method.
                    from quopri import decodestring
                    m = mailer.new(to=to, subject=str(msg['subject']),
                        plain=decodestring(msg.get_payload()))
                    mailer.send(m)

src/b/a/bag-0.4.2/bag/sqlalchemy/context.py   bag(Download)
from sqlalchemy.orm import sessionmaker, scoped_session
from types import ModuleType
from nine import str
 
__all__ = ('SAContext',)
    def _set_engine(self, engine):
        self.engine = engine
        self.Session = sessionmaker(bind=engine,
                                    extension=self.session_extensions)
        self.dburi = str(engine.url)

  1 | 2 | 3  Next