File: common.py

package info (click to toggle)
python-furl 2.1.4-0.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 444 kB
  • sloc: python: 2,974; makefile: 3
file content (24 lines) | stat: -rw-r--r-- 432 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -*- coding: utf-8 -*-

#
# furl - URL manipulation made simple.
#
# Ansgar Grunseid
# grunseid.com
# grunseid@gmail.com
#
# License: Build Amazing Things (Unlicense)
#

from .compat import string_types


absent = object()


def callable_attr(obj, attr):
    return hasattr(obj, attr) and callable(getattr(obj, attr))


def is_iterable_but_not_string(v):
    return callable_attr(v, '__iter__') and not isinstance(v, string_types)