text
stringlengths
0
1.05M
meta
dict
"""4.2 to 4.3 - add groups_roles relation Revision ID: 784a82cec07a Revises: f1dab814a4a0 Create Date: 2017-11-19 11:38:04.633560 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '784a82cec07a' down_revision = 'f1dab814a4a0' branch_labels = None depends_on = Non...
{ "repo_name": "cloudify-cosmo/cloudify-manager", "path": "resources/rest-service/cloudify/migrations/versions/784a82cec07a_4_2_to_4_3.py", "copies": "1", "size": "1054", "license": "apache-2.0", "hash": -8959833898972082000, "line_mean": 24.7073170732, "line_max": 65, "alpha_frac": 0.6337760911, "a...
"""42. Trapping Rain Water https://leetcode.com/problems/trapping-rain-water/description/ Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. ![img](https://assets.leetcode.com/uploads/2018/10/22/rainwatertrap.png) Th...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/trapping_rain_water.py", "copies": "1", "size": "1411", "license": "mit", "hash": 9130103083398567000, "line_mean": 26.6666666667, "line_max": 77, "alpha_frac": 0.4982282069, "autogenerated": false, "ratio": 3.7626666666...
"""433Mhz listener Usage: run.py run [--debug] [--redis-host=<hostname>] [--redis-port=<port>] """ import local_settings as settings import datetime import json import logging import redis import serial import time import docopt class Mhz433Listener(object): def __init__(self, **kwargs): redis_args ...
{ "repo_name": "ojarva/home-info-display", "path": "listen_433/run.py", "copies": "1", "size": "2891", "license": "bsd-3-clause", "hash": -8673570544704767000, "line_mean": 34.6913580247, "line_max": 123, "alpha_frac": 0.5098581806, "autogenerated": false, "ratio": 4.118233618233618, "config_tes...
# 43. Multiply Strings - LeetCode # https://leetcode.com/problems/multiply-strings/description/ class Solution: def multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ res = [] for i in range(len(num1)+len(num2)): res.a...
{ "repo_name": "heyf/cloaked-octo-adventure", "path": "leetcode/043_multiply-strings.py", "copies": "1", "size": "1325", "license": "mit", "hash": 6011730040677549000, "line_mean": 24.0188679245, "line_max": 61, "alpha_frac": 0.3939622642, "autogenerated": false, "ratio": 3.2960199004975124, "co...
"""43. Multiply Strings https://leetcode.com/problems/multiply-strings/description/ Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Example 1: Input: num1 = "2", num2 = "3" Output: "6" Example 2: Input: num1 = "123", num2 = ...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/multiply_strings.py", "copies": "1", "size": "2015", "license": "mit", "hash": 7434603826304700000, "line_mean": 28.1739130435, "line_max": 76, "alpha_frac": 0.5047193244, "autogenerated": false, "ratio": 3.5754884547069...
# 43 from permutation import permutation from util import list2int class Solve(object): def __init__(self): self.s = permutation([0,1,2,3,4,5,6,7,8,9]) self.s = [x for x in self.s if x[0] != 0] def f1(self, vec): return vec[3] % 2 == 0 def f2(self, vec): return sum([vec[2...
{ "repo_name": "daicang/Euler", "path": "p43.py", "copies": "1", "size": "1041", "license": "mit", "hash": 8048163963726238000, "line_mean": 20.7083333333, "line_max": 53, "alpha_frac": 0.5158501441, "autogenerated": false, "ratio": 2.768617021276596, "config_test": false, "has_no_keywords": f...
"""4.3 to 4.4 - add is_hidden_value column to secrets table Revision ID: c7652b2a97a4 Revises: 3483e421713d Create Date: 2018-04-03 14:31:11.832546 """ from alembic import op import sqlalchemy as sa from manager_rest.storage.models_base import UTCDateTime # revision identifiers, used by Alembic. revision = 'c7652b2a...
{ "repo_name": "cloudify-cosmo/cloudify-manager", "path": "resources/rest-service/cloudify/migrations/versions/c7652b2a97a4_4_3_to_4_4.py", "copies": "1", "size": "3847", "license": "apache-2.0", "hash": -3760479550921424400, "line_mean": 39.0729166667, "line_max": 76, "alpha_frac": 0.5393813361, "a...
"""444""" import hid from mcp2210 import commands import time import sys import os import pprint import time HID_SEND_BUFFER_OFFSET = (1 if 'nt' in os.name or 'windows' in os.name else 0) #PY_PRE_2_6 = (True if sys.version_info[0] <= 2 and sys.version_info[1] < 6 else False) #buf should be an iterable of bytes with l...
{ "repo_name": "calcite/ResetBuddy", "path": "RB_UTILITY/mcp2210/device.py", "copies": "1", "size": "8586", "license": "mit", "hash": 5629947500615108000, "line_mean": 31.4, "line_max": 116, "alpha_frac": 0.6205450734, "autogenerated": false, "ratio": 4.048090523338048, "config_test": false, "...
# 4455770 Dennis Verheijden KI # 4474139 Remco van der Heijden KI # multiAgents.py # -------------- # Licensing Information: Please do not distribute or publish solutions to this # project. You are free to use and extend these projects for educational # purposes. The Pacman AI projects were develop...
{ "repo_name": "ScaleRunner/PacmanAI", "path": "6 - Contest/competitionAgents.py", "copies": "1", "size": "13362", "license": "mit", "hash": 8198738194058498000, "line_mean": 34.6346666667, "line_max": 143, "alpha_frac": 0.649753031, "autogenerated": false, "ratio": 3.7344885410844046, "config_t...
# 4455770 Dennis Verheijden KI # 4474139 Remco van der Heijden KI # searchAgents.py # --------------- # Licensing Information: Please do not distribute or publish solutions to this # project. You are free to use and extend these projects for educational # purposes. The Pacman AI projects were devel...
{ "repo_name": "ScaleRunner/PacmanAI", "path": "4 - Multiagent/searchAgents.py", "copies": "2", "size": "23102", "license": "mit", "hash": -4612684963125125000, "line_mean": 36.0224358974, "line_max": 102, "alpha_frac": 0.6775603844, "autogenerated": false, "ratio": 3.7699086161879896, "config_t...
# 4455770 Dennis Verheijden KI # 4474139 Remco van der Heijden KI # search.py # --------- # Licensing Information: Please do not distribute or publish solutions to this # project. You are free to use and extend these projects for educational # purposes. The Pacman AI projects were developed at UC B...
{ "repo_name": "ScaleRunner/PacmanAI", "path": "4 - Multiagent/search.py", "copies": "2", "size": "6615", "license": "mit", "hash": 5641382011822818000, "line_mean": 34.7567567568, "line_max": 103, "alpha_frac": 0.6696900983, "autogenerated": false, "ratio": 3.730964467005076, "config_test": fal...
# 447. Number of Boomerangs # Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) # such that the distance between i and j equals the distance between i and k (the order of the tuple matters). # # Find the number of boomerangs. You may assume that n will be at most 5...
{ "repo_name": "gengwg/leetcode", "path": "447_number_of_boomerangs.py", "copies": "1", "size": "1567", "license": "apache-2.0", "hash": 3079895666088842000, "line_mean": 32.3404255319, "line_max": 111, "alpha_frac": 0.596043395, "autogenerated": false, "ratio": 3.2242798353909463, "config_test"...
# 448. Find All Numbers Disappeared in an Array # Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), # some elements appear twice and others appear once. # # Find all the elements of [1, n] inclusive that do not appear in this array. # # Could you do it without extra space and in O(n) runtime? # You ma...
{ "repo_name": "gengwg/leetcode", "path": "448_find_all_numbers_disappeared_in_an_array.py", "copies": "1", "size": "1031", "license": "apache-2.0", "hash": -5966020215223221000, "line_mean": 25.3333333333, "line_max": 77, "alpha_frac": 0.5871470302, "autogenerated": false, "ratio": 3.219435736677...
# 44 import math import itertools class Solve(object): def __init__(self): pass def solve(self): """ Solve: find pentagon number small, big (small < big), s.t.: delta = big - small (assume delta < small), sum = small + big are also pentagon numbers We loop big_...
{ "repo_name": "daicang/Euler", "path": "p44.py", "copies": "1", "size": "1167", "license": "mit", "hash": -4831317539330718000, "line_mean": 26.1627906977, "line_max": 67, "alpha_frac": 0.4747215081, "autogenerated": false, "ratio": 3.5907692307692307, "config_test": false, "has_no_keywords":...
""" 4.4 OAUTH 2 for devices Applications that run on devices with limited input capabilities (such as game consoles, video cameras, and printers) can access a Compliant API on behalf of a user, but the user must have separate access to a computer or device with richer input capabilities. The flow i...
{ "repo_name": "greedo/flask-oauth2-devices", "path": "devices/provider/devices.py", "copies": "1", "size": "20182", "license": "mit", "hash": -8506550785617520000, "line_mean": 37.2234848485, "line_max": 78, "alpha_frac": 0.5319591715, "autogenerated": false, "ratio": 4.944145026947575, "config...
"""4_4_to_4_5 Revision ID: a6d00b128933 Revises: c7652b2a97a4 Create Date: 2018-08-05 09:05:15.625382 """ from alembic import op import sqlalchemy as sa from manager_rest.storage.models_base import UTCDateTime # revision identifiers, used by Alembic. revision = 'a6d00b128933' down_revision = 'c7652b2a97a4' branch_la...
{ "repo_name": "cloudify-cosmo/cloudify-manager", "path": "resources/rest-service/cloudify/migrations/versions/a6d00b128933_4_4_to_4_5.py", "copies": "1", "size": "14186", "license": "apache-2.0", "hash": 3211950702491850000, "line_mean": 35.3743589744, "line_max": 79, "alpha_frac": 0.6105315099, "a...
"""44. Wildcard Matching https://leetcode.com/problems/wildcard-matching/description/ Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Matches any sequence of characters (including the empty sequence). The matching...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/wildcard_matching.py", "copies": "1", "size": "1986", "license": "mit", "hash": -1729538180068083500, "line_mean": 19.2040816327, "line_max": 77, "alpha_frac": 0.5434343434, "autogenerated": false, "ratio": 3.23001631321...
# 451. Sort Characters By Frequency # Given a string, sort it in decreasing order based on the frequency of characters. # # Example 1: # # Input: # "tree" # # Output: # "eert" # # Explanation: # 'e' appears twice while 'r' and 't' both appear once. # So 'e' must appear before both 'r' and 't'. Therefore "eetr" is also...
{ "repo_name": "gengwg/leetcode", "path": "451_sort_characters_by_frequency.py", "copies": "1", "size": "1293", "license": "apache-2.0", "hash": 2894370152374923300, "line_mean": 18.5909090909, "line_max": 86, "alpha_frac": 0.56612529, "autogenerated": false, "ratio": 3.028103044496487, "config_...
# 454. 4Sum II # Difficulty:Medium # Given four lists A, B, C, D of integer values, compute how many tuples (i, # j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero. # # To make problem a bit easier, all A, B, C, D have same length of N where 0 # ≤ N ≤ 500. All integers are in the range of -228 to 228 - 1 a...
{ "repo_name": "kingdaa/LC-python", "path": "lc/454_4Sum_II.py", "copies": "1", "size": "1606", "license": "mit", "hash": 4640598504896212000, "line_mean": 24.8387096774, "line_max": 76, "alpha_frac": 0.4900124844, "autogenerated": false, "ratio": 2.6006493506493507, "config_test": false, "has...
"""459. Repeated Substring Pattern https://leetcode.com/problems/repeated-substring-pattern/description/ Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase English letters onl...
{ "repo_name": "rcanepa/cs-fundamentals", "path": "python/interview_questions/repeated_substring_pattern.py", "copies": "1", "size": "1362", "license": "mit", "hash": -387427203498578560, "line_mean": 23.7636363636, "line_max": 87, "alpha_frac": 0.5910425844, "autogenerated": false, "ratio": 3.772...
# 45 import itertools class Solve(object): def __init__(self): self.pen_start_idx = 1 self.hex_start_idx = 1 def tri(self, n): """ Return nth triangle numbers """ return n*(n+1)/2 def find_pen(self, target): """ Find target in pentagonal num...
{ "repo_name": "daicang/Euler", "path": "p45.py", "copies": "1", "size": "1244", "license": "mit", "hash": 7261751180357199000, "line_mean": 24.4081632653, "line_max": 63, "alpha_frac": 0.481511254, "autogenerated": false, "ratio": 3.9871794871794872, "config_test": false, "has_no_keywords": f...
"""4.5 to 4.5.5 - Add dry_run indication in executions table - Add capabilities field to deployments - Add source/target nodes instance IDs to events and logs - Add the agents table - Add the operations and tasks_graphs tables Revision ID: 1fbd6bf39e84 Revises: a6d00b128933 Create Date: 2018-10-07 06:31:52.955877...
{ "repo_name": "cloudify-cosmo/cloudify-manager", "path": "resources/rest-service/cloudify/migrations/versions/1fbd6bf39e84_4_5_to_4_5_5.py", "copies": "1", "size": "11151", "license": "apache-2.0", "hash": -6741896631565259000, "line_mean": 40.4535315985, "line_max": 79, "alpha_frac": 0.5834454309, ...
# 460 - LFU Cache (Hard) # https://leetcode.com/problems/lfu-cache/ # Implement a Least Frequently Used cache. GODDAMN I almost died. from collections import OrderedDict, defaultdict class LFUCache(object): def __init__(self, capacity): """ :type capacity: int """ # From key to va...
{ "repo_name": "zubie7a/Algorithms", "path": "LeetCode/03_Hard/lc_460.py", "copies": "1", "size": "4146", "license": "mit", "hash": -7794249354339301000, "line_mean": 40.47, "line_max": 79, "alpha_frac": 0.5602990835, "autogenerated": false, "ratio": 4.234933605720123, "config_test": false, "h...
# 460. LFU Cache # Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: get and put. # # get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1. # put(key, value) - Set or insert the value if ...
{ "repo_name": "gengwg/leetcode", "path": "460_lfu_cache.py", "copies": "1", "size": "3669", "license": "apache-2.0", "hash": 8116018784754970000, "line_mean": 27.6640625, "line_max": 350, "alpha_frac": 0.5660943036, "autogenerated": false, "ratio": 3.267141585040071, "config_test": false, "ha...
# 462. Minimum Moves to Equal Array Elements II # Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected element by 1. # You may assume the array's length is at most 10,000. # Example...
{ "repo_name": "aenon/OnlineJudge", "path": "leetcode/5.BitManipulation/462.MinimumMovestoEqualArrayElementsII.py", "copies": "1", "size": "2223", "license": "mit", "hash": -5596607523155980000, "line_mean": 33.2153846154, "line_max": 204, "alpha_frac": 0.5339631129, "autogenerated": false, "ratio...
# 463 - Island Perimeter (Easy) # https://leetcode.com/problems/island-perimeter/ from collections import deque class Solution(object): def BFS(self, grid, w, h, i, j): # Doing ([-1] * h) * w will repeat the same list pointer, bad! visited = [[-1] * h for _ in range(w)] dq = deque([(i, j)])...
{ "repo_name": "zubie7a/Algorithms", "path": "LeetCode/01_Easy/lc_463.py", "copies": "1", "size": "1436", "license": "mit", "hash": -7995183621666085000, "line_mean": 34.0243902439, "line_max": 78, "alpha_frac": 0.4129526462, "autogenerated": false, "ratio": 3.7395833333333335, "config_test": fa...
# 463. Island Perimeter # You are given a map in form of a two-dimensional integer grid # where 1 represents land and 0 represents water. # Grid cells are connected horizontally/vertically (not diagonally). # The grid is completely surrounded by water, and there is exactly one island # (i.e., one or more connected...
{ "repo_name": "gengwg/leetcode", "path": "463_island_perimeter.py", "copies": "1", "size": "1752", "license": "apache-2.0", "hash": 4439213260097270300, "line_mean": 32.7115384615, "line_max": 98, "alpha_frac": 0.5936073059, "autogenerated": false, "ratio": 3.208791208791209, "config_test": fal...
# 469. Convex Polygon # Given a list of points that form a polygon when joined sequentially, # find if this polygon is convex (Convex polygon definition). # # Note: # # There are at least 3 and at most 10,000 points. # Coordinates are in the range -10,000 to 10,000. # You may assume the polygon formed by g...
{ "repo_name": "gengwg/leetcode", "path": "469_convex_polygon.py", "copies": "1", "size": "1405", "license": "apache-2.0", "hash": 2459065192681128400, "line_mean": 26.5490196078, "line_max": 239, "alpha_frac": 0.5580071174, "autogenerated": false, "ratio": 3.002136752136752, "config_test": fals...
# 474. Ones and Zeroes # In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue. # # For now, suppose you are a dominator of m 0s and n 1s respectively. # On the other hand, there is an array with strings consisting of only 0s and 1s. # # Now your task is t...
{ "repo_name": "gengwg/leetcode", "path": "474_ones_and_zeros.py", "copies": "1", "size": "3159", "license": "apache-2.0", "hash": 7661569853014096000, "line_mean": 36.602739726, "line_max": 119, "alpha_frac": 0.604007286, "autogenerated": false, "ratio": 2.40578439964943, "config_test": false, ...
# 475. Heaters # Winter is coming! Your first job during the contest is to design a standard heater # with fixed warm radius to warm all the houses. # # Now, you are given positions of houses and heaters on a horizontal line, # find out minimum radius of heaters so that all houses could be covered by those heaters. # ...
{ "repo_name": "gengwg/leetcode", "path": "475_heaters.py", "copies": "1", "size": "2085", "license": "apache-2.0", "hash": -8870378207636530000, "line_mean": 34.9482758621, "line_max": 98, "alpha_frac": 0.6633093525, "autogenerated": false, "ratio": 3.2476635514018692, "config_test": false, "...
"""47. Permutations II https://leetcode.com/problems/permutations-ii/ Given a collection of numbers that might contain duplicates, return all possible unique permutations. Example: Input: [1,1,2] Output: [ [1,1,2], [1,2,1], [2,1,1] ] []: [] [1]: [1] [1,2]: [1, 2], [2, 1] [1,2,1]: [1,1,2], [1,2,1], [2,1,1] 1,...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/permutations_ii.py", "copies": "1", "size": "1512", "license": "mit", "hash": -3907643228500821500, "line_mean": 23, "line_max": 77, "alpha_frac": 0.4854497354, "autogenerated": false, "ratio": 3.4285714285714284, "con...
"""48. Rotate Image https://leetcode.com/problems/rotate-image/ You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the ...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/rotate_image.py", "copies": "1", "size": "1290", "license": "mit", "hash": 2743466968207842300, "line_mean": 18.5454545455, "line_max": 79, "alpha_frac": 0.5356589147, "autogenerated": false, "ratio": 2.816593886462882, ...
# 4/9/2014 # Charles O. Goddard """ craigslist: Functions for scraping Craigslist postings. """ import dateutil.parser import unicodedata import requests import bs4 def sanitize(text): return unicodedata.normalize('NFKD', text).encode('ascii', 'ignore') class Posting(object): """ A posting on craigslist. """ ...
{ "repo_name": "cg123/craigslist-cupid", "path": "craigslist.py", "copies": "1", "size": "2551", "license": "bsd-3-clause", "hash": -4500231624835522000, "line_mean": 20.8034188034, "line_max": 109, "alpha_frac": 0.654253234, "autogenerated": false, "ratio": 2.9559675550405564, "config_test": fa...
# 49 from collections import defaultdict from prime import prime class Solve(object): def __init__(self): self.pdict = defaultdict(list) self.primes = list(prime.primes_between(end=10000)) def solve(self): def find_eq_diff_subseq(l): if len(l) < 3: return ...
{ "repo_name": "daicang/Euler", "path": "p49.py", "copies": "1", "size": "1168", "license": "mit", "hash": 1908258023264839200, "line_mean": 26.1627906977, "line_max": 59, "alpha_frac": 0.4700342466, "autogenerated": false, "ratio": 3.986348122866894, "config_test": false, "has_no_keywords": f...
# 4BitVerticalBargraph2x.py # # A DEMO 4 bit slow analogue bargraph generator in colour for STANDARD Python 2.6.x and Linux... # This is a vertical version of the horizontal one also given away by myself. # It is written so that anyone can understand how it works. # # (Original copyright, (C)2011, B.Walker, G0LCU.) # I...
{ "repo_name": "ActiveState/code", "path": "recipes/Python/577675_Four_Bit_Vertical_Coloured_Analogue_Bar_Graph/recipe-577675.py", "copies": "1", "size": "5615", "license": "mit", "hash": -4885549676701900000, "line_mean": 30.0220994475, "line_max": 96, "alpha_frac": 0.6940338379, "autogenerated": f...
## 4. Column split selection ## def find_best_column(data, target_name, columns): # Fill in the logic here to automatically find the column in columns to split on. # data is a dataframe. # target_name is the name of the target variable. # columns is a list of potential columns to split on. informat...
{ "repo_name": "vipmunot/Data-Analysis-using-Python", "path": "Decision Trees/Building a decision tree-141.py", "copies": "1", "size": "6391", "license": "mit", "hash": -3360286781119124000, "line_mean": 33.7391304348, "line_max": 146, "alpha_frac": 0.6446565483, "autogenerated": false, "ratio": 3...
# 4 December 2015 import argparse import os import re import shlex import subprocess import sys def error(*msg, code=1): print("error:", *msg, file=sys.stderr) exit(code) extensions = {"mp3", "aac", "mka", "dts", "flac", "ogg", "m4a", "ac3", "opus", "wav", "aiff", "aif"} _re_ext = r'(' + r'|'.join(extension...
{ "repo_name": "Machtan/musplay", "path": "search.py", "copies": "1", "size": "7668", "license": "mit", "hash": -1483195589935731700, "line_mean": 31.218487395, "line_max": 100, "alpha_frac": 0.5594679186, "autogenerated": false, "ratio": 3.9709994821336094, "config_test": false, "has_no_keywo...
''' 4-error_evolution.py ========================= AIM: Similarly to 1-orbits_computed.py, checks the error evolution of the computed orbits INPUT: files: - all flux_*.dat files in <orbit_id>_flux/ - <orbit_id>_misc/orbits.dat variables: see section PARAMETERS (below) OUTPUT: in <orbit_id>_misc/ : one file 'o...
{ "repo_name": "kuntzer/SALSA-public", "path": "4_error_evolution.py", "copies": "1", "size": "2915", "license": "bsd-3-clause", "hash": -6990649964198226000, "line_mean": 28.15, "line_max": 117, "alpha_frac": 0.6202401372, "autogenerated": false, "ratio": 3.09447983014862, "config_test": false,...
## 4. Implementing Binary Search: Part 1 ## # A function to extract a player's last name def format_name(name): return name.split(" ")[1] + ", " + name.split(" ")[0] # The length of the data set length = len(nba) # Implement the player_age function. For now, just return what the instructions specify def player_a...
{ "repo_name": "vipmunot/Data-Analysis-using-Python", "path": "Data Structures & Algorithms/Binary Search-93.py", "copies": "1", "size": "5812", "license": "mit", "hash": -4533982484505742000, "line_mean": 35.33125, "line_max": 99, "alpha_frac": 0.6459050241, "autogenerated": false, "ratio": 3.706...
from __future__ import with_statement import os import logging import pprint import time import sys import datetime import itertools import math import collections import random import traceback import calendar from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from goo...
{ "repo_name": "wiseman/4mapper", "path": "code.py", "copies": "1", "size": "23753", "license": "mit", "hash": -7906417336536080000, "line_mean": 30.9690444145, "line_max": 117, "alpha_frac": 0.601524018, "autogenerated": false, "ratio": 3.54046802802206, "config_test": false, "has_no_keywords...
# 4. Median of Two Sorted Arrays - LeetCode # https://leetcode.com/problems/median-of-two-sorted-arrays/description/ class Solution(object): def findMedianSortedArrays(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: float """ left1 = 0 ...
{ "repo_name": "heyf/cloaked-octo-adventure", "path": "leetcode/004_median-of-two-sorted-arrays.py", "copies": "1", "size": "1884", "license": "mit", "hash": 6445847296338236000, "line_mean": 29.4032258065, "line_max": 72, "alpha_frac": 0.4336518047, "autogenerated": false, "ratio": 3.482439926062...
"""4. Median of Two Sorted Arrays There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3, 4] ...
{ "repo_name": "nadesico19/nadepy", "path": "leetcode/algo_4_median_of_two_sorted_arrays.py", "copies": "1", "size": "1748", "license": "mit", "hash": -4272894268155824000, "line_mean": 28.6271186441, "line_max": 97, "alpha_frac": 0.4862700229, "autogenerated": false, "ratio": 3.1158645276292334, ...
# 4. More Control Flow Tools 深入流程控制 # -*- coding: utf-8 -*- # 4.1 if声明 """ x = int(input("Please enter an integer: ")) if x < 0: x = 0 print('Negative changed to zero') elif x == 0: print('Zero') elif x == 1: print('Single') else: print('More') # 4.2。for声明 words = ['cat', 'window', 'defenestrate']...
{ "repo_name": "taoshujian/taoshujian", "path": "Python/Tutorial/4.ControlFlow.py", "copies": "1", "size": "2326", "license": "apache-2.0", "hash": -8008732345775252000, "line_mean": 18.311827957, "line_max": 104, "alpha_frac": 0.5723830735, "autogenerated": false, "ratio": 1.7995991983967936, "...
# 4 # version number needs to be incremented each time the file changes! import math import mathutils import struct import bpy import json writePackedBinary = True filepathPRFX = bpy.data.filepath.rsplit('.', 1)[0] meshfile = open(filepathPRFX + ".mesh.bin", "wb") if writePackedBinary else open(filepathPRFX + ".mesh...
{ "repo_name": "bensteinert/chromarenderer-java", "path": "chroma-java-core/src/main/resources/blenderToChroma.py", "copies": "1", "size": "5789", "license": "mit", "hash": 132603487217403360, "line_mean": 36.5909090909, "line_max": 119, "alpha_frac": 0.5868025566, "autogenerated": false, "ratio":...
## 4. Querying a normalized database ## portman_query = '''select ceremonies.year, nominations.movie from nominations inner join ceremonies on nominations.ceremony_id == ceremonies.id where nominations.nominee == "Natalie Portman"; ''' portman_movies = conn.execute(portman_query).fetchall() for p in portman_movies: ...
{ "repo_name": "vipmunot/Data-Analysis-using-Python", "path": "SQL and Databases Intermediate/Database Normalization and Relations-180.py", "copies": "1", "size": "1331", "license": "mit", "hash": 2025189934928575500, "line_mean": 31.487804878, "line_max": 90, "alpha_frac": 0.7325319309, "autogenera...
## 4. Reading in the data ## import pandas as pd data_files = [ "ap_2010.csv", "class_size.csv", "demographics.csv", "graduation.csv", "hs_directory.csv", "sat_results.csv" ] data = {} for f in data_files: d = pd.read_csv("schools/{0}".format(f)) key_name = f.replace(".csv", "") dat...
{ "repo_name": "vipmunot/Data-Analysis-using-Python", "path": "Data Exploration/Data Cleaning Walkthrough_ Cleaning The Data-208.py", "copies": "1", "size": "2496", "license": "mit", "hash": -4656309392994924000, "line_mean": 33.6805555556, "line_max": 393, "alpha_frac": 0.6137820513, "autogenerated...
# 4 # add hack # add hackerrank # find hac # find hak # # 2 # 0 answer = '' dictionary_head = {} def add(value, dictionary): first_char = value[0] dict_next = dictionary.get(first_char) if dict_next is None: dict_next = {'_': 0} dictionary[first_char] = dict_next ...
{ "repo_name": "eugenj/global-notes", "path": "python_learn/contacts.py", "copies": "1", "size": "1466", "license": "mit", "hash": 4715599396825900000, "line_mean": 18.9428571429, "line_max": 56, "alpha_frac": 0.5375170532, "autogenerated": false, "ratio": 3.316742081447964, "config_test": false...
# 4. SNMP Basics # # a. Create an 'SNMP' directory in your home directory. # # $ mkdir SNMP # $ cd SNMP # # b. Verify that you can import the snmp_helper library. This is a small library that I created to simplify aspects of PySNMP. # # $ python # Python 2.7.5 (default, Feb 11 2014, 07:46:25) # [GCC 4.8.2 2014...
{ "repo_name": "linkdebian/pynet_course", "path": "class2/exercise4.py", "copies": "1", "size": "1708", "license": "apache-2.0", "hash": -3101316275643214000, "line_mean": 29.5, "line_max": 131, "alpha_frac": 0.6797423888, "autogenerated": false, "ratio": 2.5454545454545454, "config_test": false...
"""4Sum Given an array `nums` of n integers and an integer `target`, are there elements a, b, c and d in `nums` such that a + b + c + d = target ? Find all unique quadruplets in the array which gives the sum of target. Note: The solution set must not contain duplicate quadrupletes. Example: Givane array nums = [1, ...
{ "repo_name": "aiden0z/snippets", "path": "leetcode/018_4sum.py", "copies": "1", "size": "3820", "license": "mit", "hash": -9187323078683178000, "line_mean": 27.796875, "line_max": 98, "alpha_frac": 0.3906673901, "autogenerated": false, "ratio": 3.3267148014440435, "config_test": false, "has_...
"""4th update that adds users and roles Revision ID: 32a8ac91d28d Revises: 37a45401820b Create Date: 2015-11-08 16:56:55.335926 """ # revision identifiers, used by Alembic. revision = '32a8ac91d28d' down_revision = '37a45401820b' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto ...
{ "repo_name": "Rdbaker/GameCenter", "path": "migrations/versions/32a8ac91d28d_.py", "copies": "2", "size": "1317", "license": "mit", "hash": -6200086952976656000, "line_mean": 29.6279069767, "line_max": 64, "alpha_frac": 0.6659073652, "autogenerated": false, "ratio": 3.4031007751937983, "config...
# decode a frame def readFrame(cyclecount0, cyclecount1): if cyclecount0 < cyclecount1 : if cyclecount1 < 2 * cyclecount0 : return 0 # c0 < c1 < 2.c0 : 1100 return 1 # 2.c0 < c1 : 1110 else : if cyclecount0 < 2 * cyclecount1 : return 0 # c1 < c0 < 2.c1 : 1100 return CARRIER # 2.c1 < c0 : 1000 return E...
{ "repo_name": "lyriarte/dummycomm", "path": "gpio_comm.py", "copies": "1", "size": "1302", "license": "bsd-2-clause", "hash": 9105609945551670000, "line_mean": 19.34375, "line_max": 43, "alpha_frac": 0.6466973886, "autogenerated": false, "ratio": 2.547945205479452, "config_test": false, "has_...
# # 50.012 Networks Lab 2 code skeleton # Based on old code from Kurose & Ross: Computer Networks # Streamlined, threaded, ported to HTTP/1.1 from socket import * from thread import * import sys,os BUFFER_SIZE = 4096 PROXY_PORT = 8080 def clientthread(tcpCliSock): message = tcpCliSock.recv(BUFFER_SIZE) print ...
{ "repo_name": "LYZhelloworld/Courses", "path": "50.012/02/proxyServer.py", "copies": "1", "size": "4605", "license": "mit", "hash": 1967903279069412900, "line_mean": 36.1370967742, "line_max": 120, "alpha_frac": 0.5711183496, "autogenerated": false, "ratio": 4.093333333333334, "config_test": fa...
""" 500Hz Volta Box """ import logging import queue as q import time from volta.common.interfaces import VoltaBox from volta.common.util import TimeChopper from netort.data_processing import Drain logger = logging.getLogger(__name__) class VoltaBox500Hz(VoltaBox): """ VoltaBox500Hz - works with plain-text 500h...
{ "repo_name": "yandex-load/volta", "path": "volta/providers/boxes/box500hz.py", "copies": "1", "size": "4353", "license": "mpl-2.0", "hash": -255142881213687840, "line_mean": 29.8794326241, "line_max": 96, "alpha_frac": 0.5688031243, "autogenerated": false, "ratio": 3.7429062768701633, "config_...
# 50m maps of all states (10m Alaska shape) import os import sys import argparse from mapnik_xml import * # Global variables xd_width, xd_height = 1200, 900 base_dir = '/Users/monad/Work/data' cult10m_dir = os.path.join(base_dir, '10m_cultural', '10m_cultural') phys10m_dir = os.path.join(base_dir, '10m_physical') c...
{ "repo_name": "monadius/mapnik2_maps", "path": "usa50_50m_xml.py", "copies": "1", "size": "9239", "license": "mit", "hash": -8565631197804279000, "line_mean": 32.7189781022, "line_max": 109, "alpha_frac": 0.6274488581, "autogenerated": false, "ratio": 2.8462723351817623, "config_test": false, ...
# 50m maps of all states (10m Alaska shape) import os import sys import argparse # Global variables xd_width, xd_height = 1200, 900 base_dir = '/Users/monad/Work/data' cult10m_dir = os.path.join(base_dir, '10m_cultural', '10m_cultural') phys10m_dir = os.path.join(base_dir, '10m_physical') cult50m_dir = os.path.join...
{ "repo_name": "monadius/mapnik2_maps", "path": "usa50_50m.py", "copies": "1", "size": "11452", "license": "mit", "hash": -1064825273717549400, "line_mean": 27.7738693467, "line_max": 109, "alpha_frac": 0.6139538945, "autogenerated": false, "ratio": 2.9014441347859132, "config_test": false, "h...
# 50 # Find the prime below 1000000, which can be written as sum of most consecutive primes # 997651 from datetime import datetime from sympy import sieve from prime import prime class Solve(object): def __init__(self): pass def solve(self): # primes under 1000000: 78498 # prime.prim...
{ "repo_name": "daicang/Euler", "path": "p50.py", "copies": "1", "size": "2073", "license": "mit", "hash": -7824557918621743000, "line_mean": 27.7916666667, "line_max": 93, "alpha_frac": 0.5012059817, "autogenerated": false, "ratio": 3.8247232472324724, "config_test": false, "has_no_keywords":...
"""5_1_1 to 5_2 - Add columns to blueprints table for the async. blueprints upload Revision ID: 9d261e90b1f3 Revises: 5ce2b0cbb6f3 Create Date: 2020-11-26 14:07:36.053518 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql from sqlalchemy.sql import table, column from cloud...
{ "repo_name": "cloudify-cosmo/cloudify-manager", "path": "resources/rest-service/cloudify/migrations/versions/9d261e90b1f3_5_1_1_to_5_2.py", "copies": "1", "size": "21192", "license": "apache-2.0", "hash": 8801369302997262000, "line_mean": 33.6274509804, "line_max": 79, "alpha_frac": 0.5592676482, ...
# 5-1. Conditional Tests: Write a series of conditional tests. Print a statement describing each test # and your prediction for the results of each test. Your code should look something like this: # car = 'subaru' # print("Is car == 'subaru'? I predict True.") # print(car == 'subaru') # print("\nIs car == 'audi'? I pr...
{ "repo_name": "AnhellO/DAS_Sistemas", "path": "Ago-Dic-2019/DanielM/PracticaUno/5.1_ConditionalTests.py", "copies": "1", "size": "2313", "license": "mit", "hash": -1948489859523368400, "line_mean": 34.5384615385, "line_max": 120, "alpha_frac": 0.4664356864, "autogenerated": false, "ratio": 4.0795...
# 5.1 create a list of your favorite musicians # musicians = ['Eminem', 'Björns vänner', 'Solen'] # print(musicians) # # # 5.2 Create a list of tuples with each yuple containing a coordinate # cord_bro = ('55.7N', '14.1E') # cord_lun = ('55.6N', '13.1E') # # places = [cord_bro, cord_lun] # 5.3/4 Create a dictionary ...
{ "repo_name": "Frikeer/LearnPython", "path": "exc5.py", "copies": "1", "size": "1072", "license": "unlicense", "hash": -3760388473789911600, "line_mean": 23.2272727273, "line_max": 79, "alpha_frac": 0.6332082552, "autogenerated": false, "ratio": 2.4063205417607225, "config_test": false, "has_...
"""51. N-Queens https://leetcode.com/problems/n-queens/description/ The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. ![](https://assets.leetcode.com/uploads/2018/10/12/8-queens.png) Given an integer n, return all distinct solutions to the n-queens...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/n_queens.py", "copies": "1", "size": "2689", "license": "mit", "hash": 6734350502449306000, "line_mean": 27.7311827957, "line_max": 78, "alpha_frac": 0.5078592814, "autogenerated": false, "ratio": 3.8335724533715925, "...
"""5_1 to 5_1_1 - Add column topology_order to deployment_update_steps table Revision ID: 5ce2b0cbb6f3 Revises: 387fcd049efb Create Date: 2020-11-09 15:12:12.055532 """ import yaml from alembic import op import sqlalchemy as sa from sqlalchemy.sql import table, column, select from manager_rest.storage.models_base i...
{ "repo_name": "cloudify-cosmo/cloudify-manager", "path": "resources/rest-service/cloudify/migrations/versions/5ce2b0cbb6f3_5_1_to_5_1_1.py", "copies": "1", "size": "6081", "license": "apache-2.0", "hash": 3645664928210240000, "line_mean": 32.9720670391, "line_max": 79, "alpha_frac": 0.5558296333, "...
#5/23/17 #GOAL: parse data from USGS water resources software list into something #uploadable to the ontosoft portal for USGS. Use this formatted data and upload #to USGS Ontosoft portal from urllib.request import urlopen import requests import json def main(): #readURL(url, fileName) usgsData = getInfo('usgs...
{ "repo_name": "mrk7217/usgsOntosoft", "path": "USGSProjectAnalysis.py", "copies": "1", "size": "5992", "license": "apache-2.0", "hash": -2646248797247152000, "line_mean": 38.1503267974, "line_max": 120, "alpha_frac": 0.6550918197, "autogenerated": false, "ratio": 3.779179810725552, "config_test...
"""52. N-Queens II https://leetcode.com/problems/n-queens-ii/description/ The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return the number of distinct solutions to the n-queens puzzle. Example: Input: 4 Output: 2 Explana...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/n_queens_ii.py", "copies": "1", "size": "1759", "license": "mit", "hash": -1569239248940749800, "line_mean": 23.0136986301, "line_max": 77, "alpha_frac": 0.5099828865, "autogenerated": false, "ratio": 3.6597077244258873,...
"""5_2 to 5_3 - Create blueprints_labels table - Create deployment labels dependencies table - Apply some modification to the deployments labels table - Split the `filters` table to `deployments_filters` and `blueprints_filters` - Add installation_status to the deployment table - Add deployment_status to the deploymen...
{ "repo_name": "cloudify-cosmo/cloudify-manager", "path": "resources/rest-service/cloudify/migrations/versions/396303c07e35_5_2_to_5_3.py", "copies": "1", "size": "31218", "license": "apache-2.0", "hash": 6612465074529819000, "line_mean": 34.037037037, "line_max": 78, "alpha_frac": 0.5583317317, "au...
"""5_3 to 6_0 Revision ID: b92770a7b6ca Revises: 396303c07e35 Create Date: 2021-04-12 09:33:44.399254 """ from alembic import op import sqlalchemy as sa from manager_rest.storage import models # revision identifiers, used by Alembic. revision = 'b92770a7b6ca' down_revision = '396303c07e35' branch_labels = None depe...
{ "repo_name": "cloudify-cosmo/cloudify-manager", "path": "resources/rest-service/cloudify/migrations/versions/b92770a7b6ca_5_3_to_6_0.py", "copies": "1", "size": "7968", "license": "apache-2.0", "hash": -5922347937264730000, "line_mean": 24.6205787781, "line_max": 74, "alpha_frac": 0.5724146586, "a...
# 54 from collections import Counter, defaultdict class Card(object): def __init__(self, s): self.value, self.color = Solve.orders[s[:-1]], s[-1:] class Solve(object): orders = {r:i for i, r in enumerate('23456789TJQKA', 1)} def __init__(self): self.nr_p1win = 0 with open('p054_p...
{ "repo_name": "daicang/Euler", "path": "p54.py", "copies": "1", "size": "3846", "license": "mit", "hash": -4629212245426725000, "line_mean": 30.2764227642, "line_max": 112, "alpha_frac": 0.4880395216, "autogenerated": false, "ratio": 3.621468926553672, "config_test": false, "has_no_keywords":...
"""54. Spiral Matrix https://leetcode.com/problems/spiral-matrix/ Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example 1: Input: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] Output: [1,2,3,6,9,8,7,4,5] Example 2: Input: [ [1, 2, 3, 4], [5, 6, 7, 8], ...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/spiral_matrix.py", "copies": "1", "size": "1856", "license": "mit", "hash": -9082359086984925000, "line_mean": 27.1212121212, "line_max": 82, "alpha_frac": 0.4369612069, "autogenerated": false, "ratio": 3.437037037037037...
# 5-5. Alien Colors #3: Turn your if-else chain from Exercise 5-4 into an if-elif-else chain. # • If the alien is green, print a message that the player earned 5 points. # • If the alien is yellow, print a message that the player earned 10 points. # • If the alien is red, print a message that the player earned 15 point...
{ "repo_name": "AnhellO/DAS_Sistemas", "path": "Ago-Dic-2019/DanielM/PracticaUno/5.5_AlienColors3.py", "copies": "1", "size": "1168", "license": "mit", "hash": -7141399838608891000, "line_mean": 34.1818181818, "line_max": 110, "alpha_frac": 0.6232758621, "autogenerated": false, "ratio": 3.60248447...
"""55. Jump Game https://leetcode.com/problems/jump-game/ Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index. Example 1: Input: [2,3...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/jump_game.py", "copies": "1", "size": "1476", "license": "mit", "hash": -7310829640529877000, "line_mean": 27.3846153846, "line_max": 79, "alpha_frac": 0.5846883469, "autogenerated": false, "ratio": 3.9151193633952253, ...
"""560. Subarray Sum Equals K Medium Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Input: nums = [1,1,1], k = 2 Output: 2 Note: The length of the array is in range [1, 20,000]. The range of numbers in the array is [-1000, 100...
{ "repo_name": "bowen0701/algorithms_data_structures", "path": "lc0560_subarray_sum_equals_k.py", "copies": "1", "size": "2805", "license": "bsd-2-clause", "hash": -3399014722919224000, "line_mean": 24.9722222222, "line_max": 86, "alpha_frac": 0.5629233512, "autogenerated": false, "ratio": 3.32345...
"""56. Merge Intervals https://leetcode.com/problems/merge-intervals/ Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6]. Example 2: Input: [[1...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/merge_intervals.py", "copies": "1", "size": "1336", "license": "mit", "hash": -5937573995945112000, "line_mean": 26.2653061224, "line_max": 77, "alpha_frac": 0.5464071856, "autogenerated": false, "ratio": 3.1069767441860...
# 56. Score of Parentheses # Difficulty: Medium # # Given a balanced parentheses string S, compute the score of the string # based on the following rule: # # () has score 1 # AB has score A + B, where A and B are balanced parentheses strings. # (A) has score 2 * A, where A is a balanced parentheses string. # # # Exampl...
{ "repo_name": "kingdaa/LC-python", "path": "lc/856_Score_of_Parentheses.py", "copies": "1", "size": "1188", "license": "mit", "hash": 2671439921528775000, "line_mean": 19.1355932203, "line_max": 72, "alpha_frac": 0.4991582492, "autogenerated": false, "ratio": 3.3559322033898304, "config_test": ...
"""57. Insert Interval https://leetcode.com/problems/insert-interval/ Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times. Example 1: Input: intervals = [[1,3],[6,9]], newInter...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/insert_interval.py", "copies": "1", "size": "1704", "license": "mit", "hash": -3360784160488429600, "line_mean": 26.9344262295, "line_max": 77, "alpha_frac": 0.558685446, "autogenerated": false, "ratio": 3.25190839694656...
583. Delete Operation for Two Strings Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one character in either string. Example 1: Input: "sea", "eat" Output: 2 Explanation: You need one step to make "sea" to "ea" and another...
{ "repo_name": "carlb15/Python", "path": "min_operations_for_2_strings.py", "copies": "1", "size": "2791", "license": "mit", "hash": 7423928261465065000, "line_mean": 34.3417721519, "line_max": 174, "alpha_frac": 0.4632748119, "autogenerated": false, "ratio": 3.437192118226601, "config_test": fa...
""" 58 zhengzhou ershou house information """ from scrapy.spiders import Spider from scrapy import Request from scrapy.exceptions import CloseSpider, DropItem from five8.items import Five8Item import re from five8.mydb import db_context class ErshouHouseSpider(Spider): name = '58ershou' allowed_domains = ['58....
{ "repo_name": "rwecho/fflask_blog", "path": "five8/five8/spiders/five8_spider.py", "copies": "1", "size": "3024", "license": "apache-2.0", "hash": -2646751737909206000, "line_mean": 37.7692307692, "line_max": 98, "alpha_frac": 0.5826719577, "autogenerated": false, "ratio": 3.6129032258064515, "...
# 594. Longest Harmonious Subsequence: """ We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an integer array, you need to find the length of its longest harmonious subsequence among all its possible subsequences. Input: [1,3,2,2,5,2...
{ "repo_name": "ledrui/programming-problems", "path": "leetCode/weekly_contest/longest_Harmonious_Subsequence.py", "copies": "1", "size": "1027", "license": "mit", "hash": -2081233146562587100, "line_mean": 24.675, "line_max": 69, "alpha_frac": 0.5628042843, "autogenerated": false, "ratio": 3.3782...
"""59. Spiral Matrix II https://leetcode.com/problems/spiral-matrix-ii/ Given a positive integer n, generate a square matrix filled with elements from 1 to n^2 in spiral order. Example: Input: 3 Output: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ] """ from typing import List class Solution: def generate_matri...
{ "repo_name": "isudox/leetcode-solution", "path": "python-algorithm/leetcode/spiral_matrix_ii.py", "copies": "1", "size": "1492", "license": "mit", "hash": -4323743834863863000, "line_mean": 29.4489795918, "line_max": 78, "alpha_frac": 0.4302949062, "autogenerated": false, "ratio": 3.577937649880...
# 5a def rev(l): return [x for x in l[::-1]] assert(rev([1,2,3]) == [3,2,1]) # 5b def rev(l): return reduce(lambda a, n: [n] + a, l, []) assert(rev([1,2,3]) == [3,2,1]) # 6 def print_some(l): print_ret = -1 in l def decorator(f): def decorated(*args): for x in l: ...
{ "repo_name": "metakirby5/cse130-exams", "path": "finals/sp13.py", "copies": "1", "size": "3673", "license": "mit", "hash": -3892894689803983400, "line_mean": 26.2074074074, "line_max": 84, "alpha_frac": 0.51184318, "autogenerated": false, "ratio": 2.8762725137039937, "config_test": false, "h...
5# -*- coding: cp1252 -*- #Copyright © 2015 B3nac import os import sys import random import math import pygame as pg from gamedata import constants as a from gameobjects import galaxywh from gamedata import player from gamedata import bullet import SpaceRiot class Control(object): """Class that manages primary con...
{ "repo_name": "B3nac/SpaceRiot0.0.5", "path": "galaxyMap.py", "copies": "1", "size": "5714", "license": "mit", "hash": -411815346857102500, "line_mean": 35.864516129, "line_max": 112, "alpha_frac": 0.580679034, "autogenerated": false, "ratio": 3.57125, "config_test": false, "has_no_keywords":...
""" 5 Kyu - sum of pairs kata. I was having difficulty getting this kata to run within the 12000ms time constraint. Eventually, I collaborated with another programmer to determine that xrange was necessary for "lazy" loop evaluation. This would prevent the entire loop from being evaluated prior to the function return."...
{ "repo_name": "tylerc-atx/script_library", "path": "solved_5kyu-sumofpairs.py", "copies": "1", "size": "2187", "license": "mit", "hash": 6166104548391995000, "line_mean": 33.7142857143, "line_max": 113, "alpha_frac": 0.6154549611, "autogenerated": false, "ratio": 3.5970394736842106, "config_tes...
# 5 Layer DNN for digits 0 to 4 of MNIST # 100 neurons in each layer # ADAM optimization and early stopping # Import modules and data import tensorflow as tf import numpy as np from tensorflow.contrib.layers import fully_connected, batch_norm, dropout from tensorflow.examples.tutorials.mnist import input_data # Set r...
{ "repo_name": "KT12/hands_on_machine_learning", "path": "5_layer_dnn.py", "copies": "1", "size": "4533", "license": "mit", "hash": 5207969959014310000, "line_mean": 37.4152542373, "line_max": 89, "alpha_frac": 0.6898301346, "autogenerated": false, "ratio": 3.0240160106737823, "config_test": tru...
# 5. Longest Palindromic Substring - LeetCode # https://leetcode.com/problems/longest-palindromic-substring/description/ class Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: str """ s = "#" + "#".join(s) + "#" def check_palindrome(...
{ "repo_name": "heyf/cloaked-octo-adventure", "path": "leetcode/005_longest-palindromic-substring.py", "copies": "1", "size": "1580", "license": "mit", "hash": -2259868846164747500, "line_mean": 27.7454545455, "line_max": 74, "alpha_frac": 0.3949367089, "autogenerated": false, "ratio": 3.648960739...
"""5. Longest Palindromic Substring Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. """ class Solution(object): def longestPalindrome(self, s): """ :type s: s...
{ "repo_name": "nadesico19/nadepy", "path": "leetcode/algo_5_longest_palindromic_substring.py", "copies": "1", "size": "1220", "license": "mit", "hash": 328861900666210100, "line_mean": 30.1052631579, "line_max": 113, "alpha_frac": 0.4885245902, "autogenerated": false, "ratio": 3.685800604229607, ...
''' 5-statistics-error.py ========================= AIM: Perform basic statistics on the data and gets the maximal stray light flux for one orbit INPUT: files: - <orbit_id>_misc/orbits.dat variables: see section PARAMETERS (below) OUTPUT: in <orbit_id>_misc/ : file one stat file in <orbit_id>_figures/ : error evo...
{ "repo_name": "kuntzer/SALSA-public", "path": "5_statistics_error.py", "copies": "1", "size": "5532", "license": "bsd-3-clause", "hash": -4815206374991323000, "line_mean": 28.1157894737, "line_max": 114, "alpha_frac": 0.6352133044, "autogenerated": false, "ratio": 2.8544891640866874, "config_te...
# 5. El Emperador esta celebrando aniversario y ofrecera a sus clientes una serie #de ofertas que se traduciran en un incremento de sus ventas Las reglas de las ofertas #se basan en un porcentaje de descuento sobre el total de compra, que estarian variando #dependiendo del monto adquirido: Por un ponton mayor o igua...
{ "repo_name": "eliecer11/Uip-prog3", "path": "laboratorios/quiz2/quiz-2.py", "copies": "1", "size": "1205", "license": "mit", "hash": 3394683489740133400, "line_mean": 30.6842105263, "line_max": 89, "alpha_frac": 0.7259136213, "autogenerated": false, "ratio": 2.4824742268041238, "config_test": ...
""" 5th order Runge-Kutta integration. """ # Third-party import numpy as np # Project from ..core import Integrator from ..timespec import parse_time_specification __all__ = ["RK5Integrator"] # These are the Dormand-Prince parameters for embedded Runge-Kutta methods A = np.array([0.0, 0.2, 0.3, 0.6, 1.0, 0.875]) B ...
{ "repo_name": "adrn/gala", "path": "gala/integrate/pyintegrators/rk5.py", "copies": "2", "size": "3474", "license": "mit", "hash": -4285348254675915300, "line_mean": 34.0909090909, "line_max": 112, "alpha_frac": 0.540875072, "autogenerated": false, "ratio": 2.951571792693288, "config_test": fal...
"""5th update that creates Requests table and adds a backref to game and users Revision ID: 2b7d1717f5cb Revises: 32a8ac91d28d Create Date: 2015-11-09 13:07:07.328317 """ # revision identifiers, used by Alembic. revision = '2b7d1717f5cb' down_revision = '32a8ac91d28d' from alembic import op import sqlalchemy as sa ...
{ "repo_name": "Rdbaker/Rank", "path": "migrations/versions/2b7d1717f5cb_.py", "copies": "2", "size": "1352", "license": "mit", "hash": 3731670218726443000, "line_mean": 32.8, "line_max": 79, "alpha_frac": 0.6664201183, "autogenerated": false, "ratio": 3.3137254901960786, "config_test": false, ...
5#!/usr/bin/env python """ conference.py -- Udacity conference server-side Python App Engine API; uses Google Cloud Endpoints $Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $ created by wesc on 2014 apr 21 """ __author__ = 'wesc+api@google.com (Wesley Chun)' from datetime import datetime from da...
{ "repo_name": "cpwhidden/Conference-Central", "path": "conference.py", "copies": "1", "size": "38673", "license": "apache-2.0", "hash": -4525158265753829400, "line_mean": 36.8775710088, "line_max": 98, "alpha_frac": 0.6135029607, "autogenerated": false, "ratio": 4.229330708661418, "config_test"...
# 5x4 LED arrangments for digits num1 = [[0, 1, 0, 0], [1, 1, 0, 0], [0, 1, 0, 0], [0, 1, 0, 0], [1, 1, 1, 0]] num2 = [[0, 1, 1, 0], [1, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]] num3 = [[1, 1, 1, 0], [0, 0, 0, 1], [0, 1, 1, 0]...
{ "repo_name": "kbsezginel/raspberry-pi", "path": "scripts/rpi/8x8-led-lmatrix/numbers5x4.py", "copies": "1", "size": "1215", "license": "bsd-3-clause", "hash": -2691787429683438600, "line_mean": 18.2857142857, "line_max": 70, "alpha_frac": 0.2576131687, "autogenerated": false, "ratio": 2.06984667...
# 6.0001 Problem Set 3 # # The 6.0001 Word Game # Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens> # # Name : <your name> # Collaborators : <your collaborators> # Time spent : <total time> import math import random import string import re VOWELS = 'aeiou' CONSONANTS = 'bcdfghjklmnpqrstvwxyz' HAND_SIZ...
{ "repo_name": "Dreemsuncho/Introduction-to-Computer-Science-and-Programming-using-python-MIT", "path": "Class/ps3/ps3.py", "copies": "1", "size": "12040", "license": "mit", "hash": 3318135784448066600, "line_mean": 27.1967213115, "line_max": 220, "alpha_frac": 0.6063122924, "autogenerated": false, ...
# 6.0001 Problem Set 3 # # The 6.0001 Word Game # Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens> # # Name : <your name> # Collaborators : <your collaborators> # Time spent : <total time> import math import random import string VOWELS = 'aeiou' CONSONANTS = 'bcdfghjklmnpqrstvwxyz' HAN...
{ "repo_name": "indefinitelee/Learning", "path": "MIT_60001_Introduction_to_Computer_Science_and_Programming_in_Python/assignments/PS3/ps3.py", "copies": "1", "size": "10691", "license": "mit", "hash": 6662195679950383000, "line_mean": 28.9884057971, "line_max": 212, "alpha_frac": 0.6089233935, "aut...
# 6.00.1x # Problem Set 7 Test Suite import unittest import sys from ps7 import * class ProblemSet7NewsStory(unittest.TestCase): def setUp(self): pass def testNewsStoryConstructor(self): story = NewsStory('', '', '', '', '') def testNewsStoryGetGuid(self): story = NewsStory('test g...
{ "repo_name": "spradeepv/dive-into-python", "path": "edx/problem_set_7/ps7_test.py", "copies": "1", "size": "11910", "license": "mit", "hash": 338355974331948700, "line_mean": 55.7142857143, "line_max": 159, "alpha_frac": 0.6130982368, "autogenerated": false, "ratio": 3.901080904028824, "config...
# 6.00.1x Problem Set 7 # RSS Feed Filter import feedparser import string import time from project_util import translate_html from Tkinter import * #----------------------------------------------------------------------- # # Problem Set 7 #====================== # Code for retrieving and parsing RSS feeds # Do not ...
{ "repo_name": "FylmTM/edX-code", "path": "MITx_6.00.1x/problem_set_7/ps7.py", "copies": "1", "size": "9271", "license": "mit", "hash": 736300026658741800, "line_mean": 27.0939393939, "line_max": 120, "alpha_frac": 0.5917376766, "autogenerated": false, "ratio": 4.041412380122058, "config_test": ...
# 6.00.1x Problem Set 7 # RSS Feed Filter import string import time from Tkinter import * import feedparser from project_util import translate_html # Problem Set 7 #====================== # Code for retrieving and parsing RSS feeds # Do not change this code #====================== def process(url): """ Fet...
{ "repo_name": "nicola88/edx", "path": "MITx/6.00.1x/Week-7/Problem-Set-7/ps7.py", "copies": "1", "size": "10277", "license": "mit", "hash": 7510099204902020000, "line_mean": 28.1161473088, "line_max": 120, "alpha_frac": 0.5915150336, "autogenerated": false, "ratio": 4.122342559165664, "config_t...
# 6.00.2x Problem Set 2: Simulating robots import math import random import ps2_visualize import pylab # For Python 2.7: from ps2_verify_movement27 import testRobotMovement # If you get a "Bad magic number" ImportError, you are not using # Python 2.7 and using most likely Python 2.6: # === Provided class Positio...
{ "repo_name": "xqliu/coursera", "path": "6.00.2x_IntroductionToComputationalThinkingAndDataScience/ProblemSet2/ps2.py", "copies": "1", "size": "11499", "license": "mit", "hash": 3226943671527708700, "line_mean": 30.3324250681, "line_max": 88, "alpha_frac": 0.6227498043, "autogenerated": false, "r...
# 6.00.2x Problem Set 2: Simulating robots import math import random import ps2_visualize import pylab # For Python 3.5: from ps2_verify_movement35 import testRobotMovement # If you get a "Bad magic number" ImportError, you are not using Python 3.5 # === Provided class Position class Position(object): """ ...
{ "repo_name": "approximata/edx_mit_6.00.2x", "path": "pset2/ps2.py", "copies": "1", "size": "12418", "license": "mit", "hash": -5271029481961377000, "line_mean": 29.140776699, "line_max": 95, "alpha_frac": 0.6182960219, "autogenerated": false, "ratio": 4.07816091954023, "config_test": false, ...
# 6.00.2x Problem Set 2: Simulating robots import math import random import ps2_visualize import pylab import numpy as np ################## # Comment/uncomment the relevant lines, depending on which version of Python you have ################## # For Python 3.5: from ps2_verify_movement35 import testRobotMovement ...
{ "repo_name": "Mdlkxzmcp/various_python", "path": "MITx/6002x/pset2/ps2.py", "copies": "1", "size": "11266", "license": "mit", "hash": -7466551772722618000, "line_mean": 30.2077562327, "line_max": 121, "alpha_frac": 0.6294159418, "autogenerated": false, "ratio": 3.9295430763864667, "config_test...
# 6.00.2x Problem Set 2: Simulating robots import math import random import ps2_visualize import pylab ################## ## Comment/uncomment the relevant lines, depending on which version of Python you have ################## # For Python 3.5: #from ps2_verify_movement35 import testRobotMovement # If you get a "B...
{ "repo_name": "johntauber/MITx6.00.2x", "path": "Unit2/pset2/ps2.py", "copies": "1", "size": "11553", "license": "mit", "hash": -5000792438813792000, "line_mean": 29.7260638298, "line_max": 98, "alpha_frac": 0.6188868692, "autogenerated": false, "ratio": 3.9578622816032887, "config_test": false...
# 6.00.2x Problem Set 4 import numpy import random import pylab from ps3b import * def simulationWithDrug(numViruses, maxPop, maxBirthProb, clearProb, resistances, mutProb, drugTimeStep, timeStepsAfterDrug): time_steps = drugTimeStep + timeStepsAfterDrug total = 0 viruses = [] f...
{ "repo_name": "FylmTM/edX-code", "path": "MITx_6.00.2x/problem_set_4/ps4.py", "copies": "1", "size": "2221", "license": "mit", "hash": 763235085029246000, "line_mean": 29.0135135135, "line_max": 121, "alpha_frac": 0.6920306168, "autogenerated": false, "ratio": 3.6529605263157894, "config_test":...
# 6.00.2x Problem Set 4 import numpy import random import pylab from ps3b import * # # PROBLEM 1 # def simulationDelayedTreatment(numTrials): """ Runs simulations and make histograms for problem 1. Runs numTrials simulations to show the relationship between delayed treatment and patient outco...
{ "repo_name": "zhouyulian17/Course", "path": "Python/6.00.2x Introduction to Computational Thinking and Data Science/ProblemSet4/ps4.py", "copies": "1", "size": "3069", "license": "mit", "hash": 1665301354569771300, "line_mean": 27.1651376147, "line_max": 81, "alpha_frac": 0.6386445096, "autogenera...