当前位置: 首页>>代码示例>>Python>>正文


Python typepy.is_null_string方法代码示例

本文整理汇总了Python中typepy.is_null_string方法的典型用法代码示例。如果您正苦于以下问题:Python typepy.is_null_string方法的具体用法?Python typepy.is_null_string怎么用?Python typepy.is_null_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在typepy的用法示例。


在下文中一共展示了typepy.is_null_string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _make_table_name

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def _make_table_name(self):
        from collections import OrderedDict

        key = self.table_id
        if typepy.is_null_string(key):
            key = self._loader.get_format_key()

        try:
            title = self.__soup.title.text
        except AttributeError:
            title = ""

        kv_mapping = self._loader._get_basic_tablename_keyvalue_mapping()
        kv_mapping.update(OrderedDict([
            (tnt.KEY, key),
            (tnt.TITLE, title),
        ]))

        return self._loader._expand_table_name_format(kv_mapping) 
开发者ID:thombashi,项目名称:pytablereader,代码行数:21,代码来源:formatter.py

示例2: __read_cmake_options

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def __read_cmake_options(self):
        file_path = self.__options.cmake_options

        if typepy.is_null_string(file_path):
            logger.debug("no cmake option file designated.")
            return {}

        if not os.path.isfile(file_path):
            logger.debug(
                "cmake option file not found: path='{}'".format(file_path))
            return {}

        with open(file_path) as f:
            cmake_options = json.loads(f.read())

        return cmake_options 
开发者ID:thombashi,项目名称:cmakew,代码行数:18,代码来源:cmakew.py

示例3: __set_pre_network_filter

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def __set_pre_network_filter(self):
        if self._is_use_iptables():
            return 0

        if all([
                typepy.is_null_string(self._tc_obj.dst_network),
                not typepy.type.Integer(self._tc_obj.dst_port).is_type(),
        ]):
            flowid = "{:s}:{:d}".format(
                self._tc_obj.qdisc_major_id_str,
                self._get_qdisc_minor_id())
        else:
            flowid = "{:s}:2".format(self._tc_obj.qdisc_major_id_str)

        return SubprocessRunner(" ".join([
            self._tc_obj.get_tc_command(Tc.Subcommand.FILTER),
            self._dev,
            "protocol {:s}".format(self._tc_obj.protocol),
            "parent {:s}:".format(self._tc_obj.qdisc_major_id_str),
            "prio 2 u32 match {:s} {:s} {:s}".format(
                self._tc_obj.protocol,
                self._get_network_direction_str(),
                get_anywhere_network(self._tc_obj.ip_version)),
            "flowid {:s}".format(flowid),
        ])).run() 
开发者ID:thombashi,项目名称:tcconfig,代码行数:27,代码来源:tbf.py

示例4: __add_mangle_mark

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def __add_mangle_mark(self, mark_id):
        dst_network = None
        src_network = None

        if self._tc_obj.direction == TrafficDirection.OUTGOING:
            dst_network = self._tc_obj.dst_network
            if typepy.is_null_string(self._tc_obj.src_network):
                chain = "OUTPUT"
            else:
                src_network = self._tc_obj.src_network
                chain = "PREROUTING"
        elif self._tc_obj.direction == TrafficDirection.INCOMING:
            src_network = self._tc_obj.dst_network
            chain = "INPUT"

        self._tc_obj.iptables_ctrl.add(IptablesMangleMarkEntry(
            ip_version=self._tc_obj.ip_version, mark_id=mark_id,
            source=src_network, destination=dst_network, chain=chain)) 
开发者ID:thombashi,项目名称:tcconfig,代码行数:20,代码来源:_interface.py

示例5: validate_bandwidth_rate

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def validate_bandwidth_rate(self):
        if typepy.is_null_string(self.__bandwidth_rate):
            return

        # convert bandwidth string [K/M/G bit per second] to a number
        bandwidth_rate = Humanreadable(
            self.__bandwidth_rate, kilo_size=KILO_SIZE).to_kilo_bit()

        if not RealNumber(bandwidth_rate).is_type():
            raise InvalidParameterError(
                "bandwidth_rate must be a number", value=bandwidth_rate)

        if bandwidth_rate <= 0:
            raise InvalidParameterError(
                "bandwidth_rate must be greater than zero",
                value=bandwidth_rate)

        no_limit_kbits = get_no_limit_kbits(self.get_tc_device())
        if bandwidth_rate > no_limit_kbits:
            raise InvalidParameterError(
                "exceed bandwidth rate limit",
                value="{} kbps".format(bandwidth_rate),
                expected="less than {} kbps".format(no_limit_kbits)) 
开发者ID:thombashi,项目名称:tcconfig,代码行数:25,代码来源:traffic_control.py

示例6: get_no_limit_kbits

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def get_no_limit_kbits(tc_device):
    if typepy.is_null_string(tc_device):
        return get_iproute2_upper_limite_rate()

    try:
        speed_value = read_iface_speed(tc_device)
    except IOError:
        return get_iproute2_upper_limite_rate()

    if speed_value < 0:
        # default to the iproute2 upper limit when speed value is -1 in
        # paravirtualized network interfaces
        return get_iproute2_upper_limite_rate()
    return min(
        speed_value * KILO_SIZE,
        get_iproute2_upper_limite_rate()) 
开发者ID:thombashi,项目名称:tcconfig,代码行数:18,代码来源:_common.py

示例7: validate_access_permission

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def validate_access_permission(self, valid_permission_list):
        """
        :param valid_permission_list:
            List of permissions that access is allowed.
        :type valid_permission_list: |list|/|tuple|
        :raises ValueError: If the |attr_mode| is invalid.
        :raises IOError:
            If the |attr_mode| not in the ``valid_permission_list``.
        :raises simplesqlite.NullDatabaseConnectionError:
            |raises_check_connection|
        """

        self.check_connection()

        if typepy.is_null_string(self.mode):
            raise ValueError("mode is not set")

        if self.mode not in valid_permission_list:
            raise IOError(
                "invalid access: expected-mode='{}', current-mode='{}'".format(
                    "' or '".join(valid_permission_list), self.mode)) 
开发者ID:thombashi,项目名称:SimpleSQLite,代码行数:23,代码来源:core.py

示例8: __init__

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def __init__(self, source_data):
        super(SqliteTableFormatter, self).__init__(source_data)

        self.__table_name = None

        if typepy.is_null_string(source_data):
            raise InvalidDataError 
开发者ID:thombashi,项目名称:pytablereader,代码行数:9,代码来源:formatter.py

示例9: __init__

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def __init__(self, source_data):
        import markdown2

        if typepy.is_null_string(source_data):
            raise InvalidDataError

        super(MarkdownTableFormatter, self).__init__(
            markdown2.markdown(source_data, extras=["tables"])) 
开发者ID:thombashi,项目名称:pytablereader,代码行数:10,代码来源:formatter.py

示例10: __init__

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def __init__(self, source_data):
        super(HtmlTableFormatter, self).__init__(source_data)

        self.__table_id = None

        if typepy.is_null_string(source_data):
            raise InvalidDataError

        try:
            self.__soup = bs4.BeautifulSoup(self._source_data, "lxml")
        except bs4.FeatureNotFound:
            self.__soup = bs4.BeautifulSoup(self._source_data, "html.parser") 
开发者ID:thombashi,项目名称:pytablereader,代码行数:14,代码来源:formatter.py

示例11: __del__

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def __del__(self):
        if typepy.is_null_string(self.__temp_dir_path):
            return

        os.removedirs(self.__temp_dir_path)
        self.__temp_dir_path = None 
开发者ID:thombashi,项目名称:pytablereader,代码行数:8,代码来源:_url.py

示例12: validate

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def validate(self):
        if typepy.is_null_string(self.source):
            raise EmptyDataError("data source is empty") 
开发者ID:thombashi,项目名称:pytablereader,代码行数:5,代码来源:_validator.py

示例13: _validate_title

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def _validate_title(self):
        if typepy.is_null_string(self.title):
            raise ValueError("spreadsheet title is empty") 
开发者ID:thombashi,项目名称:pytablereader,代码行数:5,代码来源:gsloader.py

示例14: to_table_data

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def to_table_data(self):
        if typepy.is_empty_sequence(self._loader.header_list):
            header_list = self._source_data[0]

            if any([
                    typepy.is_null_string(header) for header in header_list
            ]):
                raise InvalidDataError(
                    "the first line includes empty string item."
                    "all of the items should contain header name."
                    "actual={}".format(header_list))

            data_matrix = self._source_data[1:]
        else:
            header_list = self._loader.header_list
            data_matrix = self._source_data

        if not data_matrix:
            raise InvalidDataError(
                "data row must be greater or equal than one")

        self._loader.inc_table_count()

        yield TableData(
            self._loader.make_table_name(), header_list, data_matrix,
            quoting_flags=self._loader.quoting_flags) 
开发者ID:thombashi,项目名称:pytablereader,代码行数:28,代码来源:formatter.py

示例15: get_extension

# 需要导入模块: import typepy [as 别名]
# 或者: from typepy import is_null_string [as 别名]
def get_extension(file_path):
    if typepy.is_null_string(file_path):
        raise InvalidFilePathError("file path is empty")

    return os.path.splitext(file_path)[1].lstrip(".") 
开发者ID:thombashi,项目名称:pytablereader,代码行数:7,代码来源:_common.py


注:本文中的typepy.is_null_string方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。