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
de2448ff3aa47afacd09f8ab20223e529d5bb8e3
alfian853/py-chat
/py-chat/server/services/group_service.py
UTF-8
7,060
2.796875
3
[]
no_license
import uuid from entities import GroupEntity, UserEntity from repositories import GroupRepository, UserRepository from session import Session class GroupService: def __init__(self): self.user_repository = UserRepository.get_instance() self.group_repository = GroupRepository.get_instance() ...
true
25a3d0a4a0580d481bceeeea755bde44518eae0e
justJM/ds3
/37_tensor.py
UTF-8
2,957
2.8125
3
[]
no_license
#In[1] import tensorflow from tensorflow.python.client import device_lib def get_available_device(): local_device_protos = device_lib.list_local_devices() return [x.name for x in local_device_protos if x.device_type == 'CPU' or 'GPU'] print(get_available_device()) #%% import tensorflow as tf def gpu_device...
true
e4735fc14e73a0729552f8730b843033f98fa5c4
PlasmaPy/PlasmaPy
/plasmapy/formulary/collisions/lengths.py
UTF-8
16,163
2.59375
3
[ "BSD-3-Clause" ]
permissive
""" Module of length parameters related to collisions. """ __all__ = ["impact_parameter_perp", "impact_parameter", "mean_free_path"] import astropy.units as u import numpy as np from astropy.constants.si import eps0, hbar from numbers import Real from numpy import pi from plasmapy import particles from plasmapy.form...
true
3b38f72df88e4772ba19d043b18c73c26eb1e404
rahulravindran0108/Santander-Classification
/santander_visualizations.py
UTF-8
2,488
3.46875
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt def filter(data, condition): """ Remove elements that do not match the condition provided. Takes a data list as input and returns a filtered list. Conditions should be a list of strings of the following format: '<field> <op> <...
true
04c581414425f04ae6745d8f229a3cbe09a27f11
robinyms78/My-Portfolio
/Exercises/Python/Learning Python_5th Edition/Chapter 7_String Fundamentals/Examples/String Formatting/Method Calls/Advanced Formatting/EG4/EG4/EG4.py
UTF-8
217
3.109375
3
[]
no_license
# Parameters hardcoded print("{0:.2f}".format(1/3.0)) # Ditto for expression print("%.2f"%(1/3.0)) # Take value from arguments print("{0:.{1}f}".format(1/3.0, 4)) # Ditto for expression print("%.*f" %(4, 1/3.0))
true
8bce9bd51e617c7811d7097cce6dcfcbb271984c
takuseno/wba-hackathon
/agent/tfalex/FeatureExtractor.py
UTF-8
3,011
2.5625
3
[ "Apache-2.0" ]
permissive
import tensorflow as tf from mynet import AlexNet as MyNet import numpy as np DEFAULT_MEAN_IMAGE = './tfalex/ilsvrc_2012_mean.npy' class FeatureExtractor(): def __init__(self, sess_name, sess_config, in_size=227, out_dim=9216): self.batchsize = 1 self.out_dim = out_dim self.in_size = in_...
true
f808378c0fd2ba65b73fa9efef4f17a037015b54
paiv/aoc2018
/code/23-1-emergency-teleportation/solve.py
UTF-8
768
3.0625
3
[]
no_license
#!/usr/bin/env python import re def md(a, b): return sum(abs(x - y) for x, y in zip(a, b)) def solve(t): bots = [((x,y,z),r) for s in t.splitlines() for x,y,z,r in [map(int, re.findall(r'-?\d+', s))]] top = max(bots, key=lambda p: p[1]) def inrange(p): return md(p[0], top[0...
true
e872bdd1dff091b9d649975e471e2bb4fbaeea73
AlexChristian720/OOP
/Object Oriented Programming/Construtor.py
UTF-8
653
4.375
4
[]
no_license
class Animal(object): def __init__(self,name): self.name=name def eat(self,food):# Common method(or property) of both subclass print('%s is eating %s. '%(self.name,food)) class Dog(Animal): def fetch(self,thing): print('%s goes after the %s!'%(self.name,thing)) class Cat(Animal): ...
true
e97ff4ad1b0dd2b0b57d9e195e1286178e2994ae
xNinjaKittyx/ChitogeBot
/BakaBot/modules/info.py
UTF-8
2,048
2.53125
3
[]
no_license
import json import requests import time import asyncio import discord from discord.ext import commands import psutil import tools.discordembed as dmbd class Info: def __init__(self, bot): self.bot = bot self.initialtime = time.time() def getuptime(self): seconds = int(time.time() - s...
true
e8023c25a7e48808e4ace05961c29c6b79269d9c
romarioschneider/python
/yandex_shoes_SHAD_2015.py
UTF-8
894
3.15625
3
[]
no_license
list_size = [] list_size_sort = [] f = open('data.txt') for i in range(0, 3): line = f.readline() if i == 0: customer_size = int(line) elif i == 1: count_shoes = int(line) else: items = line.split(' ') for i in items: list_size.append(int(i)) f.close() ...
true
0e3fd47fe4779957b68b75403715303b61d6b217
AIladin/Propositional-calculus-problem
/BoolLogicFormula/BLFormula.py
UTF-8
3,649
3.59375
4
[]
no_license
from BoolLogicFormula.Operator import * from BoolLogicFormula.CheckCorrectness import check_correctness, WrongExpression from itertools import product # TODO sync with checkCorrectness tokens bin_tokens = {'->': "imp", } un_tokens = {"!": "obj", } @Operator def imp(arg1, arg2): """ Implication operator ...
true
a34512ab67b0ed493462a01a44aa468bc7be7d55
rahulguptakota/thermal_eavesdropping
/cpu_intensive.py
UTF-8
396
3.109375
3
[ "MIT" ]
permissive
#!/usr/bin/env python from multiprocessing import cpu_count from multiprocessing import Pool def func(temp): while True: temp = (temp ** temp ) if(temp > 5000): temp = 2 def main(): number_of_cores = cpu_count() print("Number of cores availabe is {}".format(number_of_cores)) use_cpu = 2 pool = Pool(use_...
true
25978db1c47ce62b350ecf35b309b59ed4beb218
jnahelou/cookiecutter-gcf-python
/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/main.py
UTF-8
509
2.9375
3
[]
no_license
""" {{cookiecutter.project_name}} """ import logging def lower(arg: str): """ Set to lower case string provided """ return arg.lower() def do_some_stuff(arg: str): """ Do a simple stuff """ return lower(arg) def main(request): #pylint: disable=unused-argument """ Main han...
true
37eb52df321fd75c3c9849d7b04fd464242515fb
GroofiP/Geek_PyQt
/Client_Server/service.py
UTF-8
1,109
2.65625
3
[]
no_license
import subprocess from log.server_log_config import logger def info_log(mod): logger.info(f'Сообщение от клиента: модуль {mod} отработал') def main(func_ser_cli): logger.info(f"Функция {func_ser_cli.__name__} вызвана из функции {main.__name__}") func_ser_cli("127.0.0.1", 7777) def client_start_3(ip_g...
true
644335ceb26eb610040cb80446ead806e36d1175
hvzzzz/First_steps_in_python
/13 Recursividad.py
UTF-8
131
3.421875
3
[]
no_license
def suma(n): if(n==0):#caso base return 0 else: return n+suma(n-1) n = int(input()) print (suma(n))
true
18c7af961b2db205899b261d90f684f83854c903
wilsonify/euler
/src/euler_python_package/euler_python/easy/p493.py
UTF-8
2,097
3.375
3
[ "MIT" ]
permissive
""" problem 493 """ import fractions import math from euler_python.utils import eulerlib def problem493(): """ :return: """ num_colors = 7 balls_per_color = 10 num_picked = 20 decimals = 9 numerator = [0] def explore(remain, limit, history): if remain == 0: h...
true
274d5050c5e65597bb5624d7a62d57dacf3700c7
Ritvik19/CodeBook
/data/CodeChef/ZOZ.py
UTF-8
218
2.625
3
[]
no_license
for t in range(int(input())): count = 0 n, k = map(int, input().split()) A = list(map(int, input().split())) sm = sum(A) for a in A: if (2*a)+k > sm: count += 1 print(count)
true
9418e7b856d72dde5dbbe3ec5b146cfcf488588a
Dyn0402/Misc
/grid_search.py
UTF-8
1,779
3.203125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on May 14 3:18 PM 2020 Created in PyCharm Created as Misc/grid_search.py @author: Dylan Neff, dylan """ from scipy.optimize import curve_fit as cf import matplotlib.pyplot as plt import numpy as np def main(): streets_away = [0] streets_to_check = ...
true
f4beb623bb7299633629b03a46e34e28388109d1
orkolorko/taylor
/taylor.py
UTF-8
4,447
2.984375
3
[]
no_license
from sage.all import RIF, vector, zero_vector, sin, cos, exp class Taylor: def __init__(self, val , degree, variable = False, field = RIF): if isinstance(val, Taylor): self.val = val.val self.degree = val.degree elif isinstance(val, list): self.val = vec...
true
cb6120d64b1ddbcc67c4c24b2642daf750ad863e
raspibrick/install
/rpi-tutorial/ADC3c.py
UTF-8
640
3
3
[]
no_license
# ADC3c.py # Read ADC and show graphics import smbus import time from gpanel import * dt = 0.1 def readData(): adc_address = 0x4D rd = bus.read_word_data(adc_address, 0) data = ((rd & 0xFF) << 8) | ((rd & 0xFF00) >> 8) data = data >> 2 return data def init(): clear() setPenColor("gray") ...
true
2f986d6fd187afde2be4bee22c0987fee0f355c3
sumit2798/GFG
/Contest-1/Primility.py
UTF-8
387
3.5625
4
[]
no_license
def isPrime(N): if (N==1): #1 is not prime so return false return True for i in range(2,1+int(math.sqrt(N))): #We check from 2 from sqrt(N) as divisors, if any, would exist till sqrt(N) if N%i==0: #If any i divides the number this means the nubmer is not prime return False return...
true
7f05fdde6b0074344287beed53cf60642737b267
Bratah123/DefinitelyAgario
/server/packet_handlers.py
UTF-8
3,600
2.59375
3
[ "MIT" ]
permissive
import random from packets.packet import Packet from game_object import Blob from server_constants import BLOBS, BLOB_AMOUNT from server_opcodes.send_opcodes import SendOps from server_opcodes.recv_opcodes import RecvOps class PacketHandler: def __init__(self, opcode, func): self.opcode = opcode ...
true
9f291bd4425901f64a5f44287fc9c19da3f1025e
Kejuntrap/n100
/c5/45.py
UTF-8
2,865
3.46875
3
[]
no_license
#41-44を使いやすく改良したもの class Morph: surface = "" base = "" pos = "" pos1 = "" def __init__(self, r): self.surface = r[0] self.base = r[7] self.pos = r[1] self.pos1 = r[2] def show(self): print("表層系:", self.surface, "\t基本形:", self.base, "\t品詞:", self.pos, ...
true
6d3995882c65dd203f9c50c510bc6c4389a3b2d0
saswatlevin/CUDA-Image-Encryption-GUI
/src/app2.py
UTF-8
2,258
2.703125
3
[]
no_license
from PyQt5 import QtWidgets from PyQt5.QtWidgets import QApplication,QMainWindow,QPushButton,QAction,QFileDialog,QWidget from PyQt5.QtGui import * from PyQt5.QtCore import pyqtSlot import os import sys import subprocess import basics import cv2 class MyWindow(QMainWindow,QWidget): def __init__...
true
bbd96a12255a5bc95d640c4ecd9f3876ac315efa
uni-tue-kn/P4sec
/local_lib/p4runtime_lib/port.py
UTF-8
2,628
2.546875
3
[ "Apache-2.0" ]
permissive
import nnpy # type: ignore import struct from queue import Queue from threading import Thread, Event from common_lib.event import EventSystem from common_lib.logger import Logger from local_lib.settings import SwitchSettings from typing import Set class PortMonitor: def __init__(self, logger: Logger, event_syst...
true
ba0fa4b34d4bd6d3425018220043130d81cab3a9
cbsook77/cbsook77
/Study/Ch4_Sort/UpandDown.py
UTF-8
1,118
3.9375
4
[]
no_license
''' 위에서 아래로 하나의 수열에는 다양한 수가 존재한다. 이러한 수는 크기에 상관없이 나열되어 있다. 이 수를 큰 수부터 작은 수의 순서대로 정렬해야 한다. 수열을 내림차순으로 정렬하는 프로그램을 만드시오. 입력조건 첫째 줄에 수열에 속해 있는 수의 개수 N이 주어진다.(1<=N<=500) 둘재 줄부터 N+1번째 줄까지 N개의 수가 입력된다. 수의 범위는 1이상 100,000 이하의 자연수이다. 출력조건 입력으로 주어진 수열이 내림차순으로 정렬된 결과를 공백으로 구분하여 출력한다. 동일한 수의 순서는 자유롭게 출력해도 괜찮다. 입력...
true
bfafbb6d9bc1209c02b4c054b237c15adab92890
werntzp/python2
/addgui.py
UTF-8
1,299
3.484375
3
[]
no_license
from tkinter import * class Application(Frame): def convert(self): """Convert entry fields and sum.""" try: n1 = float(self.txt_one.get()) n2 = float(self.txt_two.get()) self.output.config(text=str(n1 + n2), fg="black") except: ...
true
50e402b70d3e2aea71a4046e0d73a53226115b1e
Aravind644/python-
/INHERITANCE.py
UTF-8
1,565
4.15625
4
[]
no_license
# python7 INHERITANCE 1.A, B and C are classes A is a super class. B is a sub class of A. C is a sub class of B. Create three methods in each class, 2 methods are specific to each class and third method (override method) should be in all three Classes A, B and C Create a class with main method. Create an obje...
true
5270001edf8564a2fc28113c046fd10147311ab6
LemmaLtd/Narith
/src/python/Narith/base/Protocols/Ftp.py
UTF-8
1,825
2.875
3
[]
no_license
''' [Narith] File: Ftp.py Author: Saad Talaat Date: 30th July 2013 brief: Structure to hold Ftp info ''' from Narith.base.Packet.Protocol import Protocol import threading #TODO: #determine type using tcp src,dst port class Ftp(Protocol): def __init__(self,b, isdata=False): super( Ftp, self).__init__()...
true
a75c04428632983009786d070a07109cbe2293a4
InhwanJeong/TIL
/Algorithm/solve/backjoon/easy_1/17413_reverse_word_2.py
UTF-8
648
3.8125
4
[]
no_license
if __name__ == '__main__': s = input() reverse_stack = [] not_change = False for char in s: if char == "<": while reverse_stack: print(reverse_stack.pop(), end="") not_change = True if not_change: if char == ">": not_c...
true
715f2a5e2bb95fecd1d793151be60c31406837d0
BairuChen2019/hydrodata
/hydrodata/hydrodata.py
UTF-8
7,360
3.015625
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- """The main module for generating an instance of hydrodata. It can be used as follows: >>> from hydrodata import Station >>> frankford = Station('2010-01-01', '2015-12-31', station_id='01467087') For more information refer to the Usage section of the document. """...
true
5509d26cf1b1af22f7f02e547a8b36f8f0b9e832
rogeriosilva-ifpi/adsi-algoritmos-2016.1
/atividade_f/Atividade F - Kairo Emannoel - Leonardo Freitas/lista2questao4.py
UTF-8
398
3.78125
4
[]
no_license
#_*_ coding:utf-8 _*_ def calculo_media(nota1,nota2): media=(nota1+nota2)/2.0 if media == 10.0: print "Aprovado com Distinção" elif media >= 7: print "Aprovado" else: print "Reprovado" def main(): nota1 = input("Insira primeira nota: ") nota2 = input("Insira segunda no...
true
96bd3bad6469f5e44db8f5c538da83de5df67674
DougBurke/mast-obscore
/psv.py
UTF-8
2,890
2.71875
3
[]
no_license
""" Routines for dealing with MAST data in PSV format. """ import sys import csv # A dialect for pipe-separated values class PSV(csv.Dialect): """Pipe-separated values (separator is |). At present all we really care about is the delimiter and lineterminator fields; the others are guesses. """ ...
true
49d30cdcd901c9d2d031e44994e23cca009a49c4
analuisadev/100-Days-Of-Code
/Day-51.py
UTF-8
350
3.921875
4
[ "MIT" ]
permissive
info = dict() finalização = list() for cont in range (1, 4): info['Nome'] = str(input(f'Digite o {cont}° nome: ')) info['Idade: '] = int(input('Digite a idade: ')) finalização.append(info.copy()) print ('As informações informadas foram:') for i in finalização: for v in i.values(): print(v, end='...
true
8adc9dbc3b74efeb8c1a42ff5f6a3a897fb5e279
stasi009/MyKaggle
/BagWordsMeetsPopcorn/bow_tfidf.py
UTF-8
5,613
2.734375
3
[]
no_license
import re import itertools import logging import text_utility import pandas as pd from gensim import corpora,models,matutils from review import Review,ReviewsDAL class DataLoader(object): def __init__(self,colname): self._colname = colname def words_stream(self): self._metas = [] da...
true
d1b544aafc80c22cf8a808c06d2ec714f0851ecd
johli/scrambler
/examples/image/mnist_utils.py
UTF-8
8,256
2.546875
3
[ "MIT" ]
permissive
import keras from keras.models import Sequential, Model, load_model from keras.layers import Input, Lambda import os import pickle import numpy as np import pandas as pd from keras.datasets import mnist import matplotlib.cm as cm import matplotlib.colors as colors import matplotlib as mpl from matplotlib.text impor...
true
fc35172478dee1aef6bfa3a2b6cb8d5206147077
JyothsnaJ/git-remote
/listdt.py
UTF-8
589
3.484375
3
[]
no_license
#!/usr/bin/python2.7 ###### declaring the lists list1=['ansible',1111,'puppet',86.96,'git','aws'] list2=['miner','boy'] ############ printing the lists print list1 print list2 ############## printing the first element of list1 print list1[0] ############# printing last element of list1 print list1[-1] #########...
true
fc3b9bd38ada76e0860adf635e1ff127cf411515
karthikpalavalli/Puzzles
/leetcode/most_common_word.py
UTF-8
655
3.3125
3
[]
no_license
from typing import List from collections import Counter from operator import itemgetter class Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: for ch in "!?',;.": paragraph = paragraph.replace(ch, " ") word_freq = dict(Counter(paragraph.lower().split())) ...
true
fa5f6fa75cd4f8a7cb28b8f8b47e37d17376486d
joakimeriksson/ai-smarthome
/yolov3-ha/mqtt-process-yolocv.py
UTF-8
6,853
2.828125
3
[ "BSD-2-Clause" ]
permissive
# # MQTT Camera image processing using Yolo # # Takes an image on ha/camera/mqtt # Posts back an image on ha/camera/yolo # # Author: Joakim Eriksson, joakim.eriksson@ri.se # import paho.mqtt.client as mqttClient import cv2, numpy as np, datetime from PIL import Image, ImageFont, ImageDraw import colorsys show = True ...
true
37c7ecfbcaa19da020147b0daf9e371b35fe44c8
oliveradk/Logistic_Regression
/processData.py
UTF-8
895
2.9375
3
[]
no_license
import numpy as np import pandas as pd def processData(filepath, standardize = True): 'Return standardized training data and labels from file' designM, labels = _readData(filepath) if standardize: designM = standardizeData(designM) designM = addIntercepts(designM) return designM, labels de...
true
76c93506509914e4e1990339ec943e34be355576
Ni4ka1991/apiUseWeather
/select_one.py
UTF-8
713
3.3125
3
[]
no_license
#!/usr/bin/env python3 # select_one.py from os import system from data import * from data import city def chooseOne( viewList ): print() choice = input( f"Enter a ordinal number of param you want to know about weather in {city} >>> " ) if choice in createList( viewList ): choice = int(choice) ...
true
c2789ce9e5250e228a525615f676d86e1247fd61
LittleXuezha/ai_test
/aitest1.py
UTF-8
3,953
2.984375
3
[]
no_license
import numpy as np # sigmoid当做激活函数 def sigmoid(z): return 1/(1+np.exp(-z)) def mse_loss(ytrue, ypred): return ((ytrue - ypred)**2).mean() def deriv_sigmoid(x): fx = sigmoid(x) return fx * (1-fx) class Neuron: def __init__(self, w, b): self.w = w self.b = b def feedforward...
true
6875bb0a2837fa6a8429f3d9904e27b1d02d4a06
zhangry868/VRbound
/vae_autograd/aae_reparam.py
UTF-8
10,757
2.8125
3
[]
no_license
# using autograd to do gradient computations # need autograd package # author: Yingzhen Li import time import autograd.numpy as np from autograd import value_and_grad from autograd.scipy.misc import logsumexp from network import Network from parameter_server import Parameter_Server class VA: """ An auto-encod...
true
125cef76c1b9c6cf2069fee2ea81578554a93e47
Kooma-sama/Algo_2020_virgil
/test.py
UTF-8
695
3.421875
3
[]
no_license
# def print_comb() -> None: # for i in range(8): # for j in range(9): # for k in range(10): # if i < j < k: # print(f"{i}{j}{k}") # #print_comb() l2 = [] l = [1, 1, 1, 3, 2, 2, 3] # count = 0 # for value in l: # if value == 1: # count = coun...
true
698a9d4c7f75b3d9f82b8a6c804040d2ca4e5a7e
joel-razor1/DSA_Python
/Week1/Assignments/q1.py
UTF-8
94
3.015625
3
[ "MIT" ]
permissive
def f(x): d=0 while x >= 1: (x,d) = (x/4,d+1) return(d) c=f(255) print(c)
true
688833ac6e40fac1f27c256d92d901610491ec2c
anoubhav/Codeforces-Atcoder-Codechef-solutions
/Atcoder/171/d.py
UTF-8
642
2.71875
3
[]
no_license
from sys import stdin from collections import defaultdict as dd from collections import deque as dq import itertools as it from math import sqrt, log, log2 from fractions import Fraction n = int(input()) nums = list(map(int, stdin.readline().split())) q = int(input()) freq = dd(int) ssf = 0 for i in nums...
true
6da2f5d420d2cbecbab61ef1944761537b60ed09
AndreyFrolenkov/egoroff_py
/for_nested_loops/les5.5_step2.py
UTF-8
110
2.890625
3
[]
no_license
l = list(map(int, input().split())) for i in l: for j in range(i): print('*', end='') print()
true
f4c778091ff25b73b8bc2d0b0fa28f230d75e9d3
9DemonFox/simpleLearning
/UI/R/widgets/testWidget/openFile.py
UTF-8
1,254
2.796875
3
[]
no_license
#!/usr/bin/python # -*-coding:utf-8 -*- from tkinter import * from tkinter import messagebox from tkinter import filedialog import tkinter as tk from _ast import If top = tk.Tk() # 这里四个参数分别为:宽、高、左、上 top.geometry("500x300+750+200") top.title("www.tianqiweiqi.com") strPath = StringVar() strResult = StringVar() def ...
true
3171b621a3bd9415a2031210731a574f8591b819
manlinkc/tribalvillage-game
/hw1_dev.py
UTF-8
14,472
3.375
3
[]
no_license
"""M3C 2018 Homework 1.""" """Manlin Chawla 01205586""" # Import modules needed throughout code import numpy as np import matplotlib.pyplot as plt def simulate1(N, Nt, b, e): # Setting bounds and error messages for inputs assert N > 5 and N % 2 == 1, "N must be an odd positive integer greater than 5" asse...
true
cb5b24c0cbd062e5649fd608fe66f21b303950f8
Astrid1898/SZU_CSSE_master
/SignalProcessing/homework/2_my_dft&my_idft/my_dft.py
UTF-8
1,033
3.265625
3
[ "MIT" ]
permissive
import numpy as np def dft(Xn): ''' @Hypo 1910273011 This is a function for Discrete Fourier Transform(DFT) Parameters: Xn : array_like, type = complex Returns: out : array_like, type = complex ''' Xk = []; Xk_i = 0 N = len(Xn) for k in range(N): ...
true
4b558b169c3e342b4ef820e4f0eb29de29d4fe1c
claudio1624/Python
/EjercicioN4.py
UTF-8
337
3.265625
3
[]
no_license
#! /usr/bin/python # -*- coding: iso-8859-15 -*- import os, sys llamada = int(input('Duracion de llamada :')) corta = 100 larga = 100 + (100*0.05) if llamada < 10: print'LA LLAMADA SE CONSIDERA CORTA' print'EL VALOR ES DE: ', corta else: print'LA LLAMADA ES LARGA' print'TIENE UN CARGO ADICIONAL DE 5% ...
true
6777842b7b3904bce28a8ca4cee4fc2a1d307ccf
Shiraz-University/ShirazUniversityCatalogue
/ShirazUniversityCatalogue/scripts/collect_content.py
UTF-8
1,524
2.765625
3
[]
no_license
import json import os import shutil import sys import glob from csv_to_json import csv_to_dic def get_path_parts(path): return [x for x in path.split(os.sep) if x] def find_part_in_children(children, name): for ch in children: if ch['type'] == 'folder' and ch['name'] == name: return ch def ensure_path(parts...
true
9eb7ccad2d6a9c7d5b913efaa19b719c97db5331
pheanex/exercism
/python/tree-building/tree_building.py
UTF-8
1,065
3.203125
3
[]
no_license
class Record: def __init__(self, record_id, parent_id): self.node_id = record_id self.parent_id = parent_id class Node: def __init__(self, node_id): self.node_id = node_id self.children = [] def BuildTree(records): if set(record.node_id for record in records) != set(range...
true
3beaeb1a0c4c90541318d98b872c4e72598b7025
rajjy98/Python
/loop_structures.py
UTF-8
6,641
4.65625
5
[]
no_license
import random def sumOdds(input_value): initial = 1 #The first odd number is one total = 0 #The total of the odd numbers equals 0 while initial <= input_value: #the loop starts at 1 because 0 has no odd numbers in, but one does total += initial #inital gets added to total ...
true
c68bdcea9470f4b7e7e52b99a1c5bf04b2436db3
yunhao-qian/engsci-press-python
/trie_node.py
UTF-8
1,899
3.59375
4
[]
no_license
from bisect import insort from collections import defaultdict class TrieNode: __slots__ = 'letter', 'entries', 'parent', 'child_keys', 'children' def __init__(self, letter, parent): self.letter = letter self.entries = [] self.parent = parent self.child_keys = [] self....
true
770a9c8674033f6f698fcf91dbc2b614229b81d9
flaskur/leetcode
/explore/string/add_binary.py
UTF-8
641
3.953125
4
[]
no_license
# Given two binary strings, return their sum. class Solution: def addBinary(self, a: str, b: str) -> str: carry = 0 result = '' a = list(a) b = list(b) # iterate through each binary string until they ALL fail. while a or b or carry: if a: ...
true
9c50af55ae0a27f0451c31b3dff682aa94783b29
gjeon3/SCORMgenerator
/scorm_generator_xmlversion.py
UTF-8
1,267
2.515625
3
[]
no_license
import xml.etree.ElementTree as ET tree = ET.parse('econ_js_copy/imsmanifest.xml') root = tree.getroot() root[1].set('default','PRACTICE: Identifying New Market Equilibrium from a Graph') root[1][0].set('identifier','PRACTICE: Identifying New Market Equilibrium from a Graph') root[1][0][0].text='PRACTICE: Identifying N...
true
da7764d0279a54b1bbe054db55cb7ee128591ea2
Roudgers/DCFNet
/libs/datasets/transforms.py
UTF-8
10,606
2.875
3
[]
no_license
import random from PIL import Image, ImageOps import torch from torchvision import transforms from torchvision.transforms import functional as F from torch.utils import data import math import numbers import numpy as np class Video_train_Compose(object): """Composes several transforms together. Args: ...
true
374026b73729baa2d0dc1e0aa7269ecfcc77bbb1
julius-risky/praxis-academy
/novice/03-03/latihan/jinja.py
UTF-8
269
3.1875
3
[]
no_license
from jinja2 import Template def main(): t = Template("Hello {{ something }}!") t.render(something="World") t = Template("<h1> My favorite numbers: {% for n in range(1,10) %}{{n}} " "{% endfor %}</h1>") t.render() if __name__ == "__main__": main()
true
8921f2c2480f2ea2608ebbd69da9ad185ecdbf57
maxwang967/kick-start
/leetcode/23.py
UTF-8
963
3.34375
3
[]
no_license
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def merge(self, lists, lo, hi): if lo == hi: return lists[lo] if lo > hi: return None mid = (lo + hi)...
true
b65ba7f8ad22a73e08aa05a6ae1657bd2be843ec
mabirck/BreakoutPong
/attempts/TestBreakout.py
UTF-8
2,505
2.671875
3
[]
no_license
# coding: utf-8 # In[1]: from random import sample as rsample import numpy as np from keras.models import Sequential, Model from keras.layers.convolutional import Convolution2D from keras.layers.core import Dense, Flatten from keras.layers import Input from keras.optimizers import SGD, RMSprop from keras import ba...
true
94815ccb83e87ef2fec5f3ebc285f3154ab7c9c4
emanmacario/edit-distance-py
/edit-distance.py
UTF-8
2,144
3.6875
4
[]
no_license
# Program to calculate the local or global edit # distance between two strings. # # Author: Emmanuel Macario # Date: 26/03/19 import argparse import numpy as np def global_edit_distance(q, t): assert(q and t) lq = len(q) lt = len(t) # Initialise similarity matrix F = np.zeros((lq+1, lt+1), dtyp...
true
7f4ee9f147609c49b58b2ab55877be5c89b74121
conanlhj/BOJ
/백준/Gold/14938. 서강그라운드/서강그라운드.py
UTF-8
632
2.546875
3
[]
no_license
n, m, r = map(int, input().split()) G = [[int(1e9)] * (n + 1) for _ in range(n + 1)] for i in range(n + 1): G[i][i] = 0 items = [0] + list(map(int, input().split())) for _ in range(r): u, v, c = map(int, input().split()) G[u][v] = c G[v][u] = c for k in range(1, n + 1): for i in range(...
true
abc23eb2cbb45c2f73b46668f45ee04726fc3ff0
kangyifei/CloudSimPy
/playground/Non_DAG_CRAC_energy/algorithm/cooling/PID.py
UTF-8
769
2.59375
3
[ "MIT" ]
permissive
from core.algorithm import Algorithm import numpy as np class PID(Algorithm): def __init__(self, temp): self.aimingTemp = temp self.lastTemp = None self.lastError = 0 self.errorSum = 0 self.kp = 0.2 self.ki = 0.1 self.kd = 0.3 def __call__(self, cluster...
true
d228ff3e64783fec9c8f724916a27900d6c605cd
0neMiss/Computer-Architecture
/ls8/cpu.py
UTF-8
6,030
3.421875
3
[]
no_license
"""CPU functionality.""" import sys HLT = 0b00000001 LDI = 0b10000010 PRN = 0b01000111 MUL = 0b10100010 PUSH = 0b01000101 POP = 0b01000110 CMP = 0b10100111 JEQ = 0b01010101 JNE = 0b01010110 JMP = 0b01010100 RET = 0b00010001 CALL = 0b01010000 FL = 6 SC = 7 class CPU: """Main CPU class.""" def __init__(self): ...
true
b0101c1c812d15c263ee9513175e9f5fc1064687
swford89/python_labs
/python_fundamentals-master/08_file_io/08_01_words_analysis.py
UTF-8
1,315
4.625
5
[]
no_license
''' Write a script that reads in the words from the words.txt file and finds and prints: 1. The shortest word (if there is a tie, print all) 2. The longest word (if there is a tie, print all) 3. The total number of words in the file. ''' shortest_word = 100 longest_word = 0 word_count = 0 shortest_word_list = [] lo...
true
d5163ad4d9e28984cd6b5920f9f21738decfc86d
pelson/mpl_mapping_trial
/lib/cartopy/custom_projections/mpl_cut_path.py
UTF-8
4,872
2.96875
3
[]
no_license
import numpy as np import matplotlib.path as mpath def intersect_poly(path): """Splits a path which crosses 180 degrees into two paths, connecting each of the crossing points to the next - which is only really appropriate for a filled polygon.""" a = path.vertices x = a[:, 0].flatten() # Split...
true
8819833a408e900ccf6e0ebfdf834ad574198754
zman2013/stock_quantization
/venv/index_data.py
UTF-8
10,937
2.625
3
[]
no_license
#!/usr/bin/python3 import requests import json import tushare as ts import pandas as pd import numpy as np import matplotlib.pyplot as plt from trade import Account from stock import Stock import time import datetime from pandas.tseries.offsets import * import pandas as pd from pandas.io.json import json_normalize...
true
f53f8ade06d9420d3cd2067b6a41841c594643df
ablot/my_first_repo
/test_first_script.py
UTF-8
321
3.0625
3
[]
no_license
""" Unit tests for the simple first_script function """ import pytest import first_script def test_give_answer(): assert first_script.give_answer() == "The answer is 42" def test_increament(): assert first_script.increment(12) == 13 def test_subtract_the_answer(): assert first_script.sub_answ(12) == 30 ...
true
e5d0a84c79f26961a57f74658dae4edf4d602861
quangnhan/PYT2104
/Day12/nthanh/test.py
UTF-8
1,220
2.8125
3
[]
no_license
import requests import os from datetime import datetime from pprint import pprint class Server: def __init__(self, url): self.__url = url def get(self): data = requests.get(self.__url).json() self.log("get") return data def get_by_id(self, id): data = ...
true
192229502fe440149136467e4d2c57606844c9ef
jordanwang199507/Python-Coding-Questions
/StackQueueProblems/Problem_1/LargestStack.py
UTF-8
675
3.8125
4
[]
no_license
from Stack_Mod import Stack class LargestStack(): def __init__(self): self.stack = Stack() self.max = Stack() def push(self, item): self.stack.push(item) if self.max.peek()==None: self.max.push(item) elif item >= self.max.peek(): self.max.push(item) def pop(self): item = self.stack.pop() if...
true
d7fc32d74104264482e0835d07d303cfc2e3ebdd
Hadron74/hulushoujilv
/local/mysql_database.py
UTF-8
2,744
2.515625
3
[]
no_license
# -*-coding:utf-8-*- __author__ = 'luhongc' import MySQLdb def connect(): return connect_localhost() def connect_localhost(): conn = MySQLdb.connect(host="localhost", user="root", passwd="", db="hulushoujilv", charset='utf8') return conn def create_sql(conn): cur = conn...
true
29c8b400c9e91c8c68ddf1aa52ae1bc1a963efad
davideluque/proyectodos-ci2692
/leve.py
UTF-8
665
3.46875
3
[]
no_license
def levenshtein(nombre,pista): N = len(nombre) P = len(pista) if len(nombre) > len(pista): nombre,pista = pista,nombre N, P = N,P distancia = range(N+1) for i in range(1,(P+1)): previous, distancia = distancia, [i]+[0]*N for j in range(1,N+1): ...
true
fe43bbcf4366034d4a9c684525241bbd51eb0e1b
munnam77/Python_Fun
/Mini_Python_Projects/6_Blackjack.py
UTF-8
10,289
3.109375
3
[]
no_license
# Mini-project # 6 - Blackjack # Step 1: import modules import simplegui import random # Step 2: declare some global variables CANVAS_SIZE = (740, 650) IMG_CARDS = simplegui.load_image('http://commondatastorage.googleapis.com/codeskulptor-assets/cards.jfitz.png') IMG_BACK = simplegui.load_image('http://commondatastor...
true
22118f9ebfd4f019d98727a9e83fc7d0aaa32ffd
FrenchBear/Python
/Learning/130_Fluent_Python/fp2-utf8/freecode/freecode 142.py
UTF-8
167
2.890625
3
[]
no_license
def __add__(self, other): pairs = itertools.zip_longest(self, other, fillvalue=0.0) return Vector(a + b for a, b in pairs) __radd__ = __add__
true
81417deabd60dc7064b2b7ef15023d9d785fc568
AdamZhouSE/pythonHomework
/Code/CodeRecords/2719/59137/312862.py
UTF-8
479
2.796875
3
[]
no_license
n = input() if n == "6": print(0) print(0) print(2) print(0) print(1) print(2) elif n == "10": print(0) print(1) print(1) print(0) print(0) print(2) print(0) print(3) print(0) print(1) elif n == "3": print(0) print(0) print(2) elif n == "7": ...
true
beb83ba9ddb88e783099c0bfa088e2afb2ee2ca5
elehcimd/nb2md
/nb2md/nb2md.py
UTF-8
9,771
2.875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import argparse import json import subprocess import sys import urllib import urllib.request import boto3 import nbformat as nbf try: from nb2md.version import __version__ except ImportError: from version import __version__ def local(args): if type(args) == list: cmd = ' '.join(args) else: ...
true
7e0aa8f878fe80c381f62ef177476de62088a464
guozanhua/distask
/distask/datastores/redis.py
UTF-8
5,904
2.53125
3
[ "LicenseRef-scancode-mulanpsl-2.0-en", "MulanPSL-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import logging import re from typing import Optional from distask import util from distask.datastores.base import DataStore from distask.serializers.base import Serializer from distask.task import Job from distask.util import bytes_to_int, bytes_to_str try: from redis import Redis except ImportError: raise Im...
true
d9ab7deacede4a5fc3a910ae67d6eac6861daecd
AndersonHJB/PyCharm_Coder
/Coder_Old/pycharm_daima/小程序/国旗/red.py
UTF-8
1,410
3.28125
3
[]
no_license
# -*- coding: utf-8 -*- # 写代码是热爱,写到世界充满爱! # @Author:AI悦创 @DateTime :2019/10/1 8:02 @Function :功能 Development_tool :PyCharm # code is far away from bugs with the god animal protecting #    I love animals. They taste delicious. import turtle import time turtle.bgcolor("red") turtle.fillcolor("yellow") turtle...
true
06df7e68b3b15dfaaf144651f19b3f9328223bec
AndreyPimenov/AP_Python_Programs
/Netology/HomeWorks/HW_ContextManager.py
UTF-8
4,481
3.765625
4
[]
no_license
# Необходимо реализовать менеджер контекста, печатающего на экран: # 1. Время запуска в менеджере контекста # 2. Время окончания работы кода # 3. Сколько было потрачено времени на выполнение кода # Придумать и написать программу, использующую менеджер контекста из 1-го задания # ---------------------------------------...
true
08556cea480996dc351b8bac3c7996d0479a7403
GaussianTech/AutoTabular
/autofe/featuretools_titanic.py
UTF-8
1,301
2.75
3
[ "Apache-2.0" ]
permissive
import featuretools as ft import pandas as pd from sklearn.datasets import load_iris # Load data and put into dataframe iris = load_iris() df = pd.DataFrame(iris.data, columns=iris.feature_names) df['species'] = iris.target df['species'] = df['species'].map({ 0: 'setosa', 1: 'versicolor', 2: 'virginica' })...
true
5a9922acbc1422743fd39fbb8f4c0464ccb7df78
artemisa-M/gpccodes
/Codigos estudiantes por lenguaje/PY/Bryann Valderrama/Algoritmos de Busqueda/findPair.py
UTF-8
549
3.984375
4
[]
no_license
def findPair(lista, x): tamanio = len(lista) i, j = int(0), int(1) while(i < tamanio and j < tamanio): if(i != j and lista[j] - lista[i] == x): print('Par encontrado: ({} - {})'.format(lista[j], lista[i])) return True elif(lista[j] - lista[i] < x): j = j +...
true
e1a9858e1ebc043ff22e2e370778fb85e3d14d83
cshc/cshc-web
/src/core/management/commands/init_emailaddresses.py
UTF-8
1,276
2.734375
3
[]
no_license
""" Takes all existing CshcUser entries and creates an EmailAddress entry for each with the email address verified and set as primary. This script should be run once before going live (although it is idempotent). That way existing users will not have to verify their email address when they first log into the new site....
true
767dcc7a354a9561a13535bde7476c83055b29a5
RudolfCardinal/pythonlib
/cardinal_pythonlib/regexfunc.py
UTF-8
2,288
3.015625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # cardinal_pythonlib/regexfunc.py """ =============================================================================== Original code copyright (C) 2009-2022 Rudolf Cardinal (rudolf@pobox.com). This file is part of cardinal_pythonlib. Licensed under the Apache License, Version 2.0 (t...
true
453c2ba309ae5602852bea551537f6aa10abc454
MitsukiUsui/mizuho
/helper/helper.py
UTF-8
895
2.765625
3
[]
no_license
import yaml import os import pandas as pd def get_sampleId_lst(yamlFilepath): with open(yamlFilepath, 'r') as f: yml=yaml.load(f) filepath_lst=yml[0]["left reads"] # assume all the same with yml[0]["right reads"] sampleId_lst=[filepath.split('/')[-1].replace(".fastq", "")[:-3] for filepath in file...
true
2bd9dd9b6eda1431944e91c1e013d77242fb1590
JieweiL92/P1
/Griding/test2.py
UTF-8
4,433
2.703125
3
[]
no_license
import numpy as np import math import Griding.LayerCalculator as Lc import Griding.GridMethod as gm import Read_SentinelData.SentinelClass as rd import matplotlib.pyplot as plt dir = 'D:\\Academic\\MPS\\Internship\\Data\\Sentinel\\TEST' grid_root = 'D:/Academic/MPS/Internship/Data/Sentinel/Level1/Grid/' layer_root = ...
true
146ff56d0d300551a5dc8aba82baa4ac89bead62
Ti1mmy/ICS-201
/TPW Intro 1-5/Exercise 3.py
UTF-8
282
4.5
4
[]
no_license
print('Area of a Room') print('----------------') print() width = float(input('What is the width of the room? (m) ')) length = float(input('What is the length of the room? (m) ')) area = width * length print() print(f'The area of the room is {round(area, 2)} square meters.')
true
ce3172a0a96d54f93a23806ce582f637e0c604a7
box-of-voodoo/python_old
/is_prime.py
UTF-8
822
3.46875
3
[]
no_license
import os def cls(): os.system('cls') def is_prime(x): for i in range(2,int(x**(1/2))+1): if x%i==0: return False return x def otazka_cisla(y): while True: try: x=int(input(y)) break except: print('Neplatný vstup!Pouze čísla!...
true
45db3bf8eea3ee7dfab1bf549b01440ba69b2456
CycleRank/cyclerank-dev
/utils/clique_generator.py
UTF-8
2,151
2.8125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import argparse import pathlib import sys if __name__ == '__main__': parser = argparse.ArgumentParser(description='Generate a clique graph of ' 'the given dimension.') parser.add_argument('K', metavar='<dimension>'...
true
8cc2f942ef66420acb2119fbb9e61ea4bbff2a95
cybertraining-dsc/fa19-516-167
/cloudmesh-exercises/e-cloudmesh-shell-3.py
UTF-8
838
2.875
3
[ "Apache-2.0" ]
permissive
# fa19-516-167 # E.Cloudmesh.Shell.3 # Write a new command and experiment with docopt syntax and argument # interpretation of the dict with if conditions. from __future__ import print_function from cloudmesh.shell.command import command from cloudmesh.shell.command import PluginCommand class BillScreenCommand(Plugin...
true
2ee63992345d5a898bd8a1a84487d15fe6644995
catalinacst/kmens-client-server
/netflix-prize-data/stats.py
UTF-8
1,795
2.90625
3
[]
no_license
import sys import time import zmq import json import linecache import math import matplotlib.pyplot as plt storage = {} movies = {} def getValues(points): values = points.split(", ") return (int(values[0]) - 1, int(values[1])) def getCustomer(arr): if len(arr) > 1: aux = arr[0] aux = aux[1:len(aux)] arr.pop...
true
9f50d44e26af7f48f083f212107f4b2e97c72b0d
Henry-929/Synthetic-Data-Generation-APIs-Integrations
/GaussianHMM_pred03.py
UTF-8
1,780
2.90625
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Jun 22 22:36:31 2020 @author: mac """ #%% df = pd.read_csv('trainDemo.csv',encoding="utf-8") df.iloc[:,1].plot() dataset_X=df.iloc[:,1].values.reshape(1,-1).T print(dataset_X.shape) #%% from hmmlearn.hmm import GaussianHMM model = GaussianHMM(n_compon...
true
9a743075c197c2435bc9e067bb548ed574e9cf43
cxz/devito
/devito/archinfo.py
UTF-8
3,354
2.828125
3
[ "MIT" ]
permissive
"""Collection of utilities to detect properties of the underlying architecture.""" from subprocess import PIPE, Popen import numpy as np import cpuinfo from devito.tools.memoization import memoized_func __all__ = ['known_isas', 'known_platforms', 'get_cpu_info', 'get_isa', 'get_platform', 'get_simd_reg_s...
true
76ddf159f3e69b093187c9b6c3641866c1d2aa34
SafonovMikhail/python_000577
/001719StepPyStudyJr/StepPyStudyJr_lesson09_01_lists_09_remove_20210308.py
UTF-8
107
3.015625
3
[ "Apache-2.0" ]
permissive
students = ['Lilly', 'Olivia', 'Emily', 'Sophia'] print(students) students.remove('Lilly') print(students)
true
cac8fe3972a5d209863978d4dad5e16d73f46c1d
rodea0952/competitive-programming
/AtCoder/ABC/214/A.py
UTF-8
97
3.21875
3
[]
no_license
n = int(input()) if n <= 125: print(4) elif n <= 211: print(6) else: print(8)
true
027ddb3dfd74fe1daa528bbec730f0252bbaca8d
miyazakisoft/PrimeMinisters
/PrimeMinistersByPython/primeministers/attributes.py
UTF-8
1,661
3.4375
3
[]
no_license
#! /usr/bin/env python # -*- coding: utf-8 -*- class Attributes(object): """属性リスト:総理大臣の情報テーブルを入出力する際の属性情報を記憶。""" def __init__(self, kind_string): """入力用("input")または出力用("output")で属性リストを作成するコンストラクタ。""" self._keys = [] self._names = [] if kind_string == "input": self._...
true
82eba6fb186a1dce93005300820345896a5f0288
junclemente/udemy-tkinter
/food_price.py
UTF-8
2,143
3.9375
4
[]
no_license
from tkinter import * # Configure Window root = Tk() root.title("Food Price") root.geometry("300x200") root.resizable(width=False, height=False) color = 'gray77' root.configure(bg=color) # Declare variables, IntVar() is tkinter variable declaration BANANA = 8 APPLE = 6 ORANGE = 7 PINEAPPLE = 12 JACKFRUIT = 15 AVOCADO...
true
ebb2c7c6702e72922cda8654c3a80be5b17191a6
ToLoveToFeel/LeetCode
/Python/_0189_Rotate_Array/Solution.py
UTF-8
763
3.40625
3
[]
no_license
# coding=utf-8 # @Time : 2020/3/8 # @Author : Wang Xiaoxiao # @University : Dalian University of Technology # @FileName : Solution.py # @Software : PyCharm # @github : https://github.com/i-love-linux/LeetCode # 旋转数组 class Solution(object): def rotate(self, nums, k): """ :type num...
true
f61255cbaeda97eb65518a3011b1e877428c8418
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/abc101/A/4971241.py
UTF-8
112
3.328125
3
[]
no_license
S = input() ans = 0 for c in S: if c == '+': ans += 1 else: ans -= 1 print(ans)
true
e61ccdeccf1713a2dfbec6be139c477e8c7e539d
shineyilin/serial-plot-tool
/guitext_graphicsview.py
GB18030
1,368
2.921875
3
[]
no_license
#coding=utf-8 from PyQt4.QtGui import * from PyQt4.QtCore import * from math import * #grahisc view # 1, # 2, ֱ߶ # 3, ۲ class colorItem(QGraphicsItem): n = 0 def __init__(self): super(colorItem, self).__init__() self.color = QColor(qrand() % 256,qrand() % 256,qrand() % 256) self.setToolTip("QCo...
true