コード例 #1
0
 def from_dict(obj: Any) -> 'Coin':
     assert isinstance(obj, dict)
     id = from_union([from_none, lambda x: int(from_str(x))], obj.get("Id"))
     url = from_union([from_str, from_none], obj.get("Url"))
     image_url = from_union([from_str, from_none], obj.get("ImageUrl"))
     content_created_on = from_union([from_int, from_none], obj.get("ContentCreatedOn"))
     name = from_union([from_str, from_none], obj.get("Name"))
     symbol = from_union([from_str, from_none], obj.get("Symbol"))
     coin_name = from_union([from_str, from_none], obj.get("CoinName"))
     full_name = from_union([from_str, from_none], obj.get("FullName"))
     algorithm = from_union([from_str, from_none], obj.get("Algorithm"))
     proof_type = from_union([from_str, from_none], obj.get("ProofType"))
     fully_premined = from_union([from_none, lambda x: int(from_str(x))], obj.get("FullyPremined"))
     total_coin_supply = from_union([from_none, from_na, from_str_number, from_int, from_float], obj.get("TotalCoinSupply"))
     built_on = from_union([from_str, from_none], obj.get("BuiltOn"))
     smart_contract_address = from_union([from_str, from_none], obj.get("SmartContractAddress"))
     pre_mined_value = from_union([from_str, from_none], obj.get("PreMinedValue"))
     total_coins_free_float = from_union([from_str, from_none], obj.get("TotalCoinsFreeFloat"))
     sort_order = from_union([from_none, lambda x: int(from_str(x))], obj.get("SortOrder"))
     sponsored = from_union([from_bool, from_none], obj.get("Sponsored"))
     taxonomy = from_union([Taxonomy.from_dict, from_none], obj.get("Taxonomy"))
     is_trading = from_union([from_bool, from_none], obj.get("IsTrading"))
     total_coins_mined = from_union([from_float, from_none], obj.get("TotalCoinsMined"))
     block_number = from_union([from_int, from_none], obj.get("BlockNumber"))
     net_hashes_per_second = from_union([from_float, from_none], obj.get("NetHashesPerSecond"))
     block_reward = from_union([from_float, from_none], obj.get("BlockReward"))
     block_time = from_union([from_float, from_none], obj.get("BlockTime"))
     return Coin(id, url, image_url, content_created_on, name, symbol, coin_name, full_name, algorithm, proof_type,
                 fully_premined, total_coin_supply, built_on, smart_contract_address, pre_mined_value,
                 total_coins_free_float, sort_order, sponsored, taxonomy, is_trading, total_coins_mined,
                 block_number, net_hashes_per_second, block_reward, block_time)
コード例 #2
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["Id"] = from_union([
         lambda x: from_none((lambda x: is_type(type(None), x))
                             (x)), lambda x: from_str((lambda x: str(
                                 (lambda x: is_type(int, x))(x)))(x))
     ], self.id)
     result["SortOrder"] = from_union([
         lambda x: from_none((lambda x: is_type(type(None), x))
                             (x)), lambda x: from_str((lambda x: str(
                                 (lambda x: is_type(int, x))(x)))(x))
     ], self.sort_order)
     result["Name"] = from_union([from_str, from_none], self.name)
     result["Url"] = from_union([from_str, from_none], self.url)
     result["LogoUrl"] = from_union([from_str, from_none], self.logo_url)
     result["ItemType"] = from_union(
         [lambda x: from_list(from_str, x), from_none], self.item_type)
     result["CentralizationType"] = from_union([from_str, from_none],
                                               self.centralization_type)
     result["InternalName"] = from_union([from_str, from_none],
                                         self.internal_name)
     result["GradePoints"] = from_union([from_str, from_none],
                                        self.grade_points)
     result["Grade"] = from_union([from_str, from_none], self.grade)
     result["GradePointsSplit"] = from_union(
         [lambda x: to_class(GradePointsSplit, x), from_none],
         self.grade_points_split)
     result["AffiliateURL"] = from_union([from_str, from_none],
                                         self.affiliate_url)
     result["Country"] = from_union([from_str, from_none], self.country)
     result["OrderBook"] = from_union([from_bool, from_none],
                                      self.order_book)
     result["Trades"] = from_union([from_bool, from_none], self.trades)
     result["Description"] = from_union([from_str, from_none],
                                        self.description)
     result["FullAddress"] = from_union([from_str, from_none],
                                        self.full_address)
     result["Fees"] = from_union([from_str, from_none], self.fees)
     result["DepositMethods"] = from_union([from_str, from_none],
                                           self.deposit_methods)
     result["WithdrawalMethods"] = from_union([from_str, from_none],
                                              self.withdrawal_methods)
     result["Sponsored"] = from_union([from_bool, from_none],
                                      self.sponsored)
     result["Recommended"] = from_union([from_bool, from_none],
                                        self.recommended)
     result["Rating"] = from_union(
         [lambda x: to_class(Rating, x), from_none], self.rating)
     result["TOTALVOLUME24H"] = from_union([from_plain_dict, from_none],
                                           self.totalvolume24_h)
     result["DISPLAYTOTALVOLUME24H"] = from_union(
         [from_plain_dict, from_none], self.displaytotalvolume24_h)
     return result
コード例 #3
0
 def from_dict(obj: Any) -> 'ExchangeInfo':
     assert isinstance(obj, dict)
     id = from_union([from_none, lambda x: int(from_str(x))], obj.get("Id"))
     sort_order = from_union([from_none, lambda x: int(from_str(x))],
                             obj.get("SortOrder"))
     name = from_union([from_str, from_none], obj.get("Name"))
     url = from_union([from_str, from_none], obj.get("Url"))
     logo_url = from_union([from_str, from_none], obj.get("LogoUrl"))
     item_type = from_union([lambda x: from_list(from_str, x), from_none],
                            obj.get("ItemType"))
     centralization_type = from_union([from_str, from_none],
                                      obj.get("CentralizationType"))
     internal_name = from_union([from_str, from_none],
                                obj.get("InternalName"))
     grade_points = from_union([from_float, from_str_number, from_none],
                               obj.get("GradePoints"))
     grade = from_union([from_str, from_none], obj.get("Grade"))
     grade_points_split = from_union(
         [GradePointsSplit.from_dict, from_none],
         obj.get("GradePointsSplit"))
     affiliate_url = from_union([from_str, from_none],
                                obj.get("AffiliateURL"))
     country = from_union([from_str, from_none], obj.get("Country"))
     order_book = from_union([from_bool, from_none], obj.get("OrderBook"))
     trades = from_union([from_bool, from_none], obj.get("Trades"))
     description = from_union([from_str, from_none], obj.get("Description"))
     full_address = from_union([from_str, from_none],
                               obj.get("FullAddress"))
     fees = from_union([from_str, from_none], obj.get("Fees"))
     deposit_methods = from_union([from_str, from_none],
                                  obj.get("DepositMethods"))
     withdrawal_methods = from_union([from_str, from_none],
                                     obj.get("WithdrawalMethods"))
     sponsored = from_union([from_bool, from_none], obj.get("Sponsored"))
     recommended = from_union([from_bool, from_none],
                              obj.get("Recommended"))
     rating = from_union([Rating.from_dict, from_none], obj.get("Rating"))
     totalvolume24_h = from_union([from_plain_dict, from_none],
                                  obj.get("TOTALVOLUME24H"))
     displaytotalvolume24_h = from_union([from_plain_dict, from_none],
                                         obj.get("DISPLAYTOTALVOLUME24H"))
     return ExchangeInfo(id, sort_order, name, url, logo_url, item_type,
                         centralization_type, internal_name, grade_points,
                         grade, grade_points_split, affiliate_url, country,
                         order_book, trades, description, full_address,
                         fees, deposit_methods, withdrawal_methods,
                         sponsored, recommended, rating, totalvolume24_h,
                         displaytotalvolume24_h)
コード例 #4
0
 def from_dict(obj: Any) -> 'NewsRecord':
     assert isinstance(obj, dict)
     id = from_union([from_none, lambda x: int(from_str(x))], obj.get("id"))
     guid = from_union([from_str, from_none], obj.get("guid"))
     published_on = from_union([from_int, from_none], obj.get("published_on"))
     imageurl = from_union([from_str, from_none], obj.get("imageurl"))
     title = from_union([from_str, from_none], obj.get("title"))
     url = from_union([from_str, from_none], obj.get("url"))
     source = from_union([from_str, from_none], obj.get("source"))
     body = from_union([from_str, from_none], obj.get("body"))
     tags = from_union([from_str, from_none], obj.get("tags"))
     categories = from_union([from_str, from_none], obj.get("categories"))
     upvotes = from_union([from_none, lambda x: int(from_str(x))], obj.get("upvotes"))
     downvotes = from_union([from_none, lambda x: int(from_str(x))], obj.get("downvotes"))
     lang = from_union([from_str, from_none], obj.get("lang"))
     source_info = from_union([SourceInfo.from_dict, from_none], obj.get("source_info"))
     return NewsRecord(id, guid, published_on, imageurl, title, url, source, body, tags, categories, upvotes, downvotes, lang, source_info)
コード例 #5
0
 def from_dict(obj: Any) -> 'Facebook':
     assert isinstance(obj, dict)
     points = from_union([from_int, from_none], obj.get("Points"))
     talking_about = from_union([from_int, from_none], obj.get("talking_about"))
     is_closed = from_union([from_none, lambda x: from_stringified_bool(from_str(x))], obj.get("is_closed"))
     likes = from_union([from_int, from_none], obj.get("likes"))
     name = from_union([from_str, from_none], obj.get("name"))
     link = from_union([from_str, from_none], obj.get("link"))
     return Facebook(points, talking_about, is_closed, likes, name, link)
コード例 #6
0
 def from_dict(obj: Any) -> 'SimilarItem':
     assert isinstance(obj, dict)
     id = from_union([from_none, lambda x: int(from_str(x)), from_int], obj.get("Id"))
     name = from_union([from_str, from_none], obj.get("Name"))
     full_name = from_union([from_str, from_none], obj.get("FullName"))
     image_url = from_union([from_str, from_none], obj.get("ImageUrl"))
     url = from_union([from_str, from_none], obj.get("Url"))
     following_type = from_union([from_int, from_none], obj.get("FollowingType"))
     return SimilarItem(id, name, full_name, image_url, url, following_type)
コード例 #7
0
 def from_dict(obj: Any) -> 'CodeRepository':
     assert isinstance(obj, dict)
     forks = from_union([from_int, from_none], obj.get("forks"))
     last_update = from_union([from_none, from_na, lambda x: int(from_str(x))], obj.get("last_update"))
     open_total_issues = from_union([from_int, from_none], obj.get("open_total_issues"))
     subscribers = from_union([from_int, from_none], obj.get("subscribers"))
     fork = from_union([from_none, lambda x: from_stringified_bool(from_str(x))], obj.get("fork"))
     closed_pull_issues = from_union([from_int, from_none], obj.get("closed_pull_issues"))
     parent = from_union([Parent.from_dict, from_none], obj.get("parent"))
     open_pull_issues = from_union([from_int, from_none], obj.get("open_pull_issues"))
     stars = from_union([from_int, from_none], obj.get("stars"))
     closed_issues = from_union([from_int, from_none], obj.get("closed_issues"))
     url = from_union([from_str, from_none], obj.get("url"))
     contributors = from_union([from_int, from_none], obj.get("contributors"))
     created_at = from_union([from_none, from_na, lambda x: int(from_str(x))], obj.get("created_at"))
     open_issues = from_union([from_int, from_none], obj.get("open_issues"))
     source = from_union([Parent.from_dict, from_none], obj.get("source"))
     closed_total_issues = from_union([from_int, from_none], obj.get("closed_total_issues"))
     size = from_union([from_int, from_none], obj.get("size"))
     last_push = from_union([from_none, from_na, lambda x: int(from_str(x))], obj.get("last_push"))
     return CodeRepository(forks, last_update, open_total_issues, subscribers, fork, closed_pull_issues, parent, open_pull_issues, stars, closed_issues, url, contributors, created_at, open_issues, source, closed_total_issues, size, last_push)
コード例 #8
0
 def from_dict(obj: Any) -> 'Twitter':
     assert isinstance(obj, dict)
     points = from_union([from_int, from_none], obj.get("Points"))
     account_creation = from_union([from_none, lambda x: int(from_str(x))], obj.get("account_creation"))
     followers = from_union([from_int, from_none], obj.get("followers"))
     statuses = from_union([from_int, from_none], obj.get("statuses"))
     link = from_union([from_str, from_none], obj.get("link"))
     lists = from_union([from_int, from_none], obj.get("lists"))
     favourites = from_union([from_int, from_none], obj.get("favourites"))
     following = from_union([from_int, from_none], obj.get("following"))
     name = from_union([from_str, from_none], obj.get("name"))
     return Twitter(points, account_creation, followers, statuses, link, lists, favourites, following, name)
コード例 #9
0
 def from_dict(obj: Any) -> 'Reddit':
     assert isinstance(obj, dict)
     points = from_union([from_int, from_none], obj.get("Points"))
     posts_per_hour = from_union([from_float, from_none], obj.get("posts_per_hour"))
     comments_per_hour = from_union([from_float, from_none], obj.get("comments_per_hour"))
     comments_per_day = from_union([from_float, from_none], obj.get("comments_per_day"))
     active_users = from_union([from_int, from_none], obj.get("active_users"))
     link = from_union([from_str, from_none], obj.get("link"))
     community_creation = from_union([from_none, lambda x: int(from_str(x)), from_int], obj.get("community_creation"))
     posts_per_day = from_union([from_float, from_none], obj.get("posts_per_day"))
     name = from_union([from_str, from_none], obj.get("name"))
     subscribers = from_union([from_int, from_none], obj.get("subscribers"))
     return Reddit(points, posts_per_hour, comments_per_hour, comments_per_day, active_users, link, community_creation, posts_per_day, name, subscribers)
コード例 #10
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["Id"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)),
                                lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.id)
     result["Url"] = from_union([from_str, from_none], self.url)
     result["ImageUrl"] = from_union([from_str, from_none], self.image_url)
     result["ContentCreatedOn"] = from_union([from_int, from_none], self.content_created_on)
     result["Name"] = from_union([from_str, from_none], self.name)
     result["Symbol"] = from_union([from_str, from_none], self.symbol)
     result["CoinName"] = from_union([from_str, from_none], self.coin_name)
     result["FullName"] = from_union([from_str, from_none], self.full_name)
     result["Algorithm"] = from_union([from_str, from_none], self.algorithm)
     result["ProofType"] = from_union([from_str, from_none], self.proof_type)
     result["FullyPremined"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)),
                                           lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))],
                                          self.fully_premined)
     result["TotalCoinSupply"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)),
                                             from_int,
                                             from_float],
                                            self.total_coin_supply)
     result["BuiltOn"] = from_union([from_str, from_none], self.built_on)
     result["SmartContractAddress"] = from_union([from_str, from_none], self.smart_contract_address)
     result["PreMinedValue"] = from_union([from_str, from_none], self.pre_mined_value)
     result["TotalCoinsFreeFloat"] = from_union([from_str, from_none], self.total_coins_free_float)
     result["SortOrder"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)),
                                       lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))],
                                      self.sort_order)
     result["Sponsored"] = from_union([from_bool, from_none], self.sponsored)
     result["Taxonomy"] = from_union([lambda x: to_class(Taxonomy, x), from_none], self.taxonomy)
     result["IsTrading"] = from_union([from_bool, from_none], self.is_trading)
     result["TotalCoinsMined"] = from_union([to_float, from_none], self.total_coins_mined)
     result["BlockNumber"] = from_union([from_int, from_none], self.block_number)
     result["NetHashesPerSecond"] = from_union([to_float, from_none], self.net_hashes_per_second)
     result["BlockReward"] = from_union([to_float, from_none], self.block_reward)
     result["BlockTime"] = from_union([from_float, from_none], self.block_time)
     return result
コード例 #11
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["id"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.id)
     result["guid"] = from_union([from_str, from_none], self.guid)
     result["published_on"] = from_union([from_int, from_none], self.published_on)
     result["imageurl"] = from_union([from_str, from_none], self.imageurl)
     result["title"] = from_union([from_str, from_none], self.title)
     result["url"] = from_union([from_str, from_none], self.url)
     result["source"] = from_union([from_str, from_none], self.source)
     result["body"] = from_union([from_str, from_none], self.body)
     result["tags"] = from_union([from_str, from_none], self.tags)
     result["categories"] = from_union([from_str, from_none], self.categories)
     result["upvotes"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.upvotes)
     result["downvotes"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.downvotes)
     result["lang"] = from_union([from_str, from_none], self.lang)
     result["source_info"] = from_union([lambda x: to_class(SourceInfo, x), from_none], self.source_info)
     return result
コード例 #12
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["Points"] = from_union([from_int, from_none], self.points)
     result["account_creation"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.account_creation)
     result["followers"] = from_union([from_int, from_none], self.followers)
     result["statuses"] = from_union([from_int, from_none], self.statuses)
     result["link"] = from_union([from_str, from_none], self.link)
     result["lists"] = from_union([from_int, from_none], self.lists)
     result["favourites"] = from_union([from_int, from_none], self.favourites)
     result["following"] = from_union([from_int, from_none], self.following)
     result["name"] = from_union([from_str, from_none], self.name)
     return result
コード例 #13
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["Points"] = from_union([from_int, from_none], self.points)
     result["posts_per_hour"] = from_union([to_float, from_none], self.posts_per_hour)
     result["comments_per_hour"] = from_union([to_float, from_none], self.comments_per_hour)
     result["comments_per_day"] = from_union([to_float, from_none], self.comments_per_day)
     result["active_users"] = from_union([from_int, from_none], self.active_users)
     result["link"] = from_union([from_str, from_none], self.link)
     result["community_creation"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.community_creation)
     result["posts_per_day"] = from_union([to_float, from_none], self.posts_per_day)
     result["name"] = from_union([from_str, from_none], self.name)
     result["subscribers"] = from_union([from_int, from_none], self.subscribers)
     return result
コード例 #14
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["Points"] = from_union([from_int, from_none], self.points)
     result["talking_about"] = from_union([from_int, from_none], self.talking_about)
     result["is_closed"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(bool, x))(x)).lower())(x))], self.is_closed)
     result["likes"] = from_union([from_int, from_none], self.likes)
     result["name"] = from_union([from_str, from_none], self.name)
     result["link"] = from_union([from_str, from_none], self.link)
     return result
コード例 #15
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["Id"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.id)
     result["Name"] = from_union([from_str, from_none], self.name)
     result["FullName"] = from_union([from_str, from_none], self.full_name)
     result["ImageUrl"] = from_union([from_str, from_none], self.image_url)
     result["Url"] = from_union([from_str, from_none], self.url)
     result["FollowingType"] = from_union([from_int, from_none], self.following_type)
     return result
コード例 #16
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["forks"] = from_union([from_int, from_none], self.forks)
     result["last_update"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.last_update)
     result["open_total_issues"] = from_union([from_int, from_none], self.open_total_issues)
     result["subscribers"] = from_union([from_int, from_none], self.subscribers)
     result["fork"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(bool, x))(x)).lower())(x))], self.fork)
     result["closed_pull_issues"] = from_union([from_int, from_none], self.closed_pull_issues)
     result["parent"] = from_union([lambda x: to_class(Parent, x), from_none], self.parent)
     result["open_pull_issues"] = from_union([from_int, from_none], self.open_pull_issues)
     result["stars"] = from_union([from_int, from_none], self.stars)
     result["closed_issues"] = from_union([from_int, from_none], self.closed_issues)
     result["url"] = from_union([from_str, from_none], self.url)
     result["contributors"] = from_union([from_int, from_none], self.contributors)
     result["created_at"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.created_at)
     result["open_issues"] = from_union([from_int, from_none], self.open_issues)
     result["source"] = from_union([lambda x: to_class(Parent, x), from_none], self.source)
     result["closed_total_issues"] = from_union([from_int, from_none], self.closed_total_issues)
     result["size"] = from_union([from_int, from_none], self.size)
     result["last_push"] = from_union([lambda x: from_none((lambda x: is_type(type(None), x))(x)), lambda x: from_str((lambda x: str((lambda x: is_type(int, x))(x)))(x))], self.last_push)
     return result