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
7c26f7ebf238dd83ec927e8f95fd46d7e0c309c1
cz-fish/advent-of-code
/2019/01b.py
UTF-8
263
3.203125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 with open('input01.txt', 'rt') as f: input = [int(x) for x in f.readlines()] total = 0 for i in input: rem = max(0, (i//3)-2) total += rem while rem > 0: rem = max((rem//3)-2,0) total += rem print(total)
true
3844f5bf26ea0f8bf05000773698e5a444612dc9
STKFLT/prax
/prax/semantics.py
UTF-8
1,809
2.703125
3
[ "MIT" ]
permissive
from grako.exceptions import FailedParse from prax import parser from prax import praxidike # noinspection PyMethodMayBeStatic class PraxSemantics: def __init__(self, target, src=None, operators=None): self.src = src self.target = target self.operators = operators def expression(self...
true
1f6572d558e067b403ebdc7d5213051fdef095fb
LiuFang816/SALSTM_py_data
/python/ContextLab_hypertools/hypertools-master/docs/auto_examples/plot_point_colors.py
UTF-8
788
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- """ ============================= Choosing the thumbnail figure ============================= An example to demonstrate how to choose which figure is displayed as the thumbnail if the example generates more than one figure. This is done by specifying the keyword-value pair ``sphinx_gallery_thum...
true
14eb17ab6f01674b424bd947be4375fac6858278
zhudingsuifeng/python
/2018/chocolate.py
UTF-8
500
3.140625
3
[]
no_license
#!/usr/bin/env python3 #coding = utf-8 def selection(n, h, m, w): if n == 0 or m == 0: return 0 h = sorted(h) w = sorted(w) res, i, j = 0, 0, 0 while i < m and j < n: print(w[i], h[j]) if w[i] >= h[j]: res += 1 j += 1 i += 1 return res if...
true
d8921faa897b5e508be6d62201ef5518af1d6f08
daniellaah/Data-Structure-and-Algorithms
/leetcode/code/python/49_Group_Anagrams.py
UTF-8
658
3.921875
4
[]
no_license
"""49. Group Anagrams Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return: [ ["ate", "eat","tea"], ["nat","tan"], ["bat"] ] Note: All inputs will be in lower-case. """ class Solution(object): def groupAnagrams(self, strs): """ ...
true
8234400b6d1f98accb49f1472a719c35eabdc313
PetitPandaRoux/restaurant_webapp
/populate_db.py
UTF-8
1,217
2.671875
3
[]
no_license
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from database_setup import Base, Restaurant, MenuItem engine = create_engine('sqlite:///restaurantmenu.db') Base.metadata.bind = engine DBSession = sessionmaker(bind = engine) session = DBSession() myFirstRestaurant = Restaurant(name = "Pizz...
true
578e2e2595140a79639cc9f911107dc8958bfd21
cener-1999/learn_about_python
/learn_python_socket/myserver.py
UTF-8
724
2.796875
3
[]
no_license
# -*- coding: UTF-8 -*- import socket server_addr=('127.0.0.1',1890)#写错了 myserver=socket.socket() myserver.bind(server_addr) myserver.listen(10) #welcome='my first server tsets' #myserver.send("welcome") while True: connetion,client_addr=myserver.accept() connetion.send('welcome') get_data=connetion....
true
6036a5337b1b9f4576d0350d157109656b372581
adankro/checkpoint_bedu_example
/ejemplos/servidores_web/rhoteles.py
UTF-8
742
2.875
3
[]
no_license
from flask import Flask, request import json app = Flask(__name__) lista_hoteles = [] @app.route('/hotel/', methods=['POST', 'GET']) def hoteles(): if request.method == 'POST': try: hotel = dict(json.loads(request.data)) lista_hoteles.append(hotel) return 'Hotel {} ag...
true
010dee44575da2508a08254fc310c0bb329d1055
szlevinli/studyAI
/source/teacher_code_2019/tensorflow_tutorial_1/d6_graph_get_all_op.py
UTF-8
269
2.703125
3
[]
no_license
import tensorflow as tf #construct the graph matrix1 = tf.constant([[3., 3.]]) matrix2 = tf.constant([[2.],[2.]]) product=tf.matmul(matrix1,matrix2) graph = tf.get_default_graph() with tf.Session() as sess: for op in graph.get_operations(): print(op.name)
true
c6c5e39ecb73a2cc5da3598218f16f55b1113de6
PacktPublishing/TensorFlow-Reinforcement-Learning-Quick-Start-Guide
/Chapter04/ddqn/model.py
UTF-8
3,858
2.671875
3
[ "MIT" ]
permissive
import numpy as np import sys import os import random import tensorflow as tf NET = 'bigger' # 'smaller' LOSS = 'huber' # 'L2' winit = tf.variance_scaling_initializer(scale=2) # tf.contrib.layers.xavier_initializer() #-----------------------------------------------------------------------------------------------...
true
c9a0452d76b57705630a127454f4cf28fb658acb
matthewangbin/Python
/codewar/nickname.py
UTF-8
241
3.140625
3
[]
no_license
# written by matthew import re def nickname_generator(name): if len(name)<4:return "Error: Name too short" pattern='^[A-Z][a-z][aeiou][a-z]|^[A-Z][a-z]{2}' return re.findall(pattern,name)[0] print nickname_generator('Kimberly')
true
6b813a522d5262f7f824cbe45e5f00c721aea5c1
andersonsouza12/jogopython
/jogopython/jogo.py
UTF-8
12,693
2.6875
3
[]
no_license
import pygame from random import randint from jogopython import constants from jogopython.zombie import Zombie pygame.init() # variaveis do personagem ## x é a largura da tela x_personagem = 1000 ## y é a altura da tela y_personagem = 200 largPersonage...
true
fbe6eb791526206f4824d382bd72a26e523b7f91
Finao-FF/fengwenting
/demo01.py
UTF-8
3,872
4.34375
4
[]
no_license
""" print("hello word!") #字符串 print(23333) #整数 print(2.333) #小数 print(True) #布尔值 True False print(()) #元组 print([]) #数组 print({}) #字典 锄禾日当午 汗滴禾下土 print("hello word!",23333) print("哈哈"+"嘻嘻") #字符串的拼接 print("哈哈"*100) print(((1+2)*100-9.9)/2) print(2>3) a="张三" #把张三这个值赋给变量 print(a) a=input("请输入:") #通过input输入的,均当作字符串处理了,故a...
true
d5b79845632ea144e2b6a83f8661e6f8ca72db41
imperfectskillz/holbertonschool-higher_level_programming
/0X0C-python-almost_a_circle/models/square.py~
UTF-8
1,130
3.375
3
[]
no_license
#!/usr/bin/python3 """ Module contains class Square """ from models.rectangle import Rectangle class Square(Rectangle): """ class Square """ def __init__(self, size, x=0, y=0, id=None): """ initalizes above """ super().__init__(size, size, x, y, id) def __str__(se...
true
c96c5a8f3572e49c16a62329a9f3faf9b1c6679a
HYOSEONJIN/inflearn
/python/Python_Basic/Chapter09_02.py
UTF-8
1,607
3.859375
4
[]
no_license
# Chapter09_02 # csv 파일 읽기 및 쓰기 # csv : meme - text/csv; import csv # 예제1 with open('./resource/test1.csv','r') as f : reader = csv.reader(f) next(reader) #header (첫줄) skip # 객체확인 print(reader) # 타입확인 print(type(reader)) # 속성확인 print(dir(reader)) print() # 내용 출력 for c ...
true
3a930f56029471272de121edbd3931be2ac6070a
henryz2000-stuycs/test
/introcs2/addressLtesting/addressL.py
UTF-8
2,127
2.859375
3
[]
no_license
#!/usr/bin/python # ========= HASHBANG LINE ABOVE IS MAGIC! ========= # ========= (Must be first line of file.) ========= """ Team Public Relations - Gilvir Gill, Henry Zheng IntroCS2 pd8 FINAL PROJECT END OF SEMESTER """ import math import cgi import cgitb import urllib2 import json #import googlemaps #from datetime...
true
5e87c2ca084c49aa440d0a43cd5c73b2bc9e159c
Aasthaengg/IBMdataset
/Python_codes/p02421/s446896350.py
UTF-8
208
3.5625
4
[]
no_license
turn = int(input()) tp, hp = 0, 0 for i in range(turn): t, h = input().split() if t == h: tp += 1 hp += 1 elif t > h: tp += 3 elif t < h: hp += 3 print(tp, hp)
true
7c6f9b5d0b8c212d995eb75b4477dcfea298251b
Ananda9470/programming_practise
/recursion/productSum.py
UTF-8
307
3.640625
4
[]
no_license
# O(n) | O(d) def productSum(array, multiplier=1): return sum([ ele if isinstance(ele, int) else productSum(ele, multiplier + 1) for ele in array ])*multiplier if __name__ == "__main__": array = [1, 2, 3, [4, 5, [5, 6], 7], 8] ans = productSum(array) print(ans)
true
4c3f71d4010f36b63361f0f4578672a9e9c683b3
Hall-Erik/AdventOfCode
/2015/18/part_1.py
UTF-8
1,959
3.53125
4
[]
no_license
from tqdm import tqdm lights = {} size = 100 def count_on_neighbors(pos:tuple) -> int: min_x = pos[0] - 1 min_y = pos[1] - 1 max_x = pos[0] + 2 max_y = pos[1] + 2 return [ lights.get((x, y), '.') for x in range(min_x, max_x) for y in range(min_y, max_y) ...
true
f8ae20d98e82bea9f94e9fc67a57dc6e282a845f
thehimel/data-structures-and-algorithms-udacity
/m01c04-python/i03e01_functions.py
UTF-8
297
4.40625
4
[]
no_license
# Example function 1: return the sum of two numbers. def sum(a, b): return a+b print(sum(2, 3)) # Example function 2: return the size of list, # and modify the list to now be sorted. def list_sort(my_list): my_list.sort() return len(my_list), my_list print(list_sort([9, 4, 3]))
true
48ecf4758cdf8036b9943701f7f40b93e5f707cf
Kawser-nerd/CLCDSA
/Source Codes/CodeJamData/15/22/1.py
UTF-8
957
3.015625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Uses https://github.com/rkistner/contest-algorithms import sys def debug(*args): print(*args, file=sys.stderr) def permutations(n, k): if k == 0: yield [False]*n return for p in permutations(n-1, k-1): yield p + [True] if n > k:...
true
d5e36a63e9b778e74eb20bf91a76776359cc90dc
HardipsinhSisodiya/.NetAssignments
/Python/Task1.py
UTF-8
376
3.390625
3
[]
no_license
print("Enter your details to make your details card.....") print("Enter your Firstname ") Firstame=input() print("Enter your Lastname ") Lastame=input() print("Enter your address") Address=input() print("Enter your number") Number=int(input()) print("You details card:") print("Fullname:"+Firstame+" "+Lastam...
true
bcaf8c88e77a26517d40290c16147f941ee008a0
yafeile/Simple_Study
/Simple_Python/standard/warnings/warning_9.py
UTF-8
405
2.53125
3
[]
no_license
#! /usr/bin/env/python # -*- coding:utf-8 -*- import warnings import logging logging.basicConfig(level=logging.INFO) def send_warning_to_log(message,category,filename,lineno,file=None): logging.warning( '%s:%s: %s:%s' % (filename,lineno,category.__name__,message)) return old_showwarning = war...
true
1efb0e4692fe04d24074c0909057263169308344
MargaritaPopova/pygame-SHP
/Platform.py
UTF-8
983
3.53125
4
[]
no_license
import pygame from random import randint class Platform: def __init__(self, screen): self.width = screen.width//4 self.height = 10 self.color = 85, 107, 47 self.x = randint(0, screen.width-self.width) self.y = randint(0, screen.height) self.rect = pygame.Rect(self....
true
0b01bdb977d6fca12d8adf3fe7d41efe0d98dbc8
Rudra4321/Quantum-Convolutional-Neural-Networks
/data_gen/hamiltonianOld.py
UTF-8
9,872
2.671875
3
[ "MIT" ]
permissive
import os import sys import time import psutil import itertools import numpy as np import scipy.sparse as sparse import scipy.sparse.linalg from functools import lru_cache, wraps def np_cache(*args, **kwargs): def decorator(function): @wraps(function) def wrapper(np_array, *args, **kwargs): ...
true
d3238089c3e75df0a19e301b9baed61705d92ba5
IdeaBot/basics
/?list.py
UTF-8
2,307
2.8125
3
[ "MIT" ]
permissive
from libs import command, embed import re class Command(command.DirectOnlyCommand, command.AdminCommand): '''Provides a nice list to summarize Idea's functionality The list of commands/reactions/plugins is provided in the following form: **package name** --command/reaction/plugin name **Usage** ```@Idea list (c...
true
2e7f87f39da0fbf04874684bc475af4717304912
mathildehaugum/mcts-hex
/config/demo_config.py
UTF-8
1,347
2.6875
3
[]
no_license
# ----------------------------- BOARD PARAMETERS ----------------------------- game_type = "HEX" board_size = 5 starting_player = 1 # Random starting player for each episode: 0, else 1/2 # ----------------------------- AGENT PARAMETERS ----------------------------- save_interval = 4 # M: cache interval in preparati...
true
4833702b3e4b10eeccae9d5e2a6891aa5ce966bb
BenWarwick-Champion/Euler
/python/p39.py
UTF-8
534
3.796875
4
[]
no_license
# Project Euler # Problem 39: Integer Right Triangles from math import sqrt, floor def find_triangles(perimeter): count = 0 for a in range(1, perimeter//3): for b in range(1, perimeter//2): c = sqrt(a**2 + b**2) if c.is_integer() and a + b + c == perimeter: coun...
true
11c9c2a009573aef644c73c4930867a55c2c1b35
abby501198/Programming-for-Bussiness-Computing
/hw6(1).py
UTF-8
1,687
3.828125
4
[]
no_license
# abby chang # input strings_list = [] while True: string = input().strip(" ") # 去除多餘的空白 if string == "INPUT_END": # 若遇到INPUT_END則停止讀取資料 break # 並跳出迴圈 else: strings_list.append(string) # 將各行字串加入string_list key_string = strings_list[0] # 把關鍵字取出來 strings_list.remove(key_string) # ...
true
5f9130aa33268d0c87723ece9211df79cf860435
zxbzxb180/python_work
/爬虫/temperature_spider/item.py
UTF-8
1,486
2.59375
3
[]
no_license
from peewee import * # 数据库名、 IP地址、 端口号、 用户名、 密码 db = MySQLDatabase('temperature', host='127.0.0.1', port=3306, user='root', password='123456') class Temperature(Model): date = CharField(max_length=20, null=True) time = CharField(max_length=20, null=True) temperature = CharField(max_length=20, null=True) ...
true
dd3a2e42e532a3c972469170b64e0d67be42a9e3
C4C56/music_downloader
/main.py
UTF-8
1,804
2.78125
3
[]
no_license
# coding=utf-8 import argparse from music_downloader import MusicDownloader from singer_downloader import SingerDownloader def main(): parser = argparse.ArgumentParser(prog='KuGou music crawler') group_development = parser.add_argument_group('group development', 'group development used for development') g...
true
6bd9e0e5e6d1caee971b540432f86e582e1ccb7f
JuneUrbani/stickynote-classifier
/live_predictor.py
UTF-8
3,812
2.671875
3
[]
no_license
from keras.models import model_from_json import cv2 import numpy as np import os import time # Load json and create model json_file = open('model.json', 'r') loaded_model_json = json_file.read() json_file.close() model = model_from_json(loaded_model_json) # Load weights into new model model.load_weights("model.h5") pr...
true
c3a254294a88c34a4011671f7e9dc20cf821a8d7
Jimmycheong/Pokemon_Predictor
/tf_model/functions.py
UTF-8
3,343
3.328125
3
[]
no_license
''' Hello there ''' import pandas as pd import numpy as np import tensorflow as tf def get_pokemon_data_from_csv(path): data = [] dataset = pd.read_csv(path) type_column = dataset.iloc[:, 2].values.astype(str) reshaped_type_column = np.reshape(type_column, [len(type_column), 1]) # Reshape to [?, ...
true
81b0242c5ec0ca0576520402c3f11c8bfdb69bf4
jayaram1125/MLProject1
/main.py
UTF-8
5,048
2.765625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Sep 12 18:21:38 2016 @author: JayaramK """ import numpy as np import xlrd import scipy.stats as sp import matplotlib.pyplot as plt import math wb = xlrd.open_workbook('university data.xlsx') ws = wb.sheet_by_index(0) print("UBitName:jayaramk") ...
true
b871f436e3f8d8913bf5bed364ca681c747c6826
Bambang-Sugiarto/Statistik_Corona
/Main.py
UTF-8
304
2.609375
3
[]
no_license
import pandas as pd from matplotlib import pyplot path = "datasets\COVID19_line_list_data.csv" data = pd.read_csv(path) print("INFO DATASET CORONA") print(data) print(data.describe()) print(data.info()) print("RATA-RATA SEMUA KOLOM") print(data.mean()) print("TAMPIL HISTOGRAM") data.hist() pyplot.show()
true
316be6c0feb32023a4e15a4674cc157b383513b0
hoperose/info206_exercises_Yu
/meeting9/mymodule/counting/count.py
UTF-8
424
3.71875
4
[]
no_license
from collections import Counter def main(): entry = input("Please enter a word or a sentence: ") wordsList = entry.lower().split() count = Counter() for words in wordsList: for letters in words: count[letters] += 1 print(count) if __name__ == "__main__": main() #entry is ...
true
c4968026c000be46b379d565fef2fb9802e0c401
Ankit6548/Bus-Arrival-Time-Prediction
/Calc_distance_btw_2_cord..py
UTF-8
1,220
3.484375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jun 25 00:38:47 2019 @author: Ankit Talwar """ from math import sin, cos, sqrt, atan2, radians """ def Calc_Dist_Btwn_Stops(lat1,lon1,lat2,lon2): # approximate radius of earth in km R = 6371.0 latitude1 = lat1 longitude1 = lon1 latitude2 =...
true
01e7d1a31fc10b33f47d6c4fc6f479f8a297c654
chitrita/Proj294
/macs2.py
UTF-8
700
2.546875
3
[]
no_license
""" Wrapper file to call macs2 in python """ import meta_data; import os; import sys; import subprocess as sp; def macs2_callpeaks(exp): """Calls peaks on the experiments raw file. Puts the result in the experiments Peaks folder. """ input_file = meta_data.raw_bed_file(exp); name = "macs2_" + me...
true
a0a5bf4ec5f4dc05e2443af48a53d69b0b939eb8
AlexStephan/ASSD_TP2
/src/backend/tracks/note.py
UTF-8
439
3.125
3
[]
no_license
class Note(object): def __init__(self, start=None, velocity=None, number=None, end=None): print("Note created!") self.start = start # segs self.velocity = velocity # amplitud self.number = number if self.number is not None: self.frequency = 440*pow(2,(...
true
97b71cf5d5690ae8bd6d6127e73cd2aac12261f9
Emanuele-M/Progetto-Intelligenza-Artificiale
/graph.py
UTF-8
3,456
3.34375
3
[]
no_license
import pandas as pd import numpy as np import math class Graph: def __init__(self, nodes = None): if nodes == None: nodes = [] self.nodes = nodes def addNode(self, node): if node not in self.nodes: self.nodes.append(node) def addEdge(self,...
true
711204f7719b24b17a710f88066f3c61d747cc7c
shjang1013/Algorithm
/BAEKJOON/for문/2739_구구단.py
UTF-8
114
3.171875
3
[]
no_license
N = int(input()) for i in range(1,10): print(N,"*",i,"=",N*i) # print('{0} * {1} = {2}' .format(n,i,n*i))
true
98de7f2f2e4c2571bbf92b3e8492379c63ec4ade
Pelluuh/estate-crawler
/scrapper/util/extractor.py
UTF-8
2,306
3.0625
3
[]
no_license
# coding=utf-8 from scrapy.selector import Selector from scrapy.http.response.html import HtmlResponse from htmllaundry import strip_markup from urlparse import urlparse class Extractor: @staticmethod def euro(html, cssSelector='*'): data = Extractor.string(html, cssSelector) # Flip dot and co...
true
7e0b942ebb2c75587d7520427b6ad5d08451f6db
selimyoussry/problem_solving
/misc/data_structures/sorting_quicksort.py
UTF-8
782
3.640625
4
[]
no_license
__author__ = 'somedude' """ This algorithm is in place """ def quicksort(a): return quicksort_(a, 0, len(a) - 1) def quicksort_(a, lo, hi): if lo < hi: p = partition(a, lo, hi) # All the numbers before the index p, are lower than a[p] # after p, they are greater than a[p] qui...
true
4419d93f5300f8dc8eaf74bca46a5e81a2f03148
fcondessa/where_is_X
/where_is_X.py
UTF-8
1,456
2.75
3
[]
no_license
import json from collections import defaultdict import matplotlib.pyplot as plt import numpy as np from scipy.ndimage import convolve path_location_dir = 'loc_dir.json' path_location_list = 'locs.json' with open(path_location_dir) as f: locations_dictionary = json.load(f) with open(path_location_list) as f: locatio...
true
9d525672dd402c5c6436cd6238e895eb95aa8d59
Malawi-Water-Wells-project/malawi-auth-api
/app/main/models/tribe.py
UTF-8
2,347
2.859375
3
[]
no_license
""" Created 05/02/2021 SQLAlchemy Model for a Tribe """ from datetime import datetime from uuid import uuid4 from app.main.models.abstract_model import AbstractModel from typing import List from app.main.constants import UserRoles from app.main.models import db from app.main.models.user import User class Tribe(db.Mo...
true
0596cb7f2ef85369551b37ffc6cbc25cfbb186d8
alexbakharew/CGraphics
/2/cylinder.py
UTF-8
931
3
3
[]
no_license
import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.pyplot as plt mpl.rcParams['legend.fontsize'] = 10 fig = plt.figure() ax = fig.gca(projection='3d') x_v = list() y_v = list() z_v = list() t = -np.pi while t <= np.pi + 0.1: x_v.append(3*np.cos(t)) y_v.appen...
true
6b755e6fe34355b39b0ad9d139922b7a9be1af26
ignik86/plc2db
/PlcSnap.py
UTF-8
2,714
2.5625
3
[]
no_license
import xml.etree.ElementTree as ET import snap7 import struct import time class PLCClass: def __init__(self, configfile): super(self.__class__, self).__init__() self.configfile = configfile self.config = XmlParse(self.configfile) def readtag(self, tagnr): plc = snap7.client.C...
true
cd1698f20cc8a00ad4f1de0309658e962c74c0cc
npradaschnor/algorithms_module
/compare.py
UTF-8
136
3.421875
3
[]
no_license
#Sorting lesson def compare(a,b): if a < b: return -1 elif a == b: return 0 else: return 1 print(compare(100,-240))
true
50a4594e4f71147c7f6015070411c4c9bb89ea1b
AngryLawyer/supervisor-fun
/project/validation/__init__.py
UTF-8
1,119
2.65625
3
[ "MIT" ]
permissive
from .exceptions import ValidationException from .fields import IsNonEmptyString, IsList class Validation: """ Check that a JSON object matches the schema we give it """ schema = {} def validate(self, data): validation_results = { key: rule.validate(data.get(key, None)) ...
true
e4f2fa30868fdfb955de677a04cc10d753d446a5
yexianyi/AI_Practice
/MachineLearning/Pandas/Titanic.py
UTF-8
4,533
2.625
3
[ "Apache-2.0" ]
permissive
import pandas as pd import numpy as np import matplotlib.pyplot as plt data_src = "train.csv" df = pd.read_csv(data_src, header=0) # check dataset basic info ''' <bound method DataFrame.info of PassengerId Survived Pclass ... Fare Cabin Embarked 0 1 0 3 ... 7.2500 NaN ...
true
1b0341db1a450f19d4d811c2b4e2bb1a2cb61ad6
KEVINYZY/python-tutorial
/tool/build_seq2seq_train_data.py
UTF-8
428
2.53125
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- """ @author:XuMing(xuming624@qq.com) @description: """ import pycorrector with open('eng_chi.txt', encoding='utf-8') as f1, open('a.txt', 'w', encoding='utf-8')as f2: for line in f1: line = line.strip() parts = line.split('\t') eng = parts[0] chi = parts[1]...
true
1a115b46a509599de12e7777436cae165e033e91
kimyh1207/pylib_jump-to-python_lin
/ch17/pdb_sample.py
UTF-8
169
3.015625
3
[]
no_license
import pdb numbers = [1, 2, 3] for i in range(len(numbers)): pdb.set_trace() # 중단점 설정 if numbers[i] % 2 == 0: del numbers[i] print(numbers)
true
db80e40418af21347daa8eb8d28dace8b1935b7d
ltakuno/arquivos
/python/URI/Basico/uri1021.py
UTF-8
515
3.5
4
[]
no_license
valor = float(input()) notas = [100, 50, 20, 10, 5, 2] moedas = [100, 50, 25, 10, 5, 1] v = int(valor) d = int((valor + 0.005 - v) * 100) print("NOTAS:") for nota in notas: total_notas = int(v/nota) v %= nota print("{0} nota(s) de R$ {1}.00".format(total_notas, nota)) d += (v * 100) print("MOEDAS:") fo...
true
acf3e7bf2788b77489b0276bd996a699fcfee2ba
kcaashish/PythonJamProjects
/src/part2_q14.py
UTF-8
395
3.46875
3
[]
no_license
def countWords(s): words = s.split(" ") wordsDone = list() retDict = dict() for word in words: if word in wordsDone: continue count = words.count(word) # print("%s comes %d times" % (word, count)) retDict.update({word: count}) wordsDone.append(word) return retDict print(countWords("the the the th...
true
7114328c34ae262827d2301f6ac26a74f289c8e5
syurskyi/Mastering_PyCharm
/debugging/program.py
UTF-8
187
3.53125
4
[]
no_license
import math_tricks data = [] fibs = math_tricks.fibonacci() odd_fibs = math_tricks.odd_numbers(fibs) for o in odd_fibs: if o > 1000: break data.append(o) print(data)
true
0bead3f2e2aa5d2439c3cbd91984232d2476f51a
sudnya/misc
/dynPrg/longestCommonSubSeq.py
UTF-8
2,172
3.328125
3
[]
no_license
############################################################################### # # \file longestCommonSubSeq.py # \author Sudnya Padalikar <mailsudnya@gmail.com> # \date Monday August 15, 2016 # \brief Given two strings S1 and S2, find out the longest common substring # #######################################...
true
8275cbdb5283b37a269e460d82a39b736487344b
BotZeroG/demo
/ICP5/LinearRG.py
UTF-8
529
2.984375
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy import stats plt.style.use(style="ggplot") df = pd.read_csv('train.csv', index_col=0) df.head() df.plot.scatter(x='GarageArea', y='SalePrice') Q1 = df.quantile(0.25) Q3 = df.quantile(0.75) IQR = Q3 - Q1 index = df[(df['GarageArea']...
true
f4807fb73b074139433ce67d0dd41fd8c2e32b6d
enkumamoto/exercicios-python
/Exercícios - Python.org.br/EstruturaDeRepetição/exercicio 42.py
UTF-8
604
4.0625
4
[]
no_license
''' Faça um programa que leia uma quantidade indeterminada de números positivos e conte quantos deles estão nos seguintes intervalos: [0-25], [26-50], [51-75] e [76-100]. A entrada de dados deverá terminar quando for lido um número negativo. ''' list1 = [] list2 = [] list3 = [] list4 = [] for n in range(100, -20, -1):...
true
8a26aecceea9515e58ffbf844739b8b0638da40c
MauricioMeza/covid19-colombia
/Bar Graph/barGraph.py
UTF-8
1,280
2.890625
3
[]
no_license
""" ------------------------------------------------------------------------ ------------------ Take formated, sorted data ------------------------------ ------------- create 3D visualization in blender -------------------------- ------------------------------------------------------------------------ """ """Only Wor...
true
9976dbb1f0f1156123935385db2dfe9640c14fbb
okHotel/ssd_project
/python_puri/female_births_SVM.py
UTF-8
3,069
3.109375
3
[]
no_license
import pandas as pd import plotly.express as px from datetime import datetime import numpy as np import matplotlib.pyplot as plt url = 'https://raw.githubusercontent.com/okHotel/ssd_project/master/data_set/female_birth.csv' df1 = pd.read_csv(url) df1 = df1[['Date', 'Births']] plt.plot(df1.Date, df1.Births) plt.xlabe...
true
9901a789a64446e740bdbfb47613ff9cb09a2927
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/bob/ec9effa90e0541878f877ad44536ec92.py
UTF-8
324
3.640625
4
[]
no_license
def hey(string): ''' Bob isn't very talkative. ''' if not string.strip(): return 'Fine. Be that way!' elif string.upper() == string: for character in string: if character.isalpha(): return 'Whoa, chill out!' return 'Sure.' if string[-1] == '?' else 'Whateve...
true
ae959240240f9bb7354b2a6dc9b7f772bbf165f7
Aasthaengg/IBMdataset
/Python_codes/p03775/s013405782.py
UTF-8
171
3.171875
3
[]
no_license
N=int(input()) def divisor(n): i=1 table=[] while i*i<=n: if n%i==0: table.append(n//i) i+=1 num=min(table) ans=len(str(num)) return ans print(divisor(N))
true
3558350a57ab6eff1adfbfb04745ea3dad110eae
ganeshgirase/expression_parser
/lib/expression_types_factory.py
UTF-8
1,203
2.546875
3
[]
no_license
#! /usr/bin/python # # Factory class for various expression types # like XML, CSV, TEXT etc. import expression_parser.lib.exml.xml_reader import expression_parser.lib.exml.xml_expression_processor import expression_parser.lib.exml.xml_writer from expression_parser.lib.exml.xml_reader import XMLReader from expression...
true
62e8c0ccfced799cd1036e7d89102739924c8014
hawlette/intesivepython
/Aug21/Django/hello-project/app.py
UTF-8
540
3.6875
4
[ "Apache-2.0" ]
permissive
"""This module is for learning This module has basic functions to work with numbers """ def is_even(number: int) -> bool: """ This method will find if the number passed is even or not :param number : a number :return: True if even False otherwise """ if number <= 0: return False ...
true
a8f55d747a9967126d24042bc74bface16306696
rookie0806/KoreaTop100_parsing
/serverattack.py
UTF-8
801
2.828125
3
[]
no_license
import socket import smtplib from smtplib import * IP = input("Enter Ip address: ") Port = input("Enter Port Number: ") X = input("From: ") Y = input("TO: ") s = socket.socket() s.connect((IP,int(Port))) socket.setdefaulttimeout(3) ans = s.recv(1024) if ("220" in ans): print("\n[+]Port" + " " + str(Port) + " ...
true
44d0a3a084a53952857742932d4462debafbae2c
mutantbob/coral-3d
/truncated-octahedron-2.py
UTF-8
2,108
2.734375
3
[]
no_license
import bpy import bmesh def createMeshFromData(name, origin, verts, faces): # Create mesh and object me = bpy.data.meshes.new(name+'Mesh') ob = bpy.data.objects.new(name, me) ob.location = origin ob.show_name = True # Link object to scene and make active scn = bpy.context.scene scn.ob...
true
93d610ee99ebb2676950b7fd46dd66d95289d7d1
elshadow11/Prog
/ejercicios terminados/Python/estructuras alternativas/act15.py
UTF-8
2,442
4.0625
4
[]
no_license
#Programa: act15.py #Propósito: El director de una escuela está organizando un viaje de estudios, y requiere determinar cuánto debe cobrar a cada alumno y cuánto debe pagar a la compañía de viajes por el servicio. La forma de cobrar es la siguiente: si son 100 alumnos o más, el costo por cada alumno es de 65 euros; de ...
true
783a797637350e61a7e020077481670a36a31909
BlockchainClimateInstitute/Carbon-Trading-Verfication
/archive/Estimating-SOC/src/nns/eval.py
UTF-8
4,701
2.578125
3
[]
no_license
import torch from torch import tensor import torch.nn.functional as F import torch.utils.checkpoint as checkpoint from torch.utils.data import DataLoader from torch.utils.data import TensorDataset import rasterio import matplotlib.pyplot as plt import numpy as np from tqdm import tqdm from sklearn.metrics import r2_sco...
true
be6f9f3b83ee3e4a57e688e32775a5f09c7e8461
fernandomarques/LaboratorioProgramacao
/Lista - Vetor - Array/unpacking.py
UTF-8
486
3.546875
4
[]
no_license
import random import math lista = random.sample(range(50),10) print(lista) print(*lista) # print(lista[0],lista[1], ... , lista[9]) ## atenção código avançado para explicar unpacking ## p1 = [1,2] # idealmente usariamos (1,2) TUPLAS, pesquisem! p2 = [3,3] ''' 3 p2 2 p1 1 0 1 2 3 ''' def dist(x...
true
b569d4f24382fb0b9df7053190329c5159666fef
jhj9109/TIL
/Class_On_SWEA/Class_104/codes/53차시 문자열 각각 키, 0~5정수 각각 값.py
UTF-8
352
3.4375
3
[]
no_license
data_str="abcdef" data_int=list(range(6)) data_list=list(data_str) data_dict={} for i in range(6) : data_dict[data_list[i]] = data_int[i] print("{0}: {1}".format(data_list[i], data_int[i])) #print (data_dict) # # for i in data_dict: # print("{0}: {1}".format(i,data_dict[i])) # # print (data_dict) #dat...
true
b26a68b8497443557c062501947ae52f74a5cdb9
pheidmann/HQCMeas
/hqc_meas/instruments/drivers/lock_in_sr830.py
UTF-8
4,600
3
3
[]
no_license
# -*- coding: utf-8 -*- #============================================================================== # module : lock_in_sr830.py # author : Matthieu Dartiailh # license : MIT license #============================================================================== """ This module defines a driver for the Stanford inst...
true
7f51e83f4ae5b5d50f2dc27d7305a8255739b885
artheadsweden/Python_Fundamentals_Oct_17
/Day2/01 Profiling.py
UTF-8
182
3.09375
3
[]
no_license
def my_func(): for n in range(100000): y = n**2 def main(): my_func() x = 2 for i in range(10000000): x *= i if __name__ == '__main__': main()
true
381cae8dab3aa62a42370fed792e23e75fa783df
constant5/Topic-Modeling
/LDA/BZ2Reader.py
UTF-8
1,778
2.9375
3
[]
no_license
# Module for opening reddit bz2 files on talon import json import bz2 class bz2reader(): def __init__(self, fname, keys=[], max_lines=-1): self.fname = fname self.file_object = bz2.open(self.fname, 'rb') self.max_lines = max_lines self.keys = keys def read_lines(self): ...
true
f161395b5d5069bd35a972ab9fd30cc73c151371
v4nh4n/practicepython.org
/ex23.py
UTF-8
424
3.03125
3
[]
no_license
prime = [] with open("C:\\Users\\v4h4\\Desktop\\prime.txt") as p: line = p.readline() while line: prime.append(int(line)) line = p.readline() happy = [] with open("C:\\Users\\v4h4\\Desktop\\happy.txt") as h: line = h.readline() while line: happy.append(int(line)) line = ...
true
6e15c5285ec4e8ea660df1fef876b0131d7819ff
Patel-Meet/Trailer_Viewing_Website
/main.py
UTF-8
1,227
2.765625
3
[]
no_license
import fresh_tomatoes import webbrowser import media # These are the objects of movie class Movie1 = media.Movie("12 Monkeys", "http://bit.ly/2uKjsZY", "https://www.youtube.com/watch?v=15s4Y9ffW_o") Movie2 = media.Movie("A Beautiful Mind", "http:/...
true
c6567564a9a610858dcf96354d9f83555049b3ed
span1ard/rss_update_notifier
/rss.py
UTF-8
4,453
2.625
3
[]
no_license
#!/usr/bin/env python __author__ = 'span1ard' import sys import subprocess from datetime import datetime from time import sleep import feedparser from settings import * def config_check(): if not shell_mode and not subprocess_mode and not stdout_mode and not file_mode: print('ERROR: Pick at least one o...
true
a3ac883fdc103ac1350f433534ac4e25a9b15d33
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/simple-cipher/1ac67ffd19614b90ad871dfa550aec8b.py
UTF-8
1,639
3.359375
3
[]
no_license
from string import ascii_lowercase import random # Global constants ord_a = ord('a') ord_z = ord('z') distance_a_to_z = len(ascii_lowercase) class Cipher: def __init__(self, key=None): if key: if key.isalpha() and key.islower(): self.key = key else: ...
true
94b96ccfc4899e66fd57f0d47a121ddc2e1910c0
MatthewDealer/SIPE-Simple-Image-Python-Editor
/Effects/GenerateGradient.py
UTF-8
1,051
3.15625
3
[]
no_license
from PIL import Image, ImageDraw from tkinter import colorchooser def interpolate(f_co, t_co, interval): det_co = [(t - f) / interval for f, t in zip(f_co, t_co)] for i in range(interval): yield [round(f + det * i) for f, det in zip(f_co, det_co)] def gradient(width, height, color_one, color_two): ...
true
e0ac96a732cb8efa0025691685e9217b8ccc1a0d
1234momo/housing-price-regression
/cross_validation.py
UTF-8
3,090
2.890625
3
[]
no_license
import numpy as np from sklearn.linear_model import LinearRegression, LogisticRegression from sklearn.neighbors import KNeighborsRegressor from sklearn.svm import SVR from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import mean_squared_error from sk...
true
2ccdbe6923b60dfb410faddc129466cab546917c
luzia83/pythonSparkML
/SVMTrainingDataframe.py
UTF-8
668
3.046875
3
[]
no_license
from pyspark.ml.classification import LinearSVC from pyspark.sql import SparkSession if __name__ == "__main__": spark_session = SparkSession\ .builder\ .appName("Spark SVM")\ .getOrCreate() # Loads data dataset = spark_session\ .read\ .format("libsvm")\ .lo...
true
072f56783409ef4da188192b49e7b0969e3fcf1d
liuxingrichu/tools-experiences
/udp_socket/client.py
UTF-8
405
2.6875
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- from socket import * # socket udp client端 HOST = 'localhost' PORT = 9999 server_addr = (HOST, PORT) s = socket(AF_INET, SOCK_DGRAM) s.connect((HOST, PORT)) while True: message = input('Please input messages > ').strip() s.sendto(message.encode(), server_addr) ...
true
8407948c0b4d3f5a3652b2a2c50d7c1d41bdd5b5
gmkerbler/Learn-Python-the-hard-way-Tutorial
/ex11.py
UTF-8
1,175
4.15625
4
[]
no_license
print "How old are you?", #prints the string, then asks for input - can be anything, numbers, letters or combination age = raw_input() print "How tall are you?", #prints the string, then asks for input - can be anything, numbers, letters or combination height = raw_input() print "How much do you weigh?", #prints the st...
true
c3ee1beba44055781f673093538756da9a5147f6
BartoszBiskupski/PyloveProject
/pylove105a.py
UTF-8
2,488
3.328125
3
[]
no_license
import json import os class Czlowiek: bmi = 0 def __init__(self, name, hight, weight): self.name = name self.hight = hight self.weight = weight def speak(self): print("mowie prawde") def count_bmi(self): self.bmi = (self.weight) / ((self.hight / 100) ** 2) ...
true
6d8a5a474cbe2699b9abce164dbc59e440d971ed
victormarit/testTklittleApp
/tk/account/delAccount.py
UTF-8
2,975
2.703125
3
[]
no_license
import tkinter from tkinter import messagebox from fonctions.fonctionsTk import hashPassword from classes.testNewDBConnection.dbUser import DbUser from classes.testNewDBConnection.dbConsoleCollection import DbConsoleCollection from classes.testNewDBConnection.dbGame import DbGame class DelAccount: def __init__(s...
true
d7a5f0b9eaad59bc7e6952d7e7a3d95d2450391f
SaiSujithReddy/CodePython
/TimeStamp.py
UTF-8
602
3.515625
4
[]
no_license
import time import datetime current_time = time.time() print(current_time) st = datetime.datetime.fromtimestamp(current_time).strftime('%Y-%m-%d %H:%M:%S') print(st) #Calculating 60 days 40 seconds 10 minutes 10 hours before #start_date = datetime.datetime.now() + datetime.timedelta(-60,40,0,0,-10,-10) start_date = ...
true
dff935fc5c2fc7d40c734115f32911f9381eccd8
YooSuhwa/CodingLife
/Baekjoon_Jungol/1644 소수의 연속합.py
UTF-8
1,327
3.828125
4
[]
no_license
''' @ ush 2019/12/27 * 백준 알고리즘 - 1644 소수의 연속합 (https://www.acmicpc.net/problem/1644) * python * 백준 '2003 수들의 합'과 연관 * 1. 주어진 수 이하의 모든 소수를 찾아 primes 리스트에 저장 * 소수 구하는 방법으로 "에라토스테네서의 체" 알고리즘 사용. * 2. pirmes를 바탕으로 연속된 소수의 합으로 나타낼 수 있는 경우의 수를 구함 ''' import math def findPrimes (n): isPrime = [1]*n ...
true
76d37150470af639f1d909acd59eb15af7463cd7
iamprakashom/Udacity-Intro_to_Machine_Learning_Exercise_Practice
/evaluation/evaluate_poi_identifier.py
UTF-8
3,709
3.484375
3
[]
no_license
#!/usr/bin/python """ Starter code for the evaluation mini-project. Start by copying your trained/tested POI identifier from that which you built in the validation mini-project. This is the second step toward building your POI identifier! Start by loading/formatting the data... """ import pickl...
true
a40a666baffe705ca3d2a201577c6345d0088c91
mag389/holbertonschool-machine_learning
/supervised_learning/0x06-keras/4-train.py
UTF-8
884
3.078125
3
[]
no_license
#!/usr/bin/env python3 """ train the new keras model """ import tensorflow.keras as K def train_model(network, data, labels, batch_size, epochs, verbose=True, shuffle=False): """ train with minibatch grad desc network: the model to train data: np.ndarray (m, nx) of input data ...
true
8e3070a065229550327f0ccd2be22476aa9226b9
flame4ost/Python-projects
/§2(33-60)/z33.py
UTF-8
418
3.859375
4
[ "MIT" ]
permissive
import math x = input ("Введіть x: ") x = int(x) y = input ("Введіть y: ") y = int(y) if x>y: print("Минимальное число = ", y) else: print("Минимальное число = ", x) x = input ("Введіть x: ") x = int(x) y = input ("Введіть y: ") y = int(y) if x>y: print("Максимальное число = ", x) else: print("Максимальное число = ",...
true
033587265c474255ada3bf131ef88bb722e8d11e
xiaoxubeii/test-es
/testes/utils.py
UTF-8
924
2.96875
3
[]
no_license
__author__ = 'tardis' from random import Random import random import ConfigParser import sys def random_int(randomlength=8): str = '' chars = '0123456789' length = len(chars) - 1 random = Random() for i in range(randomlength): str += chars[random.randint(0, length)] return int(str) d...
true
ddac506d8bda807a0ae6247c1e3b9b4b3e945ac5
lucasjurado/Curso-em-Video
/Mundo 1/ex040.py
UTF-8
498
4.09375
4
[ "MIT" ]
permissive
salario = float(input('Digite o valor do salário R$ ')) '''new1 = salario * 1.15 new2 = salario * 1.10 if salario <= 1250: print(f'Quem ganhava R$ {salario:.2f} passa a ganhar R$ {new1:.2f} agora.') else: print(f'Quem ganhava R$ {salario:.2f} passa a ganhar R$ {new2:.2f} agora.')''' if salario <= 1250: nov...
true
6859c71647efb5f73b52f24bd5201f0d2854e0be
rbartosinski/Lottery-OOP-System
/app.py
UTF-8
1,145
3.453125
3
[]
no_license
from models.lottery_engine import new_lottery, compare_winners from models.ticket import new_ticket, change_numbers, Ticket, table_of_winners from models.dbconnection import DBconnection db = DBconnection(user='root', password='coderslab', database='LotteryDB') cnx = db.cnx cursor = db.cursor def run_app(): pri...
true
b67a6bfc2329e29b98400d0ccd97330bb1560758
qsyed/python-programs
/web_scraping/guessing_game/csv_scraper.py
UTF-8
1,438
3.359375
3
[]
no_license
import requests from bs4 import BeautifulSoup from time import sleep from random import choice from csv import DictWriter # the first two modules above must be intsalled using pip command # base url base_url = "http://quotes.toscrape.com" def scrap_quotes(): all_quotes = [] # next page; to be add to t...
true
c4981f2cf151924e8d4861076b7c7a15c7770412
skumardotpython/JulyBatch
/WindowsApplication/9Sep19_WindowsAppCanvas.py
UTF-8
256
3.28125
3
[]
no_license
from tkinter import * top = Tk() C = Canvas(top, bg="blue", height=500, width=500) coord = 10, 50, 240, 210 arc = C.create_arc(coord, start=50, extent=300, fill="red") line = C.create_line(10,10,200,200,fill='white') print(coord) C.pack() top.mainloop()
true
b1a2aaa5a3ff7b89efc0dca449e033960b68282f
changhoonhahn/central_quenching
/CenQue/archive/tinker_groupcatalog.py
UTF-8
5,026
2.5625
3
[]
no_license
import numpy as np import pyfits as fits class groupcatalog: # import tinker et al. group catalog def __init__(self): pass def readfile(self, Mrcut=18): if Mrcut == 18: masscut='9.4' elif Mrcut == 19: masscut='9.8' elif Mrcut == 20: ...
true
60280460dd5ca13f31bd983d9319d9365664822e
atkinssamuel/Leetcode
/python/414-third-maximum-number.py
UTF-8
1,236
3.578125
4
[]
no_license
# First pass solution: ''' import numpy as np class Solution(object): def thirdMax(self, nums): """ :type nums: List[int] :rtype: int """ inf = 10000 nums = list(set(nums)) max_elements = np.ones(3) * -inf for i in range(len(nums)): if nu...
true
cc44b19928519b7b454164d3168e0fa4c399095c
chr1043086360/FastAPI_IN_Action
/common/BaseResponse.py
UTF-8
231
2.59375
3
[]
no_license
# 基础返回格式 def BaseResponse(code, msg, data, status=None, err=None): result = { "code": code, "status": status, "msg": msg, "error": err, "data": data } return result
true
d92b74d38826d05324e666d1efe1a0c65784d531
plra/euler
/problems/p100.py
UTF-8
646
2.984375
3
[]
no_license
# minimal b with 2b(b-1) = n(n-1) # solve poly 2b^2 - 2b - n(n-1) = 0 # b = (2 +- sqrt(4 + 8n(n-1))) / 4 # int iff sqrt(4 + 8n(n-1)) = 2sqrt(1 + 2n(n-1)) equiv 2 mod 4 # iff sqrt(1 + 2n(n-1)) equiv 1 mod 4 # list halfdisc = 1^2, 5^2, 9^2, ... # when 2n^2 - 2n + 1 integer? from math import sqrt def P(b, n): return...
true
624d12a7774f99680450230154d7439acc4735c3
qrcline/Computer-Networks
/FTPClient/client.py
UTF-8
5,644
2.953125
3
[]
no_license
#Author: Karl Mazur and Quinton Cline #This is a FTP Client #This file contains code for interfacing with a ftp server #Allows the user to list, RETR and STOR files to ftp server from socket import * from select import * import _thread import sys command="" serverMessage="" #Server name and port to connect to serv...
true
5254ca9eb110dee302fae09255643b43d52ef8f3
meiyalian/VICTweetAnalyzer
/backend/app.py
UTF-8
7,489
2.78125
3
[]
no_license
# Observatory Service # Import framework from flask import Flask import argparse import sys from flask_restful import Resource, Api from dbSetting import * import json app = Flask(__name__) api = Api(app) # calculate pos and neg ratio def calculateRatio(postive, negative): total = postive + negative ...
true