hive-nectar 0.0.2__py3-none-any.whl

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.

Potentially problematic release.


This version of hive-nectar might be problematic. Click here for more details.

Files changed (86) hide show
  1. hive_nectar-0.0.2.dist-info/METADATA +182 -0
  2. hive_nectar-0.0.2.dist-info/RECORD +86 -0
  3. hive_nectar-0.0.2.dist-info/WHEEL +4 -0
  4. hive_nectar-0.0.2.dist-info/entry_points.txt +2 -0
  5. hive_nectar-0.0.2.dist-info/licenses/LICENSE.txt +23 -0
  6. nectar/__init__.py +32 -0
  7. nectar/account.py +4371 -0
  8. nectar/amount.py +475 -0
  9. nectar/asciichart.py +270 -0
  10. nectar/asset.py +82 -0
  11. nectar/block.py +446 -0
  12. nectar/blockchain.py +1178 -0
  13. nectar/blockchaininstance.py +2284 -0
  14. nectar/blockchainobject.py +221 -0
  15. nectar/blurt.py +563 -0
  16. nectar/cli.py +6285 -0
  17. nectar/comment.py +1217 -0
  18. nectar/community.py +513 -0
  19. nectar/constants.py +111 -0
  20. nectar/conveyor.py +309 -0
  21. nectar/discussions.py +1709 -0
  22. nectar/exceptions.py +149 -0
  23. nectar/hive.py +546 -0
  24. nectar/hivesigner.py +420 -0
  25. nectar/imageuploader.py +72 -0
  26. nectar/instance.py +129 -0
  27. nectar/market.py +1013 -0
  28. nectar/memo.py +449 -0
  29. nectar/message.py +357 -0
  30. nectar/nodelist.py +444 -0
  31. nectar/price.py +557 -0
  32. nectar/profile.py +65 -0
  33. nectar/rc.py +308 -0
  34. nectar/snapshot.py +726 -0
  35. nectar/steem.py +582 -0
  36. nectar/storage.py +53 -0
  37. nectar/transactionbuilder.py +622 -0
  38. nectar/utils.py +545 -0
  39. nectar/version.py +2 -0
  40. nectar/vote.py +557 -0
  41. nectar/wallet.py +472 -0
  42. nectar/witness.py +617 -0
  43. nectarapi/__init__.py +11 -0
  44. nectarapi/exceptions.py +123 -0
  45. nectarapi/graphenerpc.py +589 -0
  46. nectarapi/node.py +178 -0
  47. nectarapi/noderpc.py +229 -0
  48. nectarapi/rpcutils.py +97 -0
  49. nectarapi/version.py +2 -0
  50. nectarbase/__init__.py +14 -0
  51. nectarbase/ledgertransactions.py +75 -0
  52. nectarbase/memo.py +243 -0
  53. nectarbase/objects.py +429 -0
  54. nectarbase/objecttypes.py +22 -0
  55. nectarbase/operationids.py +102 -0
  56. nectarbase/operations.py +1297 -0
  57. nectarbase/signedtransactions.py +48 -0
  58. nectarbase/transactions.py +11 -0
  59. nectarbase/version.py +2 -0
  60. nectargrapheneapi/__init__.py +6 -0
  61. nectargraphenebase/__init__.py +27 -0
  62. nectargraphenebase/account.py +846 -0
  63. nectargraphenebase/aes.py +52 -0
  64. nectargraphenebase/base58.py +192 -0
  65. nectargraphenebase/bip32.py +494 -0
  66. nectargraphenebase/bip38.py +134 -0
  67. nectargraphenebase/chains.py +149 -0
  68. nectargraphenebase/dictionary.py +3 -0
  69. nectargraphenebase/ecdsasig.py +326 -0
  70. nectargraphenebase/objects.py +123 -0
  71. nectargraphenebase/objecttypes.py +6 -0
  72. nectargraphenebase/operationids.py +3 -0
  73. nectargraphenebase/operations.py +23 -0
  74. nectargraphenebase/prefix.py +11 -0
  75. nectargraphenebase/py23.py +38 -0
  76. nectargraphenebase/signedtransactions.py +201 -0
  77. nectargraphenebase/types.py +419 -0
  78. nectargraphenebase/unsignedtransactions.py +283 -0
  79. nectargraphenebase/version.py +2 -0
  80. nectarstorage/__init__.py +38 -0
  81. nectarstorage/base.py +306 -0
  82. nectarstorage/exceptions.py +16 -0
  83. nectarstorage/interfaces.py +237 -0
  84. nectarstorage/masterpassword.py +239 -0
  85. nectarstorage/ram.py +30 -0
  86. nectarstorage/sqlite.py +334 -0
nectar/vote.py ADDED
@@ -0,0 +1,557 @@
1
+ # -*- coding: utf-8 -*-
2
+ import json
3
+ from datetime import date, datetime, timezone
4
+
5
+ from prettytable import PrettyTable
6
+
7
+ from nectarapi.exceptions import InvalidParameters, UnknownKey
8
+ from nectargraphenebase.py23 import integer_types, string_types
9
+
10
+ from .account import Account
11
+ from .blockchainobject import BlockchainObject
12
+ from .comment import Comment
13
+ from .exceptions import VoteDoesNotExistsException
14
+ from .instance import shared_blockchain_instance
15
+ from .utils import (
16
+ addTzInfo,
17
+ construct_authorperm,
18
+ construct_authorpermvoter,
19
+ formatTimeString,
20
+ reputation_to_score,
21
+ resolve_authorperm,
22
+ resolve_authorpermvoter,
23
+ )
24
+
25
+
26
+ class Vote(BlockchainObject):
27
+ """Read data about a Vote in the chain
28
+
29
+ :param str authorperm: perm link to post/comment
30
+ :param nectar.nectar.nectar blockchain_instance: nectar
31
+ instance to use when accesing a RPC
32
+ """
33
+
34
+ def __init__(
35
+ self, voter, authorperm=None, lazy=False, full=False, blockchain_instance=None, **kwargs
36
+ ):
37
+ self.full = full
38
+ self.lazy = lazy
39
+ if blockchain_instance is None:
40
+ if kwargs.get("steem_instance"):
41
+ blockchain_instance = kwargs["steem_instance"]
42
+ elif kwargs.get("hive_instance"):
43
+ blockchain_instance = kwargs["hive_instance"]
44
+ self.blockchain = blockchain_instance or shared_blockchain_instance()
45
+ if isinstance(voter, string_types) and authorperm is not None:
46
+ [author, permlink] = resolve_authorperm(authorperm)
47
+ self["voter"] = voter
48
+ self["author"] = author
49
+ self["permlink"] = permlink
50
+ authorpermvoter = construct_authorpermvoter(author, permlink, voter)
51
+ self["authorpermvoter"] = authorpermvoter
52
+ elif (
53
+ isinstance(voter, dict)
54
+ and "author" in voter
55
+ and "permlink" in voter
56
+ and "voter" in voter
57
+ ):
58
+ authorpermvoter = voter
59
+ authorpermvoter["authorpermvoter"] = construct_authorpermvoter(
60
+ voter["author"], voter["permlink"], voter["voter"]
61
+ )
62
+ authorpermvoter = self._parse_json_data(authorpermvoter)
63
+ elif isinstance(voter, dict) and "authorperm" in voter and authorperm is not None:
64
+ [author, permlink] = resolve_authorperm(voter["authorperm"])
65
+ authorpermvoter = voter
66
+ authorpermvoter["voter"] = authorperm
67
+ authorpermvoter["author"] = author
68
+ authorpermvoter["permlink"] = permlink
69
+ authorpermvoter["authorpermvoter"] = construct_authorpermvoter(
70
+ author, permlink, authorperm
71
+ )
72
+ authorpermvoter = self._parse_json_data(authorpermvoter)
73
+ elif isinstance(voter, dict) and "voter" in voter and authorperm is not None:
74
+ [author, permlink] = resolve_authorperm(authorperm)
75
+ authorpermvoter = voter
76
+ authorpermvoter["author"] = author
77
+ authorpermvoter["permlink"] = permlink
78
+ authorpermvoter["authorpermvoter"] = construct_authorpermvoter(
79
+ author, permlink, voter["voter"]
80
+ )
81
+ authorpermvoter = self._parse_json_data(authorpermvoter)
82
+ else:
83
+ authorpermvoter = voter
84
+ [author, permlink, voter] = resolve_authorpermvoter(authorpermvoter)
85
+ self["author"] = author
86
+ self["permlink"] = permlink
87
+
88
+ super(Vote, self).__init__(
89
+ authorpermvoter,
90
+ id_item="authorpermvoter",
91
+ lazy=lazy,
92
+ full=full,
93
+ blockchain_instance=blockchain_instance,
94
+ )
95
+
96
+ def refresh(self):
97
+ if self.identifier is None:
98
+ return
99
+ if not self.blockchain.is_connected():
100
+ return
101
+ [author, permlink, voter] = resolve_authorpermvoter(self.identifier)
102
+ try:
103
+ self.blockchain.rpc.set_next_node_on_empty_reply(True)
104
+ if self.blockchain.rpc.get_use_appbase():
105
+ try:
106
+ votes = self.blockchain.rpc.get_active_votes(
107
+ {"author": author, "permlink": permlink}, api="condenser"
108
+ )["votes"]
109
+ except InvalidParameters:
110
+ raise VoteDoesNotExistsException(self.identifier)
111
+ except Exception: # Fallback to condenser API
112
+ votes = self.blockchain.rpc.get_active_votes(author, permlink, api="condenser")
113
+ else:
114
+ votes = self.blockchain.rpc.get_active_votes(author, permlink, api="condenser")
115
+ except UnknownKey:
116
+ raise VoteDoesNotExistsException(self.identifier)
117
+
118
+ vote = None
119
+ if votes is not None:
120
+ for x in votes:
121
+ if x["voter"] == voter:
122
+ vote = x
123
+ if not vote:
124
+ raise VoteDoesNotExistsException(self.identifier)
125
+ vote = self._parse_json_data(vote)
126
+ vote["authorpermvoter"] = construct_authorpermvoter(author, permlink, voter)
127
+ super(Vote, self).__init__(
128
+ vote,
129
+ id_item="authorpermvoter",
130
+ lazy=self.lazy,
131
+ full=self.full,
132
+ blockchain_instance=self.blockchain,
133
+ )
134
+
135
+ def _parse_json_data(self, vote):
136
+ parse_int = [
137
+ "rshares",
138
+ "reputation",
139
+ ]
140
+ for p in parse_int:
141
+ if p in vote and isinstance(vote.get(p), string_types):
142
+ vote[p] = int(vote.get(p, "0"))
143
+
144
+ if "time" in vote and isinstance(vote.get("time"), string_types) and vote.get("time") != "":
145
+ vote["time"] = formatTimeString(vote.get("time", "1970-01-01T00:00:00"))
146
+ elif (
147
+ "timestamp" in vote
148
+ and isinstance(vote.get("timestamp"), string_types)
149
+ and vote.get("timestamp") != ""
150
+ ):
151
+ vote["time"] = formatTimeString(vote.get("timestamp", "1970-01-01T00:00:00"))
152
+ elif (
153
+ "last_update" in vote
154
+ and isinstance(vote.get("last_update"), string_types)
155
+ and vote.get("last_update") != ""
156
+ ):
157
+ vote["last_update"] = formatTimeString(vote.get("last_update", "1970-01-01T00:00:00"))
158
+ else:
159
+ vote["time"] = formatTimeString("1970-01-01T00:00:00")
160
+ return vote
161
+
162
+ def json(self):
163
+ output = self.copy()
164
+ if "author" in output:
165
+ output.pop("author")
166
+ if "permlink" in output:
167
+ output.pop("permlink")
168
+ parse_times = ["time"]
169
+ for p in parse_times:
170
+ if p in output:
171
+ p_date = output.get(p, datetime(1970, 1, 1, 0, 0))
172
+ if isinstance(p_date, (datetime, date)):
173
+ output[p] = formatTimeString(p_date)
174
+ else:
175
+ output[p] = p_date
176
+ parse_int = [
177
+ "rshares",
178
+ "reputation",
179
+ ]
180
+ for p in parse_int:
181
+ if p in output and isinstance(output[p], integer_types):
182
+ output[p] = str(output[p])
183
+ return json.loads(str(json.dumps(output)))
184
+
185
+ @property
186
+ def voter(self):
187
+ return self["voter"]
188
+
189
+ @property
190
+ def authorperm(self):
191
+ if "authorperm" in self:
192
+ return self["authorperm"]
193
+ elif "authorpermvoter" in self:
194
+ [author, permlink, voter] = resolve_authorpermvoter(self["authorpermvoter"])
195
+ return construct_authorperm(author, permlink)
196
+ elif "author" in self and "permlink" in self:
197
+ return construct_authorperm(self["author"], self["permlink"])
198
+ else:
199
+ return ""
200
+
201
+ @property
202
+ def votee(self):
203
+ votee = ""
204
+ authorperm = self.get("authorperm", "")
205
+ authorpermvoter = self.get("authorpermvoter", "")
206
+ if authorperm != "":
207
+ votee = resolve_authorperm(authorperm)[0]
208
+ elif authorpermvoter != "":
209
+ votee = resolve_authorpermvoter(authorpermvoter)[0]
210
+ return votee
211
+
212
+ @property
213
+ def weight(self):
214
+ return self["weight"]
215
+
216
+ @property
217
+ def sbd(self):
218
+ return self.blockchain.rshares_to_sbd(int(self.get("rshares", 0)))
219
+
220
+ @property
221
+ def hbd(self):
222
+ return self.blockchain.rshares_to_hbd(int(self.get("rshares", 0)))
223
+
224
+ @property
225
+ def token_backed_dollar(self):
226
+ from nectar import Hive
227
+
228
+ if isinstance(self.blockchain, Hive):
229
+ return self.blockchain.rshares_to_hbd(int(self.get("rshares", 0)))
230
+ else:
231
+ return self.blockchain.rshares_to_sbd(int(self.get("rshares", 0)))
232
+
233
+ @property
234
+ def rshares(self):
235
+ return int(self.get("rshares", 0))
236
+
237
+ @property
238
+ def percent(self):
239
+ return self.get("percent", 0)
240
+
241
+ @property
242
+ def reputation(self):
243
+ return self.get("reputation", 0)
244
+
245
+ @property
246
+ def rep(self):
247
+ return reputation_to_score(int(self.reputation))
248
+
249
+ @property
250
+ def time(self):
251
+ return self["time"]
252
+
253
+
254
+ class VotesObject(list):
255
+ def get_sorted_list(self, sort_key="time", reverse=True):
256
+ sortedList = sorted(
257
+ self,
258
+ key=lambda x: (datetime.now(timezone.utc) - x.time).total_seconds(),
259
+ reverse=reverse,
260
+ )
261
+ return sortedList
262
+
263
+ def printAsTable(
264
+ self,
265
+ voter=None,
266
+ votee=None,
267
+ start=None,
268
+ stop=None,
269
+ start_percent=None,
270
+ stop_percent=None,
271
+ sort_key="time",
272
+ reverse=True,
273
+ allow_refresh=True,
274
+ return_str=False,
275
+ **kwargs,
276
+ ):
277
+ table_header = ["Voter", "Votee", "SBD/HBD", "Time", "Rshares", "Percent", "Weight"]
278
+ t = PrettyTable(table_header)
279
+ t.align = "l"
280
+ start = addTzInfo(start)
281
+ stop = addTzInfo(stop)
282
+ for vote in self.get_sorted_list(sort_key=sort_key, reverse=reverse):
283
+ if not allow_refresh:
284
+ vote.cached = True
285
+
286
+ d_time = vote.time
287
+ if d_time != formatTimeString("1970-01-01T00:00:00"):
288
+ td = datetime.now(timezone.utc) - d_time
289
+ timestr = (
290
+ str(td.days)
291
+ + " days "
292
+ + str(td.seconds // 3600)
293
+ + ":"
294
+ + str((td.seconds // 60) % 60)
295
+ )
296
+ else:
297
+ start = None
298
+ stop = None
299
+ timestr = ""
300
+
301
+ percent = vote.get("percent", "")
302
+ if percent == "":
303
+ start_percent = None
304
+ stop_percent = None
305
+ if (
306
+ (start is None or d_time >= start)
307
+ and (stop is None or d_time <= stop)
308
+ and (start_percent is None or percent >= start_percent)
309
+ and (stop_percent is None or percent <= stop_percent)
310
+ and (voter is None or vote["voter"] == voter)
311
+ and (votee is None or vote.votee == votee)
312
+ ):
313
+ percent = vote.get("percent", "")
314
+ if percent == "":
315
+ percent = vote.get("vote_percent", "")
316
+ t.add_row(
317
+ [
318
+ vote["voter"],
319
+ vote.votee,
320
+ str(round(vote.token_backed_dollar, 2)).ljust(5) + "$",
321
+ timestr,
322
+ vote.get("rshares", ""),
323
+ str(percent),
324
+ str(vote["weight"]),
325
+ ]
326
+ )
327
+
328
+ if return_str:
329
+ return t.get_string(**kwargs)
330
+ else:
331
+ print(t.get_string(**kwargs))
332
+
333
+ def get_list(
334
+ self,
335
+ var="voter",
336
+ voter=None,
337
+ votee=None,
338
+ start=None,
339
+ stop=None,
340
+ start_percent=None,
341
+ stop_percent=None,
342
+ sort_key="time",
343
+ reverse=True,
344
+ ):
345
+ vote_list = []
346
+ start = addTzInfo(start)
347
+ stop = addTzInfo(stop)
348
+ for vote in self.get_sorted_list(sort_key=sort_key, reverse=reverse):
349
+ d_time = vote.time
350
+ if d_time != formatTimeString("1970-01-01T00:00:00"):
351
+ start = None
352
+ stop = None
353
+ percent = vote.get("percent", "")
354
+ if percent == "":
355
+ percent = vote.get("vote_percent", "")
356
+ if percent == "":
357
+ start_percent = None
358
+ stop_percent = None
359
+ if (
360
+ (start is None or d_time >= start)
361
+ and (stop is None or d_time <= stop)
362
+ and (start_percent is None or percent >= start_percent)
363
+ and (stop_percent is None or percent <= stop_percent)
364
+ and (voter is None or vote["voter"] == voter)
365
+ and (votee is None or vote.votee == votee)
366
+ ):
367
+ v = ""
368
+ if var == "voter":
369
+ v = vote["voter"]
370
+ elif var == "votee":
371
+ v = vote.votee
372
+ elif var == "sbd" or var == "hbd":
373
+ v = vote.token_backed_dollar
374
+ elif var == "time":
375
+ v = d_time
376
+ elif var == "rshares":
377
+ v = vote.get("rshares", 0)
378
+ elif var == "percent":
379
+ v = percent
380
+ elif var == "weight":
381
+ v = vote["weight"]
382
+ vote_list.append(v)
383
+ return vote_list
384
+
385
+ def print_stats(self, return_str=False, **kwargs):
386
+ # Using built-in timezone support
387
+ table_header = ["voter", "votee", "sbd/hbd", "time", "rshares", "percent", "weight"]
388
+ t = PrettyTable(table_header)
389
+ t.align = "l"
390
+
391
+ def __contains__(self, item):
392
+ if isinstance(item, Account):
393
+ name = item["name"]
394
+ authorperm = ""
395
+ elif isinstance(item, Comment):
396
+ authorperm = item.authorperm
397
+ name = ""
398
+ else:
399
+ name = item
400
+ authorperm = item
401
+
402
+ return (
403
+ any([name == x.voter for x in self])
404
+ or any([name == x.votee for x in self])
405
+ or any([authorperm == x.authorperm for x in self])
406
+ )
407
+
408
+ def __str__(self):
409
+ return self.printAsTable(return_str=True)
410
+
411
+ def __repr__(self):
412
+ return "<%s %s>" % (self.__class__.__name__, str(self.identifier))
413
+
414
+
415
+ class ActiveVotes(VotesObject):
416
+ """Obtain a list of votes for a post
417
+
418
+ :param str authorperm: authorperm link
419
+ :param Steem steem_instance: Steem() instance to use when accesing a RPC
420
+ """
421
+
422
+ def __init__(self, authorperm, lazy=False, full=False, blockchain_instance=None, **kwargs):
423
+ if blockchain_instance is None:
424
+ if kwargs.get("steem_instance"):
425
+ blockchain_instance = kwargs["steem_instance"]
426
+ elif kwargs.get("hive_instance"):
427
+ blockchain_instance = kwargs["hive_instance"]
428
+ self.blockchain = blockchain_instance or shared_blockchain_instance()
429
+ votes = None
430
+ if not self.blockchain.is_connected():
431
+ return None
432
+ self.blockchain.rpc.set_next_node_on_empty_reply(False)
433
+
434
+ if isinstance(authorperm, Comment):
435
+ # if 'active_votes' in authorperm and len(authorperm["active_votes"]) > 0:
436
+ # votes = authorperm["active_votes"]
437
+ if self.blockchain.rpc.get_use_appbase():
438
+ self.blockchain.rpc.set_next_node_on_empty_reply(False)
439
+ from nectarapi.exceptions import InvalidParameters
440
+
441
+ try:
442
+ votes = self.blockchain.rpc.get_active_votes(
443
+ authorperm["author"], authorperm["permlink"], api="condenser"
444
+ )
445
+ except InvalidParameters:
446
+ raise VoteDoesNotExistsException(
447
+ construct_authorperm(authorperm["author"], authorperm["permlink"])
448
+ )
449
+ except Exception: # Fallback to tags API
450
+ votes = self.blockchain.rpc.get_active_votes(
451
+ {"author": authorperm["author"], "permlink": authorperm["permlink"]},
452
+ api="tags",
453
+ )["votes"]
454
+ else:
455
+ votes = self.blockchain.rpc.get_active_votes(
456
+ authorperm["author"], authorperm["permlink"], api="condenser"
457
+ )
458
+ authorperm = authorperm["authorperm"]
459
+ elif isinstance(authorperm, string_types):
460
+ [author, permlink] = resolve_authorperm(authorperm)
461
+ if self.blockchain.rpc.get_use_appbase():
462
+ self.blockchain.rpc.set_next_node_on_empty_reply(False)
463
+ from nectarapi.exceptions import InvalidParameters
464
+
465
+ try:
466
+ votes = self.blockchain.rpc.get_active_votes(author, permlink, api="condenser")
467
+ except InvalidParameters:
468
+ raise VoteDoesNotExistsException(construct_authorperm(author, permlink))
469
+ except Exception: # Fallback to tags API
470
+ votes = self.blockchain.rpc.get_active_votes(
471
+ {"author": author, "permlink": permlink}, api="tags"
472
+ )["votes"]
473
+ else:
474
+ votes = self.blockchain.rpc.get_active_votes(author, permlink, api="condenser")
475
+ elif isinstance(authorperm, list):
476
+ votes = authorperm
477
+ authorperm = None
478
+ elif isinstance(authorperm, dict):
479
+ votes = authorperm["active_votes"]
480
+ authorperm = authorperm["authorperm"]
481
+ if votes is None:
482
+ return
483
+ self.identifier = authorperm
484
+ super(ActiveVotes, self).__init__(
485
+ [
486
+ Vote(
487
+ x,
488
+ authorperm=authorperm,
489
+ lazy=lazy,
490
+ full=full,
491
+ blockchain_instance=self.blockchain,
492
+ )
493
+ for x in votes
494
+ ]
495
+ )
496
+
497
+
498
+ class AccountVotes(VotesObject):
499
+ """Obtain a list of votes for an account
500
+ Lists the last 100+ votes on the given account.
501
+
502
+ :param str account: Account name
503
+ :param Steem steem_instance: Steem() instance to use when accesing a RPC
504
+ """
505
+
506
+ def __init__(
507
+ self,
508
+ account,
509
+ start=None,
510
+ stop=None,
511
+ raw_data=False,
512
+ lazy=False,
513
+ full=False,
514
+ blockchain_instance=None,
515
+ **kwargs,
516
+ ):
517
+ if blockchain_instance is None:
518
+ if kwargs.get("steem_instance"):
519
+ blockchain_instance = kwargs["steem_instance"]
520
+ elif kwargs.get("hive_instance"):
521
+ blockchain_instance = kwargs["hive_instance"]
522
+ self.blockchain = blockchain_instance or shared_blockchain_instance()
523
+ start = addTzInfo(start)
524
+ stop = addTzInfo(stop)
525
+ account = Account(account, blockchain_instance=self.blockchain)
526
+ votes = account.get_account_votes()
527
+ self.identifier = account["name"]
528
+ vote_list = []
529
+ if votes is None:
530
+ votes = []
531
+ for x in votes:
532
+ time = x.get("time", "")
533
+ if time == "":
534
+ time = x.get("last_update", "")
535
+ if time != "":
536
+ x["time"] = time
537
+ if time != "" and isinstance(time, string_types):
538
+ d_time = formatTimeString(time)
539
+ elif isinstance(time, datetime):
540
+ d_time = time
541
+ else:
542
+ d_time = addTzInfo(datetime(1970, 1, 1, 0, 0, 0))
543
+ if (start is None or d_time >= start) and (stop is None or d_time <= stop):
544
+ if not raw_data:
545
+ vote_list.append(
546
+ Vote(
547
+ x,
548
+ authorperm=account["name"],
549
+ lazy=lazy,
550
+ full=full,
551
+ blockchain_instance=self.blockchain,
552
+ )
553
+ )
554
+ else:
555
+ vote_list.append(x)
556
+
557
+ super(AccountVotes, self).__init__(vote_list)