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
32db3e452fb39cc10fd6feb1a179e665c28bb8d5
anandsharma26/Information-Retrieval
/A4_MT19059/question1 .py
UTF-8
5,341
2.8125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[2]: #importing all libraries import os from os import listdir import nltk from nltk.tokenize import RegexpTokenizer from collections import defaultdict import string import re from nltk.stem import PorterStemmer from nltk.corpus import stopwords from nltk.stem import WordN...
true
a38805adeffa614d5774caf01e59b96dbbd56eee
eilon983/proxyServer
/tests.py
UTF-8
1,357
2.625
3
[]
no_license
import unittest import requests import os import json from collections import Counter class ProxyServerTests(unittest.TestCase): # if you run it via pycharm set env variable SERVER: 127.0.0.1 server = os.environ.get('SERVER', "0.0.0.0") def setUp(self): pass def test_many_ips(self): ...
true
b8a6faf08bace90ec63695916f4781d9effe8b7b
yunyezl/algoitzman
/nahee/DFS&BFS/Q19_연산자 끼워넣기.py
UTF-8
977
3.21875
3
[]
no_license
import sys n = int(input()) num_list = list(map(int, input().split())) add, sub, mul, div = map(int, input().split()) max_n = -sys.maxsize min_n = sys.maxsize # 재귀함수를 이용해서 계속 호출 def dfs(num, i, add, sub, mul, div): global max_n global min_n # 인덱스가 n이 되면 더 이상 num_list에 값 없으므로 그때의 num들 값 중 max, min 찾음 i...
true
d30aa6c2fb09faae3f0f98fb86361b72a692a4e7
matheusfelipeog/uri-judge
/categorias/iniciante/uri1074.py
UTF-8
446
3.671875
4
[]
no_license
# -*- coding: utf-8 -*- n = int(input()) i = 0 while True: valor = int(input()) if valor % 2 == 0 and valor > 0: print('EVEN POSITIVE') elif valor % 2 == 0 and valor < 0: print('EVEN NEGATIVE') elif valor % 2 != 0 and valor > 0: print('ODD POSITIVE') elif valor % 2 != 0 a...
true
9269262d86e559dcd86e5f4600f75eb607ffd493
ahwohwoh/A-small-CNN-from-scratch
/layers.py
UTF-8
18,601
3.125
3
[]
no_license
""" change log: - Version 1: change the out_grads of `backward` function of `ReLU` layer into inputs_grads instead of in_grads """ import numpy as np from utils.tools import * class Layer(object): """ """ def __init__(self, name): """Initialization""" self.name = name self.tr...
true
69b540e88b6c692274df9bcd5a00e9df652ca4a9
duncanf95/unit-tester
/Main.py
UTF-8
7,165
3.171875
3
[]
no_license
import xlsxwriter import os import copy class Py_Line_Reader(): def __init__(self): self.line = '' self.cur_class = '' def set_line(self, line): self.line = line def get_line(self): return self.py_file def get_class_name(self): start = 0 ...
true
eed8307140bc823f430f22435df4cca06fef8514
m-sathya-reddy/DataStructuresAlgorithmsPython
/lastmile/leetcode/biweekly/29/LongestSubarrayOf1AfterDeletingOneElement.py
UTF-8
812
3.6875
4
[]
no_license
from typing import List class LongestSubarrayOf1AfterDeletingOneElement: def longestSubarray(self, nums: List[int]) -> int: ws = 0 N = len(nums) zero_count = 0 max_ones = -1 for we in range(N): if nums[we] == 0: zero_count += 1 while ...
true
d69d012797b2661707f72db49694bd453fa368cf
lancelafontaine/coding-challenges
/hackerrank/algorithms/01-warmup/time-conversion/python3/time-conversion.py
UTF-8
505
3.328125
3
[]
no_license
#!/bin/python3 import sys time = input().strip() def time_conversion(time): am_or_pm = time[-2:].lower() time = time[:-2] hour = time[:2] if am_or_pm == "am": if hour == "12": return "00" + time[2:] return time if am_or_pm == "pm": if hour == "12": ...
true
d86a62bd15ca5e05f851d667cc9e81cd145dca7b
nancychien/Text_Cleaning
/Text_Cleaning.py
UTF-8
1,786
3
3
[]
no_license
#This Program is for Python 2.7 version import nltk import string import glob import os from nltk.tokenize import RegexpTokenizer outputPath = "" fileCnt = 0 tokenizer = RegexpTokenizer(r'\w+') stopWords = set(nltk.corpus.stopwords.words('english')) #Customized stop words (lower case) cuStopWords = {'court','...
true
d69ad19d388669cfbe39cffdc6744ee539eb9456
nag92/strokeRehabSystem
/src/games/maze/collision_test.py
UTF-8
3,381
2.875
3
[]
no_license
#!/usr/bin/env python import pygame from pygame.locals import * import maze_helper import mazeBank from nav_msgs.msg import OccupancyGrid,Path from geometry_msgs.msg import Pose,Point import random # Colors for use throughout RED = (255,0,0) GREEN = (0,255,0) BLUE = (0,0,255) DARK_BLUE = (0,0,128) WHITE = (255,255,255...
true
2c3bed8805f23dac4ab4724994a5e008d968c394
JSilverio1997/Python_Agenda_Contatos
/Actions_CRUD/ContactHistoric.py
UTF-8
1,735
3.0625
3
[]
no_license
import tkinter.messagebox from Database.ConnectionDatabase import ConnectionDataBase class ContactHistoric(ConnectionDataBase): def search_contact_historic(self, id_login, name): try: self.open_connection() sql = f"select nome, numero_principal, numero_secundario, status_contato, ...
true
a6a64e564a0fae87305bf6b01b755eb5524bc605
gharnab/FACE-DETECT
/collect data.py
UTF-8
1,047
2.75
3
[]
no_license
import cv2 import urllib import numpy as np face_data=r"haarcascade_frontalface_default.xml" classifier=cv2.CascadeClassifier(face_data) url = "http://192.168.43.97:8080/shot.jpg" data = [] while len(data)<100: image_from_url=urllib.request.urlopen(url) frame=np.array(bytearray(image_from_url.read()),np.uint8...
true
ab1acc65884f44c3d2d16fefde75a249a8dedcab
gregoriusdev/Infopub_Pandas_okkam76
/part4/4.12_matplotlib_color.py
UTF-8
316
3.03125
3
[]
no_license
# -*- coding: utf-8 -*- # 라이브러리 불러오기 import matplotlib # 컬러 정보를 담을 빈 딕셔너리 생성 colors={} # 컬러 이름과 헥사코드 확인하여 딕셔서리에 입력 for name, hex in matplotlib.colors.cnames.items(): colors[name] = hex # 딕셔너리 출력 print(colors)
true
424c15f26feb68cff293e40bda4a48821b1ac382
sambadbidari/AI-Project
/ploot.py
UTF-8
273
2.75
3
[]
no_license
import matplotlib.pyplot as plt def plut(generation, score): #X = [] #generation #Y = [] #score plt.scatter(generation, score) plt.plot(generation, score, '.r-') plt.title('Graph between generation and score') plt.show() plt.savefig('plot.png')
true
caf48f4d2036c88160a86951ab741a3d4075fef7
Taoge123/OptimizedLeetcode
/LeetcodeNew/python2/LC_1538.py
UTF-8
1,466
3.765625
4
[]
no_license
# """ # This is the ArrayReader's API interface. # You should not implement it, or speculate about its implementation # """ # class ArrayReader(object): # # Compares 4 different elements in the array # # return 4 if the values of the 4 elements are the same (0 or 1). # # return 2 if three elements have a value equal...
true
2c8eaa4fb41080c4984d391b576067e7eb5c76d7
saraponton/Homework
/recapexercise3.py
UTF-8
292
3.828125
4
[]
no_license
# generate 100 numbers, print only the prime ones import random x=0 while (x<100): for x in range(100): value = random.randint(1,1000) for i in range(2, value // 2): if value % i == 0: exit() print("The number", value, "is prime")
true
9ceec16ae7454a161ffb12dad5669afb6b2a4701
emmaggie/BioinformaticAlgorithms
/patternCount.py
UTF-8
5,545
2.953125
3
[]
no_license
import utilities, math, cProfile, timeit import numpy as np def patternCount(text, pattern): '''Input: text: a long string, e.g. genome sequence pattern: a short string, e.g. motif Output: count of <pattern> occurrences in <text> ''' count = 0 for idx in range(...
true
a1e5482e47a6417055febfbb214a313ab192938e
shubhendukushwah/myRepo
/Problem_37.py
UTF-8
76
2.8125
3
[]
no_license
def genList(): ls = [x*x for x in range(1,21)] print(ls) genList()
true
3e5361d1c87e1ceb9baa2865589b358aba6f065e
WilliamX1/spider-dangdang
/command.py
UTF-8
838
2.625
3
[]
no_license
# coding: UTF-8 import sys import subprocess from importlib import reload reload(sys) cmd = [] # pip install some module module = ["requests", "scrapy", "pymysql", "pymongo", "bson"] for ele in module: cmd.append(''.join(["pip install ", ele])) # Warning: this will overwrite dangdang.csv while certa...
true
e0b8c17ddcaa0687d883fd666790c62d5b78b2ea
heatory/Highload
/python-tcp-game/client.py
UTF-8
502
3.015625
3
[]
no_license
from socket import * host = 'localhost' port = 8089 addr = (host,port) connection = socket(AF_INET, SOCK_STREAM) connection.connect(addr) response = '' while True: if response != 'correct': data = input('Введите число предполагаемое число в формате "guess *Число*": \n').encode() connection.send...
true
ada896493a9a2360d92f7dc3780b4e22e8cbd517
5ji653m6/Python-Learning
/Assignment/assignment_7_1.py
UTF-8
166
3.421875
3
[]
no_license
# Use words.txt as the file name fname = raw_input("Enter file name: ") fh = open(fname) upcs = fh.read() upcs_nonewline = upcs.rstrip().upper() print upcs_nonewline
true
c9072873cddc408b05f4cf2d273685c22bcec8f9
davidmcclure/hist-vec
/bin/train-model.py
UTF-8
1,656
2.609375
3
[]
no_license
#!/usr/bin/env python import click import logging import os import math from shutil import copyfile from hist_vec.utils import scan_paths from hist_vec.corpus import BPOCorpus, BookCorpus logging.basicConfig(level=logging.INFO) @click.group() def cli(): pass @cli.command() @click.argument('corpus_dir') @c...
true
98a326f709654f9b152ff84e4fb671d91ea193c8
cbelden/has-cals-iphone-shipped
/has_it_shipped.py
UTF-8
2,161
2.65625
3
[]
no_license
from flask import Flask, render_template import redis from bs4 import BeautifulSoup from datetime import datetime import urllib2 import hashlib import os # In-memory store redis_url = os.getenv('REDISTOGO_URL', 'redis://localhost:6379') redis = redis.from_url(redis_url) app = Flask(__name__) @app.route('/') def i...
true
48e18e169109917a093e98318e318554c89be9aa
cna274/Python_Codes
/CountWordsInFile/print_words.py
UTF-8
1,067
3.546875
4
[]
no_license
def print_words(filename): f = open(filename, 'r') texts = f.read() words = (texts.lower()) words = words.split() dict = {} for i in words: if i in dict: dict[i] +=1 else: dict[i] = 1 p = dict.items() p.sort() for i in range(len(p)): pr...
true
537a047d05792040abc85efbc9a83662cdc44d92
EEtoCS2020/CNKICrawler
/spider_paper.py
UTF-8
2,918
2.609375
3
[ "Apache-2.0" ]
permissive
import requests from bs4 import BeautifulSoup import xlwt import re import time headers = { 'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Encoding':'gzip, deflate, sdch', 'Accept-Language':'zh-CN,zh;q=0.8', 'Connection':'keep-alive', 'Host':'www.cnki...
true
692a89124b6346a6a1da1e33247fb0710e62d73c
douglasdl/Python-tkinter
/text4.py
UTF-8
348
3.703125
4
[]
no_license
import tkinter as tk window = tk.Tk() window.title("Teste") text_box = tk.Text() text_box.pack() text_box.insert("1.0", "Hello") # line.character text_box.insert("2.0", "World") text_box.insert("2.0", "\nWorld") text_box.insert(tk.END, "Text in the end.") text_box.insert(tk.END, "\nText in the end (new l...
true
f44ffc79ca4ede822ca0138211396e6aa548731f
derrickweiruluo/OptimizedLeetcode-1
/LeetcodeNew/python2/LC_1254.py
UTF-8
1,586
3.265625
3
[]
no_license
class SolutionTony: def closedIsland(self, grid) -> int: m, n = len(grid), len(grid[0]) res = 0 for i in range(m): for j in range(n): if grid[i][j] != 0: continue if self.dfs(grid, i, j, m, n) == 0: res += 1 ...
true
a942f83040f0eca700713fb9b0e8657fa0dbc05b
okamo-to/FixMatch
/dataset/cifar_change.py
UTF-8
4,819
2.546875
3
[ "MIT" ]
permissive
import logging import math import numpy as np from PIL import Image from torchvision import datasets from torchvision import transforms from pathlib import Path from torch.utils.data import DataLoader, Dataset from .randaugment import RandAugmentMC logger = logging.getLogger(__name__) normal_mean = (0.5, 0.5, 0.5)...
true
ae0fef70c58ed41b73aab567e8167d574ce0cd57
Ritikjaiswal16/PythonAssignment
/Python_Project/Module4/arrange_frequency.py
UTF-8
294
2.8125
3
[]
no_license
a=list(map(int,input().strip().split())) b=set(a) b=list(b) freq=[] for i in b: freq.append(a.count(i)) del a c=[] for i in range(len(b)): m=max(freq) index=freq.index(m) for j in range(m): c.append(b[index]) freq.remove(m) del b[index] print(c)
true
2bd1ec186e894de269fe40a372b9729e19ba4041
wplam107/senate_project
/ec2/app/functions.py
UTF-8
3,276
2.8125
3
[]
no_license
import numpy as np import pandas as pd import pickle import plotly.graph_objects as go import plotly.express as px # Function for filtering senators def sen_by_q(senator_info, party=None, gender=None, state=None): senators = [] if party == None: party = ['R', 'D', 'ID'] if gender == None: ...
true
e8cce68f8d0f2190d799ffb5c5bff040a7d4fe83
biranchinarayanpadhi/Python-workspace
/my-python-workspace/number_conversion.py
UTF-8
550
3.53125
4
[]
no_license
import math while True: response=input('Enter Binary or decimal(B/D) or E for exit') if response.lower()=='b': binary=int(input("Enter the binary number")) decimal,power=0,0 while binary!=0: rem=binary%10 decimal=decimal+(rem*(2**power)) power+=1 ...
true
afe5ea411fb43c9d7d7dcff391c4d463c24c7a17
lbaehren/testing
/python/test_lookup.py
UTF-8
599
3.25
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt ## Compute table values x = np.arange(-10, 10, 0.5) y = np.sin(x) nofPoints = x.size a = np.array ([x,y]) print "-- Size of x =", x.size print "-- Size of y =", y.size print "-- Size of a =", a.size print "-- Shape of a =", a.shape for to_find in (): pos = bi...
true
c201caa924524940a3c64a5cf7f28d27da18c056
MarcosFantastico/Python
/Exercicios/ex039.py
UTF-8
1,394
3.78125
4
[]
no_license
import datetime cores = {'ver': '\033[1;92m', 'am': '\033[1;93m', 'verm': '\033[1;91m', 'lim': '\033[m'} print('{}Alistamento Militar!{}'.format(cores['ver'], cores['lim'])) sex = str(input('Digite o seu sexo: [ F ] / [ M ]: ')) escolha = '' if sex == 'F': print('Olha, pessoas do sexo feminino não precisam fa...
true
c344839548635c09929b03a74185874b26860296
daniel-reich/ubiquitous-fiesta
/X8fNb5EouWxrMMjZL_7.py
UTF-8
148
3.171875
3
[]
no_license
def collatz(num): counter = 0 while num>1: if num%2: num = num *3 + 1 else: num = num/2 counter += 1 return counter
true
b424c358c4c45b67cf02e604be2d66c7677ffbc2
progress0407/python-nadongbin-codingtest
/ndb/lec02_gridy/03_곱_더하기.py
UTF-8
164
2.875
3
[]
no_license
# 02984 S = '02984' # S = '11' result = 0 for s in S: i = int(s) if i <= 1 or result <= 1: result += i else: result *= i print(result)
true
913a7ca0a0648c30574996bc6a8b77beef198855
krl22785/principles
/lab3/problem7.py
UTF-8
697
2.875
3
[]
no_license
import sys import csv from collections import Counter import datetime as dt import dateutil.parser as dparser filename = open(sys.argv[1]) f = csv.reader(filename, delimiter=',') daytime = [] db = {} for line in f: daytime.append(line[1]) if line[0] not in db: db[line[0]] = 1 else: db[line[0]] += 1 min_d...
true
57e252f8de043e73607d73a4660223e4549db951
dncnbuck/python-setup
/foo/lib/tests/test_example.py
UTF-8
349
2.78125
3
[]
no_license
# coding: utf-8 import pytest def setup_module(module): pass class TestExample: @classmethod def setup_class(cls): pass def setup_method(self): pass def test_foo(self): i = 1 assert i == 1 def test_zero_division(self): with pytest.raises(ZeroDivis...
true
d30def40b3348f615d35e75cedece14c75363421
rcorbish/GenePool
/test.py
UTF-8
1,158
2.921875
3
[ "Unlicense" ]
permissive
#!/usr/bin/env python import sys from gene_pool import Chromosone mx = 0 mn = 999999 for _ in range(5000) : d = Chromosone.random( 8 ) mx = max( int(d), mx ) mn = min( int(d), mn ) print( "8 bits", mn, mx ) a = Chromosone( b'111000' ) b = Chromosone( b'101111' ) print( "a & b", a & b ) print( "a | b", ...
true
9035f7aa88c70415dce2d4498fff2f3bbecd47e6
thangarajdeivasikamani/iNeuron_ML
/Week13_Logistics/Logistic-regression_final/Logistic-regression_final/logistic_app.py
UTF-8
2,050
3.03125
3
[]
no_license
from flask import Response from flask import Flask, render_template, request from flask_cors import CORS,cross_origin from logistic_predict import predObj logistic_app = Flask(__name__) app = logistic_app @app.route('/',methods=['GET']) # route to display the home page @cross_origin() def homePage(): return rend...
true
40dae7b5db4705a718c2ea0c8843967a35fa5f49
valevo/v10
/vales_notebooks/nets.py
UTF-8
3,582
2.875
3
[]
no_license
import torch from torch.nn import TransformerEncoder, TransformerEncoderLayer, Embedding, Linear, Softmax, NLLLoss, RNN, Sigmoid # TRANSFORMER ENCODER class LM(torch.nn.Module): def __init__(self, vocab_dim, embed_dim, num_layers=1): super().__init__() self.vocab_dim = vocab_dim s...
true
9ef11075712ee39483dddf062f03eaf22ef7be59
vovanukycc/tch
/python_stepic_org/pie.py
UTF-8
91
3.796875
4
[]
no_license
a = int(input()) b = int(input()) i = 1 while (i%a != 0) or (i%b != 0): i += 1 print(i)
true
62e9fc8097b76894bd25e5c54ec99728712857aa
Aasthaengg/IBMdataset
/Python_codes/p02409/s016914719.py
UTF-8
880
2.9375
3
[]
no_license
a_1= [[0 for i in range(10)] for j in range(3)] a_2= [[0 for i in range(10)] for j in range(3)] a_3= [[0 for i in range(10)] for j in range(3)] a_4= [[0 for i in range(10)] for j in range(3)] def print_ninzu(a): print("",end=" ") print(" ".join(map(str,a[0]))) print("",end=" ") print(" ".join(map(str,a...
true
7f84812682c8d405bb39a31fa5784b9c855b8f69
ujeon9/Baekjoon-Python
/11022.py
UTF-8
205
3.46875
3
[]
no_license
import sys n = int(sys.stdin.readline().rstrip()) for i in range(1, n + 1): a, b = map(int, sys.stdin.readline().rstrip().split()) print("Case #" + str(i) + ":", str(a), "+", str(b), "=", a + b)
true
549ceee8d78f72ca57916550078772858fee4b7c
joerg-schneider/blizz
/src/tutorial/custom_decorators.py
UTF-8
2,042
3.03125
3
[ "MIT" ]
permissive
from typing import Type import numpy as np import pandas as pd import blizz.apply import blizz.check from blizz import Relation, Field def my_custom_apply(relation: Type[Relation], data: pd.DataFrame) -> pd.DataFrame: """ Example of a custom apply – round all Fields defined as floats """ # example use of t...
true
59bbf6785df7ec8a6ba0bbf9ca80950b2b9d67e9
ZBeimnet/competitiveProgramming
/Week-02/Day06/LargestPerimeter.py
UTF-8
436
3.65625
4
[]
no_license
def largest_perimeter(array): array.sort(reverse=True) perimeter = 0 for i in range(len(array) - 2): if array[i] + array[i + 1] > array[i + 2]: if array[i + 1] + array[i + 2] > array[i]: if array[i] + array[i + 2] > array[i + 1]: perimeter = array[i] ...
true
365bebf06134609390f7d5aead8e3e2759633930
Dimipilo92/REST
/Section6/code/app.py
UTF-8
1,176
2.65625
3
[]
no_license
from flask import Flask from flask_restful import Api from flask_jwt import JWT # resource represents whatever our Api handles. # if our Api gets and posts "students" then our Resource will be "students" # create a class that inherits resource so it gets all its properties from security import authenticate, identity ...
true
5b108d254839454c3cbdd95c7a7ede7beb1fdceb
HuangWCW315/exam02
/plot.py
UTF-8
1,164
3.25
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import serial import time serdev = '/dev/ttyACM0' s = serial.Serial(serdev, 115200) data_num_tem = s.readline() data_num = int(data_num_tem) print(data_num) #create vector t = np.arange(0,1,1/data_num) x_p = np.arange(0,1,1/data_num) y_p = np.arange(0,1,1/data_num) z...
true
8e71bfb531d38e1874abcee041755bccc6a1482e
ilyalevushkin/AA
/rk2/laba/main.py
UTF-8
826
3.5
4
[]
no_license
from regular import * from machine import * import time line = str(input("Введите строку: ")) choice = int(input("Выберете способ нахождения факультетов: \n\t1)Регулярные выражения\n\t2)Конечные автоматы\n")) if (choice == 1): start_time = time.process_time() result = regular(line) end_time = time.proce...
true
7e69e56466d7ea29aa32030ef662adbfe6c943ed
lizhengbio/cfWGBS-pipline
/2. DMR_calling/prepare_nm_early_mat.py
UTF-8
2,434
2.640625
3
[ "Apache-2.0" ]
permissive
import time import sys def get_sam_lab_nm_early(file): print(time.asctime( time.localtime(time.time()))+" Start reading from {}".format(file)) normal_samples = [] early_samples = [] with open(file) as f: for line in f: if line.startswith("sample"): continue ...
true
ef60bcc4e3d7dacc4a603d126485d56c90172d40
tlatimer/partCart
/garbageFiller.py
UTF-8
2,136
2.9375
3
[]
no_license
import sqlite3 import random randvendors = ['asdf', 'qwer', 'zxcv', 'wasd'] randletters= ' qwerasdfzxcvtgb '.upper() nums = [500, 5000, 5000] class gf: def __init__(self, filename='partCart2.db'): self.conn = sqlite3.connect(filename) self.conn.row_factory = sqlite3.Row self.c = self.c...
true
f005d68349c0f4b6c13f0aae1fae837741611871
cczhong11/Leetcode-contest-code-downloader
/Questiondir/670.maximum-swap/670.maximum-swap_116783443.py
UTF-8
678
2.890625
3
[]
no_license
class Solution(object): def maximumSwap(self, num): """ :type num: int :rtype: int """ if num == 0: return 0 ln = [] while num > 0: ln.append(num % 10) num /= 10 ln = ln[::-1] tmp = sorted(ln, key=lambda x: -...
true
18604443e3205c9f3f84096fad1e8f05e73be96b
XoriieInpottn/tardataset
/tardataset/entries.py
UTF-8
1,596
2.75
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python3 """ @author: xi """ import argparse import numpy as np from .bsontar import BSONTar def entry_bsontar(): parser = argparse.ArgumentParser() parser.add_argument('input', nargs='?') args = parser.parse_args() print(args.input) with BSONTar(args.input, 'r') as f: ...
true
ffe0b5a4b0ea9e32745212b191eec9237d825c9a
stefan35/8_-_puzzle
/project/moves.py
UTF-8
630
3.40625
3
[]
no_license
#Funkcie na definovanie pohybu konkretnym smerom def moveDown(array): tmp = array.index(0) + 3 zero = array[array.index(0)] array[array.index(0)] = array[tmp] array[tmp] = zero def moveLeft(array): tmp = array.index(0) - 1 zero = array[array.index(0)] array[array.index(0)] = array[tmp] ...
true
65da64a025a2748efd892bccb939bee4065b5073
dduranr/python_crud_mvc
/app/modulos/contactos/formularios/contactos.py
UTF-8
1,561
2.671875
3
[]
no_license
from flask_wtf import FlaskForm from wtforms import StringField, SubmitField from wtforms.validators import DataRequired, Email, Length, ValidationError import phonenumbers class ContactoFormPost(FlaskForm): # Cada variable representa un campo de formulario nombre = StringField("Nombre", validators=[ DataRequired(...
true
b2c1fd3a6e6e533fb25de1d387b8708012a13609
coding-alchemist/data-structure-and-algorithm
/algorithm/2_add_two_numbers.py
UTF-8
1,116
3.453125
3
[]
no_license
from algorithm.model import ListNode class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: head, tail = None, None cf = 0 while l1 is not None or l2 is not None: n1 = 0 if l1 is None else l1.val n2 = 0 if l2 is None else l2.val ...
true
1408f1998f6d2448baa9c531fc13aeeba78df2d4
Shamir-Lab/MONET
/monet/module.py
UTF-8
7,915
2.765625
3
[]
no_license
import time class Module: """ Represents a single module (set of patients and omics). Contains functions to manipulate modules which are used by MONET actions (e.g. split module). """ def __init__(self, glob_var, patients={}, omics={}, weight=0): self.patients = {} s...
true
aed63cf00bfb249c26a4d36ecdf1963e6f73392e
Aphranda/PythonCode
/DataAnalysis/Agent.py
UTF-8
1,461
2.53125
3
[]
no_license
import requests import random class MyResponse(object): def __init__(self, url): self.url = url self.ip = [] def ip_check(self): with open('ip.text', mode='r') as f: a = list() for line in f.readlines(): clear = line.replace('\n', '') ...
true
948556e465234eb4075ac1bbc9efc310a7534c66
vyommartin/AlarmAI
/AlarmAI/takepics.py
UTF-8
812
3.0625
3
[]
no_license
import cv2 import os import time # Get the current working directory cwd = os.getcwd() #creates an object called camera, of type openCV video capture, using the first camera in the list of cameras connected to the computer. def takepic(): camera = cv2.VideoCapture(0) for i in range(30): #tells ...
true
d8e0637c1fc7b5eba4e10991d90cd30ece2e7354
sa-y-an/datasets
/Python files/mse0.py
UTF-8
618
3.296875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Dec 14 09:23:05 2019 @author: user """ import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression n_pts = 100 x = np.linspace(0,10,n_pts) y = 5*x+14 + np.random.uniform(-5,5,n_pts) model = LinearRegression() model.fit(x.reshape(-1,...
true
e7f68e7717adc6b272dee6fecd7389698883364f
GeraltLin/tf_learn
/data_process/CH07_batch_data.py
UTF-8
1,868
3.421875
3
[]
no_license
# encoding: utf-8 ''' @author: linwenxing @contact: linwx.mail@gmail.com ''' """ 最简单的批处理形式是将数据集中的 n 个连续元素堆叠为一个元素。 Dataset.batch() 转换正是这么做的,它与 tf.stack() 运算符具有相同的限制 (被应用于元素的每个组件):即对于每个组件 i,所有元素的张量形状都必须完全相同。 """ import tensorflow as tf inc_dataset = tf.data.Dataset.range(100) dec_dataset = tf.data.Dataset.range(0, -100...
true
e131153e512109c1558308975e5e5f80a07c0f26
gtg944s/conjugate_prior
/conjugate_prior/beta.py
UTF-8
2,419
2.953125
3
[]
no_license
import numpy as np from scipy import stats from scipy import special as fn import collections, itertools from operator import itemgetter as at try: from matplotlib import pyplot as plt except: plt = None class BetaBinomial: __slots__ = ["T", "F"] def __init__(self, *args): if not any(args): ...
true
0bf92a1288d0118ba4fe32123357ebc32f1e32aa
hlthu/PyTorch-Learn
/self-con/self-con.py
UTF-8
5,550
3.359375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Training an image classifier We will do the following steps in order: 1. Load and normalizing the CIFAR10 training and test datasets using ``torchvision`` 2. Define a Convolution Neural Network 3. Define a loss function 4. Train the network on the training data 5. Test the network on the ...
true
23e98e1c7a4cc2ae0ad065f58d64da6131918769
epiphonedan/CEC-Pyhton
/Practica.py
UTF-8
896
3.671875
4
[]
no_license
def isYearLeap(year): if year%4!=0: return False elif year%100!=0: return True elif year%400!=0: return False else: return True def daysInMonth(year,month): if year < 1900 or month < 1 or month > 12: return None days = [31, 28, 31, 30, 31, 30, 31, 31, 30...
true
b2682f47d26cdcd6801a76a6686a1a7346e8f068
MingfengKeith/myrepo
/task1/task13.py
UTF-8
418
3
3
[]
no_license
import pandas as pd #file_path = 'input.txt' file_path = "/home/travis/build/aml-spring-19/homework-1-MingfengKeith/task1/input.txt" data = pd.read_csv(file_path,encoding='utf-16', header=0, na_values=["--","NA"], escapechar = '\\',index_col=0, error_bad_lines = False) def test_input(): assert data.shape[0] == 2...
true
d576d0651bb4552df7f78ae7ef7a51182dd9d73e
jb-liran/Numpy
/scipy/scipy/scipy_stats.py
UTF-8
480
2.71875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 22 08:44:11 2018 @author: liran """ import scipy.stats as stats import numpy as np import matplotlib.pyplot as plt s=np.r_ rv1 = stats.norm() rv2 = stats.norm(2.0,0.8) samp = s[rv1.rvs(size=100), rv2.rvs(size=100)] # Kernel estimate ...
true
bfb5ca0499d2580c7e3cadc363da953844400a90
fteufel/master-thesis
/perplexity_experiments/retrain_lm_udsmprot/convert_data.py
UTF-8
14,526
2.90625
3
[]
no_license
''' Convert data from my format to the one used in udsmprot (.npy files) ''' import numpy as np import pandas as pd from tape import TAPETokenizer import os import argparse from pathlib import Path from tqdm import tqdm from collections import Counter, defaultdict def list_tokenizer(seq): '''default tokenizer ju...
true
22e894a1f8f6b0688600c14b1648851b8b21a03d
Bertik23/evo2
/evo.py
UTF-8
4,607
2.84375
3
[]
no_license
import pygame as pg from random import randint screenSize = (500,500) class Blob: def __init__(self, x, y, speed, food, sense, radius, mutation): self.x = x self.y = y self.speed = speed self.food = food self.energy = 1 self.senseRange = sense self.drawRadiu...
true
d76675fe4c48aee9282fbbfa6c76727d3e452de9
ryan-way-leetcode/hackerrank
/implementation/sock-merchant/executable.py
UTF-8
324
3.03125
3
[]
no_license
#!/bin/python3 import sys def sockMerchant(n, ar): counter_list = [0] * 101 for item in ar: counter_list[item] = counter_list[item] + 1 return sum([int(s/2) for s in counter_list]) n = int(input().strip()) ar = list(map(int, input().strip().split(' '))) result = sockMerchant(n, ar) print(res...
true
fcd31b50e499048b88511dba4c520844a1b7c41d
eduardogpg/dtranslate
/AWS/subtitle.py
UTF-8
5,836
2.8125
3
[]
no_license
import json import logging from pathlib import Path from datetime import datetime from datetime import timedelta from .common import put_file from .common import read_content from .common import get_seconds_duration from .translate import translate SUBTITLE_TEMPLATE = """{line} {start_time} --> {end_time} {sentence...
true
47b884b1cfc50f900e3333fe13b2885f9a6f4e9d
ftakanashi/wyz_mttool_scripts
/for_interpretor/analyze_excel.py
UTF-8
290
2.71875
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- import xlrd import sys fn = sys.argv[1] idx = int(sys.argv[2]) wk = xlrd.open_workbook(fn, 'r') st = wk.sheet_by_index(idx) for i in range(st.nrows): values = st.row_values(i) print('|{}|'.format('|'.join([str(v) for v in values])))
true
8055254d2df2d14db390c71c934b1f2c04d45855
gacooney/eia_trading
/network_connections.py
UTF-8
4,756
2.6875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jan 26 14:21:33 2019 @author: cooneyg """ # -*- coding: utf-8 -*- """ Created on Sat Jan 26 14:26:01 2019 @author: cooneyg """ import pandas as pd import eia BAA = 'PJM' BAA = ['PJM'] * 4 print(BAA) data = {'BAA': BAA, 'primary': [3, 2, 1, 0], 'secondary': ['a', 'b', 'c'...
true
3ff0d2b20ff377173cf9616cc03f2b29db441056
HeesooSong/Bachelors_Project
/redistribution_after_manual.py
UTF-8
1,143
2.65625
3
[]
no_license
import pandas as pd import shutil data = pd.read_excel('/home/ba4_project/ba4_Hee/Trypanosome/Prediction4_2_AL3.xlsx', sheet_name='Random') print('Dataframe created') row = 0 for image in data.Image: if data.Check[row] == "T": if data.Class[row] == "pos": dstn_path = '/home/ba4_proje...
true
1c1fab3ee1e0535e6191a801fb3b01af54e72881
efajunk/specialist
/Python 1/Day 5/Examples/string_addon.py
UTF-8
975
3.90625
4
[]
no_license
import string # # data = input('Enter a string: ') # # ## Разделение по любой строке # # result = data.split('aaa', 2) # # print(*result) # # # # ## Удаляем пробельные символы в начале и в конце строки # print('start:', data.strip(), 'finish') # # # # ## Удаляем пробельные символы только в начале строки # print('s...
true
f43d9af59d12632895f06551647d8f089c7a440f
GiovanniGabbolini/ipsim
/src/data/genres_ancestor_wikidata.py
UTF-8
2,482
2.875
3
[]
no_license
''' Created on Thu Jan 30 2020 @author Giovanni Gabbolini ''' from src.sparql.query_sparql_wikidata import query_sparql import sys import numpy as np import logging from tqdm import tqdm from src.data.data import preprocessed_dataset_path def build_genres_ancestor_wikidata_dict(): """Construct the wikidata genr...
true
26012a273ebb2a2c14e257f7d9984fb46b252dad
Stargrazer82301/CAAPR
/CAAPR/CAAPR_AstroMagic/PTS/pts/core/basics/vpn.py
UTF-8
4,264
2.71875
3
[ "GPL-1.0-or-later", "AGPL-3.0-only", "AGPL-3.0-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-philippe-de-muyter", "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** ##...
true
986f7338e7ff2524bed965f32754add25da93c0f
MrDerden/python-ape
/lesson13.py
UTF-8
1,405
3.625
4
[]
no_license
#kalendarz ''' calendar = [ {'what': 'clean dishes', 'when': 'monday'} ] todo = '' while todo != 'q': todo = input('what would you like to do? [add]/[show day]/[q]') if todo == 'add': calendar.append({'what': input('What?'), 'when': input('When?')}) elif todo == 'show day': the_day = input('What day? ') fo...
true
4c0ecf8569153aaabcd600254bda33acf8629b99
Simon2591990/PokeCenter
/models/pokemon.py
UTF-8
389
2.765625
3
[]
no_license
class Pokemon: def __init__(self, nickname, species, type, dob, trainer, status, id = None): self.nickname = nickname self.species = species self.type = type self.dob = dob self.trainer = trainer self.status = status self.id = id self.nurse = None ...
true
2cf469b1e704decb7004299f57a92cd6f74e80aa
gilberto233/LeetCode_Learning
/Remove Element/init.py
UTF-8
360
3.0625
3
[]
no_license
class Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ tag = 0 for index in range( len( nums ) ): if not nums[ index ] == val: nums[ tag ] = nums[ index ] ...
true
61cc9274b1987f07d1700d3ad43e1202017cc84f
zhangzhongyang0521/python-basic
/python-basic/data-type-example.py
UTF-8
783
3.515625
4
[ "Apache-2.0" ]
permissive
# 模拟手机充值场景 money = int(input("欢迎使用手机充值,请输入需要充值的金额:")) print("已成功充值" + str(money)) # 打印石头怪 print(2 * ' ' + 5 * '*' + 2 * ' ') print(' ' + '*' + 5 * ' ' + ' ' + '*') print('*' + 2 * ' ' + '@' + 3 * ' ' + '@' + 2 * ' ' + '*') print('*' + 7 * ' ' + '*') print('*' + 3 * ' ' + '@' + 3 * ' ' + '*') print('*' + 7 * ' ' + '*')...
true
a44c8217de84be5a2cde2d8cb88664e31fd2bde1
puttasaipranav/Data-Science
/Ch2.py
UTF-8
1,288
4.65625
5
[]
no_license
#string creation stri='Hello "python" world' #if you want specify with hifens inside the statement which u are printing long_string='''By giving three hifens, we can able to type more than one line''' print(stri) # There is also a method to convert any type of variable into string i.e, "str"--> Method name #Example m...
true
6ded6cd5cc74a4e30761ceb42c16e3061c9a624b
DerekSomerville/FakePythonGuessNumber
/src/main/python/ReadFromFile.py
UTF-8
238
2.90625
3
[]
no_license
class ReadFromFile: def read(self, fileName): filePath = "src/main/resources/" + fileName openFile = open(filePath,"r") fileData = openFile.read().splitlines() openFile.close() return fileData
true
78c2b457704c3d843f7252b53c164155348fb576
Juyoung4/StudyAlgorithm
/COS_PRO/3차/9_팝업스토어.py
UTF-8
520
3.671875
4
[]
no_license
# 팝업 스토어를 열 최적의 날짜 def solution(revenue, k) : answer = 0 rsum = sum(revenue[0:k]) answer = rsum for i in range(k, len(revenue)) : rsum = rsum - revenue[i - k] + revenue[i] if answer < rsum : answer = rsum return answer revenue1 = [1, 1, 9, 3, 7, 6, 5, 10] k1 = 4 ret1 = solution(revenue1, k1) print("soluti...
true
93b7eda53e49af1fac3e2c94fa96779b61356ed5
addriango/curso-python
/sintaxis-basica/13.range.py
UTF-8
224
3.59375
4
[]
no_license
for i in range(5): print(f"valor de la variable {i}") print("") for i in range(5,10): print(f"valor de la variable {i}") print("") for i in range(10,20,2): print(f"valor de la variable {i}")
true
6700ddae124849bd9362f3dc5d3a5c69a181c3bf
michaelvdow/RepetitionCounting
/ThresholdCrossing.py
UTF-8
3,199
2.875
3
[]
no_license
import urllib import matplotlib.pyplot as plt import csv import sys from math import * from matplotlib import * import numpy as np from scipy import * import scipy.signal as signal import scipy.ndimage as ndimage import matplotlib.pyplot as mp import time as tm get_ipython().magic(u'matplotlib inline') def zero_cross...
true
7fd2220fdc372468191d409077472b1bbd02e477
ahao214/RookieForPython
/eight/8.05.py
UTF-8
523
3.53125
4
[]
no_license
class MyClass: def method1(self): print("method1") def default(self): print("method2") my = MyClass() #判断method1是否在my中存在 if hasattr(my, 'method1'): my.method1() else: print("method1方法不存在") # 判断method2是否在my中存在 if hasattr(my, 'method2'): my.method2() else: print("method2方法不存在") ...
true
665f0be66a817bd1312301e5011d305a47161101
RoyLizhiyu/Leetocde
/206. Reverse Linked List.py
UTF-8
584
2.78125
3
[]
no_license
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int val) { this.val = val; } * ListNode(int val, ListNode next) { this.val = val; this.next = next; } * } */ class Solution { public ListNode reverseList(ListNode he...
true
2b8b81f62b6b300c98b86e8d0c89674e73b618ad
ArtemU1453/Find
/main.py
UTF-8
598
3.84375
4
[]
no_license
greeting = "Hello world" def find(sourceStr, subStr): sourceLength = len(sourceStr) substrLength = len(subStr) result = -1 i = 0 matches = False while i < sourceLength: matches = False j = 0 while j < substrLength: if sourceStr[i + j] == s...
true
9b320a2e921a50b64c23445137b323e27ac63095
waterzxj/jianweiSpider
/jianwei_plot.py
UTF-8
2,675
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- """ @author: ziyubiti @site: http://ziyubiti.github.io @date: 20150908 """ import matplotlib.pyplot as plt import numpy as np from jianwei_wangqian import * def read_data_from_mysql(conn): cursor = conn.cursor() # day cursor.execute('select * from jianwei_trades_perday') ...
true
cf78a3e2d75e0f21ea0f8b63b72834a384bb6d57
Daherson/Homework
/HomeW8/ex3p8.py
UTF-8
1,219
3.890625
4
[]
no_license
""" class ExeptElements: @staticmethod def exeptic(): new_list = [] while True: user_answ = input("Input a number: ") try: if user_answ == "stop": print(new_list) break if user_answ is int or user_ans...
true
5a3412c9ea8a0f02659d53fb076af3084d6ed972
s3cret/py-basic
/function/decorator1.py
UTF-8
366
3.15625
3
[]
no_license
def log(text): def decorator(func): def wrapper(*args, **kw): print('%s %s():' % (text, func.__name__)) wrapper.__name__ = func.__name__ return func(*args, **kw) return wrapper return decorator @log('call') def out(): print('here is the function') pri...
true
d2d3fdfcd5c8ad63891a429c0fb761df068f1da0
pedrosouzax/linear_regression
/LinearRegression.py
UTF-8
460
2.984375
3
[]
no_license
import numpy as np class LinearRegression: def __init__(self, x, y): self.x = x self.y = y self.theta = None def fit(self): X = self.x Y = self.y # self.theta = np.linalg.inv(X.dot(np.transpose(X))).dot(np.transpose(X)).dot(Y)) self.theta = np.linalg.inv...
true
8a24dad7fd1993d0e8fbdacaaee530770938554b
feiyu563/feiyu
/python_spider_basics/urllib2_spider2_post_get.py
UTF-8
1,263
2.8125
3
[]
no_license
#coding=utf8 ''' urllib2库post and get ''' import urllib import urllib2 #post方法 #---------------------------------------------- key={"name":"admin","password":"511zjk","autologin":0,"enter":"Sign in"}#登录参数 data=urllib.urlencode(key) #格式化字符串为 name=admin&password=511zjk。。。。。 url="http://172.16.15.140/zabbix/in...
true
495880a81022e6376c0ff4075e384a46d102ebc3
nakamarusun/TA-stuff
/Guessing Game/compact_one.py
UTF-8
481
4.125
4
[]
no_license
import random rand = random.randint(1, 100) print("Welcome to guessing game v1.0 !") while (True): guess: str = input("Input a number: ") if (not guess.isnumeric()): print("Please enter a valid number.") continue guess = int(guess) if (guess > rand): print("Number too high. ...
true
73ed811f06a0ff6e0790f33c723c936714c315ff
Trip4077/Intro-Python-I
/src/14_cal.py
UTF-8
1,943
4.15625
4
[]
no_license
""" The Python standard library's 'calendar' module allows you to render a calendar to your terminal. https://docs.python.org/3.6/library/calendar.html Write a program that accepts user input of the form `14_cal.py month [year]` and does the following: - If the user doesn't specify any input, your program should ...
true
2d90d5636c52722ac412ecd40aa549a04118f887
IgnatIvanov/Key-Terms-Extraction_JetBrainsAcademy
/Topics/Loop control statements/Vowels and consonants/main.py
UTF-8
228
3.96875
4
[]
no_license
in_string = str(input()) for letter in in_string: if not letter.isalpha(): break else: if letter in ['a', 'e', 'i', 'o', 'u', 'y']: print('vowel') else: print('consonant')
true
c6a6b0d49e3f4cd6254994cc369c57da6f06f8ae
combe15/Raphael-Bot
/cogs/commands/stocks.py
UTF-8
24,864
2.515625
3
[ "MIT" ]
permissive
import asyncio import functools import logging import math import discord from discord.ext import commands from discord.ext.commands import Cog, Bot, Context, BucketType import requests import dataset from tools import embeds, database, record from tools.bank import Bank import constants from tools.pagination import ...
true
3bc385e322a028cff94997320567dcbae7d5b394
dudu9999/Exerc-cio_de_casa_01
/Exercicio 07.py
UTF-8
723
4.28125
4
[]
no_license
# 7 - Ler 3 números e imprimi-los em ordem crescente. n1, n2, n3 = 0, 0, 0 n1 = int(input("1 - Digite um numero: ")) n2 = int(input("2 - Digite um numero: ")) n3 = int(input("3 - Digite um numero: ")) # 2 3 1 #n1 n2 n3 if (n1<n2) and (n2<n3) and (n1<n3): print("Em ordem crescente ",n1," ",n2," ",n3) elif (n1<n2...
true
4e3564fcb2421da74121e9908e7879561c6fabcf
bckr2549/OpenCV
/smoothing.py
UTF-8
406
2.796875
3
[]
no_license
import cv2 img = cv2.imread('photoes/lady.jpg') cv2.imshow('Lady', img) #averaging average = cv2.cv2.blur(img, (7,7)) cv2.imshow('Average_Blur', average) gauss = cv2.GaussianBlur(img, (7,7),0) cv2.imshow('Gaussian Blur',gauss ) median = cv2.medianBlur(img, 7) cv2.imshow('Median', median) bilateral = c...
true
24d8d52f803defb9d31bbced17e68d1c7c3f96f1
SimonMcLain/ProgrammingandScriptingGMIT
/Exercise_1_and_2_v1.0.py
UTF-8
1,977
4.53125
5
[ "Apache-2.0" ]
permissive
# Simon McLain, edited from a script created by Ian McLoughlin on 2018-02-12: # https://github.com/ianmcloughlin/python-fib/blob/master/fibname.py # Week 1 exercise 1: """Calculate the nth Fibonacci number where n the sum of the first and last letters of your first name as numbers. and post on the discussion forum: ...
true
bcd84eddded422c19105d9cb27dda568826f1571
happy-yu1/PythonProjects
/第2章Python高级/第三部分/py_31 多进程输出素数.py
UTF-8
888
2.96875
3
[]
no_license
from multiprocessing import Process import time import os def func1(n): # 判断某个数是否为素数 for x in range(2, n): if n % x == 0: return False else: return True def func2(): for n in range(3, 1001): if func1(n): print('%d:%d是素数' % (os.getpid(),n)) #得到进城编码 ...
true