blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
ab6937f45e9131b987150dbbfde90a68a4d20f60
Python
andrey-ladygin-loudclear/deep-learning
/helper/structures/dictionaries.py
UTF-8
2,207
3.546875
4
[]
no_license
# Dictionaries are implemented as hash maps and are very good at element insertion, # deletion, and access; all these operations have an average O(1) time complexity. # In Python versions up to 3.5, dictionaries are unordered collections. # Access, insertion, and removal of an item in a dictionary scales as O(1) with...
true
21e184faef05d0667f515594430c814ac7faccf8
Python
serllad/oop
/test12.py
UTF-8
271
2.90625
3
[]
no_license
from urllib.request import urlopen import re p = re.compile(r'<a href="(/jobs/\d+)/">(.*?)</a>')#.*ๆ˜ฏ่ดชๅฉช็š„๏ผŒๅฆ‚ๆžœไธๅŒน้…ๅ†ๅ›žๆบฏ? text = urlopen('http://python.org/jobs').read().decode() for url, name in p.findall(text): print('{} ({})'.format(name, url))
true
81d4ab12798bbf0bfa2bd2e7abee0915d4826b19
Python
y0ungdev/Algorithm
/SWEA/SWEA_1974_์Šค๋„์ฟ ๊ฒ€์ฆ.py
UTF-8
865
3.1875
3
[]
no_license
import sys sys.stdin = open("1974.txt", "r") T = int(input()) for tc in range(1, T+1): sudoku = [list(map(int, input().split())) for _ in range(9)] result = 1 # ๊ฐ€๋กœ ํ™•์ธ for x in range(9): xV = set() for y in range(9): xV.add(sudoku[x][y]) if len(xV) != 9 : ...
true
2daef8f6611ebae97f08ff0fa2eb5bd3467e04c7
Python
sam-hunt/spam-filter
/src/remove_stopwords.py
UTF-8
1,151
3
3
[]
no_license
from nltk.stem.porter import PorterStemmer def parse(filename): punctuation= ['.',',','?',':',';','\n'] #make stopwords a set for faster membership lookup later (using a large stopwords list) stopwords = set(open('../res/stopwords.txt', 'r').read().split()) textwords = open(filename, 'r').read()...
true
bb954fcd78f3a31b7e5f5471a716d02095038f2a
Python
tcfh2016/knowledge-map
/Techs/prgramming-language/python/notes/module/pkg/eggs.py
UTF-8
157
2.921875
3
[]
no_license
x = 9999 import string print(string) class EGG(object): def __init__(self): print("In destructor...") def print(self): print('egg')
true
2e361eff38ca00b3a83e90243dbe0fc097584c12
Python
crjcrj/pythonaaa
/ๆ•ฐ็ป„/ๅˆๅนถๆœ‰ๅบๆ•ฐ็ป„.py
UTF-8
476
2.609375
3
[]
no_license
from typing import List def he(nums1:List[int],m:int,nums2:List[int],n:int): i=m-1 j=n-1 k=m+n-1 while i>=0 and j>=0: if nums1[i] >= nums2[j]: nums1[k]=nums1[i] i-=1 elif nums1[i] <= nums2[j]: nums1[k]=nums2[i] j-=1 k-=1 whi...
true
748ff193c810d06056eefeb2fe67d9aac16d7342
Python
fredmorcos/attic
/Patches/Dia/autolayoutforce.py
UTF-8
4,040
2.734375
3
[ "Unlicense" ]
permissive
# autolayoutforce.py - graph layout plug-in for Dia # # Copyright (C) 2008 Frederic-Gerald Morcos <fred.morcos@gmail.com> # Copyright (c) 2008 Hans Breuer <hans@breuer.org> # # Playground for the "force based autolayout" algorithm initially implemented # for Dia in C by Fred Morcos # This program is free softwa...
true
2a86e5744541e30dc93916ba97be2fe49978e495
Python
beAWARE-project/validator-service
/src/bus_communication/listener.py
UTF-8
2,573
2.96875
3
[]
no_license
""" OBSOLETE, see bus_consumer instead """ import time from shared import message_queue, logger from validator import message_handler import threading def consume(): # TODO: # read form bus # if messages to be read # for each message # put it to message queue # pro...
true
f6a82a6ec6d4abd9fab11c94f9b84022b13bbc0f
Python
jdavid54/linear_programation
/linear_prog_gekko.py
UTF-8
1,344
4
4
[]
no_license
# https://apmonitor.com/pdc/index.php/Main/LinearProgramming ''' A simple production planning problem is given by the use of two ingredients A and B that produce products 1 and 2. The available supply is A=30 units and B=44 units. For production it requires: - 3 units of A and 8 units of B to produce Product 1 ...
true
2c7672fb3c3039082a8b49a73890522dc5ac3a24
Python
dwolfhub/zxcvbn-python
/zxcvbn/scoring.py
UTF-8
14,202
2.984375
3
[ "MIT" ]
permissive
from math import log, factorial import re from .adjacency_graphs import ADJACENCY_GRAPHS from decimal import Decimal def calc_average_degree(graph): average = 0 for key, neighbors in graph.items(): average += len([n for n in neighbors if n]) average /= float(len(graph.items())) return ave...
true
01498f0d9289775dfc37a1bf2982439d9a7abdee
Python
MasMat2/Games
/colors/circle.py
UTF-8
5,752
3.125
3
[]
no_license
import pygame, sys, math, random class vortex: def __init__(self): self.angle = math.pi self.radius = 50 def draw(self, surface, color, pos): self.center = pos speed = 0.5 for i in range(100): if self.radius > 0.01: start = self.center[0]+se...
true
1e77f180819cd6657c0e33a6754310b8e238314c
Python
ctbeiser/Evolution_full
/4/remote/streaming_json_coder.py
UTF-8
2,373
3.5625
4
[]
no_license
""" Implements a StreamingJSONCoder that reads JSON messages from a concatenated JSON stream and writes """ import json import socket class StreamingJSONCoder: """ Handles parsing of JSON objects from a concatenated JSON stream and writing JSON objects to the stream. """ ENCODING = "utf-8" BYT...
true
7304e54cc32486623dac19c091aec35ba93612d7
Python
uuuouou/PythonBash
/head.py
UTF-8
3,344
2.703125
3
[]
no_license
#! python3 """ write by liucz 2015-10-6 imitate 'head' command in Linux Shell """ import sys import re import argparse from handle_stdin import echoLines, discardLines, echoChars, discardChars def buildParser(): parser = argparse.ArgumentParser() # add optional arguments parser.add_argument('-c', dest = 'c...
true
c2719e9c324874a4f10d00fbcc75816df7d2310a
Python
maeji9811/AtCoder
/Easy/replacing_integer.py
UTF-8
171
2.71875
3
[]
no_license
import numpy as np n, k = tuple(map(int, input().split(' '))) if (2 * n) < k: print(n) elif n < k: print(abs(n - k)) else: t = n % k print(min(t, k-t))
true
a3a94e2d22072d6b39f76b2cea271972d872b796
Python
diezep/insta-network
/utilities.py
UTF-8
558
3
3
[ "MIT" ]
permissive
from random import randint from time import sleep randFloat = lambda min, max: float(randint(min, max) + randint(1, min) / randint(min + 1, max)) def waitForClick(driver, element_xpath): element = driver.find_element_by_xpath(element_xpath) element.click() driver.implicitly_wait(randFloat(2, 4)) wh...
true
52ad91bf4741878fa303d67e6e2cdb50de256399
Python
qolizadeh/python-codes
/letter-game.py
UTF-8
2,489
3.5625
4
[]
no_license
# Developed by "Reza Heiadrgholizadeh" import random import os ############################################ def show_charaters(word ,i ,n ,m_list): os.system('cls' if (os.name == 'nt') else 'clear') #print("word------->{}".format(word)) #print("list------{}".format(m_list)) out_word = "" if (len(...
true
1f55f64f390a12a8d40480a48e7f9d89fb47d28a
Python
kobe6672823/pcap_analysis
/code/tcp.py
UTF-8
3,123
3.046875
3
[]
no_license
#! /usr/bin/python # -*- coding: utf-8 -*- from protocol import * class Tcp(Protocol): """a class for ip, derived from class Protocol(an empty class)""" def __init__(self, message_data): self.message = message_data #include the tcp header and the payload #look up the structure of the tcp pr...
true
7829c81a674cb69f1445d1eda840b130d9fab065
Python
sandeepkumar8713/pythonapps
/04_tree/32_print_kth_sum_path.py
UTF-8
2,673
4.03125
4
[]
no_license
# CTCI : Q4_12_Paths_with_Sum # https://www.geeksforgeeks.org/print-k-sum-paths-binary-tree/ # https://leetcode.com/problems/path-sum-iii/ # Question : A binary tree and a number k are given. Print every path in the tree with sum # of the nodes in the path as k. A path can start from any node and end at any node and mu...
true
c9e7c66edcb23c9168f391443674d4d05a4d7262
Python
Costello-13/IMS
/defscraper.py
UTF-8
2,708
2.65625
3
[]
no_license
import requests from bs4 import BeautifulSoup import pprint import sched import time s = sched.scheduler(time.time, time.sleep) connection = redis.Redis(host='redis', port=6379, db=0) def btcscraper(sc): request = requests.get("https://www.blockchain.com/btc/unconfirmed-transactions") soup = Beautif...
true
4cd293121fb24b611b6061e00c39fb58256dd74e
Python
EwanC/pyProc
/proc_scraper/proc_protocols.py
UTF-8
594
3.03125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 from .proc_base import ProcBase class ProcProtocols(ProcBase): '''Object represents the /proc/net/protocols file.''' def __init__(self): ''' Read file by calling base class constructor which populates self.content. Since this file is already printable n...
true
f4082d4cd3edfae0c928a65afcbe81faf517e7ce
Python
daveg999/automation_class
/class9/ex8/mytest/world.py
UTF-8
973
3.5
4
[ "Apache-2.0" ]
permissive
def func3(): print "you are calling func3 from world module" class MyClass(object): def __init__(self, who, what, when): self.who = who self.what = what self.when = when def hello(self): print "if you are good, {} will bring presents instead of {} for {}".format(self.who,...
true
ccdfce913bd52e5d5d96a64e898785931aa5969a
Python
zhouliuling/Leetcode_Task
/64.py
UTF-8
796
3
3
[]
no_license
## ๆœ€ๅฐ่ทฏๅพ„ๅ’Œ ## ๅŠจๆ€่ง„ๅˆ’ ## ๅˆ†ไธบ0่กŒ๏ผŒ0ๅˆ—๏ผŒ่กŒๅˆ—ไธไธบ0ไธ‰็งๆƒ…ๅ†ต class Solution(object): def minPathSum(self, grid): """ :type grid: List[List[int]] :rtype: int """ dp = [[0]*len(grid[0])]*len(grid) m = len(grid) n = len(grid[0]) i, j = 0, 0 for i in range(m): ...
true
d899635fe3a8999e79e8efc82b41a389f0066c10
Python
davis-mwangi/python-data-structures
/dynamic-programing/matrix_product.py
UTF-8
2,055
4.125
4
[]
no_license
""" Given a 2D matrix of size N*M. The task is to find the maximum product path from (0, 0) to (N-1, M-1). You can only move to right from (i, j) to (i, j+1) and down from (i, j) to (i+1, j). """ import sys def maxProduct(arr,M, N): # It will store the maximum # product till a given cell. maxPath =...
true
ecaa52b0020dba9081fd0db0cf4b0381b89fb7ad
Python
luciana-sarachu/holbertonschool-higher_level_programming
/0x0B-python-input_output/4-from_json_string.py
UTF-8
295
3.03125
3
[]
no_license
#!/usr/bin/python3 """ import module jason""" import json """function that returns an object represented by a JSON string""" def from_json_string(my_str): """You dont need to manage exceptions if the JSON string""" """doesnt represent an object.""" return (json.loads(my_str))
true
e9e27fefba296d7a3280b554e372c1c7f78ccfc6
Python
paulchenpmc/hadoop-examples
/A2/BFS-controller.py
UTF-8
1,855
2.53125
3
[]
no_license
import subprocess numloops = 0 DFS_FILEPATH = 'output2-{}' MAPPER = 'BFS-mapper.py' REDUCER = 'BFS-reducer.py' INPUT_FILE = 'user/a2ex2-input.txt' DFS_RM_CMD = 'hdfs dfs -rm -r hdfs://10.1.2.89:9000/{}/' DFS_VIEW_OUTPUT_CMD = 'hadoop fs -cat /{}/*' HADOOP_STREAM_CALL ...
true
1cfd167e9ed3dc62e0d1ecac356ecbb3a71b8ce6
Python
faithcomesbyhearing/dbp-etl
/obsolete/py_deprecated/VersesReader.py
UTF-8
1,970
2.578125
3
[ "MIT" ]
permissive
# VersesReader # # This table has various ways to read the bible_verses.text file import io import os import sys from Config import * class VersesReader: def __init__(self, config): self.config = config self.versesFilename = self.config.directory_bucket_list % ("bible_verses") # self.bibleIdList = None # sel...
true
6d9a541c3e70e19c8e7aba4de7360b383c2a2fcd
Python
taylorjacklespriggs/sigopt-dl
/dl/categorical.py
UTF-8
401
2.734375
3
[]
no_license
from dl.param import Param class CategoricalParam(Param): validation_type = str def __init__(self, default_value, choices): super().__init__(default_value) self.choices = [self.validate_type(choice) for choice in choices] assert self.default_value in self.choices def get_param_body(self): retur...
true
168996880696dde3f48aa5db540c9151eb6edac0
Python
annaduraiviki/python_api
/py/Test_files/testEmail.py
UTF-8
604
2.625
3
[]
no_license
'\n PEP-263 A company manages owns one of more stores.\xe2\x80\x8e\n ' import smtplib import getpass fromAddress = raw_input("Enter your gmail address: ") toAddress = raw_input("Enter the recipients email address: ") subject = raw_input('Enter the subject of email: ') bodyText = raw_input('Enter the body tex...
true
9e36880e017c7c42aa7fc8e4fda17b676bc4a535
Python
Era-Dorta/bath-cag2
/t3_learning/t3_3_blackjack/blackjack.py
UTF-8
11,114
3.640625
4
[]
no_license
#! /usr/bin/env python import random # This code is based on the Q-Learning implementation in # https://github.com/justinhj/astar-algorithm-cpp # A hand is represented as a pair (total, ace) where: # - total is the point total of cards in the hand (counting aces as 1) # - ace is true if the hand contains an ace gl...
true
0a0e13a3845539a35452f4bebdea745bb63a8796
Python
qiaowenchuan/rlpricing
/randommodel.py
UTF-8
516
2.671875
3
[]
no_license
class RandomModel(object): def __init__(self, _, env, *args, **kwargs): self.env = env def predict(self, *args, **kwargs): return [self.env.action_space.sample()], None def learn(self, total_timesteps, *args, **kwargs): self.env.reset() for i in range(0, total_timesteps): ...
true
a335ab79b343d7e66ea2f7b707b66125e8c44b68
Python
charlie83cl/zoo
/zoo/main.py
UTF-8
4,175
4.09375
4
[]
no_license
from animal import Animal from leon import Lion from oso import Bear from tigre import Tiger from zoo import Zoo import os def menu(): opcion = -1 while opcion < 0 or opcion > 6: os.system("cls") print("Menรบ: John's Zoo") print("[1] Agregar Animal") print("[2] Lib...
true
bfcfeaa02d7feb5d785e51c619467c8059ff3249
Python
christiancadieux/celery_redis
/test.py
UTF-8
423
2.53125
3
[]
no_license
from celery import Celery import celery_redis import time app = Celery('tasks', broker='redis://localhost:6379/0', backend="celery_redis.RedisBackend+redis://localhost:6379/0") @app.task(name='test.add') def add(x, y): time.sleep(1) return x + y if __name__ == "__main__": r = add.delay(5, 4...
true
4912267438e0e28d781d9cf49d16cdfae91ab91c
Python
geekguy-wy/Circuitpython_Goodies
/RFM69_Node_Test_103.py
UTF-8
6,407
2.6875
3
[ "MIT" ]
permissive
import board import busio from time import sleep, time from math import atan, atan2, cos, pi, sin from digitalio import DigitalInOut, Direction, Pull DEBUG = True PIN_ONBOARD_LED = board.D13 PIN_PACKET_RECEIVED_LED = board.D6 PIN_PACKET_SENT_LED = board.D9 SEND_PACKET_INTERVAL_MIN = 0.6 SPI_SCK = board.SCK SPI_MISO...
true
d20650e49405d03b4a8d5710c08f2a1d46877cb7
Python
kupc25648/100DaysAlgorithms
/D64_K_Clique.py
UTF-8
1,640
3.75
4
[]
no_license
''' Clique in an undirected graph is a subgraph that is complete. Particularly, if there is a subset of k vertices that are connected to each other, we say that graph contains a k-clique. complete graph We can find all the 2-cliques by simply enumerating all the edges. To find k+1-cliques, we can use the previous resu...
true
5c3126212696aa850873bbc47adc0ccafce74aeb
Python
Yuki-Kurita/NAO_Mirroring-Simulation_Webots
/convert_motionfile.py
UTF-8
11,565
2.640625
3
[]
no_license
# coding:utf-8 import sys import os import time import math import datetime class convertMotionFile(): def __init__(self): # input file self.directory = "./video_experiment/taiwasha2/" # output file self.motion_file_name = "./motions/sample.motion" self.file_no = 60 ...
true
39c7d938326a6932678b96edfeb15ce135457c4f
Python
DerevenetsArtyom/pure-python
/algorithms/Problem_Solving_Algorithms_Data Structures/binary_search/search_recursive.py
UTF-8
1,442
4.28125
4
[]
no_license
# Recursive solution # Function takes only four arguments that I don't really like def binary_search_recursive(arr, item, low=0, high=-1): if not arr: # handling empty list return -1 if high == -1: # handling first iteration high = len(arr) - 1 if low >= high: # handle where we've got ...
true
ad12ac26ce40dc2149d47f76cc0ca3aca7375784
Python
comex/somestuff
/r2/dol.py
UTF-8
2,958
2.609375
3
[]
no_license
import struct, sys class DOL(object): text = data = None ep = 0x80004000 bss_addr = 0x80001f00 bss_size = 0x10 def __init__(self, dol=None): self.text = [] self.data = [] if dol is not None: a = 0 offss = [] addrs = [] sizes = [...
true
f22aeb77df51a5b219385f02a2d13695b790091a
Python
BuseglY/Machine_Learning
/Machine Learning/polyRegression.py
UTF-8
1,606
3.703125
4
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures#polinom รถzelliklerini import eder data=pd.read_csv("positions.csv") print(data.columns) level=data.iloc[:,1].values.resh...
true
58e0acdc7c4965f20c017aa5481d7b430cc2bd01
Python
viliam-gago/engeto_python_course_projects
/homeworks/lesson_7/lesson/hangman.py
UTF-8
1,716
4.15625
4
[]
no_license
import random # asking user for a guess def get_choice(guesses): text = 'Guess a letter ({} guesses left):'.format(guesses) guess = input(text) return guess # checking if guessed letter in chosen word def check_choice(char, string): char_count = 0 if char in string: char_count = string.c...
true
d3c71994fb32acf4a271a07dd9b417858861f3a5
Python
Bishnukuet/NMFRecommendation
/GenerateRecommendation.py
UTF-8
8,578
2.75
3
[]
no_license
import pickle from recommendation import load_object import numpy as np ''' User Ui is interested in a item Vj and rated it with Rij stars therefore, items with rating >= (Rij-th) will be feltched as recommendation. THe questions that I am interested to answer are: 1. Give me top 10 similar items to item j 2...
true
f0e27a8002d11314b2cb8bfc9296be5660b5a721
Python
MrLawes/scikit-learn_demo
/01LinearRegression/linear_regression.py
UTF-8
966
3.59375
4
[]
no_license
import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression import numpy as np def runplt(): plt.figure() plt.title(u'Height-Weight') plt.xlabel(u'Height') plt.ylabel(u'Weight') plt.axis([150, 190, 40, 90]) plt.grid(True) return plt plt = runplt() x = [[155], [157],...
true
ec5ecd06938e92662aef7db643c2fe64b78314b4
Python
fabiomrjr/CSGOAnalysis
/util.py
UTF-8
827
3.1875
3
[]
no_license
from datetime import datetime as dt def get_month_by_abreviation(month): switcher = { "January": 1, "February": 2, "March": 3, "April": 4, "May": 5, "June": 6, "July": 7, "August": 8, "September": 9, "October": 10, "November"...
true
d0143c7cb7a95584aae694dfd2eb347e325ba35d
Python
geospatial-services-framework/gsfpy
/gsf/dict.py
UTF-8
496
3.484375
3
[ "MIT" ]
permissive
""" Defines a Dict class that subclasses from the builtin dict so it can print the contents of a dictionary in a human readable format. """ from pprint import PrettyPrinter class Dict(dict): """Inherits the built-in dict object so it can pretty print.""" pretty_print = PrettyPrinter(indent=2) def __str...
true
dd516d03f06ad53935ed3dc9996fcc591ef6a5a3
Python
DanPopa46/neo3-boa
/boa3/model/type/primitive/bytestype.py
UTF-8
1,604
2.71875
3
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
permissive
from typing import Any from boa3.model.type.collection.sequence.sequencetype import SequenceType from boa3.model.type.itype import IType from boa3.model.type.primitive.primitivetype import PrimitiveType from boa3.neo.vm.type.AbiType import AbiType from boa3.neo.vm.type.StackItem import StackItemType class BytesType(...
true
d50a498dbb1b117730a06ca56ff7c990098a7bf5
Python
brown-liu/Leetcode_Python
/1.two.sum.py
UTF-8
549
3.515625
4
[]
no_license
arraylist = [10, 30, 33, 66, 99] target = 99 expected = [2, 3] class Solution: def twoSum(self, nums, target): # using a dict here is much easier, no need to worry about index, only the key and value li = {} for index, num in enumerate(nums): n = target - num if n n...
true
3f92bc087d77c7e0fc25366f9e7e5885efde61a4
Python
martinmongi/project_euler
/93.py
UTF-8
868
2.796875
3
[]
no_license
#!/usr/bin/env python3 import itertools def targets(s): if len(s) <= 1: for i in s: return s ts = set([]) for i in s: ns = s - set([i]) subts = targets(ns) ts |= set([x + i for x in subts]) ts |= set([x - i for x in subts]) ts |= set([i - x for x in subts]) ts |= set([x * i for x in subts]) if...
true
025482574775b50f5c0e606b50be92261f39d1ce
Python
Rajesh3601/100-Days-Of-Coding
/Day 1 - 10/Day 3.py
UTF-8
2,481
4.25
4
[]
no_license
#7 # Write a program which takes 2 digits, X,Y as input and generates a 2-dimensional array. # The element value in the i-th row and j-th column of the array should be i*j. # Note: i=0,1.., X-1; j=0,1,ยกยญY-1. # Example # Suppose the following inputs are given to the program: # 3,5 # Then, the output of the program shoul...
true
5e0d5c7af662012f643a7113e4526f2d580cb7be
Python
skvrd/leetcode.py
/problems/213/solution.py
UTF-8
583
2.78125
3
[ "MIT" ]
permissive
from typing import List class Solution: def rob(self, nums: List[int]) -> int: if len(nums) == 0: return 0 if len(nums) == 1: return nums[0] def helper(nums): prev_max = 0 curr_max = 0 for i, v in enumerate(nums)...
true
a1b04d87dc524e8044ade5563b7ba3d9ab3412ab
Python
snchildress/web-traffic-etl
/tests/test_services.py
UTF-8
5,803
2.90625
3
[]
no_license
import csv import os from typing import Union import unittest from unittest.mock import patch from src.etl.exceptions import ( InvalidParams, InvalidFilename, BadRequest, BadResponse ) from src.etl.services import ExtractionService, LoadingService class TestExtractionService(unittest.TestCase): t...
true
81e8e28c5b382a354f31d640994f92c17610511e
Python
binchen15/leet-python
/dp/prob124.py
UTF-8
2,721
3.4375
3
[]
no_license
# 5% solution class Solution: def maxPathSum(self, root: Optional[TreeNode]) -> int: if not root: return 0 self.ans = -sys.maxsize def walk(node): if not node: return 0 self.ans = max(self.ans, self.helper(node)) ...
true
63008d39e3dd222c115d12addc60b25ca49e247e
Python
lidia01/chavez_cabrera_rojas_barturen
/rojas_baturen/EJERCICIO017.py
UTF-8
273
2.90625
3
[]
no_license
#ganadore #Declarar puntaje_danza1=0.0 total_danza2=0,0 #input total_danza1=int(input("ingrese el total danza1:")) total_danza2=int(input("ingrese el total danza2:")) #PROCESING total_puntaje=total_danza1+total_danza2 if (total_puntaje>40): print("ganadores") #fin_if
true
db126fa6dca8af406e3eb64cec30bb4e302f7ef4
Python
sashakrasnov/datacamp
/24-data-types-for-data-science/3-meet-the-collections-module/04-safely-appending-to-a-keys-value-list.py
UTF-8
1,648
4.78125
5
[]
no_license
''' Safely appending to a key's value list Often when working with dictionaries, you know the data type you want to have each key be; however, some data types such as lists have to be initialized on each key before you can append to that list. A defaultdict allows you to define what each uninitialized key will contai...
true
8c4d70c0a56924b4a47ce9a0207b7624013a7c70
Python
poorna20/SortNebula
/Poorna_Subramanian_GnomeSort.py
UTF-8
1,075
3.953125
4
[]
no_license
a=[[1,5],[2,4],[1,3],[9,0]] n=4 #Number of rows print ("Matrix before sorting: ") for i in range (0,n): for j in range (0,2): print (a[i][j],end=' ') print () def gnomesort(a,n): #n being number of rows ind=0 while ind<n: if ind==0: #Going to the right element in...
true
419f061415d23a311ac780cf40d06b3aa0d8121f
Python
Uttam1982/PythonTutorial
/08-Python-DataTypes/Lists/08-contcat-repeating-list.py
UTF-8
619
5.09375
5
[]
no_license
# Other Ways to Extend a List # 1. the + operator # We can also use + operator to combine two lists. This is also called concatenation. # The * operator repeats a list for the given number of times. # Concatenating two list my_list = [1,2,3,4] new_list = my_list + [5,6,7,8] # output : [1, 2, 3, 4, 5, 6, 7, 8] print(...
true
ab49c003ff00b780386bed46875b0e3175edcd23
Python
gusrud0423/pro-api-server-recipe22
/resources/recipe.py
UTF-8
8,694
3.0625
3
[]
no_license
from flask import request from flask_restful import Resource from http import HTTPStatus from db.db import get_mysql_connection # JWT ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ from flask_jwt_extended import jwt_required, get_jwt_identity # ์šฐ๋ฆฌ๊ฐ€ ์ด ํŒŒ์ผ์—์„œ ์ž‘์„ฑํ•˜๋Š” ํด๋ž˜์Šค๋Š”, # ํ”Œ๋ผ์Šคํฌ ํ”„๋ ˆ์ž„์›Œํฌ์—์„œ, ๊ฒฝ๋กœ๋ž‘ ์—ฐ๊ฒฐ์‹œํ‚ฌ ํด๋ž˜์Šค ์ž…๋‹ˆ๋‹ค. # ๋”ฐ๋ผ์„œ, ํด๋ž˜์Šค ๋ช… ๋’ค์—, Resource ํด๋ž˜์Šค๋ฅผ ์ƒ์†๋ฐ›์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค. # ํ”Œ๋ผ์Šคํฌ ํ”„๋ ˆ์ž„์›Œํฌ์˜ ...
true
bfff934d6906c628f556ff4c2ee2a58a3b94d639
Python
Y16v/intelect
/app/api/factories/entities/winner.py
UTF-8
449
2.765625
3
[]
no_license
from api.entities.winner import Winner class WinnerEntity: @staticmethod def create( id, student_id, points, date, *args, **kwargs ): return Winner( id=id, student_id=student_id, points=poin...
true
f4164e7d0f5db8daad2e2127758d14cd6b0f9b02
Python
NurzhanKushekbayev/Homeworks
/HW1/HW1.3.py
UTF-8
368
4.3125
4
[]
no_license
# ะ—ะฐะดะฐะฝะธะต 3 # ะฃะทะฝะฐะนั‚ะต ัƒ ะฟะพะปัŒะทะพะฒะฐั‚ะตะปั ั‡ะธัะปะพ n. # ะะฐะนะดะธั‚ะต ััƒะผะผัƒ ั‡ะธัะตะป n + nn + nnn. ะะฐะฟั€ะธะผะตั€, ะฟะพะปัŒะทะพะฒะฐั‚ะตะปัŒ ะฒะฒั‘ะป ั‡ะธัะปะพ 3. ะกั‡ะธั‚ะฐะตะผ 3 + 33 + 333 = 369. n = input('ะ’ะฒะตะดะธั‚ะต ั‡ะธัะปะพ: ') result = f"{n} + {n + n} + {n + n + n} = {int(n) + int(n +n) + int(n + n + n)}" print(result)
true
026207a751575dd2cca64ca25f2c8e439231b89c
Python
yangyuxiang1996/leetcode
/out/production/leetcode/503.ไธ‹ไธ€ไธชๆ›ดๅคงๅ…ƒ็ด -ii.py
UTF-8
927
3.1875
3
[]
no_license
#!/usr/bin/env python # coding=utf-8 ''' Description: Author: yangyuxiang Date: 2021-05-10 18:34:03 LastEditors: yangyuxiang LastEditTime: 2021-05-11 08:16:23 FilePath: /leetcode/503.ไธ‹ไธ€ไธชๆ›ดๅคงๅ…ƒ็ด -ii.py ''' # # @lc app=leetcode.cn id=503 lang=python # # [503] ไธ‹ไธ€ไธชๆ›ดๅคงๅ…ƒ็ด  II # # @lc code=start class Solution(object): def ne...
true
07f907f47d4b627837247234236319ce440fd7ca
Python
Joseph351/VGG19
/newVGG_19.py
UTF-8
10,926
2.515625
3
[]
no_license
import data_input as pipeline import data_prep as data import numpy as np import tensorflow as tf from tenosrflow.contrib.layers import xavier_initializer from tensorflow import keras class VGG19: def __init__(self, weights=None): self.decay = 0.0001 def fully_connected(self, input_tensor, name, n...
true
e97184d653b737e9fa84cce23fe5928042412e1f
Python
GittiMcHub/comp9321-dse
/assignment3/z5298989.py
UTF-8
15,337
2.65625
3
[]
no_license
import sys import pandas as pd import json import numpy as np from sqlalchemy import create_engine import matplotlib.pyplot as plt import statsmodels.api as sm from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression from numpy import corrcoef from sklearn.metrics import ex...
true
a5f646180be01173c25338d460d3a622288fe50d
Python
HaidiChen/Coding
/python/recursion/decompose.py
UTF-8
519
3.40625
3
[]
no_license
def decompose(string): def dp(offset, partial_partition): if offset == len(string): result.append(list(partial_partition)) return for i in range(offset + 1, len(string) + 1): prefix = string[offset:i] if prefix == prefix[::-1]: ...
true
10bbd7062c2b2116902e4625f78294c09dbfffd8
Python
sokoni/Sjc-app
/DBstudent.py
UTF-8
12,520
2.796875
3
[]
no_license
from tkinter import * from tkinter import ttk from PIL import ImageTk, Image import sqlite3 root=Tk() root.geometry('1024x768') root.configure(bg='#0623ab') root.iconbitmap('D:\docs\Sjcjcpic.ico') root.resizable(False,False) # Title of App root.title("SJC APP") # Header of the Application label=Label(root, text="AP...
true
ce9fbaa3658ae2d1867ec05109d0eaed5c7b69a5
Python
katossky/panorama-bigdata
/cours/code exemple/fibonacci.py
UTF-8
985
3.515625
4
[]
no_license
from threading import Thread import concurrent.futures import time import logging import Queue logging.basicConfig(level=logging.DEBUG) class ThreadFibonacci (Thread): def __init__(self, n, queue_current): logging.info( 'Crรฉation du thread pour le calcul de Fibonacci %s' % (n,)) Thread....
true
3b2fabc5374e34a3a48ef5c5bc63d36595005afc
Python
IgorRebeche/storm_challange
/src/repositories/registry_repository.py
UTF-8
1,442
2.859375
3
[]
no_license
from models.registry import Registry class RegistryRepo: def __init__(self, registries: list): self.__registries = registries @property def registries(self): return self.__registries @registries.setter def registries(self, registries): self.__registries = registries d...
true
8e012aeb45c1f3ca861930d49620d8d465821ab3
Python
DanilenkoEA/Courses-of-Python
/lect_8/Program1.py
UTF-8
136
3.0625
3
[]
no_license
# coding: utf-8 x = 0 while x < 10: x += 1 f = open("tutorial.txt", "a") f.write(str(x)) f.write("\r\n") f.close()
true
e3f45a41cb40dc936d0e009552e8dc93f4e58efb
Python
colour-science/colour-hdri
/colour_hdri/utilities/tests/test_image.py
UTF-8
6,450
2.515625
3
[ "BSD-3-Clause" ]
permissive
# !/usr/bin/env python """Define the unit tests for the :mod:`colour_hdri.utilities.image` module.""" from __future__ import annotations import numpy as np import os import unittest from colour_hdri import ROOT_RESOURCES_TESTS from colour_hdri.utilities import filter_files from colour_hdri.utilities import Image, Im...
true
18b9a5e47c79ad9299f215e6e0d4e488d1c7da02
Python
realprocrastinator/dimy-project
/src/test/test-msg.py
UTF-8
1,063
2.671875
3
[ "MIT" ]
permissive
import sys from pathlib import Path # if you haven't already done so # Add toor dir of the src tree to the syspath, so that we can use absolute import file = Path(__file__).resolve() parent, root = file.parent, file.parents[1] sys.path.append(str(root)) from commn.msg import Message if __name__ == "__main__": # ...
true
2c1ac68aa2085fb1f8db3e17ab411a8e38db37b2
Python
nitish96/Deadpool
/add_buddy.py
UTF-8
705
3.359375
3
[]
no_license
from spy_details import spy, buddy def add_buddy1(): new_buddy = { 'name': '', 'salutation': '', 'age': 0, 'rating': 0.0, 'chats': [] } new_buddy['name'] = raw_input('please add your friends name') new_buddy['salutation'] = raw_input('Choose Mr or Ms') new_...
true
94b8e40906e801f36fbdbae330beb3fb8a26f533
Python
Rajmeet/C.S.Practical
/Q16.py
UTF-8
1,512
3.625
4
[]
no_license
dict1 = {'A' : 1, 'B' : 2, 'C' : 3, 'D' : 4, 'E' : 5, 'F' : 6, 'G' : 7, 'H' : 8, 'I' : 9, 'J' : 10, 'K' : 11, 'L' : 12, 'M' : 13, 'N' : 14, 'O' : 15, 'P' : 16, 'Q' : 17, 'R' : 18, 'S' : 19, 'T' : 20, 'U' : 21, 'V' : 22, 'W' : 23, 'X' : 24, 'Y' : 25, 'Z' : 26} dict2 = {0 : 'Z'...
true
856ab37a89820a9fe78c2323357ee76d8b6e5c9a
Python
cpepablito/Estagio
/SiteSincrono/hello.py
UTF-8
849
2.796875
3
[]
no_license
from flask import Flask, render_template from flask_socketio import SocketIO, emit socketio = SocketIO(app) app.config['SECRET_KEY'] = 'secret!' thread = Thread() thread_stop_event = Event() class RandomThread(Thread): def __init__(self): self.delay = 1 super(RandomThread, self).__init__() def...
true
87efc3e2ca1786981cc4cb355b78eb0660518c12
Python
eraserpeel/Game-of-Life
/main.py
UTF-8
545
2.53125
3
[]
no_license
import pyglet #from pyglet.gl import * from game_of_life import GameOfLife class Window(pyglet.window.Window): def __init__(self): super(Window, self).__init__(600, 600) self.game_of_life = GameOfLife(600, 600, 10, 0.2) pyglet.clock.schedule_interval(self.update, 1.0 / 24.0) def o...
true
3917f4b3d2d0e011055256aec626201958a135f4
Python
shub91/Data-science-Masters-UB
/Spring 2019_Semester 2/CSE574_Introduction_to_Machine_Learning/Assignment_3_SVM_Logistic_Regression/script.py
UTF-8
17,460
2.890625
3
[]
no_license
import numpy as np from scipy.io import loadmat from scipy.optimize import minimize from sklearn import svm import matplotlib.pyplot as plt from sklearn.svm import SVC import time import pickle from sklearn.metrics import confusion_matrix from sklearn.metrics import classification_report import seaborn as sn import pan...
true
5d29d931742b08a9027c1dcba60bd46d34c5427c
Python
Gurvan/GoHighFox
/models.py
UTF-8
2,203
2.96875
3
[ "MIT" ]
permissive
import torch import torch.nn as nn class Actor(nn.Module): def __init__(self, obs_dim, action_dim, hidden_dim = 256): super(Actor, self).__init__() self.fc = nn.Linear(obs_dim, hidden_dim) self.value = ResNet(hidden_dim, 1, 2, output_dim=1) self.policy = nn.Linear(hidden_dim, actio...
true
893f0ecc9610814060a9666f19ca7a339324ef0b
Python
qchui/qchui
/ๅ‰‘ๆŒ‡offer/็ฟป่ฝฌๅ•่ฏ.py
UTF-8
680
3.84375
4
[]
no_license
""" ็‰›ๅฎขๆœ€่ฟ‘ๆฅไบ†ไธ€ไธชๆ–ฐๅ‘˜ๅทฅFish๏ผŒๆฏๅคฉๆ—ฉๆ™จๆ€ปๆ˜ฏไผšๆ‹ฟ็€ไธ€ๆœฌ่‹ฑๆ–‡ๆ‚ๅฟ—๏ผŒๅ†™ไบ›ๅฅๅญๅœจๆœฌๅญไธŠใ€‚ ๅŒไบ‹CatๅฏนFishๅ†™็š„ๅ†…ๅฎน้ข‡ๆ„Ÿๅ…ด่ถฃ๏ผŒๆœ‰ไธ€ๅคฉไป–ๅ‘Fishๅ€Ÿๆฅ็ฟป็œ‹๏ผŒไฝ†ๅด่ฏปไธๆ‡‚ๅฎƒ็š„ๆ„ๆ€ใ€‚ ไพ‹ๅฆ‚๏ผŒโ€œstudent. a am Iโ€ใ€‚ๅŽๆฅๆ‰ๆ„่ฏ†ๅˆฐ๏ผŒ่ฟ™ๅฎถไผ™ๅŽŸๆฅๆŠŠๅฅๅญๅ•่ฏ็š„้กบๅบ็ฟป่ฝฌไบ†๏ผŒๆญฃ็กฎ็š„ๅฅๅญๅบ”่ฏฅๆ˜ฏโ€œI am a student.โ€ใ€‚ Catๅฏนไธ€ไธ€็š„็ฟป่ฝฌ่ฟ™ไบ›ๅ•่ฏ้กบๅบๅฏไธๅœจ่กŒ๏ผŒไฝ ่ƒฝๅธฎๅŠฉไป–ไนˆ๏ผŸ """ # -*- coding:utf-8 -*- class Solution: def ReverseSentence(self, s): s_list=s.split(' ') s_list1=s_list[...
true
76b399511725a0c56415c62b6d6bc488964bc707
Python
52hwan/ML_Prac01
/ML_prac01_180131.py
UTF-8
4,572
3.390625
3
[]
no_license
# TensorFlow tutorials # # https://www.tensorflow.org/get_started/premade_estimators from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import pandas as pd import argparse CSV_COLUMN_NAMES = ['SepalLength', 'SepalWidth', 'P...
true
2f50dea7823ecf499ab1f9d7828d00dfc2f7b282
Python
josephkokchin/MY-Syok-Bot
/MY-Syok-Bot/bot/draw.py
UTF-8
9,324
2.75
3
[ "MIT" ]
permissive
## # @author Joseph Goh # @email [joseph.kokchin.goh@outlook.com] # @create date 2019-07-20 15:09:24 # @modify date 2019-07-20 15:09:24 # @desc [The following code will extract the 4D Results] #/ """ Lucky Draw Methods """ from requests import get from parsel import Selector as sel def Magnum4D(): """Magnum...
true
b6d61ba167736ed0a7f25954f05a23b7c00eb43e
Python
alvarovdt/100-Days-Of-Code-Udemy
/100 Days of Code/1. Beginner [01-14]/Day 04 Rock Paper Scissors/main.py
UTF-8
1,185
3.59375
4
[]
no_license
import random rock = ''' _______ ---' ____) (_____) (_____) (____) ---.__(___) ''' paper = ''' _______ ---' ____)____ ______) _______) _______) ---.__________) ''' scissors = ''' _______ ---' ____)____ ______) __________) (____) ...
true
3ad15c729d80b553700ec75304ff583fe402fe06
Python
rahma15/Diverse
/Sum_and_combinations/sum_comb.py
UTF-8
2,016
3.703125
4
[]
no_license
##### different combinations of a given number of integers within a sorted list ##### whose sums are equal to a certain output ##### Example : ##### ##### >>list=range(10) ##### >>search_equal_elements(list,10,4) ##### " list : [0,1,2,3,4,5,6,7,8,9] ##### " output demanded : 10 " ##### " number of elemenets to form a ...
true
f81a31a87a20fe1bed6b1b9e71a3611dc91179db
Python
DarioBernardo/hackerrank_exercises
/search/find_first_and_last_position_in_sorted_array.py
UTF-8
2,078
4.25
4
[]
no_license
""" https://www.programcreek.com/2014/04/leetcode-search-for-a-range-java/ Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in the array, return [-1, -1]. For example, given ...
true
18f68ce22abc717a20a6119496a75fc5c6d7031e
Python
jtchilders/pointnet_toy
/pointnet.py
UTF-8
4,362
2.671875
3
[]
no_license
import torch import logging import building_blocks as bb logger = logging.getLogger(__name__) class PointNet1d(torch.nn.Module): def __init__(self,config): super(PointNet1d,self).__init__() input_shape = config['data_handling']['image_shape'] assert(len(input_shape) == 2) nPoints = input...
true
84d1f644852a5f12d484694979ea87c7fbacf5f5
Python
Stephen2697/Image_Processing
/Image Test/Image_Processing_Test/Reference Files/Main/Assignment2.py
UTF-8
13,130
2.5625
3
[]
no_license
#!/usr/local/bin/python3 #Creator: Stephen Alger C16377163 #Version: 1.0 'Assignment to Remove The Ball!' #Document: Assignment2.py #Start-Date: 08-NOV-2019 #Consult the README.md File attached for Algorithm & Process Description as to conform to the Rubric. #------IMPORT MODULES import sys, os, cv2, numpy as np, mat...
true
ae2f2efd8f43dcfd5a3af541b559812cd6b8daae
Python
psamb75/Kenken
/heuristics.py
UTF-8
2,294
3.03125
3
[]
no_license
''' This file will contain different variable ordering heuristics to be used within bt_search. 1. ord_dh(csp) - Takes in a CSP object (csp). - Returns the next Variable to be assigned as per the DH heuristic. 2. ord_mrv(csp) - Takes in a CSP object (csp). - Returns the next Variable to be assigned as...
true
0cbea425d9cd1d9524bb249e4c5b122a1861c531
Python
LuckyRathod/DeepLearning
/Unsupervised Deep Learning/Boltzmann Machines (RBM)/rbmLucky.py
UTF-8
20,071
3.5
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Jul 20 19:15:22 2020 @author: Lucky_Rathod """ #### BOLTZMANN MACHINES #### ''' We will create a Recommendation system which will predict whether the user will like a movie or not Movie Lens Dataset is used for building Recommendation system https://grouplens.org/datasets/...
true
b2a6a5c00c93741c63b2db7c57b7d4e445f365b5
Python
zhuoliu0920/python-projects
/7_Classes/Elevator/elevator.py
UTF-8
4,406
3.390625
3
[]
no_license
#!/usr/bin/env python3 import random class Building(object): """ A Building class has variables: num_of_floors, customer_list, elevator(Elevator class) methods: run() and output(). """ def __init__(self, nfloor, cus, elev): self.num_of_floors = nfloor self.customer_list = cus ...
true
3a500583930c4051c23a385667f16d478b38c741
Python
69codes/Solo-Learner
/ProthPrimeSolution.py
UTF-8
1,155
4.34375
4
[]
no_license
#Taiwo Olatunji Yusuf #Python solution #Comuter Science #GitHub - @69codes #Question: #Write a function that takes in a Proth Number and uses Proth's #theorem to determine if said number is prime? #Break down of the question: The function takes in a "PROTH NUMBER", and determines if the number is...
true
42805afb455d288785a1cb0970883dc47190b073
Python
FedeMatt/Algorithms-for-bioinformatics
/problems_week5/Problem_27.py
UTF-8
874
3.09375
3
[]
no_license
import re def generate_list(input_): input_ = input_[1:-1] input_ = [word.replace(" ", ",") for word in list(input_)] print("["+"".join(input_)+"]") # this is an example to figure out how the code works... input_ = "(-3 +4 +1 +5 -2)" obj = generate_list(input_) sp = [-3,+4,+1,+5,-2] def GreedySorting(sp,i...
true
e45a30eef4e970d73f7652a18f2eef166877b1aa
Python
turrence/spotify-music-distributor
/backend/sklearn_api.py
UTF-8
3,094
2.984375
3
[]
no_license
import sys from sklearn.neighbors import KNeighborsClassifier from spotipy_api import Spotipy_API def make_model(sp: Spotipy_API, playlists: list): model_audio_features = [] classification_for_features = [] for playlist in playlists: print("gathering song audio features for playlist: ", playlist)...
true
b1f35a6b66648bc18b4efe8fde68451eeea752e7
Python
mantis522/Daily_python
/fundamental_python/old/bisection.py
UTF-8
970
3.84375
4
[]
no_license
# def f(x): # return x * x - 2 # a = 0 # b = 3 # def bisection(a, b): # epsilon = 0.000001 # while True: # c = (a + b) / 2 # fc = f(c) # if -epsilon <= fc and fc <= epsilon: # return c # elif f(a) * f(c) < 0: # (a, b) = (a, c) # else: # ...
true
7ed120f13135aa6536142e2a801eaff2843dcdb3
Python
pdrsa/PSE
/code/Maquina_de_Busca.py
UTF-8
2,708
3.328125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: try: import re import argparse import os import glob from pathlib import Path import time from Indice_Invertido import Indice_Invertido from Consulta import Consulta import numpy as np except ImportError: print("""Vocรช nรฃo possui o...
true
f77e95b0adefbe79c66ee04b0483208a78992eab
Python
hemalalitha925/Product-Recommendation-for-Online-Grocery-WebAPP
/src/market_basket_analysis_db.py
UTF-8
1,039
2.90625
3
[]
no_license
import logging.config import os import sqlalchemy import pandas as pd import config.config as config logger = logging.getLogger(__name__) def add_rec(args): """Add new records into table. Args: args: argparse args - should include arg.method, args.file, arg.table args.method: (String) How to...
true
dc69ee1d74cf6ebe803d7a1d4e698d012ca97db2
Python
gashokbabu/sureinitiative
/users/models.py
UTF-8
1,492
2.59375
3
[]
no_license
from django.db import models from django.contrib.auth.models import AbstractUser,BaseUserManager # Create your models here. class UserManager(BaseUserManager): def create_user(self, email, password=None): """ Creates and saves a User with the given email and password. """ if not emai...
true
f15f30cd31d24787cbd79ecb03777d3a0d8e50ad
Python
Zhijie-YU/myFirstTest
/msFEM2D.py
UTF-8
12,272
2.609375
3
[]
no_license
__author__="Ning Guo, ceguo@connect.ust.hk" """ 2D model for multiscale simulation which implements a Newton-Raphson scheme into FEM framework to solve the nonlinear problem where the tangent operator is obtained from DEM simulation by calling simDEM modules""" # import Escript modules import esys.escript as escrip...
true
9ce3b3dafc8d21f86203f04b8c39bd6a5c263cde
Python
HawkingLaugh/Data-Processing-Using-Python
/Week1/4. Condition Sample.py
UTF-8
415
3.640625
4
[ "MIT" ]
permissive
k = input('input the index of shape: ') if k == '1': print('circle') elif k == '2': print('oval') elif k == '3': sd1 = int(input('the first side: ')) sd2 = int(input('the second side: ')) if sd1 == sd2: print("the square's area is", sd1*sd2) else: print("the rectangle's area is"...
true
a80196825187c9d6866289d37994a7a6e477d237
Python
djsum99/Live-Tennis-Rankings
/functions/BracketElement.py
UTF-8
1,692
3.8125
4
[]
no_license
#translates a number (0-127) to an array of seven bits, and the last #bit is cut off so that BracketElements could be matched together based on #identical bitsArrs def position_to_six_bits(position): bitsArr = [] for i in range(7): bit = position%2 bitsArr = [bit]+bitsArr position = int(...
true
db8e957768c3e5e8cd4f499b6589ece0501242a6
Python
gengmufeng/MixtureOfDeepExperts
/utils/eval.py
UTF-8
8,885
2.765625
3
[]
no_license
import numpy as np from math import sqrt, isnan import math,operator SOFTMAX_THRESHOLD = 0.5 def read_gt(): return eval(open('docs/gt_dict.txt', 'r').read()) def intersection_dist(px, py, qx, qy, rx, ry, dx, dy): l = (dy * (rx - qx) + dx * (qy - ry)) / (dy * (px - qx) + dx * (qy - py)) m = (py * (rx - qx) ...
true
c271fe0168647aba5fa0a50ec7d4415f23d5f2a5
Python
poebus0102/JINWOO
/9.์„ธํŠธ์ง‘ํ•ฉ.py
UTF-8
683
4.09375
4
[]
no_license
# ์ง‘ํ•ฉ (set) # ์ค‘๋ณต ์•ˆ๋จ , ์ˆœ์„œ์—†์Œ my_set = {1,2,3,3,3,3,3} print(my_set) java = {'์œ ์žฌ์„','๊น€ํƒœํ˜ธ','์–‘์„ธํ˜•'} python = set(["์œ ์žฌ์„","๋ฐ•๋ช…์ˆ˜"]) #๊ต์ง‘ํ•ฉ (java ์™€ python ๋ชจ๋‘ ์ถœ๋ ฅ) print(java & python) print(java.intersection(python)) #ํ•ฉ์ง‘ํ•ฉ (java ํ•  ์ˆ˜ ์žˆ๊ฑฐ๋‚˜ python ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐœ๋ฐœ์ž) print(java|python) print(java.union(python)) #์ฐจ์ง‘ํ•ฉ (java ํ•  ...
true
26f614b70beeed50cbe3c3ad2ee6cbe30a96d3a3
Python
sjleee05/cv-module
/util/crop_image.py
UTF-8
2,478
2.953125
3
[]
no_license
import cv2 import numpy as np import time def find_top_bottom_line(input_img): top_list = [] bottom_list = [] print(input_img.shape) for col in range(input_img.shape[1]): if input_img[0][col] == 255: top_list.append(0) if input_img[input_img.shape[0]-1][col] == 255: ...
true
6a42ab6d6e7178564758ba55fafd5ddca4c7f061
Python
here0009/LeetCode
/Python/BulbSwitcherIII.py
UTF-8
2,066
3.875
4
[]
no_license
""" There is a room with n bulbs, numbered from 1 to n, arranged in a row from left to right. Initially, all the bulbs are turned off. At moment k (for k from 0 to n - 1), we turn on the light[k] bulb. A bulb change color to blue only if it is on and all the previous bulbs (to the left) are turned on too. Return the ...
true
ed3bd6d08f9a6413e3930a95e0938c4c0ebcee4f
Python
PlutusApp/templates
/python-scripts/scilearn.py
UTF-8
715
3.109375
3
[ "MIT" ]
permissive
from sklearn import tree import json data = 0 with open('./training_data/data.txt') as json_data: data = json.load(json_data) targets = 0 with open('./training_data/targets.txt') as json_data: targets = json.load(json_data) print(data) clf = tree.DecisionTreeClassifier() clf = clf.fit(data,targets) print('...
true
4c6cd3b5ca1f7cfd798752d3e6172d4b4e3d77c0
Python
jaklys/Netsuite
/cdaq3706.py
UTF-8
15,387
2.875
3
[]
no_license
""" Class for Keithley 3706 controled by Visa, Keithley 3706A Six-Slot System Switch Mainframe with High Performance Digital Multimeter cdaq3706.py (C) J.M.,rev.22-Jan-16 """ copyr = 'cdaq3706.py (C) J.M.,rev.22-Jan-16' import sys, visa, time class Daq3706: """ Class supporting creation of any number of inde...
true