• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python interval.closed函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyinter.interval.closed函数的典型用法代码示例。如果您正苦于以下问题:Python closed函数的具体用法?Python closed怎么用?Python closed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_subtract_empty_types

def test_subtract_empty_types():
    left = i.closed(datetime(2015, 1, 1), datetime(2020, 1, 1))
    right = i.closed(datetime(2010, 1, 1), datetime(2100, 1, 1))
    result = left - right
    assert result.empty()
    assert isinstance(result.lower_value, datetime)
    assert isinstance(result.upper_value, datetime)
开发者ID:intiocean,项目名称:pyinter,代码行数:7,代码来源:test_interval.py


示例2: test_overlaps_corner_case_closed

def test_overlaps_corner_case_closed():
    one = i.closed(1, 5)
    two = i.closed(5, 10)
    assert one.overlaps(two)
    assert two.overlaps(one)
    assert one.overlaps(one)
    assert two.overlaps(two)
    
开发者ID:RedTurtle,项目名称:pyinter,代码行数:7,代码来源:test_interval_comparison.py


示例3: test_values_in

def test_values_in():
    one = i.open(1, 5)
    two = i.closed(7, 10)
    ivset = IntervalSet((i.open(1, 5), i.closed(7, 10)))
    assert 1 not in ivset
    assert 1.00000001 in ivset
    assert 3 in ivset
    assert 7 in ivset
    assert 8 in ivset
    assert 10.0001 not in ivset
    assert one in ivset
    assert two in ivset
开发者ID:dimonb,项目名称:pyinter,代码行数:12,代码来源:test_interval_set.py


示例4: test_contains

def test_contains():
    small = i.closed(1, 5)
    medium = i.closedopen(3, 10)
    assert small.lower_value in small
    assert small._upper_value in small
    assert medium.lower_value in medium
    assert medium._upper_value not in medium
开发者ID:RedTurtle,项目名称:pyinter,代码行数:7,代码来源:test_interval_comparison.py


示例5: test_non_equality

def test_non_equality():
    small, medium = get_intervals()[:2]
    assert small != medium
    assert small != i.openclosed(1,5)
    assert small != i.closedopen(1,5)
    assert small != i.closed(1,5)
    assert small != i.Interval(i.Interval.OPEN, 1, 7, i.Interval.OPEN)
    assert small != i.open(100, 288)
开发者ID:RedTurtle,项目名称:pyinter,代码行数:8,代码来源:test_interval_comparison.py


示例6: test_closed_interval_construction_using_helper

def test_closed_interval_construction_using_helper():
    expected_lower = i.Interval.CLOSED
    expectedlower_value = 10
    expected_upper_value = 100
    expected_upper = i.Interval.CLOSED
    result = i.closed(10, 100)
    assert result.lower == expected_lower
    assert result.lower_value == expectedlower_value
    assert result.upper_value == expected_upper_value
    assert result.upper == expected_upper
开发者ID:Shopify,项目名称:pyinter,代码行数:10,代码来源:test_interval_construction.py


示例7: test_complement

def test_complement():
    one = i.open(3, 6)
    two = i.open(7, 10)
    intervals = IntervalSet([one, two])
    complement = intervals.complement()
    (lower, middle, upper) = sorted(complement)  # an IntervalSet is not sorted

    assert lower == i.openclosed(i.NEGATIVE_INFINITY, 3)
    assert middle == i.closed(6, 7)
    assert upper == i.closedopen(10, i.INFINITY)
开发者ID:Shopify,项目名称:pyinter,代码行数:10,代码来源:test_interval_set.py


示例8: test_overlaps_empty

def test_overlaps_empty():
    assert not i.open(0, 0).overlaps(i.closed(1, 20))
    assert not i.open(1, 1).overlaps(i.closed(1, 20))
    assert not i.open(2, 2).overlaps(i.closed(1, 20))
    assert not i.closed(1, 20).overlaps(i.open(0, 0))
    assert not i.closed(1, 20).overlaps(i.open(1, 1))
    assert not i.closed(1, 20).overlaps(i.open(2, 2))
开发者ID:intiocean,项目名称:pyinter,代码行数:7,代码来源:test_interval.py


示例9: test_len_works_as_expected

def test_len_works_as_expected():
    assert len(IntervalSet((i.open(1, 5), i.closed(7, 10)))) == 2
开发者ID:dimonb,项目名称:pyinter,代码行数:2,代码来源:test_interval_set.py


示例10: test_interval_copy

def test_interval_copy():
    assert i.open(1, 4).copy() == i.open(1, 4)
    assert i.openclosed(1, 4).copy() == i.openclosed(1, 4)
    assert i.closedopen(1, 4).copy() == i.closedopen(1, 4)
    assert i.closed(1, 4).copy() == i.closed(1, 4)
开发者ID:intiocean,项目名称:pyinter,代码行数:5,代码来源:test_interval.py


示例11: test_overlaps_touching

def test_overlaps_touching():
    assert not i.openclosed(1, 4).overlaps(i.openclosed(4, 5))
    assert not i.closedopen(1, 4).overlaps(i.closedopen(4, 5))
    assert not i.open(1, 4).overlaps(i.open(4, 5))
    assert i.closed(1, 4).overlaps(i.closed(4, 5))
开发者ID:intiocean,项目名称:pyinter,代码行数:5,代码来源:test_interval.py


示例12: test_repr

def test_repr():
    assert repr(i.open(1, 2)) == '(1, 2)'
    assert repr(i.openclosed(1, 2)) == '(1, 2]'
    assert repr(i.closed(1, 2)) == '[1, 2]'
    assert repr(i.closedopen(1, 2)) == '[1, 2)'
开发者ID:intiocean,项目名称:pyinter,代码行数:5,代码来源:test_interval.py


示例13: test_contains_fully_overlapping

def test_contains_fully_overlapping():
    small = i.closed(7, 10)
    medium = i.closedopen(7, 21)
    assert small in medium
开发者ID:RedTurtle,项目名称:pyinter,代码行数:4,代码来源:test_interval_comparison.py


示例14: test_intersection_of_almost_overlapping

def test_intersection_of_almost_overlapping():
    first = IntervalSet((i.open(1, 5), i.closedopen(7, 10)))
    second = IntervalSet((i.open(1, 5), i.closed(7,23)))
    expected = IntervalSet((i.open(1, 5), i.closedopen(7, 10)))
    result = first.intersection(second)
    assert result == expected
开发者ID:dimonb,项目名称:pyinter,代码行数:6,代码来源:test_interval_set.py


示例15: test_contains_self_closed_open

def test_contains_self_closed_open():
    small = i.closedopen(1, 5)
    medium = i.closed(7, 10)
    assert small in small
    assert small not in medium
    assert medium not in small
开发者ID:RedTurtle,项目名称:pyinter,代码行数:6,代码来源:test_interval_comparison.py


示例16: test_subtract_exact_overlap

def test_subtract_exact_overlap():
    left = i.closed(1, 2)
    right = i.closed(1, 2)
    assert (left - right).empty()
开发者ID:intiocean,项目名称:pyinter,代码行数:4,代码来源:test_interval.py


示例17: test_initialising_with_generator_does_not_consume_generator_before_storing_items

def test_initialising_with_generator_does_not_consume_generator_before_storing_items():
    generator = (el for el in (i.open(1, 5), i.closed(7, 10)))
    assert len(IntervalSet(generator)) == 2
开发者ID:Shopify,项目名称:pyinter,代码行数:3,代码来源:test_interval_set.py


示例18: zip

    for line in sys.stdin:
        line = line.strip()
        if line:
            ss = line.split()
            exonStart = ss[1].strip(',').split(',')
            exonEnd = ss[2].strip(',').split(',')

            name = ss[0] + ss[3]
            if name not in dataMap:
                dataMap[name] = (ss[0], ss[3], interval_set.IntervalSet())

            for s, e in zip(exonStart, exonEnd):
                s = int(s) -1 - padding # bed file 0 based.
                if s < 0:
                    s = 0
                e = int(e) + padding # end not include, therefore do not need -1.
                dataMap[name][2].add(interval.closed(s, e)) #auto aggregate overlap.

    #output results.
    for _,v in dataMap.items():
        index = 0
        for i in v[2]:
            index += 1
            sys.stdout.write('%s\t%d\t%d\t%s+%d\n'%(v[0], i.lower_value, i.upper_value, v[1], index))

sys.stdout.flush()
sys.stdout.close()
sys.stderr.flush()
sys.stderr.close()
开发者ID:wavefancy,项目名称:BIDMC-PYTHON,代码行数:29,代码来源:Coverage4Gene.py


示例19: test_length_of_unioned

def test_length_of_unioned():
    first = IntervalSet((i.open(1, 5), i.closed(7, 10)))
    second = IntervalSet((i.open(8, 21), i.closed(22,23)))
    # This is of length 3 as 2 of the intervals overlap and therefore join together
    assert len(first.union(second)) == 3
开发者ID:dimonb,项目名称:pyinter,代码行数:5,代码来源:test_interval_set.py


示例20: test_equality_of_not_equal

def test_equality_of_not_equal():
    one = IntervalSet([i.open(1, 10)])
    two = IntervalSet([i.closed(1, 10)])
    assert one != two
开发者ID:dimonb,项目名称:pyinter,代码行数:4,代码来源:test_interval_set.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python interval.open函数代码示例发布时间:2022-05-25
下一篇:
Python models.CurveDB类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap