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
e0567e7f9012e81116e22dd6a547b962536dfdef
cillian64/portfire
/invites/send_email.py
UTF-8
1,349
2.78125
3
[]
no_license
import smtplib import time from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText def send_email(smtp, template, sender, name, email): msg = MIMEMultipart('alternative') msg['Subject'] = "IRIS Debug Log" msg['From'] = sender msg['To'] = email text = template.format(na...
true
9add3ad3838692bf2b4eeafb23bf81abcfa9164c
ohdnf/algorithms
/swea/d5/1259/1259_metal_stick.py
UTF-8
1,871
3.03125
3
[]
no_license
import sys # sys.stdin = open('input.txt') sys.stdin = open('C:/Users/multicampus/Workspace/algorithms/swea/d5/1259/input.txt') # binary_tree 방식으로 짜보자 tree 만들고 insert 하는 형식으로! # def connect(stick, screws): # while screws: # 나사가 안 남을 때까지 # screw = screws.pop() # if screw[0] == stick[-1]: # ...
true
1097398480ed482c74a67806dc2df66cb57caa53
kithon/SourceCode
/Decision/tree2etrims_sub.py
UTF-8
7,603
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- import os import sys import scipy.io import datetime import numpy as np from PIL import Image from tree import DecisionTree, ExtremeDecisionTree def zeros(w,h): # return dim=3 zeros data = [] row = [] for i in xrange(h): for j in xrange(w): row.append([0,0,0]...
true
597d0319790f053e78bb457a7df423f3e124435c
saurabhnikalje/HackerearthMachineLearningTask
/SourceCodes/ensemble1.py
UTF-8
1,732
2.765625
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.ensemble import VotingClassifier from sklearn.linear_model import LogisticRegression from sklearn.neighbors import KNeighborsClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.svm import SVC from sklea...
true
9efa0c0af2b576a077b2d64aa7b6f5e60a503147
gitmirgut/bb_stitcher
/bb_stitcher/io_utils.py
UTF-8
6,981
2.59375
3
[]
no_license
# 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed u...
true
217b94a6b33232704f98eb1f4342e11b9a8e87eb
faheem91/0A409FCEE1F52551BA8760FE438E9D
/main.py
UTF-8
6,200
2.59375
3
[]
no_license
''' ################################################ Alert Management System (AMS) - Scrapper *************** IMPLEMENTATIONS *************** 1 - Parsing HTML on the URL 2 - Extracting text from HTML 3 - Extracting keywords from text 4 - Defining keywords in Alert categories 5 - Categorization of Alert via keyw...
true
591b327776b6d4862062f2fe25cd893458b30b80
sigevsky/tensorun
/manual/dense_network.py
UTF-8
1,097
3.125
3
[]
no_license
import numpy as np from dense import Dense from activations import SigmaActivation from losses import MSE class DenseNode: def __init__(self, layer: Dense, activation: SigmaActivation): self.layer = layer self.activation = activation class TrivialGradientOptimizer: def __init__(self, alpha: ...
true
3b34a525960b8b370bac9c260bc4f91078bad3c2
jcwill415/finances-automation
/finances_automation/operations/parse.py
UTF-8
4,820
3.234375
3
[]
no_license
""" Contains parsers for reading in bank or card statements to be stored in the finances database. """ import numpy as np import pandas as pd from finances_automation import configuration as conf from finances_automation.repositories import BaseRepository from finances_automation.validation.parse import base_parser_va...
true
654d6f588ff5305050a91e8796f38f45e25af2a9
CiaranMoran27/Programming
/Week07-files/lab7.2.b.py
UTF-8
182
2.96875
3
[]
no_license
import os import sys filename = 'count.txt' def writeNumber(number): with open(os.path.join(sys.path[0], filename), "wt") as f: f.write((str(number))) writeNumber(3)
true
64425dd2e767e2029f2b9a63a9fb352a952464c4
nipy/nipy
/nipy/modalities/fmri/glm.py
UTF-8
23,537
2.75
3
[ "BSD-3-Clause" ]
permissive
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ This module presents an interface to use the glm implemented in nipy.algorithms.statistics.models.regression. It contains the GLM and contrast classes that are meant to be the main objects of fMRI data...
true
5ff2759d9f608510d9dbf084bfe32e230bb73aaf
gongpx20069/DIYNLP
/distance.py
UTF-8
2,045
2.671875
3
[]
no_license
import jieba import numpy as np from collections import Counter import difflib #其中的str1,str2是分词后的标签列表 def edit_similar(str1,str2): len_str1=len(str1) len_str2=len(str2) taglist=np.zeros((len_str1+1,len_str2+1)) for a in range(len_str1): taglist[a][0]=a for a in range(len_str2): tagli...
true
1842abe705d86205ad3dfb18f72885857abdbc0c
fanzongpeng/mywork
/daydayup/cema_python/python-0524/txtDemo.py
UTF-8
457
2.609375
3
[]
no_license
import json # try: # f = open('test_data.txt', 'r') # text = f.read() # print(text) # f.close() # except FileNotFoundError: # print("file is not found") with open('test_data.txt', 'r') as f: mytxt = f.read() print(mytxt) # txt_dict = json.loads(mytxt) # print(txt_dic...
true
4cc66a906611ae6fd9a369ff84f80584b00beeb1
Romit-Maulik/Practice
/Other_Python/Savgol.py
UTF-8
476
2.625
3
[ "MIT" ]
permissive
import numpy as np from scipy.signal import savgol_filter import matplotlib.pyplot as plt #Read data file_data = np.loadtxt('Sav_Gol_Data.csv',dtype='double',delimiter=',') print(np.shape(file_data)) plt.figure() plt.plot(file_data[:,0],file_data[:,1]) plt.show() # data_new = savgol_filter(file_data[:,2]...
true
6114205cd0845a7895640ea5d5060d01397eed3b
ilovewarpig/MathModeling
/智能优化算法/myACO.py
UTF-8
9,676
2.78125
3
[]
no_license
import numpy as np import pandas as pd import random import matplotlib.pyplot as plt import math import time df = pd.read_csv('data1.csv') adj = np.zeros((len(df), len(df))) for i in range(len(df)): for j in range(len(df)): adj[i][j] = round(np.sqrt((df['x'][i]-df['x'][j])**2 + (df['y'][i]-df[...
true
f7244261e06f5f42f94a039c88102628e2fc43da
gustavomarquezinho/python
/programs/console-only/minigames/memory.py
UTF-8
2,131
3.546875
4
[ "MIT" ]
permissive
from random import sample from time import sleep from os import system memoryInfo = [ ] memoryStatus = [ 0, 0, 0 ] def cleanMemory(): system("cls") def printEx(pMessage, pBefore, pLater, pClean): if pClean == 0: cleanMemory() sleep(pBefore) print(pMessage) sleep(pLater) if pC...
true
c54a30723bdc5c90d37f089914cd27a2b80141a3
tkarthikeyan132/tomasulo-algorithm
/reservation_bank.py
UTF-8
1,112
3.34375
3
[]
no_license
# A single ReservationBank class ReservationBank: def __init__(self, num): self.num = num # the reservation bank number self.instruction_no = 0 # instruction currently being executed self.tag1 = -1 self.source1 = 0 self.tag2 = -1 self.source2 = 0 ...
true
6755733d93fc1ad27dba7c3fd9a8e71ea5d07cc4
luischanu/NSX-Config-From-Excel_Python
/NSX_GoGet.py
UTF-8
1,665
2.828125
3
[]
no_license
""" Still ToDo Items: 1) Convert over to logging module instead of print statements 2) Handle exceptions """ import NSX_v import requests import xml.etree.ElementTree from requests.auth import HTTPBasicAuth # Still need to understand why requests.auth.HTTPBasicAuth() is not valid. from requests.packages.urllib3.exc...
true
04841a87e735aec03d95fe6e590894a171e08500
arsh09/atmcontroller-test
/src/controller.py
UTF-8
3,047
3.796875
4
[]
no_license
""" ATMController is our controller: It tries to hide the functionality of the Account class by only exposing the main functions """ from accounts import Account class ATMController: # It assumes that ATMController Constructor # works as a card reader that reads the card number # and user inputted pin...
true
36d96c9257f57cc02864e7ac37947695bed47817
JerryLiuLYU/PyLYU
/Practices/P0001/tianzheng/13、打印每个名字.py
UTF-8
157
2.625
3
[]
no_license
'''s=['sassa','sasaasassssaas','sdcrgvrtb'] for i in s: print(i)''' s=['sassa','sasaasassssaas','sdcrgvrtb'] for i in range(len(s)): print("%s"%s[i])
true
fa2f4ad8f7e61dd8b42d9cdebc49f4ce657a8682
kon3m/ML
/ml/layer/layer.py
UTF-8
1,678
2.546875
3
[ "MIT" ]
permissive
import numpy as np from ..activation import activations from ml import losses class Layer: def __init__(self,units=None,activation=None,set_bias=False): self.units=units if set_bias: self.set_bias=True else:self.set_bias=False try: self.activation=activations.__dict__[activation] except :raise ValueEr...
true
50b02b163b623186e7997a31c3789ceb409007ef
kouloudab/cogmaster2014AIP
/check_pygame.py
UTF-8
281
2.90625
3
[]
no_license
try: import pygame pygame.init() window=pygame.display.set_mode([300,300]) window.fill([100,0,0]) pygame.draw.circle(window,[0,250,250],[150,150],20) pygame.display.flip() pygame.time.wait(1000) except: print "probleme" finally: pygame.quit()
true
e9c9c6a4488f1707e1b91bee70707bc1d22d76c3
InbarRose/irtools
/irtools/tests/test_thread_pool.py
UTF-8
3,260
2.640625
3
[ "MIT" ]
permissive
#! /usr/bin/env python # Standard Imports import unittest from random import randrange import time # irtools Imports from irtools import * from irtools.kits import thread_pool # Logging log = logging.getLogger('irtools.tests.thread_pool') utils.logging_setup(level=0, log_file=ir_log_dir + '/test_thread_pool.log') ...
true
f371ea14bf13b6e0588134628e87f110d07bdc49
multimac/blazingdb-python
/blazingdb/util/timer.py
UTF-8
1,124
3.546875
4
[]
no_license
""" Defines the RepeatedTimer class, for repeatedly calling a given function """ import asyncio class RepeatedTimer(object): """ Repeatedly calls a given function at consistent intervals """ def __init__(self, interval, function, *args, loop=None, **kwargs): self._loop = loop if loop is not None els...
true
b348f6b8ae0c176dd7247a4ec4445f52e7c2ea74
lcferrara4/Paradigms_Final_Project
/player1.py
UTF-8
5,751
2.71875
3
[]
no_license
import os import sys import math import random import zlib from twisted.internet.protocol import Factory from twisted.internet.protocol import Protocol from twisted.internet import reactor from twisted.internet.defer import DeferredQueue from twisted.internet.task import LoopingCall import cPickle as pickle import p...
true
278d010880c321ff90fabadaa1067566304471ed
Aasthaengg/IBMdataset
/Python_codes/p02597/s193677360.py
UTF-8
207
2.828125
3
[]
no_license
n=int(input()) c=list(input()) r=[] w=[] for i in range(n): if c[i]=='R': r.append(i) else: w.append(i) r.reverse() ans=0 for i in range(min(len(r),len(w))): if r[i]>w[i]: ans+=1 print(ans)
true
00dab82c9885b4c2c2385f0379b2c967b4f9b94f
biagioboi/Programmazione-Avanzata
/ChainOfResponsability/DP_ChainOfResponsability.py
UTF-8
2,953
3.5625
4
[]
no_license
def main(): handler = TimerHandler(KeyHandler(MouseHandler())) gen = Event.next() while True: event = next(gen) if event.kind == Event.TERMINATE: break handler.handle(event) class Event: MOUSE = "MOUSE" KEYPRESS = "KEYPRESS" TIMER = "TIMER" TERMINATE = "T...
true
669666aa266bb830c70347c5049ba604535e1bd1
goshuirc/goshu
/modules/list_module.py
UTF-8
7,371
2.59375
3
[ "ISC" ]
permissive
#!/usr/bin/env python3 # Goshu IRC Bot # written by Daniel Oaks <daniel@danieloaks.net> # licensed under the ISC license from gbot.modules import Module from gbot.users import USER_LEVEL_ADMIN class list_module(Module): """Provides help and command listings to users.""" core = True def help_listener(sel...
true
1768967fb31b380df746ae763817c02a5a05ff8b
mgmix/BeautyGanServingApp
/beautyServer/app.py
UTF-8
1,423
2.625
3
[]
no_license
import os from flask import Flask, render_template, request, send_file, jsonify from werkzeug.datastructures import FileStorage from werkzeug.utils import secure_filename from execute import Model app = Flask(__name__) UPLOAD_FOLDER = 'path/beauty/imgs/' ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif']) def all...
true
e61b87c7d67f638852c48f110a139567633ba842
jaabberwocky/leetcode
/leetcode/TopInterviewProblems/AtoI.py
UTF-8
1,066
3.3125
3
[]
no_license
class Solution: def myAtoi(self, s: str) -> int: if len(s) == 0: return 0 isPositive = True hasSign = False stringNum = '' # strip out whitespace s = s.lstrip() if len(s) == 0: return 0 # chec...
true
76e348d1d864295ac102b179cc91757c268cbec9
mcnallc2/berkeley-intro-to-artificial-intelligence
/search/search.py
UTF-8
9,508
3.6875
4
[]
no_license
# search.py # --------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.edu. # # A...
true
64c19a9067aab99ba3bd95a7d77585357f3e8046
gdmgent-IoT-1920/labo-2-sensehat-MaartenOste
/avatar_animated.py
UTF-8
1,850
2.75
3
[]
no_license
from sense_emu import SenseHat import sys import time import random sense = SenseHat() def randomColor(): r = random.randrange(0,255) g = random.randrange(0,255) b = random.randrange(0,255) return [r,g,b] def main(): O = [0,0,0] c = randomColor() counter = 0 direction ...
true
e488922e53d0478752c1fced61a12ba755dd6726
PaoOrtiz/Python
/numero1.py
UTF-8
160
3.53125
4
[]
no_license
suce=[] a=0 b=1 num = int(input("Posición: ")) for n in range(num): suce.append(a+b) ab = a + b a = b b = ab print(suce[-1])
true
792e2d02ccdaa5cc86070121937dd6398c4db15a
MaciejNessel/algorithms
/graphs/alg_ford_fulkerson.py
UTF-8
1,219
3.75
4
[]
no_license
# Implementation of Ford-Fulkerson algorithm from queue import Queue from math import inf def bfs_search(n, s, t, parent): visited = [False for _ in range(n)] queue = Queue() queue.put(s) visited[s] = True while queue.qsize() > 0: u = queue.get() for i in range(n): i...
true
7916636f5361fa5e1e95d1349b6576f5e4c85bfd
crheacofc/MechFail
/python/branch_AlOx.py
UTF-8
2,916
2.78125
3
[]
no_license
#Python file to create graphic from sweep results import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns pd.options.mode.chained_assignment = None # default='warn' csv_file = pd.read_csv("/home/crhea/Dropbox/Research/Kidney-Stone/sheep/output/AlOx/Branches_AlOx.csv") total_gc = []...
true
d9c899ce4e95ff59621c6ab669976191f1bc7670
Gini5/Game
/Pikachu/classes/Block.py
UTF-8
646
3.1875
3
[]
no_license
import cocos, random class Block(cocos.sprite.Sprite): def __init__(self, position): super(Block, self).__init__('block.png') self.image_anchor = 0, 0 x, y = position if x == 0: # self.position is (0,0), to right and up scale self.scale_x = 4.5 # flat lan...
true
b488c1bf64e5de6070b2ebd8ffb8d12727c3e35f
dwkang707/BOJ
/python3/(2587)BOJ.py
UTF-8
189
3.15625
3
[]
no_license
# https://www.acmicpc.net/problem/2587 l = [] sum = 0 for _ in range(5): n = int(input()) sum += n l.append(n) l.sort() mean = sum // 5 median = l[2] print(mean) print(median)
true
f1ac08798f1e7969a4a00ee5968398b44b1857e3
BhagyaRana/SVNIT_Study_Material_First_Year
/Semester_2_First_Year/6-Web_Programming[Branch Specific Course-II]/6.) Python/Python/Examples/import/example/Practical3.py
UTF-8
653
4.4375
4
[]
no_license
''' Python Program to Convert given Kilometer into Miles 1 km = 0.621371 miles Meter 1 km = 1000 meter Centimeter 1 m = 100 centimeter Feet 1 m = 3.28084 foot Inch 1 foot = 12 Inch ''' kilometers = 5.5 # To take kilometers from the user, uncomment the code below # kilometers = float(input("Enter value in kilometers")...
true
0cc7003907e23418b24a21605a45fc3b20b35846
JoyChudasama/Python_Labs
/Lab-4/main.py
UTF-8
1,686
4.28125
4
[]
no_license
''' Condition control (While loop) we dont know how many times you want to repeat while condition: statements statements etc. one of the usage of while is input validation control! count control (For loop) ''' MAX_TEMP=40 def temp_check(): temp=float(input('Enter the substanc\'s' ...
true
5accfc6405c2803d5deeb749135d3bcfe0ec0e82
madelonhulsebos/Publications-IR
/Webcrawler_taxonomy/crawler.py
UTF-8
2,329
3.265625
3
[]
no_license
# Retrieve all categories using namespace=14 import requests import json subcategory_url = 'https://en.wikipedia.org/w/api.php?action=query&format=json&list=categorymembers&cmnamespace=14&cmlimit=500&cmtitle=Category:Algorithms' r = requests.get(subcategory_url) subcategories = json.loads(r.text) # print(subcategories)...
true
91da659e3b5f8c64f02bdf3053e22b18502c66c2
Raffayet/HospitalApplication
/gui/sekretar/zakazivanje_pregleda.py
UTF-8
5,977
2.53125
3
[]
no_license
import datetime from tkinter import * from tkinter import ttk, messagebox from gui.prikaz_entiteta.tabela_vremenskih_slotova import poziv_tabele_vremenskih_slotova from model.dto.dogadjaji_dto.zakazivanje_operacija_pregled_dto import ZakazivanjeOperacijaPregledDTO from model.enum.namena_prostorije import NamenaProstor...
true
6e1283f7af65c62906dbaed4dfe9f3475062eb4d
briabar/Katas
/dictionarymaker.py
UTF-8
162
3.375
3
[]
no_license
def func(n,m): dictionary = {} for i in range(0,len(n)): dictionary[n[i]] = m[i] return dictionary n = ["alice", "Bob"] m = [20, 45] print(func(n,m))
true
2deef138c25ed577062915534f3d629e28cd3403
Handagege/effectMonitor
/statsItem.py
UTF-8
4,164
2.890625
3
[]
no_license
#!/usr/bin/python import Queue class statsItem(): def __init__(self,windowLength=12): self.totalWindowStats = [0,0,0] self.totalDayStats = [0,0,0] self.tempWindowStats = [0,0,0] self.windowLength = windowLength self.windowQueueStats = [[0]*windowLength,[0]*windowLength,[0]*windowLength] self.trueMark = "...
true
20a9ca8f17bded752b4b774f15ea2530b6f362a6
msarch/py
/paused/05. bk old/0.23/bw/field.py
UTF-8
3,348
2.96875
3
[]
no_license
#!/usr/bin/python # -*- coding: iso-8859-1 -*- # zululand/cell :: rev_23 :: MAY2014 :: msarch@free.fr ##---IMPORTS------------------------------------------------------------------- import pyglet from debug import db_print ##---CONSTANTS----------------------------------------------------------------- ##---VARIABLES-...
true
fc85e7e560335b7be2c756427fc2cc10469803b5
comath/pytorch_adversarial
/xerxes/targets/mnistConvNet.py
UTF-8
1,728
2.5625
3
[]
no_license
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import os from .datasets import MNIST from ..utils import * class MNISTConvNet(nn.Module): def __init__(self): super(MNISTConvNet, self).__init__() self.conv1 = nn.Conv2d(1, 16, 5,padding = 2) s...
true
e69d97612274df74bd37c1f33b8f405af7a9e32c
manoj543/Data-structures-problem-solving
/Bit manipulation/SingleNumber.py
UTF-8
884
3.953125
4
[]
no_license
""" Problem Description Given an array of integers, every element appears thrice except for one which occurs once. Find that element which does not appear thrice. NOTE: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? Problem Constraints 2 <= A <= 5106 0 ...
true
334ff554463ccab464bee47e767e82b6cec00bae
syurskyi/Python_Topics
/125_algorithms/_exercises/exercises/Learn_Python_by_solving_100_Coding_Challenges/Coding Challenge No. 18 - Divide Two Integers.py
UTF-8
699
3.015625
3
[]
no_license
# # Divide Two Integers # # Question: Divide two integers without using multiplication, division and mod operator. # # Solutions: # # # c_ Solution # # @return an integer # ___ divide dividend, divisor # __ ? < 0 an. ? > 0 o. ? > 0 an. ? < 0 # __ ab. ? < ab. ? # r_ 0 # ...
true
128e351c0446841a6b3e2860aeb9ba869fbb48f6
maverick13m/normal-deviation
/101.py
UTF-8
472
2.71875
3
[]
no_license
import pandas as pd import csv import plotly.figure_factory as ff df = pd.read_csv("data.csv") df2 = pd.read_csv("2.csv") #height fig1 = ff.create_distplot([df["Height(Inches)"].tolist()],["Height"],show_hist=False) fig1.show() #Weight fig2 = ff.create_distplot([df["Weight(Pounds)"].tolist()],["Weight"],sh...
true
0b28990a0a8d3f1225a04cb7ea197fb470adfe0e
puv13/nspt-scripts
/scripts/pcm_coeff.py
UTF-8
1,576
2.96875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This module provides a function to calculate the known expansion coefficients of the energy density of the Principal Chiral model. References ---------- Paolo Rossi and Ettore Vicari, "Two-dimensional SU(N)xSU(N) chiral models on the lattice", Phys...
true
964d26c3c2da9b736cee627e76d885426205da41
se4sci/time-series
/src/data/data_handler.py
UTF-8
2,118
3.125
3
[]
no_license
""" A data handler to read, write, and process data """ import os import sys import pandas as pd from glob2 import glob from pdb import set_trace from collections import OrderedDict from pathlib import Path root = Path(os.path.abspath(os.path.join(os.getcwd().split("src")[0], 'src'))) if root not in sys.path: sys...
true
374cd0a45f74515e9dbeb881f12bb019252eb3af
javacasm/RaspberryBiblioMaker
/codigo/python/suma.py
UTF-8
104
3.640625
4
[]
no_license
a = input("Dime el primero numero: ") b = input("Dime el segundo numero: ") c = int(a) + int(b) print(c)
true
12eddaab0c1db539eeaca7981e87c1ee87277353
arslanmustafabora/CoronaPredictor
/Predictor.py
UTF-8
1,204
3.484375
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.preprocessing import PolynomialFeatures from sklearn import linear_model ### IMPORT DATA ### data = pd.read_csv('total_cases.csv',sep=',') ### PREPROCESS DATA ### data = data[['date','Turkey']] data[['date']] = np.arange(len(data[['da...
true
754c9874790b6ab85cf86d43bfd1824c62e29977
msand/extremitypathfinder
/extremitypathfinder/extremitypathfinder.py
UTF-8
27,128
3.03125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import pickle from copy import deepcopy from typing import List import numpy as np from .graph_search import modified_a_star from .helper_classes import DirectedHeuristicGraph, Edge, Polygon, PolygonVertex, Vertex from .helper_fcts import check_data_requirements, convert_gridworld, find_within_range, inside_polygon, ...
true
6bbe3df552410fcd2d930012c1669fdb96aea663
gurpreetatwal/hack61a
/main.py
UTF-8
4,077
3
3
[]
no_license
from data_new import berkeley_classes from bs4 import BeautifulSoup from classes import Course,CourseLoad from datetime import datetime import urllib.request print("Welcome to Tele-Bears Advisor!") print("Tele-Bears Advisors looks at last semester's enrollment data and determines") print("which classes you should Phas...
true
fcb6de9cfc97c7876e133f64788c49b20ec977f0
s975188062/EDSPer
/Visual_Angle_Calculator_v1.py
UTF-8
28,831
3.1875
3
[]
no_license
import tkinter as tk from tkinter import ttk from tkinter import scrolledtext from tkinter import Menu from tkinter import Spinbox from tkinter import filedialog from tkinter import messagebox from math import sin from math import cos from math import tan from math import pi from math import radians import webbrowser i...
true
550de703e2508c2722f63eab838f1d3e0bb4dc02
MySunShine123456/Object
/Object_classs/More_extend.py
UTF-8
312
3.6875
4
[]
no_license
#经典类的时候,就按照深度优先方式查找继承的方法, #新式类的时候,就按照广度优先的方式查找 class D(object): def bar(self): print('D.bar') class C(D): def bar(self): print('C.bar') class B(D): pass class A(B, C): pass a = A() a.bar()
true
b26501dcbf204380c97867a6bb8a215b2011efcf
elderlima/python_fundamentals
/app/update_core.py
UTF-8
364
2.890625
3
[]
no_license
from sqlalchemy import update from core import user_table, engine con = engine.connect() atualizacao = input('Digite o nome do usuario: ') atualizar = update(user_table).where(user_table.c.nome == atualizacao) novo_nome = input('Digite um novo nome: ') atualizar = atualizar.values(nome=novo_nome) resultado = con.e...
true
650269eadf796469904bb21bcaf596468d17b975
ZANJIN-git/Interactive-Charts-and-Web-App
/app.py
UTF-8
15,531
2.578125
3
[ "MIT" ]
permissive
#!/usr/bin/env python # coding: utf-8 import pandas as pd import numpy as np import plotly.graph_objects as go import plotly.express as px import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import os import boto3 import json import io aws_...
true
86f71ed7c06d303f43325bbfd18844c6e76dcff6
guillaumekugener/surgical-training-project
/tools/yolo_output.py
UTF-8
7,394
2.625
3
[]
no_license
import pickle import os import numpy as np import pandas as pd import copy from collections import deque import random from math import floor from lxml import etree import re import tqdm import matplotlib.pyplot as plt from matplotlib.patches import Rectangle import cv2 class YoloOutput: def __init__(self, vide...
true
e4de29009b800e5e23977e85d56048b0ac019e76
seantis/spare
/spare/utils.py
UTF-8
4,177
2.515625
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
import os import signal import stat import sys import weakref from boto3 import resource from botocore.client import Config from contextlib import contextmanager, ExitStack from logbook import SyslogHandler from pathlib import Path from spare import log from spare.errors import FileChangedDuringReadError CLEANUP_FUN...
true
828f6cbee76dc2908bc1701916367274bbc49600
Snnzhao/NNR
/general_recommendation_methods/evaluate.py
UTF-8
3,495
2.703125
3
[ "MIT" ]
permissive
#!/usr/bin/env python import sys, os, os.path import numpy as np import json from sklearn.metrics import roc_auc_score def dcg_score(y_true, y_score, k=10): order = np.argsort(y_score)[::-1] y_true = np.take(y_true, order[:k]) gains = 2 ** y_true - 1 discounts = np.log2(np.arange(len(y_true)) + 2) ...
true
7bd7c113dd654fd8cc53d05a75e74bb552fd63bd
narJH27/pynet
/week2_exercises/week2_exer2.py
UTF-8
874
2.9375
3
[ "Apache-2.0" ]
permissive
import sys import telnetlib import time TELNET_PORT = 23 TELNET_TIMEOUT = 5 user = 'pyclass' passwd = '88newclass' def telnet_login(conn, user, passwd): conn.read_until('sername:', TELNET_TIMEOUT) conn.write(user + '\n') conn.read_until('ssword:', TELNET_TIMEOUT) conn.write(passwd + '\n') def telne...
true
c04e55325b7e2a665f51a146e99b33f28f2b5d5c
DPDMPROJECT/projectenable
/testfile1.py
UTF-8
147
3.21875
3
[]
no_license
import time t1 = time.time() for n in range(1,1100): print ('Value:',n) n = n /10 print ('Value', n) t2 = time.time() print (t2-t1)
true
1ce76bce4fd08e38e45ec523bd9fc7adab95d2cd
bgallag6/AR_Tracking_MSU
/view_single_full_surface_fts.py
UTF-8
1,289
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Jun 01 13:58:55 2017 @author: Brendan """ import matplotlib.pyplot as plt import numpy as np import astropy.units as u import sunpy from sunpy.map import Map x = sunpy.map.Map('C:/Users/Brendan/Downloads/20110310_120615_304.fts') #x = sunpy.map.Map('C:/Users/Brendan/Docum...
true
14572ece9f12b1d09e19a529024fddb02186d2bd
DLR-SC/DataFinder
/src/datafinder/gui/user/dialogs/search_dialog/utils.py
UTF-8
12,511
2.671875
3
[]
no_license
# $Filename$ # $Authors$ # # Last Changed: $Date$ $Committer$ $Revision-Id$ # # Copyright (c) 2003-2011, German Aerospace Center (DLR) # All rights reserved. # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are #met: # ...
true
3debe2b298e793eac902f01663265426af4a6213
htmlprogrammist/kege-2021
/tasks_26/solutions/26-23.py
UTF-8
815
3.625
4
[]
no_license
# Автор: А.Н. Носкин """ Идея: считываем все результаты в массив, сортируем их по убыванию. Определяем последний результат победителя и призера """ with open("26-3k.txt") as F: n, k, m = map(int, F.readline().split()) # строку файла превращаем в 3 числа # n - общее кол-во участников # k - кол-во победителей...
true
a693f6f3ab3e9e929e7439813c866a1a21e5c216
ursg/analysator
/examples/fourier_transform_field.py
UTF-8
979
2.96875
3
[]
no_license
#!/usr/bin/python # # Fourier transform a scalar variable, or one component of a vector, in a vlsv file # (entiere space) # import pytools as pt import numpy import pylab import sys if len(sys.argv) < 3: sys.stderr.write("Syntax: fourier_transform_field.py <vlsvfile> <field> [<component>]\n") sys.exit() filen...
true
e46f422c3f5894fe02e0cbf296a8a0568b5fd646
istommao/pyvalidators
/pyvalidators/phone.py
UTF-8
1,605
3.171875
3
[]
no_license
# coding: utf-8 """phone validator. 13[0-9], 14[5,7], 15[0, 1, 2, 3, 5, 6, 7, 8, 9], 17[1, 3, 6, 7, 8], 18[0-9], 170[0-9] CHINA MOBILE: 134,135,136,137,138,139,150,151,152,157,158,159,182,183,184,187,188,147,178,1705 CHINA UNICOM: 130,131,132,155,156,185,186,145,176,1709 CHINA TELECOM: 133,153,180,181,...
true
5144005616c89b11aabd20026dabb9a5a5300fc6
jeffreylozano1376/Basics_Python
/exercises/function_exercise.py
UTF-8
2,746
3.5625
4
[]
no_license
# T-Shirt def make_shirt(text='I love Python', size='large'): """Accepts a size and text of a message print for a shirt.""" print( f"The size of the shirt is {size} and the message print is '{text}'.") make_shirt('seek discomfort', 'small') make_shirt() # Cities def describe_city(city, country="icel...
true
8600a851e35eab446f166a34765ce85522ec9859
vmarquess/CardNutri
/base_dados.py
UTF-8
6,087
2.703125
3
[]
no_license
import csv import classes alimentos_grupo = dict([('Cereais e derivados', 0), ('Verduras, hortaliças e derivados', 0,), ('Frutas e derivados', 0,), ('Gorduras e óleos', 0,), ('Pescados e frutos do mar', 0,), ...
true
54f3f81b0bdfbfcc6e513a7743413c9c5339c1e5
TIU11/pi-workshop
/rockpaperscissorgui.py
UTF-8
794
3.65625
4
[]
no_license
# Rock Paper Scissors Game from guizero import * import random possible_answers = ['rock','paper','scissors'] def rock(): comp_answer = random.choice(possible_answers) if comp_answer == 'rock' : result.value = "Tie" elif comp_answer == 'paper': result.value = 'You lose, sorry!' else: ...
true
8d6c9d5e605e82679a5a59b90460e356f3183e3b
ColtonAarts/SpeechToTextSentimentAnalysis
/SentenceDetection.py
UTF-8
198
2.765625
3
[]
no_license
# from deepsegment import DeepSegment # # The default language is 'en' # segmenter = DeepSegment('en') # segmenter.segment('I am Batman i live in gotham') # # ['I am Batman', 'i live in gotham']
true
298c134ce4684da97618035b94d725a4074a4941
jdfdoyley/python_numbers
/integers.py
UTF-8
452
4.40625
4
[]
no_license
# Following numbers are integers x = 10 y = -10 z = 123456789 print(x, y, z) # Integers have unlimited precision w = 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 print(w) # Integers in binary, octual and hexadecimal formats # binary print(0b10111011) # 187 # octal pr...
true
1545f11b9eada770ecaf1cbbad6ff3133b8c2481
juancq/py-interactive-genetic-algorithm
/app/nn/funcs.py
UTF-8
302
3.125
3
[]
no_license
import math def sigmoid(val): if val < -37: return 0.0 if val > 37: return 1.0 return 1.0/(1.0 + math.e ** -val) sfunc = sigmoid #sfunc = math.tanh def dsigmoid(val): return val * (1.0 - val) def dtanh(val): return 1.0 - val*val dfunc = dsigmoid #dfunc = dtanh
true
7b4737f1c46a39878053faadd6b9f34a033ab5f7
meyerpa/Python
/Numerical Analysis/bisection.py
UTF-8
1,182
3.859375
4
[]
no_license
""" Description: Bisection method """ __author__ = "Paige Meyer" __date__ = "09/30/2016" from math import log10 def f(x): return x**5 + 5 *(x**4) - 8 * (x**3)+5*(x**2)-11*x+7 def bisection(a, b, tol, n): print("x"+str(n)+ ": " + str((a+b)/2)) if f((a+b)/2) == 0 or abs((b - a)/2) < tol: ...
true
f71aee1a6c76db0381235b9a78b9f09f85bda495
andybloke/python4everyone
/order.py
UTF-8
200
3.34375
3
[]
no_license
order_books1 = ["Black Beauty", "The Hobbit","The Alchemist","The Little Prince"] order_books2 = ["War and Peace", 'Heidi'] order_books1.extend(order_books2) print(order_books1) print(order_books2)
true
56de234f7dec9920dfac94a32b4b3dca8170c386
Mansi-Mittal/Machine-Learning
/glass.py
UTF-8
589
2.546875
3
[]
no_license
import numpy as np import pandas as pd from sklearn.naive_bayes import GaussianNB from sklearn import preprocessing,cross_validation,svm,metrics p=pd.read_csv("glass.csv") #p.info() #print(p.describe()) Y=np.array(p["Type"]) X=np.array(p.drop(["Type"],1)) X=np.array(p.drop(["RI"],1)) X_train, X_test, Y_train, Y_tes...
true
e514b36258d6f513c9ce498a7bc63aa25d9b8a76
lxy5513/python
/mutilprocess/fall_client.py
UTF-8
3,732
2.59375
3
[]
no_license
import os from kafka import KafkaConsumer from hashlib import md5 import hashlib import cv2 from tqdm import tqdm import gc from multiprocessing import Process, Manager server = "10.0.0.222:9022" # 向共享缓冲栈中写入数据: def write_frame(stack, cam, top: int) -> None: """ :param cam: 摄像头参数 :param stack: Manager.list对...
true
cc613286f98388bf9f86af28b73dc3e0175598f3
janrems/Najboljse-ocenjene-knjige
/uvoz.py
UTF-8
8,222
3.21875
3
[]
no_license
import requests import re import os import csv import sys url = 'https://www.goodreads.com/list/show/1.Best_Books_Ever?page={}' #url glavne spletne strani def url_v_niz(url): #Funkcija za argument dobi url "url" spletne strani in vrne njeno html kodo kot niz. try: r = requests.get(url) except requ...
true
39a54a846ea142ca963f3f597a56e73b841f5842
jrhaberstroh/advent-of-code-2019
/day10.py
UTF-8
3,493
3.203125
3
[]
no_license
import numpy as np import math ## PART 1 def get_num_sight(asteroid_pos, pos): other_asteroid = asteroid_pos - {pos} disps = [ tuple(x_o - x_p for x_o,x_p in zip(other, pos)) for other in other_asteroid ] angles = { int(round(math.atan2(disp[0], disp[1]) * 1E8)) for di...
true
2a1ffb5fcc3a8210c4ef675502cdf79dcf43eab1
shincap8/holbertonschool-machine_learning
/unsupervised_learning/0x01-clustering/0-initialize.py
UTF-8
1,273
3.609375
4
[]
no_license
#!/usr/bin/env python3 """Function that initializes cluster centroids for K-means""" import numpy as np def initialize(X, k): """X is a numpy.ndarray of shape (n, d) containing the dataset that will be used for K-means clustering n is the number of data points d is the number of dimensions fo...
true
73ab58aa864820e2b24f26a38f7aebcdbd7b1ce2
RJTK/8Puzzle_solver
/heuristics.py
UTF-8
2,086
3.390625
3
[]
no_license
#This is the goal state P_goal = [[1,2,3], [4,0,5], [6,7,8]] #-------------------------------------------------------------------------------- def h1(P): ''' Heuristic number 1. Checks the number of misplaced tiles. ''' h = 0 for i, row in enumerate(P_goal[0:3]): for j, v in enumerat...
true
fbdc9a10ee1f01ddd4a498700a2448b6f74b38fb
hly9624/python
/kaoshi.py/3.py
UTF-8
311
3.40625
3
[]
no_license
#!/usr/bin/env python n = input() def choushu(a): while a % 5 == 0: a /= 5 while a % 2 == 0: a /= 2 while a % 3 == 0: a /= 3 if a == 1: return True else: return False l = [] for i in range(1,n + 1): if choushu(i): l.append(i) print l
true
00b143b3647ddb687831a32a520b502bae29952e
koleberd/goaldependency
/src/dependencyTree.py
UTF-8
10,531
2.921875
3
[ "MIT" ]
permissive
from action import * from playerState import * from playerStateTarget import * from playerStateSolution import * from actionTarget import * from actionFactory import * from graphviz import * ### #used to build and render a dependency tree ### #gets the name for a node on the tree based on its contained PS. def getNam...
true
0cb6cc118fa6988b4e6a8a38e036ef9e8736e451
markaalvaro/advent-2020
/day2.py
UTF-8
710
3.8125
4
[]
no_license
def count_occurences(password, character): count = 0 for i in range(0, len(password)): if password[i] == character: count += 1 return count def find_num_valid_passwords(): numValid = 0 for line in open('day2_input.txt'): fragments = line.split(' ') expectedRange ...
true
0ec92d9a548033c925727a87485d16a2930deee3
dotnest/pynotes
/done/average_grade.py
UTF-8
845
4.34375
4
[]
no_license
# Define a function that takes a list of lists and returns a new list of # lists with a student's name and their average grade in each sublist. def average_grade(lst): """ Return students' names and their average grades. >>> average_grade([['Bob', 56, 80, 72, 90], ['Alice', 60, 88, 44, 70]]) >>> [['Bob...
true
9d2d8b3f9cc57767d637b22ad880450beca9ccaa
bingdyee/pybatis
/v1/dbutil.py
UTF-8
1,361
2.515625
3
[ "Apache-2.0" ]
permissive
# -*-coding:utf-8-*- import sqlite3 from utils import Singleton @Singleton class DBUtils: """For sqlite3""" def __init__(self, path=None): self.pools = {} self.cur_session = None if path: conn = sqlite3.connect(path) conn.text_factory = str self.po...
true
0a32b7ccacab84e0d3d53ce561a8630a0923341f
misrashashank/Competitive-Problems
/contiguous_array_0_1.py
UTF-8
1,408
3.796875
4
[]
no_license
''' Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. Example 1: Input: [0,1] Output: 2 Explanation: [0, 1] is the longest contiguous subarray with equal number of 0 and 1. Example 2: Input: [0,1,0] Output: 2 Explanation: [0, 1] (or [1, 0]) is a longest contiguous su...
true
edcff7f2f35e18511c4064afb61b94f50a2fe350
noemrd/google_api
/read_store.py
UTF-8
2,485
2.875
3
[]
no_license
#!/usr/bin/env python3 """ This module connects to the google API to read, store and reset columns C-G in the 'template1' tab in the template sheet https://docs.google.com/spreadsheets/d/xxxxxxx/ edit#gid=12345 """ import gsheets_utils import sys import sqlalchemy import config from config import PSQL_STRING from gshe...
true
b2ede1dbefb069cb1bec5000ccb756a2715f68b2
vitoralvesp/introducao-a-ciencia-da-computacao-com-python-parte-1
/WHILE.py
UTF-8
256
3.234375
3
[]
no_license
numero = int(input("Vamos fazer um joguinho hehe! Digite um número e entenda a lógica:")) num = 1 while num < 0: a = numero // 1 % 10 b = numero // 10 % 10 c = numero // 100 % 10 d = numero // 1000 % 10 print("{}. O que houve?")
true
f8605e94a711806940d0d281731c50cfdb7b16ae
marcelodri/AdultosMayoresNLP
/fasttext/src/4_funciones_API.py
UTF-8
2,328
3.15625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Dec 18 11:50:03 2020 @author: grosati """ ## Funciones auxiliares def clean_text_df(df, input_text_file='texto', stopwords=False): """ Función para el procesamiento de texto 1. pasa todo a minúscula 2. elimina sitios web 3. elimina...
true
fb5cc7ffc0c0b2e8ff6c8b25193fbc019efe6a6e
DamianBewicz/PythonGame
/merchants/armourer.py
UTF-8
1,650
2.875
3
[]
no_license
from items import ( RustyArmor, RustyTrousers, RustyShield, RustyBoots, RustyGloves, RustyHelmet, PlateArmor, ArchmageRobe, PlateBoots, PlateGloves, MysticalGloves, PlateHelmet, ArchmageHeadpiece, BurnishedShield, IronShield, PlateTrousers, PhoenixTrousers, SorcererBoots, ) from merchants.merchant import Me...
true
21d7350549c64ed44d36c7be608a18b6e44aec2d
mindofpsyche/Games
/Snake water gun.py
UTF-8
1,985
3.953125
4
[]
no_license
import random opt = ["s", "w", "g"] c1 = random.choice(opt) #random choice by cpu print('WELCOME TO THE GAME\n' 'This is computer based Snake,water and gun game.\n') r1 = int(input('How many rounds will you like to play?\n')) p1 = 0 p2 = 0 #defining rules for winning def rules(): globa...
true
e74a85b1509de164018912752b2e62b6a27ad5e9
lxl0928/learning_python
/spiders/cuiqingcai/taobaoMM/spider.py
UTF-8
5,142
2.828125
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding:utf-8 -*- import urllib import urllib2 import re import tool import os #抓取MM class Spider: #页面初始化 def __init__(self): self.siteURL = 'http://mm.taobao.com/json/request_top_list.htm' self.tool = tool.Tool() #获取索引页面的内容 def getPage(self,pageIndex): ...
true
e5e27cc24685a5142ffe6310a9f8a7516260aaec
DrewHall1/CodeLouPythonGUIconverter
/example_image_converter.py
UTF-8
701
3.390625
3
[]
no_license
# code from https://www.geeksforgeeks.org/python-convert-image-to-pdf-using-img2pdf-module/ # Python3 program to convert image to pfd # using img2pdf library # importing necessary libraries import img2pdf from PIL import Image import os # storing image path img_path = "static/IMG_0296.JPG" # storing pdf path pdf_pat...
true
b1364de550518ce3a4c1d899445b3b6556d0c349
parvez-golam/Python
/Factorial.py
UTF-8
493
4.40625
4
[]
no_license
# ########################################## # # 1:Factorial # ########################################## # user input input_num = int(input("Enter a number:")) # Check if non negative number if input_num < 0: print("Enter a positive value") input_num = int(input("Enter a number:")) factorial = 1 ...
true
742eaf742fb9759832d60a2d195bd55848f53d55
JieliChen268/Firewall
/FirewallTest.py
UTF-8
3,902
2.75
3
[]
no_license
from unittest import TestCase from Firewall import Firewall import unittest class FirewallTest(TestCase): def setUp(self): self.fw = Firewall('/Users/jielichen/PycharmProjects/Firewall/fw.csv') #@unittest.skip def test_match(self): records = [ ['1','inbound', 'tcp', '80...
true
0e33fc027000e6567e63a7c16e9b7adbf0d524c4
hgkang9/TIL
/algo/컨테이너.py
UTF-8
540
2.65625
3
[]
no_license
import sys sys.stdin=open('컨테이너.txt','r') T=int(input()) for tc in range(1,T+1): N,M=map(int,input().split()) co=list(map(int,input().split())) tr=list(map(int,input().split())) co_check=[0]*N tr_check=[0]*M co.sort() co.reverse() tr.sort() tr.reverse() ans=0 for i in range(N...
true
1aef6c0638c5575a7c2a9385c663f158b4830b8a
milotr/studying-python-files
/Vowel Eater.py
UTF-8
379
3.9375
4
[]
no_license
# Prompt the user to enter a word # and assign it to the userWord variable. wordWithoutVovels = "" userWord = input("Enter a word for the vowel eater: ") userWord = userWord.upper() for letter in userWord: if letter in ('O','E','A','U','I'): continue wordWithoutVovels += letter print(wordWithoutVovels) ...
true
01f242eefdce81c80ddabfa4ba142e347ab92a09
thinxer/tau
/session_memcache.py
UTF-8
635
2.53125
3
[]
no_license
import memcache as memcache from web.session import Store class MemcacheStore(Store): def __init__(self, servers=['127.0.0.1:11211'], timeout=1440): self.mc = memcache.Client(servers) self.timeout = timeout def __contains__(self, key): return True if self.mc.get(key) else False de...
true
f4cf385d408e87021b595d4b91c6f8281a053817
hvdthong/sadl
/roc_curve.py
UTF-8
4,060
2.640625
3
[ "MIT" ]
permissive
import argparse from keras.datasets import mnist, cifar10 from utils import write_file from keras import utils from keras.models import load_model, Model import numpy as np from utils import load_file from sklearn import metrics import matplotlib.pyplot as plt from sklearn.metrics import roc_curve, auc from sklearn.met...
true