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
d3f3ef002edd87926d3e3a486ca403d1f1f5b3eb
metamoles/metamoles
/notebooks/metacyc_code/mol_sim.py
UTF-8
4,998
3.265625
3
[ "MIT" ]
permissive
# rdkit imports from rdkit import Chem from rdkit.Chem.Fingerprints import FingerprintMols from rdkit import DataStructs # housekeeping imports import pandas as pd def fingerprint_products(input_df): # fingerprints all products in a given df """ Args: input_df : pandas dataframe with smiles in colu...
true
410c2d6a64d20ade7c3d8466d61cda5b2f62eae3
ciecmoxia/moxiatest
/Month1/Module_datetime.py
UTF-8
8,186
3.578125
4
[]
no_license
#datetime_date ''' # https://blog.csdn.net/cmzsteven/article/details/64906245 from datetime import date # #import datetime as dt # d=dt.date(2021,9,16) # print(d,type(d)) # # 构建一个日期对象,包含有 year, month, day 三个属性。 # # 构建一个日期对象 # # year 区间[1, 9999], month 区间[1, 12], day 区间[1, (28,29,30,31)] # d = dt.date(year=2018, month=6...
true
70e7e87f0d11941ab9503020909e57b90df0fde5
tomplus/kubernetes_asyncio
/examples/example4.py
UTF-8
1,397
2.703125
3
[ "Apache-2.0" ]
permissive
"""Watch multiple K8s event streams without threads.""" import asyncio from kubernetes_asyncio import client, config, watch async def watch_namespaces(): async with client.ApiClient() as api: v1 = client.CoreV1Api(api) async with watch.Watch().stream(v1.list_namespace) as stream: asyn...
true
6cfd2a970ff98ef8d26b18032948302606d63eee
dablacknerd/Opinion-Mining-1
/general_functions.py
UTF-8
1,641
2.671875
3
[]
no_license
def polarity_score(syn_set_list): limp =[] for s in syn_set_list: word = s.name().split('.')[0] pos_score = swn.senti_synset(s.name()).pos_score() neg_score = swn.senti_synset(s.name()).neg_score() polarity_score = float(pos_score) - float(neg_score) limp.append(polarity_score) arr = np.array(limp)...
true
c235220318853f3cfeeb2692288c069e2e7ee833
PyBZ/PythonTecaj
/LTFE/primeri/branje_fs.py
UTF-8
821
3.015625
3
[ "MIT" ]
permissive
dat = open('datoteka.txt') print(dat.read()) # preberemo vsebino # Deskriptor datoteke moramo zapreti # sicer pride do uhajanja informacij (leak) dat.close() with open('datoteka.txt') as dat: print(dat.read()) class defektOpen: def __init__(self, file, mode='r', *args, **kwargs): self.__filena...
true
a6ca84180fffe2a1016e45af9c9a77f0bc44802a
JasonBenn/interview-questions
/hot-potato.py
UTF-8
265
3.609375
4
[]
no_license
from collections import deque def hot_potato(names, num): players = deque(names) while len(players): players.rotate(num) yield players.popleft() print(players) print(list(hot_potato(["brendan", "oz", "jason", "myles", "ben"], 3)))
true
5e2a23e75d07e22234d68aa48cdeccdd3cdf6d76
Auquan/help_project
/test/exitstrategies/test_lockdown_policy.py
UTF-8
8,038
2.796875
3
[ "Apache-2.0" ]
permissive
"""Tests for the lockdown_policy module.""" import datetime import pytest import attr from help_project.src.exitstrategies import lockdown_policy def test_lockdown_policy_initialization_from_dict(): """Test LockdownPolicy attributes get correctly initialized from a dict.""" policy = lockdown_policy.LockdownPo...
true
823349241084a4ad81f4470753b9517d18906081
jecs580/django_second_app
/cride/users/permissions.py
UTF-8
669
3.0625
3
[ "MIT" ]
permissive
"""Permisos de Usuario""" # Django REST Framework from rest_framework.permissions import BasePermission class IsAccountOwner(BasePermission): """Permite acceso solo a los objetos propiedad del usuario solicitante""" def has_object_permission(self,request,view,obj): """Comprueba que obj y usuario son ...
true
1aa5d5816cd4e3644d57abd5b3e89f4787d0ad7a
PANTELIMONOV/2nd
/homework 5(2).py
UTF-8
1,017
4
4
[]
no_license
import unittest # Distance between two points def distance (x1,y1,x2,y2): return 0.5**((x1-x2)**2+(y1-y2)**2) # Is the year a leap year? def is_year_leap (y): if y % 4 == 0 and y % 100 != 0: return True elif y % 400 == 0: return True else: return False # Is this a Triangle?...
true
e78cfaa53a6e0dde2439c280bacd8a675e9de4b9
BibekMSDangol/pythonlab
/t.py
UTF-8
127
3.875
4
[]
no_license
for i in range(1,10): if (i % 2 == 0): print(i,'The number is even') else: print(i,'The number is odd')
true
83c95b5cab5af65e8272656de0733783c864b2be
767928649/flask-samples
/request/request-json.py
UTF-8
419
2.6875
3
[]
no_license
from flask import Flask, request app = Flask(__name__) @app.route('/') def root(): file = open('api.html', encoding = 'utf-8') return file.read() @app.route('/api/addUser', methods = ['POST']) def addUser(): json = request.json print('JSON', json) print('name = %s' % json['name']) print('age =...
true
1c391aad2e06a4c76763fb93cb74c05717de6880
SashoStoichkovArchive/HB_TASKS
/projects/week06/05_04_2019/generators/book_generator.py
UTF-8
1,934
3.59375
4
[]
no_license
from string import ascii_letters as letters import random import sys MIN_WORD_LENGTH = 5 MAX_WORD_LENGTH = 10 def get_args(): if len(sys.argv) == 1: print(''''\ how to run: python3 <chapter_count> <chapter_length> (file_name)\n chapter_count - positional, how many chapters will be in the book chapter_le...
true
f50ab61b93afe8c935a84372e268245182dfcfd4
lastnameis-borah/Face-Detection
/face_detection_image.py
UTF-8
1,084
3.203125
3
[]
no_license
import cv2 from random import randrange # Build the classifier trained_face_data = cv2.CascadeClassifier(cv2.data.haarcascades +'haarcascade_frontalface_default.xml') # Import the image for detection img = cv2.imread("two_kids.jpg") # Convert the image to grayscale grayscaled_img = cv2.cvtColor(img, cv2.CO...
true
88c81f50c20f96eb67e336c2d2bf655933b024e1
pranshukapri/CS384_1801ME44
/Assignments/Assignment_1/tutorial01.py
UTF-8
2,415
4
4
[]
no_license
# Function to add two numbers def add(num1, num2): if isinstance(num1, str) | isinstance(num2, str): return 0 addition = num1 + num2 return addition # Function to subtract two numbers def subtract(num1, num2): if isinstance(num1, str) | isinstance(num2, str): return 0 subtraction = num1 - num2 return sub...
true
3b1bafe34102797c047c057138285cbc4e6aeda0
LoudMIndOfficial/Python_Assignment
/assignment1.py
UTF-8
790
2.859375
3
[]
no_license
import sqlite3 conn = sqlite3.connect('assignment.db') with conn: cur = conn.cursor() cur.execute("CREATE TABLE IF NOT EXISTS tbl_data2( \ ID INTEGER PRIMARY KEY AUTOINCREMENT, \ col_fileType TEXT \ )") col_fileType = ('information.docx','Hello.txt','myImage.png','myMovie.m...
true
a6a8d2b3a7d8a065d94b99d1ef32dc2f8f69acc5
bernardsmith0892/ADS-B-Tracker
/adsb_signal_processing.py
UTF-8
3,130
2.96875
3
[]
no_license
import numpy as np from numpy import * import pyModeS as pms def detectPreamble(y): """Returns a list of indices for detected ADS-B preambles in the RF signal. Parameters ---------- y : numpy.array The RF signal to analyze for ADS-B preambles. Must have a 2MHz sample rate. Returns ------- list A list of...
true
61955f2767ca4b11c7b942b315cbe6da00c16677
eltnas/ExerciciosPythonBrasil
/03 - EstruturaDeRepeticao/23.py
UTF-8
268
3.765625
4
[]
no_license
num = int(input('Numero: ')) lista = [] div = 0 for i in range(num + 1): if i % 2 == 1 and i != 2: lista.append(i) div += 1 else: div += 1 print('Numeros primos: {}'.format(lista)) print('Numero de divisoes: {}'.format(div))
true
391b8acc2a892746e40dc29a89cb9f57c435c1ff
jeeras/allexerciciespython3
/ex038.py
UTF-8
560
4.21875
4
[]
no_license
a = float(input('Valor do primeiro segmento: ')) b = float(input('Valor do segundo segmento: ')) c = float(input('Valor do terceiro segmento: ')) if (b - c) < a < b + c and (a - c) < b < a + c and (a - b) < c < a + b: print('Pode formar um triangulo.') if a == b and a == c: print('É um triangulo...
true
d9a545e2c5d1d5a542231b6e7db7d3695f1ab195
tbish967/CS7641
/project1/src/svm/samples.py
UTF-8
2,220
2.78125
3
[]
no_license
from sklearn.svm import SVC from sklearn.preprocessing import StandardScaler from src.utils import get_project_root from keras.datasets import mnist import numpy as np import matplotlib.pyplot as plt import math root = get_project_root() dataset = 'MNIST' sample_steps = 5 kernels = ['linear', 'poly', 'sigmoid'] if d...
true
3de9c3990a3f113566cb5b8335b953c3a90c36b5
debaice/pisa
/pisa/aeff/AeffServiceSliceSmooth.py
UTF-8
7,525
2.53125
3
[]
no_license
# author: J.L. Lanfranchi # # date: March 1, 2016 """ Generate a 2D effective area map using 2D-smoothed effective areas, where the smoothing is performed on 1D slices of the full 2D map, first in cosine-zenith and then in energy. """ import os import collections import numpy as np from scipy.interpolate import int...
true
dce74a7ef491bd58d9c9110f0470c324aca19808
ChristofDubs/DoubleBallBalancer
/model_3d/dynamic_model.py
UTF-8
53,939
2.765625
3
[ "Apache-2.0" ]
permissive
"""Dynamic model of 3D version of Double Ball Balancer This module contains the class DynamicModel for simulating the non-linear dynamics of the 3D Double Ball Balancer and a corresponding class ModelParam containing the relevant parameters. author: Christof Dubs """ import itertools import numpy as np from numpy imp...
true
6c73d85e2818685d891b4eb7ef772436784dd4a1
prathiksha-naik/python
/python 5.py
UTF-8
241
4.03125
4
[]
no_license
#greatest of two numbers n=int(input("enter the value for n: ")) m=int(input("enter the value for m: ")) if(n>m): print("n is {} which is greater than m: ".format(n)) else: print("m is {} which is greater than n: ".format(m))
true
d9b0faae155b474a1546b929ec466b284234abc9
jschnurr/scrapyscript
/src/scrapyscript/__init__.py
UTF-8
2,853
2.875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
""" Run scrapy spiders from a script. Blocks and runs all requests in parallel. Accumulated items from all spiders are returned as a list. """ import collections import inspect from billiard import Process # fork of multiprocessing that works with celery from billiard.queues import Queue from pydispatch import dis...
true
7e183164b89a7eaf48bb552ec1b7bc2f3d7e5ccb
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_4/161.py
UTF-8
731
3
3
[]
no_license
#!/usr/bin/python def output(resposta,num_test): print "Case #%d:"% num_test,resposta def calc(v1,v2): sum = 0 for i in range(len(v1)): num1 = v1[i] num2 = v2[i] sum = sum + (num1*num2) return sum def analise (v1,v2): #print v1 v1.sort(reverse=True) #print v1 v2.sort() resp = calc(v1,v2) return ...
true
8e0d6cfde4231d1defb733dcb39993410de6a0da
Dhrumil-Zion/Competitive-Programming-Basics
/Codechef/May LuchTime 2021/Total_Components.py
UTF-8
717
3.34375
3
[]
no_license
def primeNumbers(): prime[0] = prime[1] = False i = 2 while i ** 2 < n: if prime[i]: j = i**2 while j <= n: prime[j] = False j += i i += 1 def pre(): count = 0 for i in range(1, n+1): if prime[i]: count += ...
true
52d8e5b010426dbc851e12713763a5ad8c8f5d51
doubleZ0108/my-python-study
/100Days/Process & Threading/Single_Multi_Process.py
UTF-8
1,235
3.640625
4
[]
no_license
from random import randint from time import time, sleep from multiprocessing import Process from os import getpid def download_task(filename, multi_process = False): if multi_process: print('启动下载进程, 进程号[%d]' % getpid()) print('开始下载%s...' % filename) time_to_download = randint(5,10) sleep(time_...
true
f6115a4adeba119ef2649431bfa3b6741bffad80
georgejdanforth/pistream
/fiforeader.py
UTF-8
836
2.828125
3
[ "Unlicense" ]
permissive
import os import time from queue import Queue from threading import Thread, Event class FifoReader(Thread): def __init__(self, fifoPath, interval=0.1): super().__init__(daemon=True) self.fifoPath = fifoPath self.interval = interval self._stop_ = Event() def stop(self): ...
true
4a0ffa26764e53a31da0bcf1cdba874a47a3ebb7
mickg10/DARLAB
/InvTL/lm_py/py/misc/difftime.py
UTF-8
942
2.703125
3
[ "MIT" ]
permissive
import py _time_desc = { 1 : 'second', 60 : 'minute', 3600 : 'hour', 86400 : 'day', 2628000 : 'month', 31536000 : 'year', } def worded_diff_time(ctime): difftime = py.std.time.time() - ctime keys = _time_desc.keys() keys.sort() for i, key in py.builtin.enumerate(keys): ...
true
1c5d92f3c957628295425ab763d34ddb978eed81
caesarjalu/Metnum-Metode
/Newton_Rhapson.py
UTF-8
484
3.453125
3
[]
no_license
from Function import * def newton_rhapson(aa, bb, cc): func = Functions(aa, bb, cc) x = float(input("Masukkan nilai pendekatan awal: ")) error = float(input("Masukkan error: ")) n = int(input("Masukkan banyak iterasi: ")) print("\nLoop\tx\tf(x)") for i in range(0, n): pri...
true
d23e188d7a9eb94c13be4ffe0c029a138739fa8f
kevindong/MLH_Hackathon_Tracker
/MLH_Hackathon_Tracker.py
UTF-8
2,896
3.25
3
[ "MIT" ]
permissive
# MLH Hackathon Scraper # # MLH's webpage listing all the hackathons going on in a particular year [0] # does not list the hackathons in the order in which they are announced. # Meaning, it's difficult to see know which hackathons just appeared on the # list. It'd be nice to know which hackathon you haven't yet looked ...
true
0fcb95ee73b1399ecbfef0b33a406ff95c29ee31
davidvossel/asterisk_fun
/asterisk_pong.py
UTF-8
19,762
2.734375
3
[]
no_license
#!/usr/bin/env python ''' Copyright (C) 2010 David Vossel <dvossel@digium.com> This program is free software, distributed under the terms of the GNU General Public License Version 2. Python starpy pygame python optionparser module python twisted framework ''' import time import string import random import threading...
true
d8e90442b440c1a325bd4d5ccd15546ecc915e13
smallwood-lhcb/intro2unittesting
/tests/test_models.py
UTF-8
4,533
3.171875
3
[ "CC-BY-4.0", "MIT" ]
permissive
import numpy as np import numpy.testing as npt from inflammation.models import daily_mean, daily_max, daily_min def test_everything_works(): npt.assert_array_equal(np.array([0, 0]), np.array([0, 0])) def test_daily_mean_zeros(): """Test that mean function works for an array of zeros.""" from inflammation...
true
4b471a4c7558cfabfe3b7285f7e3ce6629663c66
Killerzone21/Python-Labs-and-Projects
/Python Programs/QuirindongoA_CSCI1470_HW8/Treasure Game.py
UTF-8
4,769
4.1875
4
[]
no_license
#********************** TreasureGame.py ********************* # # Name: Alexander Quirindongo # # Course: CSCI 1470 # # Assignment: Homework Assignment # 8 # # Algorithm: # Import random and turtle for drawing graphics and determining the treasure's location randomly. # Create a turtle screen, your 2 ...
true
efdf75133d55b722fe751c5441146effd759b11f
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_212/264.py
UTF-8
1,152
2.765625
3
[]
no_license
from itertools import combinations from math import pi from heapq import * def prikazi(indeks, niz): return "Case #{}: {}".format(indeks, niz) def resitev(stevci, P): zadovolni = 0 ostanek = 0 zadovolni += stevci[0] if P == 3: m = min(stevci[1:]) M = max(stevci[1...
true
7b2e0ad23f3a7eda0faae2ba43200708dcb1c54c
jaideep5/Contact-Tracing-APP
/covid-contact-tracing/server/entities.py
UTF-8
3,912
3.140625
3
[]
no_license
from enum import IntEnum import datetime import json class Room(): def __init__(self, id, name, max_capacity, last_sanitized_time=None, current_strength=None): self.id = id self.name = name self.max_capacity = max_capacity self.last_sanitized_time = last_sanitized_time self...
true
4a85137fcd334629326304738984ade8369a0b05
sakshamTanwar/text-seg
/main.py
UTF-8
1,927
2.6875
3
[]
no_license
import cv2 import os import sys import findBestAngle import borderRemoval import lineMerge import pythonSegmentation def fixSkew(img_fl, save_fl): angle = findBestAngle.findAngleMinArea(img_fl) img = cv2.imread(img_fl) newImg = findBestAngle.rotateImage(img, angle) cv2.imwrite(save_fl, newImg) def fix...
true
86aba0d730b23a17ddf8c658cf7ab80f189a2a09
MrHamdulay/csc3-capstone
/examples/data/Assignment_3/mkhboi005/question4.py
UTF-8
366
3.765625
4
[]
no_license
start=eval(input("Enter the starting point N:\n")) start+=1 end=eval(input("Enter the ending point M:\n")) print("The palindromic primes are:") forward ="" reverse="" for i in range(start,end): forward=str(i) reverse=forward[::-1] if reverse==forward: factor=0 for j in range(1,i+1): if i%j==0: ...
true
9a07211cc6baf32943422f40711eff30ff376a1d
buteaut/CS372
/Project 1 Final/chatserve.py
UTF-8
2,758
3.4375
3
[]
no_license
# Author: Thomas Buteau # Program: Project 1 Chat Server # Course: CS372-400 # Date: 10-29-17 # Description: This is the server chat program for the project 1 assignment. It is designed to create a socket # using the port number provided as argument 0 and wait for a connection from the client program. When the con...
true
0df2237db4c90223f2049d5a2b078bcac744d331
adan093/Html-CSS
/exo en Python/benhamed/cour tableau.py
UTF-8
506
3.671875
4
[]
no_license
cours les tableaux en Python 1) declarer un tableau nomtableau=[] 2) acceder a un element nomtableau[ indice ] 3) ajouter un element du tableau nomtableau.append(indice) 4) parcourir un tableau - a)parcourir par element for element in nomtableau: print element parcourir un indice fo...
true
f42cc62291041c07f29fafca95d43e68a5a9cd71
magnusjonsson/tidder-icfpc-2008
/playground/python/alpha-beta/alphabeta.py
UTF-8
2,946
3.3125
3
[]
no_license
# Each game state has a heuristic score associated with it. # Ending states has an end score associated with them. # End scores and heuristic scores must be compatible, ie it should # be possible to compare them and get a meaningful result. # There are two types of player: # 'max' : will try to maximize the score # '...
true
8b3caf893474cbb1aaad02ea3d05274ebe699f05
jaojpaulo/filereader
/main.py
UTF-8
237
2.828125
3
[]
no_license
import re def openAndFile(self, fileName): fileContent = [] inputFile = open(fileName, "r") for line in inputFile: fileContent.append(line) inputFile.close() return fileContent
true
31bf46c442917d12fb7365f582ccf3f49a0f39a8
maureen-qui/AirBnB_clone_v2-1
/3-deploy_web_static.py
UTF-8
2,395
2.765625
3
[]
no_license
#!/usr/bin/python3 """Deploy web static package """ from fabric.api import * from datetime import datetime from os import path env.hosts = ['18.209.20.255', '34.73.76.135'] env.user = 'ubuntu' env.key_filename = '~/.ssh/id_rsa' def do_pack(): """Function to compress directory Return: path to archive...
true
bcf94672ae29b2d9a71c62d2a260f72e57f8dcd5
kaisjessa/Project-Euler
/pe007.py
UTF-8
240
3.25
3
[]
no_license
import math count = 1 n = 3 def isPrime(x): upper = int(math.sqrt(x))+1 for i in range(2, upper): if(x%i == 0): return False return True while True: if(isPrime(n)): count += 1 if count == 10001: print(n) quit() n += 2
true
67572eac2a78439a0454952b2a965c4522a33a3d
axu4github/Learn
/learn_python/test_multiprocessing.py
UTF-8
1,014
3.171875
3
[]
no_license
# -*- coding: UTF-8 -*- ''' 学习 python 多进程 ''' from multiprocessing import Process import os class MP(object): name = "MP" def main(self): print 'main func' kwargs = {'a':'a', 'b':'b'} arg = 'arg' arg2 = 'arg2' arg3 = 'arg3' args = ['arg1', 'arg2'] pri...
true
cb89680c777ac4799488c75d8fce60779296d294
benjaminpommier/vic
/main_encoder.py
UTF-8
898
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Feb 23 20:22:46 2020 @author: Benjamin Pommier """ from features_encoder import ImageEncoder, compute_features, save from label_encoder import LabelEncoder, encode_labels import matplotlib.pyplot as plt import pandas as pd import glob import time #%% # Define the paths ORIG...
true
9872fcf317bfd1c72e4656fc7e246487d22279da
lumbermixalot/lumbermixalot
/fcurvesmixalot.py
UTF-8
21,456
3
3
[ "MIT" ]
permissive
# Useful functions to work with fcurves (animation key frames) import bpy import mathutils class FCurveDataPath: LOCATION_X = ('location', 0) LOCATION_Y = ('location', 1) LOCATION_Z = ('location', 2) QUATERNION_W = ('rotation_quaternion', 0) QUATERNION_X = ('rotation_quaternion', 1) QUATERNION_...
true
0727fd4c8829930d9d95b3fea0131c05100b6b61
RBSegarra/MoP-Generator
/Mopgen.py
UTF-8
3,382
2.5625
3
[]
no_license
import openpyxl as xl import xlrd import os try: filename = "none" filename1 = "none" # mop sheet search for col location p_name = 0 w_sale = 0 rtail = 0 inum = 0 shipping = 0 variations = 0 # clean sheet search for col locations s_p_name = 0 sw_sale = 0 ...
true
96cb283b09052ee44cad0ec880d54a57c6e96df8
joshcv2112/ProgramingProblems
/fizz_buzz.py
UTF-8
389
4.875
5
[]
no_license
# Fizz Buzz # Cycle through 1 and 100, for multiples of 3 print "Fizz" # for multiples of 5 print "Buzz", and for multiples of 3 and 5 print "FizzBuzz" def fizz_buzz(): for x in range(1, 101): if (x % 3 == 0 and x % 5 != 0): print("Fizz") elif (x % 5 == 0 and x % 3 != 0): print("Buzz") elif (x % 3 == 0 an...
true
a21a83a2da6951bcd491ec580307f81b750a3422
Wolvarun9295/PythonLibraries
/Matplotlib/9.AxisLimits.py
UTF-8
224
3.5625
4
[]
no_license
import matplotlib.pyplot as plt X = range(1, 50) Y = [value * 3 for value in X] plt.plot(X, Y) plt.xlabel('x - axis') plt.ylabel('y - axis') plt.title('Draw a line.') print(plt.axis()) plt.axis([0, 100, 0, 200]) plt.show()
true
d412f486c27eb207c10a407ff4eac7d64a4e6be6
Talkytitan5127/5_lang_frequency
/5_lang_frequency.py
UTF-8
1,201
3.828125
4
[]
no_license
import os import re import argparse from collections import Counter def get_content_from_file(filepath): if not os.path.exists(filepath): raise FileExistsError('File doesn\'t exist') with open(filepath, "r") as file_handler: return file_handler.read().lower() def get_most_freque...
true
a2bdfb69063ce5ba833fb5200b27f431a458a34f
kouamegerard/My-NaN-Biblio
/make-piston/create-piston.py
UTF-8
2,192
3.1875
3
[]
no_license
# coding: utf-8 import random import math import time """ simulation d'une chaine de montage de piston """ t_piston = "tete du piston" j_piston = "jupe du piston" a_piston = "axe du piston" c_tete = [] c_jupe = [] c_axe = [] c_piston = [t_piston, j_piston, a_piston] # simulation d'un dock def create_dock(n_carton...
true
5ce88967aa428fc8868817dee705a456c4340719
DongChengdongHangZhou/sklearn-classification
/svm.py
UTF-8
3,316
2.75
3
[ "MIT" ]
permissive
import numpy as np from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler import matplotlib.pyplot as plt from sklearn.datasets import make_moons from sklearn.svm import SVC from sklearn.datasets import make_blobs from sklearn.cluster import KMeans from sklearn import metrics im...
true
31208f02fa47525b29f14ba49e39947c2223d5a9
astroww/X-HS2O3
/simu_bd/plot.py
UTF-8
1,038
2.640625
3
[]
no_license
import numpy as np import pylab as pl da1 = np.loadtxt('6724-0-v2.txt') # testing line #da2 = np.loadtxt('656-7-0.TXT') da3 = np.loadtxt('6724-17-v2.txt') #da4 = np.loadtxt('656-8-15.TXT') pl.plot(da1[:,0],da1[:,1],'k',lw=2,label='cwl $\sim$ 659.0 nm') #pl.plot([660.4, 660.4], [0,95.8]) #pl.plot([657.6, 657.6], [0,9...
true
d06aa78e7c7cf5eb44e2b3d630cb3f5084bf760d
Endyrmion/ProgramDesignMethod_BasicPython
/Assignment 4/The Employee Class.py
UTF-8
4,249
3.265625
3
[]
no_license
class Employee: def __init__(self, id, firstName, lastName, salary): self.id = id self.firstName = firstName self.lastName = lastName self.salary = salary def getID(self): return self.id def getFirstName(self): return self.firstName def get...
true
d46ff6d43c267e35f87d8d3aef11d5cf1c2ba9bb
jessieliu1/hackust
/hackust/importer.py
UTF-8
2,638
2.6875
3
[]
no_license
import os import flask import hackust from PIL import Image import cv2 import pytesseract import shutil THIS_FOLDER = os.getcwd() INPUT_FOLDER = hackust.app.config['UPLOAD_FOLDER'] TMP_FOLDER = os.path.join(THIS_FOLDER, "tmp") OUTPUT_FOLDER = os.path.join(THIS_FOLDER, "txt") def prepare_folders(): """ :return...
true
2d976a95a0e0e0fbe6e28a6a5df66ccfd87c3a48
Ab4rdo/Python_Algorithms
/binary_search/BinarySearch.py
UTF-8
592
4.25
4
[]
no_license
def search(seq, target): """ Implementation of binary_search search algorithm :param seq: a sorted integer list :param target: a value to search :return: index of target or raise ValueError if target not in the seq or if seq is empty """ if not seq: raise ValueError('List is empty...
true
5bfa139ecaa159635860467cf4df216052e5be99
j5int/j5basic
/j5basic/Module.py
UTF-8
4,881
2.53125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from future import standard_library standard_library.install_aliases() from builtins import * import logging import os import pkgutil import sys im...
true
dbe5948a2977f7a4b1702dbf6d8e283cc519a6e8
fhirschmann/penchy
/penchy/tests/test_statistics.py
UTF-8
1,126
2.875
3
[ "MIT" ]
permissive
from penchy.compat import unittest from penchy.statistics import * from numpy.random import random_integers, random_sample import numpy as np class StatisticsTest(unittest.TestCase): def setUp(self): self.ints = random_integers(0, 50, 50) self.floats = random_sample(20) def test_average(self)...
true
4aa93937c2804b114a70ac24860d7328f8b49c04
ELW4156/W4156
/lecture_code/testing/fakenews_worked_example/test/TestIndicators.py
UTF-8
1,605
2.875
3
[]
no_license
import unittest from indicators.indicators import DomainFakenessIndicator class TestIndicators(unittest.TestCase): def test_black_box(self): domainFI = DomainFakenessIndicator() domainFI.init("data/knowndomains.csv") inWhitelistURL = "https://www.theguardian.com" score = domainFI....
true
20f5ff15187ecab24582f9f9355628b5cc7c3bd8
liugenghao/test
/jump7.py
UTF-8
118
3.203125
3
[]
no_license
a = 0; while a < 100: a = a+1 if a%7 == 0 or a%10 == 7 or a/10 > 7 and a/10 < 8: pass else: print(a)
true
6a1ece9781155d7914dfaaab5554f0d52d06ff08
AndyWood91/RATS_STATS
/RATSApp/raw_game_hierarchy.py
UTF-8
11,364
3.203125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # raw_game_hierarchy.py # made from game_hierarchy.py @ 28/4/17 - thank you andy # separation of concerns - this is minimally complex # it will hold all the data taken from the game in the simplest structure # such that it can be read into game_analysis.py to give useful ...
true
314bedf1bf2cdc68a152a97e111c48be7662042a
smohapatra1/scripting
/python/practice/day67/find_number_of_chicken_dogs.py
UTF-8
1,805
4
4
[]
no_license
''' https://courses.edx.org/courses/course-v1:UTArlingtonX+CSE1309x+1T2018/courseware/e3b7d74dca244a08b208d1f4b68e49e0/d3906c7bc4234b25a8c0ad53e8be0bbd/?child=first Quiz 3, Part 8 (Find number of chickens and dogs function) Bookmark this page Quiz 3, Part 8 0.0/10.0 points (graded) Write a function that accepts two po...
true
f2f95b2970e95bf1b9dd9a4df3dd6b2a81b80f83
Shovon588/Programming
/CodeChef/JULY20 - Chefina and Swaps.py
UTF-8
1,618
2.78125
3
[]
no_license
for I in range(int(input())): n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) a.sort() b.sort() dic = {} dica = {} dicb = {} for num in a: if num in dic: dic[num]+=1 else: dic[num]=1 if num...
true
d9cfeb7cdbf095828c0b413f0abf04280922a7c0
Peter-Pater/Introduction-to-Computer-Science
/Exercises/LAB Exercises/week6/ex1_1.py
UTF-8
515
3.53125
4
[]
no_license
from ex1 import* def main(): employee[ID_number] = add_new_employee() def look_up_employee(): input('please enter ID_number',ID_number) if ID_number in list(employee.keys()): return employee[ID_number] else return 'the employee doesn\'t exist' def add_new_employee(): name = input('please enter name:') ID_n...
true
ecf4b2ae657775cd15df15156fad89a492f8ce10
MrSmily/Code_Em_Winter_2017
/Python Projects/Alec_turtle Ovole.py
UTF-8
320
3.265625
3
[]
no_license
import turtle t=turtle.Pen() t.speed(0) t.up() t.backward(50) t.down() t.right(75) for i in range(150): t.forward(1) t.left(1) for i in range(65 ): t.forward(1) t.left(0.45) for i in range(150): t.forward(1) t.left(1) for i in range(75): t.forward(1) t.left(0.45)
true
d53946fe771be8d06ba70a21fa0a3a55cc010e8d
deividVentas/ejercicios_python
/python/9-3-crea-usuarios.py
UTF-8
1,195
3.109375
3
[]
no_license
class Usuarios(): def __init__(self, nombre, apellidos, twitter, localidad): self.nombre = nombre self.apellidos = apellidos self.twitter = twitter self.localidad = localidad def describe_usuario(self): print("El usuario " + self.nombre.title() + " " + self.apellidos.title()) print("Su twitter...
true
093b3ec7ede7569b425f031b0496f5d3a345ca2a
CongoCash/Rocket
/Updated/techcercises/primeMover/prime_mover.py
UTF-8
300
3.78125
4
[]
no_license
# Using the Python language, have the function PrimeMover(num) return the numth prime number. # The range will be from 1 to 10^4. # For example: if num is 16 the output should be 53 as 53 is the 16th prime number. # Input = 9 Output = 23 # Input = 100 Output = 541 def prime_mover(num): pass
true
c01ed406d10bc9bbe305b8b97a6b9bedc76f9ae7
SamSmith0101/vampy2017
/Primes.py
UTF-8
214
4.15625
4
[ "MIT" ]
permissive
N = int(input("NUMBER: ")) isPrime = True for test in range(2, N): if N % test == 0: isPrime = False print("{0} is a factor.".format(test)) if isPrime: print("It is prime") else: print("It is not prime")
true
858093a3005e16c469b35cd83cbce86869444b82
nwestbury/StockAnalyzer
/src/sa/__oldbots/linearbot.py
UTF-8
2,226
2.9375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 from sa.bots.basebot import BaseBot from sa.bots.features import Features from sa.common import get_ticker_names from sa.database import Database from sa.tools.returncalc import ReturnCalcuator from sa.logger import LOGGER from datetime import datetime, timedelta from math import ceil import ra...
true
d4983b19c959f16278108e5cb60b0cfd870fe6db
jalotra/DigitalCommunication
/BasebandSignalTransmission/GaussianNoise.py
UTF-8
5,387
3.734375
4
[ "MIT" ]
permissive
''' This class contains code to implement the different types of noises that we encounter while learning Digital Communication. ''' # Works only with integral values of starting_time, ending_time and time_period # Learn why does samples taken from gaussian function consitutes a white_noise. # Next I HAVE TO IMP...
true
8acc24438c13317dd4659575ba6f2f7f8f0ac8e8
ft9738962/flask_practice
/forms.py
UTF-8
4,239
2.578125
3
[]
no_license
from flask_wtf import FlaskForm from flask_wtf.file import FileField, FileRequired, FileAllowed from wtforms import StringField, TextAreaField, PasswordField, BooleanField, SubmitField, MultipleFileField from wtforms.validators import DataRequired, Length, ValidationError, Email from flask_ckeditor import CKEditorF...
true
76d14053cade17dae90978e15929cb0090567da5
mitchh300/CustomTools
/Delete_Dups.py
UTF-8
1,691
3.125
3
[ "Unlicense" ]
permissive
## Author: Mitch Holley ## Date: 08/30/2016 ## Version: 2.7.8 ## ## This script is meant to be imported into an ArcGIS script. The purpose of the tool is to delete duplicate ## records in a specific field. A checkbox is included in the script to check for duplicate geometries. ## Both a specific field AND t...
true
14d73287ee2e669bebfedcc4dfc5945cc5502c69
helenakolodko/Algorithms
/maximum_subarray.py
UTF-8
2,065
3.546875
4
[]
no_license
import sys def find_max_crossing_subarray(array, low, mid, high): left_sum = -sys.maxint temp_sum = 0 max_left = mid for i in range(mid, low - 1, -1): temp_sum += array[i] if temp_sum > left_sum: left_sum = temp_sum max_left = i right_sum = -sys.maxint t...
true
b820f8c86576d2a527c4c4e9e7f160f7fd4ff1dd
MauKi/ccri
/concepts/Class_3/sales.py
UTF-8
205
3.859375
4
[]
no_license
# # This program calculates 23% profit of # annual sales inputted by the user. # sales = float(input('Enter Total Sales: ')) profit = sales * 0.23 print('Total Profit: $', format(profit,'.2f'), sep = '')
true
6f2ce34d235578889f3a85feac9e39f859292713
yanfeiwong/STH
/MPU/motor.py
UTF-8
1,397
2.578125
3
[]
no_license
import pigpio,time,smbus pi = pigpio.pi() ma0=14 ma1=15 t=0.005 bus = smbus.SMBus(1) address = 0x68 power_mgmt_1 = 0x6b power_mgmt_2 = 0x6c bus.write_byte_data(address, power_mgmt_1, 0) #bus.write_byte_data(address, 0x1b, 0x18) gxoff=gyoff=gzoff=0 dx0=dy0=dz0=dxx0=dzz0=dyy0=0 def read_byte(adr): return bus.re...
true
a0cccfb91d241f3fe91d5a7b726fbeb80f6405d8
hashin22/pythonProject
/week12/test.py
UTF-8
23
2.765625
3
[]
no_license
r = [1, 2, 3] print(r)
true
83e68acb42ce2355d7a34153b48eebf88866043d
ziaulazam/code-snippets
/python/src/core.py
UTF-8
892
3.671875
4
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from . import helpers def get_sum(num1, num2): """ Adds two numbers. Args: num1 (int/float): The first number. num2 (int/float): The second number. Returns: int/float: The sum of two numbers. """ if isinstance(num1, str) or isinstance(n...
true
75325ee68a31a5f47f629fc7bd66d8fcaa2ee13c
aswinsvijay/InternshipBot
/src/utils/sql.py
UTF-8
5,130
2.53125
3
[]
no_license
import aiomysql import os from dotenv import load_dotenv load_dotenv() MYSQL_HOST = os.getenv('MYSQL_HOST') MYSQL_USER = os.getenv('MYSQL_USER') MYSQL_PASSWORD = os.getenv('MYSQL_PASSWORD') MYSQL_DATABASE = os.getenv('MYSQL_DATABASE') class Database: def __init__(self, db): self.db = db async def set...
true
25129778ab72bc8715d33df22c350876ae9b8bbd
CodevilJumper/CodeWars
/which_are_in.py
UTF-8
543
4.40625
4
[]
no_license
def in_array(array1, array2): """Given two arrays of strings a1 and a2 return a sorted array r in lexicographical order of the strings of a1 which are substrings of strings of a2.""" return_list = [] for word1 in array1: for word2 in array2: if word1 in word2: if ...
true
1a08b0a88755e655501a6f2740ace97ff9a8fc89
thefish115/pga
/gaApp.py
UTF-8
742
2.9375
3
[]
no_license
from tkinter import Tk, Frame, BOTH from drawings import getBounds, getObs from gaCanvas import GACanvas class App(Frame): def __init__(self, master, bounds, obs): super().__init__(master) self.initialize(bounds, obs) def initialize(self, bounds, obs): self.master.title("2D PGA") ...
true
3f1ed89f36b491e961d2a46e03f92163786ae6fa
jad-b/Crank
/crank/core/workout.py
UTF-8
3,457
2.875
3
[ "MIT" ]
permissive
from collections.abc import Iterable, Mapping from datetime import datetime from pprint import pformat from crank.core.exercise import Exercise from crank.util.cli import read_until_valid from crank.util.logging import logger from crank.util.time import parse_timestamp from crank.core.tags import parse_tags class Wo...
true
fe3e44d981d11fc91f1fc87d1674bd01be2c1cf9
Krishan00007/Python_practicals
/practical_4(3).py
UTF-8
405
4.09375
4
[]
no_license
""" Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order """ text_file = open('text.txt', 'r') text = text_file.read() text = text.lower() words = text.split() words = [word.strip('.,!;()[]') for word in words] unique = [] for word in words: ...
true
88578a0cea2aebe5ada83590e31a800efa42bc5d
joaosoares/xray_teeth_detection
/src/shape.py
UTF-8
7,756
2.921875
3
[ "MIT" ]
permissive
"""Procrustes method library""" from itertools import chain from typing import List, NewType, Tuple, Union, Any import cv2 import numpy as np from scipy import interpolate from point import Point class Shape: def __init__( self, points: Union[List[Point], np.ndarray], gray_level_profiles=[] ) -> No...
true
69e32aff544c119ce02fe3476201f9310fa127dd
anasssaghir/mundiapolis-ml
/0x01-classification/3-neuron.py
UTF-8
1,675
3.25
3
[]
no_license
#!/usr/bin/env python3 """ Module contenant la classe neurone """ import numpy as np class Neuron: """ la classe qui définit un neurone """ def __init__(self, nx): """ constructeur de la classe la variable nx: est le nombre d'entités d'entrée du neurone ...
true
600f822e50e7f173b821f12cc38c2f3c42cb7892
DanikKaragodin/python
/31.10.2020/StonePaperCut.py
UTF-8
1,986
4.0625
4
[]
no_license
import random def computerChoose(choose): d = {1: "Ножницы", 2: "Бумагу", 3: "Камень"} print("Компьютер выбрал", d[choose]) #def whoWin(man,computer): def statistic(ManWins,ComputerWins,ManCutChoose,ManPaperChoose,ManStoneChoose): print("Количество побед у человека:", ManWins) print("Количе...
true
1036871e8f3dcd9bceb707cbec5b5f9b8402a741
gimquokka/problem-solving
/Programers/Lv_1/모의고사.py
UTF-8
796
3.25
3
[]
no_license
def solution(answers): length = len(answers) first = [1, 2, 3, 4, 5]*(length//5+1) second = [2, 1, 2, 3, 2, 4, 2, 5]*(length//8+1) third = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]*(length//10+1) f_count, s_count, t_count = 0, 0, 0 i = -1 for ans in answers: i += 1 if first[i] == a...
true
e1da77211ee79561e2f4f69284dd51143e014d0c
NickLucche/ai-toy-games
/toy_games/test/test_snake_env.py
UTF-8
866
2.953125
3
[]
no_license
import gym from toy_games.games.snake import Action import numpy as np env_name = 'toy_games:Snake-v0' def test_make_env(): gym.make(env_name) def test_run_env(): import time snake = gym.make(env_name, render_shape=(30,30), body_len=4) n_episodes = 10000 fps = 0 s = time.time() for i...
true
a438fc9f7598bf18c371fe1b0461b7d4ae088e02
mysticwzm/ExtremeComputing
/Assignment2/Task4.2/reducer.py
UTF-8
1,102
2.765625
3
[]
no_license
#!/usr/bin/python import sys from operator import itemgetter preOwnerUserId, prePostId = sys.stdin.readline().strip().split('\t',1) count = 1 PostIds = prePostId maxCount = 1 maxOwnerUserId = preOwnerUserId maxPostIds = prePostId for line in sys.stdin: OwnerUserId,PostId = line.strip().split('\t',1) #if it is...
true
d172ec628781f508274036c7da049c8f808e1cb7
vpersie9/cottage
/Algorithms/c3_structures.py
UTF-8
924
3.8125
4
[]
no_license
class Binary_tree(object): def __init__(self,root): self.key=root self.left_child=None self.right_child=None def insert_left(self,new_node): if self.left_child==None: self.left_child=Binary_tree(new_node) else: t=Binary_tree(new_node) t.left_child=self.left_child self.lef_child=t def insert_...
true
d80e88797398c83422f710ce5e8241f3a412163d
greglama/MarkovChain
/Chain2.py
UTF-8
1,739
3
3
[]
no_license
import os import sys import random import re def normalizeTextForAlgo(text): chars = ",.;/:!()[]-" text = text.replace("...", "3DOTS") for c in chars: text = text.replace(c, " " + c + " ") text = text.replace("\n", " \n") text = text.replace(" "," ") text = text.replace(" ", ...
true
08383a72b40df496986c4f6863d40eca98f88029
goodbai-nlp/MyScripts
/process.py
UTF-8
720
2.84375
3
[]
no_license
# -*- coding: utf-8 -*- from collections import Counter import json import argparse def posTaggerCnt(data,output): tagger = Counter() for line in open(data,'r'): words = line.strip().split(' ') tagger.update(words) jsObj = json.dumps(tagger) fileObj = open(output,'w') fileObj....
true
d2734030b635d1f499bd4438e2376b53b16fa44c
jdarangop/holbertonschool-higher_level_programming
/0x04-python-more_data_structures/10-best_score.py
UTF-8
382
2.859375
3
[]
no_license
#!/usr/bin/python3 def best_score(a_dictionary): if a_dictionary is None or a_dictionary == {}: return None keys = list(a_dictionary.keys()) maximo = -100000000 for i in a_dictionary.keys(): tmp = a_dictionary.get(i) if tmp is None: return None if tmp > maximo...
true
a1c97d86682a60cfd66d5159d399b1aa6af86ac3
pjain4161/HW04
/HW04_ex08_05.py
UTF-8
1,078
4.1875
4
[]
no_license
#!/usr/bin/env python # HW04_ex08_05 # The following program counts the number of times the letter a appears in a # string: # word = 'banana' # count = 0 # for letter in word: # if letter == 'a': # count = count + 1 # print count # Encapsulate this code in a function named "count...
true
3ab67523cf9a53ad7db251ce5bddd83fb72cf504
sunhaiting123/python-local
/com/test/test_while.py
UTF-8
918
3.5
4
[]
no_license
# name = input("Please enter your name: ") # print("Hello, " + name + "!") # n = 1 # while n <= 5: # print(n) # n += 1 # prompt = "\nTell me something, and I will repeat it back to you:" # prompt += "\nEnter 'quit' to end the program. " # message = "" # while message != 'quit': # message = input(prompt) #...
true
b40e47fd458f63e213ab4257aaa0f11bca4cf44f
Rodrun/weatherguess
/collection.py
UTF-8
3,073
3.6875
4
[ "MIT" ]
permissive
"""Collection system for city weather data. Simplifies collecting weather data from openweathermap.org by making changes to data needs easy to do. The 'getlist' is a list of strings with desired data from the weather data. The format of the string: parent.child Where parent is a field in the JSON that contains othe...
true
8bc0f112c43ab6c05c8022763ffd8b84412ffcd5
Teknowledge/Curriculum
/machine_learning_curriculum/0.0 CS Refresher and Python Transition/dictionaries.py
UTF-8
1,301
4.15625
4
[]
no_license
d = { "cow":5, "dog":98, "cat":1 } print(d) # ditto! print("___________") ages = dict() key = "fred" value = 38 ages[key] = value # "fred" is the key, 38 is the value print(ages[key]) print("___________") d = dict() # d[key] = value d[2] = 100 # No key present, so it adds the key:value to the dictionary d[4] = 20...
true
a8de922541a5d7b4a47f9a5e84b7270648dd54f6
Qiao-Liang/LeetCode
/LC82.py
UTF-8
1,055
3.578125
4
[]
no_license
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def deleteDuplicates(self, head): """ :type head: ListNode :rtype: ListNode """ if not head: return None ...
true
01dc5dba56a43a843c3073ff4757059f775fe428
wiliamhw/Flask-CS50-Stock-Exchange-CRUD
/application.py
UTF-8
13,887
2.75
3
[]
no_license
# export FLASK_APP=application.py # export API_KEY=pk_7dbf239de0c34920905ac2112f81db74 import os import datetime from cs50 import SQL from flask import Flask, flash, jsonify, redirect, render_template, request, session from flask_session import Session from tempfile import mkdtemp from werkzeug.exceptions import defa...
true
ce76027d928c2eea094f018708c02039f463136f
imposter2not/py-automatehelper
/lib/old_window.py
UTF-8
1,953
2.875
3
[]
no_license
#! python3 """ manipulating window """ import re import win32gui import win32com.client from PIL import ImageGrab def testload(): print("i2n-window.py loaded") # get the title of the current active window def getcurrentwindow(): active_window_title = win32gui.GetWindowText(win32gui.GetForegroundWindow())...
true
96df07297bd71f4681c3ac9668483f91051bf4e9
kusha/qas
/evaluation/processing.py
UTF-8
1,555
3.203125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 """ This script processes generated distributions and generates graphs. Usage: python3 processing.py """ import numpy as np import scipy.stats as stats import matplotlib.pyplot as plt from distribution_processing_time import processing_time from distribution_paths_length import paths_length f...
true