blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
e6122138c275a7ca084bb1ca0a6f3523a11a7775
Python
SimonFans/LeetCode
/Design/L716_Max_Stack.py
UTF-8
2,019
4.3125
4
[]
no_license
Design a max stack that supports push, pop, top, peekMax and popMax. push(x) -- Push element x onto stack. pop() -- Remove the element on top of the stack and return it. top() -- Get the element on the top. peekMax() -- Retrieve the maximum element in the stack. popMax() -- Retrieve the maximum element in the stack, a...
true
65519638472d945e59ebac62d7b48613add96684
Python
rettenls/ServerlessAggregation
/Generator/.~c9_invoke_HQovSy.py
UTF-8
6,527
2.703125
3
[]
no_license
# General Imports import random import json import hashlib import time import collections import uuid import sys from pprint import pprint # Multithreading import logging import threading # AWS Imports import boto3 # Project Imports sys.path.append("../Common") from functions import * from constants import * # Rand...
true
fa0d3e13e2afcbefd0906b59cb2a407ef7e53dbf
Python
Birathan/tableBuilder
/listHelper.py
UTF-8
837
4.6875
5
[]
no_license
def list_to_str(lis): '''(list of str) -> str This function returns the string representation of the list, with elements of list seperated by ','. >>> list_to_str(['a', 'b', 'c']) 'a, b, c' >>> list_to_str([' a', 'b ', ' c ']) ' a, b , c ' ''' text = '' for element...
true
0c0fc170a788fead63ea462920587d794656168a
Python
rchicoli/ispycode-python
/Operating-System-Modules/OS-Module/Get-File-Stat.py
UTF-8
407
2.625
3
[]
no_license
import stat import time import os f = "example.py" st = os.stat(f) mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime = st print("size: %s bytes" % size) print("owner: %s %s" % (uid,gid) ) print("created: %s" % time.ctime(ctime)) print("last accessed: %s" % time.ctime(atime)) print("last modified: %s" % time...
true
225a2126114d8ee5c936c8541c3e75a71917402f
Python
afcarl/python-tutorial-1
/week6/week6-hw-recursive.py
UTF-8
221
3.484375
3
[]
no_license
def printAll(depth, l): if depth == 0: print(' '.join(l)) return printAll(depth - 1, [] + l) printAll(depth - 1, [str(depth)] + l) while 1: printAll(int(input('How many number? ')), [])
true
b9845297700fef069fde6c364f256f91ca4e2311
Python
rrampage/udacity-code
/cs387/Problem Set 3/5.py
UTF-8
5,274
3.640625
4
[]
no_license
# cs387 ; Problem Set 3 ; 5 # HW3-5 Version 1 # For this assignment you will be given all of the public information # of a Diffie-Hellman key exchange plus the number of multiplications # necessary to calculate (g**b)**a mod p, given g**b where `a` is # Alice's private key and `b` is Bob's private key # # With this i...
true
7337aaaeb23281d7365154b6592f348c8ac4820b
Python
Lehcs-py/guppe
/Seção_05/Exercício_13.py
UTF-8
782
4.625
5
[]
no_license
print(""" 13. Faça um algoritmo que calcule A média ponderada das notas de 3 provas. A primeira e A segunda têm peso 1 e A terceira tem peso 2. Ao final, mostrar A média do aluno e indicar se o aluno foi aprovado ou reprovado. A nota para aprovação deve ser igual ou superior A 60 pontos. """) print('Intervalo: 0 ...
true
0a3e8310764a4a302735ebed8af1368ae21253ba
Python
IamUttamKumarRoy/python-start
/python_if_else.py
UTF-8
303
3.828125
4
[ "Apache-2.0" ]
permissive
amount=int(input("Enter amount: ")) if amount<1000: discount=amount*0.05 print ("Discount",discount) elif amount<5000: discount=amount*0.10 print ("Discount",discount) else: discount=amount*0.15 print ("Discount",discount) print ("Net payable:",amount-discount)
true
2ac93d40bd2db8f41fb5d920911543c7d37f154c
Python
Mithrilwoodrat/coffesploit
/src/coffesploit/core/helpmanager.py
UTF-8
1,109
2.875
3
[]
no_license
# -*- coding: utf-8 -*- class HelpManager(object): """class to print help informations help users use coffesploit""" def __init__(self): self.help_list = {"show": self.help_show, "use": self.help_use, "target": self.help_set_tartget } def...
true
7386438517633f0c8183f8d8648f2e769dfa86e1
Python
patback66/COEN169
/projects/project2/recs.py
UTF-8
34,745
2.8125
3
[]
no_license
#!/usr/bin python """ @author Matthew Koken <mkoken@scu.edu> @file recs.py This file takes tab delimited txt files for users and their movie ratings. Based on the users and ratings, recommendations are given. """ #pin 3224592822747566 import csv import math import sys as Sys import time import numpy # ...
true
11a47b5b4216a1f3222ce34c077fb91874bdfc1c
Python
kliner/funCode
/algs-py/TwoArraySumAboveQuery.py
UTF-8
811
3.5625
4
[ "MIT" ]
permissive
# two sorted array, from each choose one num, calc total count which sum >= query # [3,5,6], [4,9], 9 # return 2 def solve(arr1, arr2, q): l1, l2 = len(arr1), len(arr2) i, j = 0, l2 ans = 0 while i < l1 and j > 0: print i, j if arr1[i] + arr2[j-1] >= q: j-=1 else: ...
true
cd018201800cf336a04575d502de54ee05164db6
Python
josh-howes/tidymongo
/tidymongo/tools.py
UTF-8
3,014
2.78125
3
[]
no_license
import pandas as pd from collections import defaultdict from copy import deepcopy class TidyResult(object): def __init__(self, observational_unit): self.observational_unit = observational_unit self.collection_id = '{}_id'.format(self.observational_unit) self.ref_tables_ = defaultdict(list...
true
e0cefa79b312d62f73ce5e4e8a6719decabe2c31
Python
peterhinch/micropython-async
/v2/nec_ir/art.py
UTF-8
1,319
2.65625
3
[ "MIT" ]
permissive
# art.py Test program for IR remote control decoder aremote.py # Supports Pyboard and ESP8266 # Author: Peter Hinch # Copyright Peter Hinch 2017 Released under the MIT license # Run this to characterise a remote. from sys import platform import uasyncio as asyncio ESP32 = platform == 'esp32' or platform == 'esp32_Lo...
true
9d67eca4141f72ec5aa2b855a61b7e41c86481bc
Python
Hynus/Python
/AmzOnPageAna/amzpageana.py
UTF-8
13,518
2.53125
3
[]
no_license
# coding:utf-8 import urllib import urllib2 import Image import cStringIO import os from pyquery import PyQuery as pq # 指定并爬取特定页面—————————————————————————————————————————————————————— def get_the_url_page(pdt_asin, filename): url = "https://www.amazon.com/dp/" + pdt_asin user_agent = 'Mozilla/4.0 (compatible; ...
true
16aa58b665e30d66d0ba518f2fc1d0315a78d0b6
Python
AK-1121/code_extraction
/python/python_24731.py
UTF-8
134
2.953125
3
[]
no_license
# Numpy array, insert alternate rows of zeros a=np.zeros((982,5)) b=np.random.randint(0,100,(491,5)) # your 491 row matrix a[::2] = b
true
7609930727c471d1c060fb19b0d73072ef5f4882
Python
saurabhgangurde/EE677_VLSI_CAD
/Ramanpreet/path_finder.py
UTF-8
1,399
3
3
[]
no_license
from pyeda.inter import* #from RothAlgebra import RothVariable #Or(Xor(And(Not(Or(Or(And(a, b), c), d)), d), c), And(b, d)) Fanin=[None,None,None,None,[And,0,1],[Or,4,2],[And,5,3],[And,6,3]] Fanout=[[] for i in range(len(Fanin))] for i in range(len(Fanin)): #i is index of node for which Fanout is to be foun...
true
79b87f85b10a5a2f5b53b7a1b5af5d0cb498b446
Python
nnminh98/Routing-with-DeepRL
/Network_environment/env/Old_implenentations/testing.py
UTF-8
1,678
2.546875
3
[]
no_license
import random import functools import simpy from SimComponents import PacketGenerator, PacketSink, SwitchPort, RandomBrancher, Packet from Node import NetworkNode if __name__ == '__main__': env = simpy.Environment() mean_pkt_size = 100.0 # in bytes port_rate = 2.2 * 8 * mean_pkt_size adist1 = functo...
true
1a5f4e31abaec6402fb1779fae0ab23afc9c4b7c
Python
arita37/deeplearning
/theano/multi dim grid lstm to python.py
UTF-8
47,737
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ Torch to Theano Python grid-lstm-tensorflow Examples of using GridLSTM (and GridRNN in general) in tensorflow The GridRNN implementation in tensorflow is generic, in the sense that it supports multiple dimensions with various settings for input/output dimensions, priority dimensions and no...
true
d63e66101b10e34a045704b620158258beeb3b1f
Python
adrianna-andrzejewska/UMZ_ZALICZENIE
/Zestaw1_3.py
UTF-8
628
2.84375
3
[]
no_license
import pandas as pd # loading pandas library # loading data and changing float settings df_data = pd.read_csv( 'train.tsv', sep='\t', names=[ 'price', 'nr_rooms', 'meters', 'floors', 'location', 'description']) pd.options.display.float_format = '{:.2f}'.format # add csv file df_...
true
80347fc72b5b0ac5517f7ec95bed3bc26784ac81
Python
dersonf/aulaemvideo
/exercicios/ex089.py
UTF-8
733
3.796875
4
[]
no_license
#!/usr/bin/python36 ficha = [] cont = 'S' while cont != 'N': nome = str(input('Nome: ')) nota1 = float(input('Nota 1: ')) nota2 = float(input('Nota 2: ')) media = (nota1 + nota2) / 2 ficha.append([nome, [nota1, nota2], media]) cont = str(input('Deseja continuar? [S/N]')).upper().strip()[0] print...
true
9358597ab334356e6eb964bf484587843fc7e17a
Python
Aasthaengg/IBMdataset
/Python_codes/p03041/s658319623.py
UTF-8
96
2.5625
3
[]
no_license
n,k=list(map(int,input().split())) s=list(input()) s[k-1]=chr(ord(s[k-1])+32) print("".join(s))
true
611bf70295049e21a3c92190c323662086534d3d
Python
Seralpa/AdventOfCode2018
/day10/p1_p2.py
UTF-8
1,537
3.40625
3
[ "MIT" ]
permissive
import re import operator data = re.compile(r"position=< ?(-?[0-9]+), ?(-?[0-9]+)> velocity=< ?(-?[0-9]+), ?(-?[0-9]+)>") class Point: def __init__(self, pos: tuple[int, int], vel: tuple[int, int]): self.pos = pos self.vel = vel def move(self): self.pos = (self.pos[0] + self.vel[0], self.pos[1] + self.vel...
true
c9e853fbeac886d4b01c6151c9df91730cf2c7cb
Python
namratha-21/5003-assignment12
/5003-tuplelist.py
UTF-8
150
3.03125
3
[]
no_license
list =[("abc",93), ("mno",45), ("xyz",65)] dict1=dict() for student,score in list: dict1.setdefault(student, []).append(score) print(dict1)
true
66bcf69005a4000037e069a02613abb34a667b64
Python
kwon-o/projecteuler
/051-100/055.py
UTF-8
841
3.4375
3
[]
no_license
def deaching(int1): str_lst = list(str(int1)) lst = [] for i in str_lst: lst.append(int(i)) cnt = 0 for i in range(0,int(len(lst)/2)+1): if lst[i] == lst[len(lst)-1-i]: cnt += 1 else: return False break if cnt == int(len(lst)/2) + 1...
true
7902914a3628103ba075487eb6d6429deb161bf2
Python
45-Hrishi/Pandas-For-Data-Science
/12_Missing data.py
UTF-8
1,166
3.03125
3
[]
no_license
''' 1. Real world data will often be misssing data for a variety of reasons. 2. Many machine learning models and statistical methods can not work with missing data points ,in which case we need to decide what to do with the missing data. 3. When reading in missing values.pandas will display them as NaN valueds. 4. T...
true
5899d788d1d4bfea0b0144f39cf113c1b7853634
Python
Prismary/python
/bag simulator/bag-simulator.py
UTF-8
2,789
3.296875
3
[]
no_license
import ctypes ctypes.windll.kernel32.SetConsoleTitleW("Bag-Simulator by Prismary") print("---------------------------") print(" Bag-Simulator by Prismary") print("---------------------------") contents = [] try: readsave = open("bag.txt", "r") for line in readsave: contents.append(line.replace("\n", ""))...
true
478795cb884cdca1159c5956cc85bef7ee673860
Python
matsulib/cinema3-movies
/database/manage.py
UTF-8
551
2.5625
3
[]
no_license
import os import sys import json from urllib.parse import urlsplit from pymongo import MongoClient def delete_all(col): col.delete_many({}) def insert_data(col, data): col.insert_many(data) if __name__ == '__main__': url = os.getenv('MONGODB_URI', 'mongodb://localhost:27017/movies') db_name = urlsp...
true
4441b1db4f563439056060b0f9f9c23be8b49057
Python
sakthi/Kingdoms
/kingdoms/websetup.py
UTF-8
2,008
2.515625
3
[]
no_license
"""Setup the endless-insomnia application""" import logging, os, hashlib, datetime from sqlalchemy.orm.exc import NoResultFound from kingdoms.config.environment import load_environment from kingdoms.model import meta from kingdoms.model import Player, UnitTypeDescriptor log = logging.getLogger(__name__) def setup_a...
true
2ee9ef013762978955da9adc6b91d675d9b3557d
Python
DwaynesWorld/deeplearning
/basic/linear_regression_excercise.py
UTF-8
2,098
2.9375
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt import tensorflow as tf from sklearn.metrics import (mean_squared_error, classification_report) from sklearn.model_selection import train_test_split from sklearn.preprocessing import MinMaxScaler # Read Data housing_data = pd.read_csv('../__tensorf...
true
fde4188c0a4eb59aae61bc7dfaf3dda5970d3c0e
Python
aCoffeeYin/pyreco
/repoData/vimoutliner-vimoutliner/allPythonContent.py
UTF-8
108,049
2.859375
3
[]
no_license
__FILENAME__ = otl2html #!/usr/bin/python2 # otl2html.py # convert a tab-formatted outline from VIM to HTML # # Copyright 2001 Noel Henson All rights reserved # # ALPHA VERSION!!! ########################################################################### # Basic function # # This program accepts text o...
true
85feb2fc630fa3598bfd15a3debf5839b3f87571
Python
koallen/cz4071-project-1
/graph_analyzer/plot.py
UTF-8
5,477
2.671875
3
[]
no_license
import sys import matplotlib import matplotlib.pyplot as plt import matplotlib.colors as mcolors import networkx as nx import graph import pandas as pd import numpy as np import os import pickle import math def plot_curve(data, x_label, y_label, title, save_as, log=False, h_line=None, v_line=None): x = list(data.k...
true
807fc970073592ee0b15c5a8bb9d350d3c1c3976
Python
arinanda/huffman-code-implementation-webapps
/storage/compressor/huffman/adaptive_huffman/compress.py
UTF-8
1,008
2.75
3
[]
no_license
from common import util from huffman.adaptive_huffman.adaptive_huffman import * def encode(text): encoded_text = str() root = None null = Node('null', 0) node_list = dict() for char in text: if char in node_list: encoded_text += get_code(node_list[char]) node_list[c...
true
9087fc34a07550700b110fb6a52c0b74c3956d2e
Python
icavrak/SmartHomeSim
/PricingProfile_Dual.py
UTF-8
797
3.0625
3
[]
no_license
import datetime from PricingProfile import PricingProfile class PricingProfile_Dual(PricingProfile): def __init__(self): self.low_price = 1.0 self.high_price = 2.0 def __init__(self, init_arguments): arg_list = init_arguments.split(", ") self.low_price = float(arg_list[0]) ...
true
4a8bb6e21e4ec579a42f10de91942d08bb8509ad
Python
jugal13/Python_Lab
/Python Lab/Programs/Program4a.py
UTF-8
146
3.625
4
[]
no_license
def Initials(name): return ''.join(list(map(lambda x:x[0],name.split()))) name=input("Enter full name: ") print("Initials are: "+Initials(name))
true
45a4ea8f7b8b928083cb873e565b513850f9f38b
Python
minhntm/algorithm-in-python
/datastructures/tree/challenge2_find_kth_maximum.py
UTF-8
933
4.125
4
[ "MIT" ]
permissive
""" Problem Statement: - Implement a function findKthMax(root,k) which will take a BST and any number “k” as an input and return kth maximum number from that tree. Output: - Returns kth maximum value from the given tree Sample Input: bst = { 6 -> 4,9 4 -> 2,5 9 -> 8,12 12 -> 10,...
true
5e415c04f92fd542da428d890bdf4dcaf70355da
Python
JordanRussell3030/Farm_Simulation
/cow_class.py
UTF-8
352
3.53125
4
[]
no_license
from animal_class import * class Cow(Animal): def __init__(self): super().__init__(1, 5, 4) self._type = "Cow" def grow(self, food, water): if food >= self._food_need and water >= self._water_need: self._weight += self._growth_rate self._days_growing += 1 ...
true
81e9a86ede649ff1a479f6061896b33b07c6a140
Python
DouglasMartins1999/WorldHunting
/database/Words.py
UTF-8
11,848
2.875
3
[]
no_license
countries = [] countries.append({ "name": "França", "categories": { "easy": [ ["Paris", "Capital francesa"], ["Euro", "Moeda em circulação na França"], ["Torre Eiffel", "Popular torre erguida na capital do país"], ["Louvre", "Museu mais popular"], ...
true
83ad4939afc767f8886bacf66d68e931215e4bed
Python
anandi24/PythonGames
/src/BullsAndCows/BullsAndCows.py
UTF-8
1,604
3.90625
4
[]
no_license
import pandas as pd import numpy as np import random def main(): print("Firstly, input the length of the sequence to be stored in memory") print("Secondly, keep guessing the number stored in memory. Note: Every guess should be of the same length sequence as declared in step 1") print("Keep guessing till yo...
true
ff09bfde71fa3640bcebf6a19a302bed9d372adf
Python
khanhvu11/make-appointments-skill
/__init__.py
UTF-8
10,599
2.5625
3
[]
no_license
from mycroft import MycroftSkill, intent_handler from adapt.intent import IntentBuilder from mycroft.util.parse import extract_datetime from mycroft.util.time import now_local, default_timezone import caldav from caldav.elements import dav from datetime import datetime, timedelta import json import pytz from icalendar...
true
b965e247e6b792e94b6ee0cbd0c3a4257dedede1
Python
charankk21/KittyBank
/kittyTempWork.py
UTF-8
4,713
3.109375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Nov 14 06:27:57 2018 @author: Charan """ import pandas as pd transactions = pd.DataFrame() customerProfile = pd.DataFrame() def inititalizeTransaction_df(): global transactions print('Initalizing the Kitty Bank') dict2 = {'Custid':[101,102,103,10...
true
b0e67e307f81ab4589084ec4bff6ff1c3dd2477c
Python
olavobacelar/spens-data-completion
/src/dataset.py
UTF-8
8,944
2.984375
3
[ "MIT" ]
permissive
# Preparar os dados no __init__ para ser mais fácil depois. # import pandas as pd import numpy as np import numpy.random as rd import random from typing import Union import torch from dataclasses import dataclass, astuple from torch.utils.data import Dataset, DataLoader N_LETTERS = 26 # tirar daqui, prec...
true
4c8722eeaa5d5cb72991b78f702dac4183d5578c
Python
adityaskarnik/algorithms
/Bubble Sort/bubble_sort.py
UTF-8
644
4.3125
4
[]
no_license
def bubbleSort(itemList): moreSwaps = True counter = 0 while moreSwaps: counter = counter + 1 print("Iteration number",counter) moreSwaps = False for element in range(len(itemList)-1): if itemList[element] > itemList[element+1]: moreSwaps = True ...
true
30e8ee351b8ebf2b38af2ef7a452eee5e8f4581c
Python
EduardoArgenti/Python
/CursoEmVideo/ex039.py
UTF-8
634
4.125
4
[ "MIT" ]
permissive
# Faça um programa que leia o ano de nascimento de um jovem e informe, # de acordo com sua idade: # - Se ele ainda vai se alistar ao serviço militar # - Se é a hora de se alistar # - Se já passou do tempo do alistamento # - Seu programa também deverá mostrar o tempo que falta ou que # passou do prazo from datetime impo...
true
4a4140adeaf59f48cf4dfb0f89ca1423e1f2310a
Python
nbanion/money
/money/category.py
UTF-8
8,029
3.828125
4
[]
no_license
"""Utilities for categorizing transactions. This module provides functionality for categorizing series__ of transactions using regex-based categorization schemes and index-specific manual edits. It is useful for categorizing transactions and for validating categorizations. __ https://pandas.pydata.org/pandas-docs/sta...
true
bced7f810bbc828266f8465cf7a4a055db43e450
Python
msrosenberg/TaxonomyMonographBuilder
/TMB_Create_Graphs.py
UTF-8
11,659
2.984375
3
[]
no_license
""" Module containing the various graph and chart drawing algorithms (except for those related to maps) """ # external dependencies from typing import Optional import matplotlib.pyplot as mplpy import matplotlib.ticker from wordcloud import WordCloud __TMP_PATH__ = "temp/" # my approximation of the pygal color scheme...
true
9d6a559c94c0f75967057a24a75b2c96fed76a20
Python
kiran-kotresh/Python-code
/pop_growth.py
UTF-8
143
2.890625
3
[]
no_license
def nb_year(p0, percent, aug, p): current=p0 n=0 while(current<p): current=current+current*(percent*0.01)+aug n+=1 print(n)
true
21f112f9fdd71c727912073487ff0a50ff7d8a22
Python
quvinh/pythoncb
/baitap3.py
UTF-8
296
3.03125
3
[]
no_license
n = int(input("Nhap so phan tu:")) lt = list() for i in range(n): x = int(input("Nhap phan tu thu %d :"%(i+1))) lt.append(x) s = 0 for i in lt: s += i f = open("file.txt","w") f.write(str(lt)) f.write("tong :%d"%s) f.close() f = open("file.txt","r") print(f.read())
true
4866e717ad1c80707aa245618ebc9776758bf6f6
Python
zzc558/SpectralClusterNetflex
/clustering.py
UTF-8
2,226
2.921875
3
[]
no_license
#!/usr/bin/env python3 from dataPreprocess import laplacian import numpy as np import scipy as sp from sklearn.cluster import KMeans import matplotlib.pyplot as plt def clustering(matrix, k, movieIndex): eValue, eVector = sp.sparse.linalg.eigs(matrix, k, which='SM') # get rid of the movie nodes count = 0 ...
true
4f181325c1ac81fb9668a166d3aa1883e34f30b5
Python
rezo8/LyricClassifier
/song.py
UTF-8
7,021
2.890625
3
[]
no_license
import spotifyclient import pickle as pickle from nltk.tokenize import word_tokenize import os import nltk import numpy as np import scipy GENRES = [ 'folk', 'rap', 'rock', 'r&b', 'country', 'blues' ] class Song(object): """ Object containing the lyrics to a single song Attributes: lyrics: str...
true
73d91f5c793268e7dc0b6ccb99ce1d68ef20449c
Python
mpreddy960/pythonPROJECTnew
/range.py
UTF-8
34
2.984375
3
[]
no_license
for i in range(1,23): print(i)
true
31ee8b4b28d5fa4bd2db68c4df9465274ab3dbaa
Python
apalevich/PyMentor
/01_reminder_dates.py
UTF-8
3,481
4.28125
4
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- """ This is an exercise maintained with my mentor Zcho05. The exercise contains function called create_message() that returns a message about some reminder. For example: >>> create_message((2, 4, 6, 7,)) 'Мы оповестим вас о предстоящих событиях за 2, 4, 6 и 7 дней' """ def ...
true
de5d784f1c98723db35f425782de8236e1c66dc1
Python
nobita44/CIP2021_tkinterQuiz
/main.py
UTF-8
4,927
3.71875
4
[]
no_license
# Python program to create a simple GUI # Simple Quiz using Tkinter # import everything from tkinter from tkinter import * # and import messagebox as mb from tkinter from tkinter import messagebox as mb # import json to use json file for data import json # class to define the components of the GUI class Quiz: ...
true
618e229be5f7a32fc8823218e522f597e4c9e9b0
Python
peterwilliams97/blank
/make_page_corpus.py
UTF-8
10,290
2.640625
3
[ "MIT" ]
permissive
""" PDF to text conversion """ import os from glob import glob from collections import defaultdict, OrderedDict import hashlib from subprocess import CalledProcessError, Popen, PIPE import re from utils_peter import pdf_dir, summary_dir, save_json from html_to_text import update_summary import json KBYTE = 1024 M...
true
8a3dd94a7898bc65dd67c3d5912a76be4ed1abd5
Python
kotaYkw/web_scraping_samples
/javascriptsample.py
UTF-8
722
2.65625
3
[]
no_license
import requests from bs4 import BeautifulSoup url ='http://www.webscrapingfordatascience.com/simplejavascript/' r = requests.get(url) html_soup = BeautifulSoup(r.text, 'html.parser') # ここにタグは含まれていない ul_tag = html_soup.find('ul') print(ul_tag) # JavaScriptのこーどを表示する script_tag = html_soup.find('script', ...
true
41133b2b7a4d9cfbd1eae8832a07585cc4f604bc
Python
webclinic017/aqua
/src/aqua/security/stock.py
UTF-8
671
3.53125
4
[]
no_license
""" Defines a stock contract """ from aqua.security.security import Security class Stock(Security): """ A stock represents a share of a company or index. We assume that it can be uniquely defined by a symbol (ticker). """ def __init__(self, symbol: str) -> None: self.symbol = symbol.uppe...
true
4980d6a9bda50932dfb6439d0f38e7cfca3bc170
Python
cse442-at-ub/cse442-semester-project-indra-infared-remote-access
/RaspberryPi/util/pi_lirc.py
UTF-8
4,823
2.5625
3
[]
no_license
from subprocess import check_output import shutil import dbus import time import os from threading import Thread from queue import Queue LIRC_CONF_DIR = '/etc/lirc/lircd.conf.d' def send_ir_signal(remote_name:str, button:str, method:str="ONCE", device:str=None) -> bool: """Sends an IR signal with LIRC. A...
true
26a055f95853e218e7ad5425bcd71f89848f0d12
Python
weiiiiweiiii/BreakSpace
/spacebreakerlib/ScrollbarXY.py
UTF-8
845
3.21875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: Liangze Yu """ import tkinter as tk class ScrollbarXY: def __init__(self,textArea): #pack with Window self.__root = textArea.master #function aligned to Text self.__textArea = textArea self.__xScrollbar() ...
true
c6424c89aff12786212667ea046e8d8b702716dd
Python
georgetao/comp-programming
/beads.py
UTF-8
828
3.453125
3
[]
no_license
""" ID: georget2 LANG: PYTHON3 TASK: beads """ import sys with open("beads.in", "r") as fin: n = int(fin.readline()) beads = fin.readline().replace("\n", "") def longest_beads(n, beads): curr_char = "" prev = 0 curr = 0 longest = 0 tail_whites = 0 newStreak = False for _ in range(2): for c in beads: if ...
true
0cbe8f5588e8343644fb6af1bcc0b24c180649cd
Python
shkumagai/pyside-sandbox
/sample_ghost.py
UTF-8
495
2.53125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python import logging import ghost def main(url, output_path): g = ghost.Ghost() with g.start(display=True, viewport_size=(1366, 800)) as session: res = session.open(url, timeout=30) print(res) if __name__ == '__main__': url = 'http://www.google.com/' output_path = 'c...
true
93db1c4546a65d0ed8fd0476d861886e7f65e689
Python
perikain/Pruebas
/upd1.py
UTF-8
454
3.09375
3
[]
no_license
#!/usr/bin/env python #!-*- coding: utf-8 -*- import socket host = "192.168.56.1" port = 12345 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind((host,port)) s.settimeout(5) #añade una espera de 5 segundos, sólo entonces muestra el mensade error. data, addr = s.recvfrom(1024) #recvfrom devue...
true
e9c394ec9aaacc947ee2578e1920202417963867
Python
RahulJain7/Openmodelica-Thermodynamic-Engine
/PythonFiles/UNIQUAC.py
UTF-8
921
2.640625
3
[]
no_license
import csv Compound = [] A12 = [] A21 = [] alpha = [] with open("UNIFAC.csv") as csvfile: csvreader = csv.reader(csvfile,delimiter=',') for row in csvreader: Comp1 = row[2] Comp1 = Comp1.capitalize() Comp1 = Comp1.strip(" ") Comp2 = row[3] Comp2 = Comp2.capitalize() ...
true
4980500d446bc774f7c00abe2bb0543fdbe1cf66
Python
wsustcid/Udacity-Self-Driving-Car-Engineer-Nanodegree
/Term1/Scripts/02.[Project] Finding Lane Lines/4_color_selection.py
UTF-8
1,736
3.28125
3
[]
no_license
''' @Author: Shuai Wang @Github: https://github.com/wsustcid @Version: 1.0.0 @Date: 2020-03-26 11:45:38 @LastEditTime: 2020-04-02 11:26:00 ''' import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np # Read in the image image = mpimg.imread('lane.jpg') print('This image is: ',...
true
f0343f86e207f2c0a7e8898faeb52d2d656288af
Python
danyontb/ProgrammingPortfolio
/Classes/pyramid.py
UTF-8
302
3.25
3
[]
no_license
class pyramid: import math l = input('Enter in a length:') w = input('Enter in a width:') h = input('Enter in a height:') L = int(l) W = int(w) H= int(h) print('volume: ', (L*W*H)/3) print('surface area: ', L*W+L*math.sqrt(((W*W)/4)+H*H)+W*math.sqrt(((L*L)/4)+H*H))
true
988ef3f265aa445e72e52a39e1e08bb543e14349
Python
CXOldStar/lorawanprotocol
/lorawanprotocol/assert_judge.py
UTF-8
644
2.546875
3
[ "MIT" ]
permissive
from .customer_error import AssertError class AssertJudge: @staticmethod def assert_nwkskey(nwkskey): if not (isinstance(nwkskey, bytes) and len(nwkskey) == 16): raise AssertError('NwkSKey', 'NwkSKey must be a 16 bytes data.') @staticmethod def assert_appskey(appskey): if n...
true
d9611a5577f39f2956102aea79c478f3d27aaa95
Python
abdallawi/PythonBasic
/python-standard-lib/WorkingWithPaths.py
UTF-8
2,802
4.09375
4
[]
no_license
from pathlib import Path # Makes sense: new_line = '\n' # When you wanna work with files and directories, # you will need a Path object that represents where that file or directory lives. # Here are 2 examples that show the difference between a Unix and a Windows folder hierarchy: # Unix: /home/elliot/Desk...
true
df525b01a7037dc73a9e286223ef7e29977b6610
Python
chakshujain/Python-projects
/Whatsapp_automation.py
UTF-8
665
2.90625
3
[]
no_license
from selenium import webdriver driver = webdriver.Chrome() driver.get('https://web.whatsapp.com/') nameslist = list(map(str,input("Enter names of users you wanna send message: ").split())) msg = input("Enter message: ") count = int(input("How many times you wanna send: ")) input("Enter any key after scanning code") ...
true
d36258c11914ca73f7e2bb3c99e8c38c053c6fa5
Python
lolizz00/JESD
/ConsoleApp.py
UTF-8
8,571
2.953125
3
[]
no_license
from JESDdriver import JESD import sys from version import version_logo class ConsoleApp: def __init__(self): self.dev = JESD() def outError(self): sys.stdout.write('Wrong args!') def handleArgs(self, argv): # вывод помощи, копипаст из README if argv[0] == '-h' or argv[...
true
c3b9d8ddd9d30c182aea5ed3735e2d1ba95c7761
Python
duykienvp/sigspatial-2021-quantify-voi-of-trajectories
/pup/common/information_gain.py
UTF-8
506
3.671875
4
[ "MIT" ]
permissive
# Calculate Information Gain import logging import numpy as np logger = logging.getLogger(__name__) def calculate_differential_entropy_norm(sigma, base=2) -> float: """ Differential entropy of a normal distribution with standard deviation sigma is: 0.5log(2*pi*e*sigma*sigma) :param sigma: standard deviati...
true
35a59bbd5bafdd69409557d304a26fe5c3057a1e
Python
yangyu57587720/kindergarten
/apps/users/models.py
UTF-8
2,571
2.640625
3
[]
no_license
"""用户相关的模型表""" from django.db import models from django.contrib.auth.models import AbstractUser # 导入auth-user模块 from datetime import datetime class UserProfile(AbstractUser): """继承django模块AbstractBaseUser并扩展""" nick_name = models.CharField(max_length=32, default="", verbose_name="昵称") # null针对数据库字段可以为...
true
801e71f9964f702b756a558ecc2c0c7d57421e66
Python
singhalsrishty/pythonEthans
/29March_assignment.py
UTF-8
6,924
4.40625
4
[]
no_license
''' 1. Write a program which can compute the factorial of a give numbers. The results should be printed in a comma-separated sequence on a single line. Suppose the following input is supplied to the program: 8 Then, the output should be: 40320 ''' def factorial(num): fact = 1; if num == 0: return fact...
true
a30b833a2b5ea85ddaa61ccf77832a724af5dd50
Python
AdamPellot/AutomateTheBoringStuffProjects
/Ch16/autoUnsub.py
UTF-8
1,229
2.765625
3
[ "MIT" ]
permissive
#! python3 # autoUnsub.py - Scans through your email account, finds all the # unsubscribe links in all your emails, and automatically # opens them in a browser. # Adam Pellot import bs4 import imapclient import pyzmail import webbrowser print('Enter your email address:') myEmail = input(...
true
c8903005a4f320d81e6a51d1806d4043878cd4be
Python
laxmanbudihal/Selenium
/open-close.py
UTF-8
544
2.9375
3
[]
no_license
from selenium import webdriver import os if 'chromedriver.exe' in os.listdir(): # platform independent use os module x = os.path.join(os.getcwd(), 'chromedriver.exe') print(x) driver = webdriver.Chrome(x) else: # if chrome driver is not found print('Warning : chrome binaries missing...
true
5406cbc623165068791fc63e6ec23b5802616be5
Python
deenaariff/Weave-Client
/RestClient/helpers/dockerCluster.py
UTF-8
3,370
2.546875
3
[]
no_license
import dataHelper as dh import time, sys, os import docker import shutil class Cluster: def __init__(self, configs, docker_image): self.docker_ip = "192.168.99.100" self.docker_image = docker_image; self.routes = [] self.client = docker.from_env() self.containers = [] ...
true
614fa8d31eae7b19580fe23e1ac2e748ce8385a3
Python
HongbinW/learn_python
/learn_python/名片管理/cards_main.py
UTF-8
817
3.09375
3
[]
no_license
import cars_tools while True: # TODO 显示功能菜单 cars_tools.show_menu() action_str = input("请选择要执行的操作:") print("您选择的操作是【%s】" % action_str) # 1,2,3针对名片的操作 # 0退出新四通 # 其他输入错误,并提示用户 if action_str in ["1","2","3"]: if action_str =="1": cars_tools.new_card() elif action_str =="2": cars_tools.show_all() el...
true
d0092bd2dc93be4e4a040182a46fc8c4114814a1
Python
xczhang07/Python
/third_party_libs/python_memcached.py
UTF-8
2,003
2.9375
3
[]
no_license
# concept of memcached: high-performance, distributed memory object caching system. # official site: https://memcached.org # how to install: on mac os: brew install memcached # install python library (client app) to interact with memcached server: pip install pymemcache ''' after install memcached on your device, let u...
true
22d008471f29f1c1b71643b0382d331500109143
Python
lautarianoo/LautAvito
/cities/models.py
UTF-8
1,120
2.578125
3
[ "BSD-3-Clause" ]
permissive
from django.db import models class City(models.Model): title = models.CharField(verbose_name='Название города', max_length=100) def __str__(self): return self.title class Meta: verbose_name = 'Город' verbose_name_plural = 'Города' class District(models.Model): title = model...
true
1cd2f86e9ce899d12fe48a54287633175e0b027b
Python
luzifi/CREDIT-RISK-2020B
/src/classwork/industry-crawler/models.py
UTF-8
4,079
2.734375
3
[ "MIT" ]
permissive
import json from typing import List import requests from bs4 import BeautifulSoup class AbstractIndustry: def __init__(self, title: str, children: List['AbstractIndustry']): self.title = title self.children = children def __repr__(self): return f"<{self.level}, {self.title}>" @...
true
0a95a75c2c44240a0588a85d1f4451c28a44bf35
Python
jawhelan/PyCharm
/PyLearn/Exercise Files/Treehouse/split and join.py
UTF-8
432
3.53125
4
[]
no_license
full_name = "james Whelan" # split full name "James Whale" into "James", "whelan" name_list = full_name.split() greeting_var="hello my name is tim" #split string "hello my name is tim" to "hello", "my"," name", "is", "tim" greeting_list = greeting_var.split() # swap out the name tim with james greeting_list[4] =...
true
4644782b7e7d940bec7d266d29d07a532fa79771
Python
michaeltrimm/python-notes
/memory.py
UTF-8
1,298
3.234375
3
[]
no_license
#!/usr/local/bin/python3 import resource import sys """ List Squaring numbers 1 to 10,000,000 Before: 7.312Mb After: 332.539Mb Consumed = 325.22Mb memory Generator Squaring numbers 1 to 10,000,000 Before: 332.543Mb After: 332.543Mb Consumed = 0.0Mb memory """ # Size of the sample set to = 10000000 # 10...
true
68919dce6728c9371f12037f9b63f1894d9b5ff0
Python
zuxinlin/leetcode
/leetcode/121.BestTimeToBuyAndSellStock.py
UTF-8
996
3.96875
4
[]
no_license
#! /usr/bin/env python # coding: utf-8 ''' 题目: 买卖股票的最佳时机 https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/ 主题: array & dynamic programming 解题思路: 状态转移方程:dp[i] = max(dp[i-1], prices[i] - min),表示当前到i最大利润 ''' class Solution(object): def maxProfit(self, prices): ''' :type prices: List...
true
7fc24b3261634c344c0218a74b4b0bbbcf1dd395
Python
nikkureev/bioinformatics
/ДЗ 15/Task 15.3.py
UTF-8
279
3.078125
3
[]
no_license
mport re file = 'C:/Python/2430AD.txt' # This one will help you to obtain all a-containing words def a_finder(inp): with open(inp, 'r') as f: for lines in f: for i in re.findall('/\b[\w+]*a[\w+]*\b/gi', lines): print(i) a_finder(file)
true
b3f6c8bb6ea51dc56cee3bd5934b6f114e56cad5
Python
mudits89/Just_Analytics_Test
/just_analytics__linked_list.py
UTF-8
2,668
3.875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Sep 30 08:53:28 2018 @author: mudit """ class Node: def __init__(self, data, nextNode=None): self.data = data self.nextNode = nextNode def getData(self): return self.data def setData(self, val): self.data = val ...
true
63207141aa5149358c23a5d065e344fc1f4d317d
Python
ShivaBasava/Letsupgrade_WeeklyCodeBattle
/Week13/app.py
UTF-8
3,807
4.40625
4
[ "MIT" ]
permissive
''' Solution to WEEKLY CODE BATTLE - WEEK 13 NOTE: This 'app.py' file, contains the following- 1] Solution:- To the WEEKLY CODE BATTLE:- WEEK 13, A Language Translator. 2] Code & Explaination:- to the written code, line-by-line as comments. 3] Example Output 1] Solution- a] We have made us...
true
979ead30158ba9533187ab8976f364fb2820be3d
Python
nima-m-git/exercism-python
/sieve/sieve.py
UTF-8
199
3.171875
3
[]
no_license
def primes(limit): all = list(range(2, limit+1)) for i in all: for x in range(2, round(limit/i)+1): if (i*x) in all: all.remove(i*x) return all
true
9a185a70bed9931e4fd2ed380bbd9aacbad798e5
Python
rdotlee/hologram-python
/scripts/examples/example-sms-csrpsk.py
UTF-8
1,127
2.796875
3
[ "MIT" ]
permissive
# # example-sms-csrpsk.py - Example of sending SMS via CSRPSK Authentication in the Hologram Python SDK # # Author: Hologram <support@hologram.io> # # Copyright 2016 - Hologram (Konekt, Inc.) # # LICENSE: Distributed under the terms of the MIT License # import sys sys.path.append(".") sys.path.append("..") sys.path.a...
true
ca4ee49ef2cb2621ee692e5da8a5d5cf02d63c84
Python
irisqul/cryptopals-excercise
/set1/base64_hex.py
UTF-8
257
2.6875
3
[ "Apache-2.0" ]
permissive
from binascii import hexlify, unhexlify from base64 import b64encode, b64decode hex_string = '49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d' b64_string = b64encode(unhexlify(hex_string)) print(b64_string)
true
8534a790d4d8178f1fc185c13233fcf1b1eb9fd2
Python
zyzisyz/LeetCode
/py/0034.py
UTF-8
377
3.171875
3
[]
no_license
class Solution: def searchRange(self, nums: List[int], target: int) -> List[int]: try: length = len(nums) first = nums.index(target) second = first while second+1 < length and nums[second+1] == target: second = second + 1 return [fi...
true
f7d8b61754a08da4f834782553ea3e7557ba09ff
Python
gssgch/gssgML
/com.ch/python/pythonCourse/chapter7/QueneTest.py
UTF-8
1,173
3.703125
4
[]
no_license
#!/usr/bin/python # encoding:utf-8 # 利用python实现queue class queue: def __init__(self, size=20): self.size = size self.queue = [] self.end = -1 def setsize(self, size): self.size = size def In(self, n): if self.end < self.size - 1: self.queue.append(n) ...
true
3a9f801a0f05ba1be1d0ebee0f333879694986e1
Python
giddy123/raspberry-pi-robotics
/servocontrol.py
UTF-8
2,544
3.109375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # Servo Control for Raspberry Pi with Adafruit servo control board # Created by Dmitriy Buslovich #------------------------------------------------------------------------------- #### Imports #### # Download this file from github: https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blo...
true
b55d5f86cdec95574fa521a4bccac3a56774eabe
Python
8Michelle/edward
/handlers/tasks.py
UTF-8
9,189
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- """This module contains handlers for tasks. Task interface supports starting a new task and ending current one, starting new session, checking today working time, current date and all data. """ from aiogram import types import datetime import asyncio from core import dp, States, bot, KEYBOARD...
true
8362128b5b0b981487a8cceeb829d0f03caa0336
Python
Hemie143/automatetheboringstuff
/ch17_keeping_time/ex04_convert.py
UTF-8
828
3.375
3
[]
no_license
import datetime oct21st = datetime.datetime(2019, 10, 21, 16, 29, 0) print(oct21st.strftime('%Y/%m/%d %H:%M:%S')) # '2019/10/21 16:29:00' print(oct21st.strftime('%I:%M %p')) # '04:29 PM' print(oct21st.strftime("%B of '%y")) # "Octob...
true
0a7f75292678b205f770287a8e98dfff8553d4b0
Python
walid-shalaby/knowledge-based-dimensionality-reduction
/code/python/ng20/ng20_vocabulary_builder.py
UTF-8
22,250
3.015625
3
[]
no_license
## 20ng Vocabulary Builder # Build stemmed and lemmatized vocabulary (unigrams + bigrams) from 20ng corpus and store into DB def build_vocabulary(corpus,tokenizer,stop_words,max_ngram_size,min_df,min_tf): from sklearn.feature_extraction.text import CountVectorizer from ng20_globals import max_df # tok...
true
dff71182388a15d57244452aebd9657812636943
Python
NTHU-CS50-2020/week6
/107062104/readability.py
UTF-8
635
3.734375
4
[]
no_license
from cs50 import get_string def main(): text = get_string('Text: ') print(GradeCal(text)) def GradeCal(text): letters = 0 words = 1 if text else 0 sentences = 0 for letter in text: letters += 1 if letter.isalpha() else 0 words += 1 if letter.isspace() else 0 sentences...
true
a3ab7b94874b2ab2fe04f47b7304eccfb3ce50ae
Python
MrCat9/Python_Note
/55_proxy_ip.py
UTF-8
1,031
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- # 配合使用 https://github.com/qiyeboy/IPProxyPool # 需先开启代理IP的服务 import requests import json from random import sample def get_proxy_ip(url_str): """ 获取代理IP 返回一个 tuple (ip, port) :param url_str: 代理IP接口 :return: (ip, port) <class 'tuple'> """ r = requests.get(url_str)...
true
66581051b01da95e0f0dcfe1eb4f09388060b07c
Python
qiupinghe/BTH-TE2502-MasterThesis
/normality_tests.py
UTF-8
53,562
2.546875
3
[]
no_license
from itertools import islice import statistics import numpy import math import PyGnuplot as gp from scipy.stats import sem, t from scipy import mean, median, stats import sys from numpy.random import seed from numpy.random import randn from numpy import mean from numpy import std from matplotlib import pyplot from sta...
true
8094beb6206722ad86c33fb9d7ae3b52e07d7ea3
Python
coffeemakr/python-thr
/thr/utils.py
UTF-8
724
3.34375
3
[ "Unlicense" ]
permissive
import hmac EMAIL_HMAC_KEY = b'0\xa5P\x0f\xed\x97\x01\xfam\xef\xdba\x08A\x90\x0f\xeb\xb8\xe40\x88\x1fz\xd8\x16\x82bd\xec\t\xba\xd7' PHONE_HMAC_KEY = b'\x85\xad\xf8"iS\xf3\xd9l\xfd]\t\xbf)U^\xb9U\xfc\xd8\xaa^\xc4\xf9\xfc\xd8i\xe2X7\x07#' def _hmac_sha256_hex(key, msg): h = hmac.new(key=key, digestmod='sha256') ...
true
028530cb0de539eaf3a874ffb5197351a9e75ea8
Python
diverse-project/varylatex
/vary/model/files/directory.py
UTF-8
1,529
2.59375
3
[]
no_license
import os import shutil import time from pathlib import Path def clear_directory(path): """ Removes the content of a directory without removing the directory itself """ for root, dirs, files in os.walk(path): for f in files: os.unlink(os.path.join(root, f)) for d in dirs: ...
true
e900ae1c01cde3cc20cd4a387cee03532d04700c
Python
srinivasanprashant/Bachelors-degrees-women-USA
/data-analysis.py
UTF-8
7,994
3.765625
4
[]
no_license
import pandas as pd import matplotlib.pyplot as plt women_degrees = pd.read_csv('percent-bachelors-degrees-women-usa.csv') # fig, ax = plt.subplots() # ax.plot(women_degrees['Year'], women_degrees['Biology'], label='Women') # ax.plot(women_degrees['Year'], 100-women_degrees['Biology'], label='Men') # # customize the...
true
58344b304457457eee97093ae4618173cd000088
Python
Yaskeir/Python
/cartesianToSpherical.py
UTF-8
1,358
4.59375
5
[]
no_license
import math # start with the cartesian input print("Please provide the x, y and z coordinates:") cartesianX = float(input("x: ")) cartesianY = float(input("y: ")) cartesianZ = float(input("z: ")) # define two separate recalculation functions so that they can be re-used in other code def cartesianToSpherical(x, y, ...
true
f1bd97c9a0d37e14c3582e7b143dc215626bb4ce
Python
Dm1triiy/stepik
/512.Python.Advanced/3.3.1.py
UTF-8
394
2.96875
3
[]
no_license
import requests import re source = requests.get(input().strip()) target_url = input().strip() urls = [] step_status = False if source.status_code == 200: urls = re.findall(r'href="(.+?)"', source.text) for url in urls: page = requests.get(url) if page.status_code == 200: if target_url in page.te...
true