blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
902c53953f96d81d2d9c0ff53f7274dd73824b95
Python
PieceZhang/face_detect_yolov4_yolov4tiny_ssd
/picture.py
UTF-8
877
2.75
3
[ "Apache-2.0" ]
permissive
import cv2 image_origin = cv2.imread('ssd.png') assert image_origin is not None, 'Image is not found, No such file or directory' image_data = cv2.resize(image_origin, (300, 300)) cost_time = 136.06 image_data = cv2.putText(image_data, 'Model: SSD_300', (10, 25), cv2.FONT_HERSHEY_COMPLEX_SMALL...
true
a84cde0c8cf35c6f59928e1d0c8bd382cc347223
Python
nsbejrFire/microbitRobot
/session_02/ex02_blink_maqueen_led.py
UTF-8
355
2.96875
3
[]
no_license
from microbit import * # tell python code will run on micro:bit display.clear() # makes sure all display LEDs are off while True: pin8.write_digital(1) # turn Maqueen's left LED on sleep(1000) # sleep for 1000 milliseconds = 1 second pin8.write_digital(0) # turn Maqueen's left LED off sleep(1000) # slee...
true
f51ce40e94e394fabe01e5a36ec9153534264464
Python
KaspariK/leetcode-python
/two-sum-1/solution.py
UTF-8
391
3
3
[]
no_license
from typing import List class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: target_dict = {} response = [] for i, num in enumerate(nums): if num in target_dict: response = [target_dict.get(num), i] break else...
true
b648611ddaa22fe52e39185fcaac3fa928a2dd85
Python
leolion0/490-Lesson-2
/weights.py
UTF-8
229
3.40625
3
[]
no_license
infile = open("lbs.txt", 'r') lbs = list() count = 0 line = infile.readline() while line !="": lbs.append(float(line)) count += 1 line = infile.readline() kilos = [n*0.453592 for n in lbs] # print(lbs) print(kilos)
true
2dd165ae49b4ca928a8f46a6228e155cca7d62a3
Python
vs-zhang/lc_py
/020/is_valid_parentheses.py
UTF-8
461
3.546875
4
[]
no_license
class Solution(object): def is_valid_parentheses(self, s): stack = [] pair = ['()', '[]', '{}'] for i in range(0, len(s)): stack.append(s[i]) if len(stack) >= 2 and stack[-2]+stack[-1] in pair: stack.pop() stack.pop() return len...
true
69be7f05ba96c2e765b3f9f4b495c33de10aab98
Python
branrickman/py_pi_monte_carlo
/src/main.py
UTF-8
4,373
3.296875
3
[]
no_license
import pygame from random import randint from math import sqrt pygame.init() SCREEN_SIDE_SIZE: int = 901 assert SCREEN_SIDE_SIZE % 2 != 0, "Error: SCREEN_SIDE_SIZE must be an odd integer" FPS = 200 screen = pygame.display.set_mode((SCREEN_SIDE_SIZE, SCREEN_SIDE_SIZE)) pygame.display.set_caption("Monte Carlo Pi Calc...
true
f546bff96ec82d85a5111b4e17cdfa799369d1cc
Python
migbro/kfdrc-toolbox
/vcf_validation/vcf_exact.py
UTF-8
452
3.0625
3
[]
no_license
#!/usr/bin/env python # reads vcf and checks line-by-line to see if content is the same. quite crude. import sys import gzip def open_vcf(vcf_fn): if vcf_fn[-3:] == '.gz': return gzip.open(vcf_fn, 'rb') else: return open(vcf_fn) vcf1 = open_vcf(sys.argv[1]) vcf2 = open_vcf(sys.argv[2]) f...
true
303ab156d3ec852c98baeac39de74d45f97f6e97
Python
EngrDevDom/Everyday-Coding-in-Python
/Message Box in Python/Show_Error.py
UTF-8
193
2.9375
3
[]
no_license
# Show_Error.py from tkinter import * from tkinter import messagebox top = Tk() top.title("Messagebox") top.geometry("100x100") messagebox.showerror("Error", "This is Error!") top.mainloop()
true
cbbe6334bda96ba0e043292ce0ad67454f6b59b6
Python
STORMRECLUSE/EpilepsyVIP-master
/DCEpy/ML/anomaly_detect.py
UTF-8
17,334
2.71875
3
[]
no_license
''' This file is structured similarly to scikit-learn's perceptron code, currently in beta. Similar structures. ''' from __future__ import print_function from __future__ import division import numpy as np import six, warnings from sklearn.utils.fixes import signature def lin_func(data,x1,y1,m): if type(x1) is floa...
true
e589228d2846ae2c944a7dab10abd83a9381aeec
Python
TryhardAlan/Personal-learning
/03_circle_statement/alan_02_summation.py
UTF-8
134
3.78125
4
[]
no_license
# calculator 0-100 summation i = 0 sum_1 = 0 while i <= 100: sum_1 = sum_1 + i i += 1 print("0-100 sumation is %d!" % sum_1)
true
8b09e7bef300e5a8eb4cdfac2048553505b6a7a7
Python
asmeurer/Miscellaneous-Useful-Scripts
/Comics_Downloader.py
UTF-8
8,650
2.6875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Modified from getben.py, which is in ~/Downloads/comic/ as of 20080116 """ Comics Downloader.py Downloads comic strips from http://comics.com/ for use with the ACMEReader program. By default, it downloads all the strips from today to the last strip found for each strip...
true
26b91a7dc04bc10b30dd431023a7ea5db2a2ad6b
Python
bradicator/matrixstream
/ota2d.py
UTF-8
4,250
3
3
[]
no_license
import numpy as np """ Implementation of offline tensor analysis from Beyond Streams and Graphs: Dynamic Tensor Analysis. """ class ota2d(object): def __init__(self, tensor, r1 = 3, r2 = 3): """r1, r2 are number of PC we wish to retain""" self.t = tensor self.r1 = r1 self.r2 = r2 ...
true
0e41777772c07303731eb80ecbaa33bce330cbce
Python
Walter1412/python_exercise
/users/serializers.py
UTF-8
945
2.546875
3
[]
no_license
from rest_framework import serializers from users.models import Account as UsersAccountModel class AccountSerializer(serializers.Serializer): name = serializers.CharField(required=True) password = serializers.CharField(required=True) def create(self, validated_data): print(validated_data) ...
true
452e0ab5b4ec844be68cac6ee605ab1b706fe2f5
Python
aitutor22/tetris
/blocks.py
UTF-8
6,291
2.625
3
[]
no_license
import random from collections import OrderedDict class Block(object): shapes_length = { "i": [4, 1], "o": [2, 2], "t": [3, 2], "s": [3, 2], "z": [3, 2], "j": [3, 2], "l": [3, 2], } shapes_buffer = { "i": [(0, 0), (-2, 1), (0, 0), (-1, 2)], ...
true
86ffece104ebd3f8c8356520875233c7ec84fe89
Python
hjlarry/practise-py
/standard_library/FileSystem/io_example.py
UTF-8
1,429
3.5
4
[]
no_license
import io print("一、 字符串IO操作") output = io.StringIO() output.write("something to buffer. ") # file: a file-like object (stream); defaults to the current sys.stdout. print("And so does this", file=output, end=" ") print(output.getvalue()) output.close() # discard buffer memory input = io.StringIO("Intial value for re...
true
18d29f8ed69b0a375e3f2454e5d9da4bcb38874d
Python
maximebriol/process_data
/notebooks/pretty_printer.py
UTF-8
364
2.578125
3
[]
no_license
import tempfile import pathlib import pandas import processing_data def print(table: processing_data.Table) -> pandas.DataFrame: with tempfile.TemporaryDirectory() as folder: path = pathlib.Path(folder).joinpath("dump.csv") with path.open("w") as stream: stream.write(table.to_csv()) ...
true
72cb4394285ff4f9530ad15a67d5192df7d20f1a
Python
ecell/ecell4-vis
/ec4vis/visualizer/panel.py
UTF-8
2,216
2.546875
3
[]
no_license
# coding: utf-8 """ec4vis.visualizer.panel --- visualizer panel """ import wx, wx.aui # this allows module-wise execution try: import ec4vis except ImportError: import sys, os p = os.path.abspath(__file__); sys.path.insert(0, p[:p.rindex(os.sep+'ec4vis')]) from ec4vis.logger import debug, log_call from ec...
true
b34cfbcebaeae6ff5ead89cf08608be2819d5108
Python
Ting-Kim/CodingTest_with_py
/greedy/n3109.py
UTF-8
1,170
3.0625
3
[]
no_license
# / - \ 순으로 탐색 # 점마다 /-\ 순으로 반복해서 진행하며, 진행 성공한 경우 o체크 + 다음 process로.. def search(x, y): if y == m-1: graph[x][y] = 'o' # 방문 체크 # answer += 1 return True for i in range(3): nx = x + dx[i] ny = y + dy[i] if 0 <= nx < n and 0 <= ny < m and graph[nx][ny] == '.': ...
true
bb056329a0828c60af59bace875a91f6b09fff5e
Python
hwuachen/git-trump-tweets
/vocabulary.py
UTF-8
1,132
3.1875
3
[]
no_license
import csv import nltk from pprint import pprint grouped_by_source = {} with open('trump_tweets.csv') as csvfile: reader = csv.DictReader(csvfile) for row in reader: text = row['text'] platform = row['source'] try: grouped_by_source[platform] = grouped_by_source[platform] ...
true
53b2cb2631ad1f3b760383f583e9ba9cbc184437
Python
caitlinstanton/ece-5725
/lab3/two_wheel.py
UTF-8
2,477
3.21875
3
[ "MIT" ]
permissive
# Brandon Quinlan (bmq4) and Caitlin Stanton (cs968) # ECE5725, Lab 3, Due 3/21 import RPi.GPIO as GPIO # Function for setting direction of a servo # PWM_number is a pointer to a GPIO.PWM object # Direction is a string equal to one of: - "stop" # - "clockwise" # ...
true
12a29e6ef0d9ed3a73e4eac4d97f2ef4c3d6079a
Python
geostash/geostash
/ogr_check.py
UTF-8
254
2.828125
3
[]
no_license
from osgeo import ogr driver_name_list = [ogr.GetDriver(id).GetName() for id in range(ogr.GetDriverCount())] for driver_name in sorted(driver_name_list): ds = ogr.GetDriverByName(driver_name) if ds is not None: print(driver_name)
true
dae05fbd3027e45b5de7eba0a64026048adbf667
Python
milySW/DataScience
/ML projects/wroclaw_flats/functions/eda/change_df.py
UTF-8
5,971
2.9375
3
[]
no_license
from bs4 import BeautifulSoup import requests import datetime import numpy as np def repair_time(data, path): currentDT = datetime.datetime.now() today = str(currentDT.day) + "." + str(currentDT.month) + "." + str(currentDT.year) today_date = datetime.datetime.strptime(today, "%d.%m.%Y").date() for i...
true
f6fcd629f260e216f134ff331f52362151059c7b
Python
xpeditionist/Python
/12_2.py
UTF-8
590
2.96875
3
[]
no_license
import mysql.connector as ms try: id = int(input("Enter Id: ")) name=input("Enter Name: ") price=int(input("Enter price: ")) sql="insert into products values(%d,'%s','%s')" con = ms.connect( host="localhost", user="root", passwd="1234", database="mydb") cursor=con.cursor() cursor.execu...
true
f68d9c1a94219cc628a1e25ab09d531f8e9fa8a7
Python
CarterJMcKenzie/AerospaceStructures
/SolidMotors.py
UTF-8
5,263
2.625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import configparser import FMM class Propellant: def __init__(self, propellant_name): config = configparser.ConfigParser() config.read('PropellantCatalog.ini') self.density = float(config[propellant_name]['density']) self.a = floa...
true
a62a60224f3cefc4dabad3ec79fb407c55332675
Python
Chris-Behan/TweetQueueBackend
/tests/test_user.py
UTF-8
2,229
2.6875
3
[]
no_license
from .context import tweetqueue from datetime import datetime, timedelta import pytest from tweetqueue import user from replit import db user_data = { 'access_token_key': 'test_access_token', 'access_token_secret': 'test secret', 'id': '3213213123', 'name': 'Chris Behan', 'twe...
true
dea8d899077372c7ec9a3d0fbbe6bf056eee4e9d
Python
GabrielDiDomenico/EulerProblems
/problem48/problem48.py
UTF-8
134
2.9375
3
[]
no_license
def solution(): i=1 result=0 while(i<1001): result+=pow(i,i) i+=1 return result print solution()
true
32f144f010db4f772110f69c06930d1bc78795d0
Python
wangxiaohui2015/python_basics
/basic_04/def_usage.py
UTF-8
158
3.515625
4
[]
no_license
def cal_num(num): if num <= 0: return 0 result = 0 for i in range(num): result += (i + 1) return result print(cal_num(100))
true
f0dbc91a306b8f175e30ffc40a616afcd57d372e
Python
anaturrillo/intro-python
/clase_02/repaso_funciones/04.py
UTF-8
127
2.96875
3
[]
no_license
def calcular(): a = 7 def calculo(b): print(a + b) return calculo miCalculo = calcular() miCalculo(5)
true
eceeaea7872ae823bf75ad9334f4cadc3923e395
Python
Impavidity/relogic
/relogic/logickit/scripts/convert_tacred_dataset.py
UTF-8
4,431
2.9375
3
[ "MIT" ]
permissive
import argparse import os import json from collections import defaultdict def convert_into_group(input_folder, output_folder): if not os.path.exists(output_folder): os.makedirs(output_folder) for split in ["train", "dev", "test"]: with open(os.path.join(input_folder, "{}.json".format(split))) as fin: ...
true
090912d5e9711f9b6cfc08c6aafc0603874175c6
Python
pedroblandim/TrabRedes2
/embelezador_ethernet.py
UTF-8
3,777
2.8125
3
[]
no_license
from camada_enlace import Ethernet from camada_rede import IP from camada_transporte import Transporte #Classe que representa a transformação dos dados em linhas legíveis no teminal class Filtro: def __init__(self, quadro_ethernet): self.quadro = quadro_ethernet self.datagrama_IP = IP.Datagrama(bytes_brutos=self....
true
931305c920a56dc609993269e0a749a801f2f839
Python
alvas-education-foundation/K.Muthu-courses
/21 May 2020/pandas-1.py
UTF-8
186
3.25
3
[]
no_license
"""Pandas program to get the DataFrame ( property_data.csv file).""" import pandas as pd # Reading a csv file data=pd.read_csv('property_data.csv') print("The DataFrame : ") print(data)
true
eb4a86c472b612345cded62438fcca8144385f73
Python
osnaldy/Python-StartingOut
/chapter9/Date_Printer.py
UTF-8
785
3.46875
3
[]
no_license
def main(): date = raw_input("Enter the a date in the following format 'mm/dd/yyy': ") new_date = date.split('/') print verify_month(new_date) + new_date[1] + ', ' + new_date[2] def verify_month(rr): if rr[0] == '01': return 'January ' if rr[0] == '02': return 'February ' if rr[...
true
c3fc7f5497451b77a52362246d749d1ffd3decf4
Python
kuntzer/sclas
/utils.py
UTF-8
5,565
3.046875
3
[]
no_license
""" Here are a few utils """ import os import cPickle as pickle import astropy.io.fits import gzip import numpy as np import matplotlib.colors as colors import logging logger = logging.getLogger(__name__) def writepickle(obj, filepath, protocol = -1): """ I write your python object obj into a pickle file at filepa...
true
1f1cc5409f475a33f5cc3b27ae3016b4d54ed797
Python
NazaninBayati/SMBFL
/muen/muen.py
UTF-8
1,311
3.140625
3
[ "MIT" ]
permissive
# Program to extract number # of rows using Python import xlrd import math # Give the location of the file loc = (r'F:\Document\article\journal\results\cal\scores.xlsx') wb = xlrd.open_workbook(loc) sheet = wb.sheet_by_index(0) print(sheet.cell_value(1, 0)) total = sheet.cell_value(1,2) print(total) ...
true
827714a703fd473ff337afb9a515120c4dfae594
Python
lvolkmann/couch-to-coder-python-exercises
/Boolean Expressions/evaluate_boolean_expressions.py
UTF-8
377
3.46875
3
[ "MIT" ]
permissive
""" Predict the output of each of the boolean expressions below """ "Dog" and (5 > 2) # True (6 > 2) or ((582 % 17) != 9) # True "DOG" == "DOG" and 'cat' # True (5 + 2 * 3) == ((5+2) * 3) # False not(True or False) # False (21 % 2) == (97 % 2) # True bool((25 / 5) - 5) # False (((2 ** 19) % 2) > 0) # False (((18 * 23)...
true
d37f6b607eb0c6ed56ce78867512e5c76090258b
Python
lawrencetheabhorrence/Data-Analysis-2020
/hy-data-analysis-with-python-2020/part04-e04_municipalities_of_finland/src/municipalities_of_finland.py
UTF-8
584
3.125
3
[]
no_license
#!/usr/bin/env python3 import pandas as pd def municipalities_of_finland(): df = pd.read_csv('src/municipal.tsv', sep='\t') print(df) df.index = df["Region 2018"] df=df[["Population", "Population change from the previous year, %", "Share of Swedish-speakers of the population, %", "Share of foreign cit...
true
f911a953055afecb1b1bd6b65d2e16af5b0e03e6
Python
Allentome/python_pacong
/test.py
UTF-8
348
3
3
[]
no_license
#爬取搜狗首页的页面数据 import requests if __name__ == "__main__": #指定url url = 'https://www.bilibili.com/' requests = requests.get(url=url) page_text = requests.text print(page_text) # with open('./bilibili.html','w',encoding='utf-8') as fp: # fp.write(page_text) print('爬取数据结束')
true
4caa50a10c7640090f0279293138221e613264cf
Python
jbae11/raven
/doc/workshop/reducedOrderModeling/inputs/workshop_model.py
UTF-8
326
2.796875
3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause" ]
permissive
import math def run(self,Input): a = 1.0 b = 2.0 c = 3.0 l = -1.0 self.y1 = self.x1 self.y2 = self.x1 self.y3 = a*self.x1 + b*self.x2 - c*self.x3 self.y4 = self.x1*self.x1 + self.x1*self.x2*self.x3 self.y5 = math.exp(l*self.x1) if self.y4 < 5.0: self.failure = 0.0 else: self.failure ...
true
24832f7ad8fdd99c3a80bddadfc4274e3fd69e10
Python
natsala13/locker_server
/app/forms.py
UTF-8
1,262
2.59375
3
[]
no_license
from app.models import User from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, BooleanField, SubmitField from wtforms.validators import DataRequired, Email, EqualTo, ValidationError class LoginForm(FlaskForm): username = StringField('Username', validators=[DataRequired()]) passwo...
true
6de51655a5845e7090c67726fe16a32503611c20
Python
Lucakurotaki/ifpi-ads-algoritmos2020
/Iteração WHILE/Fabio 03/Fabio 03 Parte 01/Fabio 03 Parte 01 Q01-16/f3_q16_fibonacci_n.py
UTF-8
430
4.0625
4
[]
no_license
def main(): #Entrada n = int(input("Digite um número positivo: ")) #Processamento/Saída if n < 2: print("Erro. Digite um número maior do que 1.") else: n1 = 0 n2 = 1 soma = 0 cont = 1 print(soma) while cont < n: ...
true
5e0bd103d5e7338f9775ddc9fe4b1681176fcc41
Python
krypton08rises/Car-Speed-Estimation-with-Deep-Learning
/detect_road.py
UTF-8
2,290
3.0625
3
[]
no_license
import cv2 import numpy as np import matplotlib.pyplot as plt def draw_lines(img, lines, color=[255, 0, 0], thickness=3): # If there are no lines to draw, exit. if lines is None: return # Make a copy of the original image. img = np.copy(img) # Create a blank image that matches the original in si...
true
498cd1f869cd1b38e3d2d7c360e7193767689b52
Python
the-pawns/test
/crateCsv.py
UTF-8
375
2.84375
3
[]
no_license
import csv import random import datetime fn ='data.csv' with open(fn,'w')as fd: wr=csv.writer(fd) wr.writerow(['日期','销量']) startDate=datetime.date(2017,2,21) for i in range(365): amount=300+i*5+random.randrange(100) wr.writerow([str(startDate),amount]) #下一天 starDate=start...
true
3e4be20291fc3509ee7a54c5c0a20355f48e6bdc
Python
synbiomine/synbiomine-tools
/tools/loadItems.py
UTF-8
940
2.765625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python import jargparse import xmltodict # THEORETICAL TODO IN ORDER TO UPDATE EXISTING ORGANISM NAMES WHERE A NAME DOES NOT ALREADY EXIST # load organisms from polen items xml # replace names in organism tables that match the taxonid # re-trigger necessary post-processing (probably just search index r...
true
0378687cedde6622d13d4dedcab639c6e2819c18
Python
Meghn/Single-Player-MCTS
/Node.py
UTF-8
323
2.703125
3
[]
no_license
class Node: def __init__(self, state): self.state = state self.wins = 0.0 self.visits = 0.0 self.ressq = 0.0 self.parent = None self.children = [] self.sputc = 0.0 def AppendChild(self, child): self.children.append(child) child.parent = se...
true
e96767a3d9208cdf8ce5d0498367056fcd6c8dbc
Python
kathdez7/Mision_02
/cuenta.py
UTF-8
369
3.640625
4
[]
no_license
# Autor: Katia Hernández Barrera # Descripcion: Programa nqu calcula el total de la cuenta tomando en cuenta IVA y propina # Escribe tu programa después de esta línea. Sub = int (input("inserte el costo de la comida")) print ("costo de su comida", Sub) P = (Sub * 0.13) print ("Propina", P) I = (Sub * 0.16) print ...
true
c6c53d7964eff8b7f17739d1c1b8f3862abb616a
Python
keimlink/python-workshop
/python-workshop/h_functions and_objects/c_nature.py
UTF-8
1,458
4.15625
4
[]
no_license
"""Module nature Demonstrates how to connect objects. """ class Animal(object): """An animal""" def __init__(self, name): """Constructor""" self.name = name def __repr__(self): """Returns string representation.""" return 'Animal: %s' % self.name class Food(object): ...
true
eba1be57f55c161058d39880277f603ca6ca73a0
Python
Curso-de-Python/Clase12
/ejercicio4.py
UTF-8
1,477
3.515625
4
[]
no_license
''' ----------------------------- EJERCICIO N°4 Diagramas de apilamiento ----------------------------- ''' import matplotlib.pyplot as plt # --------------------------- # EJEMPLO 1 meses= [x for x in range(1,13)] hipoteca= [700, 700, 700, 800, 800, 800, 850, 850, 850, 850, 850, 850]...
true
c2b823be6c7940ab81ccf6cdb135cf3da2e4ebe1
Python
BishuPoonia/coding
/Python/tkinters/hexagon.py
UTF-8
397
4.34375
4
[]
no_license
import turtle def square(): square = turtle.Turtle() for i in range(4): square.forward(50) square.right(90) def hexagon(): polygon = turtle.Turtle() num_sides = 6 side_length = 70 angle = 360.0 / num_sides for i in range(num_sides): polygon.forwa...
true
dca2340c6652fcda24e162e0b1e493dc1a95997d
Python
Mayur907/android-style-transfer
/adain/utils.py
UTF-8
2,069
2.78125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# -*- coding: utf-8 -*- import numpy as np import cv2 def preprocess(image, img_size=(224,224)): """ # Args image : rgb-ordered array """ image = np.expand_dims(cv2.resize(image.astype(np.float32), img_size), axis=0) return image def get_params(t7_file): import torch...
true
b9ce06d8b16616949704dc1943558f3a7db370ca
Python
myyel/pyhton
/alistirmalar/Dört Kenarına Göre Şeklin Tipini Bulma.py
UTF-8
620
3.421875
3
[]
no_license
k1=input("1. kenar: ") while not k1.isdigit(): print("lütfen bir sayi giriniz") k1=input("1. kenar: ") k2=input("2. kenar: ") while not k2.isdigit(): print("lütfen bir sayi giriniz") k2=input("2. kenar: ") k3=input("3. kenar: ") while not k3.isdigit(): print("lütfen bir sayi giriniz") k3=i...
true
d266f742b2b474d173aa85749eda8af7e4c88b00
Python
dannylee1020/flask-tutorial
/tests.py
UTF-8
3,006
2.75
3
[]
no_license
from datetime import datetime, timedelta import unittest from app import app, db from app.models import User, Post class UserModelCase(unittest.TestCase): def setUp(self): app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://' db.create_all() def tearDown(self): db.session.remove() ...
true
7946d28a7397048f58e96c49a6648d898da9dbff
Python
Sarcarean/sarcarean.github.io
/CS260/Chapter 3/Chapter_3.py
UTF-8
2,438
3.890625
4
[]
no_license
from Stack import Stack def do_math(op, op1, op2): if op == "*": result = op1 * op2 elif op == "/": result = op1 / op2 elif op == "**": result = op1 ** op2 elif op == "//": result = op1 // op2 elif op == "+": result = op1 + op2 elif op == "-": res...
true
5beb4994d79951bbd3e36afe1ec13badb74b2f3e
Python
anujarora93/clothing-detection-dataset
/crop_box_example.py
UTF-8
1,000
2.53125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- ######################################################### # # Alejandro German # # https://github.com/seralexger/clothing-detection-dataset # ######################################################### from PIL import Image import json import glob import random import matplotlib.pyplot as plt...
true
3a0ea52042d06cec4f1a23dcc8583e4bb8d8bafe
Python
ManonSabot/Competing_Optimal_Adjustments
/src/TractLSM/SPAC/soil.py
UTF-8
15,164
2.828125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Simple tipping bucket soil water balance model, a proxy for soil hydrology, with soil layer depths adapted for EucFACE. This file is part of the TractLSM model. Copyright (c) 2022 Manon E. B. Sabot Please refer to the terms of the MIT License, which you should have received along with th...
true
bcbcfcc38ee915ae23f3e018ff596b22b4e78c56
Python
linka/pcap2har
/pcap2har/pcapharconverter.py
UTF-8
1,552
2.703125
3
[ "BSD-2-Clause" ]
permissive
import json from har import JsonReprEncoder from httpsession import HttpSession from packetdispatcher import PacketDispatcher from pcap import PcapParser from pcaputil import ModifiedReader class PcapHarConverter(object): """ Representation of PCAP file in the HAR format """ def __init__(self, fileobj, drop_...
true
ebd35aad5400a8843eaa9bab547e7b3d1c48aad5
Python
SebastianElvis/ElvisProjs
/python/stock_prediction/module_prediction/nlp.py
UTF-8
4,669
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import LogisticRegression import logging import re import jieba logger = logging.getLogger("django") zh_pattern = re.compile(u'[\u4e00-\u9fa5]+') def is_contain_zh(string): string = ...
true
745236d1ecdaf7a5cd75382cde19adfcce719f06
Python
ReedJessen/AonDemo
/client.py
UTF-8
3,885
2.734375
3
[]
no_license
import requests import json import pandas as pd class IPStreetClient: def __init__(self): self.api_key = 'TGk3p1B0olaHdkGSbJSyDaMpDBPHiya688V8HOCT' self.page_size = 250 def get_semantic_search(self, raw_text, filter={}): """accepts a raw text field and optional query filter dict, retu...
true
fcd508f79e51a9cf1fef52860cf5e4bcebb7cbbf
Python
kiseonjeong/convolutional-neural-network-with-numpy
/function/gate.py
UTF-8
868
3.09375
3
[ "MIT" ]
permissive
import numpy as np # Weight and bias for test W = np.array([0.0, 0.0]) b = 0.0 def gate_and(x1, x2): # Calculate logical AND gate x = np.array([x1, x2]) w = np.array([0.5, 0.5]) b = -0.7 tmp = np.sum(W * x) + b if tmp <= 0: return 0 else: return 1 def gate_nand(x1, x2): ...
true
468d682b464bf2df3847b427c2fec42103f7f6e3
Python
vaibhavpalve1234/hackerrank
/today.py
UTF-8
502
2.828125
3
[]
no_license
# def sol1(n,str): # if len(str)==2*n: # return str # sol1(n,str+"(") # sol1(n,str+")") # def sol(op,cp,n): # if op+cp==2*n: # a=(sol1(op+cp,"")) # print(a) # return 1 # p1=sol(op+1,cp,n) # p2=sol(op,cp+1,n) # return p1+p2 # sol(0,1,2) def sol(str,res,isstart): if len(str)=...
true
05a9fc245d8c1a91bd4bda6be918f9e74863c0e3
Python
silky/bell-ppls
/env/lib/python2.7/site-packages/observations/r/doctor_aus.py
UTF-8
3,252
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import csv import numpy as np import os import sys from observations.util import maybe_download_and_extract def doctor_aus(path): """Doctor Visits in Australia a cross-section fr...
true
9158025d8bfc1d1c1682f4812863ca3cdd034a51
Python
edvinture/python
/ИНТЕРЕСНЫЕ ЗАДАЧИ ДЛЯ ЦИКЛОВ edvin sergei.py
UTF-8
983
3.421875
3
[]
no_license
# Edvin Kääpa, Sergei Smirnov sptvr19 #1 x = 1000 while True: print(x) x +=3 if x == 1018: break #2 x = 1 while True: print(x) x +=2 if x == 113: break #3 x = 90 while True: print(x) x -=5 if x == -5: break #4 x =...
true
3cc9c756482abf27ff48fad8df7bea91646c7011
Python
ZanchiTheo/Localisation-fingerprint-RSSI
/localisation.py
UTF-8
3,304
3.5
4
[]
no_license
#import des librairies import serial import string import numpy as np import json import operator from operator import itemgetter import re # Déclaration du pattern pour trier les AP par nom pattern = re.compile("AP[0-9]") # Interaction avec l'utilisateur pour savoir sur quel port écouter x = "n" # On ...
true
d0da2bb68e302dfbf2cbcfffe1b9cd4826d90365
Python
allenye0119/Amaze
/examples/basic_usage.py
UTF-8
637
2.8125
3
[ "BSD-3-Clause" ]
permissive
""" This module describes the most basic usage of Amaze: you define a prediction algorithm, (down)load a dataset and run a cross-validation procedure. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from amaze import SVD from amaze import Dataset from a...
true
8f8f1834db5b7ce19f08648cefb450a6cd4d1694
Python
fuyongde/python
/basic/niki.py
UTF-8
59
3.171875
3
[ "Apache-2.0" ]
permissive
def niki_abs(x, y): return x + y print(niki_abs(1, 3))
true
93b66199f0d052dc55e48f76db9de2aef1e9b191
Python
jbell1991/Intro-Python-II
/src/player.py
UTF-8
607
4.15625
4
[]
no_license
# Write a class to hold player information, e.g. what room they are in # currently. class Player: def __init__(self, name, current_room, inventory=None): self.name = name self.current_room = current_room self.inventory = [] def move(self, direction): if self.current_room.move[di...
true
2cd8b3fb6681ba0767ca2e871d90eb41057b4a50
Python
domzae/TaxiFareWebsite
/app.py
UTF-8
2,631
2.921875
3
[]
no_license
import streamlit as st import pandas as pd import datetime import requests import pydeck as pdk ''' # Taxi Fare Calculator ''' # map starting coords pickup_lon = -73.9798156 pickup_lat = 40.7614327 dropoff_lon = -73.8803331 dropoff_lat = 40.6513111 date = st.sidebar.date_input("Pickup Date", datetime.date(2021,5,28)...
true
e3237b6d448189cf5cc706321f5f2c3e081ff808
Python
purpl3F0x/NeuroKit
/neurokit2/signal/signal_rate.py
UTF-8
2,816
3.171875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import numpy as np import pandas as pd from .signal_interpolate import signal_interpolate from .signal_formatpeaks import _signal_formatpeaks_sanitize def signal_rate(peaks, sampling_rate=1000, desired_length=None): """Calculate signal rate from a series of peaks. Parameters ---...
true
caff94d40d951cee6183dcdf41326009057dfe63
Python
sharmar0790/python-samples
/misc/generateDimensionalArray.py
UTF-8
212
3.296875
3
[]
no_license
x,y = 3,5 r = list() for i in range(0,x): l = list() for j in range(0,y): if 0 < j < y and 0 < i < x: l.append(j*i) else: l.append(0) r.append(l) print(r)
true
ceb9c2f790f868838e69b426f71ad5bfe3f27db5
Python
lioraodg/WebScraping
/scraping.py
UTF-8
1,547
2.78125
3
[]
no_license
#!/usr/bin/env python import urllib2 import re from bs4 import BeautifulSoup import time from joblib import Parallel, delayed import multiprocessing # #Get links # start = time.time() nsubpages = 10 #331 folded pages by eye num_cores = multiprocessing.cpu_count() print "Running on ", num_cores, " CPU cores" real_l...
true
a0ca0ddadad36ab786b183200e34a5fccd9a63e6
Python
kadensungbincho/Online_Lectures
/fastcampus/office_automation_all_in_one/pythonIntermediate/9th/9th-2.py
UTF-8
397
2.703125
3
[]
no_license
from selenium import webdriver driver = webdriver.Chrome('../chromedriver') try: driver.get('http://news.naver.com') elem = driver.find_element_by_id('right.ranking_contents') lis = elem.find_elements_by_tag_name('li') for li in lis: a_tag = li.find_element_by_tag_name('a') prin...
true
7a2438afc385e5da51300695c716c2cf83e52291
Python
WPettersson/kidney_utils
/tests/test_graph.py
UTF-8
2,194
3.390625
3
[]
no_license
"""Test cases for the Graph class.""" from kidney_utils.graph import Graph from nose.tools import eq_ def test_treewidth_complete_graphs(): """Test treewidth algorithm, which is approximate and not exact. """ def test_kn(size): """Test on complete graphs.""" graph = Graph() for o...
true
b75ce71cb85702c6204e4843492bf2f9b6187f35
Python
TheChickenBoy/kattis
/python3/10kindaofpeople.py
UTF-8
1,341
2.796875
3
[]
no_license
import sys import heapq def floodfill(x, y): unvisited = [] heapq.heappush(unvisited, (x, y)) while unvisited: pos = heapq.heappop(unvisited) x, y = pos[0], pos[1] if m[x][y] == sp: m[x][y] = other if x > 0 and m[x-1][y] == sp: hea...
true
463aa0749e5336097975433c7fea7a3b5d965430
Python
DanielShangHai/python
/DanielShanghai/0000/AddNumToPic.py
UTF-8
2,437
2.8125
3
[]
no_license
from PIL import Image, ImageDraw, ImageFont __author__ = 'DanielSong' def add_num(img,number): #生成pad和数字 if number >= 10000: strNumber = '...' else: strNumber = '%d' %(number) draw = ImageDraw.Draw(img) #myfont = ImageFont.truetype('C:/windows/fonts/Arial.ttf', size=50) ...
true
09438a166e4064d7e38a1570674ab0b7121441c6
Python
ailomani/manikandan
/mani.42.py
UTF-8
70
2.953125
3
[]
no_license
m1,i=input().split() if(len(m1)>len(i)): print(m1) else: print(i)
true
1188f8f134d4b4c76dc6e3fafbf5e22b5854355c
Python
tanayrastogi/AI_Project_Path_Planning
/RRT/model.py
UTF-8
4,824
3
3
[]
no_license
import numpy as np from math import * import time from node import Node,State from kineticcar import KinCarmodel from dynpoint import DynPointmodel from diffdrive import DifferentialDrivemodel from dyncar import DynCarmodel from frictioncar import FrictionCarmodel class Model: def __init__(self,data,typ...
true
192d30b55c072a096697f7dbb110e8a68fc4d0c7
Python
YuraDmitrievtsev/Homework-2
/4.py
UTF-8
343
3.25
3
[]
no_license
import turtle import numpy as np v0=float(input("V0=")) alpha=float(input("alpha=")) k=float(input("k=")) n=float(input("n=")) dt=0.01 vy=v0*np.sin(alpha/180*np.pi) vx=v0*np.cos(alpha/180*np.pi) x=0 y=0 for i in range(5000): x+=vx*dt y+=vy*dt vy-=(10*dt+n*vy) vx-=n*vx if(y<0.01): vy=-k*vy...
true
08ee7545b923268535ea7f1f830db9b90a60becb
Python
Deep-Space-Industries/localization
/kalman.py
UTF-8
589
2.59375
3
[]
no_license
import numpy as np I = np.identity(3) A_t = np.identity(3) def z(C_t, x_t, delta_t): return C_t*x_t + delta_t def kalman_filter(previous_mu ,previous_sigma,current_u ,z_t, A_t, B_t, R_t, C_t, Q_t): #Prediction next_mu_bar= A_t*previous_mu + B_t*current_u next_sigma_bar= A_t*previous_sigm...
true
0f46523e8e0a56f313164a81b25fccde17cee4e9
Python
luxuguang-leo/everyday_leetcode
/00_leetcode/273.integer-to-english-words.py
UTF-8
1,460
3.625
4
[]
no_license
# # @lc app=leetcode id=273 lang=python # # [273] Integer to English Words # # @lc code=start class Solution(object): def numberToWords(self, num): """ :type num: int :rtype: str """ #三个一组来处理,最多处理四组,每组需要判断后两位是否小于20,因为20以内的数需要查表 #大于20小于99就取出十位和个位来组成就行 lessThan...
true
f1a699c98289d0678015c5253f7fca180bcd3d87
Python
mlflow/mlflow
/mlflow/entities/run_data.py
UTF-8
3,089
2.71875
3
[ "Apache-2.0" ]
permissive
from mlflow.entities._mlflow_object import _MLflowObject from mlflow.entities.metric import Metric from mlflow.entities.param import Param from mlflow.entities.run_tag import RunTag from mlflow.protos.service_pb2 import Param as ProtoParam from mlflow.protos.service_pb2 import RunData as ProtoRunData from mlflow.protos...
true
b8b44a7144cf08325d7a4caf1c205bc2e4bc2f4c
Python
randomkew/backj
/11047.py
UTF-8
132
2.96875
3
[]
no_license
x=int(input()) y=list(map(int,input().split())) y = sorted(y) sum=0 for i in range(x): sum+=y[i]*(x-i) print(sum) print(sum)
true
5f4733e188f6e22b84daa1f25be8e46ddaf2b9ce
Python
nithyaraman/pythontraining
/chapter2/src/vowels_and_consonant.py
UTF-8
377
3.40625
3
[]
no_license
"""write the program to print vowels and consonant letters from gulinux'""" vowel = ['a', 'e', 'i', 'o', 'u'] vowel_list = [] consonant_list = [] for var in 'gnulinux': if var in vowel: vowel_list.append(var) else: consonant_list.append(var) print "cosonant letters in gnuliunx\n", consona...
true
60dfdee2f0d9691636e238d04851455a655c2862
Python
123-IsraZaleta/HuntTI
/TestHuntIt-LenguajeSecundario/problem-2.py
UTF-8
2,320
3.3125
3
[]
no_license
def main(): j=0 k=0 lineList = [] max_1 = 0 max_2 = 0 player1_score = 0 player2_score = 0 file = './data/dataProblem2.txt' #-------------------PLEASE TYPE THE DOCUMENT PATH-------------------------------- with open(file, 'r+') as file_obj: for lines in file_obj: l...
true
71da2b64fd75511a0961b805988e4f99eda94a46
Python
L200180020/algostruk
/MODUL_4/T4.py
UTF-8
1,018
3.0625
3
[]
no_license
class Mahasiswa(object): def __init__(self, nama, nim, kota, uangsaku): self.nama = nama self.nim = nim self.kotaTinggal = kota self.uangSaku = uangsaku l0 = Mahasiswa("luqman", 107, "pojok", 289000) l1 = Mahasiswa("faris", 113, "serengan", 230000) l2 = Mahasiswa("ridwan", ...
true
9632a9a81a7e637562a28376125e8939520ea3a0
Python
glacierhole/PythonTools
/Kmeans实现.py
UTF-8
2,072
3.421875
3
[]
no_license
#Kmeans实现 #设定数据集 N=9 classlist = [[10, 2, 1],[1, 3, 1],[1, 2, 2],[2, 5, 2],[2, 5, 3],[2, 6, 3],[3, 2, 4],[3, 3, 4],[3, 3, 5]] #设定分类值k k = 3 #预设k个聚类中心 C1 = [1,1,1] C2 = [2,3,2] C3 = [5,5,5] #大循环M次,停止迭代 M=13 for j in range(M): #根据距离归类 class1 = [] class2 = [] class3 = [] for i in r...
true
20347c869253c4ccca224264b39b639cb5903bce
Python
fhfmendes04/Desenvolvedor_Python_Junior
/Collections/listas/lists_comprehension.py
UTF-8
229
3.359375
3
[]
no_license
lista_simples_inteiro = [1, 2, 3, 3, 4, 5] nova_lista = [] for i in lista_simples_inteiro: nova_lista.append(i * i) print(nova_lista) nova_lista_elegante = [i * i for i in lista_simples_inteiro] print(nova_lista_elegante)
true
1046cf80e8b0c5df330cb7be040ee72a81fc65d8
Python
Gympedies/Collective-intelligence
/gp.py
UTF-8
741
2.59375
3
[]
no_license
from random import randint, random,choice from copy import deepcopy from math import log class fwrapper: def __init__(self,function,childcount,name): self.function=function self.childcount=childcount self.name=name class node: def __init__(self,fw,children): self.function=fw.func...
true
2f3fbfbe01e58b53cc5a9bf327b51c7efe79da86
Python
LeonardoARGR/Desafios-Python-Curso-em-Video
/Mundo-1/desafio-030.py
UTF-8
292
3.421875
3
[ "MIT" ]
permissive
cores = {'limpo': '\033[m', 'vermelho': '\033[1;31m', 'verde': '\033[1;32m'} n = int(input('Digite um número: ')) if n % 2 == 0: print(f'Este número é {cores["verde"]}par{cores["limpo"]}') else: print(f'Este número é {cores["vermelho"]}impar{cores["limpo"]}')
true
3f2328382c1c9b2e01660698f085f015462ea653
Python
nkaeming/ILPLabWatch
/Services/PortService.py
UTF-8
10,346
2.984375
3
[]
no_license
import importlib, uuid, pkgutil import IOHelper.config as configIO from Models.Observable import Observable from Models.Observer import Observer from Models.PersistantObject import PersistantObject from Ports.AbstractPort import AbstractPort from Services.TriggerService import TriggerService class PortService(Observa...
true
d2f6a292afd27ab34150cad098a7d2528e45db56
Python
AzharAmin/Text-Summarizer
/TextSummarizer.py
UTF-8
3,574
3.296875
3
[]
no_license
import string from nltk.corpus import stopwords import numpy as np import networkx as nx from nltk.cluster import cosine_distance name = input('Enter .txt file: ') handle = open(name, 'r') lines = handle.readlines() handle = open(name, 'w') mystr = ''.join([line.strip() for line in lines])+"\n" handle.w...
true
e33a807f30091deda7bb47c46fc3bf2031119d1f
Python
sserdoubleh/Research
/ST_DM/GenRegion/src/generate/gen/regionalg.py
UTF-8
22,135
2.625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- ######################################################################## # # Copyright (c) 2019 Baidu.com, Inc. All Rights Reserved # ######################################################################## import sys import threading from region import geometry as mygeo from region import...
true
c92a86cebc2a7eb60db4f4f33186c2690313bac2
Python
hmortonsmith/hmwk2
/weekend-homework/run_sql_improved_with_classes.py
UTF-8
1,599
3
3
[]
no_license
import pyodbc from people_class import * class ConnSql: # when we initialise, make the connection def __init__(self, server='localhost,1433', database='Airport', username='SA', password='Passw0rd2018'): # Our variables to create a connection self.server = server self.database = databas...
true
bd2aac1db6dbd030b70eb6938fb9f735d9e1f356
Python
Rayveni/web
/webtrade/attributes/sec_history_manager.py
UTF-8
481
2.578125
3
[]
no_license
class sec_history_manager: __slots__ ='ticker','sec_name','currency','start_date','end_date','actual_for','description' def __init__(self,ticker:str,sec_name:str,currency:str,start_date:str,end_date:str,actual_for:str,description:str): self.ticker=ticker self.start_date=start_date self.s...
true
21abcf2bea73cbacead1a4833684bd44bc22aad2
Python
backtothefuture3030/algorithms
/여러 개의 4.py
UTF-8
139
3.546875
4
[]
no_license
import math #1 4의 4승 + 4 / 4 print(int(math.pow(4,4) + 4/4)) #2 4의 4승 * 4의 4승 - 4 print(int(math.pow(4,4) * math.pow(4,4) - 4))
true
cabc763b3e2c21cea6446ee3a2d308e121d2d776
Python
luizgallas/uri_iniciante
/1984.py
UTF-8
39
2.921875
3
[ "Apache-2.0" ]
permissive
seq = input().strip() print(seq[::-1])
true
bd966e38c10029cbf8d7668a2fe72c96ed86b114
Python
f2015712/Machine-Learning
/Supervised_ML/Classification/knn2.py
UTF-8
2,476
3.53125
4
[]
no_license
#KNN can be used for non-linear data import numpy as np from math import sqrt import matplotlib.pyplot as plt import warnings from matplotlib import style from collections import Counter import pandas as pd import random style.use('fivethirtyeight') dataset={'k':[[1,2],[2,3],[3,1]],'r':[[6,5],[7,7],[8,6]]} new_...
true
cd4eeb95878de43a524bbf82a64417fae8eddb49
Python
HarisHad2/exercises
/divisble_by_7.py
UTF-8
173
3.3125
3
[]
no_license
def divisble_by_7(yyy): for i in range(1, 1001): if i % 7 == 0 and i % 2 != 0: yyy.append(i) return yyy yyy = [] print(divisble_by_7(yyy))
true
5942dd56ac27496dbf335cf0cfe1c3a2d11d5548
Python
Akpandita/Video-Captioning-with-LSTM
/frames.py
UTF-8
530
2.578125
3
[]
no_license
import cv2 num=7010 while(num<=7509): vidcap = cv2.VideoCapture('./videos/video'+str(num)+'.mp4') success,image = vidcap.read() count = 0 success = True while success and count<=270: if(count==0 or count==54 or count==108 or count==162 or count==216 or count==270): cv2.i...
true
9d422fbdf1e1692cf06cf9faac260196a243f46e
Python
dahan-1996/Autoencoder_test
/AWGN_Autoencoder_versions/Transmitters/test_qpsk.py
UTF-8
3,082
3.09375
3
[]
no_license
import unittest from .qpsk import QPSKTransmitter import numpy as np class TestTransmitByte(unittest.TestCase): transmitter = QPSKTransmitter() def test_transmission(self): # Transmit an integer value input_int = np.uint8(100) output_int = self.transmitter.transmit_byte(input_int) # Make sure only uint8 in...
true
0e9765e1e8c3241a6ec6b25d3fbe3aeed6797bc0
Python
DangerousTod/TanksALot
/flyer.py
UTF-8
3,917
2.796875
3
[]
no_license
import pygame, sys, os, math, numpy as np class Cam: def __init__(self,pos=(0,0,0),center=(0,0,0),x=0,y=0,z=0): self.pos = list(pos) def events(self,event): pass def update(self,dt,key,rot): s = dt*10 r = rot*36 if key[pygame.K_s] and s != 1: self.pos[2]-=s #forward else: self.pos[2]...
true
a93a9d3352e904618803d57ce6bf0b0645054fd6
Python
mccoyp/azure-sdk-tools
/scripts/python/verify_agent_os.py
UTF-8
984
2.515625
3
[ "LicenseRef-scancode-generic-cla", "MIT" ]
permissive
# Script verifies the operating system for the platform on which it is being run # Used in build pipelines to verify the build agent os # Variable: The friendly name or image name of the os to verfy against from __future__ import print_function import sys import platform os_parameter = sys.argv[1].lower() if os_parame...
true