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
4b40c041dbdbeaac94b2dafd0bf619a3d81166f4
RazvanPasca/CanonAlgo
/AllGather/Release/checkResults.py
UTF-8
461
2.6875
3
[]
no_license
from random import randint import sys with open("result1.txt",'r+') as f: content = f.readlines() mat1 = [x.strip().split(' ') for x in content] with open("result.txt",'r+') as f: content = f.readlines() mat2 = [x.strip().split(' ') for x in content] with open("resultDif.txt",'w+') as o: for i in...
true
3a5553e3368ed50d682cac2c9e5fc5e7071fa5ee
sk670/Credit_Card_Attrition
/Credit Card Attrition.py
UTF-8
6,835
2.703125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[233]: import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', 'inline') # In[394]: data = pd.read_csv('Banking_CreditCardAttrition.csv',sep=';') # In[395]: data # In[236]: data.info(...
true
b9d7f97cc013cb82360586a64f9c2b0fb2617dad
niujie/DeepLearning_TensorFlow
/Chap4/chap4-3.py
UTF-8
174
2.671875
3
[]
no_license
import tensorflow as tf # 4.3 optimizable tensor a = tf.constant([-1, 0, 1, 2]) aa = tf.Variable(a) print(aa.name, aa.trainable) a = tf.Variable([[1, 2], [3, 4]]) print(a)
true
ba00f2ed85965b1ba9f37ae770194f3fce4bb9d8
ratatouille0822/NN_Learning_Python
/Lesson4_Opt_4_1.py
UTF-8
1,028
2.734375
3
[]
no_license
#coding:utf-8 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf import numpy as np BATCH_SIZE = 8 seed = 23455 rdm = np.random.RandomState(seed) X = rdm.rand(32,2) Y = [[x1+x2+rdm.rand()/10.0-0.05] for (x1,x2) in X] x = tf.placeholder(tf.float32,shape=(None,2)) y_= tf.placeholder(tf.float32,s...
true
998482bdf5ebd89190885b2aafd23dc8610b7427
lucasjurgensen/AggregateRating
/api_manager.py
UTF-8
1,102
2.59375
3
[ "MIT" ]
permissive
import datetime import time import urllib3 # API Manager for centalizing interractions with the Goodreads API def singleton(cls, *args, **kw): instances = {} def _singleton(): if cls not in instances: instances[cls] = cls(*args, **kw) return instances[cls] return _singleton ...
true
39fbe89dbba623d866aa832d9d437c290de76a96
sampathpagolu/process_profiling
/lib/prime1.py
UTF-8
3,930
2.78125
3
[]
no_license
import os import psutil import math import matplotlib.backends.backend_tkagg from matplotlib import pyplot as plt from time import time import datetime pid_N = os.getpid() py_N = psutil.Process() def naive(n): if n <= 1: return False if n == 2: return True if n > 2 and n % 2 == 0: ...
true
b71960d0b5029bff5cf23c44623e77e43695e238
youzark/taskmanager
/taskwarrior_double/helper.py
UTF-8
1,146
2.859375
3
[]
no_license
#!/usr/bin/env python import uuid import json def is_valid_uuid(value): try: uuid.UUID(str(value)) return True except ValueError: return False def has_attributes(task_info, attributes): for attribute_name in attributes: try: if task_info[attribute_name] != attri...
true
1a463c512ebe3c9e77e7839dad2984e9953aa9e0
irakowski/PY4E
/01_Getting Started with Python/ex_5_2.py
UTF-8
649
4.53125
5
[]
no_license
""" Exercise 2: Write another program that prompts for a list of numbers and at the end prints out both the maximum and minimum of the numbers""" numbers = list() while True: num = input("Enter a number: ") if num == 'done': break try: num = int(num) numbers.append(num) excep...
true
e649af0440edd58cd73bd9b53aa4353f110b44d4
dngur6344/baekjoon-online-judge
/1297.py
UTF-8
315
3.09375
3
[]
no_license
import math shift,height_portion,width_portion=input().split() shift=int(shift) height_portion=int(height_portion) width_portion=int(width_portion) shift=shift*shift sum=height_portion*height_portion+width_portion*width_portion sum=shift/sum sum=math.sqrt(sum) print(int(sum*height_portion),int(sum*width_portion))
true
67eb40d3a1f7b4a28450a11afd9281ec7fb297eb
rahulpandey-rp/bootcamp_2021
/Python_Bootcamp/python_day3/list_comp.py
UTF-8
111
3.078125
3
[]
no_license
seq1 = "spam" seq2 = "scam" common_letter = [letter for letter in seq1 if letter in seq2] print(common_letter)
true
64f5559c1d2d5f7e4a0e5150c26c49a5a3482e68
vishalbelsare/pysterior
/pysterior/spikes/functional_spikes.py
UTF-8
1,894
3.625
4
[]
no_license
import unittest import math import numpy as np def compose(inner_function, outer_function): def composed_function(*args, **kwargs): return outer_function(inner_function(*args, **kwargs)) return composed_function def subcompose_single(inner_function, target_kwarg, outer_function): def composed_func...
true
dac89cdfcb307497392142702ea555e6ab61a126
HeDefine/LeetCodePractice
/Q114.二叉树展开为链表.py
UTF-8
1,482
3.96875
4
[]
no_license
#!/usr/bin/env python3 # https://leetcode-cn.com/problems/flatten-binary-tree-to-linked-list # 给定一个二叉树,原地将它展开为链表。 # 例如,给定二叉树 # 1 # / \ # 2 5 # / \ \ # 3 4 6 # 将其展开为: # # 1 # \ # 2 # \ # 3 # \ # 4 # \ # 5 # \ # 6 # Definition for a binary tree n...
true
54b8ca5a419cd7df3432d6c0164fe4eb560a06ee
zyocum/IAA
/test_alpha.py
UTF-8
9,153
3.140625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- mode: Python; coding: utf-8 -*- """Test suite for Krippendorff's alpha coefficient. Example matrix D: |-------------+----+---+---+----| | Annotators | | A | B | C | |-------------+----+---+---+----| | Subject | 1 | | 1 | | | Subject | 2 | | |...
true
a7b17ad8669c838a5e2294be5b6eee42965b1a75
bhlevca/Utils_py3
/utools/lakeStability.py
UTF-8
33,166
2.96875
3
[ "LicenseRef-scancode-cecill-b-en" ]
permissive
import numpy as np import math import csv from utools import display_data import matplotlib.pyplot as plt from utools import smooth windows = ['flat', 'hanning', 'hamming', 'bartlett', 'blackman'] window_6hour = "window_6hour" # 30 * 6 for a 2 minute sampling window_hour = "window_hour" # 30 window_halfhour = "wind...
true
3b7153ab5c318b93d00ec9367a8eb18621f0906b
JuliaMaria/Madrid
/Complutense/CLOHomework/P14a_mapper.py
UTF-8
230
2.90625
3
[]
no_license
#!/usr/bin/python import sys import re for line in sys.stdin: data = re.split(r",", line) if re.search('[a-zA-Z]', data[1]) is None and re.search('[a-zA-Z]', data[2]) is None: print( data[1] + "\t" + data[2] )
true
c8a0bb72862aae04d6e1fab5f992804f27e48164
KorsakovPV/yandex_contest
/13_Yandex_Contest 2/C/C.py
UTF-8
1,469
3.703125
4
[]
no_license
""" C. Эффективные числа Фибоначчи У многих жителей Трешландии на компьютере осталось совсем мало свободного места. Но они тоже хотят иметь возможность вычислять, сколько животных могут завести. Нужно оптимизировать решение задачи про вычисление чисел Фибоначчи. Объем дополнительной памяти должен быть O(1). Формат вв...
true
3786c55112e635eb272e8a87e3e46cc897b2454d
eeue56/TI-83Games
/mini.py
UTF-8
7,927
3.015625
3
[]
no_license
from __future__ import division # PyQT4 imports from PyQt4 import QtGui, QtCore, QtOpenGL from PyQt4.QtOpenGL import QGLWidget # PyOpenGL imports import OpenGL.GL as gl import OpenGL.arrays.vbo as glvbo from random import choice COLOURS = { 'black' : (0, 0, 0), 'other-grey' : (0.25, 0.25, 0.25), ...
true
c06a529fd401553c862e188940733bd9cfe6e8e8
Naowak/Alakazam
/graphics/test2.py
UTF-8
10,916
2.5625
3
[]
no_license
import sys sys.path.append("./../map") import pygame import math as m from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * from enum import Enum import time import array import Location import Map import Sight SIZE = 1 class Display_list_color_click_array() : def __init__(self, i_size, j_s...
true
08b069ebb499414c8f4c0212c6cb21f1f652868a
piotrpasich/python_exercises
/zestaw3.py
UTF-8
3,127
3.6875
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Piotr Pasich, Łukasz Wycisło WSB, Informatyka, Niestacjonarne, Programowanie w jezyku Python Zestaw 3 """ import os """ Zadanie 1 Napisz program otwierający plik Dane1.txt i wyświetlający jego zawartość. """ path = os.path.dirname(os.path.abspath(__file__)) filename...
true
505d238e6ca484e1bce5c905797a96bf2c31cf26
bdaene/python-challenge-tools
/utils.py
UTF-8
2,665
3.75
4
[]
no_license
"""Library containing tools that do not fit in specialized libraries""" from functools import wraps from math import comb, gcd from sys import stdout from time import perf_counter def comb_mod(n, r, mod): """Returns comb(n, r) % mod using Lucas theorem. mod has to be prime.""" c = 1 while r > 0: ...
true
8b06f3b10e42721e9bcd4a6154c0e0c309ee353e
particle128/ssdlut-news-hub
/web_server.py
UTF-8
3,000
2.546875
3
[ "MIT" ]
permissive
# -*- coding=utf-8 -*- import re , redis , urllib , logging from urlparse import urlparse, parse_qs from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from config import * def generate_page(rs): body='' for source in SOURCE: name=source['name'] items=rs.hgetall(name).items() # 显示结果按照新闻id降序排列 li...
true
e67ee672ed580f829290a1b58b53b2479b7a1943
leonskim/webdnn
/example/custom_operator/section1/square.py
UTF-8
1,929
2.9375
3
[ "Zlib", "MIT" ]
permissive
import keras class SquareLayer(keras.layers.Layer): """ calculate x^2 elementwisely """ # noinspection PyMethodOverriding def call(self, x): return keras.backend.pow(x, 2) # --------------------------------------------------------------------------------------------------- # Step 1. Def...
true
f930b88244a4f53b86a0e8885e8f6a3877e66fa4
hackcyprus/jobber
/scripts/management/create_job.py
UTF-8
2,656
2.734375
3
[ "MIT" ]
permissive
""" Creates a new job interactively. A company and a location *need to exist* before the job is created. Usage: create_job.py """ from docopt import docopt from env import path_setup path_setup() from jobber.script import run, die, prompt from jobber.core.models import Company, Job, Location def handle_locat...
true
0ce2027ef4d086cde0b0e389c26221d3675bc271
suhanacharya/python-jetbrains-academy
/Number of users/task.py
UTF-8
133
2.65625
3
[]
no_license
# write your code here with open("users.json", "r") as json_file: user_dict = json.load(json_file) print(len(user_dict["users"]))
true
5006898d4b4e5c4cf247bd799c6db8bfca940fa1
MarkJParry/MyGMITwork
/Week08/numpyLab.py
UTF-8
835
4.5625
5
[]
no_license
#Filename: numpyLab.py #Author: Mark Parry #Created: 09/03/2021 #Purpose: Weekly Lab 8 using numpy, demonstrates numpy array properties import numpy as np salMin = 20000 salMax = 80000 salLen = 10 #2. seeds the random numbers so that they stay the same while program is being run and tested np.random.seed(1)...
true
0da69eb4daff77a5ea79e5957329411a9e363479
sscluck/NumberGuessing
/code/workshop.py
UTF-8
2,636
3.84375
4
[ "MIT" ]
permissive
""" The MIT License (MIT) Copyright (c) 2013 Sally and Stephanie Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,...
true
18050b96d0356eae95434178987dc2982f621f35
codenm007/Gitbot-using-Python-speech-Recognition
/tkinter_github_account.py
UTF-8
542
2.6875
3
[]
no_license
from tkinter import * root3 = Tk() root3.title('Voice control git management system') root3.iconbitmap('icon.ico') def githubAccount(): label_github_account = Label(root3, text='Enter your github repo:') label_github_account.grid(row=1, column=1, padx=10, pady=10) entry_github_account = Entry(root3, widt...
true
dd1588f4e0d4c9b5b92d1b14f8080cfe0f828149
ahmedje123/Programming.ICT
/Practice Exercises/les5/pe5_3.py
UTF-8
361
3.46875
3
[]
no_license
infile = open("C:\\Users\\Ahmad\\PycharmProjects\\untitled\\Practice Exercises\\les5\\kaartnummers.txt", 'r') content = infile.read() lst = [line.split(', ')[0] for line in content.split ('\n')] x = max(lst) infile.close() print('Deze file telt ' , len(lst) , ' regels') print('Het grootste kaarntummer is: ', x , ' en...
true
18d4373fcd27f5c7bc5e0ccd6681ae06370dedea
bharath-j-old/Text-Mining-Tweepy
/tweepy.py
UTF-8
953
2.96875
3
[]
no_license
#import necessary methods from tweepy library from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream #adding user credentials to the following variables access_token = '' access_token_secret = '' consumer_key = '' consumer_secret = '' file = open('twitter_data.txt', 'w'...
true
082185554b8db4f116b44191d6c7dd5d7503c107
LDiazN/LenguajesDeProgramacion
/tarea_1/ejercicio_4/zip.py
UTF-8
366
3.75
4
[]
no_license
def zip(a,b): if a and b: yield (a[0], b[0]) for p in zip(a[1:], b[1:]): yield p for p in zip([1,2,3], ['a', 'b', 'c']): print(p) def zipWith(a,b,f): if a and b: yield f(a[0],b[0]) for p in zipWith(a[1:], b[1:], f): yield p for p in zipWith([0,1,2,1]...
true
b189c240c74945d0f3f787717a0a2347129b0e1c
enaim/Competitive_Programming
/Python/Ex_10.py
UTF-8
164
3.015625
3
[]
no_license
import random a = random.sample(range(1,30), 12) b = random.sample(range(1,30), 16) print(a) print(b) result = [i for i in set(a) if i in b] print(result)
true
4694770349d21b2c089c6348775f692e97f416b1
izgzhen/hidden-markov-example
/models.py
UTF-8
14,438
2.6875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # Problem 1: Bigram HMMs import json import math import time import sys import os UNK_PROP = 0.1 START = 'START\0' START2 = 'START2\0' UNK = 'UNK\0' STOP = 'STOP\0' STOP2 = 'STOP2\0' MODE = "default" if os.getenv("MODE") is not None: MODE = os.getenv("MODE") def load_...
true
012d35e1365e14a8594c1377da322794a3f02d8f
jackspicer1229/CSCI4622-NLP
/svm.py
UTF-8
2,358
2.984375
3
[]
no_license
import pandas as pd import texthero as hero from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer from sklearn.model_selection import train_test_split, GridSearchCV from sklearn.svm import SVC from sklearn.metrics import accuracy_score, confusion_matrix, precision_score, recall_score, f1_sc...
true
3c3e5564fd4163a4c072d0632962be3a5ec8733f
AlexandreLouzada/Pyquest
/envExemplo/Lista14/main.py
UTF-8
2,530
3.703125
4
[]
no_license
from produto import Produto from gerenciador_produtos import GerenciadorProdutos def exibir_menu(): print("1. Incluir produto") print("2. Consultar produto") print("3. Alterar produto") print("4. Excluir produto") print("5. Listar produtos") print("6. Sair") def executar_menu(): arquivo ...
true
1b64678a40e99773341a4e8a6c777c7480b9a4a7
voicezyxzyx/python
/Exercise/银行自动提款机系统/atm.py
UTF-8
1,514
3.046875
3
[]
no_license
from card import Card from user import User import random class ATM(): def __init__(self): self.allUsers={} def createUser(self): '''向用户字典中添加一对键值对''' name=input("请输入您的姓名:") idCard=input("请输入您的身份证号码:") phone=input("请输入您的电话号码:") prestoreMoney=int(input("请输入预存金额:")...
true
d2ecea826d8c54634b4dc3058a3938d5f193b960
devlabsf/Concentration-Match-Match-
/card.py
UTF-8
342
3.03125
3
[]
no_license
class Card: def __init__(self, value, suit): self.value = value self.suit = suit if self.suit in ('hearts','diamonds'): self.color = "red" else: self.color = "black" def get_val(self): return self.color + self.value def get_file(self): return 'cards/' + self.value + '_' +...
true
41f6ec1a09d5929c91794040c225c47be8865a3f
oriasegal/Python_Programs_AI
/ex01 - A-Star/state.py
UTF-8
3,186
3.875
4
[]
no_license
''' The state is a list of 2 items: the board, the path The target for 8-puzzle is: (zero is the hole) 012 345 678 ''' import random import math # returns a random board nXn def create(n): s = list(range(n*n)) # s is the board itself. a vector that represent a matrix. s=[0,1,2....n^2-1] m =...
true
9f94cd0a6947f6a30dd661bc265a3798d6b74c0f
rsumner31/ngraph
/ngraph/frontends/caffe2/c2_importer/ops_unary.py
UTF-8
5,148
3.015625
3
[ "Apache-2.0" ]
permissive
# ****************************************************************************** # Copyright 2017-2018 Intel Corporation # # 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.apa...
true
e137c80f0b65039b91c21112aa7b0ea40e41c4d0
hiddenpoool/digitalwand
/ex2/pypy.py
UTF-8
1,190
4.21875
4
[]
no_license
# ----------------- # Реализуйте функцию even_last, которая принимает на вход список # задан массив целых чисел. Вы должны найти сумму элементов с четными индексами # (0-й, 2-й, 4-й ...), а затем умножить это суммированное число на конечный элемент массива. # Не забывайте, что первый элемент имеет индекс 0. # Для пусто...
true
7a901428030be14e1aea86cd7480086c76c592ef
gmsIgor/igorgomespereira_P1
/Q3.py
UTF-8
367
3.078125
3
[]
no_license
#questao 3 def pi(): anterior = 0 prox_imp = 1 pi = 4*(1/prox_imp) anterior = -1000000 while abs(pi-anterior) > (5*pow(10,-8)): anterior = pi if(prox_imp < 0): prox_imp = (abs(prox_imp) + 2) else: prox_imp = -(prox_imp + 2) pi...
true
4fa88c91e00eb466076f7aa37bbbfe57f792c3a2
leric2/GROMORA-harmo
/scripts/pyretrievals/tests/retrievals/arts/test_atmosphere.py
UTF-8
2,005
2.640625
3
[ "MIT" ]
permissive
import pytest import xarray as xr import numpy as np from retrievals.arts.atmosphere import Atmosphere import os TEST_DATA_PATH = os.path.join(os.path.dirname(__file__), 'test_data') def _default_atmosphere(): # Generate some stupid test data p_grid = np.logspace(1e5, 1-2, 100) t_field = np.linspace(10,...
true
9bda1ae03b3fab092dba025ff576f7e486efc16e
FluffyFu/Leetcode
/703_kth_largest_element_in_a_stream/solution.py
UTF-8
688
3.5625
4
[]
no_license
import heapq from typing import List class KthLargest: def __init__(self, k: int, nums: List[int]): # only need to keep track of the k-largest m = min(len(nums), k) self._heap = sorted(nums)[-m:] heapq.heapify(self._heap) self._k = k def add(self, val: int) -> int: ...
true
10077a74b37cd0fb2e53188d153731d9ca09ab10
hinewin/The-Modern-Python-3-Bootcamp
/ch.15 HTTP Request/3. Requests Module.py
UTF-8
624
3.078125
3
[]
no_license
# requests Module # Makes HTTP requests from Python code # USeful for web scrapping/crawling, grabbing data from other APIs, etc # Install using PIP import requests url = "https://www.google.com" # will need http response = requests.get(url) print (f"Your request to {url} came back w/ status code {response.status_co...
true
49374134981734db942b4142b69c8b83c17c63fa
fingerman/python_fundamentals
/intro/2_12_currency_converter.py
UTF-8
937
3.25
3
[]
no_license
a = float(input()) c1 = input() c2 = input() if c1 == "USD" and c2 == "BGN": a = a * 1.79549 print("{0:.2f}".format(a), c2) elif c1 == "BGN" and c2 == "USD": a = a / 1.79549 print("{0:.2f}".format(a), c2) elif c1 == "BGN" and c2 == "EUR": a = a / 1.95583 print("{0:.2f}".format(a), c2) elif c1 ==...
true
276a6fa35f2b96a15e05cfc3cc43586d9a14e050
Rajeshwarchennam/machine_learning1
/posterior.py
UTF-8
1,073
3.046875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt def power(x,n): y=1 for i in range(n): y=y*x return y def polybasis(x,m): l=len(x) X=x if m>1: for i in range(2,m+1): y=power(X,i) x=np.column_stack((x,y)) z=np.column_stack((np.ones(l),x)) return ...
true
b658be3331fb4345eea86c933e1d7665fe8dcc85
ProdigyXable/UnifiedDebuggingStudy
/Scripts/RQ3/get_exclusive_versions.py
UTF-8
828
2.765625
3
[ "MIT" ]
permissive
from collections import defaultdict tool_vs = dict() with open("plausible.txt") as f: for line in f: if ":" in line: tool = line.split(":")[0] versions = line.split(":")[1].split() tool_vs[tool] = versions tool_exclu_versions = defaultdict(list) for tool_target in tool_vs: # each target tool target_v...
true
a53af1c84d410143333ef6b6ffcf74c3dae23967
ElishaKay/python-practice
/basic_py_stuff/stringfunctions.py
UTF-8
612
4.5
4
[]
no_license
# STRING FUNCTIONS myStr = 'HelloThereWorld1' # Capitalize print(myStr.capitalize()) # Swap case print(myStr.swapcase()) # Get length print(len(myStr)) # Replace print(myStr.replace('World', 'Everyone')) # Count sub = "H" print(myStr.count(sub)) # Startswith print(myStr.startswith('Hello')) ...
true
155d38e02082339a0125a76d2b782ef2912695fd
oribaldi/Master_Project
/stack_network.py
UTF-8
4,869
3.015625
3
[]
no_license
# -*- coding: utf-8 -*- ################################################################## # # TUM Informatics # Master Thesis Project: Indexing Methods for Social Search # # Author: Oriana Baldizan # Date: March 2016 # # stack_network.py : defines the social network of the Stack data # #############################...
true
50158e6e78a064b1c575f3ee27bc81dfc329eebb
HuyaneMatsu/hata
/hata/discord/channel/forum_tag_update/tests/test__ForumTagUpdate__constructor.py
UTF-8
1,774
2.78125
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
permissive
import vampytest from ...forum_tag import ForumTag from ..forum_tag_update import ForumTagUpdate def _assert_fields_set(forum_tag_update): """ Tests whether all fields are set of the given forum_tag update. Parameters ---------- forum_tag_update : ``ForumTagUpdate`` The forum_tag up...
true
fb017845e7fc42ac0e237cff6ae4970f813ddcde
mirik93/mgm-banking
/hubbardtitle/models.py
UTF-8
1,325
2.75
3
[]
no_license
from flask_sqlalchemy import SQLAlchemy from hubbardtitle import app,db from werkzeug.security import generate_password_hash, check_password_hash #import date time from datetime import datetime class User(db.Model): id = db.Column(db.Integer, primary_key = True) username = db.Column(db.String(150), nullable =...
true
3bad6f8a6ea3e00d1beb4a11d6602df56219ebc0
aj3sh/python-design-patterns
/1. Creational Patterns/5. Prototype/main.py
UTF-8
2,051
3.78125
4
[]
no_license
''' Instead of creating new objects setting the same attributes every time, Prototype method include prototyping the common objects into a cache and clones it to give a new instance. Later on the distinct attributes can be changed. ''' import copy class Player: name = None def set_name(self, name): self.name =...
true
9abd8d0e8956021caf78dcdde776a2eb1d5d184a
seun5/US-Bikeshare-Analysis-Project
/bikeshare.py
UTF-8
16,732
3.546875
4
[]
no_license
import csv import time from datetime import datetime # ## Filenames # chicago = 'chicago.csv' # new_york_city = 'new_york_city.csv' # washington = 'washington.csv' # Lists city_list = ["chicago", "new_york_city", "washington"] time_period_list = ["month", "day", "none"] month_list = ["January", "February", "March",...
true
7ffa7086ecb0f89a552e98430da474008921a05c
bryanhonof/2EA-ICT_Network_Programming
/GPIO/ledButton.py
UTF-8
1,157
3.328125
3
[ "MIT" ]
permissive
#!/usr/bin/python # impot libraries import RPi.GPIO as GPIO import time # declare hardware pins ledPin = 18 butPin = 17 # set some GPIO stuff GPIO.setmode(GPIO.BCM) GPIO.setup(ledPin, GPIO.OUT) GPIO.setup(butPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) # beginning state GPIO.output(ledPin, GPIO.LOW...
true
a4b8afbb44fef017d5208fc7021ac0e6a789a5bf
thiagobc98/ExerciciosPython
/EXERCICIO_04_REPETICAO.py
UTF-8
348
4.03125
4
[]
no_license
pais_A = 80000 pais_B = 200000 anos = 0 print("População do País A: ", pais_A) print("População do País B: ", pais_B) while(pais_A <= pais_B): pais_A = pais_A * 1.030 pais_B = pais_B * 1.015 anos = anos + 1 print("Para a população do País A bater ou igualar a do País B vai ser preciso ", ...
true
6d4394628e8f58523975c3242643162f0d2ab75a
theCuriousHAT/speciality-classifier
/score.py
UTF-8
2,137
2.515625
3
[]
no_license
#import pickle import json import numpy as np #from sklearn.externals import joblib #from sklearn.linear_model import Ridge from azureml.core.model import Model import joblib import pandas as pd import os import nltk from nltk.corpus import stopwords #from nltk.stem import PorterStemmer from textblob import...
true
9f6afa8ae3b6d2b6ed905044b7065e938b57110e
domnamsk/project
/HW 1-1.py
UTF-8
524
3.5
4
[]
no_license
# Задача-1: поработайте с переменными, создайте несколько, # выведите на экран, запросите от пользователя и сохраните в переменную, выведите на экран a = 10 b = 'OK' c = 444.3 d = c != 444.2 print('a =', a, ' type:', type(a)) print('b =', b, ' type:', type(b)) print('c =', c, ' type:', type(c)) print('d =', d, ' ...
true
13a4064cbdc35a7a14ec33d3ed452c491a88001c
metalmerge/Python-201-FinalProject
/Python-201-FinalProject/main.py
UTF-8
1,240
3.625
4
[]
no_license
import Approval, Plurality, Runoff while (True): choice = int( input(""" Pick what election type: 1- Plurality 2- Runoff 3- Approval """)) if choice == 1: print( """In single-winner plurality voting, each voter is allowed to vote for only one candidate, and the winner of the ele...
true
e43bfa39edd7a7862f7d3bfd170ed2a1557c1882
bnajafi/EETBS-Assignments-Polimi-2018-2019-
/Assignment4/Assignment4_AnaBlanco.py
UTF-8
2,711
3.1875
3
[]
no_license
#ASSIGNMENT 4 (Example 1 Unit 1.2): #Calculate Overall unit thermal resistance (Rtotal) and overall heat transfer coefficient (Utotal) #1st way of importing data: import wallFunctions as nickname import os import sys thisFileDirectory = os.path.dirname(sys.argv[0]) os.chdir(thisFileDirectory) print os.getcwd() R_i=...
true
7d19154ca82fb973f7830d7da64f907a39a46c6e
califafa/algorithm_test
/tools/python_fitting_01_numpy.poltfit(x,y,n).py
UTF-8
1,074
3.671875
4
[]
no_license
#enviroment: anaconda python3.5 #implement: numpy.polyfit(x,y,n), result: y = a*x^n+b*x^(n-1)+...... import numpy as np import matplotlib.pyplot as plt import random datLen=10 fitLen=12 x=[] for i in range(datLen): x.append(i) x1=[] for i in x: for j in range(100): x1.append(i+0.01*j) #x=np.array...
true
c5fa5c091ba0d2d84e5b773224d885a8f9377c16
lipengyuer/test
/src/algorithmLearning/test.py
UTF-8
2,413
3.171875
3
[]
no_license
import time import copy class ListNode(): def __init__(self, v): self.val = v self.next = None class Solution: def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ res1, res2 = addTwoNode(l1.val, l2.val) ...
true
fc003ef777f04516f3125cc45cca4ba4a3d52d12
liberbell/pylib01
/stats.py
UTF-8
1,130
3.8125
4
[]
no_license
import statistics import csv import array sample_data1 = [1, 3, 5, 7] sample_data2 = [2, 3, 5, 4, 3, 5, 3, 2, 5, 6, 4, 3] # print(statistics.mean(sample_data1)) # print(statistics.median(sample_data1)) # print(statistics.median_low(sample_data1)) # print(statistics.median_high(sample_data1)) print(statistics.mode(s...
true
cf19522d2d01cfa1dad71ea7ac3ef28fed03347e
binit-singh/python-datastructures
/week3_greedy_algorithms/3_car_fueling/car_fueling_test.py
UTF-8
911
2.9375
3
[]
no_license
import unittest from .car_fueling import compute_min_refills class CarFuelingTestCase(unittest.TestCase): def test1(self): d = 500 t = 200 n = 4 stops = [100, 200, 300, 400] refill = compute_min_refills(d, t, stops) self.assertEqual(refill, 2) def test2(self): ...
true
b2b5f63f81d03275355622ff2bcc36ad4c1d1b50
CI-WATER/erfp_era_interim_process
/generate_return_periods.py
UTF-8
3,585
2.59375
3
[ "MIT" ]
permissive
#!/usr/bin/python #generate_return_periods.py import netCDF4 as nc import numpy as np import os from json import dumps def generate_return_periods(era_interim_file, return_period_file): """ Create warning points from era interim data and ECMWD prediction data """ id_dim_name = u'COMID' print "Ext...
true
997950f374a0dd32af48b3fb2bb4ef8f578ea4bd
mikepatel/NBA-Shoes-ProGAN
/train.py
UTF-8
6,314
2.9375
3
[]
no_license
""" Michael Patel April 2020 Project description: Build a GAN to create basketball shoe designs File description: For model preprocessing and training """ ################################################################################ # Imports import os import numpy as np from datetime import datetime impor...
true
f8385d6eab3c364224b98674671ecd23530a9ba3
kmu-cs-swp2-2018/class-03-bjs07
/MainGUI.py
UTF-8
5,907
2.5625
3
[]
no_license
from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QApplication, QWidget, QLineEdit from PyQt5.QtWidgets import QLayout, QGridLayout from PyQt5.QtWidgets import QWidget,QPushButton,QHBoxLayout,QVBoxLayout,QApplication,QLabel,QComboBox,QTextEdit,QLineEdit from PyQt5 import QtCore from PyQt5.QtGui import * import pi...
true
eb230bc69ac123303da37d089bc18e2454c69be3
windhaunting/Coding_practices
/ArrayStackQueueHash/mergeInterval.py
UTF-8
1,076
3.59375
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 15 14:33:34 2018 @author: fubao """ # 56. Merge Intervals # facebook ''' Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18]. ''' # Definition for an int...
true
4eba838760f7bb3bb25147b30e9b4819c314f211
MinghaoHan/eye_of_the_sky
/server/Socket&Show/server1.py
UTF-8
2,661
2.96875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jun 27 21:03:45 2020 @author: hp """ # -*- coding=utf-8 -*- import socket import os class Send: def __init__(self,IP,port): self.IP=IP self.port=port def send_data(self): conn = socket.socket() # 声明socket类型,同时生成sock...
true
48d0ae249133845238204d03a7fce055661d8824
Jaswanth1020/Uber-Implementation
/instanceGenV3.py
UTF-8
17,359
3.328125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Mar 2 16:22:26 2019 @author: poikones """ import random import numpy as np import math """ Function that computes the Euclidean distance betwen two points (x1,y1) and (x2,y2). """ def distance(x1,y1,x2,y2): d = ((x2-x1)**2+(y2-y1)**2)**0.5 return d...
true
d34238b51e0fd93b55024f70e3833610183305e7
rjmsilf/WISB256
/Opdracht1/ManyGreetings.py
UTF-8
106
3.765625
4
[]
no_license
name=input('What is your name? ') times=input('How many greetings? ') print(times+' x Hello, %s!' %(name))
true
322b0999834ce4c47ec028b122da212878508432
M2I-HABET/CyTrack
/CyTrack/CyPredict/predictor/atmosphere/AtmosphereState.py
UTF-8
1,500
3.65625
4
[ "MIT" ]
permissive
''' A representation of the conditions of the atmosphere. Units are managed by the user. @author: adapted by DGXU ''' class AtmosphereState: h = 0.0 p = 0.0 t = 0.0 dp = 0.0 wd = 0.0 ws = 0.0 #create new state. def __init__(self, altitude, pressure, temperature, dewPoint, windDirectio...
true
70260becf74d5815e34014bfa87add3faa1188eb
TetyanaLi/hillel_python
/LEVEL_1/LESSON_5/lesson5-3.py
UTF-8
342
3.46875
3
[]
no_license
katet_a = float(input('Введите длину:')) katet_b = float(input('Введите ширину:')) if katet_a != katet_b: s = katet_a * katet_b * 0.5 elif katet_a == katet_b: s = katet_a ** 2 print((s)) #вопрос - как ограничить знаки после запятой в вещественном числе?
true
857810a244766b0cc3a93a95eb8e6ef75ef92551
csomura/misc_scripts
/tileslide.py
UTF-8
2,418
3.796875
4
[]
no_license
#3x3 tile slide puzzle, solve it! import time #make tile object class tile(): def __init__(self): a = 1+1 def initialize(self, x,y,num): self.x = x self.y = y self.num = num def changecoord(self,x,y): self.x = x self.y = y #make space object class space(): def __init__(self): a = 1+1 self.n...
true
6c963e965e27bb68aebb50f8c7efed92d30cf992
chng3/Python_work
/第七章练习题/7-8-10.py
UTF-8
1,297
3.640625
4
[]
no_license
# 7-8 熟食店 sandwich_orders = ['pastrami', 'tuna', 'derr', 'pastrami', 'derr', 'pastrami'] finished_sandwiches = [] while sandwich_orders: finished_sandwich = sandwich_orders.pop() print("I made your " + finished_sandwich + " sandwich.") finished_sandwiches.append(finished_sandwich) print(finished...
true
a46bd7af3b9771c7c27911d1ea9442f28e3e5d0e
metagenlab/diag_pipelines
/rules/report_generation/scripts/MN_tree.py
UTF-8
3,824
2.78125
3
[]
no_license
import numpy import networkx import pandas import json import itertools def find_clusters(G, node_list): comb = itertools.combinations(node_list, 2) groups = [] for i in comb: if i[0] == i[1]: continue try: weight= (G[i[0]][i[1]]) except: if le...
true
b4df29d26b436fdf67232a6df0cff185824c2f5d
legacyunited/cryptogram-solver
/src/solver.py
UTF-8
1,353
3.046875
3
[]
no_license
import requests from bs4 import BeautifulSoup sample = 'DL KBZ PVVM ZBDE LKBL EVXFROBRT DZ LKV CFOZL QFOZL QFOX FQ WFNVOMXVML VJRVGL BUU LKV FLKVOZ LKBL KBNV PVVM LODVE.' class solve_cryptogram: def solve(self, cryptogram): if len(cryptogram) == 0 or not len(''.join(cryptogram.replace(' ',''))): ...
true
2f9314adae90f5c96f2309a12ee3ac0142210b13
aguha65/hairy
/quarters/test_mnist.py
UTF-8
8,868
2.65625
3
[]
no_license
import sys import os import time import numpy import numpy as np import pickle from sklearn.datasets import fetch_mldata from sklearn.cross_validation import train_test_split import theano import theano.tensor as T from logistic_regression import LogisticRegression from fully_connected import HiddenLayer from conv_l...
true
484d3314d1a982c8aa50574deb81a3a27f8b048c
hptruong93/TXT
/Class_exercise.py
UTF-8
1,989
3.046875
3
[]
no_license
class Camera(object): def __init__(self, model, battery_model): self.model = model self.battery_model = battery_model def take_photo(self, thing): print("{} takes photos of {}".format(self.model, thing)) def set_up(Camera, Tripod) print("Set up Camera {} on Tripod".format(C...
true
0d1ff7b97d793de42452a6e287ee273b14d69d2e
royveshovda/deep-reinforcement-learning
/p3_collab-compet/network.py
UTF-8
1,567
2.59375
3
[ "MIT" ]
permissive
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from utils import hidden_init class Network(nn.Module): def __init__(self, config, seed, device): super(Network, self).__init__() self.seed = torch.manual_seed(seed) self.input = nn.Linear(config.input_siz...
true
983722dbab4dfc7cf5f8e7eb99b9cafc2bbaa0c7
6jk/MyPythonLearning
/基础python学习/Gerrlogging.py
UTF-8
1,194
3.640625
4
[]
no_license
import logging def foo(s): return 10/int(s) def bar(s): return foo(s)*2 def main(): try: bar('0') except Exception as e: logging.exception(e) main() print('END') # class FooError(ValueError): # pass # def foo(s): # n = int(s) # if n==0: # raise FooError('invalid v...
true
696b53c2849d3833221028024ed02d697e0cdfa5
raresrosca/advent_of_code_2020
/day13/day13.py
UTF-8
2,239
3.4375
3
[]
no_license
# ---- Part 1 ----- def handle_input(file_name): with open(file_name, 'r') as f: lines = f.readlines() time_stamp = int(lines[0].rstrip()) schedule = [] for i in lines[1].split(','): if i != 'x': schedule.append(int(i)) return time_stamp, schedule...
true
11487fe517ab5ba1dfb5a73d2234503abf3e5aca
rthijssen/FlowerMonkey
/file_handler.py
UTF-8
208
2.921875
3
[]
no_license
#/!/usr/bin/python def writeDataToFile(filename, data, quitOnFail=False): f = file("output/"+filename, "a") f.write(data) f.flush() f.close() print "[*] Successfully saved %s" % filename
true
8e4527a7817738c05cbfe80c3ed185c23197e473
jiayi-wei/vqa-tf2
/preprocess.py
UTF-8
9,937
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- import random import numpy as np import json import argparse import tensorflow as tf import re import os from tqdm import tqdm def get_top_answers(data, params): mem = {} for item in data: ans = item['answer'] mem[ans] = mem.get(ans, 0) + 1 ans_count = sorted([(cou...
true
67c035e31961cf630bfb027bf6a9ce856288adc1
73nko/daily-interview
/Python/max-stack.py
UTF-8
866
4.4375
4
[]
no_license
### # 26-11-2020 # Hi, here's your problem today. This problem was recently asked by Twitter: # Implement a class for a stack that supports all the regular functions (push, pop) and an additional function of max() which returns the maximum element in the stack (return None if the stack is empty). Each method should ru...
true
42f58aaf6d2925edd670553b893226a550e6189a
jhqthai/waste-treatment-system
/treatment-station/ti-sensor-tag/call-test.py
UTF-8
1,508
2.84375
3
[]
no_license
from cc2650sensortag import * import os import time import sys # ---------------------------------------------------------------------------# # Application Related Macros # ---------------------------------------------------------------------------# HEAT = "24:71:89:E8:85:83" UNDULATION = "24:71:89:CC:1E:00" A...
true
3aeaac2b4e17d19c676b2f7bd51cfe2d7209d806
ibis-project/ibis
/ibis/common/temporal.py
UTF-8
6,513
2.75
3
[ "Apache-2.0" ]
permissive
from __future__ import annotations import datetime import numbers from abc import ABCMeta from decimal import Decimal from enum import Enum, EnumMeta import dateutil.parser import dateutil.tz import pytz from public import public from ibis import util from ibis.common.dispatch import lazy_singledispatch from ibis.co...
true
4caebcbd4cbde4b1efe8742be042f41e0d23006f
isakson98/Equities-Research
/Fundumental_fetch_scripts/process_tickers_dataset.py
UTF-8
4,397
2.65625
3
[]
no_license
import pandas as pd import datetime import requests import os from bs4 import BeautifulSoup import sys sys.path.append(os.getcwd()) # current directory must be root project directory from Fundumental_fetch_scripts.harvest_ticker_names import DIRECTORY_TO_SAVE_IN, ACTION_TYPE from Data_Access.Find_file_path import find...
true
c36189ae41d834c93df14470ca3a8f9a63d880bf
loggar/py
/py-core/statements/better-docstring.py
UTF-8
576
4.5625
5
[]
no_license
from collections.abc import Iterable def print_each_item(items: Iterable) -> None: """ Prints each item of an iterable. Parameters: ----------- items : Iterable An iterable containing items to be printed. Raises: ------- TypeError: If the input is not an iterable. ValueEr...
true
4b365e520070e756a32f62d885283be490973140
Gluuz/GildedRose-Refactoring-Kata
/src/items/backstage_passes.py
UTF-8
886
2.625
3
[ "MIT" ]
permissive
from src.items.helpers.constants import INCREMENTER_SELL_IN_VALUE, MAX_QUALITY_DEFAULT_VALUE from src.items.base import Item class BackstagePassesItem(Item): def __init__(self, name: str, sell_in: int, quality: int): super().__init__(name, sell_in, quality) self.is_valid_quality(self.get_quality(...
true
1682b8c641ba2ffaebeaf3d3e1ec1a8bbbe7a00b
cshung/Competition
/rosalind/edit.py
UTF-8
452
3.15625
3
[]
no_license
# http://rosalind.info/problems/edit/ from sys import stdin from libfasta import readFasta from liblevenshtein import levenshtein def edit(str1, str2): m = len(str1) n = len(str2) (cost, choice) = levenshtein(str1, str2, True) return cost[m][n] def main(): data = [] for line in stdin: data.append(lin...
true
79dd96b09e9ce40e92c25ab343849ef897c12c84
Dhruvish09/PYTHON_TUT
/Operators/Assignment Operators/Modulus AND.py
UTF-8
105
3.375
3
[]
no_license
#Takes modulus using left and right operands and assign result to left operand x = 5 x%=3 print(x)
true
1a8fc74367d20244737ace2a177582c04e18947b
r2kode/se-udemy
/pytest_tut/test_class_demo.py
UTF-8
435
2.90625
3
[]
no_license
import pytest from pytest_tut.class_to_test import SomeClassToTest @pytest.mark.usefixtures("oneTimeSetUp", "setUp") class TestClassDemo(): @pytest.fixture(autouse=True) def classSetup(self): self.abd = SomeClassToTest(10) def test_method_a(self): print("test_method_A") result = ...
true
84eb6e85b98596a60c75bf39616ce217c466d0c1
Bingwen-Hu/hackaway
/projects/olds/pyscripts/is_exist.py
UTF-8
578
3.015625
3
[ "BSD-2-Clause" ]
permissive
# -*- coding: utf-8 -*- """ 百度百科上都有谁? """ from utils import preprocess def judge(soup): no_result = soup.find_all('p', {"class": "sorryCont"}) if no_result: print("Sorry, 百度百科上没有哦!要不你自己写一个?") return links = soup.find_all("ul", {"class": "polysemantList-wrapper"}) if not links: ...
true
24c2b889991a42fcc7d99246e5a6c4984e4006c4
Alejandro-Gutierrez/Ejercicio-Python
/ejercicio10.py
UTF-8
130
2.96875
3
[]
no_license
diccionario={ "Nombre":"luis", "Apellido":"Gutierrez", "Edad":16 } for x in diccionario: print (diccionario[x])
true
3de9416b7d00ac2557941d0d1ada2321b8623a51
pnnl/FlexyAirDeepMPC
/neuromancer/neuromancer/dev/neuralODE.py
UTF-8
2,771
2.71875
3
[ "MIT" ]
permissive
# # # # TODO: differentiate autonomous and non-autonomous odes # # and odes with and without disturbances # """ # gray-box ODE for training with customly defined nonlinmap # then use them as specifi nonlinear and linear maps # e.g., nonlinmap = [CSTR, LorentzSystem] # linmap = identity not being learned ...
true
cc88cc842c95e5422d9eedb78665f7b81e239c4a
AKLeee/LeetCode_OJ
/Min_Depth_BT#49/min-depth-bt-run.py
UTF-8
254
2.65625
3
[]
no_license
from MinDepthBT import Solution from TreeNode import TreeNode root = TreeNode(1) node02 = TreeNode(2) node03 = TreeNode(3) node04 = TreeNode(4) root.left = node02 #root.right = node03 #node02.left = node04 test = Solution() print test.minDepth(root)
true
e9423c0ba139f4e716631fbabd8cfcf5f5af6f0a
rscircus/advent_of_code_2019
/03part2.py
UTF-8
2,645
3.90625
4
[]
no_license
# The task here is two-fold: # 1. find the intersections of two paths on a 2D-grid # 2. find the few fewest combined steps the wires must take to reach an intersection # Basically the first brute force visual solution doesn't work for the correct input data which is way too big. And the first solution also needed ...
true
271a72a1ef9cab4ccfdbc32449ba2c79166bb0b5
OliverMD/TPOP
/theory/binaryTree.py
UTF-8
5,060
3.8125
4
[]
no_license
""" TODO: Add wrapper to binary tree in order to correctly implement ditcionary. This is so that the rotations will work. """ class BinaryTree: """Implements the abstract class Tree and probides operations for keeping the height logn """ def __init__(self): """creates and empty binary tre...
true
15e98b2774d750c24d39ce6135d2f2ed2da777d4
guna7222/CompletePythonDeveloper
/PythonBasics/Formatted_String.py
UTF-8
393
4.34375
4
[]
no_license
# Formatted Strings """ A python formatted method takes the passed arguments, format them and place them in the strings where the placeholders are. """ name = 'gunasekhar' age = 23 print(f'My name is {name} and i\'m {age} year old.') print('My name is {} and i\'m {} year old'.format(name, age)) print('My...
true
75d7a9feef7ff18828a2505af305ff7d977308f8
nbmhoang/makesense-verification
/main.py
UTF-8
668
2.75
3
[]
no_license
# -*- coding: utf-8 -*- import os import glob import xml.etree.ElementTree as ET def update_xml_file(xml_file: str): tree = ET.parse(xml_file) root = tree.getroot() for obj in root.findall('object'): # print('Found a object') for ele in obj: if ele.tag in ('truncated', 'difficult'): ...
true
4ff8373569543abb9f5d1123a6041b65dace4b82
xydro/Pong
/Pong/venv/star.py
UTF-8
997
2.84375
3
[]
no_license
import pygame import random from spritesheet import SpriteSheet class Star: def __init__(self, ai_settings, screen): self.screen = screen self.ai_settings = ai_settings ss = spritesheet.spritesheet('starsheet.png') # Sprite is 16x16 pixels at location 0,0 in the file... ...
true