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
ffc069fa663c70246b55d04771b3fded4b971ad0
Python
bozbalci/ceng435
/part_two/stats.py
UTF-8
2,090
2.953125
3
[]
no_license
import json import matplotlib.pyplot as plt import numpy as np import scipy.stats def mean_confidence_interval(data, confidence=0.95): """ Copied from https://stackoverflow.com/questions/15033511/compute-a-confidence-interval-from-sample-data """ a = 1.0 * np.array(data) n = len(a) m, se = np...
true
2443d3ccccf852b432daa780940d93a440fe57d8
Python
jibespanola/fastapi-stockscreenerapp
/test_yfinance.py
UTF-8
84
2.890625
3
[]
no_license
import yfinance as yf msft = yf.Ticker("MSFT") #Prints stock info print(msft.info)
true
4870bce3905e6c4fb097d0cde1eaf24e334698e0
Python
DoomwareSoftwareSolutions/playground
/apps/authentication/tests.py
UTF-8
5,249
2.65625
3
[]
no_license
from django.test import TestCase from apps.authentication.models import User class UserTest(TestCase): def testUsersRawCreation(self): u = User(username = "hello", hashedID = "123452", email = "hello@hello.com") u2 = User(username = "hello2", hashedID = "123452", email = "hello2@hello.com") u.save() U = User...
true
08cdd3f69142441442fdda4383345cc4b346618b
Python
geniustesda/my-project
/python_crawl/city_weather/city_list.py
UTF-8
430
2.6875
3
[]
no_license
# -*- coding: utf-8 -*- ''' 简单的爬取城市列表,有一些地名没有更新 ''' import requests from lxml import etree r = requests.get("http://www.52maps.com/china_city.php#0") html = etree.HTML(r.content) content = html.xpath('.//*[@class="col-md-12"]/a/text()') for i in content: i = i.encode("utf-8") if i != None: f = open("...
true
3ea87a645d66ad84ebaffa2fee6eb94df84cd11e
Python
PerlMonker303/py-sockets-chat-app
/server3.py
UTF-8
10,079
2.53125
3
[]
no_license
import struct import socket import ctypes import sys import threading import select ''' - server receives TCP connections from clients to register them - create a thread for receiving messages from clients - for each new client the server will ping all other clients - for each client who leaves the server -...
true
541f2372cfdb89bb9a3c1d02e905df41ff37c181
Python
Imajon/Egg-V2
/scripts/tools/servo.py
UTF-8
513
2.984375
3
[]
no_license
# Servo Control import time def set(property, value): try : f = open("/sys/class/rpi-pwm/pwm0/" + property, 'w') f.write(value) f.c lose() except: print("Error writing to: " + property + " value: " + value) def setServo(angle): set("servo", str(angle)) set("delayed", "0") set("mode", "servo") set("servo_max", "180") se...
true
8b0fc84f1ed27e20dbc289efcfaa00693b626875
Python
pombredanne/pandaslite
/pandaslite/stats.py
UTF-8
421
3.265625
3
[ "BSD-3-Clause" ]
permissive
import math def is_numeric(x): try: for i in x: float(i) return True except: return False def mean(x): if is_numeric(x): return sum(x) * 1.0 / len(x) def variance(alist): if is_numeric(alist): m = mean(alist) return map(lambda x: (x - m)**2,...
true
4cd048629af07f32cc183734de8dd816c53ab71a
Python
rhammell/isw-visuals
/data/format_data.py
UTF-8
3,423
3.1875
3
[]
no_license
# Format ISW product data into new datasets that are utilized # by the various visualizations import json import requests import dateutil.parser # Open ISW product data fname = "isw_products.json" with open(fname, "r") as f: products = json.load(f) # Create histogam of people and how many products they are incl...
true
79b2a59f34394f6466bca5487aa7202db0a79ddd
Python
Jinsaeng/CS-Python
/al4995_Hw_02_q3.py
UTF-8
254
3.421875
3
[]
no_license
import math def factors (num): lst = [] for i in range(1, math.ceil(math.sqrt(num))): if num% i == 0: lst.append(i) yield i lst.reverse() for ele in lst: i = int(num/ele) yield i
true
33757da03b3e1972a607551bccf174b85a84901b
Python
LuizVinicius38/01-Arte-em-ASCII
/Desafio_4.py
UTF-8
344
3.1875
3
[]
no_license
print("PARABENS!!!!!!!!!") print("") print("DINOSSAUROOOOOOOOO!") print(" __") print(" / _)") print(" .-^^^-/ / ") print(" __/ /") print("<__.|_|-|_|") print("") print("OLHA O BOLINHO :D") print(". " *11) print("i "*11) print("#"*21) print("="*21) print("#"*21) print(...
true
77ebf8f95547ae0491a1fc1b84ddeced43a5e984
Python
stets/dmvchecker
/main.py
UTF-8
567
2.984375
3
[]
no_license
import requests f = open('nerdwords', 'r') words = f.read().split('\n') def plateChecker(plate): base_url = 'https://services.dps.ohio.gov/BMVOnlineServices/VR/Availability/Passenger/GetAvailability?vehicleClass=&newPlate={0}&organizationCode=0'.format(plate) r = requests.get(base_url) if 'currently ava...
true
3c77e33555f74defc480aa058b33fae32f82b59c
Python
daniloaugusto0212/EstudoPython
/python_dankicode/exercicios/numero_primo.py
UTF-8
361
4.40625
4
[]
no_license
num = int(input("Digite um número inteiro para saber se ele é primo: \n")) primo = False if num > 1: for i in range(2, num): print(i, "\n") if (num % i) == 0: primo = False break else: primo = True if primo: print(f"O número {num} é primo!") else: print(f"...
true
b4747669a9d56eb5a4d3327d8dcd9b4d410bbd1e
Python
QuestionC/euler
/Euler38.py
UTF-8
722
3.828125
4
[]
no_license
# 192 x (1, 2, 3) = (192, 384, 576) which joins into a pandigital # 9 x (1, 2, 3, 4, 5) = (9, 18, 27, 36, 45) # What is the largest pandigital number that can be formed this way where the tuple is (1, 2, ..., n) for n > 1? import itertools max = 0 for n in range (2, 10): y = tuple(range(1, n + 1)) for x in ...
true
7b059e5c3a711e4fe55f18affbbf5caa34849787
Python
Jonathan-aguilar/DAS_Sistemas
/Ago-Dic-2019/JOSE ONOFRE/PRACTICAS/Practica1/MoreConditionalT.py
UTF-8
927
3.75
4
[ "MIT" ]
permissive
color = 'azul' print(color == 'azul') palabra = 'ambiente' print('///////////////////////////////') if palabra != 'mundo': print("Las palabras no son iguales!") print('///////////////////////////////') tamano = 10 print(tamano==10) cantidad = 13 if cantidad != 10: print("La cantidad no es la indicada") prin...
true
14fb5589fb3210376dba84a4cda2c663a4104a3d
Python
ian0/ARC
/src/common_utils.py
UTF-8
1,338
3.46875
3
[ "Apache-2.0" ]
permissive
"""NUI Galway CT5132/CT5148 Programming and Tools for AI (James McDermott) Common funtions for Assignment 3 Student name(s): Ian Matthews Student ID(s): 12100610 """ import numpy as np import json from itertools import chain def load_file(filename): """ Read in a json file from the data/training folder i...
true
fa5feee2714c6c23da110d7bd8bb29cdf18fd855
Python
gaoxinge/bible
/python/pysheeet/5/test.py
UTF-8
166
2.96875
3
[]
no_license
def func_1(): print("Hello") def func_2(): print("World") def func_3(): print("!!!") s = [func_1, func_2, func_3] for _ in s: _()
true
fe34c5dd289b26c86969e6818ad6de53f506555f
Python
himnsuk/Python-Practice
/Interview/LinkedList/link_list.py
UTF-8
1,711
4.25
4
[]
no_license
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def add_node_in_end(self, node): if self.head is None: self.head = node else: n = self.head while n.ne...
true
22db9430ca8cc8a6ddd2fb94d1f92c92424dbc6e
Python
justinALEX01/Python-resources
/Python_T5.py
UTF-8
1,002
3.90625
4
[]
no_license
# Create a class to open file class OpenFile(): file = "" def __init__(self,_fileName): self.fileName=_fileName def openfile(self): self.file = open(self.fileName) def closefile(self): if self.file.close(): self.file = None #Create a class to Write File class WriteF...
true
339a00d34c351662c34ad771ba8ac3b7ac59aa67
Python
anovacap/holberton-system_engineering-devops
/0x15-api/0-gather_data_from_an_API.py
UTF-8
1,251
3.359375
3
[]
no_license
#!/usr/bin/python3 """Using a REST API for a given employee ID, returns information about his / her TODO list progress """ import requests import sys def main(): if len(sys.argv) == 2 and type(eval(sys.argv[1])) == int: todos_url = "https://jsonplaceholder.typicode.com/todos" user_url = "https://j...
true
a07bf39ff5c5e99901c2b6a992d26289c7a48b3d
Python
erolneuhauss/studies
/python/thomas_theis_einstieg_in_python/8.3.2_lesen_ende.py
UTF-8
390
3.6875
4
[]
no_license
#!/usr/bin/python # Module importieren import sys # Zugriffversuch try: d = open("lesen.txt") except: print("Dateizugriff nicht erfolgreich") sys.exit(0) # Lesen, Ausgabe und Summierung aller Zeilen summe = 0 zeile = d.readline() while zeile: summe += float(zeile) print(zeile, end="") zeile ...
true
f6f4bc825b3bec6d1b8721b7ed78a26ab9dd2e37
Python
jamenze/Harley-Saves-Earth-
/Bullet.py
UTF-8
1,234
3.703125
4
[]
no_license
import pygame from pygame.sprite import Sprite class Bullet(Sprite): def __init__(self,screen,the_player,direction): super(Bullet, self).__init__() self.screen = screen self.rect = pygame.Rect(0,0,25,5) self.color = (255, 255, 255) self.rect.centerx = the_player.rect.right # right side of player's rectangl...
true
511eb62b26d32aa197f1892ed38a4230bc6f2269
Python
TANISHCHHABRA/Competitve-Programming
/LeetCode/July-Challenge-202/Week1/arranging_coins.py
UTF-8
253
2.890625
3
[]
no_license
class Solution: def arrangeCoins(self, n: int) -> int: ans = 0 x = n for i in range(1,n+1): if x >= i: x = x - i ans += 1 else: break return ans
true
03c30b804a15783bbd6e16ce7f63441ae305f02a
Python
Aasthaengg/IBMdataset
/Python_codes/p03286/s580907455.py
UTF-8
134
3.078125
3
[]
no_license
n=int(input()) ans="" k=0 while n!=0: ans=str(n%2)+ans n=n-(n%2)*(-1)**k n=n//2 k+=1 if ans=="": ans=0 print(ans)
true
78f2dc9d931dfd3ac381b3b625384136449038b9
Python
statsmodels/statsmodels
/statsmodels/robust/norms.py
UTF-8
24,923
3.203125
3
[ "BSD-3-Clause" ]
permissive
import numpy as np # TODO: add plots to weighting functions for online docs. def _cabs(x): """absolute value function that changes complex sign based on real sign This could be useful for complex step derivatives of functions that need abs. Not yet used. """ sign = (x.real >= 0) * 2 - 1 retu...
true
f99bf0d563572a81feff6be3ccfa0bf15579ec1c
Python
nu-childlab/gazepoint-prototype
/gazepoint_object.py
UTF-8
3,764
2.53125
3
[]
no_license
import socket from psychopy import event,core import time class gazepoint_object(): def __init__(self,host='127.0.0.1',port=4242): self.host = host self.port = port self.address = (host, port) return def calibrate(self, duration=15): """Runs the calibration screen, and ...
true
90c487fd2e0ad9fb4218452a826eb29f5dbca946
Python
harperj/graphlab-specializer
/pagerank_graph.py
UTF-8
764
2.640625
3
[]
no_license
import graph as gl class PageRankGraph(gl.Graph): RESET_PROB = gl.double(0.15) TOLERANCE = gl.double(0.01) last_change = gl.double(0.0) class VertexData(gl.Graph.Vertex): def __init__(self): self.val = gl.double(3.0) class EdgeData(gl.Graph.Edge): pass def update(...
true
f80d9eda1962511b41cbb57ea552c7c75b5336ed
Python
Timoluo/PythonLearning
/Practice/Test33-OOPAdvanced-UsingProperty.py
UTF-8
2,446
4.375
4
[]
no_license
### 使用@property # 为了限制参数的合理性与范围,可以通过函数检查、设置;用另一个来获取 class Student(object): def get_score(self): return self._score def set_score(self, value): if not isinstance(value, int): raise ValueError('score must be an integer!') if value < 0 or value > 100: raise Valu...
true
5590810a60877b6a16ca071bdebd00fe0cfa52f7
Python
Prabin-Neupane/task1.py
/dict.py
UTF-8
1,946
4.03125
4
[]
no_license
# Make a dictionary using lists above and delete the key-value (students:marks) pairs with lowest marks. import math students = ['jack','jill','david','silva','ronaldo'] marks = ['55','60','53','66','76'] dict ={} for key in range(len(students)): dict[students[key]] = marks[key] print(dict) dict_2 ={} for items i...
true
55572f19edcb77872ef8a51bc29049139b37f770
Python
SymmetricChaos/NumberTheory
/Computation/RootFinding/BisectionMethod.py
UTF-8
1,122
3.625
4
[ "MIT" ]
permissive
# The bisection method finds a from warnings import warn from GeneralUtils import sign def bisection_method(a,b,func,iters=10): fa = func(a) fb = func(b) if sign(fa) == sign(fb): raise Exception("Points must have opposite signs.") # Guarantee that a is the negative side and b i...
true
89e09f186d61281b888a7362fe9e0dfa5bb00d17
Python
dondongwon/pcme
/datasets/vocab.py
UTF-8
3,771
3
3
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
permissive
""" Create a vocabulary wrapper. Original code: https://github.com/yalesong/pvse/blob/master/vocab.py """ from collections import Counter import json import os import pickle import fire from nltk.tokenize import word_tokenize from pycocotools.coco import COCO ANNOTATIONS = { 'mrw': ['mrw-v1.0.json'], 'tgif'...
true
1f567e507b94e69a04506428f618858bd8ecba52
Python
YyzHarry/ME-Net
/fancyimpute/soft_impute.py
UTF-8
6,624
2.6875
3
[ "MIT" ]
permissive
# 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 under th...
true
d1a2cae03a70155cc72a4428853c14eef55411c4
Python
omervered0708/HW2
/data.py
UTF-8
1,639
3.640625
4
[]
no_license
import pandas class Data: def __init__(self, path): """ the function loads the data from the csv file :param path: the path to the csv file :return: none """ df = pandas.read_csv(path) self.data = df.to_dict(orient="list") def get_all_districts(self):...
true
99e10177103eafc657c5f2cd5f6ff444fbfd1c24
Python
santsy03/RADIX
/Source_Code/madagascar/appussd/utilities/metrics/core.py
UTF-8
1,989
2.71875
3
[]
no_license
from utilities.metrics.metricHandler import heartBeat from utilities.logging.core import log def send_metric(metrics, metric_type='timer'): '''wrapper function for sending metrics. invokes respective metric sending func based on type of metric @params: metrics dict, and metric_type ''' if metr...
true
9ffb4b3d36787b2846a3f40003b874e174937c31
Python
Mr-ari/Python-Programs
/dictionaries_prac.py
UTF-8
679
3.484375
3
[]
no_license
def histogram(s): h = dict() for c in s: if c not in h: h[c] = 1 else: h[c] += 1 return h def LookUpError(): print ("Error") def reverse_look_up(h,value): for key in h: if h[key] == val: return key raise LookUpError() def invert_dict(h): invert = dict() for key in h: val = h[key] if...
true
4c090f5eccadc96334486bd352fe9064db4702b5
Python
chithrasasidharan/pyth
/pyth/sudoku.py
UTF-8
9,974
2.953125
3
[]
no_license
#!/usr/bin/env/python3 from tkinter import * from tkinter import messagebox import tkinter as tk import time import random window = Tk() window.title('Sudoku') window.geometry('700x700') window.configure(background="white") center = Frame(window, bg = 'white',width = 200,height = 200,padx=30,pady=30) center.grid(row...
true
fae1a607be17020a0ec026f05181dcf137c51afe
Python
abhinavsingh/sshpool
/sshpool/ctl.py
UTF-8
3,292
2.515625
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- """ sshpool.ctl ~~~~~~~~~~~ This module maintain pool of SSH channels and allow communication via RESTful API :copyright: (c) 2013 by Abhinav Singh. :license: BSD, see LICENSE for more details. """ import sys import cmd import time import logging from .client import Client...
true
86ba1e95df899b1760ad49913cccf272511be68b
Python
ketralnis/lua_sandbox
/lua_sandbox/tests/perf.py
UTF-8
3,472
3.21875
3
[ "BSD-2-Clause" ]
permissive
""" Measure performance of lua_sandbox under the most common conditions This is: 1. bring up a VM 2. load up some code in a sandbox 3. execute that loaded code over and over with different globals set in the sandbox """ import re import timeit from lua_sandbox.executor import Capsule from lua_sandbox.executor im...
true
1882dc67d6205b9d165ef066d9d9215deeeb5208
Python
ggibson5972/Notable_project
/query.py
UTF-8
2,433
2.75
3
[]
no_license
#Author: Grace Gibson #Date: 7/31/2018 #Main method for POSTGRESQL text analysis project #import interface to connect to postgres hostname = 'localhost' username = 'postgres' password = 'aw3s0me!' database = 'notable' import psycopg2 print "Using psycopg2..." myConnection = psycopg2.connect(host=hostname, user=userna...
true
492e47be6429a22ea83425ced5deda473ab63a88
Python
leobol96/MCTS
/node.py
UTF-8
1,289
3.96875
4
[]
no_license
class Node(object): """ The Node class is used to build the binary tree. Each node that is not a leaf is connected to two children, the right one and the left one. """ def __init__(self, t=0, n_a=0, reward=None, left=None, right=None): """ Constructor method :param t: Reward...
true
0ca69da07703a007b6fd529d9b183818364bdffd
Python
meudnaes/Hydro-dynamics-Tests
/SodShock/sod_shock_exact.py
UTF-8
6,904
2.984375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from scipy.optimize import fsolve class SodShockTube: """ Exact solution to the Sod shock problem after time t Inspired by: - https://www.astro.uu.se/~hoefner/astro/teach/ch10.pdf --> calculation of expansion fan and determination of regions - ...
true
4584c668b6ec9822b684fe9d5e3976dad8783e7e
Python
ShuKate/my-sandbox
/part1/task2.py
UTF-8
213
4.125
4
[]
no_license
#Is it a leap-year? n = int(input('A year between 1900 and 3000\n')) if 1900 <= n <= 3000: if n % 4 == 0 and n % 100 != 0 or n % 400 == 0: print('Leap-year!') else: print('Ordinary year!')
true
3984b31ed66620ed8dd7dc974f6e258cc9839b0f
Python
vvvictorlee/TextSimilarity
/TextSimilarity-VSM-Gensim.py
UTF-8
2,549
2.984375
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- import logging import time from gensim import corpora, models, similarities # 基于向量空间模型(VSM)实现的中文文本相似度计算,对于平均 170 词的 3148 篇文章,耗时约 21s # 使用的是 Gensim:https://radimrehurek.com/gensim # 打印调试信息 logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.I...
true
78876dec9fb0d326430c5663da685993129a9eda
Python
dflay/calibration
/conv.py
UTF-8
1,158
3.171875
3
[]
no_license
# read in calibration coeffs from other analyzers and create a json object import csv import json import pandas as pd # whose data are we looking at usr = "ran-hong" dataFile = "run-1_04-03-20" # test DF output # csv_path = "/home/dflay/Workplace/dflay/calibration/output/blinded/flay/04-04-20/calibData...
true
22d4ad76994162237e3d322bf528b460ede3838c
Python
Nuclearblitz12/Star-Trek-Game
/Star Trek.py
UTF-8
5,296
3.671875
4
[]
no_license
import random class Character: def __init__(self): self.hull = 100 self.shields = 100 self.power_systems = 100 self.torpedos = 20 self.speed = 0 self.evasion = 0 self.accuracy = random.randrange(0,100) self.enemy = "Klingons" self....
true
e6fa908ef587291b418fe2f4b0be573c385312f5
Python
gaojijun/code-seg
/python-code/exceptions_jjgao.py
UTF-8
639
3.359375
3
[]
no_license
import sys def tell_time(): sys.exit('hello') # 1. how to use raise # 2. sys.exit will throw an exception, it's type is SystemExit. # 3. SystemExit/KeyboardInterrupt cannot be caught by 'except Exception' def first_catch(): try: tell_time() except: print 123 raise try: first_...
true
8e627ba316704641691c845dfda59e910218974f
Python
Olivier-Lakoue/titanic-neural-network
/titanic.py
UTF-8
1,696
2.71875
3
[]
no_license
import numpy as np import pandas as pd from sklearn.cross_validation import train_test_split from keras.models import Sequential from keras.layers import Dense, Activation from keras.utils import np_utils from keras.optimizers import SGD #far too much repetition, just cleaning the data for the neural net df = pd.read_...
true
90759121c5fa8ec589b88efb5ca63b511824a8bd
Python
MaxTran96/Text-Prediction
/Prediction_Model.py
UTF-8
5,651
3.375
3
[]
no_license
import tensorflow as tf import nltk import collections import numpy as np from tensorflow.contrib import rnn TEXT_FILE_NAME = 'atom_text' NUM_WORDS_FOR_PREDICTION = 3 tf.reset_default_graph() # Function to take a list of words and create a dictionary from them # Takes in a list of strings where each word is its own s...
true
a697db1e5b092daed4fdee4d9496c986aae79391
Python
HotchkissCP/cmimc2021
/cmimcai1/main.py
UTF-8
8,536
3.734375
4
[]
no_license
# Bet Starter File # NOTE: You can run this file locally to test if your program is working. #============================================================================= # INPUT FORMAT: hand, others, card, scores # hand: Your current hand (a list of integers 2 to 14) # others: All other players' hands, in a fixed...
true
322436001370b30da44ca910963724d5908c9a80
Python
Hironobu-Kawaguchi/atcoder
/aribook/_template_aribook222itemgetter.py
UTF-8
583
3.515625
4
[]
no_license
# 蟻本をPythonで (初級編) # https://qiita.com/saba/items/affc94740aff117d2ca9 # 2-2 猪突猛進! "貪欲法" # 例題 2-2-2 区間スケジューリング問題 # 多次元リストの sort に使える from operator import itemgetter n = int(input()) s = list(map(int, input().split())) t = list(map(int, input().split())) st = sorted([(s[i], t[i]) for i in range(n)], key=i...
true
7443a286584b0be37dbb91f83ab1b5c5aabaee78
Python
oncsr/ERICA_2019060346
/cal.py
UTF-8
2,777
3.0625
3
[]
no_license
import sys from PyQt5.QtWidgets import * from PyQt5.QtCore import * class Form(QWidget): def __init__(self): QWidget.__init__(self, flags=Qt.Widget) self.cnt = 0 self.lb = QLabel(str(self.cnt)) self.plus = QPushButton() self.minus = QPushButton() self.multi = QPushButton() self.parti = QPushButton() ...
true
5fa88036b82b893faa65ff8efe3ca8ed6b3c48f8
Python
zhouhye/campingScraper
/src/root/nested/example.py
UTF-8
1,065
2.984375
3
[]
no_license
''' Created on May 12, 2016 @author: hillenr ''' from bs4 import BeautifulSoup from urllib2 import urlopen BASE_URL = "http://www.chicagoreader.com" def get_category_links(section_url): html = urlopen(section_url).read() soup = BeautifulSoup(html, "lxml") boccat = soup.find("dl", "boccat") category_...
true
107e5226d557798b21b0d673c1a1a7be230fbe2c
Python
qfma/ohnolog-dc
/utilities/io.py
UTF-8
1,140
3.46875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env python2.7 # ''' Input/Output helper scripts # This file provided various python functions that use the os and sys # modules in order to list files, folders etc. # ''' import os def list_folder(infolder): '''Returns a list of all files in a folder with the full path''' return [os.path.join(in...
true
3389862c581a6daedd1ae2694f2f77a5a8a5498b
Python
HelioGuilherme66/robotframework-seleniumlibrary
/utest/test/keywords/test_keyword_arguments_element.py
UTF-8
1,259
2.53125
3
[ "Apache-2.0" ]
permissive
import unittest from mockito import mock, unstub, when from robot.api import logger from SeleniumLibrary.keywords import ElementKeywords class KeywordArgumentsElementTest(unittest.TestCase): def setUp(self): ctx = mock() ctx._browser = mock() self.element = ElementKeywords(ctx) def...
true
b052bc8693505bbbb1d3b99a16108d6a6b21956b
Python
vtsartas/ejpython
/ejpy/ejercicios2/ejs/ejercicio4.py
UTF-8
829
4.46875
4
[]
no_license
# 4. Programa que lea por teclado tres números enteros H, M, S # correspondientes a hora, minutos y segundos respectivamente, # y comprueba si la hora que indican es una hora válida. def ejercicio4(): # iniciamos 'otro4' para que entre en el while otro4="s" while (otro4=="s"): # pedimos la hora ...
true
f9f3fe1bfb3252aba32f848ab10ed18985d00c9e
Python
xxg2/pythonl
/ch3/listp.py
UTF-8
665
3.328125
3
[]
no_license
# 列表可以包含任何类型的 L = [123, 'spam', 1.23] print(len(L)) print(L[1]) print(L[:-1]) L.append('NI') L = L + [4,5,6] print(L) # remove the third item L.pop(2) print(L) # ------------------------------ M = ['bb', 'cc', 'aa'] M.sort() print(M) M.reverse() print(M) # ---------------列表解析表达式 matrix = [[1,2,3],[4,5,6],[7,8,9]] prin...
true
fe2b8d162d74f615b595cb0369a4d32d0362fb91
Python
sayyedsy/sayyed-saber
/Armstrong number.py
UTF-8
180
2.953125
3
[]
no_license
num=int(input("enter any no=")) sum=0 a=num while num>0: dg=num%10 sum=sum+dg*dg*dg num=num//10 if a==sum: print("armstrong number") else: print("not armstron") #407 #153 #1-9
true
e85aea0e9d782b5a05f2d4a5e7f57aec8508f2ba
Python
VukW/age_detection
/utils/pytorch_wrapper.py
UTF-8
3,393
2.625
3
[]
no_license
from abc import ABC, abstractmethod from typing import List import torch from torchvision import transforms augmentation = transforms.Compose([transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)), transforms.ToPILImage(), transforms.RandomHorizon...
true
58f663c194c18b3ed962a06db6d000d1b3bfe3ec
Python
josue-islas/matplot_library
/Scripts/6.1_Proyecto_Final_Dash_Guia.py
UTF-8
3,549
2.59375
3
[]
no_license
# FASE 1: IMPORTAR LIBRERÍAS import dash import dash_core_components as dcc import dash_html_components as html import plotly.graph_objs as go from dash.dependencies import Input, Output import pandas as pd app = dash.Dash() # FASE 1: CARGA DE DATOS (dataframe df_ventas --> Pestaña "Detalle" / dataframe df_ventas_acu...
true
8defe55a3d83b0946df381486940c5d671a1a605
Python
TMearns1609/Initial-Repo
/test.py
UTF-8
132
2.890625
3
[]
no_license
from myUtils import MyUtils strToFloat = MyUtils() Num=input("Your number here: ") Float = strToFloat.strToFloat(Num) print (Float)
true
0c3b9f676419553d98159ec503bc918ce7732800
Python
erick-r-anderson/UPS-_Router
/package.py
UTF-8
1,111
3.203125
3
[]
no_license
# i am storing the package as a custom object data structure # this allows easy access to each of the various attributes of the package # and this also allows multiple references to the same package object at various points in the program class Package: def __init__(self, package_id, address, city, state, zip...
true
2ce4939cd4c0dbc0eb5993304e46468eb5a8a5c0
Python
FL12358/Stellar_Spin_Rates
/ReportExamples.py
UTF-8
15,188
2.75
3
[]
no_license
import numpy as np import matplotlib.pylab as plt from matplotlib.cm import ScalarMappable from astropy.stats import LombScargle import math from astropy.io import fits import matplotlib.patches as mpatches def RemoveNaN(a,b,c): #Determines NaNs in f and creates new shorter arrays without NaNs validIndex = np....
true
6bf0d347b35ae2e2a86d3162599f641a3aa47af4
Python
zdyxry/LeetCode
/tree/0572_subtree_of_another_tree/0572_subtree_of_another_tree.py
UTF-8
1,060
3.9375
4
[]
no_license
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def isSubtree(self, s, t): """ :type s: TreeNode :type t: TreeNode :rtype: bool """ ...
true
4a56955197e3cbc67f8d59fb16a01b9208d82d14
Python
tomjsstewart/AutoInsta
/PostQueue.py
UTF-8
2,882
3.5
4
[]
no_license
from Post import Post import queue as Q from datetime import datetime from dateutil import parser import json class PostQueue(): """ Stores all posts in the order in which they should be posted. PostQueue will read posts.json file to populate itself. """ def __init__(self): ...
true
22067fd33aa887c93866b75c3aaac270754cbff5
Python
Mohaymin/QASystem
/q_a_system/spacy_play/answer_type_extraction.py
UTF-8
2,611
2.859375
3
[]
no_license
""" Answer type can be date, location, number, person, resource, list """ from q_a_system.global_pack import constant from q_a_system.spacy_play import parts_of_speech, keyword_extraction def printAnswerType(ques, keyword): question = constant.nlp(ques) qu = ques.split(' ') number = ["height", "elevation...
true
612b06db867150d604b0d65d692bfe35c14f4ab7
Python
mlaneuville/evolve
/processing/Report.py
UTF-8
5,895
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- """ @author: mlaneuville """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg from matplotlib.backends.backend_pdf import PdfPages from collections import OrderedDict from PyPDF2 import PdfFileReader, PdfFileMerger import graphviz import os ...
true
19f5a2043857bda6168b01a0cffd1d1c93b6947c
Python
mkuczynski11/Leetcode-solutions
/41.py
UTF-8
585
3.296875
3
[]
no_license
#https://leetcode.com/problems/first-missing-positive/ class Solution(object): def firstMissingPositive(self, nums): """ :type nums: List[int] :rtype: int """ nums.append(0) n = len(nums) for i in range(len(nums)): if(nums[i] >= len(nums) or nums[i...
true
147a473c35689a516e9684fe007b15f08b808a61
Python
k0syan/Kattis
/acm_contest_scoring.py
UTF-8
519
2.90625
3
[]
no_license
if __name__ == "__main__": score = 0 total = 0 tries = [] success = [] while True: data = input() if data == "-1": break else: data = data.split() time = int(data[0]) task = data[1] result = data[2] if re...
true
0817e64d52a95863d2c8d17c5b5c007e896fed59
Python
Monchez32/SiatemasExpertos
/vinoejemplo/parcial1.py
UTF-8
827
3.03125
3
[]
no_license
import pandas as pd df = pd.read_csv('winequality-red.csv', sep=';') df.head() def clasificar(parametro1, parametro2, parametro3): for i, n in enumerate(parametro2): if n >= parametro1: df.loc[i, parametro3] = 'alto' else: df.loc[i, parametro3] = 'bajo' retur...
true
14b7493c85d9d8a570a6a9d7c5f1c69a96bb0429
Python
Leofighting/Practice-on-LeetCode
/LeetCode/数组-加一.py
UTF-8
832
3.796875
4
[]
no_license
# -*- coding:utf-8 -*- __author__ = "leo" # 给定一个由整数组成的非空数组所表示的非负整数,在该数的基础上加一。 # 最高位数字存放在数组的首位, 数组中每个元素只存储单个数字。 # 你可以假设除了整数 0 之外,这个整数不会以零开头。 class Solution: @staticmethod def plus_one(digits): for i in range(1, len(digits)+1): if digits[-i] != 9: digits[-i] += 1 ...
true
cd411c847b3cefec0e82271c7ae5be5358188132
Python
joo-jj/codeStudy
/백준 9376. 탈옥.py
UTF-8
1,647
2.71875
3
[]
no_license
from collections import deque import sys input = sys.stdin.readline dx = [1, -1, 0, 0] dy = [0, 0, 1, -1] def bfs(x, y): c = [[-1] * (w + 2) for _ in range(h + 2)] q.append([x, y]) c[x][y] = 0 while q: x, y = q.popleft() for i in range(4): nx = x + dx[i] ...
true
b08cb077e2b8151210b475eec5a3e14841d4a0e3
Python
clintonbf/sensor_interface
/sensors/spec_dgs.py
UTF-8
3,380
3.109375
3
[]
no_license
import abc from sensors import SensorInterface from unit_conversion import celsius_to_kelvin import serial # Copyright Clinton Fernandes (clint.fernandes@gmail.com) 2021 DATA_INDICES = { "serial_number": 0, "measurement": 1, "temperature": 2, "relative_humidity": 3, "raw_sensor": 4, "temp_digi...
true
af6df807fac86a0e5ebfbfd5be3ec596a85a35ad
Python
tyutltf/Leecode
/801-900/832-翻转图像.py
UTF-8
2,091
3.96875
4
[]
no_license
# -*- encoding: utf-8 -*- """ @File : 832-翻转图像.py @Time : 2023/06/09 20:36:22 @Author : TYUT ltf @Version : v1.0 @Contact : 18235121656@163.com @License : (C)Copyright 2020-2030, GNU General Public License """ # here put the import lib from typing import List """ 给定一个 n x n 的二进制矩阵 image ,先 水平 翻转图像,然...
true
2837ca2aaa80861a1fe2b9ce4ff1070c8e80ec0c
Python
sam735/CodeYard
/tabularizationFibdynProgm.py
UTF-8
365
4.03125
4
[]
no_license
lookup = [] def populate_lookup(x: int): for i in range(0, x+1): lookup.append(0) def fib(x: int): lookup[0] = 0 lookup[1] = 1 for i in range(2, x+1): lookup[i] = lookup[i-1] + lookup[i-2] if __name__ == '__main__': x = int(input('Enter the number:')) populate_lookup(x) ...
true
09a106c4a231f2df904ff28c7566a585b9b8d748
Python
wuyx/Machine-Learning
/MiniFlow/linear.py
UTF-8
1,601
3.078125
3
[]
no_license
from node import Node import numpy as np class Linear(Node): def __init__(self, inputs, weights, bias): Node.__init__(self, [inputs, weights, bias]) def forward_propagation(self): inputs = self.inbound_nodes[0].value weights = self.inbound_nodes[1].value #bias = np.sum(self.in...
true
92a659c8494569741b2cd944eb289cb879f51ef4
Python
uestcjackey/caffe
/examples/matrix_multiplication/py_data_layer.py
UTF-8
741
2.765625
3
[ "LicenseRef-scancode-generic-cla", "BSD-2-Clause", "BSD-3-Clause", "LicenseRef-scancode-public-domain" ]
permissive
import caffe import numpy as np class LineDataLayer(caffe.Layer): def setup(self, bottom, top): self.batch_size = 10; top[0].reshape(self.batch_size, 2, 1) top[1].reshape(self.batch_size) self.W = np.array([2,5], dtype=np.float32) self.b = -7.0 print("W=\n"+...
true
4ce3de898d29f0a825a2705818ea8f822329a7a3
Python
viper-dev/examples
/ICU_Capture_IR_Packets/main.py
UTF-8
1,292
2.859375
3
[]
no_license
################################################################################ # ICU Capture IR Packets # # Created by VIPER Team 2015 CC # Authors: L. Rizzello, G. Baldi, D. Mazzei ################################################################################ import icu import streams import pwm streams.serial...
true
98fc6298c2234b95636d9a69f5457fbc0b3b7d05
Python
Kruto-n/python-012021
/7/program35.py
UTF-8
362
2.859375
3
[]
no_license
import wget import pandas import matplotlib.pyplot as plt #wget.download("https://raw.githubusercontent.com/pesikj/python-012021/master/zadani/5/temperature.csv") temperature = pandas.read_csv('temperature.csv') cities = temperature[temperature["City"].isin(["Miami Beach", "Helsinki", "Tokyo"])] cities.boxplot(column...
true
49a4ff4ea6e18f02f8d088c09cc43dcb02071d53
Python
roshak7/d2_home_fpw
/db_actions.py
UTF-8
6,796
2.734375
3
[]
no_license
from django.contrib.auth.models import User from news.models import Author, Category, Post, PostCategory, Comment def init(): print(f'DB initialization started...') print(f' Очистка объектов...') PostCategory.objects.all().delete() print(f' PostCategories = {PostCategory.objects.count()}') Cate...
true
12dee9eb8074c8d801d2fb535f800831db8e4cbb
Python
krissrex/Icon-Tools
/icon converting/androidify_icons.py
UTF-8
2,038
3.015625
3
[ "MIT" ]
permissive
import os, shutil drawable_folder = 'drawable' def list_files(): files = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.png')] print(files) return files def find_out(): out_folder = 'out' counter = 0; while os.path.exists(out_folder + (str(counter) if counter != 0 else ''))...
true
d65c4e7e5194d084f76d3605b54817ca4b6bdf77
Python
s-christian/Schoolwork
/Data Structure and Algorithm Analysis/Programming Assessments/Assessment 3/dijkstra.py
UTF-8
830
3.4375
3
[]
no_license
# These would be placed within the Graph class # In this case, 1000 represents the max distance, or our "infinity" def dijkstra(self, src): distances = [1000] * self.size distances[src] = 0 shortestPathTree = [False] * self.size for cout in range(self.size): u = self.minDistance(distances, shor...
true
73d71eb8835a95e4ce50c4eb4e53abbf1cb39328
Python
hong-brother/hdf
/reader/hdfReader.py
UTF-8
540
2.859375
3
[]
no_license
import os import h5py #HDF5 File Dirdory sep = os.sep s111_Point = os.getcwd() +sep+'..'+ sep +"resource" + sep+"s111" + sep + "111_area.h5" print("path ="+s111_Point) ##파일 체크 isFileCheck = os.path.exists(s111_Point) if isFileCheck : print("is File") f = h5py.File(s111_Point, 'r') #1. read Group g1 =...
true
1b86d5f6fb61b5c1db839e5cbf1ba4198655f8e5
Python
Iammillo/English-Sentence-Boundary-Detection
/main.py
UTF-8
1,503
3.328125
3
[]
no_license
"""import nltk: natural language toolkit library""" import nltk from nltk.tokenize import word_tokenize,sent_tokenize """This function return string with chunk named 'CLAUSE' after the sentence is chunked""" def extract_string(psent): for subtree in psent.subtrees(): if subtree.label() == 'CLAUSE': yield '...
true
6a525ea9d87440b8a7d618cc737b4b14df02609a
Python
tyhtm3/Photory-AI
/flask_server/image_captioning/image_caption.py
UTF-8
7,449
2.71875
3
[]
no_license
import pickle import tensorflow as tf import numpy as np class BahdanauAttention(tf.keras.Model): def __init__(self, units): super(BahdanauAttention, self).__init__() self.W1 = tf.keras.layers.Dense(units) self.W2 = tf.keras.layers.Dense(units) self.V = tf.keras.layers.Dense(1) ...
true
b706ac55f014e5bf7a7f2bec2d66fe13595c4965
Python
axd8911/Leetcode
/mianshi_prep/AMZ_VO_prep/1167_Minimum_Cost_to_Connect_Sticks.py
UTF-8
355
3.03125
3
[]
no_license
class Solution: def connectSticks(self, sticks: List[int]) -> int: heapq.heapify(sticks) total = 0 while len(sticks)>1: n1 = heapq.heappop(sticks) n2 = heapq.heappop(sticks) curr = n1 + n2 total += curr heapq.heappush(sticks,curr) ...
true
661cda915111f08c9fdc9fc110edeaae50a12ae8
Python
kmgowda/kmg-leetcode-python
/word-break/word-break.py
UTF-8
2,360
3.25
3
[ "Apache-2.0" ]
permissive
// https://leetcode.com/problems/word-break import functools class Trie: def __init__(self): self.nxt = collections.defaultdict(Trie) self.isword = False class Solution(object): def __init__(self): self.root = Trie() def insert(self, word): cur = self.root...
true
e7614a31e39f3def85fcf6d5a57fb3f8ea946106
Python
Moremar/py-library-tuto
/unittest/test_calc.py
UTF-8
1,930
3.09375
3
[ "Unlicense" ]
permissive
import unittest from unittest.mock import patch from calc import add, divide, Calculator class TestCalc(unittest.TestCase): @classmethod def setUpClass(cls): print('Called once before starting to run the tests') @classmethod def tearDownClass(cls): print('Called once after finishing...
true
4831b35519f569485c4e25dcc9d27f8d875b56da
Python
Ras-Kwesi/highnews
/app/models.py
UTF-8
1,072
2.734375
3
[ "MIT" ]
permissive
class Articles: ''' definition of the news class properties ''' def __init__(self,title,author,description,url,urlToImage,publishedAt): self.title = title self.author = author self.description = description self.url = url self.urlToImage = urlToImage # The link t...
true
5e627199881a2b8911a4502608b6de4ca7145edb
Python
danielrive/techinsiders2020_python
/infrastructure/aws_components/networking/aws_vpc.py
UTF-8
6,580
2.8125
3
[]
no_license
import pulumi import pulumi_aws as aws import ipaddress as ip class vpc: ''' A class used to represent an AWS Networking resources Methods ------- create_basic_networking() Creates a ''' def __init__(self, name, net_address, cidr_public, cidr_private, azs, provider): ''' ...
true
0afe37ccb6b439687b6748f330d72e7a68ce6c3f
Python
saritabhateja/tensorflow_learning
/m3-LogisticRegression.py
UTF-8
2,662
2.828125
3
[]
no_license
import pandas as pd import numpy as np import statsmodels.api as sm from returns_data_logistic_regression import read_goog_sp500_logistic_data xData, yData = read_goog_sp500_logistic_data() logit = sm.Logit(yData, xData) result = logit.fit() predictions = (result.predict(xData) > 0.5) num_accurate_...
true
cc26d261a78d5a7f5cbff67cba972d95003181d1
Python
larok00/MetaGo
/MetaGo_website/read_registry.py
UTF-8
1,084
2.859375
3
[]
no_license
import django import json import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MetaGo_website.settings") django.setup() from MetaGo.models import Employee def barcode_to_product_dict(barcode=None): f = open("food_registry.txt", 'r') file_str = f.read() file_json = json.loads(file_str) f.close()...
true
90d70b3dd8d16e89f6c65db6ae6156717e7b9391
Python
JohnnySunkel/BlueSky
/Time Series/multi_headed_multivariate_mlp.py
UTF-8
2,063
3.453125
3
[]
no_license
# Multi-headed multivariate MLP from numpy import array, hstack from keras.models import Model from keras.layers import Input, Dense from keras.layers.merge import concatenate # Split a multivariate time series into samples def split_sequences(sequences, n_steps): X, y = list(), list() for i in range(len(seque...
true
fdbc9f921905c0a62691f7c20935d8b8bbd9c1ba
Python
andersonlemos/PythonForZombies
/Task List/exercise7.py
UTF-8
550
4
4
[]
no_license
# coding: utf-8 primeiro = int(raw_input('Primeiro : ')) segundo = int(raw_input('Segundo : ')) terceiro = int(raw_input('Terceiro : ')) if segundo < primeiro > terceiro: print ('Primeiro maior %d ' % primeiro) elif primeiro < segundo > terceiro: print ('Segundo maior %d ' % segundo) else: print('Terceiro...
true
500b12e0c23afdfd38374ea81ec04a8d24ac7281
Python
johnnyUCSF/scEasyMode
/scEasyMode/sceasy.py
UTF-8
25,696
2.6875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import pandas as pd import numpy as np import seaborn as sns import scanpy as sc from datetime import datetime from scipy import stats import matplotlib.pyplot as plt from scipy.stats.mstats import gmean def read_species(human=True): """ Returns either the human or mouse anndata object ...
true
31592019740604c6e9dafe4a0833b117aad65675
Python
winmanuel/AUTOMATIC-ANALYSIS-OF-BUILDING-FOOTPRINTS-WITH-VERY-HIGH-RESOLUTION-SATELLITE-IMAGERY
/arrays.py
UTF-8
2,934
2.9375
3
[]
no_license
""" Bottom-up microsimulation of object-detection Authors: Godwin Emmanuel No rights reserved """ import numpy from sklearn.cluster import KMeans import gdal import numpy as np import matplotlib.pyplot as plt import os # from sklearn.metrics import silhouette_score workspace_path = os.path.dirname(__file__) # raste...
true
a00637def4e12f22bad6c15e0d0cb09c3207d831
Python
alexdelorenzo/tiler
/gen_tiles.py
UTF-8
3,518
2.703125
3
[ "MIT" ]
permissive
from concurrent.futures import ThreadPoolExecutor from itertools import product from pathlib import Path from typing import Tuple, List import cv2 import numpy as np import os import sys from tqdm import tqdm import math import conf import multiprocessing import click # DEPTH = 4 -> 4 * 4 * 4 = 64 colors DEPTH = con...
true
f9b0023bcf4a69ac1a9db9890f04372b2d1993a5
Python
john-m-hanlon/Python
/Sentdex Tutorials/Python Programming for Finance [Sentdex]/11 - Mapping Target Function.py
UTF-8
7,922
2.890625
3
[]
no_license
""" This file contains code for use with "Python Programming for Finance" by Sentdex, available from https://www.youtube.com/user/sentdex/ Transcribed by: John Hanlon Twitter: @hanlon_johnm LinkedIn: http://bit.ly/2fcxlEw Github: bit.ly/2fSDp4J """ import bs4 as bs import datetime as dt import os import pandas as pd ...
true
afe72af7229e686395c2f8a6f43b7a90799b56c8
Python
ralvarezmar/ST
/Practica02/procesa_coches.py
UTF-8
835
3.046875
3
[]
no_license
#!/usr/bin/python -tt # -*- coding: utf-8 -*- import sys import os import string from os import listdir def imprimir(fichero): lista=[] a=0 for linea in fichero: linea=linea.replace("\n","") if "/coches" in linea: print "Marca\t", "Modelo\t", "Matricula" print "--------------------------" elif "Ma...
true
c0e7c0290b4ee238b2f6e5f39a18bb91b1605119
Python
thaybaldao/ct-213
/Lab 2/thayna.baldao_lab2/path_planner.py
UTF-8
7,470
3.859375
4
[]
no_license
from grid import Node, NodeGrid from math import inf import heapq class PathPlanner(object): """ Represents a path planner, which may use Dijkstra, Greedy Search or A* to plan a path. """ def __init__(self, cost_map): """ Creates a new path planner for a given cost map. :param...
true
ef2989a53d1240034a7194a19c163e89b6f64584
Python
rosepark222/messi_vs_ronaldo
/keras_rnn_many_to_one_X_train.py
UTF-8
6,340
3.09375
3
[]
no_license
# https://keras.io/getting-started/sequential-model-guide/#examples # check this out # check this out for shaping input and outputs# check this out for shaping input and outputs# check this out for shaping input and outputs# check this out for shaping input and outputs # check this out for shaping input and ou...
true
00404f6f411c4bd4384483dcbae530823b1abc56
Python
matthewtessler/python-web-scraper
/scraper.py
UTF-8
3,536
3.265625
3
[]
no_license
from lxml import html import requests # initial messages detailing instructions print("Welcome to Python Web Scraper!") print("Enter a valid url to find the most frequent words on its page.") print("Enter 'q' to quit the application.") raise_errors = input("Do you want errors raised? Enter 'Y' or 'N': ") while raise_e...
true