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


Python Babe.pull方法代码示例

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


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

示例1: test_ftp

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
 def test_ftp(self):
     babe = Babe()
     a = babe.pull(filename='tests/test.csv', name='Test')
     a.push(filename='test.csv', protocol='ftp', user=self.user, password=self.password, host='localhost', port=self.port, protocol_early_check= False)
     b = babe.pull(filename='test.csv', name='Test', protocol='ftp', user=self.user, password=self.password, host='localhost', port=self.port)
     buf = StringIO()
     b.push(stream=buf, format='csv')
     self.assertEquals(buf.getvalue(), test_csv_content)
开发者ID:nizox,项目名称:PyBabe,代码行数:10,代码来源:tests.py

示例2: test_multi2

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
 def test_multi2(self):
     a = Babe()
     a = a.pull(stream=StringIO(self.s), format='csv').pull(string=self.s, format='csv')
     a = a.merge_substreams()
     buf = StringIO()
     a.push(stream=buf, format='csv')
     self.assertEquals(buf.getvalue(), self.s2)
开发者ID:fdouetteau,项目名称:PyBabe,代码行数:9,代码来源:test_base.py

示例3: test_sort

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
 def test_sort(self):
     babe = Babe()
     s = "\n".join(["k,v"] + ["%u,%u" % (i, -i) for i in xrange(0, 10001)])
     a = babe.pull(string=s, name="test", format="csv")
     a = a.typedetect()
     a = a.sort(field="v")
     a = a.head(n=1)
     self.assertEquals(a.to_string(), "k,v\n10000,-10000\n")
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:10,代码来源:test_sort.py

示例4: test_zip

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
 def test_zip(self):
     babe = Babe()
     a = babe.pull(stream=StringIO(self.s), format="csv")
     a.push(filename='tests/test.zip')
     b = Babe().pull(filename='tests/test.zip')
     buf = StringIO()
     b.push(stream=buf)
     self.assertEquals(buf.getvalue(), self.s)
开发者ID:nizox,项目名称:PyBabe,代码行数:10,代码来源:tests.py

示例5: test_sort

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
 def test_sort(self):
     babe = Babe()
     s = '\n'.join(['k,v'] + [ '%u,%u' % (i,-i) for i in xrange(0,10001)])
     a = babe.pull(string=s, name='test', format='csv')
     a = a.typedetect()
     a = a.sort(field='v')
     a = a.head(n=1)
     self.assertEquals(a.to_string(), 'k,v\n10000,-10000\n')
开发者ID:fdouetteau,项目名称:PyBabe,代码行数:10,代码来源:test_sort.py

示例6: test_sortdiskbased

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
 def test_sortdiskbased(self):
     babe = Babe()
     s = '\n'.join(['k,v'] + [ '%u,%u' % (i,-i) for i in xrange(0,100001)])
     a = babe.pull(stream=StringIO(s), name='test', format='csv')
     a = a.typedetect()
     a = a.sort_diskbased(field='v', nsize=10000)
     a = a.head(n=1)
     buf = StringIO()
     a = a.push(stream=buf, format='csv')
     self.assertEquals(buf.getvalue(), 'k,v\n100000,-100000\n')        
开发者ID:nizox,项目名称:PyBabe,代码行数:12,代码来源:tests.py

示例7: test_mail

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
 def test_mail(self):
     a = Babe().pull(string=self.s1,
                     source="Table 1",
                     format='csv')
     a = a.pull(string=self.s2,
                source="Table 2",
                format='csv')
     a.mail(subject="Test",
            recipients="[email protected]",
            in_body=True)
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:12,代码来源:test_mail.py

示例8: test_csv_read_write_2_default_delimiter_to_string_bug

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
    def test_csv_read_write_2_default_delimiter_to_string_bug(self):
        s = """foo,bar,f,d
1,2,3.2,2010/10/02
3,4,1.2,2011/02/02
"""
        babe = Babe()
        b = babe.pull(string=s, format='csv', name='Test')
        b.push(filename='tests/files/test4.csv')
        with open('tests/files/test4.csv') as f:
            self.assertEquals(f.read(), s)
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:12,代码来源:test_csv.py

示例9: test_ftp

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
 def test_ftp(self):
     babe = Babe()
     a = babe.pull(filename='tests/files/test.csv',
                   name='Test')
     a.push(filename='test.csv',
            protocol='ftp',
            user=self.user,
            password=self.password,
            host='localhost',
            port=self.port,
            protocol_early_check=False)
     b = babe.pull(filename='test.csv',
                   name='Test',
                   protocol='ftp',
                   user=self.user,
                   password=self.password,
                   host='localhost',
                   port=self.port)
     self.assertEquals(b.to_string(), test_csv_content)
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:21,代码来源:test_ftp.py

示例10: test_csv_read_write

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
    def test_csv_read_write(self):
        s = """foo\tbar\tf\td
1\t2\t3.2\t2010/10/02
3\t4\t1.2\t2011/02/02
"""
        babe = Babe()
        b = babe.pull(string=s, format='csv', name='Test', delimiter='\t')
        b.push(filename='tests/files/test2.csv', delimiter='\t')
        with open('tests/files/test2.csv') as f:
            self.assertEquals(f.read(), s)
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:12,代码来源:test_csv.py

示例11: test_ftpzip

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
 def test_ftpzip(self):
     babe = Babe()
     a = babe.pull(filename='tests/files/test.csv',
                   name='Test')
     a.push(filename='test.csv',
            compress='test.zip',
            protocol='ftp',
            user=self.user,
            password=self.password,
            host='localhost',
            port=self.port,
            protocol_early_check=False)
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:14,代码来源:test_ftp.py

示例12: test_log

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
    def test_log(self):
        buf = StringIO()
        buf2 = StringIO()
        babe = Babe()
        a = babe.pull(filename='tests/test.csv', source='Test')
        a = a.log(logfile=buf)
        a.push(stream=buf2, format='csv')
        s = """foo,bar,f,d
1,2,3.2,2010/10/02
3,4,1.2,2011/02/02
"""
        self.assertEqual(s, buf.getvalue())
        self.assertEqual(s, buf2.getvalue())
开发者ID:fdouetteau,项目名称:PyBabe,代码行数:15,代码来源:test_base.py

示例13: test_split

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
    def test_split(self):
        babe = Babe()
        s = """a,b
1,3:4
2,7
"""
        a = babe.pull(string=s,format='csv',name='Test')
        a = a.split(field='b',separator=':')
        self.assertEquals(a.to_string(), """a,b
1,3
1,4
2,7
""")
开发者ID:fdouetteau,项目名称:PyBabe,代码行数:15,代码来源:test_transform.py

示例14: test_log

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
    def test_log(self):
        buf = StringIO()
        buf2 = StringIO()
        babe = Babe()
        a = babe.pull("tests/test.csv", name="Test")
        a = a.log(stream=buf)
        a.push(stream=buf2, format="csv")
        s = """foo	bar	f	d
1	2	3.2	2010/10/02
3	4	1.2	2011/02/02
"""
        self.assertEqual(s, buf.getvalue())
        self.assertEqual(s, buf2.getvalue())
开发者ID:tcabrol,项目名称:PyBabe,代码行数:15,代码来源:tests.py

示例15: test_split

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import pull [as 别名]
    def test_split(self):
        babe = Babe()
        buf = StringIO("""a,b
1,3:4
2,7
""")
        a = babe.pull(stream=buf,format='csv',name='Test')
        a = a.split(field='b',separator=':')
        buf2 = StringIO()
        a.push(stream=buf2, format='csv')
        self.assertEquals(buf2.getvalue(), """a,b
1,3
1,4
2,7
""")
开发者ID:nizox,项目名称:PyBabe,代码行数:17,代码来源:tests.py


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