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
ce1763b32f96350eba79a81a0b95033b5d443cfd
edeno/nelpy
/nelpy/core/_eventarray.py
UTF-8
83,638
2.625
3
[ "MIT" ]
permissive
__all__ = ['EventArray', 'BinnedEventArray', 'SpikeTrainArray', 'BinnedSpikeTrainArray'] """ idea is to have abscissa and ordinate, and to use aliasing to have n_series, _series_subset, series_ids, (or trial_ids), and so on. What is the genericized class? EventArray? eventseri...
true
419c5f96515957bcc502d2b25b3ed52d4132a18a
csdms/pymt
/pymt/events/empty.py
UTF-8
429
2.578125
3
[ "MIT" ]
permissive
"""An empty event. :class:`PassEvent` implements an event-like interface but doesn't do anything. This can be a useful event to give to an :class:`EventManager` if you want to force the manager to stop at particular intervals. """ class PassEvent: """An event that doesn't do anything.""" def initialize(self...
true
98474cca0b24616e605dee0a422be99b3c6972ca
mnooraali/Pythonproject
/specificsearch.py
UTF-8
717
3.453125
3
[]
no_license
import datetime def specificdate(): print("Specific...") specific = input("Enter the date you want to search for its project: ") try: datetime.datetime.strptime(specific, '%Y-%m-%d') showfile = open("newprojects.txt") filedata = showfile.readlines() for project in filedata: ...
true
569449dd0870f89c70ca1431d671e350036afc7c
susil-github/PythonProjects
/ForLoopExample.py
UTF-8
129
3.75
4
[]
no_license
# this shows the for loop example i = 0; num = int(input("Enter the range number")); for i in range(0,num): print(i,end=' ')
true
dafef81f7c4029620631feaf312e22b91ab4c12b
yanivn2000/Python
/Syntax/Module5/39_isInstance.py
UTF-8
315
4.1875
4
[]
no_license
#Slide 14 #Basic ineritance: members and functions class C: x = 1 def f1(self): print("f1") class D(C): y = 2 def f2(self): print("f2") c1 = C() d1 = D() print(isinstance(c1, C)) #True print(isinstance(c1, D)) #False print(isinstance(d1, C)) #True print(isinstance(d1, D)) #True
true
f74827ed6b6e22dfd5c35fc7ab89ede140ffda8d
joeydubey/llm
/test/test_orders.py
UTF-8
2,533
3.5625
4
[]
no_license
import unittest from order import Order from orders import get_all_orders, get_available_orders, get_order, get_new_order_id #Sample orders to use in testing o1 = Order(1, "DEL", "BOM", True) o2 = Order(7, "Hong Kong", "Singapore", False) o3 = Order(4, "Kennedy Town", "Sheung Wan", False) test_orders = sorted([o1, o2,...
true
cf78d495a991b40bc012e91462dd9ea655ce9936
unrealcv/unrealcv
/test/server/rr_test.py
UTF-8
953
2.71875
3
[ "MIT" ]
permissive
''' Test to verify the RealisticRendering environment. Because we already know a lot about the RealisticRendering environment, we assume some of its properties, such as object location, material color, etc. And use these as ground truth to verify the plugin. ''' import pytest @pytest.mark.skip(reason="Not implemented"...
true
1376c57fd58a7ee934ec9c67a55498c0c5e78150
akita8/scrapper
/backend/tests/test_models/test_current.py
UTF-8
215
2.609375
3
[ "MIT" ]
permissive
"""Tests for current module of models package.""" def test_current_key(models): """It tests the models' method key.""" model, values, key = models model.from_dict(values) assert model.key() == key
true
4dcfb1343672db3ed942fb587e232623c3af9a0e
parthx9/FindHacks
/api/app.py
UTF-8
738
2.515625
3
[ "MIT" ]
permissive
from flask import Flask, jsonify from flask_cors import CORS, cross_origin import json app = Flask(__name__) CORS(app, support_credentials=True) @app.route('/') def hello_world(): return 'Hello, World!' @app.route('/hacks', methods=['GET']) def getMLHHacks(): all_hacks = [] with open('data.json') as da...
true
bdc37708ccb0f7dc435843e6ee2abe683c14d2ce
SquirrelBrain/django-blueprint
/scripts/environment/persona.py
UTF-8
2,018
3.140625
3
[ "MIT" ]
permissive
""" Quickly set the appropriate DJANGO_SETTINGS_MODULE """ from pathlib import Path def check_file_system(abspath): """Checks filesysten for required directories Parse through the Django Project Root to ensure that all required directories exist, creating them if they do not. Args: abspath ...
true
aae68863914bb68f05a5265b80c2fbd17adb7769
anandu467/Sorty
/context.py
UTF-8
7,153
2.546875
3
[ "MIT" ]
permissive
# A sample context menu handler. # Adds a menu item with sub menu to all files and folders, different options inside specified folder. # When clicked a list of selected items is displayed. # # To demostrate: # * Execute this script to register the context menu. `python context_menu.py --register` # * Restart explorer....
true
e3e2edd2b02f86618eabe1245c1c3aea462607c0
g-chen201/OptionPricig_Tree_OOP
/Option.py
UTF-8
4,960
2.65625
3
[]
no_license
# -- coding utf-8 -- # Time 172019 216 PM # Author Guanlin Chen import math as m import copy as cp class Option def __init__(self, T, K, kind='call', geo='European') self.K = K self.T = T self.putcall = kind self.geo = geo class Underlying def __init__(self, s...
true
3ad68fc96f7016c92694f465c15c250ca2456cb4
AdamZhouSE/pythonHomework
/Code/CodeRecords/2986/47996/321500.py
UTF-8
671
3.171875
3
[]
no_license
#include <string.h> #include <iostream> using namespace std; /*将字符串A转换为字符串B最少的操作次数*/ int minEditDistance(string A,string B) { int A_len=A.length(); int B_len=B.length(); int D[B_len+1][A_len+1]; D[0][0]=0; for(int i=1;i<=A_len;i++) { D[0][i]=i; } for(int i=1;i<=B_len;i++) {...
true
b73506f827217607bc0338e0b1520fee6147b357
jdemel/GFDM-PHY-Reference
/simulation/modem/util/frame_multiplexer.py
UTF-8
691
2.765625
3
[ "MIT" ]
permissive
import numpy as np class FrameMultiplexer(): def multiplex_frame(self, data, preamble): ''' Frame Multilpexer Parameters ---------- data : 1d or 2d array Array of data blocks. 1st dimension - number of blocks, ...
true
a3ab676daf1a264a0523dcabb3bf7d8ec956003f
seanahmad/audioImprovement
/datasets/hdf5_dataset.py
UTF-8
1,228
2.90625
3
[]
no_license
import os import warnings from typing import List, Tuple import h5py import librosa import numpy as np from torch.utils.data import Dataset class HDF5Dataset(Dataset): """Dataset of noisy and clean pairs taken from an hdf5 file """ def __init__(self, hdf5_path: str, transform=None) -> None: """ ...
true
4a40ba22f98fb578adf4c9bfb58dd3143feb3620
cryptonitas/cryptonita
/cryptonita/conv.py
UTF-8
11,947
3.53125
4
[]
no_license
''' >>> from cryptonita.conv import B # byexample: +timeout=10 >>> from cryptonita.conv import as_bytes, transpose, uniform_length, repack, join_bytestrings >>> from cryptonita.bytestrings import MutableByteString, ImmutableByteString ''' def as_bytes(raw, encoding='ascii', mutable=False): r''' ...
true
0806c1848c870f0be96796ca96bf3852b3137231
Jason-Toh/FYP
/Program/Algorithm/interface/home_pred.py
UTF-8
5,422
2.8125
3
[]
no_license
from tkinter import * from tkinter import ttk from tkinter import messagebox #====================( Class )==================== class HomePred(): #====================( Functions )==================== def __init__(self, home): #====================( Variables )==================== self.base = [...
true
36189ce4c7037d851a74526023c632434f66eb63
wujianming/Machine-learning-raschka
/raschka_4_preprocessing.py
UTF-8
1,093
2.90625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Mar 04 23:05:00 2017 @author: raghavrastogi """ import pandas as pd df = pd.DataFrame([['green', 'M', 10.1, 'class1'], ['red', 'L', 13.5, 'class2'], ['blue', 'XL', 15.3, 'class1']]) df.columns = ['color', 'size', 'price'...
true
df827f8794307425306bbc0e6ffe6f9f0bec8de2
valievav/api_auto_tests
/tests/integration/test_blog.py
UTF-8
982
3
3
[]
no_license
from unittest import TestCase from blog import Blog class BlogTest(TestCase): def test_create_post(self): b = Blog('My blog', 'VV') b.create_post('Post 1', '1') self.assertEqual(1, len(b.posts)) self.assertEqual('Post 1', b.posts[0].title) self.assertEqual('1', b.posts[0...
true
bca7f346b2ada7aabc8b6792e93a90d09ea37ce5
esphill/course
/PA5/crack.py
UTF-8
6,946
3.625
4
[]
no_license
# CSE 130: Programming Assignment 5 # crack.py # Jay Ceballos # A09338030 # jjceball@ieng6.ucsd.edu from misc import * import crypt def load_words(filename,regexp): """Load the words from the file filename that match the regular expression regexp. Returns a list of matching words in the order they...
true
7d4c2323b2e1eb74cce7d56330013cf515e6693e
yjhoon2/Coding_test
/Programmers/Level2/예상_대진표.py
UTF-8
214
2.875
3
[]
no_license
def solution(n,a,b): answer = 0 while True: q, r = divmod(a, 2) a = q+r q, r = divmod(b, 2) b = q+r answer += 1 if a == b: break return answer
true
c7b82285e70a33d5f53242f1689e017b8acbb571
AssafHMor/intro2cs-python
/intro2cs-python/ex3/findSecondSmallest.py
UTF-8
1,125
3.734375
4
[]
no_license
############################################################################### #FILE: findSecondSmallest.py #WRITER: Assaf_Mor + assafm04 + 036539096 #EXCERSICE: intro2cs ex3 2014-2015 #DESCRIPTION: #a program which calculates the second smallest value entered by the user ##############################################...
true
8aeacb874289e38151019caff38408840bda0b24
james-nesbitt/configerus
/configerus/test/test_3_config_copy.py
UTF-8
2,227
3.125
3
[ "MIT" ]
permissive
""" Test config's copy() Here we test that the Config object is able to make copies of itself, and that changing those copies doesn't affect originals. """ from configerus.contrib.dict import PLUGIN_ID_SOURCE_DICT import configerus import unittest import logging logging.basicConfig() logger = logging.getLogger("co...
true
9bd21c2ddf016e04ed7c587f4deaf7f01d2ba3a5
mauriciovieira/Python_studies
/udacity/turtle_test.py
UTF-8
487
3.578125
4
[]
no_license
import turtle def draw_m(): window = turtle.Screen() window.bgcolor("blue") turtle.right(270) turtle.forward(100) turtle.right(135) turtle.forward(60) turtle.left(90) turtle.forward(60) turtle.right(135) turtle.forward(100) turtle.end_fill() def draw_a(): turtle....
true
fb2ebdc824b53e367e37cda85cfaf9eb47f99b30
Spawn1k/pytasks
/574.py
UTF-8
344
3.28125
3
[]
no_license
s1 = input() s2 = input() word = [0 for i in range(27)] corr = 'abcdefghijklmnopqrstuvwxyz' corr = corr.upper() for i in range(len(s1)): k = corr.find(s1[i]) word[k] += 1 for i in range(len(s2)): k = corr.find(s2[i]) word[k] -= 1 i = 0 while word[i] == 0 and i < 26: i += 1 if i == 26: print('YES...
true
ecde2628f71e0eaa12efce1ad3d28c1fec6e7903
XeroX/unirest-python
/unirest/test/test_unirest.py
UTF-8
4,839
2.53125
3
[ "MIT" ]
permissive
# -*- coding:utf-8 -*- import sys import os import unittest sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) import unirest class UnirestTestCase(unittest.TestCase): def test_get(self): response = unirest.get('http://httpbin.org/get?name=Mark', params={"nick":"thefosk"}) self.assertEqual(...
true
48e806695fc94b1f568de273dd5a14548b7a5f1e
ScorpionMB/skillfactory-b3.13-boleev
/b3_13_test.py
UTF-8
5,480
3.546875
4
[]
no_license
import textwrap class TopLevelTag: # ... def __init__(self, tag): self.tag = tag # Список внутренних тегов self.childrens = [] # Метод для += def __iadd__(self, other): self.childrens.append(other) return self def __str__(self, *args): ...
true
e1ede4c56ef190acf920d1060238f13cd12d9a16
songhui/raspfun
/sensehat/rotate.py
UTF-8
500
3.15625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: from sense_hat import SenseHat sense = SenseHat() # In[2]: def normalize(g): color = (1 + g) * 128; if color < 0: color = 0; if color > 255: color = 255; return int(color) # In[3]: while True: acceleration = sense.get_acceler...
true
4cc7c1d37d40df00f125e16cb1a1c6f354136543
MeetM/NanonetsAPI
/ops/job_count_ops.py
UTF-8
1,910
2.59375
3
[]
no_license
import os import redis class JobCount: IN_TRAINING = "InTraining" TRAINING_COMPLETE = "TrainingComplete" TRAINING_NOT_STARTED = "TrainingNotStarted" def __init__(self, model_id): redis_url = os.environ['REDIS_URL'] self.db = redis.StrictRedis(host=redis_url, port=6379, db=0) ...
true
85c3b6f62d57d16dfcfa8d8cb670af07fd82b543
Skylatitude/Machine-Learning
/HW5/HW5-4.py
UTF-8
5,309
2.609375
3
[]
no_license
from numpy import * import random # import matplotlib.pyplot as plt from sklearn.decomposition import PCA def loadData(filename): vector = [] with open(filename) as file: for line in file: vector.append(map(float, line.split())) # fe = [[]*len(vector[0])]*len(vector) for i in rang...
true
013419c34eacc4cd2e4a04a120cbf3861067f6d1
subhadram/Non-linear-dynamics
/FHNphase.py
UTF-8
1,928
2.9375
3
[]
no_license
import numpy as n import pylab as p import scipy.integrate as integrate def dr(r, f): return a - r - 4*r*f/1+ r**2 def df(r, f): return b*r*(1 - (f/(1+r**2))) def derivs(state, t): """ Map the state variable [x, y] to the derivitives [deltar, deltaf] at time t """ #print t, state ...
true
f3073e1613f64f6b7769c765ec861104089c4e66
kuaikang/python3
/工作/组卷网/章节对应.py
UTF-8
2,462
2.90625
3
[]
no_license
import pymysql import contextlib from common.string_util import get_similarity # 定义上下文管理器,连接后自动关闭连接 @contextlib.contextmanager def mysql(host='localhost', port=3333, user='root', password='kuaikang', db='kuaik', charset='utf8'): conn = pymysql.connect(host=host, port=port, user=user, passwd=password, db=db, chars...
true
1945b23da988c3c8eb8ab98bcfb2f488fec58ece
EnricoHuber/Rubbish
/n.9.py
UTF-8
231
3.5625
4
[]
no_license
import matplotlib.pyplot as plt import numpy as np x = np.arange(10) y = x*7 plt.plot(x, y) plt.title("Draw a line.") plt.xlabel("x-axis") plt.ylabel("y-axis") print(plt.axis()) plt.axis([0, 20, 0, 80]) plt.show()
true
b3cc313cde4364350061aa644754cc1e052d9688
nick-newton2/Dell-Preternship
/scripts/final_clean.py
UTF-8
7,122
2.84375
3
[]
no_license
#!/usr/bin/env python3 import csv import json import sys import os import json import string # Function to convert a CSV to JSON def read_json(jsonFilePath): # JSON file f = open (jsonFilePath, "r") # Reading from file data = json.loads(f.read()) # Closing file f.close() return data def c...
true
2182ea3619f8f6c585ad04104c27a5268b75b86f
aclemen4/aMAZEd
/mask.py
UTF-8
3,079
3.59375
4
[ "MIT" ]
permissive
#!/usr/bin/env python """ Class to help masking specific grid cells MIT License Copyright (c) 2017 Gaurav Mathur 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 wi...
true
85b14fecbe883aa9a682830f4fb89dca91e0e511
nkchangliu/puzzles
/leetcode/integer_break.py
UTF-8
319
3.34375
3
[]
no_license
def integer_break(n): if n < 2: return 0 if n == 2: return 1 if n == 3: return 2 lst = [1] * (n + 1) lst[2], lst[3] = 2, 3 for i in range(4, n + 1): lst[i] = max(lst[left] * lst[i - left] for left in range(n // 2 + 1)) return lst[n] print(integer_break(10))
true
cc3be916371de59593bea77246c1439aafca3494
sjain619/Computer-Networking
/Mail Client/send_mail.py
UTF-8
869
2.515625
3
[]
no_license
#from socket import * import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart '''clientSocket = socket(AF_INET, SOCK_STREAM) #TCP Connection to Server clientSocket.connect(server)''' email_user = 'shrey.mailtest@gmail.com' #Enter the sender's mail ID email_password = 'Qw...
true
3ed008e482ccd5eed01bf73a318e92dac29425eb
aawanRahman/M2M
/M2M framework/template_generator/fi/grammar.py
UTF-8
4,245
2.53125
3
[ "MIT" ]
permissive
from M2M.template_generator.fi.custom_templates import CustomTemplates entities = { "License plate": 'Rekisterikilpi', "Area": 'ilmoitusalue', "phone number": 'puhelinnumero', "Phone number": 'Puhelinnumero', "Pincode": 'Pin-koodi', "Terms and conditions": 'Käyttöehdot', "registration": 're...
true
3244e776b513143dec09b678abf850a5c3f622ff
Lianyihwei/RobbiLian
/Lcc/pythonrace/PYA210.py
UTF-8
276
3.953125
4
[]
no_license
side1 = eval(input()) side2 = eval(input()) side3 = eval(input()) if (side3+side2 >= side1): print(side1+side2+side3) elif side1+side2 >= side3: print(side1+side2+side3) elif (side1+side3 >= side2): print(side1+side2+side3) else: print("Invalid")
true
5a516a98dfcfd75684a4bde284207a860ac69161
hoang6/UM-PythonForEverybody
/Course3-UsingPythonToAccessWebData/hw2.py
UTF-8
213
3.09375
3
[]
no_license
import re file = open('regex_sum_237416.txt') numbers = list() for line in file: line = line.strip() numbers += re.findall('[0-9]+', line) # print numbers print sum([int(number) for number in numbers])
true
13477a7fc1f7462fedae20c7eae8b51c1fd9a5b1
3b1b/videos
/_2018/eop/birthday.py
UTF-8
726
3.125
3
[ "MIT" ]
permissive
from manim_imports_ext import * class Birthday(Scene): def construct(self): sidelength = 6.0 corner = np.array([-sidelength/2,-sidelength/2,0]) nb_days_left = 365.0 toggle = False def probability(): width = rect.get_width() height = rect.get_height...
true
139fdabbae44b06ecbf00e7fbdee19034ba91522
ragnariock/tankbuster
/tankbuster/engine/detect.py
UTF-8
4,025
3.25
3
[ "MIT" ]
permissive
# Import the necessary packages import numpy as np from .. import cnn from keras.applications.resnet50 import preprocess_input from keras.preprocessing.image import load_img, img_to_array from keras.utils.data_utils import get_file """ This file, detect.py, contains the function that loads, pre-processes and feeds the...
true
f822038c71b7111885f75306a38e378b0cf481d0
adamgillessen/monopoly
/Server/testSquares.py
UTF-8
1,036
3.4375
3
[]
no_license
import unittest from Squares import * from Player import * class SquareUnitTests(unittest.TestCase): """ UnitTests for all classes in this file. """ def test_Square_add_player(self): s = Square(0) p = Player(1) s.add_player(p) self.assertTrue(s.has_player(p)) def ...
true
6abe3523f3fb4dadf79ba00a0372b9ab57661bbc
ShrubinS/ml-assignment-1
/team_49/task1 (performance by dataset size), team_49/task1, team_49, performance by dataset size, source code/regression_algorithms.py
UTF-8
3,482
2.90625
3
[]
no_license
# Imports import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn import linear_model from sklearn.model_selection import cross_validate from sklearn import svm from sklearn import metrics from sklearn import neighbors import util import re import math def regression_p...
true
912573ab777df1d23824c8d4b4f0a1138a983cbe
delfick/aws_syncr
/aws_syncr/filename_completer.py
UTF-8
2,080
2.609375
3
[ "MIT" ]
permissive
from aws_syncr.errors import UserQuit from aws_syncr.compat import input import readline import glob import os def setup_completer(): if 'libedit' in readline.__doc__: readline.parse_and_bind("bind ^I rl_complete") else: readline.parse_and_bind("tab: complete") readline.set_completer(NoneC...
true
8e2494ae7ee9f96c3fc3e8b9143ad13e3fca4f45
adam-hotait/3Dtictactoe
/client_side/client.py
UTF-8
2,496
2.8125
3
[]
no_license
import socket from client_side.commClient import CommClient from client_side.graphical.commWithGUI import CommWithGUI from client_side.graphical.gui3d import Gui3D from client_side.graphical.connexionScreen import ConnexionScreen from client_side.graphical.deconnectionScreen import DeconnectionScreen import re class ...
true
76e5be166f22f4ccdf84685917e0a2ff64808b14
RutvikMori18/Python-Program-Practice
/var.py
UTF-8
218
3.34375
3
[]
no_license
class car: wheel=5#class variable def __init__(self): self.name='bmw'#instance variable self.mil=20 c1=car() c2=car() car.wheel=4 print(c1.name,c1.mil,c1.wheel) print(c2.name,c2.mil,c1.wheel)
true
39facbdc115c0beca9cac913284c3b83d56b5d47
alexkritikos/vizdoom-ai
/watch.py
UTF-8
2,495
2.703125
3
[]
no_license
from collections import deque from time import sleep from environment import stack_frames, init_watching_environment, initialize_vizdoom from general_utils import load_file_simple, validate_scenario_input import numpy as np from network import create_network from parameters import state_size, stack_size, episodes_to_wa...
true
73ce98fe80f6102b42334b84575cf63435bb6616
oscarcorres/EjemColabora
/modelo.py
UTF-8
671
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- class cliente: #comentario def __init__(self, nombre, direccion, telf, email, facturacion_anual ): self.nombre = nombre self.direccion = direccion self.telf = telf self.email = email self.facturacion_anual = facturacion_anual def crea(n): ...
true
7c4f10eea5a96baca8958bb980b834d8c2e6db65
HaydenInEdinburgh/LintCode
/HackerRank/k_largest_in_two_sorted_arrays.py
UTF-8
800
3.546875
4
[]
no_license
class Solution: """ @param arrays: a list of array @param k: An integer @return: an integer, K-th largest element in two arrays """ def KthInTwoArrays(self, A, B, k): # write your code here m, n = len(A), len(B) if m +n < k: return None i, j = m-1, n-...
true
5e4238681b3f9422d6489b259d4151fbebac4631
mhuangw/Algorithms
/Python/Strings/permutation.py
UTF-8
570
4.15625
4
[]
no_license
# Checks if two strings are permutations (anagrams) of each other def permutation(first, second): # Length must be equal for strings to be permutations if len(first) != len(second): return False # Use dictionary to count character occurrence in each string charCount = {} for x in first: if x in charCo...
true
c4b74ca48950f5a3c15398c00fc35c9086dd0f25
wuyijun1/Study_Plan
/Python/Hello.py
UTF-8
256
2.59375
3
[]
no_license
# -*- coding: utf-8 -*- from bs4 import BeautifulSoup import requests url = "http://news.baidu.com" data = requests.get(url) s = BeautifulSoup(data.text.encode(data.encoding), "lxml") title = s.select("#pane-news > div > ul > li.hdline0") print(title)
true
24ba94f7ce0896331722877ee3324164fefa07c5
MuskanThakur2002/Mysql_files
/interview.py
UTF-8
1,277
3.109375
3
[]
no_license
A = [0,1,4,5,6,7] B = [3,4,9,8,7,2] def median_fun(n): if len(n)%2!=0 and len(n)!=0: c=(len(m)-1+1)/2 return n[int(c)] elif len(n)%2==0 : d=n[int((len(n)-1)/2)] e=n[int((len(n)+1)/2)] c=(d+e)/2 return c m=A+B for i in range(len(m)): for j in range(len(m)-1-i):...
true
926f873d890ca765ad0edc16f7aa5882f22019df
ameya2806/python
/sendmail.py
UTF-8
855
2.765625
3
[]
no_license
# send email with python script import smtplib # write the body of message content ='This is test mail generated from python script' #body with content sender and reciever body='\r\n'.join(['To: %s'%'reciever_mail_id ', 'From: %s'%'sender_mail_id', 'Subject: %s'%...
true
f9f671244b8a558d0389260ab847506b8a34b32e
yu5shi8/AtCoder
/ABC_A/ABC056A.py
UTF-8
208
3.25
3
[]
no_license
# -*- coding: utf-8 -*- # A - HonestOrDishonest # https://atcoder.jp/contests/abc056/tasks/abc056_a ab = input().split() if (ab.count('H') == 2) or (ab.count('D') == 2): print('H') else: print('D')
true
2042b4cc753bd34f1195cab6b110b02d6c5e64a7
Shohet-Val/Python
/polindrom_number.py
UTF-8
481
3.046875
3
[]
no_license
palindrom_lst = [] for i in range(101, 999): print('i =',i) for j in range(i, 999): multi_IJ = str(i * j) # palindrom = multi_IJ[::-1]# print(i, '*', j, '=', str(i * j)) #print(palindrom) if palindrom == multi_IJ: palindrom=int(palindrom) p...
true
25a2216fa444b0d8d2202af5ec33ef94df7f8401
anyuliuyi/sanyi
/framework/framework.py
UTF-8
3,008
2.8125
3
[]
no_license
#coding=utf-8 import time import datetime import random class gl: @staticmethod def repaceSpecialCharactersinString(content): return content.replace("^", "").replace("a", "").replace("link", "").replace("text", "").replace("href", ...
true
9c2ac1e301279c4a3856f5fc2fbda182453bfce6
HamzaRabi/MagnePlane
/paper/images/trade_scripts/boundary_layer_length_plot.py
UTF-8
1,027
2.671875
3
[ "Apache-2.0" ]
permissive
import numpy as np import matplotlib.pyplot as plt L_pod = np.loadtxt('../data_files/boundary_layer_length_trades/L_pod.txt', delimiter = '\t') A_tube = np.loadtxt('../data_files/boundary_layer_length_trades/A_tube.txt', delimiter = '\t') fig = plt.figure(figsize = (3.25,3.5), tight_layout = True) ax = plt.axes() pl...
true
c1be66cfe7a48e55b75938b318817aaedff0b7ad
kolts/shtilbot
/shtilbot.py
UTF-8
1,183
2.578125
3
[]
no_license
import discord import re DISCORD_BOT_TOKEN = 'NDM2OTcyMjYxODgzNTEwODA0.DbvRwQ.7IAKvl4-Ts8mgjEw6kQPMUiVaqM' client = discord.Client() @client.event async def on_ready(): print('Logged in as') print(client.user.name) print(client.user.id) print('------') @client.event async def on_message(message): ...
true
aa33481a667884849b4b3f9f587045ae99d99a23
helenayyan/leetcode
/backtracking/0040_combination_sum_ii.py
UTF-8
1,262
3.71875
4
[]
no_license
""" Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target. Each number in candidates may only be used once in the combination. Note: All numbers (including target) will be positive integers. The solutio...
true
4a904b9bd4780dbee3cc354722893bde79376d4c
BU-NU-CLOUD-SP16/Network-traffic-collection
/System/detect.py
UTF-8
4,133
2.625
3
[]
no_license
import time from influxdb import InfluxDBClient from entropy import entropy_calc import re def predict_mal(zeus, crypto_exploit, ponmo): results = [] # MALICIOUS DOMAIN SECTION zeuslist = list(zeus.get_points(measurement='http')) for z in zeuslist: ent = entropy_calc.sentropy(z['Dom...
true
19573810eae8e4faada6795388c28500350c3f90
WarmisharrowPy/Story-Generator
/Main.py
UTF-8
1,492
3.65625
4
[]
no_license
import random books = ['Mother', 'Midnight Children', 'My experiments with truth', 'Mystery'] print(random.choice(books)) Sentence_starter = ['Once upon a time', 'A few years ago', 'Yesterday', 'Last night', 'A long time ago','On 20th Jan'] character = [' there lived a king.',' there lived a man named Jack.', ' t...
true
1cedbaf4c1ac1414714581701a983dc30b34d80b
Gborgman05/algs
/py/next_permutation.py
UTF-8
726
2.890625
3
[]
no_license
class Solution: def nextPermutation(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ last = nums[0] if len(nums) < 2: return nums for i in range(len(nums)): if nums[i] >= last: last =...
true
ae03edd92e3b9431187c73d71b2802c888420dfa
kthyng/tabswebsite
/python/plot_buoy.py
UTF-8
53,904
2.890625
3
[]
no_license
''' Make plot of recent buoy data. Easier to access through get_data.py ''' import matplotlib as mpl from sys import platform if platform == 'linux': mpl.use('Agg') import matplotlib.pyplot as plt import numpy as np from datetime import datetime, timedelta import tools from matplotlib.dates import date2num, num2d...
true
ae36b96e6fa6b0c0f21a97f3aa97fb63be3b0ac6
sam33n/hackerearth_problem_image_recognition
/hacker_earth_problem_statement.py
UTF-8
2,144
2.546875
3
[]
no_license
import pandas as pd import cv2 import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from tensorflow import keras, layers from sklearn.preprocessing import OneHotEncoder import os df = pd.read_csv('Downloads/dataset/train.csv') df2 = pd.read_csv('Downloads/dataset/test.csv') PATH = os.getcwd() I...
true
7bea39e40d314ff7c123f2d2dcc0fbcd3533c085
juchiyama/bigdata_fall2015
/python/test/nice.py
UTF-8
805
2.65625
3
[]
no_license
import unittest, re, string import nltk from rdt.data.mongo.source import Source import rdt.data.clean.html as html class NiceTestCase(unittest.TestCase): def setUp(self): self.t = self.assertTrue self.inst = self.assertIsInstance self.source = Source(host="localhost",port=27017,database='reddit_stream_test',c...
true
d2eee2524658d364cf48a8642c8925f012342a7e
swapnilkathane/pract_1
/Sort string.py
UTF-8
150
3.34375
3
[]
no_license
my_str="swapnil is very good boy" words=my_str.split() #print(words) words.sort() print("The sorted words are: ") for word in words: print(word)
true
c625e12d22c95f19cfb669d08f0815676d2cfcb3
jimbc/python_101
/exercises/number_tools.py
UTF-8
71
3.171875
3
[]
no_license
def add(x,y): return x+y+1 def subtract(x,y): return x-y-1
true
7dd501e8d669c85504fcc921482b93e3c871f169
lanzhiwang/first-diy-framework
/asyncio/05.py
UTF-8
1,350
3.3125
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- import asyncio import time now = lambda: time.time() async def do_some_work(x): print('Waiting: ', x) start = now() coroutine = do_some_work(2) loop = asyncio.get_event_loop() ''' 协程对象不能直接运行,在注册事件循环的时候,其实是run_until_complete方法将协程包装成为了一个任务(task)对象。 所谓task对象是Future...
true
78e91e8de19c8e89c92f43109e93a9620a4ab032
Mr-cpc/idea_wirkspace
/learnp/basic/bupt_2017_11_21/simplifyp.py
UTF-8
431
2.984375
3
[]
no_license
import re def simplifyP(path:str) -> str: path = re.sub("//*","/",path) dirs = path.split("/") stk = [] for i in dirs: if i in ("","."): continue elif i == "..": if len(stk): stk.pop() else: continue else: ...
true
a5fde4c84393350dc57671664164435b53cca547
thomasgas/pyeventio
/eventio/exceptions.py
UTF-8
1,138
3.1875
3
[ "MIT" ]
permissive
class WrongType(Exception): ''' This exception should be raised if an EventIO file contains an unxpected Object Type at the wanted position ''' def __init__(self, expected, received): if isinstance(expected, tuple): super().__init__( 'Expected one of {}, but rece...
true
bd000e31e16b5e124c37c704716f5da211d180d0
JasperJuergensen/elastalert
/elastalert/ruletypes/frequency_rule.py
UTF-8
5,042
2.59375
3
[ "Apache-2.0" ]
permissive
from elastalert.exceptions import EAException from elastalert.queries.elasticsearch_query import ( ElasticsearchCountQuery, ElasticsearchQuery, ElasticsearchTermQuery, ) from elastalert.queries.query_factory import QueryFactory from elastalert.ruletypes import RuleType from elastalert.utils.event_window imp...
true
d5409bbeba2dac5f01cc46bec26ba1e7783074ee
nicolasheude/Workshops
/ai/8.DecisionTree/src/graphviz/dispay_tree.py
UTF-8
2,404
2.796875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 ## ## EPITECH PROJECT, 2021 ## display tree ## File description: ## dsiplayr tree ## import os from subprocess import check_call, run, PIPE """ LIB FOR SKLEARN """ """ FONCTION """ def install_dot(filepath): print("Do you want to install dot ? yes / no") res = input() if res == "n...
true
762be8072520c9151b1eb08b5ae4d6990c1ff59e
raberto-nowhere/vs-compare
/compare.py
UTF-8
3,142
2.765625
3
[]
no_license
# Usage: # Set SOURCE and ENCODE variables and call either FinalRangeComparison() # or PreFinalRangeComparison() # FinalRangeComparison() : Compare final encode against source # PreFinalRangeComparison(): Compare test encode against source # output = FinalRangeComparison() # output = Pre...
true
2a90a795dbe762b178e84ffde7ee3b82c78bbf9f
CEsarABC/Python-CI-
/Python fundamentals/99 bottles.py
UTF-8
1,027
5.125
5
[]
no_license
# First, we just need a for loop. Our for loop will iterate through the range of numbers between 99 and 0, # stepping in -1. Each iteration of the loop will get closer to 0. On the following two lines we just declare # two string variables (line_one and line_two). Instead of including the number of bottles of beer in ...
true
3eed7600e95209bfd109ca0e899b81e8005b65c1
tokuD/atcoder
/my_library/Eratosthenes.py
UTF-8
432
3.578125
4
[]
no_license
def Eratosthenes(N): """1~Nで素数を探す""" isprime = [True]*(N+1) isprime[0],isprime[1] = False,False for i in range(2,N+1): #* iが素数でない場合 if not isprime[i]: continue #* iが素数なら、i以外のiの倍数をふるい落とす for j in range(2*i,N+1,i): isprime[j] = False #* ispri...
true
4fba98077f4c94dac51ab2d1c1cfbbebaf04142c
IdiotCirno/MFTI
/Recursion/euclid.py
UTF-8
89
3.53125
4
[]
no_license
def euclid(x, y): if x%y: return euclid(y, x%y) return y print(euclid(60, 140))
true
eef5b94a5cd6b16b3ac795dd2de5031347bfafa7
lsst-camera-dh/sequencer-files
/python/parsesummary.py
UTF-8
3,006
2.8125
3
[]
no_license
# !/usr/bin/env python # usage in command line: # python parsesummary.py /Users/nayman/Documents/REB/TS8/ITL-sensors # python parsesummary.py /Users/nayman/Documents/REB/TS8/ITL-sensors/recap-confluence.txt import os import sys import numpy as np def half_median(table): """ Outputs the medians of the two ha...
true
4a7f013cecc919cbd0168ebdebb3ef09e535bdd0
gbox3d/python_study
/tinker/ex01.py
UTF-8
496
2.984375
3
[]
no_license
#%% import tkinter as tk # Tkinter import pathlib #%% win = tk.Tk() win.title("opencv tinker basic") # 상단제목 설정 win.geometry("320x240+50+50") # 지오메트리: 너비x높이+x좌표+y좌표 # win.resizable(False, False) # x축, y축 크기 조정 비활성화 lbl = tk.Label(win, text="Hello" ,font=("Arial Bold",50)) lbl.grid(column=0, row=0) print(f'{pathlib.Pa...
true
d51d1ecea5abd1e19ea905ebb444808b29e2eaf6
buptwangsong/BigDataTraining
/LinearRegression.py
UTF-8
520
3.1875
3
[]
no_license
import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression data = pd.read_excel('./data/巴金.xls') data['家2'] = data['家']**2 data['春2'] = data['春']**2 data['秋2'] = data['秋']**2 x = data[['家2', '春2', '秋2', '家', '春', '秋']] y = data['result'] model = LinearRegression() model.fit(x, y) print(...
true
b2d3a7af392f44973de08def3444f9d8ae2aa7bb
natelincyber/faceTrackingCamera
/PC.py
UTF-8
2,833
2.65625
3
[]
no_license
import socket, os, sys, cv2, time, keyboard from ipwebcam import IPWEBCAM from _thread import * # servo without sticker - 15-180 degrees of rotation HOST = '192.168.0.109' # The server's hostname or IP address PORT = 2468 # The port used by the server os.system('cls' if os.name == 'nt' else 'clear') # ...
true
4da998c8077c120241bb3ce904b0690cc8c0393d
fengfengrr/-
/testing/test_steps.py
UTF-8
802
2.75
3
[]
no_license
from PYTHON.calc import Calc import pytest import yaml def steps_data(): with open('test_steps.yaml') as i: return yaml.load(i) #导入方法 class Test_calc: @classmethod def setup_class(cls): print('初始化类方法') cls.calc = Calc() with open('test_data.yaml') as f: data = yaml.l...
true
fffb5e7524759511e5dcb092d9354c11bc9728d5
Patricia888/data-structures-and-algorithms
/sorting_algos/quick_sort/quicksort.py
UTF-8
914
3.65625
4
[ "MIT" ]
permissive
def quicksort(lst): if len(lst) < 2: return lst else: # keep it simple, have the pivot be index[0] pivot = lst[0] # start at index[0] current_position = 0 for item in range(len(lst)-1): # if the item is less than the pivot, swap if lst[ite...
true
0ce9f6640e1c08c4634756e37321cf088ba5ba37
monicaihli/python_course
/Mar-04_class-function/class-demo-1.py
UTF-8
914
3.859375
4
[]
no_license
# # Date: March 04, 2020 # File: class-demo-1.py # Auth: monica@utk.edu # Desc: Demonstrates a simple implementation of a class # #. from _datetime import datetime def main(): new_student = Student("Joann", "Fishstick Studies", 2022) print(new_student.name) print(new_student.gradyear) yearstillgrad ...
true
2710a37f6c7fdbbb055feef0687d2e5730a65f7e
RaviShivam/coding-competitions
/codejam/foregone.py
UTF-8
521
3.34375
3
[]
no_license
from random import randint def run_test1(): n = input() substr = sum([10**i for i, e in enumerate(n[::-1]) if e=='4']) return "{} {}".format(substr, int(n)-substr) def run_test(): n = int(input()) if '4' not in str(n): return "{} {}".format(0, n) while True: a = randint(1,...
true
137c8a8c1f4bb891608c6ae70faf688d4d0915d1
lexruee/learning-python
/das/algo/factorial.py
UTF-8
403
3.515625
4
[]
no_license
# -*- coding:utf-8 -*- def factorial_rec(n): if n <= 1: return 1 else: return n * factorial_rec(n - 1) def factorial_acc(n, acc=1): if n <= 1: return acc else: return factorial_acc(n - 1, acc * n) def factorial_gen(): def gen(): r, i = 1, 1 while...
true
f450aff948fe8df464ffd579b0cb54433ba38a10
TheFibonacciEffect/NumphysSerie12
/exponential_euler.py
UTF-8
1,415
2.96875
3
[]
no_license
# %% import numpy as np import matplotlib.pyplot as plt import sympy as sp from scipy.linalg import expm # %% def expo_euler_step(yk, h, f, J): z = h*J A = expm(z) - np.eye(2) b = z @ f(*yk) prop = np.linalg.solve(A, b) return yk + h*prop def wrapper(f, Df, N, y0, t): t, h = np.linspace(0,t, N,...
true
820ccc5f28ea136fbd1616cc3358b3a70760044f
horverno/sze-academic-python
/gyak/01/bank.py
UTF-8
144
2.625
3
[ "MIT" ]
permissive
penz = 100 kamat = 1.1 for ev in range(0,6): print("%d: %.2f Ft van a bankban, %.1f-es kamattal" % (ev + 2018, penz * (kamat ** ev), kamat))
true
51c513d32b1a3c02cad139be50cbbbeaf158fede
hamzaimran08/LDSA
/Assignment_1/mapper.py
UTF-8
1,078
2.953125
3
[]
no_license
#!/usr/bin/env python3 """mapper.py""" import sys import json import re # input comes from STDIN (standard input) for line in sys.stdin: # remove leading and trailing whitespace line = line.strip() if len(line) == 0: continue pronouns = ["han", "hon", "den", "det", "denna", "denne","hen"] # s...
true
4183d3928649d2cc931ad6e25d446b07a2bf79ae
dgisolfi/dgisolfi
/2DSpace/2DSpace.py
UTF-8
1,472
3.296875
3
[]
no_license
# Prj: 2Dspace # Author: Daniel Gisolfi # Date: 2.13.17 # 2DSpace.py from Tkinter import * from random import* root = Tk() root.title("2D Space") root.wm_iconbitmap("spaceIcon.ico") canvas = Canvas(root, width=600, height=600) canvas.configure(background="light blue") def start(): #||||||||||||||||||||||(x1,y1,x2...
true
bb26c755ff47fac71f9ecdda23c78b2305406816
s3p02/basics
/pythonBinarySearchTree/bst.py
UTF-8
2,320
4
4
[]
no_license
class node: def __init__(self,value = None): self.value = value self.left_child = None self.right_child = None class binary_search_tree: def __init__(self): self.root = None def insert(self,value): if self.root == None: self.root = node(value) ...
true
fd26de20c1e093724fa5ee4f138d261c78284029
FinestStone/INF8215
/TP1/main.py
UTF-8
3,705
3.125
3
[]
no_license
from rushhour import * def test1(): positioning = [1, 0, 1, 4, 2, 4, 0, 1] s0 = State(positioning) b = not s0.success() print(b) s = s0.move(1, 1) print(s.prev == s0) b = b and s.prev == s0 print(s0.pos[1], " ", s.pos[1]) s = s.move(6, 1) s = s.move(1, -1) s = s.move(6, -1)...
true
b4fa9229ed249eea58c357592286d8ab938532d7
Massa7ca/Projecteuler
/76.py
UTF-8
192
2.921875
3
[]
no_license
def _76_(n): history = [1]+[0]*n for t in range(1, n+1): for i, x in enumerate(range(t, n+1)): history[x] += history[i] return history[-1] print(_76_(100)-1)
true
ad291635fe75ab31e67e57c0909e22c501d6430b
ClaytonCKOB/validacao_cpf_python
/index.py
UTF-8
311
2.96875
3
[]
no_license
from validar_cpf import Cpf cpf_user = input("Insira seu cpf: ") c1 = Cpf(cpf_user) c1.filtro_de_valores(cpf_user) lista_numerica = c1.separar(cpf_user) digito_01 = c1.calculo_d1(lista_numerica) digito_02 = c1.calculo_d2(lista_numerica, digito_01) print(c1.verificar(lista_numerica, digito_01, digito_02))
true
98f7816cb8fe7e308c6fda0438f0fbd0da242470
kakyoa/Chat-tools-for-Ttkinter
/python3test/lclient.py
UTF-8
1,239
3.171875
3
[]
no_license
from socket import * from threading import Thread HOST = 'localhost' PORT =12345 BUFSIZE=1024 ADDR=(HOST,PORT) print(ADDR) Sock = socket(AF_INET,SOCK_STREAM) Sock.connect(ADDR) Sock.send(b'1') print(Sock.recv(BUFSIZE).decode()) nickname=input("input your nackname: ") Sock.send(nickname.encode()) def sendThreadFunc()...
true
d28eb291dc529a940a1fa276cb8434a875255e9e
dmitriykul/PythonPrograms
/Ch7_Ex4.py
UTF-8
479
4.09375
4
[]
no_license
#Бесконечный цикл Num = [1,2,3,4,5,6,7,8,9,0] print('Введите X для выхода') while True: r = input('Отгадайте число из списка: ') if r == 'X' or r == 'x': break try: r = int(r) except ValueError: print('Введите число или X для выхода.') if r in Num: print('Вы отгадали...
true
321e93ce18acb3bcb1fb516d119aa64ad86f9d03
liunlll/LiuLeetCode
/python_data_structure/unionsearch.py
UTF-8
2,069
3.796875
4
[]
no_license
##############################200. 岛屿数量##################### # 给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围,并且它是通过水平方向或垂直方 # 向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。 # 示例 1: # 输入: # 11110 # 11010 # 11000 # 00000 # 输出: 1 # 示例 2: # 输入: # 11000 # 11000 # 00100 # 00011 # 输出: 3 from collections import deque class Solution200(object)...
true
049c19acc1b4deed6e95a8b2bb78e352ac74e7af
DisExcpt/convertor_bases
/Convertor.py
UTF-8
1,084
3.65625
4
[]
no_license
from math import floor from equivalencias import Obtener_valor_pL, Obtener_valor_pN class in_out(): def __init__(self, e, s): self.entrada = int(e) self.salida = int(s) def convertir_de_xa10(self, valor): decimal = 0 posicion = 0 valor = valor.lower() valor = v...
true
0a04aba3d3122ab3a1b0d67753fbcfef8d63c349
Himani-Bhatt/python
/prog18.py
UTF-8
341
4
4
[]
no_license
x = int(input("enter first no:")) y = int(input("enter second no:")) print("1=add 2=sub 3=mul 4=div") ch = int(input("enter your choice")) print("ans =") if ch == 1: print(x + y) pass elif ch == 2: print(x - y) elif ch == 3: print(x * y) elif ch == 4: print(x / y) else: print("enter correct choice...
true
302c75da118db5dc145fb536e12bb7e0ca4b0cb6
ttk1/clustering
/draw.py
UTF-8
1,533
2.921875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import k_means as km import fuzzy_c_means as cm import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import interp1d from scipy.spatial import ConvexHull k = 5 #クラスタ数 m = 1.7 #ファジィさの度合 def plot(ps): x = [i[0] for i in ps] y = [i[1] for i in p...
true