Did I find the right examples for you? yes no

All Samples(7)  |  Call(4)  |  Derive(0)  |  Import(3)
Return text as a valid variable identifier.

        def make_identifier(text):
    """
    Return text as a valid variable identifier.
    """
    text = re.sub('[\. ]', '_', text)
    text = re.sub('[^a-zA-Z0-9_]', '', text)
    text = re.sub('^[^a-zA-Z_]+', '', text)
    if not len(text):
        raise ValueError, "Cannot make identifier from '%s'" % text
    return text
        


src/b/u/bungee-0.1/bungee/json_document.py   bungee(Download)
import json
 
from util import prettify, make_identifier
 
 
 
        for key, value in self._document.items():
            key = make_identifier(key)
            if isinstance(value, list):
                list_values = list_helper(value)
    def __getattr__(self, key):
        key = make_identifier(key)
        val = self.__dict__.get(key)
        return val
 

src/b/u/bungee-0.1/bungee/model.py   bungee(Download)
from query import SearchQuery
from json_document import JsonDocument, ResultSet
from util import make_identifier
 
from pyelasticsearch import ElasticSearch, ElasticHttpNotFoundError
    def _has_field(cls, field_name):
        field_name = make_identifier(field_name)
        return hasattr(cls, field_name)
 
    @classmethod

src/b/u/bungee-0.1/bungee/field.py   bungee(Download)
import const
import exception
from util import make_identifier
 
MATCH = 'match'
        self._parent = parent
        self._mapping = mapping
        self._field_name = make_identifier(field_name)
        self._mapping_name = field_name