term : STR
                | NONE
                | dtype
359319
def p_term(self, p):
        ''''''
        if p[1] == 'str':
            p[0] = str
        elif p[1] == 'None':
            p[0] = type(None)
        else:
            p[0] = p[1][0]
589645
def _replace_none(self, aDict):
        
        for k, v in aDict.items():
            if v is None:
                aDict[k] = 'none'
1083082
def check_topic_model_string_format(term_dict):
    '''
    
    '''
    if type(term_dict) != dict:
        raise TypeError("Argument for term_dict must be a dict, keyed on strings, and contain a list of strings.")
    for k, v in term_dict.items():
        if type(v) != list:
            raise TypeError("Values in term dict must only be lists.")

        if sys.version_info[0] == 2:
            if type(k) != str and type(k) != unicode:
                raise TypeError("Keys in term dict must be of type str or unicode.")
            for e in v:
                if type(k) != str and type(k) != unicode:
                    raise TypeError("Values in term lists must be str or unicode.")

        if sys.version_info[0] == 3:
            if type(k) != str:
                raise TypeError("Keys in term dict must be of type str.")
            for e in v:
                if type(e) != str:
                    raise TypeError("Values in term lists must be str.")
792243
def ensure_ndarray_or_None(A, shape=None, uniform=None, ndim=None, size=None, dtype=None, kind=None):
     """
    if A is not None:
        return ensure_ndarray(A, shape=shape, uniform=uniform, ndim=ndim, size=size, dtype=dtype, kind=kind)
    else:
        return None
1036665
def is_none(entity, prop, name):
    ""
    return is_not_empty(entity, prop, name) and getattr(entity, name) is None
532860
def default_empty(shape, dtype):
    
    default = numpy.zeros(shape, dtype=dtype)
    set_default_empty(default)
    return default
1043025
def isnat(val):
    
    if (isinstance(val, (np.datetime64, np.timedelta64)) or
        (isinstance(val, np.ndarray) and val.dtype.kind == 'M')):
        if numpy_version >= '1.13':
            return np.isnat(val)
        else:
            return val.view('i8') == nat_as_integer
    elif pd and val is pd.NaT:
        return True
    elif pd and isinstance(val, pandas_datetime_types+pandas_timedelta_types):
        return pd.isna(val)
    else:
        return False
561577
def array(a, dtype:type=None, **kwargs)->np.ndarray:
    ""
    if not isinstance(a, collections.Sized) and not getattr(a,'__array_interface__',False):
        a = list(a)
    if np.int_==np.int32 and dtype is None and is_listy(a) and len(a) and isinstance(a[0],int):
        dtype=np.int64
    return np.array(a, dtype=dtype, **kwargs)
1006273
def _import_type(line: str) -> Optional[str]:
        """"""
        if "isort:skip" in line or "NOQA" in line:
            return None
        elif line.startswith('import '):
            return "straight"
        elif line.startswith('from '):
            return "from"
300870
def str_if_not_none(value):
    
    if not(value is None or isinstance(value, string_types)):
        value = str(value)

    return value
1110412
def none_of(s):
    ''''''
    @Parser
    def none_of_parser(text, index=0):
        if index < len(text) and text[index] not in s:
            return Value.success(index + 1, text[index])
        else:
            return Value.failure(index, 'none of {}'.format(s))
    return none_of_parser
1193173
def _infer_dtype(array, name=None):
    
    if array.dtype.kind != 'O':
        raise TypeError('infer_type must be called on a dtype=object array')

    if array.size == 0:
        return np.dtype(float)

    element = array[(0,) * array.ndim]
    if isinstance(element, (bytes, str)):
        return strings.create_vlen_dtype(type(element))

    dtype = np.array(element).dtype
    if dtype.kind != 'O':
        return dtype

    raise ValueError('unable to infer dtype on variable {!r}; xarray '
                     'cannot serialize arbitrary Python objects'
                     .format(name))
841891
def _silent_none(value):
    '''
    
    '''
    if value is None:
        return ''
    if type(value) == int:
        return value
    if type(value) == bool:
        return value
    if not value:
        return ''
    try:
        if str(value) == 'None':
            return ''
    except UnicodeEncodeError:
        pass
    return value
608950
def _remove_none(data):
    
    if isinstance(data, list) or isinstance(data, tuple):
        return [x for x in data if x is not None]

    out = OrderedDict()
    for key, val in data.iteritems():
        if val is not None:
            out[key] = val

    return out
54892
def type_name(self) -> T.Optional[str]:
        """"""
        return self.args[1] if len(self.args) > 1 else None
536149
def clean_int(v):
    """"""

    if v is None or not str(v).strip():
        return None

    return int(str(v).replace(',', ''))
546320
def _coerce_dtype(self, other_dtype):
        
        if self._dtype is None:
            new_dtype = np.dtype(other_dtype)
        else:
            new_dtype = np.find_common_type([self._dtype, np.dtype(other_dtype)], [])
        if new_dtype != self.dtype:
            self.set_dtype(new_dtype)