From a5b6ea9d65ab5ce02bb86418508be49458c744e6 Mon Sep 17 00:00:00 2001 From: Jon Hagg Date: Mon, 31 Aug 2020 10:34:15 -0700 Subject: [PATCH 1/2] chore: add black to dependencies --- Pipfile | 1 + Pipfile.lock | 254 +++++++++++++++++++++++++++------------- requirements.txt | 1 + requirements_freeze.txt | 21 +++- 4 files changed, 192 insertions(+), 85 deletions(-) diff --git a/Pipfile b/Pipfile index c44713563..866972ca6 100644 --- a/Pipfile +++ b/Pipfile @@ -4,6 +4,7 @@ url = "https://pypi.org/simple" verify_ssl = true [dev-packages] +black = "*" [packages] geopy = "==1.20.0" diff --git a/Pipfile.lock b/Pipfile.lock index dd317f3bb..680940e60 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "e35ccebf38b0185679b10c45e6864c56f9f7793b9be56b6b9ea17cfcb23d7fb2" + "sha256": "9b846cef1243ecb6579ea34ee5b75de9e6303a910d14474dfb49df2444b2432e" }, "pipfile-spec": 6, "requires": {}, @@ -16,94 +16,85 @@ "default": { "attrs": { "hashes": [ - "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c", - "sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72" + "sha256:0ef97238856430dcf9228e07f316aefc17e8939fc8507e18c6501b761ef1a42a", + "sha256:2867b7b9f8326499ab5b0e2d12801fa5c98842d2cbd22b35112ae04bf85b4dff" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==19.3.0" + "version": "==20.1.0" }, "bcrypt": { "hashes": [ - "sha256:69361315039878c0680be456640f8705d76cb4a3a3fe1e057e0f261b74be4b31", - "sha256:0258f143f3de96b7c14f762c770f5fc56ccd72f8a1857a451c1cd9a655d9ac89", - "sha256:436a487dec749bca7e6e72498a75a5fa2433bda13bac91d023e18df9089ae0b8", - "sha256:a190f2a5dbbdbff4b74e3103cef44344bc30e61255beb27310e2aec407766052", - "sha256:6305557019906466fc42dbc53b46da004e72fd7a551c044a827e572c82191752", - "sha256:763669a367869786bb4c8fcf731f4175775a5b43f070f50f46f0b59da45375d0", - "sha256:5432dd7b34107ae8ed6c10a71b4397f1c853bd39a4d6ffa7e35f40584cffd161", - "sha256:a595c12c618119255c90deb4b046e1ca3bcfad64667c43d1166f2b04bc72db09", - "sha256:ff032765bb8716d9387fd5376d987a937254b0619eff0972779515b5c98820bc", - "sha256:6fe49a60b25b584e2f4ef175b29d3a83ba63b3a4df1b4c0605b826668d1b6be5", - "sha256:0b0069c752ec14172c5f78208f1863d7ad6755a6fae6fe76ec2c80d13be41e42", - "sha256:9fe92406c857409b70a38729dbdf6578caf9228de0aef5bc44f859ffe971a39e", - "sha256:ce4e4f0deb51d38b1611a27f330426154f2980e66582dc5f438aad38b5f24fc1", - "sha256:c9457fa5c121e94a58d6505cadca8bed1c64444b83b3204928a866ca2e599105", - "sha256:74a015102e877d0ccd02cdeaa18b32aa7273746914a6c5d0456dd442cb65b99c", - "sha256:8b10acde4e1919d6015e1df86d4c217d3b5b01bb7744c36113ea43d529e1c3de", - "sha256:d7bdc26475679dd073ba0ed2766445bb5b20ca4793ca0db32b399dccc6bc84b7", - "sha256:cb93f6b2ab0f6853550b74e051d297c27a638719753eb9ff66d1e4072be67133", - "sha256:19a4b72a6ae5bb467fea018b825f0a7d917789bcfe893e53f15c92805d187294" + "sha256:5b93c1726e50a93a033c36e5ca7fdcd29a5c7395af50a6892f5d9e7c6cfbfb29", + "sha256:63d4e3ff96188e5898779b6057878fecf3f11cfe6ec3b313ea09955d587ec7a7", + "sha256:81fec756feff5b6818ea7ab031205e1d323d8943d237303baca2c5f9c7846f34", + "sha256:a67fb841b35c28a59cebed05fbd3e80eea26e6d75851f0574a9273c80f3e9b55", + "sha256:c95d4cbebffafcdd28bd28bb4e25b31c50f6da605c81ffd9ad8a3d1b2ab7b1b6", + "sha256:cd1ea2ff3038509ea95f687256c46b79f5fc382ad0aa3664d200047546d511d1", + "sha256:cdcdcb3972027f83fe24a48b1e90ea4b584d35f1cc279d76de6fc4b13376239d" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==3.1.7" + "markers": "python_version >= '3.6'", + "version": "==3.2.0" }, "cffi": { "hashes": [ - "sha256:267adcf6e68d77ba154334a3e4fc921b8e63cbb38ca00d33d40655d4228502bc", - "sha256:26f33e8f6a70c255767e3c3f957ccafc7f1f706b966e110b855bfe944511f1f9", - "sha256:3cd2c044517f38d1b577f05927fb9729d3396f1d44d0c659a445599e79519792", - "sha256:4a03416915b82b81af5502459a8a9dd62a3c299b295dcdf470877cb948d655f2", - "sha256:4ce1e995aeecf7cc32380bc11598bfdfa017d592259d5da00fc7ded11e61d022", - "sha256:4f53e4128c81ca3212ff4cf097c797ab44646a40b42ec02a891155cd7a2ba4d8", - "sha256:4fa72a52a906425416f41738728268072d5acfd48cbe7796af07a923236bcf96", - "sha256:66dd45eb9530e3dde8f7c009f84568bc7cac489b93d04ac86e3111fb46e470c2", - "sha256:6923d077d9ae9e8bacbdb1c07ae78405a9306c8fd1af13bfa06ca891095eb995", - "sha256:833401b15de1bb92791d7b6fb353d4af60dc688eaa521bd97203dcd2d124a7c1", - "sha256:8416ed88ddc057bab0526d4e4e9f3660f614ac2394b5e019a628cdfff3733849", - "sha256:892daa86384994fdf4856cb43c93f40cbe80f7f95bb5da94971b39c7f54b3a9c", - "sha256:98be759efdb5e5fa161e46d404f4e0ce388e72fbf7d9baf010aff16689e22abe", - "sha256:a6d28e7f14ecf3b2ad67c4f106841218c8ab12a0683b1528534a6c87d2307af3", - "sha256:b1d6ebc891607e71fd9da71688fcf332a6630b7f5b7f5549e6e631821c0e5d90", - "sha256:b2a2b0d276a136146e012154baefaea2758ef1f56ae9f4e01c612b0831e0bd2f", - "sha256:b87dfa9f10a470eee7f24234a37d1d5f51e5f5fa9eeffda7c282e2b8f5162eb1", - "sha256:bac0d6f7728a9cc3c1e06d4fcbac12aaa70e9379b3025b27ec1226f0e2d404cf", - "sha256:c991112622baee0ae4d55c008380c32ecfd0ad417bcd0417ba432e6ba7328caa", - "sha256:cda422d54ee7905bfc53ee6915ab68fe7b230cacf581110df4272ee10462aadc", - "sha256:d3148b6ba3923c5850ea197a91a42683f946dba7e8eb82dfa211ab7e708de939", - "sha256:d6033b4ffa34ef70f0b8086fd4c3df4bf801fee485a8a7d4519399818351aa8e", - "sha256:ddff0b2bd7edcc8c82d1adde6dbbf5e60d57ce985402541cd2985c27f7bec2a0", - "sha256:e23cb7f1d8e0f93addf0cae3c5b6f00324cccb4a7949ee558d7b6ca973ab8ae9", - "sha256:effd2ba52cee4ceff1a77f20d2a9f9bf8d50353c854a282b8760ac15b9833168", - "sha256:f90c2267101010de42f7273c94a1f026e56cbc043f9330acd8a80e64300aba33", - "sha256:f960375e9823ae6a07072ff7f8a85954e5a6434f97869f50d0e41649a1c8144f", - "sha256:fcf32bf76dc25e30ed793145a57426064520890d7c02866eb93d3e4abe516948" - ], - "version": "==1.14.1" + "sha256:0da50dcbccd7cb7e6c741ab7912b2eff48e85af217d72b57f80ebc616257125e", + "sha256:12a453e03124069b6896107ee133ae3ab04c624bb10683e1ed1c1663df17c13c", + "sha256:15419020b0e812b40d96ec9d369b2bc8109cc3295eac6e013d3261343580cc7e", + "sha256:15a5f59a4808f82d8ec7364cbace851df591c2d43bc76bcbe5c4543a7ddd1bf1", + "sha256:23e44937d7695c27c66a54d793dd4b45889a81b35c0751ba91040fe825ec59c4", + "sha256:29c4688ace466a365b85a51dcc5e3c853c1d283f293dfcc12f7a77e498f160d2", + "sha256:57214fa5430399dffd54f4be37b56fe22cedb2b98862550d43cc085fb698dc2c", + "sha256:577791f948d34d569acb2d1add5831731c59d5a0c50a6d9f629ae1cefd9ca4a0", + "sha256:6539314d84c4d36f28d73adc1b45e9f4ee2a89cdc7e5d2b0a6dbacba31906798", + "sha256:65867d63f0fd1b500fa343d7798fa64e9e681b594e0a07dc934c13e76ee28fb1", + "sha256:672b539db20fef6b03d6f7a14b5825d57c98e4026401fce838849f8de73fe4d4", + "sha256:6843db0343e12e3f52cc58430ad559d850a53684f5b352540ca3f1bc56df0731", + "sha256:7057613efefd36cacabbdbcef010e0a9c20a88fc07eb3e616019ea1692fa5df4", + "sha256:76ada88d62eb24de7051c5157a1a78fd853cca9b91c0713c2e973e4196271d0c", + "sha256:837398c2ec00228679513802e3744d1e8e3cb1204aa6ad408b6aff081e99a487", + "sha256:8662aabfeab00cea149a3d1c2999b0731e70c6b5bac596d95d13f643e76d3d4e", + "sha256:95e9094162fa712f18b4f60896e34b621df99147c2cee216cfa8f022294e8e9f", + "sha256:99cc66b33c418cd579c0f03b77b94263c305c389cb0c6972dac420f24b3bf123", + "sha256:9b219511d8b64d3fa14261963933be34028ea0e57455baf6781fe399c2c3206c", + "sha256:ae8f34d50af2c2154035984b8b5fc5d9ed63f32fe615646ab435b05b132ca91b", + "sha256:b9aa9d8818c2e917fa2c105ad538e222a5bce59777133840b93134022a7ce650", + "sha256:bf44a9a0141a082e89c90e8d785b212a872db793a0080c20f6ae6e2a0ebf82ad", + "sha256:c0b48b98d79cf795b0916c57bebbc6d16bb43b9fc9b8c9f57f4cf05881904c75", + "sha256:da9d3c506f43e220336433dffe643fbfa40096d408cb9b7f2477892f369d5f82", + "sha256:e4082d832e36e7f9b2278bc774886ca8207346b99f278e54c9de4834f17232f7", + "sha256:e4b9b7af398c32e408c00eb4e0d33ced2f9121fd9fb978e6c1b57edd014a7d15", + "sha256:e613514a82539fc48291d01933951a13ae93b6b444a88782480be32245ed4afa", + "sha256:f5033952def24172e60493b68717792e3aebb387a8d186c43c020d9363ee7281" + ], + "version": "==1.14.2" }, "cryptography": { "hashes": [ - "sha256:0c608ff4d4adad9e39b5057de43657515c7da1ccb1807c3a27d4cf31fc923b4b", - "sha256:0cbfed8ea74631fe4de00630f4bb592dad564d57f73150d6f6796a24e76c76cd", - "sha256:124af7255ffc8e964d9ff26971b3a6153e1a8a220b9a685dc407976ecb27a06a", - "sha256:384d7c681b1ab904fff3400a6909261cae1d0939cc483a68bdedab282fb89a07", - "sha256:45741f5499150593178fc98d2c1a9c6722df88b99c821ad6ae298eff0ba1ae71", - "sha256:4b9303507254ccb1181d1803a2080a798910ba89b1a3c9f53639885c90f7a756", - "sha256:4d355f2aee4a29063c10164b032d9fa8a82e2c30768737a2fd56d256146ad559", - "sha256:51e40123083d2f946794f9fe4adeeee2922b581fa3602128ce85ff813d85b81f", - "sha256:8713ddb888119b0d2a1462357d5946b8911be01ddbf31451e1d07eaa5077a261", - "sha256:8e924dbc025206e97756e8903039662aa58aa9ba357d8e1d8fc29e3092322053", - "sha256:8ecef21ac982aa78309bb6f092d1677812927e8b5ef204a10c326fc29f1367e2", - "sha256:8ecf9400d0893836ff41b6f977a33972145a855b6efeb605b49ee273c5e6469f", - "sha256:9367d00e14dee8d02134c6c9524bb4bd39d4c162456343d07191e2a0b5ec8b3b", - "sha256:a09fd9c1cca9a46b6ad4bea0a1f86ab1de3c0c932364dbcf9a6c2a5eeb44fa77", - "sha256:ab49edd5bea8d8b39a44b3db618e4783ef84c19c8b47286bf05dfdb3efb01c83", - "sha256:bea0b0468f89cdea625bb3f692cd7a4222d80a6bdafd6fb923963f2b9da0e15f", - "sha256:bec7568c6970b865f2bcebbe84d547c52bb2abadf74cefce396ba07571109c67", - "sha256:ce82cc06588e5cbc2a7df3c8a9c778f2cb722f56835a23a68b5a7264726bb00c", - "sha256:dea0ba7fe6f9461d244679efa968d215ea1f989b9c1957d7f10c21e5c7c09ad6" + "sha256:10c9775a3f31610cf6b694d1fe598f2183441de81cedcf1814451ae53d71b13a", + "sha256:180c9f855a8ea280e72a5d61cf05681b230c2dce804c48e9b2983f491ecc44ed", + "sha256:247df238bc05c7d2e934a761243bfdc67db03f339948b1e2e80c75d41fc7cc36", + "sha256:26409a473cc6278e4c90f782cd5968ebad04d3911ed1c402fc86908c17633e08", + "sha256:2a27615c965173c4c88f2961cf18115c08fedfb8bdc121347f26e8458dc6d237", + "sha256:2e26223ac636ca216e855748e7d435a1bf846809ed12ed898179587d0cf74618", + "sha256:321761d55fb7cb256b771ee4ed78e69486a7336be9143b90c52be59d7657f50f", + "sha256:4005b38cd86fc51c955db40b0f0e52ff65340874495af72efabb1bb8ca881695", + "sha256:4b9e96543d0784acebb70991ebc2dbd99aa287f6217546bb993df22dd361d41c", + "sha256:548b0818e88792318dc137d8b1ec82a0ab0af96c7f0603a00bb94f896fbf5e10", + "sha256:725875681afe50b41aee7fdd629cedbc4720bab350142b12c55c0a4d17c7416c", + "sha256:7a63e97355f3cd77c94bd98c59cb85fe0efd76ea7ef904c9b0316b5bbfde6ed1", + "sha256:94191501e4b4009642be21dde2a78bd3c2701a81ee57d3d3d02f1d99f8b64a9e", + "sha256:969ae512a250f869c1738ca63be843488ff5cc031987d302c1f59c7dbe1b225f", + "sha256:9f734423eb9c2ea85000aa2476e0d7a58e021bc34f0a373ac52a5454cd52f791", + "sha256:b45ab1c6ece7c471f01c56f5d19818ca797c34541f0b2351635a5c9fe09ac2e0", + "sha256:cc6096c86ec0de26e2263c228fb25ee01c3ff1346d3cfc219d67d49f303585af", + "sha256:dc3f437ca6353979aace181f1b790f0fc79e446235b14306241633ab7d61b8f8", + "sha256:e7563eb7bc5c7e75a213281715155248cceba88b11cb4b22957ad45b85903761", + "sha256:e7dad66a9e5684a40f270bd4aee1906878193ae50a4831922e454a2a457f1716", + "sha256:eb80a288e3cfc08f679f95da72d2ef90cb74f6d8a8ba69d2f215c5e110b2ca32", + "sha256:fa7fbcc40e2210aca26c7ac8a39467eae444d90a2c346cbcffd9133a166bcc67" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", - "version": "==3.0" + "version": "==3.1" }, "geographiclib": { "hashes": [ @@ -130,11 +121,11 @@ }, "more-itertools": { "hashes": [ - "sha256:68c70cc7167bdf5c7c9d8f6954a7837089c6a36bf565383919bb595efb8a17e5", - "sha256:b78134b2063dd214000685165d81c154522c3ee0a1c0d4d113c80361c234c5a2" + "sha256:6f83822ae94818eae2612063a5101a7311e68ae8002005b5e05f03fd74a86a20", + "sha256:9b30f12df9393f0d28af9210ff8efe48d10c94f73e5daf886f10c4b0b0b4f03c" ], "markers": "python_version >= '3.5'", - "version": "==8.4.0" + "version": "==8.5.0" }, "numpy": { "hashes": [ @@ -348,5 +339,110 @@ "version": "==0.2.5" } }, - "develop": {} + "develop": { + "appdirs": { + "hashes": [ + "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41", + "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128" + ], + "version": "==1.4.4" + }, + "black": { + "hashes": [ + "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea", + "sha256:70b62ef1527c950db59062cda342ea224d772abdf6adc58b86a45421bab20a6b" + ], + "index": "pypi", + "version": "==20.8b1" + }, + "click": { + "hashes": [ + "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a", + "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", + "version": "==7.1.2" + }, + "mypy-extensions": { + "hashes": [ + "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d", + "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8" + ], + "version": "==0.4.3" + }, + "pathspec": { + "hashes": [ + "sha256:7d91249d21749788d07a2d0f94147accd8f845507400749ea19c1ec9054a12b0", + "sha256:da45173eb3a6f2a5a487efba21f050af2b41948be6ab52b6a1e3ff22bb8b7061" + ], + "version": "==0.8.0" + }, + "regex": { + "hashes": [ + "sha256:0dc64ee3f33cd7899f79a8d788abfbec168410be356ed9bd30bbd3f0a23a7204", + "sha256:1269fef3167bb52631ad4fa7dd27bf635d5a0790b8e6222065d42e91bede4162", + "sha256:14a53646369157baa0499513f96091eb70382eb50b2c82393d17d7ec81b7b85f", + "sha256:3a3af27a8d23143c49a3420efe5b3f8cf1a48c6fc8bc6856b03f638abc1833bb", + "sha256:46bac5ca10fb748d6c55843a931855e2727a7a22584f302dd9bb1506e69f83f6", + "sha256:4c037fd14c5f4e308b8370b447b469ca10e69427966527edcab07f52d88388f7", + "sha256:51178c738d559a2d1071ce0b0f56e57eb315bcf8f7d4cf127674b533e3101f88", + "sha256:5ea81ea3dbd6767873c611687141ec7b06ed8bab43f68fad5b7be184a920dc99", + "sha256:6961548bba529cac7c07af2fd4d527c5b91bb8fe18995fed6044ac22b3d14644", + "sha256:75aaa27aa521a182824d89e5ab0a1d16ca207318a6b65042b046053cfc8ed07a", + "sha256:7a2dd66d2d4df34fa82c9dc85657c5e019b87932019947faece7983f2089a840", + "sha256:8a51f2c6d1f884e98846a0a9021ff6861bdb98457879f412fdc2b42d14494067", + "sha256:9c568495e35599625f7b999774e29e8d6b01a6fb684d77dee1f56d41b11b40cd", + "sha256:9eddaafb3c48e0900690c1727fba226c4804b8e6127ea409689c3bb492d06de4", + "sha256:bbb332d45b32df41200380fff14712cb6093b61bd142272a10b16778c418e98e", + "sha256:bc3d98f621898b4a9bc7fecc00513eec8f40b5b83913d74ccb445f037d58cd89", + "sha256:c11d6033115dc4887c456565303f540c44197f4fc1a2bfb192224a301534888e", + "sha256:c50a724d136ec10d920661f1442e4a8b010a4fe5aebd65e0c2241ea41dbe93dc", + "sha256:d0a5095d52b90ff38592bbdc2644f17c6d495762edf47d876049cfd2968fbccf", + "sha256:d6cff2276e502b86a25fd10c2a96973fdb45c7a977dca2138d661417f3728341", + "sha256:e46d13f38cfcbb79bfdb2964b0fe12561fe633caf964a77a5f8d4e45fe5d2ef7" + ], + "version": "==2020.7.14" + }, + "toml": { + "hashes": [ + "sha256:926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f", + "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88" + ], + "version": "==0.10.1" + }, + "typed-ast": { + "hashes": [ + "sha256:0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355", + "sha256:0c2c07682d61a629b68433afb159376e24e5b2fd4641d35424e462169c0a7919", + "sha256:249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa", + "sha256:24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652", + "sha256:269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75", + "sha256:4083861b0aa07990b619bd7ddc365eb7fa4b817e99cf5f8d9cf21a42780f6e01", + "sha256:498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d", + "sha256:4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1", + "sha256:6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907", + "sha256:715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c", + "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3", + "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b", + "sha256:8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614", + "sha256:aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb", + "sha256:bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b", + "sha256:c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41", + "sha256:d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6", + "sha256:d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34", + "sha256:d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe", + "sha256:fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4", + "sha256:fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7" + ], + "version": "==1.4.1" + }, + "typing-extensions": { + "hashes": [ + "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918", + "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c", + "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f" + ], + "version": "==3.7.4.3" + } + } } diff --git a/requirements.txt b/requirements.txt index b10d2b2bd..9d0b4b5c2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +black==20.8b1 geopy==1.20.0 jsonpickle==1.2 numpy==1.18.5 diff --git a/requirements_freeze.txt b/requirements_freeze.txt index bba24279c..722cf6a88 100644 --- a/requirements_freeze.txt +++ b/requirements_freeze.txt @@ -1,16 +1,22 @@ -attrs==19.3.0 -bcrypt==3.1.7 -cffi==1.14.0 -cryptography==2.9.2 +appdirs==1.4.4 +attrs==20.1.0 +bcrypt==3.2.0 +black==20.8b1 +cffi==1.14.2 +click==7.1.2 +cryptography==3.1 geographiclib==1.50 geopy==1.20.0 jsonpickle==1.2 -more-itertools==8.4.0 +more-itertools==8.5.0 +mypy-extensions==0.4.3 numpy==1.18.5 packaging==20.4 pandas==1.0.4 paramiko==2.7.1 +pathspec==0.8.0 pluggy==0.13.1 +psycopg2==2.8.5 py==1.9.0 pycparser==2.20 PyNaCl==1.4.0 @@ -18,8 +24,11 @@ pyparsing==2.4.7 pytest==5.4.3 python-dateutil==2.8.1 pytz==2020.1 +regex==2020.7.14 scipy==1.4.1 six==1.15.0 +toml==0.10.1 tqdm==4.29.1 +typed-ast==1.4.1 +typing-extensions==3.7.4.3 wcwidth==0.2.5 -psycopg2==2.8.5 From 1e7c001e8aa08f0b760141e129e87b8e0082b8ef Mon Sep 17 00:00:00 2001 From: Jon Hagg Date: Mon, 31 Aug 2020 10:39:01 -0700 Subject: [PATCH 2/2] style: run latest version of black --- powersimdata/data_access/csv_store.py | 4 +- powersimdata/data_access/execute_list.py | 15 ++- powersimdata/data_access/scenario_list.py | 25 ++-- powersimdata/data_access/sql_store.py | 11 +- powersimdata/design/clean_capacity_scaling.py | 29 ++--- .../tests/test_clean_capacity_scaling.py | 2 +- .../design/tests/test_transmission.py | 12 +- powersimdata/design/transmission.py | 4 +- powersimdata/input/abstract_grid.py | 8 +- powersimdata/input/change_table.py | 120 +++++++++--------- powersimdata/input/grid.py | 4 +- powersimdata/input/input_data.py | 4 +- powersimdata/input/scenario_grid.py | 12 +- powersimdata/input/transform_grid.py | 48 ++----- powersimdata/input/transform_profile.py | 4 +- powersimdata/network/csv_reader.py | 4 +- .../network/usa_tamu/usa_tamu_model.py | 14 +- powersimdata/output/output_data.py | 4 +- powersimdata/scenario/analyze.py | 20 +-- powersimdata/scenario/create.py | 92 ++++---------- powersimdata/scenario/delete.py | 12 +- powersimdata/scenario/execute.py | 36 ++---- powersimdata/scenario/move.py | 32 ++--- powersimdata/scenario/scenario.py | 8 +- powersimdata/scenario/state.py | 11 +- powersimdata/tests/mock_builder.py | 2 +- powersimdata/tests/mock_grid.py | 2 +- powersimdata/tests/test_mocks.py | 3 +- powersimdata/utility/helpers.py | 16 +-- setup.py | 2 +- 30 files changed, 197 insertions(+), 363 deletions(-) diff --git a/powersimdata/data_access/csv_store.py b/powersimdata/data_access/csv_store.py index e54a5e645..66f442b9b 100644 --- a/powersimdata/data_access/csv_store.py +++ b/powersimdata/data_access/csv_store.py @@ -12,9 +12,7 @@ class CsvStore: """ def __init__(self, ssh_client): - """Constructor - - """ + """Constructor""" self.ssh_client = ssh_client def get_table(self, filename, path_on_server): diff --git a/powersimdata/data_access/execute_list.py b/powersimdata/data_access/execute_list.py index d0056356e..dac75a99d 100644 --- a/powersimdata/data_access/execute_list.py +++ b/powersimdata/data_access/execute_list.py @@ -4,8 +4,7 @@ class ExecuteTable(SqlStore): - """Storage abstraction for execute list using sql database. - """ + """Storage abstraction for execute list using sql database.""" table = "execute_list" columns = ["id", "status"] @@ -38,7 +37,13 @@ def add_entry(self, scenario_info): """ scenario_id, status = scenario_info["id"], "created" sql = self.insert() - self.cur.execute(sql, (scenario_id, status,)) + self.cur.execute( + sql, + ( + scenario_id, + status, + ), + ) def update_execute_list(self, status, scenario_info): """Updates status of scenario in execute list @@ -67,9 +72,7 @@ class ExecuteListManager(CsvStore): """ def __init__(self, ssh_client): - """Constructor - - """ + """Constructor""" super().__init__(ssh_client) def get_execute_table(self): diff --git a/powersimdata/data_access/scenario_list.py b/powersimdata/data_access/scenario_list.py index b52084df7..67f8b7963 100644 --- a/powersimdata/data_access/scenario_list.py +++ b/powersimdata/data_access/scenario_list.py @@ -6,8 +6,7 @@ class ScenarioTable(SqlStore): - """Storage abstraction for scenario list using sql database. - """ + """Storage abstraction for scenario list using sql database.""" table = "scenario_list" columns = [ @@ -76,9 +75,7 @@ class ScenarioListManager(CsvStore): """ def __init__(self, ssh_client): - """Constructor - - """ + """Constructor""" super().__init__(ssh_client) def get_scenario_table(self): @@ -95,16 +92,13 @@ def generate_scenario_id(self): :return: (*str*) -- new scenario id. """ print("--> Generating scenario id") - command = ( - "(flock -e 200; \ + command = "(flock -e 200; \ id=$(awk -F',' 'END{print $1+1}' %s); \ echo $id, >> %s; \ - echo $id) 200>%s" - % ( - server_setup.SCENARIO_LIST, - server_setup.SCENARIO_LIST, - posixpath.join(server_setup.DATA_ROOT_DIR, "scenario.lockfile"), - ) + echo $id) 200>%s" % ( + server_setup.SCENARIO_LIST, + server_setup.SCENARIO_LIST, + posixpath.join(server_setup.DATA_ROOT_DIR, "scenario.lockfile"), ) err_message = "Failed to generate id for new scenario" @@ -123,7 +117,10 @@ def add_entry(self, scenario_info): # AWK parses the file line-by-line. When the entry of the first column is # equal to the scenario identification number, the entire line is replaced # by the scenaario information. - program = "'{if($1==%s) $0=\"%s\"};1'" % (scenario_info["id"], entry,) + program = "'{if($1==%s) $0=\"%s\"};1'" % ( + scenario_info["id"], + entry, + ) command = "awk %s %s %s" % (options, program, server_setup.SCENARIO_LIST) err_message = "Failed to add entry in %s on server" % server_setup.SCENARIO_LIST diff --git a/powersimdata/data_access/sql_store.py b/powersimdata/data_access/sql_store.py index 05375517a..68b1a0b3e 100644 --- a/powersimdata/data_access/sql_store.py +++ b/powersimdata/data_access/sql_store.py @@ -16,8 +16,7 @@ class LoggingCursor(psycopg2.extras.DictCursor): """Cursor that prints queries before execution. Primarily used for debugging""" def execute(self, sql, args=None): - """Print sql query and delegate execution to super. - """ + """Print sql query and delegate execution to super.""" print(self.mogrify(sql, args)) try: @@ -28,7 +27,7 @@ def execute(self, sql, args=None): def get_connection(): - """ Temporary connection used for local development + """Temporary connection used for local development :return: (*str*) -- connection string for postgres db """ return "dbname=psd host=localhost user=postgres password=example" @@ -60,7 +59,7 @@ class SqlStore: """Base class for objects stored in a postgres db. Implements context manager for connection handling and methods for generating queries based on convention. Derived classes should define table and columns attributes for - this to work properly. + this to work properly. """ def __init__(self): @@ -105,7 +104,7 @@ def select_where(self, key): return self.select_all() + where_clause def insert(self, subset=None): - """ Build INSERT statement on current table for all columns, or subset if + """Build INSERT statement on current table for all columns, or subset if specified. :param iterable subset: collection of columns to specify in query :return (*psycopg2.sql.SQL*) -- template for insert statement @@ -118,7 +117,7 @@ def insert(self, subset=None): ) def delete(self, key): - """ Build DELETE .. WHERE statement on current table using key to filter. + """Build DELETE .. WHERE statement on current table using key to filter. :param str key: column to use in WHERE clause :return (*psycopg2.sql.SQL*) -- template for delete statement """ diff --git a/powersimdata/design/clean_capacity_scaling.py b/powersimdata/design/clean_capacity_scaling.py index 73daf6c45..2c690f608 100644 --- a/powersimdata/design/clean_capacity_scaling.py +++ b/powersimdata/design/clean_capacity_scaling.py @@ -702,9 +702,7 @@ def create_change_table(self, ref_scenario): class IndependentStrategyManager(AbstractStrategyManager): - """Calculates the next capacities using individual target shortfalls. - - """ + """Calculates the next capacities using individual target shortfalls.""" def __init__(self): AbstractStrategyManager.__init__(self) @@ -793,8 +791,7 @@ def data_frame_of_next_capacities(self): class AbstractCollaborativeStrategyManager(AbstractStrategyManager): - """Base class for Collaborative strategy objects, contains common functions. - """ + """Base class for Collaborative strategy objects, contains common functions.""" def __init__(self): raise NotImplementedError("Only child classes should be instantiated") @@ -913,8 +910,7 @@ def data_frame_of_next_capacities(self): class CollaborativeStrategyManager(AbstractCollaborativeStrategyManager): - """Calculates the next capacities using total target shortfalls. - """ + """Calculates the next capacities using total target shortfalls.""" def __init__(self): self.addl_curtailment = {"solar": 0, "wind": 0} @@ -934,8 +930,7 @@ def calculate_total_shortfall(self): return total_ce_shortfall def calculate_participating_capacity(self, category): - """Calculates capacity for a resource, in participating states. - """ + """Calculates capacity for a resource, in participating states.""" participating_capacity = sum( [ self.targets[tar].resources[category].prev_capacity @@ -1352,9 +1347,7 @@ def set_allowed_resources(self, allowed_resources): self.allowed_resources = allowed_resources def save_target_as_json(self): - """Saves target object as indented JSON file named by region name. - - """ + """Saves target object as indented JSON file named by region name.""" print(os.getcwd()) json_file = open( os.path.join( @@ -1373,9 +1366,7 @@ def save_target_as_json(self): json_file.close() def save_target_as_pickle(self): - """Saves target object as pickle file named by region name. - - """ + """Saves target object as pickle file named by region name.""" print(os.getcwd()) json_file = open( os.path.join( @@ -1403,14 +1394,10 @@ def __str__(self): class ResourceManager: - """Manages the creation of resource objects from scenario information. - - """ + """Manages the creation of resource objects from scenario information.""" def __init__(self): - """Creates an empty dictionary to hold resource objects. - - """ + """Creates an empty dictionary to hold resource objects.""" self.resources = {} def __getitem__(self, key): diff --git a/powersimdata/design/tests/test_clean_capacity_scaling.py b/powersimdata/design/tests/test_clean_capacity_scaling.py index 465806147..71294d4d4 100644 --- a/powersimdata/design/tests/test_clean_capacity_scaling.py +++ b/powersimdata/design/tests/test_clean_capacity_scaling.py @@ -53,7 +53,7 @@ def test_independent_new_capacity(): "geo": [0, 0, 0, 0], "hydro": [0, 0, 0, 0], "solar": [0.4, 0, 0, 0], - "wind": [0, 0, 0, 0,], + "wind": [0, 0, 0, 0], }, index=area_names, ) diff --git a/powersimdata/design/tests/test_transmission.py b/powersimdata/design/tests/test_transmission.py index aa7229d38..69cf5026c 100644 --- a/powersimdata/design/tests/test_transmission.py +++ b/powersimdata/design/tests/test_transmission.py @@ -210,7 +210,11 @@ def setUp(self): # Finally, combine all of this into a MockScenario self.mock_scenario = MockScenario( - grid_attrs={"branch": mock_branch, "bus": mock_bus, "plant": mock_plant,}, + grid_attrs={ + "branch": mock_branch, + "bus": mock_bus, + "plant": mock_plant, + }, congu=congu, congl=congl, ct=ct, @@ -382,7 +386,11 @@ def setUp(self): "wind": {"zone_id": {"E": 1.3, "W": 2.1}}, } self.ref_scenario = MockScenario( - grid_attrs={"branch": mock_branch, "bus": mock_bus, "plant": mock_plant,}, + grid_attrs={ + "branch": mock_branch, + "bus": mock_bus, + "plant": mock_plant, + }, ct={ "branch": {"branch_id": {101: 1.5, 102: 2.5, 103: 2, 105: 4}}, # These shouldn't get used diff --git a/powersimdata/design/transmission.py b/powersimdata/design/transmission.py index 54b3029a5..4ff681157 100644 --- a/powersimdata/design/transmission.py +++ b/powersimdata/design/transmission.py @@ -201,7 +201,7 @@ def scale_congested_mesh_branches( ): """Use a reference scenario as a baseline for branch scaling, and further increment branch scaling based on observed congestion duals. - + :param powersimdata.input.change_table.ChangeTable change_table: the change table instance we are operating on. :param powersimdata.scenario.scenario.Scenario ref_scenario: the reference @@ -367,7 +367,7 @@ def _construct_composite_allow_list(valid_branches, allow_list, deny_list): def _increment_branch_scaling(change_table, branch_ids, ref_scenario, value=1): """Modify the ct dict of a ChangeTable object based on branch scaling from both a reference scenario and a set of branches to increment by a value. - + :param powersimdata.input.change_table.ChangeTable change_table: the change table instance we are operating on. :param [list/set/tuple] branch_ids: an iterable of branch indices. diff --git a/powersimdata/input/abstract_grid.py b/powersimdata/input/abstract_grid.py index 7f73284bb..54db3c7ec 100644 --- a/powersimdata/input/abstract_grid.py +++ b/powersimdata/input/abstract_grid.py @@ -2,14 +2,10 @@ class AbstractGrid(object): - """Grid Builder. - - """ + """Grid Builder.""" def __init__(self): - """Constructor - - """ + """Constructor""" self.data_loc = None self.interconnect = None self.zone2id = {} diff --git a/powersimdata/input/change_table.py b/powersimdata/input/change_table.py index d57b3abec..2dbee4c1e 100644 --- a/powersimdata/input/change_table.py +++ b/powersimdata/input/change_table.py @@ -28,66 +28,66 @@ class ChangeTable(object): """Create change table for changes that need to be applied to the original - grid as well as to the original demand, hydro, solar and wind profiles. - A pickle file enclosing the change table in form of a dictionary can be - created and transferred on the server. Keys are *'demand'*, *'branch'*, - *'biomass'*, *'coal'*, *'dfo'*, *'geothermal'*, *'ng'*, *'nuclear'*, - *'hydro'*, *'solar'*, *'wind'*, *'other'*, *'dcline'*, *'new_dcline'*, - and *'storage'*. - If a key is missing in the dictionary, then no changes will be applied. - The data structure is given below: - - * *'demand'*: - value is a dictionary. The latter has *'zone_id'* as keys and a - factor indicating the desired increase/decrease of load in zone - (1.2 would correspond to a 20% increase while 0.95 would be a 5% - decrease) as value. - * *'branch'*: - value is a dictionary. The latter has *'branch_id'* and/or - *'zone_id'* as keys. The *'branch_id'* dictionary has the branch - ids as keys while the *'zone_id'* dictionary has the zone ids as - keys. The value of those dictionaries is a factor indicating the - desired increase/decrease of capacity of the line or the lines in - the zone (1.2 would correspond to a 20% increase while 0.95 would - be a 5% decrease). - * *'biomass'*, *'coal'*, *'dfo'*, *'geothermal'*, *'ng'*, *'nuclear'*, - *'hydro'*, *'solar'*, *'wind'*, *wind_offshore*, and *'other'*: - value is a dictionary. The latter has *'plant_id'* and/or - *'zone_id'* as keys. The *'plant_id'* dictionary has the plant ids - as keys while the *'zone_id'* dictionary has the zone ids as keys. - The value of those dictionaries is a factor indicating the desired - increase/decrease of capacity of the plant or plants in the zone - (1.2 would correspond to a 20% increase while 0.95 would be a 5% - decrease). - * *'dcline'*: - value is a dictionary. The latter has *'dcline_id'* as keys and - the and the scaling factor for the increase/decrease in capacity - of the line as value. - * *'storage'*: - value is a dictionary. The latter has *'bus_id'* as keys and the - capacity of storage (in MW) to add as value. - * *'new_dcline'*: - value is a list. Each entry in this list is a dictionary enclosing - all the information needed to add a new dcline to the grid. The - keys in the dictionary are: *'capacity'*, *'from_bus_id'* and - *'to_bus_id'* with values giving the capacity of the HVDC line and - the bus id at each end of the line. - * *'new_branch'*: - value is a list. Each entry in this list is a dictionary enclosing - all the information needed to add a new branch to the grid. The - keys in the dictionary are: *'capacity'*, *'from_bus_id'* and - *'to_bus_id'* with values giving the capacity of the line and - the bus id at each end of the line. - * *'new_plant': - value is a list. Each entry in this list is a dictionary enclosing - all the information needed to add a new generator to the grid. The - keys in the dictionary are *'type'*, *'bus_id'*, *'Pmax'* for - renewable generators and *'type'*, *'bus_id'*, *'Pmax'*, *'c0'*, - *'c1'*, *'c2'* for thermal generators. An optional *'Pmin'* can be - passed for both renewable and thermal generators. The values give - the fuel type, the identification number of the bus, the maximum - capacity of the generator, the coefficients of the cost curve - (polynomials) and optionally the minimum capacity of the generator. + grid as well as to the original demand, hydro, solar and wind profiles. + A pickle file enclosing the change table in form of a dictionary can be + created and transferred on the server. Keys are *'demand'*, *'branch'*, + *'biomass'*, *'coal'*, *'dfo'*, *'geothermal'*, *'ng'*, *'nuclear'*, + *'hydro'*, *'solar'*, *'wind'*, *'other'*, *'dcline'*, *'new_dcline'*, + and *'storage'*. + If a key is missing in the dictionary, then no changes will be applied. + The data structure is given below: + + * *'demand'*: + value is a dictionary. The latter has *'zone_id'* as keys and a + factor indicating the desired increase/decrease of load in zone + (1.2 would correspond to a 20% increase while 0.95 would be a 5% + decrease) as value. + * *'branch'*: + value is a dictionary. The latter has *'branch_id'* and/or + *'zone_id'* as keys. The *'branch_id'* dictionary has the branch + ids as keys while the *'zone_id'* dictionary has the zone ids as + keys. The value of those dictionaries is a factor indicating the + desired increase/decrease of capacity of the line or the lines in + the zone (1.2 would correspond to a 20% increase while 0.95 would + be a 5% decrease). + * *'biomass'*, *'coal'*, *'dfo'*, *'geothermal'*, *'ng'*, *'nuclear'*, + *'hydro'*, *'solar'*, *'wind'*, *wind_offshore*, and *'other'*: + value is a dictionary. The latter has *'plant_id'* and/or + *'zone_id'* as keys. The *'plant_id'* dictionary has the plant ids + as keys while the *'zone_id'* dictionary has the zone ids as keys. + The value of those dictionaries is a factor indicating the desired + increase/decrease of capacity of the plant or plants in the zone + (1.2 would correspond to a 20% increase while 0.95 would be a 5% + decrease). + * *'dcline'*: + value is a dictionary. The latter has *'dcline_id'* as keys and + the and the scaling factor for the increase/decrease in capacity + of the line as value. + * *'storage'*: + value is a dictionary. The latter has *'bus_id'* as keys and the + capacity of storage (in MW) to add as value. + * *'new_dcline'*: + value is a list. Each entry in this list is a dictionary enclosing + all the information needed to add a new dcline to the grid. The + keys in the dictionary are: *'capacity'*, *'from_bus_id'* and + *'to_bus_id'* with values giving the capacity of the HVDC line and + the bus id at each end of the line. + * *'new_branch'*: + value is a list. Each entry in this list is a dictionary enclosing + all the information needed to add a new branch to the grid. The + keys in the dictionary are: *'capacity'*, *'from_bus_id'* and + *'to_bus_id'* with values giving the capacity of the line and + the bus id at each end of the line. + * *'new_plant': + value is a list. Each entry in this list is a dictionary enclosing + all the information needed to add a new generator to the grid. The + keys in the dictionary are *'type'*, *'bus_id'*, *'Pmax'* for + renewable generators and *'type'*, *'bus_id'*, *'Pmax'*, *'c0'*, + *'c1'*, *'c2'* for thermal generators. An optional *'Pmin'* can be + passed for both renewable and thermal generators. The values give + the fuel type, the identification number of the bus, the maximum + capacity of the generator, the coefficients of the cost curve + (polynomials) and optionally the minimum capacity of the generator. """ def __init__(self, grid): diff --git a/powersimdata/input/grid.py b/powersimdata/input/grid.py index cdc84dc3c..485492d9f 100644 --- a/powersimdata/input/grid.py +++ b/powersimdata/input/grid.py @@ -15,9 +15,7 @@ class Grid(object): """ def __init__(self, interconnect, source="usa_tamu", engine="REISE"): - """Constructor. - - """ + """Constructor.""" if not isinstance(source, str): raise TypeError("source must be a string") if not isinstance(engine, str): diff --git a/powersimdata/input/input_data.py b/powersimdata/input/input_data.py index f512302b3..2b67456ee 100644 --- a/powersimdata/input/input_data.py +++ b/powersimdata/input/input_data.py @@ -14,9 +14,7 @@ class InputData(object): """ def __init__(self, ssh_client, data_loc=None): - """Constructor. - - """ + """Constructor.""" if not os.path.exists(server_setup.LOCAL_DIR): os.makedirs(server_setup.LOCAL_DIR) diff --git a/powersimdata/input/scenario_grid.py b/powersimdata/input/scenario_grid.py index fe7bd4a58..c3173f0c3 100644 --- a/powersimdata/input/scenario_grid.py +++ b/powersimdata/input/scenario_grid.py @@ -12,9 +12,7 @@ class ScenarioGrid(AbstractGrid): - """File reader for MAT files for scenarios which were run on the server. - - """ + """File reader for MAT files for scenarios which were run on the server.""" def __init__(self, filename): """Constructor. @@ -120,9 +118,7 @@ def _build_network(self): class FromREISE(ScenarioGrid): - """MATLAB file reader, for MAT files created by REISE/MATPOWER - - """ + """MATLAB file reader, for MAT files created by REISE/MATPOWER""" def _build_network(self): self._read_network() @@ -131,9 +127,7 @@ def _build_network(self): class FromREISEjl(ScenarioGrid): - """MATLAB file reader, for MAT files created (& converted) by REISE.jl - - """ + """MATLAB file reader, for MAT files created (& converted) by REISE.jl""" def _build_network(self): self._read_network() diff --git a/powersimdata/input/transform_grid.py b/powersimdata/input/transform_grid.py index 9e3872f66..d270d8948 100644 --- a/powersimdata/input/transform_grid.py +++ b/powersimdata/input/transform_grid.py @@ -6,9 +6,7 @@ class TransformGrid(object): - """Transforms grid according to operations listed in change table. - - """ + """Transforms grid according to operations listed in change table.""" def __init__(self, grid, ct): """Constructor @@ -43,9 +41,7 @@ def get_grid(self): return self.grid def _apply_change_table(self): - """Apply changes listed in change table to the grid. - - """ + """Apply changes listed in change table to the grid.""" for g in self.gen_types: if g in self.ct.keys(): self._scale_gen(g) @@ -110,9 +106,7 @@ def _scale_gencost(self, plant_id, factor): self.grid.gencost["before"].loc[plant_id, "c2"] /= factor def _scale_branch(self): - """Scales capacity of AC lines. - - """ + """Scales capacity of AC lines.""" if "zone_id" in self.ct["branch"].keys(): for zone_id, factor in self.ct["branch"]["zone_id"].items(): branch_id = ( @@ -135,9 +129,7 @@ def _scale_branch_capacity(self, branch_id, factor): self.grid.branch.loc[branch_id, "x"] /= factor def _scale_dcline(self): - """Scales capacity of HVDC lines. - - """ + """Scales capacity of HVDC lines.""" for dcline_id, factor in self.ct["dcline"]["dcline_id"].items(): self.grid.dcline.loc[dcline_id, "Pmin"] *= factor self.grid.dcline.loc[dcline_id, "Pmax"] *= factor @@ -145,9 +137,7 @@ def _scale_dcline(self): self.grid.dcline.loc[dcline_id, "status"] = 0 def _add_branch(self): - """Adds branch(es) to the grid. - - """ + """Adds branch(es) to the grid.""" new_branch = {c: 0 for c in self.grid.branch.columns} v2x = voltage_to_x_per_distance(self.grid) for entry in self.ct["new_branch"]: @@ -189,9 +179,7 @@ def _add_branch(self): ) def _add_dcline(self): - """Adds HVDC line(s) to the grid - - """ + """Adds HVDC line(s) to the grid""" new_dcline = {c: 0 for c in self.grid.dcline.columns} for entry in self.ct["new_dcline"]: from_bus_id = entry["from_bus_id"] @@ -213,16 +201,12 @@ def _add_dcline(self): ) def _add_gen(self): - """Adds generator(s) to the grid. - - """ + """Adds generator(s) to the grid.""" self._add_plant() self._add_gencost() def _add_plant(self): - """Adds plant to the grid - - """ + """Adds plant to the grid""" new_plant = {c: 0 for c in self.grid.plant.columns} for entry in self.ct["new_plant"]: bus_id = entry["bus_id"] @@ -248,9 +232,7 @@ def _add_plant(self): ) def _add_gencost(self): - """Adds generation cost curves. - - """ + """Adds generation cost curves.""" new_gencost = {c: 0 for c in self.grid.gencost["before"].columns} for entry in self.ct["new_plant"]: bus_id = entry["bus_id"] @@ -268,9 +250,7 @@ def _add_gencost(self): self.grid.gencost["after"] = self.grid.gencost["before"] def _add_storage(self): - """Adds storage to the grid. - - """ + """Adds storage to the grid.""" storage_id = self.grid.plant.shape[0] for bus_id, value in self.ct["storage"]["bus_id"].items(): storage_id += 1 @@ -299,9 +279,7 @@ def _add_storage_unit(self, bus_id, value): ) def _add_storage_gencost(self): - """Sets generation cost of storage unit. - - """ + """Sets generation cost of storage unit.""" gencost = {g: 0 for g in self.grid.storage["gencost"].columns} gencost["type"] = 2 gencost["n"] = 3 @@ -310,9 +288,7 @@ def _add_storage_gencost(self): ) def _add_storage_genfuel(self): - """Sets fuel type of storage unit. - - """ + """Sets fuel type of storage unit.""" self.grid.storage["genfuel"].append("ess") def _add_storage_data(self, storage_id, value): diff --git a/powersimdata/input/transform_profile.py b/powersimdata/input/transform_profile.py index 10e864d80..5437e0aba 100644 --- a/powersimdata/input/transform_profile.py +++ b/powersimdata/input/transform_profile.py @@ -5,9 +5,7 @@ class TransformProfile(object): - """Transforms profile according to operations listed in change table. - - """ + """Transforms profile according to operations listed in change table.""" def __init__(self, ssh_client, scenario_info, grid, ct): """Constructor diff --git a/powersimdata/network/csv_reader.py b/powersimdata/network/csv_reader.py index e176ddc85..66a492222 100644 --- a/powersimdata/network/csv_reader.py +++ b/powersimdata/network/csv_reader.py @@ -10,9 +10,7 @@ class CSVReader(object): """ def __init__(self, data_loc): - """Constructor - - """ + """Constructor""" self.bus = csv_to_data_frame(data_loc, "bus.csv") self.plant = csv_to_data_frame(data_loc, "plant.csv") self.gencost = csv_to_data_frame(data_loc, "gencost.csv") diff --git a/powersimdata/network/usa_tamu/usa_tamu_model.py b/powersimdata/network/usa_tamu/usa_tamu_model.py index ac0c7fa5d..07df9785a 100644 --- a/powersimdata/network/usa_tamu/usa_tamu_model.py +++ b/powersimdata/network/usa_tamu/usa_tamu_model.py @@ -16,9 +16,7 @@ class TAMU(AbstractGrid): """ def __init__(self, interconnect): - """Constructor. - - """ + """Constructor.""" super().__init__() self._set_data_loc() @@ -39,9 +37,7 @@ def _set_data_loc(self): self.data_loc = data_loc def _set_storage(self): - """Sets storage properties. - - """ + """Sets storage properties.""" self.storage["duration"] = 4 self.storage["min_stor"] = 0.05 self.storage["max_stor"] = 0.95 @@ -50,9 +46,7 @@ def _set_storage(self): self.storage["energy_price"] = 20 def _build_network(self): - """Build network. - - """ + """Build network.""" reader = CSVReader(self.data_loc) self.bus = reader.bus self.plant = reader.plant @@ -69,7 +63,7 @@ def _build_network(self): def _drop_interconnect(self): """Trim data frames to only keep information pertaining to the user - defined interconnect(s). + defined interconnect(s). """ for key, value in self.__dict__.items(): diff --git a/powersimdata/output/output_data.py b/powersimdata/output/output_data.py index a4e9cd085..431c042d4 100644 --- a/powersimdata/output/output_data.py +++ b/powersimdata/output/output_data.py @@ -16,9 +16,7 @@ class OutputData(object): """ def __init__(self, ssh_client, data_loc=None): - """Constructor - - """ + """Constructor""" if not os.path.exists(server_setup.LOCAL_DIR): os.makedirs(server_setup.LOCAL_DIR) self._ssh = ssh_client diff --git a/powersimdata/scenario/analyze.py b/powersimdata/scenario/analyze.py index 1e24fbd6d..a404d8d5c 100644 --- a/powersimdata/scenario/analyze.py +++ b/powersimdata/scenario/analyze.py @@ -21,9 +21,7 @@ class Analyze(State): allowed = [] def __init__(self, scenario): - """Constructor. - - """ + """Constructor.""" self._scenario_info = scenario.info self._scenario_status = scenario.status super().__init__(scenario) @@ -40,16 +38,12 @@ def __init__(self, scenario): self._set_ct_and_grid() def _set_allowed_state(self): - """Sets allowed state. - - """ + """Sets allowed state.""" if self._scenario_status == "extracted": self.allowed = ["delete", "move"] def _set_ct_and_grid(self): - """Sets change table and grid. - - """ + """Sets change table and grid.""" input_data = InputData(self._ssh, data_loc=self.data_loc) grid_mat_path = input_data.get_data(self._scenario_info, "grid") self.grid = Grid( @@ -64,9 +58,7 @@ def _set_ct_and_grid(self): self.ct = {} def print_scenario_info(self): - """Prints scenario information. - - """ + """Prints scenario information.""" print("--------------------") print("SCENARIO INFORMATION") print("--------------------") @@ -93,9 +85,7 @@ def _parse_infeasibilities(self): return infeasibilities def print_infeasibilities(self): - """Prints infeasibilities. - - """ + """Prints infeasibilities.""" infeasibilities = self._parse_infeasibilities() if infeasibilities is None: print("There are no infeasibilities.") diff --git a/powersimdata/scenario/create.py b/powersimdata/scenario/create.py index 2bfce20a0..b58a2f681 100644 --- a/powersimdata/scenario/create.py +++ b/powersimdata/scenario/create.py @@ -28,9 +28,7 @@ class Create(State): allowed = [] def __init__(self, scenario): - """Constructor. - - """ + """Constructor.""" self.builder = None self.grid = None self.ct = None @@ -55,9 +53,7 @@ def __init__(self, scenario): super().__init__(scenario) def _update_scenario_info(self): - """Updates scenario information. - - """ + """Updates scenario information.""" if self.builder is not None: self._scenario_info["plan"] = self.builder.plan_name self._scenario_info["name"] = self.builder.scenario_name @@ -75,16 +71,14 @@ def _update_scenario_info(self): self._scenario_info["change_table"] = "No" def _generate_and_set_scenario_id(self): - """Generates scenario id. - - """ + """Generates scenario id.""" scenario_id = self._scenario_list_manager.generate_scenario_id() self._scenario_info["id"] = scenario_id self._scenario_info.move_to_end("id", last=False) def _add_entry_in_execute_list(self): """Adds scenario to the execute list file on server and update status - information. + information. """ self._execute_list_manager.add_entry(self._scenario_info) @@ -92,9 +86,7 @@ def _add_entry_in_execute_list(self): self.allowed.append("execute") def _upload_change_table(self): - """Uploads change table to server. - - """ + """Uploads change table to server.""" print("--> Writing change table on local machine") self.builder.change_table.write(self._scenario_info["id"]) print("--> Uploading change table to server") @@ -181,9 +173,7 @@ def get_wind(self): return self.get_profile("wind") def create_scenario(self): - """Creates scenario. - - """ + """Creates scenario.""" self._update_scenario_info() missing = [] for key, val in self._scenario_info.items(): @@ -224,9 +214,7 @@ def create_scenario(self): self.switch(Execute) def print_scenario_info(self): - """Prints scenario information. - - """ + """Prints scenario information.""" self._update_scenario_info() print("--------------------") print("SCENARIO INFORMATION") @@ -278,9 +266,7 @@ def set_builder(self, interconnect): class _Builder(object): - """Scenario Builder. - - """ + """Scenario Builder.""" interconnect = None base_grid = None @@ -300,9 +286,7 @@ class _Builder(object): name = "builder" def __init__(self, interconnect, ssh_client): - """Constructor. - - """ + """Constructor.""" self.base_grid = Grid(interconnect) self.profile = CSV(interconnect, ssh_client) self.change_table = ChangeTable(self.base_grid) @@ -406,9 +390,9 @@ def set_engine(self, engine): def load_change_table(self, filename): """Uploads change table. - :param str filename: full path to change table pickle file. - :raises FileNotFoundError: if file not found. - """ + :param str filename: full path to change table pickle file. + :raises FileNotFoundError: if file not found. + """ try: ct = pickle.load(open(filename, "rb")) self.change_table.ct = ct @@ -427,31 +411,23 @@ def __str__(self): class Eastern(_Builder): - """Builder for Eastern interconnect. - - """ + """Builder for Eastern interconnect.""" name = "Eastern" def __init__(self, ssh_client): - """Constructor. - - """ + """Constructor.""" self.interconnect = ["Eastern"] super().__init__(self.interconnect, ssh_client) class Texas(_Builder): - """Builder for Texas interconnect. - - """ + """Builder for Texas interconnect.""" name = "Texas" def __init__(self, ssh_client): - """Constructor. - - """ + """Constructor.""" self.interconnect = ["Texas"] super().__init__(self.interconnect, ssh_client) @@ -465,9 +441,7 @@ class Western(_Builder): name = "Western" def __init__(self, ssh_client): - """Constructor. - - """ + """Constructor.""" self.interconnect = ["Western"] super().__init__(self.interconnect, ssh_client) @@ -481,54 +455,40 @@ class TexasWestern(_Builder): name = "Texas_Western" def __init__(self, ssh_client): - """Constructor. - - """ + """Constructor.""" self.interconnect = ["Texas", "Western"] super().__init__(self.interconnect, ssh_client) class TexasEastern(_Builder): - """Builder for Texas + Eastern interconnect. - - """ + """Builder for Texas + Eastern interconnect.""" name = "Texas_Eastern" def __init__(self): - """Constructor. - - """ + """Constructor.""" self.interconnect = ["Texas", "Eastern"] super().__init__(self.interconnect, ssh_client) class EasternWestern(_Builder): - """Builder for Eastern + Western interconnect. - - """ + """Builder for Eastern + Western interconnect.""" name = "Eastern_Western" def __init__(self): - """Constructor. - - """ + """Constructor.""" self.interconnect = ["Eastern", "Western"] super().__init__(self.interconnect, ssh_client) class USA(_Builder): - """Builder for USA interconnect. - - """ + """Builder for USA interconnect.""" name = "USA" def __init__(self, ssh_client): - """Constructor. - - """ + """Constructor.""" self.interconnect = ["USA"] super().__init__(self.interconnect, ssh_client) @@ -541,9 +501,7 @@ class CSV(object): """ def __init__(self, interconnect, ssh_client): - """Constructor. - - """ + """Constructor.""" self._ssh = ssh_client self.interconnect = interconnect diff --git a/powersimdata/scenario/delete.py b/powersimdata/scenario/delete.py index 42d819569..a3ba2c1ad 100644 --- a/powersimdata/scenario/delete.py +++ b/powersimdata/scenario/delete.py @@ -6,9 +6,7 @@ class Delete(State): - """Deletes scenario. - - """ + """Deletes scenario.""" name = "delete" allowed = [] @@ -31,9 +29,7 @@ def print_scenario_info(self): print("Scenario has been deleted") def delete_scenario(self): - """Deletes scenario on server. - - """ + """Deletes scenario on server.""" # Delete entry in scenario list self._scenario_list_manager.delete_entry(self._scenario_info) @@ -77,8 +73,6 @@ def delete_scenario(self): self._clean() def _clean(self): - """Clean after deletion. - - """ + """Clean after deletion.""" self._ssh.close() self._scenario_info = None diff --git a/powersimdata/scenario/execute.py b/powersimdata/scenario/execute.py index eaf0743e0..e11f32a6f 100644 --- a/powersimdata/scenario/execute.py +++ b/powersimdata/scenario/execute.py @@ -26,9 +26,7 @@ class Execute(State): allowed = [] def __init__(self, scenario): - """Constructor. - - """ + """Constructor.""" self._scenario_info = scenario.info self._scenario_status = scenario.status super().__init__(scenario) @@ -43,9 +41,7 @@ def __init__(self, scenario): self._set_ct_and_grid() def _set_ct_and_grid(self): - """Sets change table and grid. - - """ + """Sets change table and grid.""" base_grid = Grid(self._scenario_info["interconnect"].split("_")) if self._scenario_info["change_table"] == "Yes": input_data = InputData(self._ssh) @@ -70,9 +66,7 @@ def get_grid(self): return copy.deepcopy(self.grid) def _update_scenario_status(self): - """Updates scenario status. - - """ + """Updates scenario status.""" execute_table = self._execute_list_manager.get_execute_table() scenario_id = self._scenario_info["id"] self._scenario_status = execute_table[ @@ -80,9 +74,7 @@ def _update_scenario_status(self): ].status.values[0] def _update_scenario_info(self): - """Updates scenario information. - - """ + """Updates scenario information.""" scenario_table = self._scenario_list_manager.get_scenario_table() scenario_id = self._scenario_info["id"] scenario = scenario_table[scenario_table.id == scenario_id] @@ -125,9 +117,7 @@ def _run_script(self, script, extra_args=None): return process def print_scenario_info(self): - """Prints scenario information. - - """ + """Prints scenario information.""" print("--------------------") print("SCENARIO INFORMATION") print("--------------------") @@ -136,9 +126,7 @@ def print_scenario_info(self): print("%s: %s" % (key, val)) def print_scenario_status(self): - """Prints scenario status. - - """ + """Prints scenario status.""" print("---------------") print("SCENARIO STATUS") print("---------------") @@ -146,9 +134,7 @@ def print_scenario_status(self): print(self._scenario_status) def prepare_simulation_input(self): - """Prepares scenario for execution - - """ + """Prepares scenario for execution""" self._update_scenario_status() if self._scenario_status == "created": print("---------------------------") @@ -218,9 +204,7 @@ class SimulationInput(object): """ def __init__(self, ssh_client, scenario_info, grid, ct): - """Constructor. - - """ + """Constructor.""" self._ssh = ssh_client self._scenario_info = scenario_info self.grid = grid @@ -242,9 +226,7 @@ def create_folder(self): raise IOError("Failed to create %s on server" % self.TMP_DIR) def prepare_mpc_file(self): - """Creates MATPOWER case file. - - """ + """Creates MATPOWER case file.""" print("--> Preparing MPC file") print("Scaling grid") grid = copy.deepcopy(self.grid) diff --git a/powersimdata/scenario/move.py b/powersimdata/scenario/move.py index 9f1ccabd4..98bd22ca6 100644 --- a/powersimdata/scenario/move.py +++ b/powersimdata/scenario/move.py @@ -15,15 +15,11 @@ class Move(State): allowed = [] def __init__(self, scenario): - """Constructor - - """ + """Constructor""" super().__init__(scenario) def print_scenario_info(self): - """Prints scenario information. - - """ + """Prints scenario information.""" print("--------------------") print("SCENARIO INFORMATION") print("--------------------") @@ -54,9 +50,7 @@ def move_scenario(self, target="disk"): self._clean() def _clean(self): - """Clean after deletion. - - """ + """Clean after deletion.""" self._ssh.close() @@ -68,16 +62,12 @@ class BackUpDisk(object): """ def __init__(self, ssh_client, scenario_info): - """Constructor. - - """ + """Constructor.""" self._ssh = ssh_client self._scenario_info = scenario_info def move_input_data(self): - """Moves input data. - - """ + """Moves input data.""" print("--> Moving scenario input data to backup disk") source = posixpath.join( server_setup.INPUT_DIR, self._scenario_info["id"] + "_*" @@ -87,9 +77,7 @@ def move_input_data(self): stdin, stdout, stderr = self._ssh.exec_command(command) def copy_base_profile(self): - """Copies base profile - - """ + """Copies base profile""" print("--> Copying base profiles to backup disk") for kind in ["demand", "hydro", "solar", "wind"]: interconnect = interconnect2name( @@ -107,9 +95,7 @@ def copy_base_profile(self): print(stderr.readlines()) def move_output_data(self): - """Moves output data - - """ + """Moves output data""" print("--> Moving scenario output data to backup disk") source = posixpath.join( server_setup.OUTPUT_DIR, self._scenario_info["id"] + "_*" @@ -119,9 +105,7 @@ def move_output_data(self): stdin, stdout, stderr = self._ssh.exec_command(command) def move_temporary_folder(self): - """Moves temporary folder. - - """ + """Moves temporary folder.""" print("--> Moving temporary folder to backup disk") source = posixpath.join( server_setup.EXECUTE_DIR, "scenario_" + self._scenario_info["id"] diff --git a/powersimdata/scenario/scenario.py b/powersimdata/scenario/scenario.py index 87f294cc6..e031c24c8 100644 --- a/powersimdata/scenario/scenario.py +++ b/powersimdata/scenario/scenario.py @@ -20,9 +20,7 @@ class Scenario(object): """ def __init__(self, descriptor): - """Constructor. - - """ + """Constructor.""" if not isinstance(descriptor, str): raise TypeError("Descriptor must be a string") @@ -108,9 +106,7 @@ def _set_status(self): self.status = status.status.values[0] def print_scenario_info(self): - """Prints scenario information. - - """ + """Prints scenario information.""" self.state.print_scenario_info() def change(self, state): diff --git a/powersimdata/scenario/state.py b/powersimdata/scenario/state.py index 673ee3ddc..f8fe2abc8 100644 --- a/powersimdata/scenario/state.py +++ b/powersimdata/scenario/state.py @@ -13,8 +13,7 @@ class State(object): allowed = [] def __init__(self, scenario): - """Constructor. - """ + """Constructor.""" if type(self) == State: raise TypeError("Only subclasses of 'State' can be instantiated directly") @@ -46,9 +45,7 @@ def __str__(self): return self.name def _leave(self): - """Cleans when leaving state. - - """ + """Cleans when leaving state.""" if self.name == "create": del self.builder elif self.name == "analyze": @@ -56,7 +53,5 @@ def _leave(self): del self.ct def _enter(self): - """Initializes when entering state. - - """ + """Initializes when entering state.""" pass diff --git a/powersimdata/tests/mock_builder.py b/powersimdata/tests/mock_builder.py index 4b0034e8e..b5b60be62 100644 --- a/powersimdata/tests/mock_builder.py +++ b/powersimdata/tests/mock_builder.py @@ -5,7 +5,7 @@ class MockBuilder: def __init__(self, ct=None): """Constructor. - + :param dict ct: change table dict to be sent to MockChangeTable. """ if ct is None: diff --git a/powersimdata/tests/mock_grid.py b/powersimdata/tests/mock_grid.py index 12bf4be5d..d38963eb2 100644 --- a/powersimdata/tests/mock_grid.py +++ b/powersimdata/tests/mock_grid.py @@ -147,7 +147,7 @@ class MockGrid(object): def __init__(self, grid_attrs=None): - """ Constructor. + """Constructor. :param dict grid_attrs: dictionary of {*field_name*, *data_dict*} pairs where *field_name* is the name of the data frame (sub, bus2sub, diff --git a/powersimdata/tests/test_mocks.py b/powersimdata/tests/test_mocks.py index 8ec1b8f2a..b075ad941 100644 --- a/powersimdata/tests/test_mocks.py +++ b/powersimdata/tests/test_mocks.py @@ -29,7 +29,8 @@ def mock_pg(): ) pg.set_index( - pd.date_range(start="2016-01-01", periods=period_num, freq="H"), inplace=True, + pd.date_range(start="2016-01-01", periods=period_num, freq="H"), + inplace=True, ) pg.index.name = "UTC" return pg diff --git a/powersimdata/utility/helpers.py b/powersimdata/utility/helpers.py index 0f743c5c6..b21904f2f 100644 --- a/powersimdata/utility/helpers.py +++ b/powersimdata/utility/helpers.py @@ -3,25 +3,17 @@ class PrintManager(object): - """Manages print messages. - - """ + """Manages print messages.""" def __init__(self): - """Constructor - - """ + """Constructor""" self.stdout = sys.stdout @staticmethod def block_print(): - """Suppresses print - - """ + """Suppresses print""" sys.stdout = open(os.devnull, "w") def enable_print(self): - """Enables print - - """ + """Enables print""" sys.stdout = self.stdout diff --git a/setup.py b/setup.py index 88c94e588..9575d9495 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ "paramiko", "scipy", "tqdm", - "psycopg2" + "psycopg2", ] setup(