deva 1.2.1__tar.gz → 1.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. {deva-1.2.1 → deva-1.2.3}/PKG-INFO +1 -1
  2. {deva-1.2.1 → deva-1.2.3}/deva/__init__.py +1 -1
  3. {deva-1.2.1 → deva-1.2.3}/deva/core.py +36 -33
  4. {deva-1.2.1 → deva-1.2.3}/deva/sample/crawler/asynchttp.py +2 -2
  5. {deva-1.2.1 → deva-1.2.3}/deva/sample/my_future.py +1 -1
  6. deva-1.2.3/deva/sample/search/cpiplog.db +0 -0
  7. {deva-1.2.1 → deva-1.2.3}/deva/sample/search/search_sql.py +2 -2
  8. {deva-1.2.1 → deva-1.2.3}/deva/sample/webview/stream_page.py +1 -1
  9. {deva-1.2.1 → deva-1.2.3}/deva/when.py +2 -2
  10. {deva-1.2.1 → deva-1.2.3}/deva.egg-info/PKG-INFO +1 -1
  11. {deva-1.2.1 → deva-1.2.3}/deva.egg-info/SOURCES.txt +1 -0
  12. {deva-1.2.1 → deva-1.2.3}/setup.py +1 -1
  13. {deva-1.2.1 → deva-1.2.3}/MANIFEST.in +0 -0
  14. {deva-1.2.1 → deva-1.2.3}/README.rst +0 -0
  15. {deva-1.2.1 → deva-1.2.3}/deva/bus.py +0 -0
  16. {deva-1.2.1 → deva-1.2.3}/deva/compute.py +0 -0
  17. {deva-1.2.1 → deva-1.2.3}/deva/dask.py +0 -0
  18. {deva-1.2.1 → deva-1.2.3}/deva/endpoints.py +0 -0
  19. {deva-1.2.1 → deva-1.2.3}/deva/future.py +0 -0
  20. {deva-1.2.1 → deva-1.2.3}/deva/graph.py +0 -0
  21. {deva-1.2.1 → deva-1.2.3}/deva/lambdas.py +0 -0
  22. {deva-1.2.1 → deva-1.2.3}/deva/monitor.py +0 -0
  23. {deva-1.2.1 → deva-1.2.3}/deva/namespace.py +0 -0
  24. {deva-1.2.1 → deva-1.2.3}/deva/page.py +0 -0
  25. {deva-1.2.1 → deva-1.2.3}/deva/pipe.py +0 -0
  26. {deva-1.2.1 → deva-1.2.3}/deva/river.py +0 -0
  27. {deva-1.2.1 → deva-1.2.3}/deva/sample/.DS_Store +0 -0
  28. {deva-1.2.1 → deva-1.2.3}/deva/sample/bus/bus_in.py +0 -0
  29. {deva-1.2.1 → deva-1.2.3}/deva/sample/bus/bus_out.py +0 -0
  30. {deva-1.2.1 → deva-1.2.3}/deva/sample/crawler/.DS_Store +0 -0
  31. {deva-1.2.1 → deva-1.2.3}/deva/sample/matmul.py +0 -0
  32. {deva-1.2.1 → deva-1.2.3}/deva/sample/search/.DS_Store +0 -0
  33. {deva-1.2.1 → deva-1.2.3}/deva/sample/search/search_stream.py +0 -0
  34. {deva-1.2.1 → deva-1.2.3}/deva/sample/when/scheduler.py +0 -0
  35. {deva-1.2.1 → deva-1.2.3}/deva/sample/when/timer.py +0 -0
  36. {deva-1.2.1 → deva-1.2.3}/deva/sample/when/worker.py +0 -0
  37. {deva-1.2.1 → deva-1.2.3}/deva/search.py +0 -0
  38. {deva-1.2.1 → deva-1.2.3}/deva/sources.py +0 -0
  39. {deva-1.2.1 → deva-1.2.3}/deva/state.py +0 -0
  40. {deva-1.2.1 → deva-1.2.3}/deva/store.py +0 -0
  41. {deva-1.2.1 → deva-1.2.3}/deva/templates/monitor.html +0 -0
  42. {deva-1.2.1 → deva-1.2.3}/deva/templates/stream.html +0 -0
  43. {deva-1.2.1 → deva-1.2.3}/deva/templates/streams.html +0 -0
  44. {deva-1.2.1 → deva-1.2.3}/deva/templates/xterm.css +0 -0
  45. {deva-1.2.1 → deva-1.2.3}/deva/templates/xterm.js +0 -0
  46. {deva-1.2.1 → deva-1.2.3}/deva/topic.py +0 -0
  47. {deva-1.2.1 → deva-1.2.3}/deva/utils/__init__.py +0 -0
  48. {deva-1.2.1 → deva-1.2.3}/deva/utils/simhash.py +0 -0
  49. {deva-1.2.1 → deva-1.2.3}/deva/utils/sqlitedict.py +0 -0
  50. {deva-1.2.1 → deva-1.2.3}/deva/utils/whooshalchemy.py +0 -0
  51. {deva-1.2.1 → deva-1.2.3}/deva.egg-info/dependency_links.txt +0 -0
  52. {deva-1.2.1 → deva-1.2.3}/deva.egg-info/not-zip-safe +0 -0
  53. {deva-1.2.1 → deva-1.2.3}/deva.egg-info/requires.txt +0 -0
  54. {deva-1.2.1 → deva-1.2.3}/deva.egg-info/top_level.txt +0 -0
  55. {deva-1.2.1 → deva-1.2.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: deva
3
- Version: 1.2.1
3
+ Version: 1.2.3
4
4
  Summary: data eval in future
5
5
  Home-page: https://github.com/sostc/deva
6
6
  Author: spark
@@ -25,4 +25,4 @@ try:
25
25
  except ImportError:
26
26
  pass
27
27
 
28
- __version__ = '1.2.1'
28
+ __version__ = '1.2.3'
@@ -399,27 +399,28 @@ class Stream(object):
399
399
  This is typically done only at source Streams but can theortically be
400
400
  done at any point
401
401
  """
402
- ts_async = getattr(thread_state, 'asynchronous', False)
403
- if self.loop is None or asynchronous or self.asynchronous or ts_async:
404
- if not ts_async:
405
- thread_state.asynchronous = True
406
- try:
407
- result = self._emit(x)
408
- if self.loop:
409
- return gen.convert_yielded(result)
410
- finally:
411
- thread_state.asynchronous = ts_async
412
- else:
413
- @gen.coroutine
414
- def _():
415
- thread_state.asynchronous = True
416
- try:
417
- result = yield self._emit(x)
418
- finally:
419
- del thread_state.asynchronous
420
-
421
- raise gen.Return(result)
422
- sync(self.loop, _)
402
+ # ts_async = getattr(thread_state, 'asynchronous', False)
403
+ # if self.loop is None or asynchronous or self.asynchronous or ts_async:
404
+ # if not ts_async:
405
+ # thread_state.asynchronous = True
406
+ # try:
407
+ # result = self.update(x)
408
+ # if self.loop:
409
+ # return gen.convert_yielded(result)
410
+ # finally:
411
+ # thread_state.asynchronous = ts_async
412
+ # else:
413
+ # @gen.coroutine
414
+ # def _():
415
+ # thread_state.asynchronous = True
416
+ # try:
417
+ # result = yield self.update(x)
418
+ # finally:
419
+ # del thread_state.asynchronous
420
+
421
+ # raise gen.Return(result)
422
+ # sync(self.loop, _)
423
+ self.update(x)
423
424
 
424
425
  def update(self, x, who=None):
425
426
  try:
@@ -544,19 +545,16 @@ class Stream(object):
544
545
  from .graph import visualize
545
546
  return visualize(self, filename, source_node=source_node, **kwargs)
546
547
 
547
- def attend(self, x):
548
- """#async等将执行结果入流"""
549
- assert isinstance(x, gen.Awaitable)
550
- futs = gen.convert_yielded(x)
551
- self.loop = self.loop or get_io_loop()
552
- self.loop.add_future(futs, lambda x: self._emit(x.result()))
548
+ # def attend(self, x):
549
+ # """#async等将执行结果入流"""
550
+ # assert isinstance(x, gen.Awaitable)
551
+ # futs = gen.convert_yielded(x)
552
+ # self.loop = self.loop or get_io_loop()
553
+ # self.loop.add_future(futs, lambda x: self._emit(x.result()))
553
554
 
554
555
  def __ror__(self, x): # |
555
556
  """emit value to stream ,end,return emit result"""
556
- if isinstance(x, gen.Awaitable):
557
- self.attend(x)
558
- else:
559
- self.emit(x, asynchronous=False)
557
+ self.emit(x, asynchronous=False)
560
558
  return x
561
559
 
562
560
  def __rrshift__(self, x): # stream左边的>>
@@ -1205,12 +1203,17 @@ class Deva():
1205
1203
  # loop.make_current()
1206
1204
  # loop.start()
1207
1205
 
1208
- loop = get_io_loop(asynchronous=False)
1209
- loop.instance().start()
1206
+ # loop = get_io_loop(asynchronous=False)
1207
+ # loop.instance().start()
1208
+
1210
1209
  # import asyncio
1211
1210
  # l = asyncio.new_event_loop()
1212
1211
 
1213
1212
  # l.run_forever()
1213
+ try:
1214
+ IOLoop().start()
1215
+ except KeyboardInterrupt:
1216
+ exit()
1214
1217
 
1215
1218
 
1216
1219
  print(os.getpid())
@@ -2,12 +2,12 @@ from deva import *
2
2
 
3
3
  h = http()
4
4
  h.map(lambda r: (r.url, r.html.search('<title>{}</title>')[0])) >> log
5
- 'http://www.518.is' >> h
5
+ 'http://secsay.com' >> h
6
6
 
7
7
 
8
8
  s = Stream()
9
9
  s.rate_limit(1).http(workers=20).map(lambda r: (
10
10
  r.url, r.html.search('<title>{}</title>')[0])) >> warn
11
- 'http://www.518.is' >> s
11
+ 'http://secsay.com' >> s
12
12
 
13
13
  Deva.run()
@@ -34,7 +34,7 @@ foo1() | print
34
34
 
35
35
  foo2() | log
36
36
 
37
- foo2() | attend()
37
+
38
38
  name = "Masnun"
39
39
 
40
40
  # IPython.embed()
Binary file
@@ -36,6 +36,6 @@ session.add(log)
36
36
  session.commit()
37
37
 
38
38
 
39
- CpipLog.search_query('tensorflow') >> first
39
+ CpipLog.search_query('tensorflow') >> first >> print
40
40
 
41
- CpipLog.search_query('tensorflow') >> ls
41
+ CpipLog.search_query('tensorflow') >> ls >> print
@@ -25,5 +25,5 @@ s2.webview()
25
25
  s2.webview('/stock')
26
26
  s3.webview()
27
27
 
28
- Monitor().start()
28
+ # Monitor().start()
29
29
  Deva.run()
@@ -150,9 +150,9 @@ class timer(Stream):
150
150
  self.stop()
151
151
 
152
152
  if self.thread:
153
- self.thread_pool.submit(lambda: self.update(self.func()))
153
+ self.thread_pool.submit(lambda: self.emit(self.func()))
154
154
  else:
155
- self.update(self.func())
155
+ self.emit(self.func())
156
156
  yield gen.sleep(self.interval)
157
157
  if self.stopped:
158
158
  break
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: deva
3
- Version: 1.2.1
3
+ Version: 1.2.3
4
4
  Summary: data eval in future
5
5
  Home-page: https://github.com/sostc/deva
6
6
  Author: spark
@@ -35,6 +35,7 @@ deva/sample/bus/bus_out.py
35
35
  deva/sample/crawler/.DS_Store
36
36
  deva/sample/crawler/asynchttp.py
37
37
  deva/sample/search/.DS_Store
38
+ deva/sample/search/cpiplog.db
38
39
  deva/sample/search/search_sql.py
39
40
  deva/sample/search/search_stream.py
40
41
  deva/sample/webview/stream_page.py
@@ -3,7 +3,7 @@ from os.path import exists
3
3
 
4
4
  setup(
5
5
  name='deva',
6
- version='1.2.1',
6
+ version='1.2.3',
7
7
  include_package_data=True,
8
8
  packages=find_packages(),
9
9
  python_requires='>=3.5',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes