blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
9a2af7086ef9c34db1d7adc56ddba93bfa90aba9
LeighGriffith/python-projects
/once_upon_a_time.py
UTF-8
547
4.15625
4
[]
no_license
print('Once upon a time, their was a ____ ') print('Write something thats a living thing') guy = input('< ') print('Once upon a time, their was a ' + guy + ' who lived in a ____') print('Write something that you can live in') house = input('< ') print('Once upon a time, their was a ' + guy + ' who lived in a ' +...
true
4e2722fcc3f3e69f48d4ae52daeaf7394b44133c
ljb6685/evolveu
/python/hello.py
UTF-8
303
2.546875
3
[]
no_license
from flask import Flask app = Flask(__name__) def readjson(filename): with open('dfjson.json', "w") as file: data = flask.json.load(file) return data @app.route('/api/') def data(name): return flask.jsonify(readjson('data/'+name+'.json')) if __name__ == '__main__': app.run()
true
bb3aaa340d088cc4c1638cb4729ad3a92686d146
ascaniopy/python
/exerciciosModuloIII/ex085-listasComParesImpares.py
UTF-8
382
4.125
4
[ "MIT" ]
permissive
num = [[], []] valor = 0 for c in range(1, 8): valor = int(input('Digite o {}º valor: '.format(c))) if valor % 2 == 0: num[0].append(valor) else: num[1].append(valor) print('=' * 50) num[0].sort() num[1].sort() print('Os valores pares digitados foram: {}'.format(num[0])) print('Os valores í...
true
778277f49600808d957908b372d48bfaa9902a2b
samhains/sprite_generator
/python/clean.py
UTF-8
526
2.65625
3
[]
no_license
from PIL import Image import os BASE_DIR = "./images/bg/" dir_fnames = [BASE_DIR+fname for fname in os.listdir("{}".format(BASE_DIR))] for fname in dir_fnames: try: im = Image.open(fname) im.verify() if not fname.endswith(".png"): im = Image.open(fname) ...
true
8cc0827a8523f11cec64b0d16cf5353dd9a1aeb9
mmkhaque/LeetCode_Practice
/157. Read N Characters Given Read4.py
UTF-8
2,344
4.125
4
[]
no_license
""" The read4 API is already defined for you. @param buf4, a list of characters @return an integer def read4(buf4): # Below is an example of how the read4 API can be called. file = File("abcdefghijk") # File is "abcdefghijk", initially file pointer (fp) points to 'a' buf4 = [' '] * 4 # Create buffer with ...
true
8be304f3d573faae07a9f76ba4f86ea2f14a7391
Parya1112009/mytest
/in1.py
UTF-8
233
2.8125
3
[]
no_license
def extendlist(value,list = []): list.append(value) return list list1 = extendlist(12,[]) list2 = extendlist(13) list3 = extendlist(14) print "list1 is %s" %list1 print "list2 is %s" %list2 print "list3 is %s" %list3
true
5027fdaa3a471f92618bd6d4303ef4c3ff5a586b
abhay97ps/ReversiBot
/Bot/Node.py
UTF-8
1,833
3.015625
3
[]
no_license
import numpy as np import random import copy from Model.ModelHelper import Next, Check class Node: turn = 0 N = 0 # number of simulations Q = 0 # number of wins C = 1 # weight given to exploration parent = None state = None Children = [] # list of node class UnexploredChildren = []...
true
c8d51d180a2fbbc3d18e43ee1f95be40dc20d4ab
vascofaraujo/UAV-ART
/simulation_py/dynamics/mav_dynamics.py
UTF-8
13,502
2.765625
3
[]
no_license
""" mavDynamics - this file implements the dynamic equations of motion for MAV - use unit quaternion for the attitude state part of mavPySim - Beard & McLain, PUP, 2012 - Update history: 12/20/2018 - RWB 2/24/2020 """ import sys sys.path.append('..') import numpy as np import math # lo...
true
a0b309a56c81beb91c35b563420e36515ca56540
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/abc013/B/4835322.py
UTF-8
99
3.453125
3
[]
no_license
a = int(input()) b = int(input()) c = abs(a-b) if c <= 4: print(c) else: print(9-c+1)
true
12cafefb819443a4a3a614d2aefb77496b7934a9
morgankb17/cis122
/Week 8/cis122-assign08-group-manager.py
UTF-8
774
3.453125
3
[]
no_license
''' CIS 122 Summer 2020 Assignment 8 Author: Morgan Bartlett Credit: Description: Group manager ''' d = {} def create_group(d): pass def list_groups(d): pass def add_group_data(d): pass def list_group_data(d): pass def cmd_help(): print("?: List commands") print("C: Create a new group") ...
true
24d316bafd7df2818d4191d7d144928d68a60307
mailtwogopal/python-references
/pythonProject/exercises/basicorbeginner's/list_frm_lists.py
UTF-8
336
3.640625
4
[]
no_license
def filterList(list1, list2): newList = [] for i in range(0, len(list1)): if list1[i] % 2 != 0: newList.append(list1[i]) for j in range(0, len(list2)): if list2[j] % 2 == 0: newList.append(list2[j]) return newList print(filterList([1, 2, 3, 4, 5, 6, 7, 9], [2, 3...
true
cc40ebc5957dae52546658a4524785697a049d0d
jonghwanhyeon/overwatch-stats
/overwatch/stats/parsers.py
UTF-8
1,318
3.265625
3
[ "MIT" ]
permissive
import datetime import re def parse_number(value): value = value.replace(',', '') if value[-1] == '%': return float(value[:-1]) / 100 try: return int(value) except ValueError: return float(value) def parse_time(value): if value == '--': return 0.0 if ':' in...
true
1569cfcf507bc1b0d1b9ebfe713c6d43b328e04a
tnaimisha/ClusteringImplementations
/linkage_algorithms_heap.py
UTF-8
8,605
3.59375
4
[]
no_license
# This file contains the functions developed for single linkage clustering algorithm import sys import math import random import time import numpy as np import heapq as hp def load_file(): #load_file function reads the input file to a list and determines the number of clusters(k) based on the number of classes in...
true
b46cfb280d00f8c58c80ff0c1d1dd9d823a9e283
nikolaslacerda/dijkstras-algorithm
/Graph.py
UTF-8
498
3.453125
3
[]
no_license
from collections import defaultdict class Graph(object): def __init__(self): self.nodes = set() self.edges = defaultdict(list) self.distances = {} def insertNode(self, value): self.nodes.add(value) def insertEdge(self, from_node, to_node, distance): self.edges[fro...
true
d69309bdce526803b18810210df8274ff2dc8f5c
neuml/txtai
/src/python/txtai/archive/compress.py
UTF-8
1,029
3.3125
3
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license" ]
permissive
""" Compress module """ import os class Compress: """ Base class for Compress instances. """ def pack(self, path, output): """ Compresses files in directory path to file output. Args: path: input directory path output: output file """ ...
true
a412529ee52d3938c4f71ac94cc0b53875e0e38b
tachyon777/PAST
/PAST_1/C.py
UTF-8
220
2.84375
3
[]
no_license
#第一回 アルゴリズム実技検定 #C import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n%2==0 else 0 lst1 = list(map(int,readline().split())) lst1.sort(reverse=True) print(lst1[2])
true
fd0c4083f68f951691a7abda62d2b383438b6836
hanhsienhuang/Gomoku
/websocket_client.py
UTF-8
792
3.40625
3
[]
no_license
#!/usr/bin/env python # WS client example import asyncio import websockets async def hello(): uri = "ws://localhost:8765/" async with websockets.connect(uri, ping_interval=None) as websocket: name = input("What's your name? ") await websocket.send(name) print(f"> {name}") gr...
true
578bac1da26083aa6d3de1ef0775add60df3cf20
suhyeonjin/CodePractice
/Baekjoon/15552.py
UTF-8
204
3.09375
3
[]
no_license
#Exercise 15552 import sys count = sys.stdin.readline().rstrip() for i in range(int(count)): strList = sys.stdin.readline().rstrip().split(' ') numList = map(int, strList) print sum(numList)
true
96ac7d4214138383898ca1af87ee1dae16a6fd9a
ericzundel/mvn2pants
/src/python/squarepants/file_utils.py
UTF-8
1,705
3.109375
3
[ "Apache-2.0" ]
permissive
import os import shutil from contextlib import contextmanager from tempfile import mkdtemp, mktemp @contextmanager def temporary_dir(): """Returns a temporary directory that gets cleaned up when the context manager exits.""" tempdir = mkdtemp() try: yield tempdir finally: shutil.rmtree(tempdir) @con...
true
5318c927c9c714266f7bbb413e2f17b530dd0644
Elsadwi07/Keamananpl-mahasiswa-balok
/# Luas dan Volume Balok.py
UTF-8
431
3.953125
4
[]
no_license
# Luas dan Volume Balok # Nama : Elsa Dwi Handayani # Nim : 19051397035 print ("Menghitung Luas dan Volume Balok") p = int(input("Masukkan Panjangnya = ")) l = int(input("Masukkan Lebarnya = ")) t = int(input("Masukkan Tingginya = ")) if p <0 or l <0 or t <0 or t <0 : raise ValueError luas = (2...
true
a81c21e1b3ca77a1e0787294577cec3a05125e92
BraeWebb/mit6.00.2
/quiz/p1.py
UTF-8
396
3.34375
3
[]
no_license
import random def A(): mylist = [] r = 1 if random.random() > 0.5: r = random.randint(1, 10) for i in range(r): random.seed(0) if random.randint(1, 10) > 3: number = random.randint(1, 10) mylist.append(number) return mylist number = [7] for i in ra...
true
6352161cdcdccc304665ca33c2196848fe3a008d
walshification/advent-of-code-2017
/solutions/stream_processing.py
UTF-8
1,957
3.4375
3
[]
no_license
import yaml def valuate(stream): cleaned_stream = clean(stream) pure_stream = remove_garbage(cleaned_stream) return assess(pure_stream) def count_garbage(stream): cleaned_stream = clean(stream) return garbage_count(cleaned_stream) def clean(stream): cleaned_stream = [] i = 0 while ...
true
80d77da8eaaaa46e5c795cbeebdf68efa3db4f99
rucsa/thesis_benchmark_advisor
/advisor3worker.py
UTF-8
1,845
2.609375
3
[]
no_license
from pyfancy import pyfancy import recommender as recom import time def getAllocations(client_portfolio, allSecurities, text = True): stocks_alloc, bonds_alloc = client_portfolio.current_allocation(allSecurities) if text: pyfancy.pyfancy().cyan("Current allocation: {} stocks and {} bonds \n".forma...
true
6cd0d62ce7148dd7ef5653129b291f260cf01a37
Aasthaengg/IBMdataset
/Python_codes/p03477/s582608599.py
UTF-8
152
3.3125
3
[]
no_license
n = list(map(int,input().split())) ans = n[0] + n[1] - n[2] - n[3] if ans > 0: print("Left") elif ans == 0: print("Balanced") else: print("Right")
true
5a3b93b6021477346a7050512e1f3c4963e744b8
robotsarecrazy64/Capstone-Project
/emelia/data_processing.py
UTF-8
9,164
2.71875
3
[]
no_license
import csv import numpy as np event_cause_vals = ['Random System Fault', 'Network Fault', 'Upgrade/Maintenance', 'Design Understanding', 'Design Problem', 'Environment or External', 'Induced', 'Informational', 'Documentation'] detection_method = ['Polling', '...
true
1f37426e1f06885f541be3f6fc714f4b93a797d8
NITIN-ME/Python-Algorithms
/doublylinkedlist.py
UTF-8
2,766
4.03125
4
[]
no_license
""" Node - element, prev, next _header, _trailse, _next __init__(self) __len__(self) is_empty(else) _insert_between(self, e, predecessor, successor) _delete_node(self, node) insert_front(self, e) insert_back(self, e) delete_front(self) delete_back(self) """ class Empty(Exception): def __init__(self, message): print...
true
73c2a2e057eb07fbab90cf631075140fac9f6d1f
balrog-nona/learning_python
/uceni_soubory/last_page_extractor_V2.py
UTF-8
861
2.65625
3
[]
no_license
#!/bin/python3 import PyPDF2 import sys import os import glob # tato verze prejmenuje vsechny soubory ve slozce, vytvori nove a puvodni zachova # pro verzi, co puvodni maze, je bash script linux_page_extractor files = glob.glob("{}*.pdf".format(sys.argv[1])) # absolutni cesta k souborum for file in files: inpu...
true
53dabe0719f45bc4db6e1a5b128acb166a4e90c4
xzcxzcxzc/dataProcessNew
/main.py
UTF-8
2,622
3.453125
3
[]
no_license
import xlrd import numpy as np #读取一行数据 def readDataRow(tableName,rowNumber): #读取数据 # data = xlrd.open_workbook('33_3m.xlsx') #读取数据 data = xlrd.open_workbook(tableName) #读取数据 table = data.sheets()[0] #打开第一张表 # print("rowvslue") # print(table.row_values(rowNumber)) ...
true
298ef1dbc4acdda24952c32cf457d1a9fca29344
devaljain1998/Amazon-comment-system
/comment_analyser/algo.py
UTF-8
4,989
3
3
[]
no_license
import nltk import statistics import pandas as pd from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer, TfidfTransformer from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes import MultinomialNB from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import ...
true
22b8738e9927254973eff0d1a302b35de9b40715
jonntd/dsPlayblast
/dsPlayblast/ffmpegFn.py
UTF-8
693
3
3
[ "MIT" ]
permissive
import os import time import logging LOGGER = logging.getLogger() class Converter(object): def __init__(self, ffmpeg_path: str, input_path: str, output_path: str = ""): self.ffmpeg_path = ffmpeg_path self.input_path = input_path self.output_path = output_path def convert_avi_to_mp4(s...
true
9b4443ba0cc91117101aadd8d82545f8fb5d6100
rakeshprasadyaday/basic
/wilsonprime.py
UTF-8
77
3.328125
3
[]
no_license
import math p=int(input("Enter value of p")) n=math.factorial(p-1) print(n)
true
a1cc1b8cb08aa1c8aa356576968bd634a0b59308
Pashibo/course_Python
/HW_Python_002_sc_9.py
UTF-8
1,001
3.46875
3
[]
no_license
import random c = int(input()) d = random.randint(1, 100) e = random.randrange(1, 101, 1) if c < d and c < e: print('Вы ввели число =', c, 'которое <', d, 'и <', e) elif c < d and c > e: print('Вы ввели число =', c, 'которое <', d, 'и >', e) elif c < d and c == e: print('Вы ввели число =', c, 'которое <', ...
true
af8f497cca542bc903567a048d389d5b32b5b1d0
matech96/ADA
/kisházik/03.py
UTF-8
2,810
2.890625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import numpy as np import matplotlib.pyplot as plt # In[4]: def get_typespeiffic_price(df, property_subtype): df_panel = df[df['property_subtype'] == property_subtype] return df_panel[['city', 'unit_property_price']].groupby(by=['city'])[...
true
e93af28b781c83c917480cf3fc7da795673ec7f2
rickygalliani/Hanna
/src/portfolio.py
UTF-8
20,286
2.65625
3
[]
no_license
# Ricky Galliani # Hanna # src/portfolio.py from src.asset_class import AssetClass from src.deposit import Deposit from src.holding import Holding from src.api import ( AccountProfile, DividendInfo, HoldingInfo, SecurityInfo, load_account_profile, load_dividends, load_holdings, load_sec...
true
e94229e7ce0bbf6418b6d092428fcb1846d958bb
gitprouser/LeetCode-3
/regular-expression-matching3.py
UTF-8
879
3.46875
3
[]
no_license
class Solution: """ @param s: A string @param p: A string includes "." and "*" @return: A boolean """ def isMatch(self, s, p): # write your code here def is_match(i_s, i_p): if i_p == len(p): return i_s == len(s) elif i_p + 1 < len(p) and ...
true
1ea95b73054da0ecf3c52b23cc97951064711bf8
kevin-funderburg/virtual-memory-page-replacement-algorithms
/main.py
UTF-8
7,704
3.203125
3
[ "MIT" ]
permissive
## # @authors Kevin Funderburg # # Created on 11/19/19 # from collections import deque import queue #import logging import random import argparse REF_STRING = None def FIFO(num_frames: int): """ First In First Out page replacement """ print("First in first out") memory = [] fifo_q = queue.Q...
true
a9b05b0898d6e8ac84ae423151c0944891216d20
ShihabAhmed09/HackerRank-Solutions-Python
/Regex/Grouping and Capturing/MatchingWordBoundaries.py
UTF-8
158
2.875
3
[]
no_license
import re Regex_Pattern = r'\b[aeiouAEIOU][a-zA-Z]*\b' print(str(bool(re.search(Regex_Pattern, input()))).lower()) # \b assert position at a word boundary.
true
6595983afe59059b939b62ed834765392444a0cc
felipe-fp/corcovado
/M2_savings_inflation_analysis.py
UTF-8
598
2.984375
3
[ "MIT" ]
permissive
import pandas as pd import matplotlib.pyplot as plt inflation = pd.read_csv('Price_index.csv',index_col = 0) inflation.columns = ['price'] inflation['delta'] = ((inflation['price'] - inflation['price'].shift(12))/inflation['price']) * 100 #plt.figure(1) #inflation['delta'].plot() #plt.show() m2 = pd.read_csv('M2_US...
true
83978339f228fa6cf4bd47689eaad3a0e78c950c
gpk1995/Digital-Alpha
/test1/prob3.py
UTF-8
562
3.6875
4
[]
no_license
# problem 3 import numpy as np lis = [12,6,48,37,88,31,54,11,60,122,105,88,122,155,105] lis.sort() key = int(input("Enter the value to be searched")) for i in range(len(lis)): if lis[i] == key: print("The %s is in index %s" %(key, i)) break # list of numbers from keybord def func...
true
210d0e04b9f3771ee568bf758e44be7e533aae41
kgodfrey24/advent-of-code-2017
/day2/day2b.py
UTF-8
2,122
2.703125
3
[]
no_license
def splitAndConvertToFloat(stringInput): splitStrings = stringInput.split() return map(convertToFloat, splitStrings) def convertToFloat(stringInput): return float(stringInput) input = """1208 412 743 57 1097 53 71 1029 719 133 258 69 1104 373 367 365 4011 4316 1755 4992 228 240 3333 208 247 3319 4555 71...
true
b534bdb15a40020223475e83b78799d2a17df79d
Pohfy123/PhoneResolver
/TF-IDF/textCrawling.py
UTF-8
1,554
2.859375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import urllib from HTMLParser import HTMLParser from bs4 import BeautifulSoup import sys import re def CssJsStrip(html): pureHtmlCss = re.subn(r'<(script).*?</\1>(?s)', '', html)[0] pureHTML = re.subn(r'<(style).*?</\1>(?s)', '', pureHtmlCss)[0] return pureHTML...
true
3330ebc55a4e696d02f5bcf2aa102c911e0da164
AmberHsia94/ml-basics
/knn.py
UTF-8
2,862
3.59375
4
[]
no_license
# coding=utf-8 ''' The implementation of KNN algorithm. (1)收集数据:确定训练样本集合测试数据; (2)计算测试数据和训练样本集中每个样本数据的距离; (3)按照距离递增的顺序排序; (4)选取距离最近的k个点; (5)确定这k个点中分类信息的频率; (6)返回前k个点中出现频率最高的分类,作为当前测试数据的分类。 @Author: AmberHsia @Date: 18.11.2018 ''' import time import pandas as pd import numpy as np import operator from sklearn.metric...
true
a6e80b68ebcf8c8e813616a0b46ef84c863f3a3c
debrine/ChallengeSet-W2020
/week-04/lilmert/bus.py
UTF-8
262
3.515625
4
[]
no_license
import sys def passengers(num_stops): if num_stops == 1: return 1 else: return passengers(num_stops-1) + 2**(num_stops-1) cases = sys.stdin.readline() for line in sys.stdin.readlines(): print(passengers(int(line)), end=" ") print()
true
e4465bbc528e4ead1a8d9bf62eb41f0c0b975247
sakshid22/HealingManagementSystem
/Other Codes/chatclient.py
UTF-8
1,596
2.734375
3
[]
no_license
from socket import * import time, random, thread Port, Port2, HostIP, myname, mypw, newdata = 50005, 50003, "localhost", "", "", "" gamemode = "lobby" Clientsonline = [] def recvloop(soc): global newdata while 1: newdata = soc.recv(1024) newlist = newdata.split() newjob = ne...
true
d9894867f3aa62c7ddb1e39d9b2f9163b87cc4f9
TheusZer0/ctf-archives
/SHELL/2021/crypto/Subsi/script.py
UTF-8
268
2.640625
3
[ "MIT" ]
permissive
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ{}_1234567890' key = 'QWERTPOIUYASDFGLKJHZXCVMNB{}_1234567890' text = <flag> def encrypter(text,key): encrypted_msg = '' for i in text: index = alpha.index(i) encrypted_msg += key[index] # print(encrypted_msg) return encrypted_msg
true
cb5088bb8d51944a6e715d0d3044a7be00811556
Lodour/SHU-Library-Helper
/shulib_logger.py
UTF-8
923
2.921875
3
[]
no_license
# coding=utf-8 """ A logger model for SHU Library Helper. Set up a logger model with filename of logfile. Default log filename is `./shulib.log`. [+] info(msg) logging.info(msg) [+] warn(msg) logging.warning(msg) [TODO] Add level-info to logging.basicConfig() """ import logging class shulib_logger(object): ...
true
41733a3721a7f76206c3aec0544650c7692cd0cf
allen-zqh/plotly
/Chapter03/subplot_multi.py
UTF-8
1,071
2.53125
3
[ "MIT" ]
permissive
from plotly import tools import plotly as py import plotly.graph_objs as go pyplt = py.offline.plot trace1 = go.Scatter(x=[1, 2, 3], y=[4, 5, 6], mode='markers+text+lines', text=['A', 'B', 'C'], textposition='bottom' )...
true
b908421c02d57e7ae2ec49972c34cf2f047dce20
tusharsadhwani/leetcode
/jump_game.py
UTF-8
819
3.375
3
[ "MIT" ]
permissive
class Solution: def canJump(self, nums: list[int]) -> bool: # As we just need to reach last index, the number at last position doesn't matter nums.pop() # Represents the number of elements ahead we can jump from current index max_reach = 0 for jump in nums: # Si...
true
f90be5cc988d735add19d7a9bb3b6de8d0cfea87
WARbotics/WAR-Trainig
/Python/numbers.py
UTF-8
320
4.125
4
[]
no_license
# lets start with creating a int varible number = 4 # if I wanted to change it to a float it would just floatOfNumber = float(number) # This would turn into 4.0 # if I made float number a different a different number floatOfNumber = 4.5 # and change it back int(floatOfNumber) # This now becomes 4 and drops the .5
true
6ac99bea5d62e5450da4e42334be02ba6bcc3574
divergen371/WirelessSignalProcessing
/FresnelZone.py
UTF-8
839
3.296875
3
[]
no_license
import math SPEED_OF_LIGHT = 299792458.0 print("周波数=") s = input() freq = float(s) _lambda = SPEED_OF_LIGHT / freq print("d1=") s = input() d1 = float(s) print("d2=") s = input() d2 = float(s) print("n(フレネルゾーンの次数)=") s = input() n = int(s) print("障害物の高さ(m)=") s = input() H2 = int(s) dh = (d1 + d2) / 2.0 Rn1 = math.sq...
true
1e7890aa7ca416ef53bf70182b19765475e7e5d8
purescript-python/purescript-show-python
/python-ffi/Python/IO/Unsafe.py
UTF-8
317
2.859375
3
[ "MIT" ]
permissive
def printLn(s): return lambda: print(s) def show(s): return lambda: str(s) def repr(s, *, r=repr): return lambda: r(s) def assertMsg(cond, msg): def ap(): assert cond, msg return () return ap def assert_(cond): def ap(): assert cond return () return ap
true
1ba32ad53defb8f76c3fd0a66611f7c95e5b6b51
Hwnag702/idiotquant
/idiotquant/stock.py
UTF-8
3,835
2.75
3
[]
no_license
# -*- coding: utf-8 -*- ''' Stock class 주식 종목을 나타내는 객체입니다. ''' class Stock: INVALID_VALUE = 0xFFFFFFFFFFFFFFFF # code # name # isETF # market # manage # bestPrice # capLevel # sector # json def __init__(self, json): self.json = json # TODO 종목 코드가 필요함 ...
true
5bde784881c30ca3a4fefe38c78c19c82947c130
briannoogin/ANRL-UCI-Test-Networks
/KerasSingleLaneExperiment/cnn_deepFogGuard.py
UTF-8
12,101
2.515625
3
[]
no_license
from __future__ import print_function from __future__ import absolute_import from __future__ import division import os import warnings import keras.backend as K import keras.layers as layers from keras.backend import zeros from keras_applications.imagenet_utils import _obtain_input_shape, get_submodules_from_kwargs f...
true
a9958cdf319601a673d5c755842103340de96f15
ArturAvelino/bank-concept
/utils/helper.py
UTF-8
56
2.609375
3
[]
no_license
def formata_valor(valor): return f"R$ {valor:,.2f}"
true
af76e640624ab68be0e5c6244cbedb6a1d620565
zhihanyang2022/pytorch-ddpg
/params_pool.py
UTF-8
7,046
2.703125
3
[ "MIT" ]
permissive
import numpy as np import torch import torch.nn as nn from torch import optim from replay_buffer import Batch def get_net( num_in:int, num_out:int, final_activation, # e.g. nn.Tanh num_hidden_layers:int=6, num_neurons_per_hidden_layer:int=64 ) -> nn.Sequential: layers ...
true
f774756d09d09670cf6e20c1028614fd6d8c963d
TimothySjiang/leetcodepy
/Solution_394.py
UTF-8
461
3.15625
3
[]
no_license
class Solution: def decodeString(self, s: str) -> str: stack = [["", 1]] num = 0 for c in s: if c.isdigit(): num = num * 10 + int(c) elif c == '[': stack.append(["", num]) num = 0 elif c == ']': ...
true
24b3bb9e49284428f7c5238e4a800d1e9862a477
mezl/leetCodePython
/levelOrder.py
UTF-8
769
3.453125
3
[]
no_license
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def levelOrder(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ arry = [] ...
true
4492d5da0e63a73cad99ffe59841a4f5269acf76
jokyjoe-joy/search-py
/search.py
UTF-8
8,634
2.71875
3
[ "MIT" ]
permissive
import sys import random import time import datetime # Versioning settings ENVIRONMENT = "github" VERSION = '0.0.1-%s' % ENVIRONMENT # Global init, default settings below. FAST_MODE = False NUMBER_OF_PROGRESS_INDIC_UPDATES = 500 # Colors for print(). class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' ...
true
aab8e8e9bbd72fb9e0c7c72d9a1b127f72b985e6
LimeOrangeTree/PYTHON
/excel1.py
UTF-8
3,110
3.15625
3
[]
no_license
# import openpyxl # wb=openpyxl.load_workbook('data\\address.xlsx') # # print(type(wb)) # # print(wb.get_sheet_names()) #시트명 # # print(wb.sheetnames) # # 시트에 접근 # # sheet=wb.get_sheet_by_name('friend') # sheet=wb['friend'] # # print(type(sheet)) # # 현재 열린시트 확인 # sheet=wb.active # # print(type(sheet)) # # ...
true
2cd7528b56d1fbd3ce7d21894e7f17ce19caec71
AIGW/1807
/02.10day/05-property.py
UTF-8
304
3.9375
4
[]
no_license
class Dog(): def __init__(self): self.__age = 100 def getAge(self): return self.__age def setAge(self,age): self.__age = age age = property(getAge,setAge) dog = Dog() #dog.setAge(150) #print(dog.getAge()) dog.age = 900 #相当于写14行 print(dog.age)#相当于写15行 print(dog.getAge())
true
805b171ca8c8e41b7e7da8d9ef679f951a6986dd
fernandomarins/pygame
/pygame.py
UTF-8
4,741
3.375
3
[]
no_license
# coding: utf-8 # In[ ]: import pygame pygame.init() screen = pygame.display.set_mode((900, 700)) def checkCollision(x, y, treasureX, treasureY): global textWin, screen collisionState = False if y >= treasureY and y <= treasureY + 40: if x >= treasureX and x <= treasureX + 35: y = 6...
true
c3ebed8a88df08655d7fa6a2dd3517e85b53c53c
Timbwa/AgePredictor
/acquisition.py
UTF-8
2,879
2.65625
3
[]
no_license
import numpy as np import os def data_acquisition(folder_path='\Dataset'): geoFeatTrainX = [] geoFeatTrainY = [] geoFeatTestX = [] geoFeatTestY = [] textFeatTrainX = [] textFeatTrainY = [] textFeatTestX = [] textFeatTestY = [] full_set_path = os.getcwd() + folder_path ...
true
a3c0fa4716aa47b772f34a67bd54e8abe535398f
mymhzm/se_senticlass_api
/emotion_model/model.py
UTF-8
4,746
2.75
3
[]
no_license
# emotion_model.py ## 定义模型 # 這個 block 是要拿來訓練的模型 import torch from torch import nn from torch.autograd import Variable import torch.nn.functional as F import numpy as np # emotion_model = LSTM_Net(embedding, embedding_dim=250, hidden_dim=150, num_layers=1, dropout=0.5, fix_embedding=fix_embedding) class LSTM_Net(nn.Mod...
true
11b939de70cf2c7fb0e4264716fbc903d332ff71
LeonardoSaes/Exercicios-python-basico
/python básico/desafio67.py
UTF-8
840
3.71875
4
[ "MIT" ]
permissive
# cadastro de pessoas resposta = "".upper() contidade = 0 conthomem = 0 contmulher = 0 while True: print('-' * 30) print('{:^30}'.format('CADASTRO DE PESSOAS')) print('-' * 30) idade = int(input('Idade: ')) sexo = ' ' while sexo not in 'MF': sexo = str(input('Sexo [M/F]: ')).upper().stri...
true
701459a4e2efc41a8cf6554c83bd64f911c14c39
eckp/TAS
/regression.py
UTF-8
8,800
3.375
3
[]
no_license
'''Provide functions that fit exponential curves to a given set of data points.''' import numpy as np from scipy import optimize def exp_regression(x, y, p0=None): '''Accept two lists of x and y values of the data points, with an optional list of initial guesses for the parameters. Return the fitted funct...
true
bbfe6c0a3cc14680e47899ddac99733ea88d5d33
PostXaver/Financial-Stability
/historicalVolatilityFinal.py
UTF-8
1,804
3.328125
3
[]
no_license
import pandas as pd from sklearn import linear_model import numpy as np import matplotlib.pyplot as plt def cleanToPandas(filePath): cleaned = pd.read_csv(filePath, index_col=None, na_values=['.']) cleaned = cleaned.fillna(method='ffill') return cleaned def formatForRegression(df): x = df.index.valu...
true
59003ef34d4a32ebe18a74cfd08c868856c70833
miguelfbrito/RS17_project_program
/improvesplit/msloaddata.py
UTF-8
6,603
2.65625
3
[]
no_license
import csv import msconfig ''' load data from function atom files, calldep files, concerndep files. generate global allAtoms, classDepDict interface: loadData() ''' #dep between class class DepElement: def __init__(self, calldep, concerndep): self.calldep = calldep self.concerndep = concer...
true
45dba6efee02832be6bc73bba003e20c4c12bdbc
iyvan/data_view
/prepare/clean/dataclean.py
UTF-8
15,099
2.890625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Dec 25 22:42:01 2016 @author: temp01 """ import numpy as np from prepare.clean.basecalc import BaseCalc class DataCleaner(BaseCalc): def __init__(self): super(DataCleaner, self).__init__() pass def selectfromdeepv(self,nparr_torqu...
true
9e596d7cfea1cd15ab81b4628cb6d2ce3426be42
lemonade512/EulersProject
/Problem020.py
UTF-8
262
3.4375
3
[]
no_license
#!/usr/bin/env python # TODO look into how big integers are actually manipulated in languages # like Java and C++ total = 1 for i in range(1, 101): total *= i sum_ = 0 while total > 0: num = total % 10 sum_ += num total /= 10 print sum_
true
f11064579155d6ad7fd4baa777c33be9a49f1739
timfaner/ics.py
/tests/calendar.py
UTF-8
5,543
2.703125
3
[ "Apache-2.0" ]
permissive
import unittest from collections import Iterable from six import PY2 import arrow from ics.parse import Container from ics.icalendar import Calendar from ics.event import Event from ics.todo import Todo from .fixture import cal1, cal2, cal10, cal12, cal14 class TestCalendar(unittest.TestCase): fixtures = [cal...
true
d46f7eb34927166142f208f5671c1904adb25fd1
simontaotw/gae-utility
/lib/geo.py
UTF-8
707
2.6875
3
[]
no_license
import webapp2 from external import geohash class GeohashHandler(webapp2.RequestHandler): def get(self): self.post() def post(self): hash_value = '' coordinates = self.request.get('coordinates', '') if coordinates: lat = coordinates.split(',')[0] lng...
true
0511c2b37c3c9d6749852848fb57cb5a21c8e6d7
Rd-Feng/AirBnB_clone_v3
/api/v1/views/users.py
UTF-8
2,243
2.703125
3
[ "LicenseRef-scancode-public-domain" ]
permissive
#!/usr/bin/python3 """Renders json view for User object(s) """ from models import storage from api.v1.views import app_views from flask import jsonify, abort, request, make_response @app_views.route("/users", strict_slashes=False, methods=['GET']) def all_users(): """Returns list of json represen...
true
f1c326eb482071448de9967a6dee0d62eb7fe7fc
Xitog/tallentaa
/python/pygame/Tuto2PyGame.py
UTF-8
3,535
3.03125
3
[]
no_license
#----------------------------------------------------------------------- # Import #----------------------------------------------------------------------- import pygame # L'import principal from pygame.locals import * # Les codes des touches du clavier #--------------------------------------------------...
true
b0da43bea1bb4d1cdeb456793ed9dbd3591d91de
CoopCoopHolm/Python-OOP-Holm_Cooper_User
/Holm_Cooper_User.py
UTF-8
1,120
3.3125
3
[]
no_license
class User: def __init__(self, username, email_address): self.name = username self.email = email_address self.account_balance = 0 def make_deposit(self, amount): self.account_balance += amount def make_withdrawal(self, amount): self.account_balance...
true
f64d401527e9e2b005c332fca29de60348ea5ae5
Keep-Current/Express
/kce/api.py
UTF-8
1,146
2.515625
3
[ "MIT" ]
permissive
import responder from kce.crawler import Fetcher from kce.mail import sendMail api = responder.API(version = "0.1") f = Fetcher() @api.route("/") def default(req, resp): resp.text = "OK" @api.route("/latest/arxiv/{subject}") def get_latest(req, resp, *, subject): papers = f.arxiv(subject) ...
true
a5e44c44cf24bb80cde380c09f44a884b9704801
mayhuifu/UT-AnLay
/compress_dataset/compress.py
UTF-8
5,294
2.71875
3
[ "BSD-3-Clause" ]
permissive
## # @file compress.py # @author Mingjie Liu # @date July 2019 # @brief compress feature images to channel and label, save to hdf5 file format # import numpy as np import glob from scipy import misc from tqdm import tqdm import h5py class compress(object): def __init__(self): # Dataset name self.n...
true
3f4f2fb4263857659791ff7b839b001bec97a503
nevermore1993/leetcode_python3
/561. Array Partition I/solution.py
UTF-8
753
4.03125
4
[]
no_license
// 要使所有的对中的小的元素的和最大,那么我们要尽量让小的元素大。最大的元素不可能是小的,而第二大的元素和最大的元素配对,那么他就是小的。 // 同理,第四大的元素和第三大的元素配对,第四大的就是小的。以此类推。先排序,再将所有奇数位置的数相加。 class Solution: def arrayPairSum(self, nums: List[int]) -> int: nums.sort() res = 0 for i in range(0,len(nums),2): res += nums[i] return res ...
true
641eccf5c991db9c339316e2c485e95ed0f1b2ca
atrox3d/udemy-PNPCM-128-network-app
/ip_reach.py
UTF-8
829
2.671875
3
[]
no_license
import sys import subprocess def ip_reach(iplist: list[str]): """check IP reachability""" for ip in iplist: # rstrip already performed in ip_file_valid ping_reply = subprocess.call( f'ping {ip} /n 2', # stdout=subprocess.DEVNULL, # stderr=subprocess.DEVNULL ...
true
629357270b8bfc679af2936805be1444b310aea8
VictorWesterlund/collage
/classes/Color.py
UTF-8
1,968
3.140625
3
[ "MIT" ]
permissive
from PIL import Image, ImageFilter from .lib.colorthief import ColorThief # Image loader class PrepImage(): def __init__(self,image): self.image = Image.open(image) self.image = self.image.resize((50,50)) # Downscale image to improve performance # Format RGB output as HEX (without #) def h...
true
bd98e01af9468cf7ab6e06faa6141685d4e60f1d
melycm/Turtle-Exercises
/hexagon.py
UTF-8
132
3.25
3
[]
no_license
import turtle def hexagon(): for i in range(6): turtle.forward(50) turtle.right(60) hexagon() mainloop()
true
60bfed772ad95bb87ef7befe2d41776a38f5ed49
inno-asiimwe/bucketlist-app
/app/classes/user.py
UTF-8
4,022
3.375
3
[]
no_license
"""Module for the User Class""" from .bucketlist import BucketList from .activity import Activity class User: """Creates the user object and has methods for creating and viewingbucketlists and activities""" def __init__(self, firstname, lastname, username, password, email): self.firstname = fir...
true
06a5f39ea42c8980551e9288121ffa8e25d343e5
LLNL/fudge
/brownies/BNL/utilities/bins.py
UTF-8
276
2.734375
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
from numpy import logspace, flip import math def equal_lethargy_bins(numBins, domainMin=1e-5, domainMax=20.0e6, reverse=False): seq = logspace(start=math.log10(domainMin), stop=math.log10(domainMax), num=numBins) if reverse: seq = flip(seq) return seq
true
73a4953f78cdb17a330faf08414d07333ece4ff4
bojanuljarevic/Algorithms
/Ispit/tree_testing.py
UTF-8
649
3.1875
3
[]
no_license
import bst import random if __name__ == "__main__": T = bst.Tree() for i in range(10): T.treeInsert(bst.Node(d = bst.Data(random.randint(0, 100)))) T.treeInsert(bst.Node(d = bst.Data(10))) print("Root: ", T.root.key()) T.inorderTreeWalk(T.root) print("---------------") n = T.tree...
true
b9546247ee8654fb4ed286bb78529d7fc9838828
cerdwin/Reinforcement_learning_blackjack
/sarsaagent.py
UTF-8
4,881
3.046875
3
[]
no_license
from abstractagent import AbstractAgent from blackjack import BlackjackEnv, BlackjackObservation from collections import defaultdict import random import matplotlib.pyplot as plt from carddeck import * def start_off(): return defaultdict(lambda: [0.0, 0.0]), defaultdict(lambda: 0) class SarsaAgent(AbstractAgent...
true
65db0f978dcb5b8306bcc3f9a6af87bac3f7d8b7
JesseRed/MST_JSAM
/analyse_csvs/my_statistics.py
UTF-8
867
3.5625
4
[]
no_license
import numpy as np from numpy.random import randn from numpy.random import seed from numpy import mean from numpy import var from math import sqrt # function to calculate Cohen's d for independent samples def cohend(d1, d2): # calculate the size of samples n1, n2 = len(d1), len(d2) # calculate the variance of the s...
true
7846c3aa60af27d7ec18763040792c86f9822104
HorseSF/xf_Python
/day07/code/14-字典的遍历.py
UTF-8
624
4.65625
5
[]
no_license
person = {"name": "zhangsan", "age": 18, "height": 180} # 遍历方式 # for...in遍历 for x in person: # for...in循环获取key print(x, "=", person[x]) # 获取所有key,之后遍历key print(person.keys()) # dict_keys(['name', 'age', 'height']) for k in person.keys(): print(k, "=", person[k]) # 获取所有value 只能拿到值不能拿到key for v in person.val...
true
43d889f8ec5e6b567a20a88720f0fdb2ccf17518
naoya-miyashita198805/python--
/food.py
UTF-8
992
3.34375
3
[]
no_license
# coding: UTF-8 from menu_item import MenuItem class Food(MenuItem): # ↑ここの部分記入忘れがち、承継したなら書いておこう def __init__(self, name, price, calorie): super().__init__(name, price) self.calorie = calorie def info(self): return self.name + ':¥ ' + str(self.price) + ' ' + str(self.calo...
true
43de3833258dee3913bc108eb51bdb50226a9cbb
YiseBoge/CompetitiveProgramming
/LeetCode/BST/search_tree.py
UTF-8
632
3.296875
3
[]
no_license
from LeetCode.BST.__tree_node__ import TreeNode class Solution: def search_bst(self, root: TreeNode, val: int) -> TreeNode: if root is None: return None if root.val == val: return root if root.val > val: return self.search_bst(root.left, val) if ...
true
ee61eed77b0c9628bd0b699aeeeb70b9ab237276
marija2102ua/Homework
/HW5/hw5.1.py
UTF-8
357
4.09375
4
[]
no_license
divisible2 = [n for n in range(1,11)if n % 2 == 0] print(f'Even numbers that are divisible by 2 {divisible2}.') divisible3 = [n for n in range(1,11)if n % 3 == 0] print(f'Odd numbers, which are divisible by 3 {divisible3}.') not_div_2_3= [n for n in range(1,11)if n % 2 != 0 and n % 3 != 0] print(f'Numbers that are not ...
true
b92f95327718e228cbf4fc62c63a7cad6e4b8e72
fulltimefarmer/study_python
/study/readXl.py
UTF-8
313
3.203125
3
[]
no_license
from openpyxl import load_workbook wb = load_workbook('../file/students.xlsx') print(wb.sheetnames) sheet = wb.worksheets[0] print('Max row: %d' % sheet.max_row) print('Max column: %d' % sheet.max_column) print() for row in sheet.rows: for cell in row: print(cell.value, end='\t\t') print()
true
679695b171e60945b9acfe8197e2a2afe2e0cd8b
Aasthaengg/IBMdataset
/Python_codes/p02797/s443212492.py
UTF-8
154
2.59375
3
[]
no_license
N, K, S = map(int,input().split()) L = [S]*K for i in range(N-K): if S < 10**9: L.append(S+1) else: L.append(1) print(' '.join(map(str, L)))
true
4fd7c2d62c172b6bf99d3eac7a455457a8b327de
jung9156/studies
/lecture/algorithm/input.py
UTF-8
1,130
3.09375
3
[]
no_license
# def solution(scoville, K): # answer = 0 # idx = 0 # scoville.sort() # # while True: # if scoville[idx] < K: # if idx >= len(scoville) - 1: # return -1 # a, b = scoville[idx], scoville[idx + 1] # d = a + b * 2 # answer += 1 # ...
true
1e1f8f9d439b62c18b8280f7a0cf08104dceb3f8
mauricioklein/algorithm-exercises
/challenge-45/solver.py
UTF-8
978
3.796875
4
[ "MIT" ]
permissive
# # Time complexity: O(logn) # Space complexity: O(1) # def occurrences(nums, k): left = binsearch(nums, k, search_min=True ) right = binsearch(nums, k, search_min=False) # "k" not found on the array if left == -1 or right == -1: return 0 return right - left + 1 def binsearch(nums, k, search_min): ...
true
713d6dc309bcfe63dcd22cb0242d712132571db9
WonyJeong/algorithm-study
/koalakid1/Study/bj-12841.py
UTF-8
943
3.09375
3
[]
no_license
import sys input = sys.stdin.readline if __name__ == "__main__": n = int(input()) crosses = list(map(int, input().strip().split())) lefts = list(map(int, input().strip().split())) rights = list(map(int, input().strip().split())) distance = crosses[n-1] + sum(lefts) left = 0 right = sum(r...
true
f9f37c3ce268110fe9dbfc8f6cbfe32ff5321adc
mgokayb/beginnerpythonprojects
/userlogin.py
UTF-8
1,038
3.734375
4
[]
no_license
print("""" ************************************ User login interface! Enter the your id and password Plz ************************************ """) try_limit = 3 user_id = "john" user_pass = "nhoj" while try_limit > 0: id = input("ID : ") password = input("PASSWORD : ") if try_limit == ...
true
ae0d22d0ff444de2bb6b8336f81bc2046bbf4b43
tkhirianov/lab6
/E.py
UTF-8
3,241
3.234375
3
[]
no_license
''' Задача E ++++++++ В одном карточном клубе состоит N джентльменов. Иногда азарт некоторых из них берет верх над благоразумием, и кто-то проигрывает больше денег, чем у него есть с собой. В этом случае проигравший обычно берет в долг у кого-то из посетителей клуба, чтобы расплатиться с партнерами по игре. Чтобы нача...
true
562253b1cc5cb7bb03d5ccc504e3150792c5f44e
Rjayaprakashnarayana/PrintName
/excercise4/4.16_diff_smla.py
UTF-8
407
3.546875
4
[]
no_license
def diff_l_S(a,n): small=99999 large =0 for i in range(n): if(a[i]< small): small = a[i] if(a[i]>large): large = a[i] return large - small arr = [] n = int(input("Enter Number of Elements in array:")) for i in range(n): b= int(input()) arr.insert(i,b) d...
true
35491c0b3a4457ed28512a2920d3fd74669b810b
dob9601/hashcode-2021-qualifier
/solvers/reorder_optimiser.py
UTF-8
1,734
2.96875
3
[]
no_license
import random from solvers.solver import Solver from world import World from schedule import Schedule class ReorderOptimiser(Solver): name = 'ro' epochs = 1000 mutativity = 0.1 class EvaluatedSchedule(): def __init__(self, schedule: Schedule, score: int = 0): self.schedule = sched...
true
0211f3458508e36cb5546e6ec636c7f82946ab62
artzimy/CNNTabular
/TabConvModel.py
UTF-8
2,030
2.5625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: from fastai.vision import * from fastai.tabular import * from fastai.layers import * # # Define Model # **Build combined model architecture using tabular and image cnn learners** # In[2]: class TabConvModel(nn.Module): def __init__(self, tab_model, img_model, ...
true
18b34b67b2c608c09d6b36a47c4077e63381a325
MohamadShafeah/python
/Day3/06Functions/O01Functions7.py
UTF-8
165
3.65625
4
[]
no_license
# def math_opr(x, y): add = x + y mul = x * y quotient = x // y diff = x - y return add, mul, quotient, diff print(math_opr(40, 10))
true