Skip to main content

Python package to generate random dictionaries of given types.

Project description

random_dict

pip downloads license Examples tested with pytest-readme Python version GitHub actions

Python package to generate random dictionaries of given types.

It is primarily intended for randomized testing purposes, where you need to generate many random dictionaries of a given type.

How do I install this package?

As usual, just download it using pip:

pip install random_dict

Usage examples

Here are some examples of how to use this package.

In all cases, you can always specify the random_state parameter to make the generation of the random dictionaries reproducible. The random_state parameter can be an integer or a random.Random object.

Generator random_string_dict

This function will generate a dictionary with given at most max_depth and max_height of type string.

from random_dict import random_string_dict

my_random_string_dict = random_string_dict(
    max_depth=4,
    max_height=3,
    random_state=42
)

An example of the generated dictionary is:

{
   "40HIKZ15ZN8R5QCM96RGOC22SVBXSHB1B25KWD8O4QHN3AOKWVRJXGT2AETKLN51ASWCF9CMRAQXAMITB730UETEIWJ4V2UFTXXTA1SLV1I1M1KA3FG2ZY85X419WCX2PT0C0OOVHEVCZPWY938TPE8LIP6SDCOG2FYRWTF3DSPE4SO9E6H8AUH8FWK867QMCVVNDE0GKNLG1SEHPNCRBMZ2RW48U05SLZDOG8JHXYI1ZH2Y2LXELB5BGLWNO3SQH0M2A9IXAGBVERDSIV0RDJW3RY6BLTD157YHFAK107NOCDMJKE48RZ4TA5RWD9EBKH8C3568W6SGS16SITXG3WQV10L4W41WCLHN0YQ7HNMKUMTSRQWPHFQVGP9WNZ45R633ASXCKZ2EBSX91YB1EY38N404MGL1AC5S2TH85JQQCGNBEOZXIVO1IJTCIE2EIYI3XAHY1JS5AUKUXI926B3DTPZD9ISLKUPSSQ7A99X2K7GMOKBIC6JQ1HWUIPPMSCT2SLFSOGWSQBC48WH5YVXDSK5D0SG03F186T3":{
      "TC6IRIZXI2ERM8YLKSVELJOFRLCAIW8DN06FKERAH5E6BIDSRHINU5PF8I922GJB767X3IIEWIXSN5XUM9OH8APMHWFFA35QFT9BEF1EA1TBU8J1PZDPKBZKZSZWIYA8S58NIG35RQ4RNHZYO7VQTO8QN5Y46GR4RMQ3ZKG77W1PREC6YAHRNBFMGI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49HALCZ2VNOQKSAL2KBBLCM168ABMA77Q8Y5HSU69PCZSVUGG55ISX2LTATBUTWTJL8UECSBEJS1YC2R36JW5XGWPX080ZDXZGLP4TJ914L3EJ1R0W5OTG9LTX2YHT0VLQOD8J3PLZ7LKO344L2E5I8LO5AIM2YMH5NNUHKJSX1XHQTJA9RYV0C3IGOULI2609VLH4IO83G77FWQQ8XAJOJR66RJPZZTSLHTMGZV0FUA539W3HBMLDTZD0H5IE557CGJF76LDS40ORBKLREN7UNKIFIEN665PL73NDIDDN1U1B0JAW8I2001C11SVUJIS0R8ZI9931LK3MHXJGGZNY6UBN40UP7H9VCCQSAUU32VENZO8C4RTTE2H6Q2YZQFTSFO1636P686Y8VEICBSQNNP9LY4C4KSRHHQSOQ11Q2NYLXSJ0E8PPTNJIXOGRC8INWUH16PH6XSCZKOXUGO2MOL4QH13I900J8JK1QFGED6PSPXM3MVPMDOSSIDYN2TPI0M6RJI9QTUOIMRIH4DRLPWETF5YK0NOAC7XB3HMX2ITHLPS4NLWU5ESB8S7QRY2BKZYKIGS7WO2T921Q6HIXAWA86A0HV2927S82INL8II5M0EVLBUDBAY6XVCKR940TZIQ98URYX9LUU9W4HZ9K24SFYTIK601GQYP7FAN77ZUJL539JHIBPZBWF8TQRH0ROWLI6BD2BS3K3CE7ID82MB3TK79K2VLS8HCWH8I406ISOR8DERNT4CCSYU":"NHPSVZSEM6RFRGD5TBOYMEGA42W7N9LSH7LNU9JRTAJ57UY70TGHIV220ES93VGIH5Y21JNSAXXR8M1MNYH2OE2K92K8CB96E2CW11903KCK1E92Z54YOO9817439BXYGH28G13TIRL9"
      },
      "A51F1IMGNDV8J53ON4VUN4S":{
         "DTY9LMREX9QDPWLE8PHI4MJHBKFYVA49L8EIWVEAFQFZW0Q597LWFQN1IMNVAKJMV7W4M7911U6PAB3E4UHQBD06NA671F81JHX26N9WBXGSDIKH5O0JAIMHHFULHM8RV1F2H7XJP8OR2JA2O4YFJHXM557RU5RNRMRNZ0DYJNX3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EMPJEV0QRLXLKVGUXIKWVMYBR0L6ROLGO2YLSDZWPL190DXDZ8Q4K67YF7YJ0SUIX6D7VFMULJZJNY77SGXWLX0TMSPY3I80E4ULQSFY2Z8ZH875M1N70VLJLU6NB0UU2IFJESZXOCLYE3G9DR6IL5YRT28YBDP5CLW2KY1MYVI65CSRSNTFCO3F6OOIU1MD4IWX4IR7OA6F6FPYZCZ4BFBQKDG73SWEHCEAJ7KZ3UFJS6WYRXQVTA2QM7GR4JL6VAVENCBR0KPN9SAIPBCVNZJ5NFI6K8S263TGY0S1K64FXA2028U97PSZK1DHRO6AHSFUFRIEXV0167M493K2WM44OGZIILW0QT7C1PA1TW2SQE0YQH0KUNYE8H3ANRPMH2B99LX4EO6ADKCVUG8YK5IXA20EZNBWJFIS4V29WGTHTIKNIJZA54UUDMVNXC6NHWM4XRQ9PJ8WHFX4HGMRZT89LRSVQ3DOCGCQBVDHOTRN51DTRALSPHYKJPKJB2DUDE3USS15Z3I36XYOVRP5BZ3A802XNQ7DKXJX65O3LTPJUCZMGE06PTGMPPRAD8ZGC1DKL0M3QMAVYQGB":"6U7UFV075MH7VA9LFGUH3KY6V1H5AXXKS7GV3IEQDKC1E73XTYAON1UWTUU4NQIQ6URACFP596M133IPMEAFSDKT51SL5PPQITQT6ZJMVUMWWHX4KREEIUG75MCZU6Z2L2NWWIOUON2K7UZJ03ZDL3OTXJ4YSSUT1ZYLZNBKSFELP264CE8DCFZUWTD7Z7NHC9YV5J3B8EP8PADQXARAQO0ETM8UKJ0ZCYXV0MGJOXWV7DAHO0XMGSJHL9JRUVHPKY1LM32XTB0K8X6YIENRLTVXZB0DAILV7G4SB8K0VSV8QC9HYLBVLU0FHZ6GHCVI79CIBVLCGMIEQH23X8NROJXOW19FJWZS0KYCIHZHHOMFUP6WULLH"
   }
}

Generator random_bool_dict

This function will generate a dictionary with given at most max_depth and max_height of type bool.

from random_dict import random_bool_dict

my_random_bool_dict = random_bool_dict(
    max_depth=4,
    max_height=3
)

An example of a generated dictionary, which is valid in Python but not JSON, is:

{
    False: {
        False: {
            True: False
        },
        True: {
            False: False
        }
    },
    True: {
        False: True
    }
}

Generator random_float_dict

This function will generate a dictionary with given at most max_depth and max_height of type float.

from random_dict import random_float_dict

my_random_float_dict = random_float_dict(
    max_depth=4,
    max_height=3
)

An example of a generated dictionary is:

{
    5.838465975049892e+17: {
        -4.008570194091692e+18: 7.671696293521426e+18
    },
    -5.404113932518959e+18: {
        -1.0826526904696832e+17: {
            -2.0148582735267492e+18: 3.867521655027165e+18
        },
        -2.9688147469768294e+17: {
            -7.380086557178485e+18: -2.506577041256698e+18
        },
        -2.9138314192637604e+18: {
            4.697547290608851e+18: 4.830654770483216e+18
        },
        3.9789321536341074e+18: {
            -3.638599544562848e+18: -7.972525504741839e+18
        }
    },
    -1.221119660224516e+18: {
        -1.3650496171266396e+18: {
            -9.213258899606604e+18: -4.296518858697994e+17
        },
        -6.628155848495411e+17: {
            3.77458873913942e+18: 5.981093646914435e+18
        },
        7.515186864336656e+18: {
            -3.219764523205816e+17: 2.251170816546177e+18
        },
        -8.644881667850097e+18: {
            7.209687400215734e+18: 2.822324547824081e+18
        }
    },
    2.58967476722851e+18: {
        -2.326310449248946e+18: -2.1900475783758582e+18
    },
    4.875708300200688e+18: {
        -1.8343697977334477e+18: {
            -1.4504606390152458e+18: 7.405124711101133e+18
        },
        7.058700713359712e+18: {
            1.886613655377924e+18: -2.3740162253553807e+18
        },
        3.116858697691941e+18: {
            -2.888025820273885e+18: -4.3122215786878013e+18
        },
        1.660050777956436e+18: {
            5.71100290923741e+18: -7.972143965030861e+18
        }
    }
}

Generator random_int_dict

This function will generate a dictionary with given at most max_depth and max_height of type int.

from random_dict import random_int_dict

my_random_int_dict = random_int_dict(
    max_depth=4,
    max_height=3
)

An example of a generated dictionary is:

{
    -8957474761186343626: {
        7292188101330365487: -2468660774499068450
    },
    4067273498737636301: {
        -6046743244139167770: -7189532293873771925
    },
    -2334320921180678090: {
        8773594462708811803: -2193239901719276460
    },
    5562838892642811787: {
        3164652842771697394: -6347020828801507995
    },
    245279891019254836: {
        -1892486395089534380: 6305871656619735194
    }
}

Generator random_dict

This function will generate a dictionary with given at most max_depth and max_height of mixed types. You can specify the types of keys and values by passing the key_generators and value_generators arguments. By default, they are set to the string "all", which means that all supported types of generators will be used.

from random_dict import random_dict

my_random_dict = random_dict(
    max_depth=4,
    max_height=3,
    key_generators="all",
    value_generators="all"
)

An example of a generated dictionary is:

{
    True: {
        3850809717962289273: {
            5.032368430002846e+18: (
                b'EFF57S5PY92OT4WZ5PG90ZP3UQ5DID06KT0N8Y96IX61RDNGWXFT66U8JZCZRMQ54FTIXEVDHSGDWRG82A017CQZQFZFHE6L86XNR6SPIHF9XVFGOGMR60YM9XN5UFFCO23J5AGE3K2PPWBXAXS57DFQT64VM22OPDU0G2ZPYN0J6UZF3WY3NNU96F1FY3VVHPYH4L3I9PZTGZMGAGORBCJPU4LSTI9K87BR8VFLU2RSUE5BFQ1V7TFVI6EXKDFRSS1O7H9DWGYRW96TOQ9QW0HSMLMOK7IISGNOKFGC9KFHP27WQ52SP91HPVS7SUD2FK2DPJSZSZNMEM8RH55KGT6KHTMPXICIV8CNDJCULGXS6QSZUZER75ZJIDLHZ75UKCKJWJBHWW9J1HGPJHKVE6OLAG51R053458W88ZU0S9UBHNRIN6YPRVBS8IR3EUTE0K6O28GOPIWO6QZ01NW9EELAASWELBW4PTWKCTH1PQPX6Q6J59FR1FF9LU3ONLY5CGZ8T0A7B00YFHY6H2ILMT0IVQLX0JODBXYIQO1TH25FYAJEFIRF6UCK49PES054JSUNUA24PQAYCJSBTMKTVQD7DS2WWMPYIB5DUYPHNLFWH5LQIRZCU98F8802C9PCLRR59O2YTDMA7OVN20HXZU05XIGTKGMS6JK0BE6MHH8CV1AH2MYP89CHRT5X058O09S1L05I3TE4GMPGPABDGJZ6NI34AQ7TXIP4PFWW0UMXRWNPVRRAJZV',
                -1.2646110568889774e+18
            )
        },
        -122348294308631256: {
            -1.3225498068959724e+18: b'25RW02BTH31GPEKTMPV3BWWLLC32KMLWM2HYT25RWXSXAC9UV790VGF6XDUCWC7U4OQ681SKX3765KTYEOVCNMAJHEOEYC0058KZJASHHD4GSRSWW6DNC5C5RF53W4M2MUFBAIOKFT203L7ZXVL7GBP95XGXKX6OG32WZ4DBW1U707N4BTFGDAXM3Z1ZKEKAWI24ILLHGQIH53DUBJ1LZ067M8AEO4WTDL5H7I8BWD2H507WVF78981K7BTKDFBSQC7UTS0U5UDCSPIBEOVDGMHLXJ61P58H5CFHNITB22JBBDOCR8KSVFUXXAUF8CIM599HKEJXQ152D33PG7DGF0IJXMDTJLZYSLEU5T7EI5XPF5660G4FN4PDCQ1FPXQJHG60D7A1YGVQ134FD4AVO9LBAXM0RM0COF8097MPAIPU4FOLMEZZ03XJSOHNFX9GIM0WWHLOUKISLMS3K789QP07BAITDUHXNZVHBTU82H8ZG9I2Y66Z47T0ZE7HCB5F9Z5QU52WCX8BVXPJ3IJQDQ1KQWZ6D8NR8QRAVMYIQXLZ8NA0ETIM9NSI8XRG2DJOO42M82IR9258TOVUPGGJKWNJVOGMFQQ96MR6A05EGZ7DCSG16816LVQ0ZYE95TIRZF659CP0UHJ7PUCRGP92WPU1U4H81N35R8BB7K1U8ZPO21ZBL5O1G8AD0F6DTMUQE3IRFDBF5VJRYWN7UO1J62NU08W211WR1M0XAZ5Q5R106QFCU1Z53TQZH7ICUYOTKGSG79LF8LJGL2CH7DL8LWPNUI6UE2Z3M8EQ9ZHDAB9IXKGA5IW64POQZUDC8LBDF7LWFUEXKDVOIMJOD'
        }
    },
    'TFSFW0JAO1CBKOJZ94AXQ7RNKOU3W87MD42DFVJ88VQ491AYO8WEXKDRFRB8G9HOYRS5N3IGYJ3VZF': {
        (False, True): {
            False: -2424799385895555469
        },
        (
            6842235171093970376,
            b'ILHM8KRE223JOSTT9PLKHFSRIAG44C9KEKSSA501XVGXAKHF1O0LRWYYYH0ED9R6X8CTLS8T24RE18X6X5KKMLPIJ3V939NPWA72ZOYTAVO8295B85Y52VQPGOJODKC4BA039BIYWOXD9KF8FX825EF7WEEEL86TQR24HR38TKPF8ONI5HMW37SCXKPMBA7LQ6AAPS82WPJ574U28M1RLQNA2XNBLNYRYT7NTSBCBPZH0HQEJ3J78KF3BK3WI7GEJH2W8DIEEMY7BVI4LPKLRCA6BREGOZUSPDTCT8TRDRHUVJ9ZLHZWCS3CGB64U84BE1ZGCDI6HU1KIHWN030OSCXQVEJJ0TPX92IICSZJ6WXBUIGABDXG1OMXUYGFVRPJ2SHELHSWQ9EHRU1I9NLAXU9IKUHBVEI9552W9XN0VE9CE26OS'
        ): {},
        7920822393579589677: {
            -9010294765205127260: (
                False,
                'A6X5JJ5P4B1ONMURF0B0QAWU9K3MAGJ5D2T1860RQPJ3ASKV5NCRMGVWFG2BSUCCD95PSJT2VSIETOHND9RTL4DPEI9CE39CRXVLNJVWKMLAO1CSGO4L7MAETQ1PJ08MU95O7C0NM4WUKM6555ZGFGOJFPHLTLN8YXB92YX3BBFDA5P0N7QN54DW0YFTXFYFIIBFFVWSNWFJIM6GIT3H1TSDJGJCTRAZT23ZIG6KXTQS46RK3285QSEET85N75I1QNCOODPWEYGHL2M4NR28WE97JCBGEKYJ4DBMWHHT0CR3GKIAD4Z3MZ8LZJ5Q6JQPJZF6D4T7AJLSL32D0IV29NVN9X25PSYVS9F94YUTOMDH7PPQISS5Q76RE6K78QHFGB2354DJYPU0ZN03NKPZCID1ST035VSRYXDYDD3JQYFARCYAT2I4BQGC8XN9ZD0TTM8GLR7PPE2JM9R34XWB36QQBJITIC32R0SUXYSL5GPPQL1LY719SF79WUEZL1GI6IOKMYDZ6KFNIQYGWTUQY25RB01VV6HVZ8UW0FY1CVKGPJ05GTCAI3N7C23VEI9FPZ7BPFAZA09271IMH1T31XSPD1LR0K4UUNEWNH5WOGB67D3DFRIMVS3EJE4519KXE1OE80KON3B2NDJL62WYLP6K2OGKEL4SLFPWS9ZUBMT1A2D92VQOAZUXRKOJBB8GL94YEQCZ6C21QJNY3GNRJDTIQH962ZDPT2O6KKB9DJZYM3EE618B3AER1L03TYCBG7HNIRAB71R3CJI7RT2P1O0JUWNG9A0AZX8TB930P8LFB7XNOPJ0FIJ19IHAIEYHJ0T1KTE4J8BHV6540SBQ0WPFBNLDTPYTQS7WTD7ZIOY5G08HYQVEK8XKCYGYT8DMABZPXVPJUYU6F56AAMS4Y3IZNZ0GIWN1O1ZKJ0S5JWVF4RMGDJ9M116AWAN2IOLM'
            )
        },
        -1432440954087030864: {
            True: b'KDOGGSCTWXFUU7BMGPDPG0XOJ7IZ1UCME1XDE17B5YXP00HHV2TUNCFY0CAYWBQ543XVGZ3ANU3ALROWP6U10WGN31LSA82A9QZT3VGNI0LBN2QGET1BKJ9184JNUUMJ1H04H23W3XA2YDSMLYKR4SEW5BT1XZI9WYG3FXCCM9LI6BN8FMF1E5QQNU4ME2IE7TMBKITB26F01OMIQQ9NWS9KBO2Z0HD4P3KM4HPNXN2BJ1W3073TJA5Q9ARE29QVY34N0ZFSSEQJH3UF5F4VGHIDVKB83J3CL3XOYZ0BJGJ9V66642XYRAPI1OWNLN26B49AHR2BTYBDGPPYOF39EZA8SPJ3717DFZUBC4UUSTBAOZ57NDWMWNZFVL50VZRXEAFRKPYKEYZMPGKUDO7V73PEPVX95NIDLZSP9FM49TFVM7DIOIJ2P77Q3JPQB7R4YDSDON30TVP8ZBBMNJ0CFR1LGRIY9VELWCHR8UA0HACLY0XBZ9SVTKCOO5K0FHYNXLKLGSSBM78KI5A937MZJW0LC4J6G33NJBJWJ6ARKEZ0W32QGHSDQLX75NOHCJZMLA6DGPUWZ1OLKHOCAL0IH0XE2UY1AZ0H7X11XIZGGBWFBNY6CIEGA78W9O5PONTAOLSAB1EXGA3I74UK8IHQI7F6IRCBQIFYZ6J32RA0VQQFO'
        }
    },
    'RES628Z47JL28CMERAIQZI42REEGHA0VRJOJTE06K4IO2Z24LVL7LCGVYYVL7GJ61FP6CX7XJLM16C3O57JE0DYQGMKHA34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AKX48JBZVCAXYXYM7TK9X7YXVTW3Z8X9V19L7TOZPAXWH7MQ2CC3HDUZIYOMWV9ZIIE6R7NZL8RZPIYAKRISXER2L8A7P8EVSGKL': 2324388942594025560,
        (
            'YJ1Q0WR5IVMPFYM9KTGEM8YYAO1W9OB6TQ404IYGHUWT85JDCCQZDY7NZ4LITW3OY6B8D3MVP4E3YQLS4YGUQT31MNSI001B8NTS34SFU4J5WS4A9SQ811HRZD2MYGFJ4K9KH0TG4MOLAYYEAG3MAF4IUBJ1JTKSQP27DWSLG5ZT0YQR1JO46W1C1ZN4ZCP4A272V6SXY3GXJCZZW7FDV4DBHY3V29GT915M59PQQEKG4E92KHL48ZSU3Y7OSIOOJNNYA63R6Y7CDMIV15IUN5B49XNNLJXV0G6KIOM61WQUOWVLT05ACN43WR6MQ33JDN78Q0W2Z7L6IA9OV954VOJHBIVCKNU2XNB80DGJUPLTA94TZ1ZM4PPY25MAIKYNTF5NQLNBUG1TKBZ0D3V8NM42UYAYQ3AO786DW1FJUTW3MZ7FFRAH',
           b'UUSS21AL8PSUZK3BAX3YXS8K664I7URYKKN097Y9L9LF6QU3Z2F1ORL3BTAAKU7XE3NGM0EKX3X65SM921VRV1826KYJYNT8FZJFRB1PA17UFGMOUKPNNOPD9RLECS1LAMX6FO35485TMXBGVTGH3ZUWXB13SCC0NN4MWFYVGI4S21HXCG4RHNGZDT3EH2HW9IF73KVSMB9TY1MLR7N7MCJ7AFIV07JGJH4TSZWA7IGCHLOTP4EL949RWCWAO6HHISB'
        ): (
            'WOPHI8X3H5TDDTGTNWV489M1O97MV7DSB104CB07UVMFTW6KBXXN8VJRLDIGGW3NARU3A2ZU3EM3WC512QUWP4R3D93JFSXKYMZ8WZSQWNHUI19RXKXZW71EJE3KYUYP13LNY39Q7SAHNIJRMZ98382B5UT5HY29YS8CORZ96X3F58RGH6QI4UBSMDDZ3ZA5XGFRLD4UQSIDY3CYFAKLI1TGAJV0I4H5EX6F3ESXS2FRP3RM9KB9EN7Y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9ICDVGZV7P5G4UCT5B5HN3R5T4QWM7J9V1XBEC5NYVS1JSQPYIG0ZXO6IWPLXTBT11O0Z20M72N8N6L'
        ),
        (
            b'173JWAZOXARHJ6SEUI9DD1SOHN5VCTY8TAHPXN3QEGKSFE10SLCVAZLM5O99V8292AI9ICNM6OGX25ZVWBXF2Q0BK1HE7H206VK6DVLU8VAG5IP3S7WFET5VUSY4SZ6FF6ASGLZ0CN97ZV2XLZGF93HOI0AVBVCJ0SJI27NZR9R87NQ9VUQ5UFWB62X22Q0CASBUB1X8S23FF03VJDEK2Q2W32RCJIYN3QRSER8WZM3AOL5Y2DZMXR0RORO15RMNBCCR5WQKQIGYD7VLGU2RFPJZ100H842K9INVMGURYR3XMZDMO87J1DRVT00F1867BYOZU2ZFRHMA70OKIR98I8LNXDHNTK8NT3QXE35KEFLEIE',
            False
        ): -3665858169163958488
    }
}

Using custom generators

Since we mentioned above that you can specify the types of keys and values by passing the key_generators and value_generators arguments, you can also pass custom generators. Here is a mixed example:

from typing import List, Optional
from random import Random
from random_dict import random_dict, random_int, random_bool

def custom_list_generator(random_state: Optional[Random] = None) -> List[int]:
    """Return a list of 3 random integers.
    
    Parameters
    ----------
    random_state : Optional[Random]
        The random state to use for generating random numbers.
    """
    if random_state is None:
        random_state = Random()
    return random_state.choices([1, 2, 3, 4, 5], k=3)

my_random_dict = random_dict(
    max_depth=4,
    max_height=3,
    key_generators=[random_int, random_bool],
    value_generators=[random_int, random_bool, custom_list_generator]
)

More generated examples can be found within the examples folder.

License

This project is licensed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

random_dict-1.2.0.tar.gz (62.0 kB view details)

Uploaded Source

File details

Details for the file random_dict-1.2.0.tar.gz.

File metadata

  • Download URL: random_dict-1.2.0.tar.gz
  • Upload date:
  • Size: 62.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.9

File hashes

Hashes for random_dict-1.2.0.tar.gz
Algorithm Hash digest
SHA256 05ad321988cf603480fdb962f5afc6e05d27b346f6196d2e53b12c5797051500
MD5 0021763d2182376c7257bb155c205fad
BLAKE2b-256 3ee6504d230ac81b2e9efd8262409291626d9eeba9215b0be75170bf5789eb9c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page