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
7057667d381699321ff835f659c00be2a1a54c7a
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/stan_slov7/lesson06/test_mailroom4.py
UTF-8
3,164
3.140625
3
[]
no_license
#!/usr/bin/env python """ test code for the arguments lab """ import sys, os.path # you can change this import to test different versions from mailroom4 import add_donation, getdb, print_list, create_report, gen_letter, send_letters, getmydir # add_donation test def test_1(): assert "Albert Einstein" in getdb() ...
true
a0eab39d2602bd97676d6ab79fcce720d905c1b7
AlpineMeadow/M567-Class-Project
/VisualizeDailyStockPrice.py
UTF-8
4,910
2.96875
3
[]
no_license
#! /usr/bin/env python3 #A program for plotting the daily stock price. #Gather our code in a main() function. def main() : import matplotlib.pyplot as plt import numpy as np from matplotlib.backends.backend_pdf import PdfPages import math import argparse #A parser for command line options. import sys i...
true
e16f6e3aa41da3bb4731c2fc278fdbf13b0a7008
TheBoinkner/DDSM-Suite-Dynamic-Config-Script
/Selection.py
UTF-8
1,297
3.46875
3
[]
no_license
import os print("Welcome to the Modular Script Manager.") print("Please select 'y' or 'n' to add or exclude a script to the script pool.") ls = os.listdir() files = [] def pool(): for x in ls: print("Would you like to add " + x + " to the pool?") y = input() while True: ...
true
90f53741a7192574ae3b83af7575d5ddef94f4ec
saiury/mbed-cloud-sdk-python
/scripts/tpip.py
UTF-8
5,147
2.671875
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# --------------------------------------------------------------------------- # Mbed Cloud Python SDK # (C) COPYRIGHT 2017 Arm Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http...
true
604251cc56297daefb9d8680113f6dcd9d0591dd
yannickbijl/BioStringCompress
/tests/test_lib_data.py
UTF-8
1,501
2.890625
3
[]
no_license
import pytest import os from BioStringCompress import lib_data def test_translatRNAToDNA(): assert ['A', 'T', 'T', 'C', 'G'] == lib_data.translateDNAToRNA(['A', 'U', 'U', 'C', 'G']) def test_translateDNAToRNA(): assert ['A', 'U', 'U', 'C', 'G'] == lib_data.translateDNAToRNA(['A', 'T', 'T', 'C', 'G']) def te...
true
60d970714076ee674e9e169f46b4a9dc6d584de8
kguidonimartins/intro-prog-python
/cap03/list-3.5.py
UTF-8
221
3.984375
4
[]
no_license
# Operadores lógicos # O operador 'and' é binário. # Retorna 'verdadeiro' apenas quando os # dois operadores são verdadeiros print(True and True) print(True and False) print(False and True) print(False and False)
true
51073ae7389d8d01db10c152a071adf688bdd5a5
cbbing/stock
/cleastsq.py
UTF-8
2,588
3.25
3
[ "Apache-2.0" ]
permissive
# coding=utf-8 ''' 作者:Jairus Chan 程序:多项式曲线拟合算法 ''' import matplotlib.pyplot as plt import math import numpy import random #阶数为9阶 order=9 #进行曲线拟合 def getMatA(xa): matA=[] for i in range(0,order+1): matA1=[] for j in range(0,order+1): tx=0.0 for k in range(0,len(xa)): ...
true
779a93ed8776d9ec7cafc0d13fce578c1a6ac01a
dianarobot/KanjiTest
/AnalisisKanji.py
UTF-8
7,182
2.578125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: Diana Rocha Botello """ import JapaneseTokenizer import json import re class AnalisisKanji(): def __init__(self): self.mecab_wrapper = JapaneseTokenizer.MecabWrapper(dictType='ipadic') self.n5KanjiListFrecuencias = {} self.n5KanjiListWords = {} self....
true
fc077082bf9e739165449465dc3959cef3f9b2e0
efwoods/pptx2py
/scanner.py
UTF-8
24,527
2.703125
3
[]
no_license
""" ############################################################################ IMPORTS ############################################################################ """ import os from pptx import Presentation import re import sys from pprint import pprint """ #########################################################...
true
e56027d7b73320226fa634888f1e8a15d5873907
slingam00/Introduction_to_Python
/Iteration/While_Loops.py
UTF-8
369
3.796875
4
[]
no_license
incrementer = 1 while incrementer < 6: print(incrementer) incrementer = incrementer + 1 # re-assigning incrementer to one value higher # while loop breaks when incrementer equals 6 # the while loop runs 5 times and ...
true
f44040ede5f2d6a9e39e72eb4e957725743b30d8
YaelGF/POO_1719110736
/Semana_2/avion.py
UTF-8
1,054
3.546875
4
[]
no_license
class Avion: def __init__(self,pasajeros,size,color,carga_max,capacidad_tanque,tiempo_vuelo,altura,velocidad,marca): self.pasajeros = pasajeros self.size = size self.color = color self.carga_max = carga_max self.capacidad_tanque = capacidad_tanque self.tiempo_vuelo...
true
daff9f570b6a315f984761c3235e5b22726b96d4
jofas/ki-praktikum
/a1/a1_1/main.py
UTF-8
3,184
3.46875
3
[]
no_license
import random GENES = { 1 : 100, 2 : 10, 3 : -50, 4 : 200 } DONE = 200 * 8 def random_gene(): return random.randint(1,4) class Individuum: def __init__(self,genes): self.genes = genes self.fitness = float(sum(GENES[gene] \ for gene in self.genes)) self.wei...
true
032d11d2b5bbb69181465288fcbe789b683013fb
JensPfeifle/sph-nearest-neighbor
/scripts/plot_2d.py
UTF-8
4,065
3.046875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from typing import List, Tuple import config as CONF import sys from matplotlib.gridspec import GridSpec """ Reads datapts from the file data.pts and plots them in 2D plots. This is useful for viewing the particle arangement from different directions. It is also quite...
true
37dbaa60b4331e3e2467287e2d9de5f1dda476fa
IsaacTips/AIFFEL
/Fundamentals/F28_Flask/flask_app/pyproject/app_data.py
UTF-8
1,490
2.640625
3
[]
no_license
from flask import Flask, render_template, request import os import sqlite3 import pandas as pd app = Flask(__name__) ''' DB 함수 ''' def get_db(db_name): return sqlite3.connect(db_name) def sql_command(conn, command): try : conn.execute(command) conn.commit() command = command.lower(...
true
7afb416f74b886c712119beaa400591deee7b931
sl8r000/insight
/models/naive_bayes_body.py
UTF-8
1,701
2.734375
3
[]
no_license
from model import Model import nltk from stack_exchange import text_processing as tp class NaiveBayesBody(Model): def train(self, dataset): self._user_models = dict() for user_id in dataset: training_data = [] for training_pair in dataset[user_id]: question,...
true
40eac768f6d197b5cd0997cafc6eebe0f6d4bc7c
blxlrsmb/TrendMicro2014
/code/plot.py
UTF-8
1,403
2.765625
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # $File: plot.py # $Date: Mon Aug 18 07:35:00 2014 +0800 # $Author: Xinyu Zhou <zxytim[at]gmail[dot]com> import numpy import matplotlib.pyplot as plt from collections import Counter from IPython import embed def pair2data(data_c0, data_c1): data_c0, data_c1 = map(la...
true
9e45bb2e36c8c15f3b386508a02333ec12770fe2
clebsjr/projeto_agenda
/model.py
UTF-8
1,580
2.6875
3
[]
no_license
from connection import connection_db from contextlib import closing model_table = 'contato' def insert(contato): with closing(connection_db()) as conn: with closing(conn.cursor()) as c: sql = f""" INSERT INTO {model_table} (nome, email, telefone) VALUES...
true
6d263a63dcb16c5079f1d6dcaf8db90450433007
wu3976/MyPython
/DictionaryDemo.py
UTF-8
465
3.734375
4
[]
no_license
#Key value pair #create a dictionary monthConversions={ "Jan": "January", #associate abbreviation "Jan" to value "January" "Feb": "Feburary", #the key must be unique within one list } print(monthConversions["Jan"]) #Inside the [], type in one key, output the value. If key is invalid, throws error print(monthC...
true
023bc7174cd005979fb41ae541b736fc7a79044e
tjatn304905/algorithm
/SWEA/1767_프로세서연결하기/sol1.py
UTF-8
2,988
3.046875
3
[]
no_license
import sys sys.stdin = open('sample_input.txt') def solution(lexi): cores = search(lexi) result = 0 for core in cores: i = core[1] j = core[2] min_wire = 12 # 가장 짧은 길 찾기 # 상 for test in range(i-1, -1, -1): if lexi[test][j] != 0: ...
true
11b9bfab7935fa03582d2afda1d7384ee5906efc
goldang01/Python_Play
/streamlit/streamlit_sample/naver_crawler.py
UTF-8
2,216
2.609375
3
[ "MIT" ]
permissive
from urllib.request import urlopen from bs4 import BeautifulSoup import re import pandas as pd from datetime import datetime, timedelta # https://search.shopping.naver.com/best100v2/detail.nhn?catId=50000190 category_df = pd.DataFrame({ 'category' : ['스킨케어', '베이스메이크업', '색조메이크업', '클렌징', '마스크/팩'...
true
42c1cde358f8eaceff574606902c8eba526dc337
magedu-pythons/python-19
/P19054-yangxingxing/week4/classwork.py
UTF-8
894
3.8125
4
[]
no_license
#!/usr/bin/env python # # 1.1 杨辉三角 myLine = 21 myList = [[1], [1, 1]] for i in range(2, myLine): newList = [1] * (i + 1) for y in range(1, i): newList[y] = myList[i-1][y-1] + myList[i-1][y] myList.append(newList) print(myList) # 1.2 对称计算 myLine = 21 myList = [[1], [1, 1]] for line in range(2, myLin...
true
11208898b26cede2f74d5f21d71701737f68c336
JJace421/Python-workbook-exercises
/Exercise 034.py
UTF-8
96
3.671875
4
[]
no_license
num = int(input("Insert number: ")) % 2 if num == 0: print("even") else: print("odd")
true
be26ce090c5227cd69cdbdafc7b1f837cd9f4023
shweta257/nlp-finalEval
/coreference-TeamChaos/clustering.py
UTF-8
2,154
2.84375
3
[]
no_license
import sys class Cluster(): def __init__(self,radius, distanceMatrix): # self.distanceMatrix = [[ 0, 3, 5 ,6, 7],[3, 0, 2, 1, 8 ],[6, 2 , 0, 100,10],[5,1,100,0,7],[7,8,10,7,0]] self.distanceMatrix = distanceMatrix # print self.distanceMatrix self.clusterSetList = [set([i]) for i i...
true
277f5d6153d147a918f400e89a7a647cf050684f
shwina/libgpuarray
/pygpu/parser.py
UTF-8
8,701
2.78125
3
[ "ISC" ]
permissive
import re import tokenize try: from cStringIO import StringIO except ImportError: from StringIO import StringIO class Compiler(object): def __init__(self): self.symbol_table = {} self.setup_syntax() self.reset() def reset(self): self.token = None self.next = Non...
true
0780e97b148a30d1d6168149e807af4459dca28d
dkisai/codewars
/lastdigit.py
UTF-8
297
3.203125
3
[]
no_license
def last_digit(n1, n2): if n2 == 0: return 1 seq = [[0], [1], [2, 4, 8, 6], [3, 9, 7, 1], [4, 6], [5], [6], [7, 9, 3, 1], [8, 4, 2, 6], [9, 1]] l_digit = int(str(n1)[-1]) position = n2 % len(seq[l_digit]) return seq[l_digit][position - 1] print(last_digit(99 , 55))
true
45888ccddd166e74be77fd1da23f3c8646c853b6
TauaneBianquini/programinhas
/bissexto.py
UTF-8
406
3.25
3
[]
no_license
bissexto = ([1988, 1992, 1996, 2000, 2004, 2008, 2012, 2016, 2020]) naobissexto = ([1989, 1990, 1991, 1993, 1995, 1997, 1998, 1999, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010, 2011, 2013, 2014, 2015, 2017, 2018, 2019]) ano = int(input('Insira um ano para saber se é bissexto, de 1988 a 2020: ')) if (ano in biss...
true
56b939b26f953433650ac8c5a6413f0ed690090e
LiorMoshe/Werewolf-Anac19
/agents/information_processing/lie_detector.py
UTF-8
3,913
3.4375
3
[]
no_license
from agents.game_roles import * from agents.tasks.admitted_role_task import AdmittedRoleTask from agents.strategies.player_evaluation import PlayerEvaluation # Importance of the task of two lying agents detected. ADMITTED_ROLE_IMPORTANCE = 1.0 # Importance of the task when one or more agents admitted to have my role....
true
41cc98972b9d19b59081b1ab68a79fe20c40fee2
karolina139/Arkanoid
/extensions.py
UTF-8
531
3.25
3
[]
no_license
import pygame class Extensions(pygame.sprite.Sprite): """Klasa tworząca rozszerzenia.""" def __init__(self, posx, posy, extension): # Inicjalizuj klasę bazową Sprite pygame.sprite.Sprite.__init__(self) self.image = pygame.image.load(extension) self.image = pygame.transform.sc...
true
1cd8c9d3736911acd9f73e5beb6ca38c79fae3e0
Federvgh/PythonClassesSeminar
/example_functions.py
UTF-8
1,399
3.140625
3
[]
no_license
from flask_pymongo import ObjectId from app import mongo # Function for Obtaining all books def obtain_all_books(): return list(mongo.db.Books.find()) # Function for Adding a book def insert_one_book(book_form): try: new_book = { "title": book_form.get('title'), ...
true
b61d24b2ecbf9f3469928760af2bd2e9702dfd64
NoahBennett123/Pac-Man
/ghost3.py
UTF-8
1,003
2.90625
3
[]
no_license
import pygame, sys, time, random from pygame.locals import * ghost3 = pygame.image.load('pghost.png') ghost3 = pygame.transform.scale(ghost3, (35,35)) class ghostthree(pygame.sprite.Sprite): def __init__(self): super().__init__() self.x = 30 self.y = 30 self.image = ghost3 ...
true
aa4c6c32704f59be383d0b1ef480270a82d97b93
sudeep0901/python
/stringops.py
UTF-8
1,048
3.5625
4
[ "MIT" ]
permissive
string = "I am sudeep patel " split = string.split(',') print(split) string = "I am sudeep patel " split = string.split(' ', maxsplit=-11) # -ve max split does not impact string print(split) input_string = """Name,Phone,Address Mike Smith,15554218841,123 Nice St, Roy, NM, USA Anita Hernandez,15557789941,425 ...
true
9b59bf78f512b34a115baba0a82a04dec2442068
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/abc122/C/4968364.py
UTF-8
259
3.0625
3
[]
no_license
n, q = map(int, input().split()) s = input() c = [0] for i in range(len(s)-1): if s[i] == "A" and s[i+1] == "C": c.append(c[-1]+1) else: c.append(c[-1]) for i in range(q): l, r = map(int, input().split()) print(c[r-1] - c[l-1])
true
80dbe94cfee266b1eee1ba8752cd19c815e7f539
robinklaassen/advent-of-code-2019
/day20/part1.py
UTF-8
627
3.046875
3
[]
no_license
from typing import Tuple import networkx as nx from day20.parse_input import parse_input def get_node_by_unique_mark(graph: nx.Graph, unique_mark: str) -> Tuple[int, int]: nodes = [node for node, mark in graph.nodes(data='mark') if mark == unique_mark] assert len(nodes) == 1 return nodes[0] def main()...
true
295d590851da04cee8799223e6cb20b33f2e9614
Alpine-DAV/hmc2017
/mpiml/DataReader/FeatureDataReader.py
UTF-8
12,552
2.8125
3
[]
no_license
import numpy as np import sys, os, re class FeatureDataReader(object): """Reader for simulation data related to machine learning features Attributes: dataDir: data directory numParts: # of partitions in mesh zoneOffsets: a map that takes zone id and returns partition and ...
true
5fb0216f16c39f65739cdadc01bea755ebc21e68
duijf/breaking
/breaking/bucket.py
UTF-8
8,951
3.8125
4
[]
no_license
import math from dataclasses import dataclass, field from typing import Tuple from breaking.clock import Clock, MonotonicClock @dataclass class TokenBucket: """ Impose an upper bound on a number of events over a time interval. Use cases: - Rate limiting the number of requests for clients. - C...
true
90b513f6bf7d50e86ef521ab340466e9296fb7d1
scoutiii/PYTHON-testTurtle
/3dFirstDrawings/cubeFunctions.py
UTF-8
7,873
3.09375
3
[]
no_license
# this is where I am storing my functions for drawing cubes import math import pointPlanePairs as classes import vectorFunctions as vecFunc # holds the coordinate points for each side of a cube cubeSize = 100 cubeGap = 10 squareTop = [[-cubeSize, -cubeSize, (cubeSize + cubeGap)], [cubeSize, -cubeSize, (cu...
true
a5e4a2adfb2c4d14a7016dbc1241eecde93251ce
albertklee/SPARKZumo
/utils/graph.py
UTF-8
4,663
3.109375
3
[ "MIT" ]
permissive
#!/usr/bin/env python import math from shapely.geometry import Point from shapely.geometry.polygon import Polygon class graph: __shapes = { "Online": { "points": [], "color": "#ff00ff" }, "BranchLeft": { "points": [], "color": "#0000ff" ...
true
429a292a77eaf0e402261b757060fd2d8cc4f2df
AdamZhouSE/pythonHomework
/Code/CodeRecords/2727/60648/257967.py
UTF-8
960
3.203125
3
[]
no_license
#第一行为用例数,第二行为🐀的初识位置,第三行为洞的位置 #老鼠放一个数组里,洞放一个数组里,还有一个标记洞是否已用的数组 #算法?:好法子:先排序,然后从左边开始以老鼠为单位搜索最近的洞(第一个洞优先考虑左边)并把洞标记为已用1,计算总时间 nn=input() nn=int(nn) for i in range(nn): n=input() n=int(n) lsr=input().split(' ') lsr=[int(lsr[i]) for i in range(n)] lsr.sort() lsh=input().split(' ') lsh=[int(lsh[i...
true
e14b1cc05c8b7aa7cd1c49a50cc8e3acfa3a64b7
Anym00se/Linnapuolustus
/main.py
UTF-8
3,594
2.765625
3
[]
no_license
''' Created on 21.3.2017 @author: Mattias ''' import sys import time from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import * from gui import * from castle import * from towers import * from enemies import * from time import * from file_reader import * #-------------------- Main -----------...
true
cbb06ac57f5fb7d13930850b1640b0e539fc38be
AlexeyRadchenko/LostFilmBot
/parser/parser.py
UTF-8
2,376
2.5625
3
[]
no_license
from requests_html import HTMLSession from re import search import json from time import sleep class LostFilmParser: source_url = 'https://www.lostfilm.tv/' tv_shows_list_part_url = 'https://www.lostfilm.tv/ajaxik.php' part_step = 10 def __init__(self): self.session = HTMLSession() se...
true
b8b45425fb9211af47804c01ced6163147bf5bf8
bitnahian/UNIHACK
/scripts/clean.py
UTF-8
1,404
2.59375
3
[ "MIT" ]
permissive
import pandas as pd df = pd.read_csv('../data/cleaned_data.csv') df_speed = df.loc[df['SPEED_IND'] == 'Y'] df_red = df.loc[df['RED_LIGHT_CAMERA_IND'] == 'Y'] df_speed = df_speed[['LOCATION_CODE', 'LOCATION_DETAILS', 'CAMERA_TYPE','SCHOOL_ZONE_IND', 'SPEED_IND']] df_red = df_red[['LOCATION_CODE', 'LOCATION_DETAILS', ...
true
a7e2c772de5454c7e8b2f5a537c3c25e77383eae
dothedung1982/ds-program-2
/PycharmProjects/bt_for_stmt.py
UTF-8
211
3.453125
3
[]
no_license
# for item in sequence: # for_suite # sử dụng range(start, end) cho 1 giá trị vòng lặp cố định my_list = ['hello', 'world'] for(i, item) in enumerate(my_list): print('{}:{}'.format(i, item))
true
ed649e3d5226e10d6c9e9195ab7cad9001eaabfb
qihuilyu/P2T
/MC simulation/mcdose/mcdose/dataloader.py
UTF-8
9,850
2.515625
3
[ "MIT" ]
permissive
import logging import ast import os import struct import sys import math import random import time from os.path import join as pjoin from collections import deque, namedtuple import numpy as np import tensorflow as tf from tensorflow import keras from .timer import Timer logger = logging.getLogger("MCDose."+__name__...
true
730948554cce5584ae992abdfd22b6eaf08f0f4d
TheoKanning/GridworldRlDemo
/runner.py
UTF-8
1,647
3.609375
4
[ "MIT" ]
permissive
"""Reinforcement learning experiment runner. This class connecst the agent and environment by passing actions, states, and rewards back and for for a set number of iterations. """ class Runner: def __init__(self, agent, environment, num_iterations=100): """Args: a...
true
5234a8bfa7d2469bb07cfdf9c94e517c4248b95d
sayantansatpati/ml
/ds-challenges/delivery-times/delivery-app/prediction.py
UTF-8
5,515
3
3
[]
no_license
import pandas as pd import numpy as np from joblib import load from featurestore import FeatureStore class Prediction(object): def __init__(self, data_to_predict_json): # Load Feature Store (In a real world, this would be a service) self.fs = FeatureStore() # Load Model (Using Model 1) ...
true
96c4b13ce8f1d7ffabc26f25303f8a5688789034
enumag/match_higurashi_scripts
/match_higurashi_sprites.py
UTF-8
3,832
2.84375
3
[]
no_license
import json import argparse #these regexes are slightly different as DrawBust* has one argument before the bust name, ModDraw* has two import sys from match_statistics import MatchStatistics from match_statistics_to_csv import convertMatchingToCSV from matching_core import get_matching_script_paths_between_folders, u...
true
a66b5b4b6603eebaa058eed8e8576c780a9a27f5
sqarrt/Ingine
/ingine/examples/seabattle.py
UTF-8
3,134
2.578125
3
[ "MIT" ]
permissive
import numpy import os os.environ['KERAS_BACKEND'] = 'theano' from keras.layers import Dense import csv from ingine import ann # Устанавливаем seed для повторяемости результатов numpy.random.seed(151681) def load_data(): """ Функция получения данных из data.py :return: list(2) of lists(2) """ ...
true
bf5e0f06c6b0a5ce3f55a12890d7bc2a860e5e4c
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_199/216.py
UTF-8
945
3.28125
3
[]
no_license
# raw_input() reads a string with a line of input, stripping the '\n' (newline) at the end. # This is all you need for most Google Code Jam problems. f = open("A-large.in",'r') g = open("Answer.txt", 'w') t = int(f.readline()) # read a line with a single integer for i in range(1, t + 1): s, k = f.readl...
true
b7b6891513d45893af57555af5ef5ee2ab20bc4d
ModelDBRepository/234992
/graphs/traces_plots.py
UTF-8
1,912
3
3
[]
no_license
import sys, os sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),os.path.pardir)) from graphs.my_graph import set_plot def set_scale_and_annotation(ax, xunit='s', yunit='mV', xscale=None, yscale=None): x1, x2 = ax.get_xlim() y1, y2...
true
9bd8e3c8a27137389897587fe884291f33e0435a
lanpartis/LeetCodePractice
/13.py
UTF-8
365
3.21875
3
[]
no_license
class Solution: def romanToInt(self, s): """ :type s: str :rtype: int """ v ={'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000} cand=list() for i in s: cand.append(v[i]) for i in range(len(s)-1): if cand[i]<cand[i+1]: ...
true
2ad55eeaba81d1cf232ee3cc848e85fbff3fa8aa
nckz/origGPISite
/training/solutions/ex2/GPI/e4_ArrayBounds_GPI.py
UTF-8
1,249
3.28125
3
[]
no_license
# Author: Nick Zwart # Date: 2013oct18 # Exercise 4: SOLN # Compile and run the cpp node. Observe how R2 arrays are created and # translated from numpy arrays. Add an two more outputs to the PyMOD # that generate arrays using the R2 ArrayBounds object and one that # generates an ArrayBounds objec...
true
a211d418868d5dfeace440754bb19d9657a09b24
charsyam/andong_edu
/oss/main.py
UTF-8
805
2.9375
3
[ "MIT" ]
permissive
from flask import Flask from andong_edu import AndongEdu from edu_exceptions import * app = Flask(__name__) edu = AndongEdu() @app.route('/hello/<name>') def hello_world(name): return edu.hello(name) @app.route('/ping') def ping(): return edu.ping() @app.route('/add/<num1>/<num2>') def add(num1, num2): ...
true
b68c19e7c78c835c99cde59d1b97d97458647f67
raydrawc/python
/src/program_contrl_homework.py
UTF-8
2,460
3.90625
4
[]
no_license
# %% [markdown] # 以下条件测试的结果是 # %% # 条件判断假: None 0/0.0 False 空字典{} 空元组() 空列表[] 空字符串"" '' # 空的 d = {} # d = 0.0 if d: print("非空") else: print("空的") # %% [markdown] # 判断优先级 () > not > and > or # True True or False and False True or (False and False) # %% [markdown] # in 判断是否是子元素 # False # True foods = ["bread", ...
true
2bbddfcbf76ca249391f9c615006b7352ee0f17f
Aryadipura/readtextextension
/Read_Text/python/pyttsx_read_text_file.py
UTF-8
4,814
2.90625
3
[]
no_license
#!/usr/bin/env python # -*- coding: UTF-8-*- ''' Pyttsx ====== Read a plain text file in Windows using the Python `pyttsx` speech package. + Designed for reading text aloud with the Windows SAPI5 system. + For other systems, read the [documentation](https://github.com/parente/pyttsx) for `pyttsx`. Wi...
true
48eebff48968496a5dc7b99c8b87f2e897a65741
adusa1019/nlp100
/nlp24.py
UTF-8
376
2.515625
3
[]
no_license
#!/usr/bin/env python # coding=utf-8 import re from nlp20 import JaWiki def get_media_file_lines(text): return [ re.search(r'(ファイル|file):(.*?)\|', line).group(2) for line in text.split('\n') if re.search(r'(ファイル|file):(.*?)\|', line) ] if __name__ == '__main__': print(get_media_file_lin...
true
0c1954c99e488c3ea38fa731617e656b43acfd12
mohamed265/Online-Judge-Python-Solution
/CodeForces/A_Valera_and_Plates.py
UTF-8
361
3.1875
3
[]
no_license
''' Created on ٠٩‏/١٢‏/٢٠١٤ @author: mohamed265 ''' t = input().split() m = int(t[1]) k = int(t[2]) s = input() p = s.count('1') b = s.count('2') m -= p k -= b #print(m , k) if m > 0: k += m if k < 0: print(abs(k)) else: print(0) elif k >= 0: print(abs(m)) else: ...
true
9c08ffa783ac92de2e1699929307eec7f80faeb7
pwinslow/MoMentum
/MoMentumApp/fetcher.py
UTF-8
2,006
2.6875
3
[ "MIT" ]
permissive
import sys import json import requests from time import sleep from bs4 import BeautifulSoup from constants import api_key def get_response(url): r = requests.request("GET", url) # If status code is 429, give api a break while r.status_code == 429: sleep(2) r = requests.request("GET", url) # If there i...
true
1362ea15af2d74ac3a8d093633b3a48b9c7724f3
JamesPerreault/MyGourmetRecipes
/scripts/gourmet-show-images.py
UTF-8
690
2.65625
3
[]
no_license
#!/usr/bin/python3 import SqliteDb from io import BytesIO from PIL import Image, UnidentifiedImageError import argparse parser = argparse.ArgumentParser(description='Show images from Gourmet Sqlite db') parser.add_argument('ids', type=int, nargs='+', help='id(s) of recipes to show') parser.add_arg...
true
b1687dc9071597581db2f9990b65da3a99ab3a04
lucaslzl/sumotripscleaner
/cleaner.py
UTF-8
3,332
3.4375
3
[ "Apache-2.0" ]
permissive
import os import random import math from bs4 import BeautifulSoup """ Converts duarouter route files to trip files. Content: - Read duarouter xml route files - Creates shuffled lists of routes - Saves it as trips """ class Cleaner: """ Init method to configure parameters Please edit it """ def __init__...
true
d1077a0c02989f5dbf28395cedf629f9b7a25c43
aaa29022/ML2017
/hw3/plot_chart.py
UTF-8
931
2.734375
3
[]
no_license
import sys import numpy as np import matplotlib.pyplot as plt def main(): result = sys.argv[1] chart_title = sys.argv[2] data = np.genfromtxt(result, delimiter = ',') x = np.arange(1, data.shape[0] + 1) plt.plot(x, data[:, 0], label = 'Train') plt.plot(x, data[:, 2], label = 'Validation') ...
true
406077b82c505c4b7e492c109b0a49fe5dfbec7f
RyanYin04/LeetCode
/24.swap-nodes-in-pairs.py
UTF-8
1,138
3.40625
3
[]
no_license
# # @lc app=leetcode id=24 lang=python3 # # [24] Swap Nodes in Pairs # # @lc code=start # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # Method I: Double pointer: # def swapPairs(self, head: ListNode) -> Li...
true
0578917146fef9232d039791d2e8780e7f6cbe92
LeiEarn/server
/swagger_server/modules/accessControlSystem.py
UTF-8
2,957
2.59375
3
[]
no_license
# -*- coding: utf-8 -*- from flask import g import threading import functools """ 访问控制 """ class AccessControlSystem(object): _instance_lock = threading.Lock() app = None def __new__(cls, *args, **kwargs): if not hasattr(AccessControlSystem, "_instance"): with AccessControlSystem._in...
true
a3605d616a9a6b6cbe265047fc8af3e9bda30744
knowledge4free/2020
/016-ssti/src/app.py
UTF-8
1,374
2.578125
3
[]
no_license
import random from flask import Flask, render_template_string, render_template, request import os import emojis app = Flask(__name__) app.config['SECRET_KEY'] = 'Leer alles over Software Security bij Arjen (follow @credmp) at https://www.novi.nl' def magic(flag, key): return ''.join(chr(x ^ ord(flag[x]) ...
true
3d3c8532e8e0e4b9768578d01049b85d688b6b14
cwohlfeil/scripts
/python/examples/search_combine_pdfs.py
UTF-8
841
3.046875
3
[]
no_license
#! python3 # search_combine_pdfs.py - searches for and combines all the PDFs in the # current working directory into into a single PDF. import PyPDF2 import os # Get all the PDF filenames pdfFiles = [] for filename in os.listdir('.'): if filename.endswith('.pdf'): pdfFiles.append(filename) pdfFiles.sort(...
true
11d7f96ee45f00d9fa9f4ee36614586cd1a7edef
Nirperm/Design-Pattern
/Composite/entry.py
UTF-8
521
2.796875
3
[]
no_license
from abc import ABCMeta, abstractmethod from file_treatment_exception import FileTreatmentException class Entry(metaclass=ABCMeta): @abstractmethod def get_name(self): pass @abstractmethod def get_size(self): pass def print_list(self): self._print_list('') def _prin...
true
dfc20c740d6671a5a2d4a2ca939b9645720770d3
Xandervm/Project-game
/Gamefull/zysettings.py
UTF-8
435
2.5625
3
[]
no_license
import pygame import random from os import path FONT_NAME = "arial" WIDTH = 480 HEIGHT = 600 FPS = 60 img_dir = path.join(path.dirname(__file__), 'img') pygame.init() pygame.mixer.init() screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("Gimma") clock = pygame.time.Clock() # ...
true
50c7d16fa5ecf1b2de2eeab10e78e5d6c821d065
OmnesRes/infarction
/figures/figure_1/figure_1.py
UTF-8
2,137
2.859375
3
[ "MIT" ]
permissive
import numpy as np import pylab as plt from matplotlib.patches import Ellipse fig=plt.figure(figsize=(22.62372, 12)) ax = fig.add_subplot(111) fig.subplots_adjust(bottom=.2) font1={'family':'Arial', 'color' : 'b', 'weight' : 'normal', 'size' : 30, } font2={'family':...
true
b85879c61ecfd1c05a008fa30526a849b7aeff23
nadavo/MEMM-POS-Tagger
/MEMM.py
UTF-8
16,380
2.71875
3
[ "MIT" ]
permissive
import pickle import numpy as np from scipy.optimize import fmin_l_bfgs_b from utils import split_calculation_to_threads, HistoryTuple, Timer from Viterbi import ViterbiAlgorithm from collections import defaultdict, Counter from tabulate import tabulate class MEMM: """Class to implement an MEMM model as learnt in...
true
1f549e3a29ab7e71fd0e689ce3bee823836393d3
chris-jantzen/AI_AStar_And_BFS_Search
/search.py
UTF-8
1,964
3.296875
3
[]
no_license
from priority_queue import PriorityQueue class Search: def __init__(self, goal_state, search_type="bfs"): self.goal_state = goal_state self.open_list = PriorityQueue() self.closed_list = [] self.id_count = 1 self._open_list_pop_count = 0 self._open_list_add_count = ...
true
90bede9c858107f345abcd27be8aedebf5621d07
benilton02/Curso_de_Python
/Comandos_Sequenciais/1020.py
UTF-8
138
3.234375
3
[]
no_license
idade=int(input()) ano=idade//365 aux=idade%365 mes=aux//30 aux=aux%30 print(ano, "ano(s)") print(mes,"mes(es)") print(aux, "dia(s)")
true
ad5bbed49c651365dfca2d5d669bd408f34480ce
visheshkumar450/RealEstatePricePredictor
/Real Estate - web/main.py
UTF-8
2,873
2.953125
3
[]
no_license
from flask import Flask from flask import render_template from flask import request app=Flask(__name__) #model import pandas as pd import numpy as np housing = pd.read_csv("data.csv") # Train, Test, Splitting from sklearn.model_selection import train_test_split train_set, test_set = train_test_split(hous...
true
f5b5c23e413f699c50eac3ae92ec139b4ce5f304
sm-jalali-f/ai-snake
/GameMap.py
UTF-8
9,075
3.15625
3
[]
no_license
__author__ = 'jalali' import math from enum import Enum class PositionType(Enum): EMPTY = 0 WALL = 1 SNAKE = 2 FOOD = 3 class GameMap: def __init__(self, matrix, parent, snake_head_pos, default_snake_pos,which_h): self.which_h =which_h self.parent = parent ...
true
72fa7a8d022353bb49a2fc4637b8744a93a04e8e
Ouranosinc/malleefowl
/malleefowl/pe/reduce.py
UTF-8
5,483
2.515625
3
[ "Apache-2.0" ]
permissive
import sys import json from pywps import ComplexOutput from pywps import LiteralInput, ComplexInput, BoundingBoxInput from pywps import Format, get_format from owslib.wps import Input from owslib.wps import Output from malleefowl.utils import DataWrapper, auto_list from malleefowl.pe.task import TaskPE from malleefow...
true
38a03207298bb20846e0de0fd2f40de86693179f
sk24085/Interview-Questions
/easy/valid-parenthesis.py
UTF-8
805
4.03125
4
[]
no_license
''' Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Example 1: Input: s = "()" Output: true Example 2: In...
true
e3d817ad709e3ef46aabafbb2c9496238f38e2e3
mnubo/kubernetes-py
/kubernetes_py/models/v1/NFSVolumeSource.py
UTF-8
2,435
2.609375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This file is subject to the terms and conditions defined in # file 'LICENSE.md', which is part of this source code package. # from kubernetes_py.utils import is_valid_string, filter_model class NFSVolumeSource(object): """ http://kubernetes.io/docs/api-refer...
true
588a50511d43c9f21437c6f28079f049943153c8
Coder481/Data_Structure_And_Algorithm
/Recursion/First_N_numbers.py
UTF-8
114
3.15625
3
[]
no_license
def f1(n): if n==1: print(n) a=f1(n-1)+1 print(a) ipt=int(input('Enter value of N:')) f1(ipt)
true
4dc4ce98990e2287b4b192dd03c2a3aec9027318
Herky1818/PyCh
/PyCh/Modules.py
UTF-8
60
2.703125
3
[]
no_license
from Calc import * a=10 b=23 print(add(a,b)) print(mul(a,b))
true
8aedc72bca828f803975b74f8fadeb23eec027c3
r12547414/ie_Projects
/HM_Employment_class_02/Multitask_length.py
UTF-8
743
3.234375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created by iFantastic on 2019/4/28 import time import threading def sing(): """唱歌5秒钟""" for i in range(3): print("----正在唱:菊花茶----%d"%i) time.sleep(1) def dance(): """跳舞 5秒钟""" for i in range(3): print("----正在跳舞----%d"%i) ...
true
5048a27234ddf606f3f006098136902935345f64
iHoHyeon/BOJ
/CLASS3/5430.py
UTF-8
639
2.734375
3
[]
no_license
import sys T = int(sys.stdin.readline()) for _ in range(T): p = sys.stdin.readline() n = int(sys.stdin.readline()) x = sys.stdin.readline().rstrip()[1:-1].split(',') if n == 0: [] R, L = 0, 0 check = True for i in p: if i == "R": check = not chec...
true
4bcb522f7f9dff4303fb29330ac3aa732f5f3ac3
simran-grewal/Graph-Algorithms
/Graph Theory/DfsUsingAdjList.py
UTF-8
372
3.609375
4
[]
no_license
from Graph import Graph def dfs(visited, node, graph): if node in visited:return visited.append(node) for neighbour in graph[node]: dfs(visited, neighbour, graph) G = Graph() G.addItem('A', 'B') G.addItem('B', 'C') G.addItem('B', 'E') G.addItem('C', 'D') G.addItem('E', 'F') G.printGraph() visite...
true
d5d7c943e459acfdb004051df8b3317cb84ae982
peperon/PySnake
/src/level.py
UTF-8
1,354
3.34375
3
[]
no_license
import pygame import configparser class Level(object): _TILE_WIDTH = 32 _TILE_HEIGHT = 32 def __init__(self, level_file="level1.map"): self._load_level(level_file) self.width = self.width_map * self._TILE_WIDTH self.height = self.height_map * self._TILE_HEIGHT def render(sel...
true
700ddcf0c299f04f84442d5d8bc57b3aa9b042d0
krnets/codewars-practice
/6kyu/Regex pattern to check if string has all characters/index.py
UTF-8
1,184
4.28125
4
[]
no_license
""" 6kyu - regex pattern to check if string has all characters Your function should return a valid regular expression. This is a pattern which is normally used to match parts of a string. In this case will be used to check if all the characters given in the input appear in a string. Input: Non empty string of uniqu...
true
bcaabe30738e4641084d691c4fa5797787f3f99c
Omega094/lc_practice
/count_complete_tree_nodes/CountTreeNodes.py
UTF-8
1,496
3.109375
3
[]
no_license
import sys sys.path.append("/Users/jinzhao/leetcode/") from leetcode.common import * #We already know that this is a complete tree, #Therefore if we simply traverse the whole tree, #we will be getting a timeout. class Solution(object): #Complexity is nlogn ? def countNodes(self, root): """ ...
true
52212ae0ce3e7607714e6e2a083b4f4381455605
YouReTs/SuperCoinbot
/utils/messages.py
UTF-8
37,681
2.515625
3
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
import time import math import datetime from data.config import * from utils.sqlite import get_user, get_num_vouch, get_sum_dep, get_sum_pay, get_sum_vouch, clear_firstname updatemsg = 'Главное меню' voucher_nan = '😞 Чек не найден.' voucher_bad = 'Походу вы не успели и чек превратился в 🎃 🎃 🎃' banmsg = f'🖕 Вы не...
true
2e80b24e0d9b577fc35d7faa3f02526fac08f611
EDowds98/dailyProgrammingReddit
/talkingClock.py
UTF-8
473
3.1875
3
[]
no_license
#! python3 #link to challenge: https://www.reddit.com/r/dailyprogrammer/comments/6jr76h/20170627_challenge_321_easy_talking_clock/?ref=share&ref_source=link from num2words import num2words from time import strftime hours = [] hour = int(strftime("%I")) minute = int(strftime("%M")) amPm = strftime("%p") if int(min...
true
7587652b4866eb4492596b0887aacd3973248231
hazelv/Python
/newProco25.py
UTF-8
332
3.390625
3
[]
no_license
#finding the volume of a sphere def main(): enter= int(raw_input()) pi= float(22.0/7) master= [] for i in range (0,enter): i=int(raw_input()) volume= (4.0/3) * ((pi) * (i**3)) master.append(volume) for i in range (0, len(master)): print int(master[i]) main...
true
b5c49f733384f75af188c7f39ab8babf4d3ecbb9
jenbu/simulering
/pygameTest/functions.py
UTF-8
648
2.625
3
[]
no_license
time = 0 timeStep = 0.001 #maa vere liten nok slik at ikke Fd blir crazy stort timeEnd = 20 J = 2 drumRadius = 40 pRadius = 0.8#i m theta = 0 thetaDot = 0 y = 200 yDot = 0 m = 100 k = 10**6 b = 10**3 g = 9.81 def calculation(y_pos, yDot, theta, thetaDot, time): y = y_pos if y < 0: Fd = abs(y)*k + (-y...
true
ef0de5b4e09099445baf40260a8e5f99c8005e13
modriczhou/kyber
/kyber/data_utils/word2vec.py
UTF-8
1,065
2.578125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/8/18 09:38 # @Author : Yuansheng Zhou # @Site : # @File : word2vec.py # @Software: PyCharm from gensim.models import Word2Vec from gensim.models.word2vec import LineSentence from gensim.models import KeyedVectors from kyber.config import Config im...
true
35e21656245385fee7533c9c7e158b2316b8a001
EduardAlex/BiHex
/bihexbase/bihex.py
UTF-8
693
3.1875
3
[ "MIT" ]
permissive
class Bihex: def __init__(self, number): self.number = 0 if number[0] == "d": exec("self.number = int(number[1:])") self.base = "dec" if number[0] == "b": exec("self.number = int(" + "'0b'" + "number[1:])") self.base = "bin" if number[0] == "x": exec("self.number = int(" + "'0x'" + "number[1:])"...
true
8c4cb35b3be94ab7659a86ba4680346f64c9c1bb
Thalaivar/roslab
/image_processing.py
UTF-8
1,032
2.703125
3
[]
no_license
import cv2 import imutils import numpy as np from copy import deepcopy def image_processing(image): # convert black squares to white THRESH = 40 idx = np.where((image <= [THRESH, THRESH, THRESH]).all(axis=2)) thresh_image = deepcopy(image) thresh_image[idx] = [255, 255, 255] # threshold image to make bgd black...
true
bfb4fbb131150e4674f8d28a3311275218f51e37
Manonox/Spaceshifter
/utils/utils.py
UTF-8
1,425
2.640625
3
[]
no_license
from utils.vector import vector as vec import math def listget(l, i, n=None): try: return l[int(i)] except IndexError: return n def pullValues(i, k, args, kwargs, n): if listget(args, i) is not None: return listget(args, i) else: return (kwargs.get(str(k), None) or n) ...
true
ce72b9bd93f1da50ae340ea1b88e21c54f18c75d
ncullen93/pytorch
/tools/cwrap/plugins/__init__.py
UTF-8
17,228
3.34375
3
[ "BSD-2-Clause" ]
permissive
class CWrapPlugin(object): """Base class from which all cwrap plugins should inherit. Override any of the following methods to implement the desired wrapping behavior. """ def initialize(self, cwrap): """Initialize the Plugin class prior to calling any other functions. It is used...
true
7e34b481d5a181e96772c7825d0b7c78f900b0d3
akevinblackwell/Raspberry-Pi-Class-2017
/AVERAGE.py
UTF-8
136
3.171875
3
[]
no_license
Roster= ("Kevin", "Clara", "Aidan") for student in Roster: AVG= 50 print (student, AVG) print (Roster) x=2 print (Roster[x])
true
f1a4b42fba1cc2767d06dc14e1ae8c8b23da46d2
ianrowan/qLearn
/qLearn/Initialize.py
UTF-8
1,837
2.90625
3
[ "MIT" ]
permissive
from core import MultiOps as op from core.Qubit import Qubit as q from qLearn.Session import Session class Initialize(Session): def __init__(self, num_vars, limit_spin=False): """ Creates session for Quantum Learning :param num_vars: number of Qubits to init :param limit_spin: boo...
true
0ae7f62aea76b2e82911e50fa24c1f271c85f51b
polinashpudeiko/Biohack2020
/Models/RNA_SVR.py
UTF-8
2,022
2.703125
3
[ "MIT" ]
permissive
#!/bin/python import pandas as pd import sklearn TissueSamples = pd.read_csv("Data/count_matrix_target_subset.tsv", sep="\t") def GetGeneMask(Descriptions): return [True for x in Descriptions] GeneMask = GetGeneMask(TissueSamples["Description"]) def TissueSampleRow(kind): return "Tissue.Sample.ID_%s" % k...
true
e8007b18f3923873e1fffdbe3bd8090b5299d9dd
EKU-Summer-2021/ml-assignment-beresgabor76
/src/dataset_nn_insurance.py
UTF-8
566
2.609375
3
[]
no_license
""" Module for class intended to store and prepare insurance data for linear regression """ from src.dataset_nn import Dataset4NN class Dataset4NNInsurance(Dataset4NN): """ Class intended to store and prepare insurance data for linear regression """ def __init__(self, test_size=0.2, random_state=30):...
true
898187d31ee6cdda9c0182e1e4fc96efdf02dad8
upOwa/unleashed-py
/tests/test_itemdetail.py
UTF-8
1,562
2.515625
3
[ "MIT" ]
permissive
import requests import unleashed_py def test_stockonhandwarehouses(requests_mock): mocked_value = """{ "Items": [ { "WarehouseId": "23456789-abcd-ef01-2345-6789abcdef01", "Warehouse": "Warehouse 1", "AvailableQty": 518 }, { "WarehouseId": "abcdef01-2345-6789-abcd-ef0123456789...
true
00fa04539322a17a5ada77156908376c8936c4ed
LTongSpark/workplace
/risk_pro/demo2.py
UTF-8
212
2.890625
3
[]
no_license
#-*-encoding:utf-8-*- sum = lambda a ,b :a + b print (sum(1,2)) # str = raw_input("please enter :") # print "nishuru" ,str try: fh = open("testfile" ,"w") fh.write("the is") finally: print( "go in")
true
27ac5f1baf6dc3c83c4ce25b23a1f2b8539271cf
Akuli/porcupine
/porcupine/plugins/gotoline.py
UTF-8
777
3.03125
3
[ "MIT" ]
permissive
"""Jump to a given line number easily.""" from tkinter import simpledialog from porcupine import menubar, tabs def gotoline(tab: tabs.FileTab) -> None: # simpledialog isn't ttk yet, but it's not a huge problem imo lineno = simpledialog.askinteger( "Go to Line", "Type a line number and press Enter:",...
true
df867f31bfcd1987c1ebcf4036a49a187af5851c
jmiqra/Compiler_Project_P2
/phase_2.py
UTF-8
8,722
2.890625
3
[]
no_license
""" @author: iqrah """ import sys import tokens import phase_1 t = phase_1.get_next_token() print(t) def next_token(): global t t = phase_1.get_next_token() print(t) if t != None: return True else: return False def program_start(): print("------program") ...
true