How to use the pydash.assign function in pydash

To help you get started, we’ve selected a few pydash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dgilland / pydash / tests / test_objects.py View on Github external
def test_assign(case, expected):
    assert _.assign(*case) == expected
github JPStrydom / Crypto-Trading-Bot / src / trader.py View on Github external
:type balance_item: dict
        """
        btc_price = 1
        is_tracked = False
        if balance_item["Currency"] != "BTC":
            coin_pair = "BTC-" + balance_item["Currency"]
            is_tracked = coin_pair in self.Database.trades["trackedCoinPairs"]
            btc_price = self.get_current_price(coin_pair, "bid")

        try:
            btc_value = round(btc_price * balance_item["Balance"], 8)
        except TypeError as exception:
            logger.exception(exception)
            btc_value = 0

        return py_.assign(
            py_.pick(balance_item, "Currency", "Balance"),
            {"BtcValue": btc_value, "IsTracked": is_tracked}
        )
github opendatacube / datacube-stats / datacube_stats / output_drivers.py View on Github external
def build_attrs(name, attrs):
            return pydash.assign(dict(long_name=name,
                                      coverage_content_type='modelResult'),  # defaults
                                 attrs,                                      # Defined by plugin
                                 self.var_attributes.get(name, {}))          # From config, highest priority
github opendatacube / datacube-stats / datacube_stats / virtual / output_drivers.py View on Github external
def build_attrs(name, attrs):
            return pydash.assign(dict(long_name=name,
                                      coverage_content_type='modelResult'),  # defaults
                                 attrs,                                      # Defined by plugin
                                 self.var_attributes.get(name, {}))          # From config, highest priority

pydash

The kitchen sink of Python utility libraries for doing "stuff" in a functional way. Based on the Lo-Dash Javascript library.

MIT
Latest version published 4 days ago

Package Health Score

90 / 100
Full package analysis