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
2a2993b497b411f164151e16a0c32f75f5183674
ymli1997/deeplearning-notes
/python-learning/libraries/matplotlib-learning/plot-demo.py
UTF-8
212
2.734375
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- ''' 简单绘制 ''' import numpy as np import matplotlib.pyplot as plt x = np.linspace(0,2 * np.pi,32) fig = plt.figure() plt.plot(x,np.sin(x)) plt.show() plt.savefig('temp/sing.png')
true
6ad5918770ed8883723a1256cff6eaab7a0f57ce
airakesh/interviewbits
/strings/reverse_the_string.py
UTF-8
905
4.28125
4
[]
no_license
''' Given a string A. Return the string A after reversing the string word by word. NOTE: A sequence of non-space characters constitutes a word. Your reversed string should not contain leading or trailing spaces, even if it is present in the input string. If there are multiple spaces between words, reduce them to a...
true
f41ca08a989bc0d45cb50ff56e4692fb6af502f7
Murali1125/Fellowship_programs
/DataStructurePrograms/Hashing_function.py
UTF-8
4,120
4.6875
5
[]
no_license
"""-------------------------------------------------------------------------- -->Create a Slot of 10 to store Chain of Numbers that belong to each Slot --to efficiently search a number from a given set of number -->Logic -> Firstly store the numbers in the Slot. Since there are 10 Numbers --divide each number by 11 and...
true
a3124a1e57e0604ccf3b84d9323422c19a75e48f
alexandraback/datacollection
/solutions_5709773144064000_1/Python/aromo/B.py
UTF-8
1,345
3.21875
3
[]
no_license
#!/usr/bin/python """ template.py input-file > output-file""" import sys from numpy import * sys.setrecursionlimit(10000) def input_words(): line = IN.readline() return line.strip().split() def input_ints(): return map(int, input_words()) def input_floats(): return map(float, input_words()) def fo...
true
524ad5c2b77d450dcb23b953b65b0a5184e5e000
untilyou58/ML-training
/day6_SVm/day6_SVM_VN.py
UTF-8
4,174
2.78125
3
[]
no_license
# from __future__ import print_function # import numpy as np # import matplotlib.pyplot as plt # from scipy.spatial.distance import cdist # np.random.seed(22) # means = [[2, 2], [4, 2]] # cov = [[.3, .2], [.2, .3]] # N = 10 # X0 = np.random.multivariate_normal(means[0], cov, N) # class 1 # X1 = np.random.multivariate...
true
2ef5ba29c94830899b6b224146878e3b98c8eae2
mrluanma/tornado_gunicorn_nginx_heroku
/hello_world.py
UTF-8
271
2.59375
3
[ "MIT" ]
permissive
import os import tornado.web pid = os.getpid() class MainHandler(tornado.web.RequestHandler): def get(self): print("Hello, world!", file=self) print("Process ID: %s" % pid, file=self) application = tornado.web.Application([("/", MainHandler)])
true
1e2aaa254683ad60782fad95fba2b090ad781acc
paramita1024/demarcation
/src2/create_synthetic_data.py
UTF-8
3,943
2.578125
3
[ "MIT" ]
permissive
import numpy as np import numpy.random as rnd from math import ceil import pickle class create_synthetic_data: def __init__(self, num_node = 0 , frac_sparse = 0 , start_time = 0 , end_time = 0, num_msg = 0 ): self.num_node = num_node self.nodes = np.arange(self.num_node) self.frac_sparse = frac_sparse self.n...
true
036636b7b0891ee9f9de63431221e5ca58a964ba
jedzej/tietopythontraining-basic
/students/BRACH_Jakub/lesson_01_basics/L01P06_Desks.py
UTF-8
875
3.78125
4
[]
no_license
#!/usr/bin/env python3 desk_capacity = int(2) total = 0 def desks_needed(stud_num): whole = int(stud_num / desk_capacity) left = int(stud_num % desk_capacity) if(left!=0): whole = whole + 1 return whole; #print('Enter the number of students in group a') students_a = int(input()) #print('Enter the num...
true
d834cebb95ee56b6f34695ee21b2b014b1d8e33c
KaiHangYang/calMethod
/ImageResize/tool_cv2.py
UTF-8
3,608
2.921875
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- # ---------Edit By KaiHangYang---------- # -------------2015,04,04--------------- #import cv import cv2 import numpy as np import math from getVal import ( linear, cubic, ) import time # 目前两个版本只是针对于RGB三通道图片进行的处理扩展起来还是很容易的 # 对于1 ~ 3倍之内的图片放大和缩小建议使用双线性内差值法 # 效果和三次卷积法差...
true
2b34aaa1258911c568b8abd0b374ffc3acccce0a
fitimkuis/PythonProject
/scripts/CompareImages.py
UTF-8
587
2.859375
3
[]
no_license
import cv2 from PIL import Image import numpy as np def comp_images(a, b): img1=cv2.imread(a) img2=cv2.imread(b) difference = cv2.subtract(img1,img2) result = not np.any(difference)#if diff is all zeros it will return False if result == True: return "The images are same" else: ...
true
fc4712e2d1b56a85d14e4a26b64e40b885ea873b
LucaBergo/battaglia-navale
/battaglia.py
UTF-8
1,649
2.921875
3
[]
no_license
import requests from random import randint import time #manca aggiunge riposo ogni 3 secondi per evitare di perdere colpi con funzione time.sleep(3) a=requests.post("http://192.168.1.231:8000/signup", json= {"name": "VT"}).json() #accreditamento print(a) #printi per vedere se ti ha registrato c=re...
true
63b1a5834983045d506f529d78aae74dcc3a9899
fb/pyWaveBuddy
/openvario.py
UTF-8
851
3.46875
3
[]
no_license
""" input is an NMEA sentence including the leading '$' and excluding '*' example: an input of "$POV,P,1018.35" will return "$POV,P,1018.35*39" """ def nmea_csum(input): csum = 0 for c in input[1:]: csum ^= ord(c) return input + "*{:02x}".format(csum) def make_pov(lst): return nmea_csum("$PO...
true
e109612db81b6259620b1a5beea4d2c4535fbb84
oroyeo/OOD_assignment_2
/test_podcast.py
UTF-8
8,369
3.0625
3
[]
no_license
import unittest import datetime from podcast import Podcast from audio_file import AudioFile import inspect class TestPodcast(unittest.TestCase): """A class that holds the tests to be run Roy Ortega - A01078553 ACIT 2515 - Set B February 13, 2020 """ def setUp(self): """S...
true
e3a4240bd9b911ad2d5bbbacbb05675dd8cae3e4
Park-Ji-Yoon/Algorithm
/파이썬 알고리즘 인터뷰/chapter07/09_세 수의 합_brute-force.py
UTF-8
568
3.140625
3
[]
no_license
def threeSum(nums): result = [] nums.sort() # 오름차순 정렬 for i in range(len(nums) - 2): # 중복된 값 건너뛰기 if 0 < i and nums[i] == nums[i-1]: continue for j in range(i+1, len(nums) - 1): if i + 1 < j and nums[j] == nums[j-1]: continue for k in range(j+1, len(nums)): ...
true
e18b1ed45e5359a4160f448bddae840ac25cd70d
mammadov7/Project_Euler
/ex5.py
UTF-8
444
3.21875
3
[]
no_license
import math def nok( x , y ): rang, i = x, 2 if rang > y: rang = y while i <= rang : if x % i == 0 and y % i == 0: x /= i y /= i i -= 1 i += 1 return x t = int(input()) for a0 in range(t): multiple=1 n = int(input()) f...
true
c1ac22ad6428baaeee2ab24aab79515e445d77e6
fanfom/Fish
/Milk.py
UTF-8
3,039
2.703125
3
[]
no_license
import logging import time from pynput import mouse import serial from numpy import * import cv2 from PIL import ImageOps, Image, ImageGrab, ImageChops from matplotlib import pyplot as plt def get_active_window(): """ Get the currently active window. Returns ------- string : Name of the c...
true
37cb013a130d5ddd142aeb12d0af7b11cf0eb20f
anupandey/Info_202
/Pandey_Anu_course_retreival-main.py
UTF-8
8,836
3.078125
3
[]
no_license
import numpy as np import pandas as pd import nltk import matplotlib.pyplot as plt from sklearn import feature_extraction from nltk import NaiveBayesClassifier from nltk.tokenize import word_tokenize from itertools import chain from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selectio...
true
33b79ba8a72ec929f090287118f4c246cc0af17c
brentshermana/CompetativeProgramming
/src/puzzles/InterviewKickstart/graphs/string-transformation-using-dictionary.py
UTF-8
1,683
3.71875
4
[]
no_license
# given an array of strings, return an array of strings # representing the transformation from a start word # to a stop word by changing only one character at a time # and ensuring all intermediate words are in dictionary # make sure the path is as short as possible # assume all strings are equal length. The dictiona...
true
7587b23b947a11a360183fb4c61ac658f10a2f76
Rishabh-Jain21/Zip-Cracker
/crack.py
UTF-8
1,576
2.984375
3
[]
no_license
import zipfile from threading import Thread import argparse import os if not os.path.exists(os.path.join('passwords.txt')): with open("passwords.txt", 'w') as f: pass def extract_zip(orignal_file_path, extract_file_path, zfile, password): extract_file_name = os.path.splitext(extract_file_path)[0] ...
true
7b9359099f27dc2056447b688eb9cc121e3a281e
marcosmagno/compiler
/syntactic/run.py
UTF-8
744
2.796875
3
[]
no_license
from lexer import Lexer from parser import Parser import argparse __author__ = "Marcos Magno de Carvalho" class RunSyntatic(object): """docstring for ClassName""" def __init__(self, arg): self.args = arg def start_syntatic(self): lexer = Lexer(self.args.file) parser = Parser(lex...
true
3e8bd5c856014f5b451dc45feb6632f39a241c51
nilx/ipol_demo
/lib/build.py
UTF-8
4,349
2.828125
3
[]
no_license
""" build tools """ import os, shutil import urllib2, time import tarfile, zipfile from subprocess import Popen import cherrypy from .misc import ctime TIME_FMT = "%a, %d %b %Y %H:%M:%S %Z" def download(url, fname): """ download a file from the network if it is newer than the local file @param url:...
true
b185affcc09486567c9222337529ae3dfeb5174a
wxted/ERDC_MOOSE
/ERDCMOOSE/plotting/plotCommon.py
UTF-8
27,999
2.984375
3
[ "MIT" ]
permissive
# coding=utf-8 """A file with functions that are common to most, if not all plotting classes within geoplot. Admittedly, this whole class of functions could use a lot more documentation.""" from cartopy import crs as ccrs from cartopy import feature as cfeature import numpy as np from matplotlib import pyplot as pl...
true
b45161d204476767d26caccc36af5ae9518178f6
yogesh1202/CMPT-310-Artificial-Intelligence-Survey
/A1/A1/search.py
UTF-8
11,195
3.40625
3
[]
no_license
# search.py # --------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.edu. # # At...
true
c6d990fdded2669b6b3b2819f5443f806310ab19
v1otusc/ttk-data
/python/resample.py
UTF-8
797
2.6875
3
[]
no_license
#!/usr/bin/env python # Resample a VTI dataset. # Julien Tierny <julien.tierny@sorbonne-universite.fr>, 2023. # argv[1]: input file # argv[2]: xDim # argv[3]: yDim # argv[4]: zDim # argv[5]: output file import sys from paraview.simple import * if len(sys.argv) == 6: inputFile = sys.argv[1] xDim = int(sys.a...
true
2c87d8179a2eb35ebd62c2e2746c2944f9cdf509
korderoman/iotools
/controllers/solver_tr.py
UTF-8
2,346
2.875
3
[]
no_license
from pulp import * class Resolucionador: def __init__(self,nombre_o,nombre_d,dic_o_cant,dic_d_cant,lista_listas_costos): self.nombres_o_lista=nombre_o self.nombres_d_lista=nombre_d self.diccionario_o_cantidades=dic_o_cant self.diccionario_d_cantidades=dic_d_cant self.lista_d...
true
fa2816e0e7480696fbfc611839ba579113fdf455
hyk3018/Invoker-Trainer
/Invoker Trainer/Invoker Trainer/Dota.py
UTF-8
3,996
3.109375
3
[]
no_license
import xml.etree.ElementTree as ET """ Dota object is instantiated and called when data regarding Dota is needed. It has minimal functionality - basically acts as a data store. """ class Dota: # Initialisation will set the path of the xml files to read from # The Element Tree class from the xml library will...
true
ae414279e4e877a3b3feaf92b916d9176d7b1203
Lisa-Hsu/Python_Practice
/fileio.py
UTF-8
926
3.296875
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- def readfileasline(name): f = open(name,mode='r') while True: line = f.readline() if not line: break print('{}'.format(line),end='') f.close() def readfile(name): with open(name, 'r') as filehandle: for line in fil...
true
bd77e3703eee0286868f4a2e1a8668fb436f0bc4
4RG0S/2021-Winter-Jookgorithm
/한유경/[21.01.15]2941.py
UTF-8
169
2.90625
3
[]
no_license
# 크로아티아 알파벳 croatia = ['c=', 'c-', 'dz=', 'd-', 'lj', 'nj', 's=', 'z='] _str = input() for i in croatia: _str = _str.replace(i, ' ') print(len(_str))
true
8b4bf65c779488cadf050a431a5ce64135215dd5
mrkp305/doves_project
/core/validators.py
UTF-8
407
2.734375
3
[]
no_license
import re from django.core.validators import ValidationError from django.utils.translation import ugettext_lazy as _ def national_id_validator(value): regex_string = re.compile(r'\d{2}\d{6,7}[a-zA-Z]{1}\d{2}', re.IGNORECASE) if not regex_string.match(value): raise ValidationError( _("Value...
true
eb64e89353d081342355d1f90af4684e83c64fe9
Small-Years/haovideo_obj
/Tool.py
UTF-8
2,717
2.9375
3
[]
no_license
from datetime import datetime as cdatetime #有时候会返回datatime类型 from datetime import date,time from flask_sqlalchemy import Model from sqlalchemy.orm.query import Query from sqlalchemy import DateTime,Numeric,Date,Time #有时又是DateTime def queryToDict(models): if(isinstance(models,list)): if(isinstance(models[0]...
true
73c1797b32005e1d6dd8e7c60c748ee400611e2a
erikmoroz/django-boilerplate
/src/common/enum.py
UTF-8
985
3.578125
4
[]
no_license
# -*- coding: utf-8 -*- ENUM_ATTRIBUTE_PREFIX = tuple("ABCDEFGHIJKLMNOPQRSTUVWXYZ") class Enum: """ Base class for application enums. Eventually may have helper methods on here for iterating values etc. or providing labels """ # Dictionary of enum value to label _labels = None @classmet...
true
4fc5a085ed13769d1a08c9dffb91db8d641363db
boweiYan/Synth
/ipython/Gmean-test.py
UTF-8
1,636
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <codecell> import numpy as np import math # define functions TP = lambda f: (f*eta*mu).sum() TN = lambda f: ((1-f)*(1-eta)*mu).sum() FP = lambda f: (f*(1-eta)*mu).sum() FN = lambda f: ((1-f)*eta*mu).sum() G = lambda f: np.sqrt( (TP(f)*TN(f))/( (TP(f)+FN(f))*(TN(f)...
true
344faa822a9ac58d9eedfd6f44ce307f0dc1cb9b
andrei-bartra/time_matrix_peru
/mpi_code.py
UTF-8
4,357
2.625
3
[]
no_license
# -*- coding: utf-8 -*- ''' _______________________________________________________________________ | | | Time Matrix MPI Implementation | | Multipurpose implementation ...
true
99de20ffa2c2b879fd74ea6f061fdecf015d74c0
nguyengiapphuongduy/ppl-181
/All/src/test/LexerSuite.py
UTF-8
16,112
3.125
3
[]
no_license
import unittest from TestUtils import TestLexer class LexerSuite(unittest.TestCase): def test_1_identifier(self): """test normal identifiers""" self.assertTrue(TestLexer.test('abc','abc,<EOF>',101)) def test_2_identifier(self): """test lower-upper mixing identifiers""" se...
true
5a4befe5ef36d9256c868309306c68a4e57bcc36
sgyeong97/Baekjoon
/Python/For/10871.py
UTF-8
298
3.34375
3
[]
no_license
count, num = input().split() minnum = int(num) result = [] num_list = [] temp = input() input_list = temp.split() for x in range(int(count)): num_list.append(int(input_list[x])) if num_list[x] < minnum : result.append(num_list[x]) for x in result: print(x, end=' ')
true
34e717f012ec6327e82fa4d575799cecc0ac160d
StefReck/Km3-Autoencoder
/scripts/Testing/py5Example.py
UTF-8
8,766
2.90625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import h5py import numpy as np """ mctracks/ bjorkeny, dir_x, dir_y, dir_z, energy, id, interaction_channel, is_cc, length, pos_x, pos_y, pos_z, time, type, event_id hits/ _indices, channel_id, dir_x, dir_y, dir_z, dom_id, du, event_id, floor, pos_x, pos_y, pos_z, t0, time, tot, trigg...
true
8f21f5a7c25d2c6fc7500ba32f35e47400d437ea
zzfd97/MDBServer
/mdb/sniffer.py
UTF-8
970
2.578125
3
[]
no_license
import logging from usb_handler import USBHandler, to_ascii class Sniffer: def __init__(self): self.initialized = False self.logger = logging.getLogger('.'.join((__name__, self.__class__.__name__))) async def initialize(self, usb_handler: USBH...
true
ccd9a1751078cbd94d585a1b3bb7fa6565b631a8
Tony2h/Xhome_bjtu
/tools/readFromCsvToTxt_CN.py
UTF-8
742
2.921875
3
[ "Apache-2.0" ]
permissive
import re def is_all_zh(s): for c in s: if not ('\u4e00' <= c <= '\u9fa5'): return False return True with open("playlist_style1.csv") as file: for line in file: line1=line.split('\n') str = line1[0].split(',') if is_all_zh(str[1]): singername = str[1...
true
0b80ee4e4d58eab1a9be981e4f1d1bdd1dbfe090
adrianogil/miru
/src/python/miru/raytracing/scene.py
UTF-8
6,561
2.734375
3
[ "MIT" ]
permissive
from PIL import Image from .ray import Ray import numpy as np from miru.engine.camera import Camera from miru.engine.vector import Vector3 from miru.engine.color import Color from miru.engine.sceneparser import SceneParser from miru.engine.material import Material from miru.raytracing.cube import Cube from miru.ra...
true
35074f28ac7385bf29f982df2fc7e48cd9bf012e
Chubek/CodingChallenges
/N-DigitDivisibleByM/Program.py
UTF-8
312
3.453125
3
[]
no_license
def HighestWithN(i): return 9 * int(i*'1'); def DivisibleBy(): myInput = input("Enter two numbers delimited by space: "); i = int(myInput[0]); k = int(myInput[2]); for j in reversed(range(0, HighestWithN(i))): if j % k == 0: print(j); break; DivisibleBy();
true
e3c32962ca18353de402fd6502ff2b4404090870
Palo-IT/petitext
/objets_relation.py
UTF-8
10,359
3.34375
3
[ "Apache-2.0" ]
permissive
# coding: utf-8 from Mot import Mot class Concepts: def __init__(self, mot): ##print("mot not null") self.clabel = mot.label self.lemma = mot.lemma ##print("lemme ", self.lemma) self.mot = mot self.relations_g = [] #liste des r...
true
f27acf7a109e14ef551769bc41833257b543261e
chenjienan/python-leetcode
/categories/tree/124.binary-tree-maximum-path-sum.py
UTF-8
1,204
3.421875
3
[]
no_license
# # @lc app=leetcode id=124 lang=python # # [124] Binary Tree Maximum Path Sum # # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def maxPathSum(self, root): """ ...
true
754ed3529cf1ee342b15800b0642b4f439462ee7
abreezes/abreezes-mycrawlers
/crawl/zhaopin/zhaopin/utils/get_jobtype_addr.py
UTF-8
1,194
2.71875
3
[]
no_license
def get_type(value): if '工' in value or '工程' in value or '技术员' in value or '技术' in value or '师傅' in value \ or '技师' in value or '学徒' in value or '维修' in value or '修理' in value or '维护' in value: return '工程类' elif '总经理' in value or '项目经理' in value or '储备' in value or '运营' in value or '课长' \ ...
true
5da500f1a564a1bc6fc3b4299091b96f1622e5a6
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_97/1838.py
UTF-8
645
2.703125
3
[]
no_license
seen = [] def isRec(num, bound1, bound2): global seen s = str(num) origS = s[:] lst = [] for i in range(len(s)): s = s[1:] + s[0] if s == origS: if lst: return len(lst) else: return 0 elif s not in lst and bound1 <= int(s) <= bound2 and (s, origS) not in seen and (origS, s) not in seen: lst.appe...
true
df03b4cd8a2070ed688adbd3e482583e16c3984e
MiroVatov/Python-SoftUni
/Python Fundamentals 2020 - 2021/01 - Basic Syntax, Conditional Statements and Loops/More exercises 01 - 02.py
UTF-8
280
3.796875
4
[]
no_license
string = input() string = list(string) new_list = [] upper_index = 0 for i in string: if i.isupper(): index = string.index(i) if index in new_list: index = upper_index new_list.append(index) upper_index += 1 print(new_list)
true
b90cb9a1f3fa3fab777584cc8489e3c7e0342890
5zhixi/pythonForMachineLearning
/SimpleLinearRegression.py
UTF-8
413
2.984375
3
[]
no_license
import numpy as np x=[1,3,2,1,3] y=[14,24,18,17,27] def fitSLR(x,y): n=len(x) fenzi=0 fenmu=0 for i in range(n): fenzi+=(x[i]-np.mean(x))*(y[i]-np.mean(y))#分子 fenmu+=(x[i]-np.mean(x))**2#分母 b1=fenzi/fenmu b0=np.mean(y)-b1*np.mean(x) return b0,b1 def predict(x,b0,b1): y=b0...
true
a4daf1d4c6a4c1be3207481b5ac1819ee76e1907
SakuraGo/leetcodepython3
/PythonLearning/fourteen/c6.py
UTF-8
372
3.328125
3
[]
no_license
a = '' b = False c = [] print(a == None) print(b== None) print(c==None) def fun(): return None a = fun() if not a :#s print("s") else: print("f") if a is None:#s print("s") else: print("f") a = [] if not a : #s 空列表判断bool值返回s ##判空操作 print("s") else: print("f") if a is None:#f pri...
true
5fe7806e574dd34cc1af9cb54e374716d92212c3
lunarseer/python_bro
/lessons/lessons_2019/lesson_1/code.py
UTF-8
1,005
3.71875
4
[]
no_license
# cycle examples """ i = 0 for x in range(0, 10): print(i, x) i += 1 for i, x in enumerate(['sdfsd', 8646, 324]): print(i, '==', x) i = 0 for elem in ['sdfsd', 8646, 324]: print(i, elem) i += 1 active = True i = 0 while active: print(i, '- Iterating') i += 1 if i >= 15: ...
true
ff24425ad3871de6b6e99d0959b16f53ed59c568
rafaelgarrido/Arithmos
/arithmos/parser.py
UTF-8
1,590
3.453125
3
[]
no_license
from lexer import Lexer from lexer import Token class Parser: def parse(self, exp): self.lexer = Lexer(exp) expression_value = self.expression() token = self.lexer.get_next_token() if token.kind == Token.End: return expression_value else: raise Error("Error while parsing expression. Couldn't find ...
true
8188aa9719a70d762746b74ed684fd4f144caad8
jrusso1020/CS4740
/nlp_project2_uncertainty/create_word_embeddings.py
UTF-8
2,240
2.890625
3
[]
no_license
import gensim import glob class Sentences(object): def __init__(self, dirname): self.dirname = dirname def __iter__(self): for file_name in glob.glob(self.dirname + "/*.txt"): with open(file_name, 'r') as article: text = article.read() sents = text.split("\n\n") temp = "" ...
true
c4e9cec3ab344bcf6e660e81a3d02ebdbc49c4ff
BarracudaPff/code-golf-data-python
/examples/hello_coroutine.py
UTF-8
338
3.5
4
[ "MIT" ]
permissive
"""Print 'Hello World' every two seconds, using a coroutine.""" import asyncio @asyncio.coroutine def greet_every_two_seconds(): while True: print("Hello World") yield from asyncio.sleep(2) if __name__ == "__main__": loop = asyncio.get_event_loop() try: loop.run_until_complete(greet_every_two_seconds()) final...
true
45c77c100e435c6c51f354d63fdfb930369cad88
nlegras/CS-407
/hwk01/test_encode.py
UTF-8
1,062
3.34375
3
[]
no_license
from encode import encode def test_empty_string(): assert encode("") == "" def test_non_repeating_string(): # non-repeating strings will always return the input string assert encode("a") == "a" assert encode("abc") == "abc" assert encode("aba") == "aba" def test_compression(): assert encode("aabbbccccddddd"...
true
96cc4909b54920dedfad345e881d9b21fe4e6ab5
hemanshu-cohesity/management-sdk-python
/cohesity_management_sdk/samples/register_vcenter/register_vcenter.py
UTF-8
3,705
2.65625
3
[ "MIT" ]
permissive
# Copyright 2019 Cohesity Inc. # # Python example to add a VM to a protection Job. # This script is compatible with Python2 # Usage: python register_vcenter.py import os import argparse from cohesity_management_sdk.cohesity_client import CohesityClient from cohesity_management_sdk.models.environment_enum import Enviro...
true
8caed8411a5a845861130715cdf54644745bf646
fhfmendes04/Desenvolvedor_Python_Junior
/Collections/listas/arrays.py
UTF-8
327
3.84375
4
[]
no_license
from array import array array_1 = array('B', [1,2,3,4,5,6,]) print(array_1) for i in array_1: print(i) # Inserir elemento array_1.insert(2, 50) print(array_1) # remover elemento array_1.remove(4) print(array_1) #Buscar elemento print(array_1.index(50)) #Atualizar dados em um array array_1[2] = 55 print(a...
true
88d7a7baf6b8810c104ec46906448014a7aa81dd
jackyhobingo/LeetCode
/547.Friend_Circles.py
UTF-8
590
2.671875
3
[]
no_license
class Solution(object): def findCircleNum(self, M): """ :type M: List[List[int]] :rtype: int """ def dfs(visited_list, m, M, len_M): visited_list[m] = True for n in range(len_M): if not visited_list[n] and M[m][n]: d...
true
bbaf50ac77340010d98205df2783edef9ee7f5f1
allendaicool/joinquantFiles
/webCrawler/__init__.py
UTF-8
2,772
2.65625
3
[]
no_license
# -*- coding: utf-8 -*- from scrapy import Render from datetime import datetime from crawlAnalyze import beautifulSoupParse from dateutil import tz from drawline import * import time from PySide import QtCore, QtGui, QtWebKit import sys def loadPage(url): page = QtWebKit.QWebPage() loop = QtCore.QEve...
true
290c1121753ab29e99893ba4cee8bbffba1f1b46
xsh884826402/CNT_XSH
/model_rnn.py
UTF-8
2,845
2.796875
3
[]
no_license
import tensorflow as tf import numpy as np class Config( ): embedding_dim = 64 seq_length = 100 num_classes = 40 vocab_size = 5000 num_layer = 3 hidden_dim = 128 type = 'gru' drop_keep_prob = 1 learning_rate = 1e-3 batch_size = 64 n_epoch = 50 print_pe...
true
20d79fd72d3c404a7baf72c0c503c306a9696eac
terriyu/map-words-faster-rcnn
/tools/maps/overlay.py
UTF-8
3,994
3.171875
3
[ "MIT", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
permissive
# Script for creating augmented images by overlaying lines over original map images from __future__ import division import numpy as np import cv2 import os import string def adjust_gamma(image, gamma=1.0): """Adjust gamma of an image (change brightness) Args: image (2D array) - image to process ...
true
ff0fc4ee993cb9cc7b59efe65ed7f71a02f13ce3
zhumorui/lab_security_system
/algorithm_interface/V2.0/socket_client_Raspberry.py
UTF-8
591
2.546875
3
[]
no_license
import cv2 import io import socket import struct import time import pickle class SocketClient(object): def __init__(self): self.client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def connect(self, host, port): print("connect now,wait...") self.client_socket.connect((hos...
true
e367f7943191b58469b9ea126a781dc4f3226020
sevenhe716/LeetCode
/String/test_q722_remove_comments.py
UTF-8
900
3.03125
3
[]
no_license
import unittest from String.q722_remove_comments import Solution1 class TestRemoveComments(unittest.TestCase): """Test q722_remove_comments.py""" def test_remove_comments(self): s = Solution1() self.assertEqual(["int main()", "{ ", " ", "int a, b, c;", "a = b + c;", "}"], s.removeComments(...
true
c28ad56bf7e1c695569516246607cffcc934d57c
m1theus/faculdades-logatti-rep
/python/avaliacao/1.py
UTF-8
100
3.375
3
[]
no_license
operacao = 2 for i in range(0, 11): print('{0} x {1} = {2} '.format(operacao, i, i * operacao))
true
2577a7bb4bc022111d46710dc61aa958a615e123
ccarlil1/PythonProjects
/Letter_Counter.py
UTF-8
868
3.671875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Apr 28 21:12:55 2019 @author: Casey """ import string def counter(phrase): count_letters = {} all_letter_count = {} alphabet = string.ascii_letters for i in alphabet: count = 0 for j in sentence: if i == j: ...
true
59dc37df9847378b4006563866ee091509828c81
ajevnisek/packaging-and-entry-points
/equaldecoration/equaldecoration/equaldecoration.py
UTF-8
234
3.28125
3
[ "MIT" ]
permissive
"""Print something in a new exciting pretty way.""" from __future__ import print_function def pretty_eqauls_printing(to_print): """Print string with added equal.""" print("{dec}{obj}{dec}".format(dec="=" * 3, obj=to_print))
true
4e55ee7981013d4bab0ba2fd2d2196e8885581c4
jiyoungsin/ImageScraper
/scrape.py
UTF-8
2,226
2.828125
3
[]
no_license
import csv import logging from datetime import datetime from google_images_download import google_images_download from time import sleep logger = logging.getLogger("imagescraper-bot") logger.setLevel(level=logging.INFO) log_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') stream_ha...
true
12ca70644d40b33d58d1140d3962b84a8d1b8434
ouzlaye/face_recognition
/train_model.py
UTF-8
1,202
2.796875
3
[]
no_license
from sklearn.preprocessing import LabelEncoder from sklearn.svm import SVC import argparse, pickle # Consttruct the argument parser and parse arguments ap = argparse.ArgumentParser() ap.add_argument("-e", "--embeddings", required=True, help="path to serialized db of facial embeddings") ap.add_argument("-r", "--recog...
true
d2450e9d7083e860891e9a01497db0deca56d001
GovindCoding/Ghost
/Python/Machine_Learning_Projects/Linear_Regression_production_ready/Student_Mark_Prediction/app.py
UTF-8
862
2.59375
3
[]
no_license
from flask import Flask,render_template,request,jsonify import pickle app=Flask(__name__) @app.route('/',methods=['GET']) def homePage(): return render_template('index.html') @app.route('/predict',methods=['POST','GET']) def index(): if request.method=='POST': try: Hours=float(request.for...
true
1b3521820b2647da76b84452982e158e9a3119b0
virresh/CurrencyConvert
/a1.py
UTF-8
3,235
3.828125
4
[]
no_license
''' Module a1 for HW 1 This module has functions for fetching the currency data designed for python 3 Team Information : Partner 1 Partner 2 Name: Viresh Gupta Name: Saatvik Jain Roll No: 2016118 Roll No: 2016261 ''' import urllib.request ''' Global Variables ''' err='' ''' ---------------- ''' de...
true
01c827144d95b70f4c5c89309980474634255184
siavash9000/Computational-Investing
/HomeWork5/bollingerbands.py
UTF-8
2,474
2.984375
3
[]
no_license
__author__ = 'siavash' # QSTK Imports import QSTK.qstkutil.qsdateutil as dateUtil import QSTK.qstkutil.DataAccess as dataAccess import numpy as numpy # Third Party Imports import datetime as dateTime import pandas as pandas import QSTK.qstkutil.tsutil as tsutil import matplotlib.pyplot as plt import matplotlib.dates ...
true
f4a658f5445328dbf86b5836cd6ec646845d9e7a
YuanXianguo/Python-Interview-Master
/100Cases/1-50/num19完数=因子之和.py
UTF-8
443
3.3125
3
[]
no_license
for n in range(2,1001): list = [] for i in range(1,n): if n % i == 0: m = int(n / i) if i > m: break else: list.append(i) if m != n: list.append(m) list.sort() count = 0 for i in list: ...
true
dfb09f3f7da42af7b5f7cb0379619bd203257a79
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_136/1793.py
UTF-8
2,309
3.09375
3
[]
no_license
#!/usr/bin/env python import re outf = 'out.txt' def eq(a, b, eps=0.0000001): return abs(a - b) <= eps class CookieClicker(object): def __init__(self, pid, fo): self.c = None self.f = None self.x = None self.r = 2 self.pid = pid self.fo = fo def read_par...
true
aa82ff38e2b8cdc5e011d6ae9532ab7e5ce2c33b
chenlex/python_script
/SqliteDatabase/test_sqlitedatebase.py
UTF-8
1,081
2.609375
3
[]
no_license
import peewee from playhouse.shortcuts import model_to_dict db = peewee.SqliteDatabase("test.db") class BaseModel(peewee.Model): class Meta: database = db def to_dict(self): return model_to_dict(self) class New_Update(BaseModel): mac = peewee.CharField(primary_key=True) version = peew...
true
6f34cbb114ab846df057c56be014fb1e0baa0ab4
Atulsingh3009/Python_Programs
/password.py
UTF-8
1,085
3.890625
4
[]
no_license
#1 import re #2 def password(): while True: #3 user_input = input("Enter a password : ") is_valid = False if (len(user_input)<6 or len(user_input)>12): #4 print("Not valid ! Total characters should be between 6 and 12") continue elif not re.search("[A-Z]",user_input): #5 ...
true
547b0d847c604824440e957cf900ba3efb68478a
Laboputer/LearnML
/01. [LECTURE] SunghunKim's github/03. Reinforcement Learning with TF v1/02_random_frozenkake_det.py
UTF-8
1,013
3.109375
3
[]
no_license
# https://medium.com/emergent-future/simple-reinforcement-learning-with-tensorflow-part-0-q-learning-with-tables-and-neural-networks-d195264329d0#.pjz9g59ap import gym import random from gym.envs.registration import register import matplotlib.pyplot as plt register( id='FrozenLake-v3', entry_point='gym.envs.to...
true
9db2b66f0acdc97ff0b9b1c6c82205da8b733750
TripleEss/DL_Spring_2019
/HW2/RNN/preprocessing_2.py
UTF-8
4,500
2.546875
3
[]
no_license
from torch.autograd import Variable from torchvision import transforms from torch.utils.data import Dataset, DataLoader import torch import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import os ############# GLOBAL DEF ############# """ override the dataset class for custom d...
true
126bd0695fe632984e053acb0659153ceb57d522
Algorithm-P0/meanjung
/2021/2573.py
UTF-8
1,453
2.8125
3
[]
no_license
import sys from collections import deque N, M = map(int, sys.stdin.readline().split()) # N세로 M가로 graph = [list(map(int, sys.stdin.readline().split())) for _ in range(N)] dy = [-1,1,0,0] dx = [0,0,1,-1] def check(y, x, visited): q = deque() q.append([y,x]) visited[y][x]=True while q: y, x = q.pop...
true
e3f785f4fbba973d229ee69891edec53655a246d
absentm/ml_coding
/Tree_Regression/main/regTrees.py
UTF-8
3,360
3.203125
3
[]
no_license
# coding=utf-8 # regTrees.py # 树回归 from numpy import nonzero, shape, inf, mean, var, mat def loadDataSet(fileName): ''' 加载数据 :param fileName: 文件名 :return: ''' dataMat = [] fr = open(fileName) for line in fr.readlines(): curLine = line.strip().split('\t') fltLine = map...
true
0d18a2f61be123fe9b257fc3dd0ecf1561169963
kwcooper/CogSimulations
/autonomousAgents/PredatorPrey/world.py
UTF-8
3,672
3.28125
3
[]
no_license
import random import math import turtle #change color #change Velocity #allow the agent to select prey class Predator: def __init__(self, v, turtleON=False): self.x = random.randint(-100,100) # agent's x position self.y = random.randint(-100,100) # agent's y position self.o = random.r...
true
2f09b2b078ac96ebf9e3bb1b2638348e6b7818f5
loganbonsignore/web-scraping
/Missions_to_Mars/scrape_mars.py
UTF-8
3,013
2.546875
3
[]
no_license
from splinter import Browser from flask import Flask, jsonify, redirect import pandas as pd from bs4 import BeautifulSoup as bs import time import pymongo import re import datetime def init_browser(): executable_path = {"executable_path": "/usr/local/bin/chromedriver"} return Browser("chrome", **executable_pat...
true
c40993c044f0587b0a47101a20744868c58d1e9d
juliamoraiss/python-CursoEmVideo
/Exercícios/ex078.py
UTF-8
551
4.125
4
[]
no_license
lista = [] for c in range(0, 5): n = int(input(f'Digite um valor para a posição {c + 1}: ')) lista.append(n) print(f'Você digitou os valores: {lista}') maior = max(lista) posmaior = [] menor = min(lista) posmenor = [] for c, v in enumerate(lista): if v == maior: posmaior.append(c + 1) for c2, v in e...
true
5cef0b2bb3539847ffbbb3163d1f46b3758ec055
AllenKll/python-pacman
/infoDisplay.py
UTF-8
2,147
3.1875
3
[]
no_license
import pyglet class InfoDisplay(object): ''' display of text messages ''' SCORE_X = 10 STATUS_Y = 470 LIVES_X = 630 def __init__(self, window): self.scoreLabel = pyglet.text.Label('', font_size=14, x=InfoDisplay.SCORE_X, ...
true
c85740acaf83c8ad5606730a252d4d3be6e0eace
CarlosLannister/TFG-ShodanScripts
/palantir.py
UTF-8
1,681
2.828125
3
[ "MIT" ]
permissive
import shodan import time from optparse import OptionParser class palantirContext(object): def __init__(self): self.shodan_key = 'YOUR API KEY !!!!' self.output = 'results.txt' self.query = '' self.message = '' self.page = 1 def get_cmd_line_args(): context = palantirContext() opts = OptionParser()...
true
661c83668ddd7adb25adaf81f3e0fb077201c844
Shootniky/gb_homework_py
/les3_hw_3/task_4.py
UTF-8
1,195
4.25
4
[]
no_license
""" 4. Программа принимает действительное положительное число x и целое отрицательное число y. Необходимо выполнить возведение числа x в степень y. Задание необходимо реализовать в виде функции my_func(x, y). При решении задания необходимо обойтись без встроенной функции возведения числа в степень. Подсказка: попробуйт...
true
80c24f8b1e6d1fbebabecd3cbf4caf2f474e9e12
demul/algorithm_problem_solving
/해시 베스트앨범.py
UTF-8
527
2.765625
3
[]
no_license
def solution(genres, plays): d = dict() for i in range(len(genres)) : try: d[genres[i]][0][i] = plays[i] #장르내 고유번호 해시에 + d[genres[i]][1] += plays[i] #장르 고유 재생수에 + except: d[genres[i]]=list() d[genres[i]].append(dict()) ...
true
ce212de14d256a486faec456450d9627a44f455b
scikit-hep/pyhf
/src/pyhf/optimize/opt_tflow.py
UTF-8
1,583
2.609375
3
[ "Apache-2.0" ]
permissive
"""Tensorflow Backend Function Shim.""" from pyhf import get_backend import tensorflow as tf def wrap_objective(objective, data, pdf, stitch_pars, do_grad=False, jit_pieces=None): """ Wrap the objective function for the minimization. Args: objective (:obj:`func`): objective function data ...
true
54c62796a722b03b61ac4258685fdd09276037a7
SteephanSteve/Hunter_Program
/avg_matrix.py
UTF-8
211
2.953125
3
[]
no_license
n=int(input()) s=[] for i in range(n): x=map(int,raw_input().split()) s.append(x) l=0 for i in range(len(s)): l+=len(s[i]) s[i]=sum(s[i]) print format(sum(s)/float(l),".6f")
true
8775640a7b934342050fa94ea45100986bdb103c
searchstudies/aapvl
/backend_app/backend/src/logos/align_points.py
UTF-8
2,855
3.234375
3
[ "MIT" ]
permissive
# MIT License # # Copyright (c) 2016 - 2018 XXX # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, p...
true
30aa9b6723be3cff80a52241f9b6389f557171de
jonghyeok34/Python_class
/python_01/src/180822/mysql/mysql_select.py
UTF-8
456
2.953125
3
[]
no_license
# 회원 정보 출력 import pymysql try: con = pymysql.connect(host='localhost', port=3306, user='root', password='1234', db='mysql', charset='utf8') cursor = con.cursor() cursor.execute('select * from contact') rows = cursor.fetchall() for row in rows: ...
true
6df302751be3ba88bd8d5853c4b414e21a71b3db
AlexMout/Project
/Model/Tick.py
UTF-8
181
2.625
3
[]
no_license
from json import loads, dumps class Tick: def __init__(self,price,volume,timestamp): self.price = price self.volume = volume self.timestamp = timestamp
true
4d9097b669ffddc21ec284a28cf6da12fc370008
wangye707/papercode
/毕业论文/图片裁剪/图片裁剪_big.py
UTF-8
2,860
2.75
3
[]
no_license
#!D:/workplace/python # -*- coding: utf-8 -*- # @File : 图片裁剪.py # @Author: WangYe # @Date : 2020/3/21 # @Software: PyCharm import cv2 import numpy as np # name = [0,5,1000,3000,6000,10000,20000,30000,40000,50000] path = '0.png' path_out = 'cqut_image' size = 256 img = cv2.imread(path) def total_image_predict(ori_imag...
true
3235eabd3c0ef17beed2a26da1e57a0a387d013a
HuzefaMandvi/EC500-HealthMonitorSystem
/error_handler.py
UTF-8
835
2.671875
3
[]
no_license
def Error_Handler(data): hr_reading = data.get("heart_rate") bp1_reading = data.get("blood_pressure1") bp2_reading = data.get("blood_pressure2") bo_reading = data.get("blood_oxygen") alert = False if bp1_reading > 140 or bp1_reading < 120 or bp2_reading > 90 or bp2_reading < 80: alert...
true
c36ff2623cd3399dbfb97d899feec29f4c486e48
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/bob/8089eb75378445f8bc137a1ace0ceb52.py
UTF-8
411
3.015625
3
[]
no_license
class Bob(object): def hey(self, incoming): if not incoming or not incoming.strip(): return 'Fine. Be that way!' decoded = incoming.decode('latin-1') is_shouting = decoded.isupper() is_question = decoded.endswith('?') if is_shouting: return 'Woah, c...
true
f1042a20eefe6a48b88485057c62bb1c6f7c0b81
Xilinx/pyxir
/python/pyxir/shared/xbuffer.py
UTF-8
1,891
2.6875
3
[ "Apache-2.0" ]
permissive
# Copyright 2020 Xilinx Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
true
46ff4a1d087825ffbdfebb0a354b23877f4f9e89
karelinas/adventofcode2020
/day15/main.py
UTF-8
772
3.890625
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Full solution for Advent of Code 2020, day 15 Usage: python3 main.py """ from collections import deque from itertools import count def number_game(starting_numbers): queue = deque(starting_numbers.copy()) history = {} for turn in count(): said ...
true
491f958f8349b84702cc33e5fe963aa12068058a
shuvava/python_algorithms
/sort/insertion.py
UTF-8
2,032
3.46875
3
[]
no_license
#!/usr/bin/env python # encoding: utf-8 # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Copyright (c) 2017-2022 Vladimir Shurygin. All rights reserved. # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '''Insertion sort(bubble sort) Complexity: O(n^2) ...
true
9c636676d933201bfeaecd88f0a6a793a8a59586
EnedinoAndre/Estrutura-De-Dados-em-Python
/Aula 7 - Fila/filaArq.py
UTF-8
1,051
3.890625
4
[ "MIT" ]
permissive
class Fila(): def __init__(self): self.dados = ["RAMON","Altayr"] #MOSTRAR FILA def MostrarFila(self): return self.dados #INSERIR DADOS NA FILA def InserirDado(self, newValue): self.dados.append(newValue) #self.dados.insert(len(self.dados),newValue) #RETIRAR DADO ...
true
0f54028de876980a58aa90790c6b455f7bf53bf5
tim-jackson/pushpy
/pushpy/gcm.py
UTF-8
7,707
2.703125
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
"""gcm.py: Functionality enabling Push Notification messages to be sent to the Google Cloud Messaging service. """ import json import ast from datetime import datetime from StringIO import StringIO from twisted.internet.protocol import Protocol from twisted.python import log from twisted.internet.defer import Deferred...
true
f06759a0fa9f1abcd8a95b7e718a491cb1163616
BStalewski/SRProject
/server/clock.py
UTF-8
1,441
2.765625
3
[]
no_license
from copy import deepcopy class Clock: def __init__(self, my_nr, count): self.my_nr = my_nr self.clock = [ [0] * count for _ in range(count) ] #def refuse( self ): def refuse( self ): #self.clock[self.my_nr][sender] -= 1 # comment in new clock without sender #self.c...
true
36c9e27244c0e6b99782ba475d1810911b734914
lucasrm25/Machine-Learning-and-Pattern-Recognition-MO444
/assignment_03/main.py
UTF-8
15,808
2.796875
3
[]
no_license
import os import numpy as np import matplotlib.pyplot as plt import re from datetime import datetime import pandas as pd from tqdm import tqdm tqdm.monitor_interval = 0 tqdm.pandas(desc="my bar!") from nltk.tokenize import word_tokenize, sent_tokenize from nltk.corpus import stopwords stop = set(stopwords.words('engli...
true
2c34efc2f55355897b05278c391681b30188c64b
yenOlass/calishot
/calishot/search_shodan.py
UTF-8
9,539
2.71875
3
[]
no_license
#! /usr/bin/python3 import shodan import requests import time import re import math #Search shodan def search_shodan(search_str, page_start, page_stop, max_retry): content_lengths=[] etags=[] calibre_IP_list=[] for x in range(page_start,page_stop+1): #range is exclusive of the final value (i.e in range(1,20) goe...
true
33ec29f9efc78c82c2c7b6f0fe7acb57765a0c51
mbreese/mvpipe_py
/bin/mvpipe
UTF-8
3,058
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env python import sys import os try: import sjq except: sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'sjq')) try: import sjq assert sjq except: pass try: import mvpipe except: sys.path.append(os.path.join(os.path.dirname(o...
true