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
21c4ae9caa9e5caba0b497d7e0782452de879b56
rcchen0526/UVA
/uva_406.py
UTF-8
854
3.4375
3
[]
no_license
import math def prime_list(Max): prime=[] for i in range(1, Max+1): check_prime=True for j in range(2, int(math.sqrt(i))+1 ): if not i%j: check_prime=False break if check_prime: prime.append(i) return prime while True: try:...
true
1c833e14f62e91541ccda00cee1dba296dbef67b
matsuosfh/AtCoder
/コラッツ予想.py
UTF-8
865
3.21875
3
[]
no_license
def kora(N): count: int = 0 maxN = 0 while N != 1: if N % 2 == 0: N = N // 2 count += 1 else: N = 3 * N + 1 count += 1 if maxN < N: maxN = N return(count,maxN) N = int(input()) max_count =[] max_N = [] max_Nw = [] #初期値...
true
c39b5dd6d4b50e44d0e3223bb8b58849a265983c
amitrs55/Python
/App1.py
UTF-8
1,782
3.921875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jun 20 07:29:21 2020 @author: SINGH'S """ from pathlib import Path import json from difflib import get_close_matches #create variable to pass dirctory data_folder = Path("C:/Users/SINGH'S/Documents/Python Scripts/app1") #create another variable to pass file nam...
true
7ceafa18fe4e67a79b39ba048db0e7b03b41cda3
junkings/consensus_monitor
/algorithm/WordSeg.py
UTF-8
2,129
2.625
3
[]
no_license
#encoding:utf8 import jieba import pickle jieba.load_userdict(r'..\statics\user_dict.txt') # 输出dict,key为类别标签,默认为-1 def wordseg(data, filename=None): """输入一个字典,该字典的每一个key是一个文档 输出一个字典,该字典的key是类别,每个类别下有很多文档""" if data == {}: print('未获取数据') return if filename == None: filename = "../segresult/data_all_1011.pkl" ...
true
4033a4235ef731c506400a7c88cc683bcb8e2e0b
AmolVagad/Python_Programming-
/Multiple_Inheritance.py
UTF-8
530
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Feb 18 09:06:42 2017 @author: amol """ class Flash(): def run(self): print('running') def fight(self): print('fighting') class Zoom(): def beat(self): print('Beats Zoom') c...
true
288ecd36a5f9af4f389e265e9089e0ef4fb2be5f
myarist/Progate
/Languages/Python/python_study_1/page16/script.py
UTF-8
404
4.15625
4
[ "MIT" ]
permissive
apple_price = 2 # Terima jumlah apel dengan menggunakan input(), dan berikan hasilnya ke variable input_count input_count = input("Mau berapa apel?: ") # Ubah variable input_count ke integer, dan berikan hasilnya ke variable count count = int(input_count) total_price = apple_price * count print('Anda akan membeli ...
true
a1885a3aff599b2c0cdbec1ea13e3fa33758b717
oohlaf/asynchttp
/tests/http_session_test.py
UTF-8
4,785
2.671875
3
[ "BSD-3-Clause" ]
permissive
"""Tests for asynchttp/session.py""" import http.cookies import tulip import unittest import unittest.mock import asynchttp from asynchttp.client import HttpResponse from asynchttp.session import Session class HttpSessionTests(unittest.TestCase): def setUp(self): self.loop = tulip.new_event_loop() ...
true
c173d752a616fb99e592713fa0fa98f4ee703c47
shima3434/Introductory_Python_Projects
/Bulk Pricing/test_bulk_pricing.py
UTF-8
505
2.78125
3
[]
no_license
#Names (Me, Partner): Shima Abdulla, Wilson Badillo import bulk_pricing as gc def test_get_cost_happy_path(): 'Some happy path cases to test the get_cost function' assert gc.get_cost(200) == 140 assert gc.get_cost(3) == 2.25 assert gc.get_cost(75) == 54 assert gc.get_cost(1000) == 670 def test_ge...
true
23cd6526ed1021f74c3a9d90e7ef086ddd75b5ee
hks73/testing
/test_channel.py
UTF-8
13,611
2.59375
3
[]
no_license
################################## import urllib2 import urllib import sys import json import requests ################################### url_for_internet="http://api.pressplaytv.in/v1/channel?pageLen=1000&pageNum=1" url_for_hotspot ="http://pressplaytv.in/api/v1/channel?pageLen=1000&pageNum=1" def check_url(url): ...
true
46f32b27086e1e12b339c6b564275c2415b4661c
chlo-ek/Random-Flavor-Generator
/source/.ipynb_checkpoints/sourcecode3-checkpoint.py
UTF-8
214
3.453125
3
[ "MIT" ]
permissive
while True: try: myFile = input("Enter filename: ") newFile = open(myFile) for line in newFile: print(line) break except: print("Error, try again!")
true
a9187a268176fd3d96a47bdc533d2c33cc7c34d1
mwon0326/2D-GamePrograming
/term/game_world.py
UTF-8
815
3.09375
3
[]
no_license
objects = [[],[],[],[],[],[]] layer_bg = 0 layer_player = 2 layer_obstacle = 3 layer_item = 4 layer_gate = 1 layer_message = 5 def add_object(o, layer): objects[layer].append(o) def remove_object(o): for i in range(len(objects)): if o in objects[i]: # print('deleting', o) objects[i].remove(o) del o br...
true
3e1e748864a23e54b481efbb2b0b8c785321fb9f
directorscut82/HistomicsTK
/docs/examples/ReinhardSample.Test.py
UTF-8
3,415
2.6875
3
[ "Apache-2.0" ]
permissive
# Tests ReinhardNorm.py. Normalizes an input image to a standard image in LAB # color space. The input image, standard image, and normalized output image are # displayed side-by-side. # Also tests helper functions: # RudermanLABFwd.py # RudermanLABInv.py import matplotlib.pyplot as plt import numpy import openslide im...
true
e6c1a79d260ea96cd2926fa6b81bf8f174059cc9
marinetech/subnero
/test_tx_rx.py
UTF-8
2,447
2.59375
3
[]
no_license
# Settings # Node 1 ip_address = "192.168.0.11" # # Node 2 # ip_address = "192.168.0.11" # ip_address = "localhost" number_of_loops = 2 sleep_between_loops = 0 signal_file = 'PortoVeryShort' ##--------------------------------------## import sys import time import numpy as np import arlpy.signal as asig import arlpy...
true
0204cabbc6aeeffff9bb977167cf0372b0d6cfaf
trnila/biological_algorithms
/cv2/algorithm_options.py
UTF-8
1,742
2.53125
3
[]
no_license
from PyQt5.QtWidgets import QSpinBox, QDoubleSpinBox, QComboBox import numpy as np from widgets import StartPosWidget class AlgorihmOption: def build_widget(self, app): raise NotImplementedError def get_value(self, widget): raise NotImplementedError class IntOption(AlgorihmOption): def...
true
bf71b39f9bb9b6fb2558784387abedc4bf04080f
vipasu/MArt
/crosshairs.py
UTF-8
904
3.015625
3
[]
no_license
import plotting as p import numpy as np import seaborn as sns import matplotlib.pyplot as plt N = 1000 numcols = 20 def generate_points(n): r = np.clip(np.random.normal(0,.7,n), -1, 1) #r = np.clip(np.random.normal(.3,.2,n), -1, 1) #r = np.sqrt(np.random.uniform(0,1,n)) theta = np.random.uniform(0, 2 ...
true
99c2c6a7f7ad750862764b11557f55c91a81fcf9
reyntors/pix2pix-1
/preprocess_data.py
UTF-8
1,986
3.140625
3
[]
no_license
import os import cv2 import numpy as np from tqdm import tqdm from datetime import datetime # Paths folderPath = "data/dataset/train" sourceNPYPath = "data/preprocessed_data/source.npy" targetNPYPath = "data/preprocessed_data/target.npy" def separate_source_target(image): """ Input: One image of shape (600, 1200,...
true
09bfe8bad05366e9c202b5910b8e497f54cb5b38
jcass77/pybites
/pybites_bite54/poem.py
UTF-8
310
3.359375
3
[]
no_license
INDENTS = 4 def print_hanging_indents(poem: str): paragraph, _, remainder = poem.partition("\n\n") for i, line in enumerate(paragraph.splitlines()): line = line.strip() print(" " * INDENTS + line) if i > 0 else print(line) if remainder: print_hanging_indents(remainder)
true
7cfd39e40a1dbf79df1a3924513709a7ca1fcb1d
MADtest/AutotestCourse
/Lesson 4/unic_array_or_not.py
UTF-8
554
3.546875
4
[]
no_license
# -*- coding: utf-8 -*- def is_unic(given_list): list_of_unic = [] elements_count = 0 for j in range(len(given_list)): for i in range(len(given_list[j])): elements_count += 1 if given_list[j][i] not in list_of_unic: list_of_unic.append(given_list[j][i]) ...
true
1f78473c3f9eac058571ec09b1b341e95b15acfa
abhibembalagi/hackerranksolutions
/alternatingcharactersdeletion.py
UTF-8
240
2.578125
3
[]
no_license
#!/bin/python import math import os import random import re import sys t=input() for _ in range(t): s=raw_input() delete_cnt=0 for i in range(1,len(s)): if s[i]==s[i-1]: delete_cnt+=1 print delete_cnt
true
5afa1906cbd0eb17a1b28092f208ce231e9c0e61
rafaelmoresco/POO
/level.py
UTF-8
2,471
2.984375
3
[]
no_license
import sys import pygame import game_functions as gf from pygame.sprite import Group from settings import Settings from player import Player from enemy import Enemy import random class Level: def __init__(self,screen,gSettings,enemies,p1,trueScreen): self.screen = screen self.trueScreen = trueScree...
true
2878775d53ee1978cea632ba9b1c033627c67b82
mfraile/dwork
/dwork/dataset/pandas.py
UTF-8
3,667
3.15625
3
[ "BSD-3-Clause" ]
permissive
import pandas as pd import random import operator import math from typing import Any from .dataset import Dataset from .attribute import Attribute, TrueAttribute from ..language.types import Array, Type from ..mechanisms import geometric_noise, laplace_noise from ..language.expression import Expression from ..language....
true
3fe7d6f19d8a1e0e612eab116e1320f35d4a5ad8
omerler/DataHack
/ml.py
UTF-8
2,748
2.5625
3
[]
no_license
import os import pickle import numpy as np import pandas as pd from sklearn.cross_validation import KFold from sklearn.feature_selection import VarianceThreshold, RFE, SelectFromModel from sklearn.preprocessing import normalize from sklearn.tree import DecisionTreeClassifier from sklearn.linear_model import Logistic...
true
d8237a3e16d579496c19e013245e54f2cecf51d6
vishalbelsare/graphs
/graphs/mixins/analysis.py
UTF-8
4,920
2.546875
3
[ "MIT" ]
permissive
from __future__ import division, absolute_import, print_function import numpy as np import scipy.sparse as ss import scipy.sparse.csgraph as ssc import warnings from ..mini_six import range from ._betweenness import betweenness class AnalysisMixin(object): # scipy.sparse.csgraph wrappers def connected_components...
true
cd65f019bf42fa8d9ff9583eec69d6737850b4ca
sattosan/stress_fastapi
/locustfile.py
UTF-8
672
2.578125
3
[]
no_license
from locust import HttpLocust, TaskSet, task, between import random import string class UserTaskSet(TaskSet): def on_start(self): self.client.headers = {'Content-Type': 'application/json;'} @task(1) def fetch_user(self): self.client.get("/users/{}".format(random.randint(0, 100))) @ta...
true
7a7043b5129a86d1291b59f9c76984f516f811a2
VEOjiwon/BaekJoon
/Day1_printcat.py
UTF-8
663
3.796875
4
[]
no_license
''' 백준 입출력과 사칙연산 고양이 개 A*B A/B 사칙연산 나머지 곱셈 2588번문제 ''' print('''\ /\\ ) ( ') ( / ) \(__)|''') print('''|\_/| |q p| /} ( 0 )"""\\ |"^"` | ||_/=\\\\__|''') ''' #사칙연산 L = list(map(int, input().split())) print(L[0]+L[1]) print(L[0]-L[1]) print(L[0]*L[1]) print(int(L[0]/L[1])) print(L[0]%L[1]) #나머지 L = ...
true
021b6bd35bdc209fbf09187c0a514fb578e6862c
leogtzr/python-cookbook-code-snippets
/strings_and_text/matching_regex_schema1.py
UTF-8
144
2.546875
3
[]
no_license
import re url = 'http://www.python.org' # url = 'alv' has_schema = re.match('http:|https:|ftp:', url) if has_schema: print('Exist ... ')
true
b5fcf7b601329eaa240ff39deaa143f6243e3dc7
schatzkara/Recombination-Rates
/Model_and_Simulations/OLD/id_sim.py
UTF-8
5,657
3.140625
3
[]
no_license
#! python3 # script to simulate DNA sequences mutating and produce a matrix of the ID% between them import random import numpy as np def sim_id_percent(L, generations, GC_prop, kappa, phi): alpha = ((1/L) * kappa)/(kappa + 1) # probability of transitions beta = (1/L)/(kappa + 1) # probability of transversions anc...
true
21b6c8427b071d2bda5c0c08b303b97b1fe5a498
hsuan97/nlu_restaurant
/code/nlu_restaurant_prediction.py
UTF-8
3,899
2.625
3
[]
no_license
import os import numpy as np import pandas as pd from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from keras.layers import Embedding from keras.models import model_from_json #from sklearn.preprocessing import LabelEncoder MAX_SEQUENCE_LENGTH = 100 MAX_VOC...
true
6787e4516a91df3ab2727e7e1c10e9ffb7b50600
likeshumidity/heroku-flask-quakes-lesssimple
/foo.py
UTF-8
723
2.640625
3
[]
no_license
from urllib.parse import urlencode import csv import requests GMAPS_URL = 'https://maps.googleapis.com/maps/api/staticmap?' USGS_FEED_URL = 'http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_month.csv' def get_quake_data(): resp = requests.get(USGS_FEED_URL) data = list(csv.DictReader(res...
true
d1b2667b89067d47847df7d0969e4b97f6290d30
Adasumizox/ProgrammingChallenges
/codewars/Python/5 kyu/Rot13/rot13.py
UTF-8
301
3.109375
3
[]
no_license
from string import ascii_lowercase, ascii_uppercase def rot13(message): lower = str.maketrans(ascii_lowercase, ascii_lowercase[13:] + ascii_lowercase[:13]) upper = str.maketrans(ascii_uppercase, ascii_uppercase[13:] + ascii_uppercase[:13]) return message.translate(lower).translate(upper)
true
868ea9ac13319510e3b610fb7340b606f5a81297
carolinewainwright/Onset_code
/find_water_year_or_season.py
UTF-8
11,343
3.78125
4
[]
no_license
# This script contains the code to find the start and end of the # climatological water year for regions with one wet season per year # or the start and end of the two climatological water seasons # if the point in question has two wet seasons per year # It also contains the functions used to find the minima and maxi...
true
76782f16c59a9cd00277bd4eb92e0771c6b79f0d
punithakur/shopping-app
/shoppingapp.py
UTF-8
4,869
2.71875
3
[]
no_license
from model import * class app: choise=0 prolist=[] custlist=[] clist=[] orlist=[] def start(self): while True: self.printoption() if app.choise==1: self.addcategory() elif app.choise==2: self.catlisting() ...
true
55e16b950af62435c8906c1a53550a817a76c734
linxiaohui/CodeRepoPy
/Video/CameraVideo/VideoFaceDetection.py
UTF-8
1,532
2.5625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import cv2 face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml') # 摄像头只能一个进程获取 camera = cv2.VideoCapture(0) # 格式 #('P', 'I', 'M', '1') = MPEG-1 codec #('M', 'J', 'P', 'G') = motion-jpeg codec #('M', 'P', '4', '2') = MPEG-4.2 codec #...
true
05808ad835a3386c9cdd273cc302411220085205
RYZF-SUCC/quantize_cnn
/quantize/s_round.py
UTF-8
249
2.609375
3
[]
no_license
import torch import math import random def s_round(x): """ 随机舍入,最小的精度是1 :param x: :return: """ x_f = torch.floor(x) p = x-x_f b = torch.bernoulli_(p) x_f.__add__(b) return x_f # test()
true
b0cb6ccc4385ac80bf111a5ff52123e4c6e1a233
taimurIslam/django
/smart life/test.py
UTF-8
87
2.84375
3
[]
no_license
a = "taimur" if a[0]==len(a)-1: print('matched') else: print('not matched')
true
569e0bb6bfc48961ad249a1c991acc9ab379faad
M-T3K/Codewars
/6-kyu/IsPrime/isPrime.py
UTF-8
293
3.1875
3
[]
no_license
#Kata can be found at: https://www.codewars.com/kata/5262119038c0985a5b00029f def is_prime(num): if num < 2: return False if num == 2 or num == 3: return True i = 2 while i < num: if num % i == 0: return False i += 1 return True
true
edc8e31f42e4a562968184c64445e7617396926b
jtlai0921/MP31601
/CH03/CH0341A.py
UTF-8
279
3.796875
4
[]
no_license
''' 計算 2+4+...+20 偶數和,當計數器為10就離開廻圈 ''' sum = 0 #儲存累加值 for count in range(2, 20, 2): if count == 10: break # 中斷廻圈的執行 else: sum += count print('計數器 = ', count, ' 總和 = ', sum)
true
9189b01f9971ee1c0ff08adab8286c4334a41a16
Nishi311/NEU_Capstone_2018_2019
/Interfaces/side_and_quadrant_handling/side_object.py
UTF-8
9,570
2.78125
3
[]
no_license
import os from .quadrant_object import Quadrant class SideObject(object): THIS_FILE_PATH = os.path.dirname(os.path.abspath(__file__)) CONFIG_FILE_NAME = "quadrant_config.txt" def __init__(self, side_name=None): if side_name: self.side_name = side_name else: self....
true
12f9519b6d6304712969380b708455915ff171f1
nikhil-nakhate/search-engine-udacity
/test.py
UTF-8
576
3.6875
4
[]
no_license
''' Created on 21 Apr 2013 @author: Nikhil ''' def find_element(p, t): i = 0 for e in p: if (e == t): print i return i i = i+1 return -1 find_element([1,2,3], 3) def find_element_in(p, t): if (t in p): print p.index(t) return ...
true
e13a9e679b304e6b17d059468c89798e42614f2d
pai10464/python
/Loop+/loop11.py
UTF-8
366
2.90625
3
[]
no_license
x = [e for e in input()] not_du = [] ans = '' for e in range(len(x)): if x[e] not in not_du: not_du.append(x[e]) num = list(range(len(not_du))) no_du = 0 for e in not_du: num[no_du] = 0 for i in x: if i == e: num[no_du] += 1 no_du += 1 for e in range(len(not_du)): ans += ...
true
fc694f91de969f0947ee2f72021b4ccb44ccd21f
Euler1707/Zelle2
/futval.py
UTF-8
572
3.859375
4
[]
no_license
''' Created on Aug 27, 2018 # futval.py # A program to compute the value of an investment # carried 10 years into the future 24 CHAPTER 2. WRITING SIMPLE PROGRAMS # by: John M. Zelle @author: ECOLINNA ''' def main(): print "This program calculates the future value of a 10-eyar investment" p...
true
b4c7322359a130c53600a3c22646b6890ff1bf25
jain-avi/Faster-RCNN
/keras_frcnn/time_distributed_blocks.py
UTF-8
3,021
2.765625
3
[]
no_license
""" Author : Avineil Jain and Sravan Patchala This file contains the architecture blocks used for the classifier Note the beautiful use of the TimeDistributed blocks here, because the ROI's can be thought of as a series of signals """ #Time distributed layers for the Faster RCNN classifier network! from keras.layers...
true
1116459ed6a214ade8c3b4174a296db7b964d3c7
Murmally/scryer
/loader.py
UTF-8
1,000
2.984375
3
[]
no_license
import os import sc2reader def get_filename_from_path(path): tmp = path.split('\\') return tmp[len(tmp) - 1] def format_teams(replay): teams = list() for team in replay.teams: players = list() for player in team: players.append("({0}) {1}".format(player.pick_race[...
true
7fe62a782cd4c9dbab62092bf8a932ada937d3f1
gahogg/rl_learn
/rl_learn/rl_learn/bandits/__init__.py
UTF-8
862
2.546875
3
[]
no_license
""" bandits A package for designing and evaluating agents that perform on bandit problems. Modules ------- environments Defines an interface that all bandit environments must provide, as well as provide some sample ones. They interact with agents in the agents module. agents Defines an interface that all band...
true
051de9bf1ac4150160766e3ed0ec1bcd05bf705e
xuechao1/DX_interfaceTest
/common/configEmail.py
UTF-8
3,623
2.546875
3
[]
no_license
# -*-coding:utf-8 -*- import os import smtplib from email.header import Header from config import readConfig, getpathInfo from common.Log import logger from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart read_conf = readConfig.ReadConfig() subject = read_conf.get_email('subject') # 从配...
true
6f372fe2535dfa0c74140c611b6b0c4d4b929546
jonathanqbo/moncton-python-2020
/week1/i_am_a_writer.py
UTF-8
250
2.828125
3
[]
no_license
print('I am a writer') print('If I can see it,' + ' then i can do it') print("""\ If I just believe it, there's nothing to it I believe I can fly I believe I can touch the sky I think about it every night and day Spread my wings and fly away """)
true
6f1ef42bc7ead0feb8dd8e5868dd14bbdf843039
TIM245-W16/tim245-1
/TestVisualizations.py
UTF-8
1,568
2.5625
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt import DataLoader as dl import Helpers as hlp import arch import statsmodels.api as sm from scipy.signal import detrend from statsmodels.graphics.tsaplots import plot_acf, plot_pacf for cur in dl.valid_currencies(): print 'Evaluating {}'.forma...
true
d115deed980a4f1933a4e4d24759bb5f0cb525dc
AaronVillanueva/InteractivePythonRunestone
/Capitulo 4/Poligonos.py
UTF-8
494
4.03125
4
[]
no_license
#coding: UTF-8 #Este programa crea un poligono de cuantos lados se le indique. import turtle wn = turtle.Screen() wn.bgcolor("white") Maki = turtle.Turtle() Maki.color('red') Maki.pensize(3) def dibujarPoligono(t, numerolados, lado): for i in range(numerolados): t.forward(lado) t.left(360/numerola...
true
b4624da4a2abd0f3bb091de5b905b7c38d1a3dfc
arnaldosantosjr/projetos_de_pyton
/exercicios/ex008.py
UTF-8
213
4
4
[]
no_license
#O programa converte o valor dado em metros para centímetroe e milimetros m = int(input('Digite um valor para conversão.\n')) cm = m * (10**2) mm = m * (10**3) print('{}m vale {}cm ou {}mm.'.format(m, cm, mm))
true
fc48919ac5f869915b5e7ef33157f9326feec9d9
Dboingue/somber
/somber/sequential.py
UTF-8
12,866
3.09375
3
[ "MIT" ]
permissive
"""The sequential SOMs.""" import logging import json import numpy as np from tqdm import tqdm from .som import Som from .ng import Ng from .components.utilities import shuffle from .components.initializers import range_initialization from functools import reduce logger = logging.getLogger(__name__) class Sequenti...
true
8fca26e58856f1780306c183e5b0e5400decdcae
mafavaron/USonic_Simulators
/src/usonic2.py
UTF-8
600
2.828125
3
[]
no_license
#!/usr/bin/env python3 import serial import time import random if __name__ == "__main__": random.seed() port = serial.Serial('/dev/ttyUSB0', 9600, timeout=1) i = 0 while True: i += 1 iu = random.randint(-6000,6000) iv = random.randint(-6000,6000) it = random.randint( ...
true
245801f25d9bfbc4595ed68075fc5baeccf52dd5
TheFausap/qvm
/scripts/plotbloch.py
UTF-8
800
2.640625
3
[]
no_license
#!/usr/bin/env python import qutip import sexpr import numpy import sys def getqmem(str): return sexpr.str2sexpr(str)[0] def getqids(exp): return exp[0] def getnodes(exp): return exp[1] def parse_file(file): qids = [] q = {} f = open(file) s = f.read() f.close() parsed = getqmem(s...
true
15cb28cab001590303705e3e3dbbbb7891ccd57d
yingtaoluo/51jobs-Text-Mining
/sy3/calculate.py
UTF-8
77
3.03125
3
[]
no_license
import math def cal(k,m): return math.log10(k)*m print(cal(4,1/4))
true
fd02de072907eea7005b479102b6d210609d45bf
dassimanuel000/social-py
/ig_post.py
UTF-8
1,307
2.765625
3
[]
no_license
from instabot import Bot #import instabot as bot #from instabot-py import Bot def main_ig(): def post(): bot = Bot() bot.login(username = username.get(), password = password.get()) bot.upload_photo(image_path_.get(), caption =message_.get()) ig_master = Tk() ig_master.title('INST...
true
330757bca1260e7b39967c8af99a5773691bda28
MackeiWeng/myoms
/app/authentication/auth.py
UTF-8
4,489
2.78125
3
[]
no_license
# -*- coding:utf-8 -*- import jwt,datetime,time from flask import jsonify from .model import User from utils.ReturnCode import falseReturn,trueReturn from config.setting import Config import functools from utils.ReturnCode import * class Auth(): @staticmethod def encode_auth_token(user_id,login_time): ...
true
12fde4f00c24f30bf73f20165584af19ad88c554
aglab2/pdp11-emu
/pdp11_scripts/scripts/vram2font.py
UTF-8
413
2.859375
3
[]
no_license
from sys import argv import struct with open(argv[1], "rb") as f: with open(argv[1]+".font", "wb") as out: n = 0 curWord = f.read(2) while curWord: j = n % 95 i = int((n - j) / 95) out.seek(2*(16*j + i)) print(curWord[1]) out.write(struct.pack("B", curWord[1])) #Convert to little-endian for bett...
true
e5f778ca0108195feacdfd80793cb2d1caf07e9b
rctillotson25/python-exercises
/Python-programming/q16.py
UTF-8
389
4.125
4
[]
no_license
# -*- coding: utf-8 -*- # Question 16 # Level 2 # Question: # Use a list comprehension to square each odd number in a list. The list is input by a sequence of comma-separated numbers. # Suppose the following input is supplied to the program: # 1,2,3,4,5,6,7,8,9 # Then, the output should be: # 1,3,5,7,9 print ','.jo...
true
245ca1c0b45c115bc93666e8f0d3fac8bf5bbc24
Simon-Hostettler/Reddit_Image_Scraper
/IMGFixer.py
UTF-8
2,123
2.984375
3
[]
no_license
import subprocess import os import re import logging import traceback from PIL import Image #Directory where images are stored directory = "xxx" # Tries to open image file and checks errors # If file does not open correctly, file deleted! # WARNING: DO NOT HAVE ANY OTHER FILES THAN IMAGES IN THIS DIRECTORY!!! files ...
true
ae20530854ec58b6b0cbe3ddd27ab227b003106b
nagask/CrackingTheCodingInterview
/StacksAndQueues/threeStacks.py
UTF-8
132
2.515625
3
[]
no_license
#Describe how you could use a single array to implement three stacks. #rough idea def threeStacks(): a=b=c=Stack() d=[a,b,c]
true
03da453828f8a5bb4151cdb02a1af06e3f631557
ddenizakpinar/Practices
/Sequence Equation.py
UTF-8
340
3.390625
3
[]
no_license
# https://www.hackerrank.com/challenges/permutation-equation/problem # 03.08.2020 def permutationEquation(p): ans = [] for i in range(1,len(p)+1): x1 = p.index(i) x2 = p.index(x1+1) ans.append(x2+1) return ans n = int(input()) p = list(map(int, input().rstrip().split())) print(per...
true
d778d1f3a299edac83e1b9aa2b9201310a369734
vit-001/advisor
/trader/trade_request.py
UTF-8
483
2.671875
3
[]
no_license
# -*- coding: utf-8 -*- __author__ = 'Vit' class TradeRequest: BUY="BUY" SELL="SELL" def __init__(self, type, callback=lambda time,value:None, comment=""): self.type=type self.callback=callback self.comment=comment def is_buy(self): return self.type==TradeRequest.BUY ...
true
90eff087ef1cf2493035a8115f626fcb4e5d9e9a
Chinmaykalvade/Rpi
/picamera.py
UTF-8
3,577
2.765625
3
[]
no_license
# !/usr/bin/python # load sudo modprobe bcm2835-v4l2 for video input #Import dependencies from pygame, time, GPIO, sys and OS import sys, os, pygame import pygame.camera import time import datetime import picamera from picamera import PiCamera import pygame.image from time import sleep, strftime import RPi.GPIO as GPI...
true
3f936b76713fd9193813bb4c59606463fa2def6d
macinjoke/various
/python/dotinstall-to3/11_dictionary.py
UTF-8
324
3.640625
4
[]
no_license
# coding: UTF-8 # 辞書 key value # [2505, 523, 500] sales = {"taguchi":200, "fkoji":300, "dotinstall":500} print(sales) print(sales["taguchi"]) sales["fkoji"] = 800 print(sales) # in print("taguchi" in sales) # True # keys, values, items print(list(sales.keys())) print(list(sales.values())) print(list(sales.items()))
true
7a06ba6256dc971c322390afcfd8d398a4872cd4
vishalsakpal/pynet_test
/stringex2.py
UTF-8
219
2.90625
3
[]
no_license
#!/usr/bin/env python from __future__ import print_function ip_addr = input("Enter IP Address:") print (ip_addr) ip_addr = ip_addr.split(".") print (ip_addr) print ("{:<12} {:<12} {:<12} {:<12}".format(*ip_addr))
true
3e2c2a132624f7df687507628ba94618b9c3c361
carlanlinux/TrainingPython
/LyndaPythonEssentialTraining/03_Types_Bool.py
UTF-8
563
3.5
4
[]
no_license
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ x = True print('x is {}'.format(x)) print(type(x)) x = False print('x is {}'.format(x)) print(type(x)) x = 7 > 5 print('x is {}'.format(x)) print(type(x)) # Ausencia de valor x = None print('x is {}'.format(x)) print(type(x)) x = 0 # 0 Es false # Non...
true
f8a5de101369ee7b44996e07ced520feef1346cf
Rediet8abere/CodePath
/pal.py
UTF-8
559
3.796875
4
[]
no_license
def isPalindrome(s): print(len(s)) left = 0 right = len(s)-1 # iterrate through the string from left and right while left < right: if not s[left].isalpha() and not s[right].isalpha(): left += 1 right -= 1 elif not s[right].isalpha(): right -= 1 elif not s[left].isalpha(): l...
true
09c336767d536b867611d45eb79cac9de5b50b01
SuperOxigen/CanDev-Finance-Canada
/gathernomics/models/sourcetbl.py
UTF-8
5,846
2.71875
3
[ "MIT" ]
permissive
"""Restaurant Site - Source Table Model. Copyright (c) 2018 Alex Dale See LICENSE for information. """ from datetime import date as Date from enum import Enum import logging from gathernomics.models.base import ModelBase logger = logging.getLogger("gathernomics.models.sourcetbl") class SourceTableType(Enum): ...
true
5f0ad852a92c2405233f304753ba532c170a927a
yikeke/python-side-projects
/ffmpeg/moviepy.py
UTF-8
1,450
2.859375
3
[ "MIT" ]
permissive
from moviepy.editor import * # https://zulko.github.io/moviepy/ref/VideoClip/VideoClip.html#videofileclip # def one_video(filename): # # clip and concatenate one video # # waiting on user: please give one clip... # clip1 = VideoFileClip("1.mp4").subclip(0,158) #读取视频1.mp4,并截取0-158秒的内容 # # waiting on use...
true
8c8f7726877a3c31359a6d962319ede51f40525a
kaviraj333/python
/sqsumdigites.py
UTF-8
81
2.703125
3
[]
no_license
amu =list( map(int,raw_input(""))) abi= 0 for i in amu: abi+=i**2 print(abi)
true
b36c02785ef5e3dffe43287c6af3b373e71e4c61
ray-project/ray
/doc/source/serve/doc_code/tutorial_sklearn.py
UTF-8
2,232
2.65625
3
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
permissive
# fmt: off # __doc_import_begin__ from ray import serve import pickle import json import numpy as np import os import tempfile from starlette.requests import Request from typing import Dict from sklearn.datasets import load_iris from sklearn.ensemble import GradientBoostingClassifier from sklearn.metrics import mean_...
true
f4da18593c7b676c6c6af82384d8d087b83b9b02
muniri92/microsoft-interview-study
/src/temp_tracker.py
UTF-8
1,986
4.1875
4
[ "MIT" ]
permissive
""" Write a class TempTracker with these methods: insert()—records a new temperature get_max()—returns the highest temp we've seen so far get_min()—returns the lowest temp we've seen so far get_mean()—returns the mean ↴ of all temps we've seen so far get_mode()—returns a mode ↴ of all temps we've seen so far Optimize ...
true
694d5fbb640d75b019df2234414b1d386cc37691
GAA-UAM/scikit-fda
/skfda/tests/test_grid.py
UTF-8
11,212
2.796875
3
[ "BSD-3-Clause" ]
permissive
"""Test FDataGrid behaviour.""" import unittest from typing import Sequence, Tuple import numpy as np import scipy.stats.mstats from mpl_toolkits.mplot3d import axes3d from skfda import FDataGrid, concatenate from skfda.exploratory import stats class TestFDataGrid(unittest.TestCase): """Test the FDataGrid repre...
true
eaa5f0618399d792dc4d8c01eb4ac0e4ecf6277e
AndreaCensi/boot_olympics
/src/bootstrapping_olympics/interfaces/streamels/streamels_make.py
UTF-8
3,199
2.671875
3
[]
no_license
from .base import streamel_dtype, ValueFormats from contracts import contract import numpy as np __all__ = ['new_streamels', 'make_streamels_2D_float', 'make_streamel_bit', 'streamels_join_1D', 'make_streamels_rgb_float', 'make_streamels_float', 'make_streamels_1D_float', 'make_streame...
true
800624ccd23e45fe0f81ad6c5712ad8e659eb6e9
szhongren/leetcode
/111/main.py
UTF-8
206
2.53125
3
[]
no_license
""" Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. """ # TODO: NEEDS CODE FROM BEFORE
true
831ccd31f28d6639590b637fc3f78e3c6ff02c12
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/arc010/A/4655503.py
UTF-8
258
2.890625
3
[]
no_license
from sys import stdin input = stdin.readline n, m, a, b = map(int, input().split()) for i in range(1, m+1): c = int(input()) if n <= a: n += b n -= c if n < 0: print(i) break else: print("complete")
true
80fc362c842bd761465305a88ad4e62a8fa8c799
erlendea/testing_github
/chapter_4/animals_1.py
UTF-8
83
3.625
4
[]
no_license
animals = ['ulv','bjørn','jerv'] for animal in animals: print(animal.title())
true
4491083614048d66da04020a83f5fb1c6a52c190
umar1196/MachineLearning
/updatedcode.py
UTF-8
4,104
2.546875
3
[]
no_license
import mysql.connector as ct import xlsxwriter from BioSQL import BioSeqDatabase from Bio import Entrez from Bio import SeqIO from Bio import Align def generate_sub_db(user, pasword, query_db_name, descrip, db_name, gene_id, flag, given_database_id): ''' function generates a sub database, retrive records ...
true
9c5db512354619a9112ce4c21d79aaac4e105371
krieya/PCFG_Parser
/parser.py
UTF-8
5,310
3.09375
3
[]
no_license
import numpy as np from nltk.tree import Tree from nltk.grammar import Nonterminal from collections import defaultdict from nltk import CFG,PCFG def create_table(sent_len): '''Create a table appropriate for CYK parsing. Returns a list of lists of empty lists''' outer_l = [] for i in range(sent_l...
true
48db6a0bf07c46535c558a6597205adf4977bc5b
mritunjay2404/PythonProject
/if_statement.py
UTF-8
97
3.421875
3
[]
no_license
# if statement age=int(input("type your age:")) if age>=18: print("you r elegible to vote.")
true
7beef195b700b769f657ce8bf1f91a1822f77f73
BaldvinAri/Python_verkefni
/Vika 01/voyager1.py
UTF-8
1,073
3.5625
4
[]
no_license
d0_miles = 16637000000 # Distance from sun day 0 in miles vpHour_miles = 38241 # Speed of Voyager in miles per hour vpDay_miles = 38241 * 24 # Speed of Voyager in miles per day MilesToKm = 1.609344 # Km per mile d0_km = MilesToKm * d0_miles # Distance from sun day 0 in km vpHour_km = MilesToKm * vpH...
true
c666ff0f5c5329e39975a7f29af33055cf9b69c0
anton-dovnar/checkio
/Polygon/merge_intervals_generator_version.py
UTF-8
1,959
3.78125
4
[]
no_license
#!/home/fode4cun/.local/share/virtualenvs/checkio-ufRDicT7/bin/checkio --domain=py run merge-intervals-generator-version # You are given a sequence of intervals, as tuples of ints where the tuples are sorted by their first element in ascending order. # Your task is to minimize the number of intervals by merging those...
true
eb3dcb237073b0d0c871cdff3b46dd170070596d
myliu/python-algorithm
/leetcode/water_and_jug.py
UTF-8
641
3.1875
3
[]
no_license
class Solution(object): def canMeasureWater(self, x, y, z): """ :type x: int :type y: int :type z: int :rtype: bool """ def gcd(a, b): return a if b == 0 else gcd(b, a%b) # Deal with the case where either x or y is zero and the other one i...
true
19191078c619f0c955f797eff64903b4856eaa3f
Neromaru/SoftservElementary
/Task7/Test/Test.py
UTF-8
768
3.28125
3
[]
no_license
import unittest from Task7.main import NaturalOrder class TestNaturalOrder(unittest.TestCase): def test_root_as_a_border_value(self): initial = NaturalOrder(64) expected = 8 return self.assertEqual( initial.check_rot(64**0.5), expected ) def test_...
true
a46fbcef70e330e040deb8e58b2fb29552c96e86
MrHamdulay/csc3-capstone
/examples/data/Assignment_7/shzlwa001/question1.py
UTF-8
562
3.90625
4
[]
no_license
# program for removing duplicate strings after "first encounter" # Lwazi Shezi # 1 May 2014 print('Enter strings (end with DONE):') # initialise variables to be used new_string = '' string_list = [] while new_string != 'DONE' : new_string = input() # add the new string in the list containing the...
true
c773a2316c8bea391172117ff1519b06efa7a332
baptiste-pasquier/MCM_ensae
/tools.py
UTF-8
591
2.984375
3
[]
no_license
import os import shutil import matplotlib.pyplot as plt class PDF(): def __init__(self, fig_folder): self.fig_folder = fig_folder self.fig_count = 0 shutil.rmtree(fig_folder, ignore_errors=True) os.makedirs(fig_folder) def export(self, name=None): if name is None: ...
true
f36c85c4787aaab3fdc4431a8d2d033cd4363175
BedirT/Algorithms_and_DS
/Problems/LeetCode/070_climbing_stairs.py
UTF-8
200
2.6875
3
[]
no_license
class Solution: def climbStairs(self, n: int) -> int: dp = [1 for _ in range(n + 1)] for i in range(n - 2, -1, -1): dp[i] = dp[i + 1] + dp[i + 2] return dp[0]
true
8a333a0e0d9e229d55d752583e5177f3122580f2
emithongle/AD---20160602
/20160602 - 000/libs/utils.py
UTF-8
2,578
2.984375
3
[]
no_license
import string def findMaxStringP(text, type, skip=0, skip_chars=''): i, nskip = 0, 0 while (i < len(text) and nskip <= skip): if (type == 'ascii'): if (text[i] not in skip_chars): if (text[i] in string.digits + string.punctuation): nskip += 1 ...
true
d1081afcde18e18a6bb61c8665f200fad3518c91
marcovnyc/penguin-code
/Python_Talk/mpt-master/mptpkg/myttt.py
UTF-8
8,079
3.46875
3
[]
no_license
import turtle as t from random import choice from copy import deepcopy from mptpkg import voice_to_text, print_say def ttt(): t.setup(600,600,100,200) t.hideturtle() t.tracer(False) t.bgcolor("red") t.title("Tic-Tac-Toe in Turtle Graphics") # Draw horizontal lines and vertical line...
true
57ff5eaa697e47b44766d2d7c535d7f1df9b8076
SandraBurlinge/python-challenge
/PyBank/main.py
UTF-8
1,866
3.546875
4
[]
no_license
import os import csv from csv import reader csvpath = os.path.join('Resources', 'budget_data.csv') with open(csvpath, newline='') as csvfile: csvreader = csv.reader(csvfile, delimiter=',') csv_header = next(csvreader, None) #create a Python script that analyzes the records to calculate each of the follow...
true
1f750652c47e2353a4854f881bdb31d5dde41c68
hujeff/select_lunch
/select_lunch.py
UTF-8
5,942
3.65625
4
[ "MIT" ]
permissive
import random lunch = ['中餐','西餐','甜点'] chinese_food = ['鱼香肉丝','青椒肉丝','鱼香茄子','红烧鱼块','香干回锅肉','粉蒸肉','干锅花菜','玉米排骨','小白菜','小炒黄牛肉'] western_food = ['巨无霸汉堡','墨西哥鸡肉卷','薯条','嫩牛五方','板烧鸡腿堡','黑椒牛排','通心粉','双层皇堡'] dessert = ['三明治','蛋糕','龟苓膏','奶茶','冰淇淋','麦片'] def PrintList(self): global lunch,chinese_food,western_food,dessert ...
true
4da20266cc63021a0285110520f25a1d9dc123c0
Baichenjia/Non-local-nets-tensorflow
/train_cifar_10.py
UTF-8
5,131
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- import os import tensorflow as tf import numpy as np from non_local_tf import non_local_block tf.enable_eager_execution() n_class = 100 layers = tf.keras.layers class CNN(tf.keras.Model): def __init__(self, non_local=True): super(CNN, self).__init__() self.non_local = non_...
true
5219a171bc15d719dc795a1852084dbd4acd3998
ShaoxiongYuan/PycharmProjects
/5. Python数据分析+人工智能/3. 深度学习/3. Extra/Day15/01_rail/01_rail.py
UTF-8
2,812
3.21875
3
[]
no_license
import cv2 as cv import math import numpy as np def calc_line_points(x1, y1, x2, y2): k = float(y2 - y1) / float(x2 - x1) # 斜率 b = float(y1) - float(x1) * k # 偏置 points = [] for x in range(x1, x2 + 1): y = int(k * x + b) points.append((x, y)) return points def cross_point(lin...
true
6899444b3164142acacb2a3faa83809cae034acc
MilanSpiridonov/psdWebReader
/PythonApplication1/PythonApplication1.py
UTF-8
5,600
2.671875
3
[]
no_license
from psd_tools import PSDImage from PIL import Image import os #INIT script = '' #HTML code, components will be added later in code #aligncenter script += """<!DOCTYPE html> <html> <head> <style> .aligncenter{ text-align: center;} a:hover{opacity: .75;} p{ font-family: "Times New Roman"; } </style> <title> Landing Pa...
true
6698193ddcc3920eb6fd37bd93be6136246ccbb8
lucky5656/Python-Code
/Python/练习28——判断写入的字符串参数是否回文联(递归).py
UTF-8
531
4.03125
4
[]
no_license
def Huiwen(temp,start,end): if start > end: return 1 else: if temp[start]==temp[end]: return Huiwen(temp,start+1,end-1) else: 0 temp = input('请输入一段文字:') length = len(temp) end = len(temp)-1 if Huiwen(temp,0,end): if temp[0:length//2] == temp[leng...
true
6a6bf405616973dba9aa132bddac1dd386e175b3
kaist-plrg/jstar
/tests/compile/basic/es2016/CharacterSetMatcherAbstractOperation.spec
UTF-8
857
3.09375
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
1. Return an internal Matcher closure that takes two arguments, a State _x_ and a Continuation _c_, and performs the following steps when evaluated: 1. Let _e_ be _x_'s _endIndex_. 1. If _e_ is _InputLength_, return ~failure~. 1. Let _ch_ be the character _Input_[_e...
true
1b4741340c6c62bab8bcad8071d51e4a6f1c03c0
CodeJudge-9000/Streak_Data_Analysis
/Brownian.py
UTF-8
5,071
3.46875
3
[]
no_license
# -*- coding: utf-8 -*- import csv import os import numpy as np import matplotlib.pyplot as plt import math import seaborn as sns ## Trajectory plot of Brownian motion by Johanna # Changes working directory os.chdir('/Users/Johanna/OneDrive - Danmarks Tekniske Universitet/DTU/3. Semester/Fagprojekt/Data ...
true
426e72b2400e3dd5ecbb847d33ba1b02dca5c0aa
I-am-YuLang/MADGCN
/model/Subgraph.py
UTF-8
2,223
2.625
3
[]
no_license
# -*- coding:utf-8 -*- import torch import torch.nn as nn import torch.nn.functional as F from lib.utils import scaled_Laplacian, cheb_polynomial import torch.optim as optim from model.layer import GraphConvolution class sub_graph_parallel(nn.Module): ''' 并行化计算子图 GCN of the sub_graph ''' def __in...
true
533acf4e8974dc51cb66d88517c40cd9c9308c5f
randodev/masfrl-licenta
/masfrl/slave/connection/socket_connection.py
UTF-8
2,214
3.40625
3
[]
no_license
""" Module that takes care of communication from/to MASFRL-Server. Offers send/receive methods, both which encode and decode messages automatically. Requires MASFRL-Server credentials to connect. """ import socket import logging import masfrl.messages as messages # Use module logger logger = logging.getL...
true
965e0f58ef9039fa51db6f381268cda12d40a85c
mfkiwl/PVTsensors
/All_Digital_VTSensor/2nd_version/Verilog_65nm_RTL/Scripts/Script_Dummy_RO_Top.py
UTF-8
872
2.75
3
[ "Apache-2.0" ]
permissive
####################################### # Define variable ####################################### # define how many dummy ROs needed, maximum 32*8 dummy_cnt = 512 ####################################### # Create file ####################################### # Create a new file f = open("Dummy_RO_Top.v","w") # write th...
true
6ee4f5c25bb196a61c64bfc457716f887a5e068b
tonyxiahua/CIS-40-Python
/CIS 40/Lab7.py
UTF-8
1,191
3.484375
3
[]
no_license
dic = {} keys = dic.keys() ''' Handle ''' for line in open("words.txt"): line = line.strip() for word in line: if word in keys: dic[word] += 1 else: dic[word] = 1 ''' Printer ''' for data in sorted(dic.values()): for elem in dic.keys(): if dic.get(elem) == dat...
true