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
c90f0635fc30f4f5a7068026ada951d7e6dc6677
amclees/cs4660-fall-2017-amclees
/cs4660/search/searches.py
UTF-8
4,490
3.390625
3
[]
no_license
""" Searches module defines all different search algorithms """ try: import Queue as queue except ImportError: import queue import sys from graph import graph as g def bfs(graph, initial_node, dest_node): """ Breadth First Search uses graph to do search from the initial_node to dest_node ret...
true
f736c6e40a794ae184ea1d0b82cfc33322347dcc
keskinmertcan/ATM-Scenario-with-Python
/atm.py
UTF-8
5,524
3.0625
3
[]
no_license
import random ikiyuzluk = 100 yuzluk = 100 ellilik = 100 yirmilik = 100 onluk = 100 dakika = 0 saat = 8 sirano = 0 liste = ['Mehmet','Fatma','Mertcan','Fatih','Cihan','Emine','Servet','Müge','Berk'] z = ikiyuzluk+yuzluk+ellilik+yirmilik+onluk while saat < 17: if (z != 0): r = rand...
true
ed1251873b365e6c113b4e4f0d6f5333402f922c
chananelp/supermarket_list_maker
/web_html.py
UTF-8
1,309
2.921875
3
[]
no_license
import urllib.request import urllib.parse from bs4 import BeautifulSoup city_name = input("Please enter city (hebrew): ") #print(f'You entered {value}') if not city_name: city_name = 'אריאל' print(city_name) city_enc = urllib.parse.quote(city_name) #city = "%D7%90%D7%A8%D7%99%D7%90%D7%9C" # Ariel city #print(...
true
27f60921c563c4f46e53f5b3f5a4f702152d532e
koboldul/Udacity_AIND_Term1
/AIND-Annealing/AIND-Simulated_Annealing/ann.py
UTF-8
7,973
3.65625
4
[ "LicenseRef-scancode-public-domain" ]
permissive
# coding: utf-8 # # I. Introduction # # ![Simulated Annealing](SA_animation.gif) # As illustrated in the lectures, simulated annealing is a probablistic technique used for finding an approximate solution to an optimization problem. In this exercise you will check your understanding by implementing [simulated anneali...
true
f689fccd306780693d2a2616a148c80bac12e30c
dCremins/Wizards-2
/helpers.py
UTF-8
304
3.109375
3
[]
no_license
import time def delay_print(s): if isinstance(s, str): if len(s.split()) > 1: for line in s.split('\n'): print(line) time.sleep(.25) else: print(s) time.sleep(.25) else: print(s) time.sleep(.25)
true
85e40fc680068cdceff238e6b6c268b241527b85
rajacheers/mltrain
/madhuselvaraj/python-basics/basics1.py
UTF-8
1,230
3.9375
4
[]
no_license
import datetime from datetime import date import math #date & time print("datetime:") print(datetime.datetime.now()) print("--------------------------") #area of circle radius = float(input("enter the radius:")) area = math.pi * pow(radius, 2) print("area of circle is:",area ) print("--------------------------") #cr...
true
6afbcc9140b7d26d775b6d957f1e29bac7b10896
deepsjuneja/tathastu_week_of_code
/day4/program2.py
UTF-8
656
3.90625
4
[]
no_license
nList = int(input("Enter the no. of tuples in list: ")) nTuple = int(input("Enter the no. of elements in each tuple: ")) List = [] for i in range(nList): print("Enter the elements in tuple", i+1, "one by one: ") Tuple = () for j in range(nTuple): a = int(input()) Tuple = Tuple + (a, ) L...
true
24a9fc40198729563d051982be386a8f587ca144
divyaYK/pyqt5_docent
/advanced/menuwidget.py
UTF-8
863
2.578125
3
[]
no_license
import sys from PyQt5.QtWidgets import QAction, QApplication, QMainWindow class Window(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Menu Widget") self.setGeometry(50, 50, 640, 480) self.UI() def UI(self): menubar = self.menuBar() file = menubar.addMenu("File")...
true
65fe8db88d256f6842ef67a1a51f57d7663c4b3c
Govindakc/cs5390finalProject
/edit_distance.py
UTF-8
1,500
3.5625
4
[]
no_license
import sys from numpy import zeros class EditDistance: # Constructor def __init__(self, x, y): self.x = x self.y = y # This method uses dynamic programming and returns the edit distance def edDistDp(self): D = zeros((len(self.x)+1, len(self.y)+1), dtype=int) D[0...
true
b2dfd5b17dc7eb31363fe9ebdecd001b7ad97250
ronaldfalcao/formacao-python-alura
/forca/forca.V1.py
UTF-8
666
3.9375
4
[]
no_license
def jogar(): print(29 * "*") print("* Bem Vindo ao Jogo da Forca *") print(29 * "*") palavra_secreta = "banana" enforcou = False acertou = False while not enforcou and not acertou: chute = input("Qual a letras? ") chute = chute.strip() # Removendo os espaços em branco ...
true
d27099609598155b6a4dbf71bc13875dc6aa2f78
Hrabal/GoneDriverVisuals
/core.py
UTF-8
3,944
2.859375
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- from threading import Thread from queue import Queue import numpy as np import random import pyaudio import pygame import time import aubio from shapes import black, Line, Polygon from tools import wavelength_to_rgb, pitch_to_note, roundup class Analyzer: def __init__(self, input_n, n_ch...
true
e6c16d7b79e2a743d35720893b9cfd68212a3aaa
jchiang87/cp_pipe_drivers
/python/lsst_camera/cp_pipe_drivers/amp_stats.py
UTF-8
4,621
2.5625
3
[ "BSD-3-Clause" ]
permissive
""" Module to compute amp-wise mean and stdev statistics. """ import sys from collections import defaultdict import numpy as np import pandas as pd import lsst.daf.persistence as dp import lsst.afw.image as afwImage import lsst.geom import lsst.afw.math as afwMath __all__ = ['get_stats', 'OverscanHandler', 'get_raw_a...
true
43b7bf6946ebe3f3b14f2fda1c7aa3a8ef550f7d
thhapke/sdi_pandas
/solution/operators/sdi_pandas_0.0.37/sdi_pandas_0.0.36/content/files/vflow/subengines/com/sap/python36/operators/sdi_pandas/linRegressionTrain/linRegressionTrain.py
UTF-8
5,736
2.8125
3
[ "MIT" ]
permissive
import sdi_utils.gensolution as gs import sdi_utils.set_logging as slog import sdi_utils.textfield_parser as tfp from sklearn.linear_model import LinearRegression import pandas as pd EXAMPLE_ROWS = 5 try: api except NameError: class api: class Message: def __init__(self,body = None,attri...
true
198b66200ce2abe52b4711848a8e312a1ba47027
Jy1126/native-spider
/test.py
UTF-8
74
2.640625
3
[]
no_license
a = '1234567823456' import re c = re.search('(23)(45)',a) print(c.group())
true
c91e9eed9ef2ddb33c6bd212cfa048bccf92aaf8
zabiullakhangithub/Python_Session1_Assignment_1.7
/Assignment 1.7.py
UTF-8
378
3.96875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Feb 22 12:46:45 2018 @author: zabiulla.khan Write a Python program to reverse a word after accepting the input from the user. Sample Output: Input word: AcadGild Output: dilGdacA """ # Accept a word from user input word = str(input("Enter any word to reverse:")...
true
577cb7035522141aa553b31594f9e0e80896ec42
Daniel823/PiRealTimeMotionDetection
/motion.py
UTF-8
3,770
2.515625
3
[ "MIT" ]
permissive
import numpy as np from picamera import PiCamera, PiCameraCircularIO from picamera.array import PiMotionAnalysis from config import db, address, resolution, seconds,formats, sensitivity from utils import coordinates, twilight, write_video,upload_files_s3,remove_files_os, save_motion from helpers import _check_twilight,...
true
a8612c484a64b685f3073902667540324843a58f
LsAntonio/side-project
/scripts/model_helper.py
UTF-8
3,544
2.921875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: antonio @email: laguilarg@upao.edu.pe """ ############# # Libraries # ############# from PIL import Image import numpy as np import torch import torch.nn as nn from torch import optim from torchvision import models, datasets, transforms from collections impor...
true
65b603ed95393e4fe9c1e49b7303de310372aa21
sixtemesseven/reitkalender_crawler
/reitkalender.py
UTF-8
4,492
2.875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Mar 27 16:28:21 2019 @author: justRandom / Andreas Kellermann ##TODO: Find a way to sort that messy table ##TODO: Start program with arguments? ##TODO: Improve notification, popup window or similar... ##TODO: Documentation (?) """ import requests import lxml.html as lh im...
true
257ae0378886edaf4280f05a679bbdf8506cf6ca
morganstanley/testplan
/testplan/common/utils/sockets/fix/client.py
UTF-8
5,998
2.609375
3
[ "MIT", "Apache-2.0" ]
permissive
"""Fix TCP client module.""" import ssl import time import socket from typing import Optional from testplan.common.utils.sockets.fix.utils import utc_timestamp from .parser import tagsoverride, FixParser from ..tls import TLSConfig class Client: """ A Basic FIX Client Connects to a FIX server via the FI...
true
edaee3905301ad05279834205a5575aaddb3c194
JedPadoa/Python-Pitch-Detection-Program
/Main.py
UTF-8
983
2.75
3
[]
no_license
from scipy.io import wavfile from pylab import* from audioProcessing import freqArray, removeUnnecessary # import signal sampFreq, sound = wavfile.read(r'C:\Users\jeddo\Documents\Image-Line\Data\FL Studio\Projects\Audio_3.wav') s1 = sound[:, 0] # plot time domain of signal timeArray = arange(0, len(s1), ...
true
2786b526d98336058761ae97b0b5c7f3786e1a1f
xpqz/aoc-19
/day02.py
UTF-8
1,140
3.328125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # Advent of Code 2019 # # Day 2: 1202 Program Alarm # # https://adventofcode.com/2019/day/2 # # By Stefan Kruger def read_data(filename="data/input02.data"): with open(filename) as f: return (list(map(int, f.read().split(",")))) class Done(Exception): pass de...
true
c82ae483812a8493965131a20c4460f041379669
pepsin92/eigenbike
/scrapers/kaktus.py
UTF-8
1,603
2.515625
3
[]
no_license
import requests_html import requests import os from time import sleep from urllib.parse import urljoin from itertools import count base_url = 'https://kaktusbike.sk' base_dir = './data/training' request_frequency = 20 session = requests_html.HTMLSession() def parse_category(name, category_url): previous = None ...
true
16427fc6b85321fd5844936ed9e73c27701f0d99
gabriellaec/desoft-analise-exercicios
/backup/user_293/ch19_2019_04_03_18_55_31_003783.py
UTF-8
201
2.671875
3
[]
no_license
import math def calcula_distancia_do_projetil(v,θ,y0): a= (v**2)//2*9.8 b= 1 + math.sqrt(1+(2*9.8*y0)/v**2*((math.sin(θ))**2) c= math.sin(2*θ) d= a*b*c return d
true
ee5c940bd690c8bc55f4b845c538becdcf728f89
marcelopizani/resolucoes
/python/01/quarto.py
UTF-8
707
3.859375
4
[]
no_license
#!/usr/bin/env python # -*- coding: latin1 -*- qtd_masculina = 0; soma_masculino = 0; qtd_feminia = 0; soma_femino = 0; for i in range(5): sexo = str(raw_input("Digite um sexo (M)asculino ou (F)eminino: ")); idade = int(raw_input("Digite uma idade: ")); if (sexo == 'M') or (sexo == 'm'): qtd_masculina += 1; ...
true
87b34f56ce6f9b88189ecdfa8292a01c4021dfa0
mymatsubara/tomasulo-simulator
/stages/write.py
UTF-8
3,755
2.9375
3
[]
no_license
def write(reservation_stations, registers, config, cur_cycle, times, mem, fu, reservation_station_completed): ''' Escreve os resultados (atualiza a "mem" de acordo com a instrução concluída; atualiza a tabela "times"; para a instrução concluída atualiza a tabela "fu" para indicar que a unidade funcional está li...
true
bda5e984d2dbd4a07625484008b4f3bff9654c33
Arwen0905/Python_Test
/0727/a0727_dlib_imutils_臉部辨識.py
UTF-8
446
2.671875
3
[ "MIT" ]
permissive
import dlib import cv2 import imutils img = cv2.imread("face_francefoot.jpg") img = imutils.resize(img, width=1280) detector = dlib.get_frontal_face_detector() face_rects = detector(img, 0) #0:一般偵測、1:臉部較小 for i,d in enumerate(face_rects): x1 = d.left() y1 = d.top() x2 = d.right() y2 = d.bottom() cv2...
true
bc7c9150851fe6c262b10d8efecc28682a0cbcf3
praveenreddynarala/RobotFramework
/Test_Automation/TestFramework/Libraries/Pages/home_page.py
UTF-8
8,745
2.625
3
[]
no_license
"""Implementing Home screen page objects repository""" from TestFramework.Libraries.Pages.base_page import BasePage from TestFramework.Libraries.Pages.login_page import LoginPage from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC class HomePage(BasePage): ...
true
dcaa312798bb549e3951854337bd64482b0b8eef
rperera12/anisotropicfracture
/simba/database.py
UTF-8
1,884
2.640625
3
[]
no_license
#!/usr/bin/env python3 import argparse import sqlite3 import hashlib import os import re import simba parser = argparse.ArgumentParser(description='Sift through outputs') parser.add_argument('directories', nargs='*', help='List of directories containing ALAMO output') parser.add_argument('-d','--database', default='r...
true
18332e7c8d48e9ae9655c1746642a9b76f5990b7
superr90/Monkey_PacMan
/Utils/FigUtils.py
UTF-8
45,798
2.671875
3
[]
no_license
''' Description: Utility functions for the figure plotting. ''' import numpy as np import pandas as pd import itertools import random from more_itertools import consecutive_groups as cg import copy import sys sys.path.append("/home/qlyang/Documents/pacman/") # =====================================...
true
40ff2e00f84e9b696718cf2435ca3b6052b4c181
dbbudd/Python-Experiments
/Pokemon/Battle Examples/pokemonAdv.py
UTF-8
6,148
3.515625
4
[]
no_license
#!/bin/python ## Todo ################################################# # choice for attacks # # each pokemon has a diffrent attack set # # more battles, maybe a tournament system # # more choices for items, instead of just a potion # ######################################################### ## Module...
true
5acd733d38700eccf4abd6ca662644ed0b2f751d
Susan-Cloy/KenyaPoverty
/batcher.py
UTF-8
13,778
2.859375
3
[ "Apache-2.0" ]
permissive
from __future__ import annotations from collections.abc import Iterable, Mapping from typing import Optional import tensorflow as tf class Batcher(): def __init__(self, tfrecord_files, label_name, scalar_features, ls_bands='rgb', nl_band=None, nl_label=None, batch_size=1, epochs=1, normalize=Non...
true
ad27a135dd27f1e8c933c308897e0391b378a320
snvenen/gens
/pick up line gen.py
UTF-8
444
3.546875
4
[]
no_license
import time import random print "pick up line generator 2016" print "by paul bell and sam moore" time.sleep(1) prt1 = ["if i could rearrange the alphabet, ", "are you from tennessee, ", "did it hurt when you fell ", ""] prt2 = ["i would you put 'u' and 'i' together", "because you're the only 10 i see", "f...
true
2f996f06d535927687550c7a65c553abffc61b6b
alanhdu/testing-talk-materials
/linters/mypy.py
UTF-8
89
3.203125
3
[]
no_license
def is_palindrome(s: str) -> bool: return s == str(reversed(s)) is_palindrome(3)
true
77e72ca2d99e2ce15a668e81ee86c4160158627c
knaidoo29/VectorGP
/distance.py
UTF-8
1,881
3.515625
4
[]
no_license
import numpy as np def get_distance_squared(pos1, pos2): """Returns distance squared. Parameters ---------- pos1, pos2 : array_like Positions in 1 axis. Returns ------- r2 : array_like Distance squared. """ r2 = (pos1 - pos2)**2. return r2 def get_distance_s...
true
ea86256665ce9f00605eb57a0d895d873c8983ca
fly2rain/LeetCode
/zigzag-conversion/zigzag-conversion.py
UTF-8
1,116
3.21875
3
[]
no_license
__author__ = 'clp' class Solution(object): def convert(self, s, numRows): """ :type s: str :type numRows: int :rtype: str """ if numRows == 1: return s str_list = ['' for x in range(numRows)] element_len = 2 * numRows - 2 total_el...
true
6c4889a3a6178a42d5c0529c6d6c1720aa498f6d
LalithChandraAttaluri/Python_ICPS
/ICP6/ICP6_4.py
UTF-8
1,076
2.9375
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt from sklearn.decomposition import PCA import numpy as np from sklearn.cluster import KMeans from sklearn import preprocessing from sklearn.metrics import silhouette_score import seaborn as sns #Importing Dataset dataset = pd.read_csv('CC.csv') #Finding the top 5 mos...
true
1c26fbd6612bf1ad1e4f6d44d5ac5b12b0be3406
Road-Balance/Spotmicro_Dynamixel
/Simulation/pybullet_tutorial/pybullet_simplecar.py
UTF-8
1,839
3.046875
3
[ "Apache-2.0" ]
permissive
""" Reference from: https://gerardmaggiolino.medium.com/creating-openai-gym-environments-with-pybullet-part-1-13895a622b24 """ import pybullet as p import pybullet_data from time import sleep physicsClient = p.connect(p.GUI) p.setAdditionalSearchPath(pybullet_data.getDataPath()) p.setGravity(0, 0, -9.8) # Sliders ...
true
4a8bd023339436cd0f9845c31d29de2e00b6d5c6
tangkaiyang/fluent_python
/chapter06/promotions.py
UTF-8
793
2.953125
3
[]
no_license
# !/usr/bin/env python3 # -*- coding: utf-8 -*- # @Time : 2019/4/4 13:31 # @Author : tangky # @Site : # @File : promotions.py # @Software : PyCharm def fidelity_promo(order): """为积分为1000或以上的顾客提供5%折扣""" return order.total() * .05 if order.customer.fidelity >= 1000 else 0 def bulk_item_promo(orde...
true
9811a15c30fae6fcb2455f20e2f55108a75d4d0c
NxG-7/Etherblob-Explorer
/etherblob/lib/explorer.py
UTF-8
6,766
2.609375
3
[ "MIT" ]
permissive
import os import shutil from pyfiglet import Figlet from termcolor import colored from time import sleep from etherscan import Etherscan from etherblob.lib.extractor import Extractor from etherblob.lib.stats import Stats from etherblob.utils.log import Logger from etherblob.utils.wrappers import ends_gracefully class...
true
a42cf251199f931cbca3557937b2f5bdb408e8ce
basecampshirls/mycode
/alicebobadventures/alicebobstegano.py
UTF-8
1,355
3.421875
3
[]
no_license
#!/usr/bin/python3 import requests import wget import webbrowser import turtle from PIL import Image from stegano import lsb #pulling random dog pic url via API and convert JSON to python def url(): dogs = requests.get("https://random.dog/woof.json") dog_api = dogs.json() return dog_api #use pulled url to...
true
420c0d991320275f10fba0610f6036f43ac2c598
DanielBaudry/darksector
/src/use_cases/player_attack_monster.py
UTF-8
788
2.859375
3
[]
no_license
from src.domain.expedition.expedition_repository import ExpeditionRepository from src.domain.player.player_repository import PlayerRepository class PlayerAttackMonster: def __init__(self, player_repository: PlayerRepository, expedition_repository: ExpeditionRepository): self.player_repository = player_rep...
true
03cda6369520d4e381f2a92739403ec20b1f7804
iamajay/task_scheduler
/src/models/tracking_key.py
UTF-8
810
2.5625
3
[]
no_license
from sqlalchemy import Column, ForeignKey, String from sqlalchemy.orm import relationship from base import Base from task_list import TaskList class TrackingKey(Base): __tablename__ = 'trackingkey' UniqueId = Column(String(32), primary_key=True) TrackKey = Column(String(5), nullable= False) TaskUniqu...
true
a9692830ffb7d57ce1005c00e406f088e708128f
OptimusCrime/ntnu-2015-it3105-module5
/mnist_loader.py
UTF-8
1,645
2.65625
3
[]
no_license
# -*- coding: utf-8 -*- import os import numpy as np class Loader: def __init__(self): pass @staticmethod def load(dataset='training'): # Get the path for the dataset path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data') # Chose what dataset to open ...
true
325735be987334a288694f096b54c8e22a97dd64
Swapnull/EddieRobot
/src/eddie_serial_driver/eddie.py
UTF-8
1,861
3.28125
3
[]
no_license
#!/usr/bin/env python import sys import glob import serial class Eddie: def __init__(self): self.ser = getOpenPort() self.ser.baudrate = 115200 def sendCommand(self, shape): if shape == 'triangle': s = 'GO 50 50\r' print s print 'going forward' self.ser.write(s.encode()) elif shape == 'square...
true
4665167cd6c13ecaf986e3c73fb83affd81b2096
carinapetcu/University-Projects
/Graph algorithms/Connected components of an undirected graph using BFS/Entities/UndirectedGraph.py
UTF-8
2,465
3.375
3
[]
no_license
class UndirectedGraph: def __init__(self, numberOfVertices): self._dictionaryOut = {} self._dictionaryCosts = {} for index in range(numberOfVertices): self._dictionaryOut[index] = [] def get_number_vertices(self): return len(self._dictionaryOut.keys()) def get_n...
true
01f478059ef5491b2c77c9d75951bf4e6c65acb7
00-00-00-11/hata
/hata/ext/__init__.py
UTF-8
2,506
2.9375
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- """ Hata extensions come into this folder. If a hata library extension is imported, it should register itself with the ``register_library_extension``, so if an other library extension is imported, it can register a hook to run only if both are imported. Hook registrations can be done with the ...
true
555bd55183e945224c1f2ed8283617b07b31c5f6
asurendrababu/nehprocpy
/triangleQuest2.py
UTF-8
276
3.796875
4
[]
no_license
# https://www.hackerrank.com/challenges/triangle-quest-2/problem #Print the palindromic triangle of size as explained above. # # Sample Input # # 5 # Sample Output # # 1 # 121 # 12321 # 1234321 # 123454321 for i in range(1, int(input()) + 1): print((10 ** i // 9) ** 2)
true
9aae1393d498fc1a59f088cd1bffe9aecca0ef60
iIdele/College-Programming-Lab-Exercises
/python_exercises/boggle_122.py
UTF-8
2,434
3.171875
3
[]
no_license
import sys d_pos = {'1': ['2', '5', '6'],'2': ['1', '3', '5', '6', '7'], '3': ['2', '4', '6', '7', '8'], '4': ['3', '7', '8'], '5': ['1', '2', '6', '9', '10'], '6': ['1', '2', '3', '5', '7','9', '10', '11'], '7': ['2', '3', '4', '6', '8', '10', '11', '12'], '8': ['3', '4', '7', '11', '12'], '9':...
true
4bc12b44011f922169efb2510b923badb14c97a0
emcek/dcs_liberation
/gen/defenses/armor_group_generator.py
UTF-8
778
2.578125
3
[]
no_license
import random from dcs.vehicles import Armor from game import db from gen.defenses.armored_group_generator import ArmoredGroupGenerator def generate_armor_group(faction:str, game, ground_object): """ This generate a group of ground units :param parentCp: The parent control point :param ground_object...
true
59c1d7ef1f9d7f139fc0be10d92c1bc079955597
randomgen1/fashion-MNIST-classification
/utils.py
UTF-8
2,564
2.59375
3
[]
no_license
''' The code contains utility functions/methods to be used while training, like data transform ''' import torch from torchvision import transforms ########################################################################### # Data transforms ########################################################################### da...
true
705681f3a5da69a4b07e2baf88236ec88ddbf566
simple-framework/simple_grid_yaml_compiler
/simple_grid_yaml_compiler/compiler/semantics.py
UTF-8
678
2.65625
3
[ "Apache-2.0" ]
permissive
import os import tempfile from ruamel.yaml import YAML def check_yaml_syntax(expanded_yaml_file): #try: yaml = YAML() expanded_yaml_file_temp = open(expanded_yaml_file.name, 'r') augmented_yaml = yaml.load(expanded_yaml_file_temp) augmented_site_level_configuration_file = open(os.pa...
true
5cb93be6efd6f602a5d05136d698f92c3dc3e67c
bestenk/beste4
/4.haftacumartesi12.py
UTF-8
492
3.8125
4
[]
no_license
# kullsnıcı dışarıdan string olarak sayı dizisi gönderecek # 3 4 5 6 77.7 77 4 12.3 54 54.67 gibi #gelen string değeri geriye sayısal bir dizi olarak döndürünüz def converttolist(string): mylist = string.split() for n in range(len(mylist)): if mylist[n].count("."): mylist[n] = float(my...
true
0fc0de8b12f75111bc58987e00fde6490d0f6f7d
QitaoXu/Lintcode
/Alog+/class5/maxiumProductSubarray.py
UTF-8
622
3.171875
3
[]
no_license
class Solution: """ @param nums: An array of integers @return: An integer """ def maxProduct(self, nums): # write your code here n = len(nums) f = [0 for _ in range(n)] g = [0 for _ in range(n)] f[0] = nums[0] g[0] = nums[0] ...
true
6137f032317d4eceb52fb72b193c7dfba6796acc
membase/ep-engine
/management/clitool.py
UTF-8
2,878
2.546875
3
[ "Apache-2.0" ]
permissive
import optparse import socket import sys import mc_bin_client class CliTool(object): def __init__(self, extraUsage=""): self.cmds = {} self.flags = {} self.extraUsage = extraUsage.strip() self.parser = optparse.OptionParser( usage="%prog host[:dataport] command [option...
true
e66e88eb20f3ed7d63aa1144fcbf1d4c9cccb8b3
riyadhswe/Python_Javatpoint
/03 Python Keywords/for, while.py
UTF-8
46
3.453125
3
[]
no_license
list = [1,2,3,4,5] for i in list: print(i)
true
c6fe441ab007eff0c044f7dc548a9c9d5b115402
Stanford-BIS/pystorm
/pystorm/examples/parse_power_data.py
UTF-8
25,078
2.921875
3
[ "MIT" ]
permissive
import numpy as np import matplotlib.pyplot as plt import time import csv import glob from os import listdir, walk from os.path import isfile, join # This program parses power measurement data gotten from the Keithley 2604B # SourceMeter. def getData(csvFileName, numHeaderRows=6): Measurements = [] with op...
true
9ed6eecfa1826afce0efabddd0de4c914761000c
masashi69/My-home-lab
/addledend.py
UTF-8
735
2.8125
3
[]
no_license
from PIL import Image, ImageDraw, ImageFont import os filename = 'homelab.png' legend = """\ Out of service Not built """ diag = Image.open(filename) width, height = diag.size # Setting rectangle position start_x = width - 210 end_x = width - 230 start_y = 5 end_y = 15 # Setting font RictyFont = ImageFont.truetyp...
true
a2f077e524006e31a66f5d091e4c16c760a13286
portworx/dcos-commons
/tools/universe/test_package.py
UTF-8
1,698
2.578125
3
[ "Apache-2.0" ]
permissive
from .package import Package from .package import Version def test_version_comparison(): assert Version(0, "1.2.4") < Version(10, "1.2.4") assert Version(0, "1.2.5") < Version(10, "1.2.4") assert Version(0, "1.2.3") == Version(0, "1.2.4") assert Version(0, "1.2.3") == Version(0, "1.2.3") assert ...
true
5c0931a38f5d117a6e619ddf13ca42dd66160ce5
yoann-dufresne/AMIC2
/view.py
UTF-8
569
3
3
[]
no_license
from math import floor class View: def __init__(self, game, term=True, net=False): self.game = game self.terminal = term self.network = net def refresh(self): if self.terminal: self.refresh_term() if self.network: self.refresh_network() def refresh_term(self): next_walls = ['-' if val else ' ' f...
true
f45939ae4dcd2ba7e8f5bcbe092999a387721c81
rvcjavaboy/eitra
/python-assignments/new/exp2.py
UTF-8
320
4.03125
4
[]
no_license
''' Write a generator that creates an endless stream of numbers starting from a value given as argument with a step size of 5. Write one version without and one with itertools. ''' def Num(n): while 1: yield n n+=5; n=Num(int(input("Enter Number"))) for i in n: print(i)
true
f8103dfaf863d17d731bfa27d004cde4752132e1
duynguyen-usc/craps_sim
/craps_sim.py
UTF-8
1,796
3.703125
4
[]
no_license
import random def roundDown(n, divisor): return n - (n % divisor) def getBetMultiplier(n): if (n == 6 or n == 8): return 6 else: return 5 def rollDice(): DICE_MIN = 1 DICE_MAX = 6 dice1 = random.randint(DICE_MIN, DICE_MAX) dice2 = random.randint(DICE_MIN, DICE_MAX) ret...
true
7a5057ce92755cbc5ee032fd917c79edca8fe54e
IGATUS/data-science
/covid.py
UTF-8
1,378
2.96875
3
[]
no_license
import streamlit as st import pandas as pd import requests from bs4 import BeautifulSoup #web scraping to get the list of world countries @st.cache def countries(): url='https://www.worldometers.info/geography/alphabetical-list-of-countries/' r=requests.get(url) soup=BeautifulSoup(r.conten...
true
0a34927a3ef5eae13797f889cb72ec0533babd49
brandjamie/udacity_osm_data_wrangle
/clean.py
UTF-8
17,521
3
3
[]
no_license
import xml.etree.ElementTree as ET import re import string import json # regular expressions used in checking data # All lower case including underscore lower = re.compile(r'^([a-z]|_)*$') # All lower case including underscore and one colon. lower_colon = re.compile(r'^([a-z]|_)*:([a-z]|_)*$') # contains characters...
true
5f8590a8d8c96989faab6649a6321096d36778ea
jaeehooon/baekjoon_python
/단계별로 풀어보기/4. while문/[10951] A + B - 4.py
UTF-8
368
3.65625
4
[]
no_license
""" 입력이 끝날때까지 A+B를 출력하는 문제. EOF에 대해 알아 보세요. EOF는 빈 문자열, 예를 들면 "" 같은 문자열 아래의 코드에서 아무 입력이 없으면 예외처리가 되어 종료가 됨 """ import sys while True: try: a, b = map(int, sys.stdin.readline().split()) except: break print(a + b)
true
e131e00d6aba6fde48c6cd777058d497c2cb8db9
RubeshU/Python-Internship-BEST-ENLIST
/Day_2_Task.py
UTF-8
646
3.828125
4
[]
no_license
print("30 days 30 hour challenge") print('30 days 30 hour challenge') Hours = "thirty" print(Hours) Days = "Thirty days" print(Days[0]) Challenge = "I will win" print(Challenge[7:10]) Challenge = "I will win" print(len(Challenge)) Challenge = "I will win" print(Challenge.lower()) a = "30 Days" b = "30 ho...
true
8ad4cda4a8fcdbe5cb1706985b4dfd0cfa43d654
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_136/2363.py
UTF-8
858
2.921875
3
[]
no_license
N = 0 #total test cases with open("output.txt", 'w') as output: with open("B-large.in") as inp: N = inp.readline() N = int(N) for i in range(0, N): val = inp.readline() C, F, X = val.split(" ") C = float(C) F = float(F)...
true
4ce14be64d3484b0abceaa53907bcaaf07cf197c
iis-siium/synthetic_datasets
/MNIST/convertMNIST.py
UTF-8
3,150
3.0625
3
[ "Apache-2.0" ]
permissive
# IMPORTS import tensorflow as tf import tensorflow_datasets as tfds import csv import os from PIL import Image # CONSTANTS TRAINING_SIZE = 60000 TESTING_SIZE = 10000 DATA_IMAGE_WIDTH = 28 DATA_IMAGE_HEIGHT = 28 FINAL_IMAGE_WIDTH = 100 FINAL_IMAGE_HEIGHT = 100 TRAINING_EXPORT_DIR = "MNIST_Converted_Training\\" TRAININ...
true
fbbf5992f27c2c6fd54456585b50b707c5270cb7
AlexeyGy/raspberry-frontend
/model.py
UTF-8
1,874
2.65625
3
[]
no_license
import os from logging import info from typing import List import numpy as np import cv2 as cv INPUT_FOLDER = "model/" # where we read the neural network from # the image size that the neural network is trained to work on. # Should only be changed if the model is switched. IMAGE_FORMAT = (544, 320) # a pretrained ...
true
75635f4503aa098750302f404627487dbea0da00
riley-martine/dku-culture
/data/clean_data.py
UTF-8
3,436
3.375
3
[]
no_license
#!/usr/bin/env python3 """Clean up the raw data into something easier to work with.""" # I did this with python because I was too lazy to # spend 5 minutes doing it by hand import csv import itertools import re from typing import Dict, List from autocorrect import NLP_COUNTS, known, spell # We could use a mypy_ex...
true
7ce81047f3075168aa747894943cad117845bfe9
jjoyce0510/whiteboard-genius
/symbol_training/parse_letters.py
UTF-8
3,423
2.625
3
[]
no_license
# Import the modules import cv2 import numpy as np from os import listdir from os.path import isfile, join IMAGE_NAME = 'scanned_test.png' CURR_FOLDER = '../symbol_training/doub_quote' files = [f for f in listdir(CURR_FOLDER) if isfile(join(CURR_FOLDER, f))] images = [f for f in files if '.png' in f and 'j' in f] cu...
true
44aef0d405e322a7a1fab722758035dd2ce8a038
keyehzy/Kattis-problems
/sumsquareddigits.py
UTF-8
296
2.890625
3
[]
no_license
def sumsquareddigits(): n = int(input()) for _ in range(n): i, b, n = map(int, input().split()) r = 0 while n > 0: s = n % b n //= b r += s * s print(i, r) return if __name__ == '__main__': sumsquareddigits()
true
d07a65172be0e78f96b8018152b9d0b549c580a9
cytadela8/django-deployment
/safe_caller.py
UTF-8
1,808
2.53125
3
[]
no_license
#!/usr/bin/python3 import sys import caller_config import subprocess import os from filelock import FileLock class InvalidCommit(Exception): pass def sanitize_commit_info(commit: str) -> str: commit = commit.strip() if not commit.isalnum(): raise InvalidCommit() return commit def get_maste...
true
5e96aa02772b260ca92571d497f7b9eb8766de87
gabrielvtan/ByteAcademy-FullStack
/Phase1/Week1/Python/1.3_4-Read-McNugget-Matrix-Hanoi/3-matrix-sort/row_col_sort.py
UTF-8
1,569
3.390625
3
[]
no_license
import numpy as np from tabulate import tabulate def read_matrix_file(filename): with open(filename, 'r') as open_file: output_list = [] for line in open_file: output_list.append(line.split()) output_list = [[int(j) for j in i] for i in output_list] return (output_list) def p...
true
6b3624affb68bc61cc78a2e957121d6b8abe4a40
T-Cube-AI/Time-dependent-SEIRD-Model-API
/World-Wide-Covid19/computeInsightsFunction.py
UTF-8
272
2.671875
3
[ "MIT" ]
permissive
#!/usr/bin/python3 def computeInsights(confrimed, deaths, active=None): insights = dict() cfr = (deaths / confrimed) * 100 insights["cfr"] = cfr if active != None: ifr = (deaths / active) * 100 insights["ifr"] = ifr return insights
true
090a75be01cea1f6aa5beec0b3a611183b2568ae
hectorlopezv/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/tests/6-max_integer_test.py
UTF-8
1,075
3.21875
3
[]
no_license
#!/usr/bin/python3 """unit test module""" import unittest max_integer = __import__('6-max_integer').max_integer class testing(unittest.TestCase): """testing for max_integer function""" def test_max_integer(self): self.assertEqual(max_integer([1, 2, 3]), 3) def test_max_integer_2(...
true
5475c723cf741325bc1ba9d0c007ca43ddac8dd8
aldew5/CCC-Solutions
/2014/python/J2.py
UTF-8
367
3.640625
4
[]
no_license
# Alec Dewulf # "Vote Count" J2 2014 num_votes = int(input()) votes = list(input()) a_votes = 0 b_votes = 0 x = 0 while x < num_votes: for v in votes: if v == 'A': a_votes += 1 elif v == 'B': b_votes += 1 x += 1 if b_votes < a_votes: print("A") elif a_vot...
true
b96d5ee7a5661aa1d117b20633b028bf12199bc4
shelleywu1921/tsp
/stableset/find_comb_test_pr76.py
UTF-8
3,141
2.859375
3
[]
no_license
''' Try to see if setting comb_upper_bound to 1.0 will find anything This is testing the above idea on pr76 ''' #find_comb_test.py: ''' I've decided to move the finding comb __name__=='__main__' from mindomcut2.py to here. Deleted progreebar, not useful after all. Too lazy to fix it Moreover, I have added a loop s...
true
00bdaae28935913b3b82b979bfa76ee5dcb96e8d
mhouse1/mechsoftronic
/Kshatria/src/test_kshatria.py
UTF-8
4,805
2.625
3
[ "MIT" ]
permissive
''' Created on Apr 20, 2015 @author: MHouse1 ''' import gui_support import time class HardwareTest: def __init__(self,builder): builder_object = builder cfg_file_handle = gui_support.CfgFile(builder_object) self.CNCConfigData = gui_support.CfgData(builder_object, cfg_fil...
true
d22389dfc6ec86b11f34041778ee01646ea958d9
Saketh-Chandra/blynk-library-python
/examples/05_utc_and_timezone.py
UTF-8
1,339
3.09375
3
[ "MIT" ]
permissive
""" Blynk is a platform with iOS and Android apps to control Arduino, Raspberry Pi and the likes over the Internet. You can easily build graphic interfaces for all your projects by simply dragging and dropping widgets. Downloads, docs, tutorials: http://www.blynk.cc Sketch generator: http://examples.blyn...
true
4a06b6887101e81373994188f59865a9a7ee317d
selous123/tensorflowExercise
/tensorflow_ex/ex1/dataset/house data/read_housing.py
UTF-8
648
2.578125
3
[]
no_license
#coding:utf-8 from __future__ import division import sklearn import numpy as np from sklearn.model_selection import train_test_split def read_housing_data(): # file = open("housing.data.txt",'r'); # for line in file: # print line; a = np.loadtxt("housing.data.txt"); data = a[:,1:end-1]; ...
true
cf965db594ba6c6c6bd7080a8184db639d73b76c
shrechatterjee/Twitter_Search_for_phrase
/auto_tweet.py
UTF-8
2,087
3.09375
3
[]
no_license
##skc1v12@soton.ac.uk ## This code is to find out if there are any string of choice can be found within last N number of tweets from twython import Twython from twython import TwythonStreamer CON_KEY ='***********************************' #Consumer Key (API Key) CON_SEC ='***********************************' #Cons...
true
81819214751d8b90d50115bbadf4f08dc5d6ea9d
kc113/pyprog1
/BST.py
UTF-8
7,909
4.09375
4
[]
no_license
# BST.py from TreeNode import TreeNode class BST: #------------------------------------------------------------ def __init__(self): """create empty binary search tree post: empty tree created""" self.root = None #-------------------------------------------...
true
7eb8d4ae656973f1e25a64ddc0444b99e2a531c7
adongxu/Python-Data-Visualization
/demo5.py
UTF-8
948
3.265625
3
[]
no_license
from matplotlib.pyplot import * # generate different normal distributions x1 = np.random.normal(30, 3, 100) x2 = np.random.normal(20, 2, 100) x3 = np.random.normal(10, 3, 100) # plot item plot(x1, label='plot') plot(x2, label='2nd plot') plot(x3, label='last plot') # generate a legend box # start pos=(0,1.02) width=...
true
5d15c9cfb2548f763b54fedae5331e0d2d4e88a2
cyckuan/summ
/utils/save_dict_to_json.py
UTF-8
259
2.78125
3
[]
no_license
#! /usr/bin/env python def save_dict_to_json(data_dict,json_file): """ saves data to json file """ import json f = open(json_file,"w") json.dump(data_dict, f, indent=4) # sort_keys=True, ensure_ascii = False f.close()
true
1304c607feecc22e01a2b08bf054e5efb5f1a886
ZyryanovAV/lb11
/Individual1.py
UTF-8
1,298
3.75
4
[ "MIT" ]
permissive
#!/usr/bin/env 2. # -*- config: utf-8 -*- # Вариант 1. Напишите рекурсивную функцию, проверяющую правильность расстановки скобок в строке. # При правильной расстановке выполняются условия: # количество открывающих и закрывающих скобок равно. # внутри любой пары открывающая – соответствующая закрывающая скобка, скобки ...
true
437ccfe3b2f8c96aa9d1ad3a638ec2919a204767
Gonulkirmazz/roadmap_folders
/Python_Fonksiyonlar/Exercises_5.py
UTF-8
2,080
5
5
[]
no_license
################# # Exercise 5 # Let's use functions to calculate your trip's costs: # # Define a function called hotel_cost with one argument nights as input. The hotel costs $140 per night. # So, the function hotel_cost should return 140 * nights. # Define a function called plane_ride_cost that takes a string, city, ...
true
fd08a734453d77de80c8f821a5cf14dc7c5428dd
le773/ud120-projects
/codeone/decision_tree/dt_author_id.py
UTF-8
1,518
3.015625
3
[]
no_license
""" This is the code to accompany the Lesson 3 (decision tree) mini-project. Use a Decision Tree to identify emails from the Enron corpus by author: Sara has label 0 Chris has label 1 """ import sys from time import time import os sys.path.append(os.getcwd() + "\\codeone\\tools") from email_preproces...
true
c75447c1b8a095bb7a11858234b1ef9eaadc6f19
tanpinquan/parallel_data_mining
/eclat_seq.py
UTF-8
1,200
3.03125
3
[]
no_license
from collections import OrderedDict def prune_dict(dic, min_support): out_dic = {} for key, value in dic.items(): if len(value) >= min_support: out_dic[key] = value return out_dic def merge_tids(dic): out_dic = {} for key, value in dic.items(): for key2, value2 in d...
true
c9b55fb5febda9fd28119b8917ca61364db4904f
MasterScott/vk_scripts
/vk_photos.py
UTF-8
1,514
2.59375
3
[ "WTFPL" ]
permissive
#!/usr/bin/python3 import os import requests import json from time import sleep from pathlib import Path token = 'Your token' v=5.52 def setup_download_dir(): download_dir = Path('Photos') if not download_dir.exists(): download_dir.mkdir() return download_dir def write_json(data): with open('photos.json', 'w...
true
934068be596a74ad4a6babcfe47850c14c0c5ad2
breimanbzx/TheWayOfImage
/pythonCrashCourse/AlienInvasion/game_stats.py
UTF-8
460
2.78125
3
[]
no_license
# 记录游戏中可能变化的统计信息 class GameStats: """跟踪游戏的统计信息""" dog_life: int score: int def __init__(self, ai_game): self.setting = ai_game.setting self.reset_stats() self.game_active = False def reset_stats(self): """记录游戏中可能变化的统计信息,并且需要在重启后清零的""" self.dog_life = self...
true
da74efac100649f7fffa2ff854ede87889a68387
gulamd/python
/compare_list.py
UTF-8
402
3.953125
4
[]
no_license
# compare lists # ==,is fruit = ['orange','pear','apple'] fruit1 = ['orange','apple','pear'] fruits = ['banana','apple','kiwi','same'] # print(fruit == fruits) false #print(fruit == fruit1) # true # but if we use 'is' print(fruit is fruit1) # false # sice both fruit and fruit1 is different object # == it will che...
true
1b5a645cb286092bee75d2316183d77374a9e2b1
Upinder3/Data-Mining-Course
/clean_data.py
UTF-8
1,291
2.75
3
[]
no_license
from pykalman import KalmanFilter import numpy as np import matplotlib.pyplot as plt from numpy import ma from scipy.fftpack import fft, ifft import pandas as pd import math from os import listdir from os.path import isfile, join import os import argparse def parse_arguments(): parser = argparse.ArgumentParser() ...
true
5c0c04c816d5be9bbb2773c05125d8a66ca0d8a2
95Li/oldboy-learning-code
/days45/test.py
UTF-8
457
3.59375
4
[]
no_license
def isOneBitCharacter(bits): """ :type bits: List[int] :rtype: bool """ if bits == [0]: return True if not bits: return False st = str(bits[0])+str(bits[1]) if st == '10' or st == '11': res = isOneBitCharacter(bits[2:len(bits)]) else: res ...
true
2bfabca17a57555fc6b2874852580680471b636d
qhl453770571/My-Python
/20190226/quote.py
UTF-8
178
2.65625
3
[]
no_license
from urllib.request import quote,unquote url='http://www.sogo.com/web?query=' word=quote('达内') print(word) print(url+word) code=unquote('%E8%BE%BE%E5%86%85') print(code)
true
9bf452a2007d2f577e5cd6b934ff08a2f838aef4
cameronkabati/pythonexample
/add2numb.py
UTF-8
60
2.734375
3
[]
no_license
def add(A,B): result=A+B print("result:",A+B)
true
403d33b5e4a2cba0f62cbe308fbf17fb7cc3d131
MoldovanAlexandruVasile/AI
/Sudoku/State.py
UTF-8
4,037
3.515625
4
[]
no_license
from math import sqrt class State: def __init__(self, matrix): self.__matrix = matrix self.__size = len(matrix) def usedInRow(self, row): for i in range(self.__size): for j in range(self.__size): if self.__matrix[row][i] == self.__matrix[row][j]: ...
true
a2e6985a81f70d843fce40eb67e4d182cbbefaa5
benchopt/benchmark_mcp
/datasets/simulated.py
UTF-8
988
2.734375
3
[]
no_license
from benchopt import BaseDataset, safe_import_context from benchopt.datasets import make_correlated_data with safe_import_context() as import_ctx: import numpy as np class Dataset(BaseDataset): name = "Simulated" # List of parameters to generate the datasets. The benchmark will consider # the cross...
true
456e42f6659847990468254eeebfdda6aecc122f
Jemmy-Hong/myPython
/pyPro/cn/py/chap7/greeter.py
UTF-8
425
3.84375
4
[]
no_license
# promp = "If you tell us who you are, we can personalize the message you see." # promp += "\nWhat is your first name? " # # name = input(promp) # print("\nHello, " + name + "!") #while循环 prompt = "\nTell me something, and I will repeat it back to you:" prompt += "\nEnter 'quit' to end the program. " message = "" wh...
true
65bc6da70bd5b90f8034cf251d73fa33fff303c0
SamuelOke/scaling-garbanzo
/pythag.py
UTF-8
259
3.8125
4
[]
no_license
import math from math import sqrt # Input print('Input lengths of shorter triangle sides:') a = float(input('Length of side a:')) b = float(input('Length of side b:')) c = sqrt(a**2 + b**2) print('The length of the Hypoteneuse is', str(round(c,2)))
true
eee31ac6b8e59c68440f221c5a26cef6fddb92f2
rodri9os/ProcImg
/opencv/plotline.py
UTF-8
203
2.921875
3
[]
no_license
''' Criar uma linha vertical no histograma ''' import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = plt.axes() x = np.linspace(0, 10, 1000) y = np.full((1000,),25) ax.plot(y,x);
true