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
6f26472f7a54a4e48ff683b46f9f1ef67774b1a1
IStoyanova/SmartCities_ParetOpt
/examples/example_weather.py
UTF-8
2,124
2.796875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Wed Feb 11 14:12:12 2015 @author: tsz """ from __future__ import division import pycity_base.classes.Timer import pycity_base.classes.Weather import matplotlib.pyplot as plt def run_test(): timer = pycity_base.classes.Timer.Timer() weather = pyci...
true
c1cd52aa0e51490a7220602acfe8e39a65e0ae5d
NiharikaSinghRazdan/PracticeGit_Python
/Code_Practice/Filter_function.py
UTF-8
165
3.34375
3
[]
no_license
#findout the even nos in list using filter def check_even(num): return num%2==0 my_list=[1,2,4,6,8,7] my_list1=list(filter(check_even,my_list)) print(my_list1)
true
d2388d0aaeb78638ada1429b54c77d7e1f12fdac
iammdsufiahmed/flasky
/resources/book.py
UTF-8
2,272
2.796875
3
[]
no_license
from flask_restful import Resource, reqparse from flask import request from flask_jwt import jwt_required from models.book_model import BookModel class Books(Resource): # /book/<id:int> @jwt_required() def get(self, name): found_book = BookModel.find_by_name(name) if found_book: ...
true
0b83bed26a94efd0454916fc93f2d40483789f58
ventusOrientis/dogsbody
/save_mechanik.py
UTF-8
2,006
3.453125
3
[]
no_license
import json def init_pool (player: str, pool:str): dice_pools = {} dice_pools['Spieler'] = [] dice_pools['Spieler'].append({ 'Name': player, 'pool': pool }) with open("dice_pools.json", "w") as outfile: json.dump(dice_pools, outfile) def save_pool (player: str, pool:str)...
true
1c121c3e88d13ebdc421738a9248960fbaedc68e
guolikai/mypython
/day04/class/class_readwrite.py
UTF-8
791
2.84375
3
[]
no_license
#!/usr/bin/env python # _*_ coding:utf8 _*_ '''Created on 2016-11-8 @Author:Guolikai''' #调用修改私有字段 class info(object): def __init__(self,name,job,sarlary): self.name = name self.job = job self.__sarlary = sarlary #私有字段 def __show(self): ...
true
932aad343c6f9e066e64fb0decbbce0304581931
svolk19/tcpChat
/client.py
UTF-8
281
2.71875
3
[]
no_license
import socket def main(friendIP): s = socket.socket() host = friendIP port = 9999 s.connect((host, port)) while True: data = s.recv(1024).decode('utf-8') if len(data) > 0: print('<<<' + str(data)) s.close()
true
4adbc19dd5e5fb74d47a83bf89df10cb51864980
rogandley/Python5eGenerator
/genLib/Stats.py
UTF-8
442
3.078125
3
[]
no_license
""" Class to hold the stat array for a character """ class Stats(): def __init__(self, stre, dex, con, inte, wis, cha): self.stre = stre self.dex = dex self.con = con self.inte = inte self.wis = wis self.cha = cha def setStats(stats, stre, dex, con, inte, wis, cha):...
true
1b57d77f7d7712ba2ee04c62dfeafca403edd9a3
lulalulala/leetcode
/1--50/5. Longest Palindromic Substring.py
UTF-8
718
3.640625
4
[]
no_license
"""Example 1: Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Example 2: Input: "cbbd" Output: "bb" """ class Solution: def longestPalindrome(self, s): """ :type s: str :rtype: str """ list1 = [] list2 = [] log_str = '' for i in s:...
true
b3f1340985b5ee6f879d53a282249b5cdb10cef5
coding-dojo-unicap/segundo-coding-dojo
/spock.py
UTF-8
978
3.171875
3
[]
no_license
def resultado(mao1,mao2): hashTable={'Pedra':['Tesoura','Largato'],'Papel':['Pedra','Spock'], 'Tesoura':['Papel', 'Largato']} play1 = 1 play2 = 2 empate = 0 print('Mao1 :'+ mao1 + '\n' + 'Mao2: '+ mao2) if(mao1 == mao2): return empate elif(mao1 == 'Pedra' and ma...
true
f1aaabc0e31c94e964a389845926db80c8aa8d29
Kanaderu/SYDE556-750
/SYDE556-750OxytocinFearConditioning_v1.py
UTF-8
2,977
2.65625
3
[]
no_license
# Peter Duggins # SYDE 556/750 # April 2016 # Final Project - Oxytocin and Fear Conditioning import nengo import nengo_gui import numpy as np import matplotlib.pyplot as plt plt.rcParams['lines.linewidth'] = 1 plt.rcParams['font.size'] = 20 #ensemble parameters stim_N=50 #neurons for stimulus populations stim_dim=1 #...
true
11b96f0193bb23a64af3e75215f19d11679fd501
CodeCarrots/warsztaty
/na_zywo/20141210_firmatrad.py
UTF-8
437
3.234375
3
[ "CC0-1.0" ]
permissive
cnt = 0 def new_employee(name, job, cnt): cnt += 1 return ({'name': name, 'job':job}, cnt) def get_name(employee): print(employee['name']) def change_job(employee, job): employee['job'] = job return employee # dodajemy komputer def new_computer(name, type): return {'name': ...
true
af0d798736e10d28e12d3e5f6c77aa31c83dca65
imzhen/HMMSpellChecker
/tools.py
UTF-8
3,430
3.578125
4
[]
no_license
from functools import reduce, partial import re def to_lower(text): return re.findall('[a-z]+', text.lower()) def to_lower_sentence(sentence_list): return ['###'] + reduce(lambda x, y: x+y, [to_lower(word) for word in sentence_list]) + ['.', '###'] def parse_file(file_path): """ It is used to pars...
true
d1efca782cb17527904575c8d45a553cd72e02bb
SankalpJoshi2910/Python-Programming
/Final Encryption.py
UTF-8
1,241
3.34375
3
[]
no_license
# Final Encryption import string import random alphabet=string.printable print(alphabet) #print(len(alphabet)) key='qwerty'#to be more general #key=alphabet.find(key)/ #comment this if using random.randint newmessage='' newmessage2='' message=input('enter a new message : ') '''for character in mes...
true
de20b90544a17fd3fa3a71a99bac59f0385b6768
Sinder20/Ejercicios1Python
/ImparesHasta100.py
UTF-8
220
3.90625
4
[]
no_license
# 1. Hacer un programa que imprima los numeros impares hasta el 100 y que imprima cuantos impares hay k=0 for i in range(1, 101): if i%2!=0: print(i) k=k+1 print("Cantidad de Números impares:",k)
true
ab5caeb1e9aa6e997c7e9e7d597d22ae24beeb00
wh-jung0522/AlgorithmStudy
/Programmers/Test/2.Stack_Que/4_Printer_Queing.py
UTF-8
796
3.296875
3
[]
no_license
def solution(priorities, location): answer = 0 while(True): que_length = len(priorities) if (que_length==0): break top_priority_location = priorities.index(max(priorities)) if(top_priority_location > location): location = location+que_length-top_priority_l...
true
0ec8ad0b230fde0734f9ffff6a68091d073ee753
Forcemay/Robot_2020
/object/buoy.py
UTF-8
1,582
3.421875
3
[]
no_license
class Buoy(): def __init__(self, color, x,y): self.color=color self.x = x self.y = y self.position="%"#position in the storage self.color_storage="%" self.state="initial" self.order="%" def which_state(self) :#we can direcly apply the function but for...
true
0e8c5319dbab5ff782fc91fcfc729e84cd83ad13
wangfuli217/ld_note
/cheatsheet/编程笔记/07.Python/1.基础/1.4.1.decorator.py
UTF-8
14,071
3.890625
4
[]
no_license
装饰器 关于装饰器,请记住: 装饰器函数能增加或替换被装饰函数 装饰器函数在模块加载时, 被装饰函数定义的时候就开始执行了 在定义装饰器函数时, 如果忘了添加functools.wraps装饰器, 它会将被装饰函数的元信息拷贝过来 registry = [] # <1> def register(func): # <2> print('running register(%s)' % func) # <3> registry.append(func) # <4> return func # <5> @...
true
bccbf42b1cfab2b7140964a4fe6fc1181d70eb8b
AG4957/-
/qq信息连续发送(间隔发送).py
UTF-8
2,141
2.796875
3
[]
no_license
import tkinter as tk from tkinter import * import win32clipboard as w import win32con import win32gui import time window = tk.Tk() #禁止窗口缩放 window.resizable(False, False) window.title('QQ信息连续发送') window.geometry('425x200') e1 = tk.Label(window, text='纯属娱乐,不要恶搞!', bg='green', font=('Arial', 20)).grid(row...
true
19842e710fc19401a8cc730dfde308ac42bcfeef
JohanSmet/lsim
/src/tools/rom_led_decimal_8b.py
UTF-8
1,606
3.34375
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env python3 # rom_led_decimal_8b.py: ROM that replaces the logic to display a 8-bit value on 4 7-segment LED modules # - input : [0-7] = the number to display # [8-9] = index of the digit to display (0 = least significant digit) # - output : 8 bits (the segments to light up) # # +-a-+ # ...
true
d86717d9a77f40a79fccd144e2b8448013d9f40e
Mncedy/Level-zero-coding
/Desktop/LEVEL o CODING/task6.py
UTF-8
174
3.34375
3
[]
no_license
def maxValue(num1, num2, num3): max = num1 if num2 > max: max = num2 if num3 > max: max = num3 return max print(maxValue(num1, num2, num3))
true
c57d5666aa1e0e0546a954d601625f5f51c8c7f1
xtrinch/fcm-django
/fcm_django/fields.py
UTF-8
4,147
2.703125
3
[ "MIT" ]
permissive
import re import struct from django import forms from django.core.validators import MaxValueValidator, MinValueValidator, RegexValidator from django.db import connection, models from django.utils.translation import gettext_lazy as _ UNSIGNED_64BIT_INT_MIN_VALUE = 0 UNSIGNED_64BIT_INT_MAX_VALUE = 2**64 - 1 __all__ = ...
true
ef8b86d909b80d564f2da2033c6c41a7733444b9
csungg/csung.github.io
/Folder2/functions.py
UTF-8
299
3.8125
4
[]
no_license
def monday(): print("Hello world!") name = input("What's your name?") answer = input("Do you like mondays, " + name + "?") if answer == "yes": print("You're wrong, stop that...") elif answer == "no": print("I am too") else: print("What?") monday()
true
27535c5c037ebe4a478c89d44d257ad7a0f05279
ianholing/MLH_bot
/bots/MsTaco/src/persistence.py
UTF-8
1,975
2.75
3
[]
no_license
import os from tinydb import TinyDB, Query from tinydb.operations import add, subtract from src.config import DAILY_TACOS from src.time_utils import get_today users_db = TinyDB('./db/users.json') logs_db = TinyDB('./db/logs.json') class DBUser: def __init__(self, user_id): self.user = self.get_user(user...
true
948c6002b133800e29f102f9b61c617989d9a40c
zelca/udacity-cs373-assignments
/assignments/search-optimum-policy.py
UTF-8
1,883
3.53125
4
[]
no_license
# ---------- # User Instructions: # # Write a function optimum_policy that returns # a grid which shows the optimum policy for robot # motion. This means there should be an optimum # direction associated with each navigable cell from # which the goal can be reached. # # Unnavigable cells as well as cells from which # t...
true
350427f4ff6123d4931a2f9d4f1a5198a5283970
jurajama/FMIWeatherClient
/fmiweatherlib.py
UTF-8
2,371
2.84375
3
[]
no_license
# coding=utf-8 import requests, urllib, datetime import xml.dom.minidom # Docs: # https://en.ilmatieteenlaitos.fi/open-data-manual-fmi-wfs-services # Available queries: # http://opendata.fmi.fi/wfs?service=WFS&version=2.0.0&request=describeStoredQueries class fmiweather(): FMI_BASE_URL = "http://opendata.fmi.fi/...
true
c985060489adeaaf9cb9172f17731bc667a4c84b
mubero/AgregationPhysique2020
/LP/LP.49 Portraits de phase/LP49. Portrait de phases. Python/Pendule_simple.py
UTF-8
1,165
3.25
3
[]
no_license
import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt # Definition des parametres l = 1.0 # m g = 9.81 # m/s2 m = 1.0 # kg Omega2 = g/l # pulsation du pendule # Definition modele def modele_pendule(y, t, a, b): omega, theta = y dydt = [-a*np.sin(theta)...
true
baf798f7f457f6b67c88cc98955e61c070541382
nagy3n/Proxy
/client.py
UTF-8
1,068
3.09375
3
[]
no_license
import socket import sys def encode(key, clear): enc = [] for i in range(len(clear)): key_c = key[i % len(key)] enc_c = chr((ord(clear[i]) + ord(key_c)) % 256) enc.append(enc_c) return "".join(enc) def decode(key, enc): dec = [] for i in range(len(enc)): ...
true
2a5e3e3f88b6014829cd85458f38cd72fafa723b
guigui2993/Euler
/p143/p143abc.py
UTF-8
900
3.46875
3
[]
no_license
#Problem 143 """ Investigating the Torricelli point of a triangle a, b, c, p, q, r are integers find sum of p+q+r when p+q+r <= 120000 AN = BM = CO = p + q + r => AN, BM, CO are integers Seems that Beta is angle in pythagorean triangle cos(B) = p/q Idea: compute ||CO|| and others should be integer ! 1st way to di...
true
825eb2d5326b1676abdfb23168e5799302119aeb
jckim70/DL1
/lab-04-3-file_input_linear_regression-02.py
UTF-8
2,202
3.21875
3
[]
no_license
# Lab 4 Multi-variable linear regression import tensorflow as tf import numpy as np tf.set_random_seed(777) # for reproducibility def MinMaxScaler(data): numerator = data - np.min(data, 0) denominator = np.max(data, 0) - np.min(data, 0) # noise term prevents the zero division # return numerator / (deno...
true
91648f7c6d7930bd5166f16b563f8c1960f59fb4
roddar92/linguistics_problems
/src/russian/NaiveSentenceBoundaryDetector.py
UTF-8
6,173
2.875
3
[]
no_license
import re from src.russian.NaiveTokenizer import NaiveTokenizer class NaiveSentenceBoundaryDetector(object): __DOT, __QUESTION, __EXPRESSION = '.', '?', '!' __EOS = (__DOT, __QUESTION, __EXPRESSION, '...') __MULTI_PUNCT = re.compile(r'([.?!]){2,}') __ABBR_WITH_POINTS = re.compile(r'([A-ZА-Я]\.){3,}') ...
true
7ee130976aa03b114fd1e810d252bb313abc842a
chou-chou/progression_stage_model
/progression_stage_model.py
UTF-8
6,825
3.140625
3
[ "MIT" ]
permissive
#!/usr/local/bin/python # -*- coding: utf-8 -*- ''' Created on Oct 26, 2014 Finding Progression Stages in Time-evolving Event Sequences WWW14 を実装してみる. X =: [x_0,x_1,...,x_i,...,x_n] numN : len(X) x_i : [x_i_0,x_i_1,...,x_i_j,...,x_i_numLs[i]] numLs[i]: len(x_i) x_i_j: one event in c s_i_j: in {0,..,numK-1} s.t. j>=k...
true
907b3ea5a7ab6914475cb5552ed9305c32e4a44e
4doctorstrange/DS-and-Algorithms-in-Python
/solved/greedy/coinchange_mincoins.py
UTF-8
377
3.296875
3
[]
no_license
def coin(v,arr): c=0 ans=[] arr.sort(reverse=True) for i in arr: if i>v: continue elif i==v: c+=1 ans.append(i) break else: v-=i c+=1 ans.append(i) return (ans,c) v=int(input()) arr=...
true
33582a2f5f2d7e6a4b9580a3250d80ff1a39705c
basepair/basepair-python
/basepair/helpers/nice_print.py
UTF-8
5,140
2.875
3
[ "MIT" ]
permissive
'''Helper to print object nicely''' from __future__ import print_function # General imports import os # Lib imports from tabulate import tabulate # App imports from basepair.helpers import eprint class NicePrint: '''Helper class to print nice objects''' @staticmethod def analyses(data): '''Print analyses...
true
b6bb4295f0f61ed8dd874ff297d2d22af16c478d
mamunm/data_science_algorithms
/Games/waiting_game.py
UTF-8
677
3.609375
4
[]
no_license
import random import time ttime = random.randint(1, 10) print('Your target time is {} seconds. Good luck!'.format( ttime)) input('-' * 20 + 'Press Enter to Begin' + '-' * 20) stime = time.perf_counter() print('Wait {} seconds to press the next Enter'.format(ttime)) input('-' * 20 + 'Press Enter to Begin' + '-'...
true
b4081765fd3116ea43e9f50f63c7161a1d0e1653
Waznop/meme-on-generator
/source/meme_analysis.py
UTF-8
1,339
2.578125
3
[]
no_license
import pickle import numpy as np import matplotlib.pyplot as plt from glob import glob from meme_scrape import data_path analysis_path = "./analysis.pkl" data_list = [] for data_file in glob(data_path + "*.pkl"): with open(data_file, "rb") as f: item = pickle.load(f) data_list.append((item.score, ...
true
5ae6bb1f07b6d92d05a2c260289b27fab5ea78fb
13jqq/PokerLearning
/poker_env/MCnode.py
UTF-8
3,436
2.78125
3
[]
no_license
import numpy as np from collections import defaultdict from abc import ABC, abstractmethod class RealtimeSearchMCTSNode(ABC): def __init__(self, state, parent=None): ''' Parameters ---------- state : poker_env.state.TwoPlayersAbstractGameState require: __...
true
8557d9db275af20cf3f656110f0ba7acf166bd86
Aasthaengg/IBMdataset
/Python_codes/p02724/s054291286.py
UTF-8
70
2.84375
3
[]
no_license
n = int(input()) p = n // 500 * 1000 n %= 500 p += n // 5 * 5 print(p)
true
6a217df58050157a14827e7e0cefd176e35ef0c7
MrBanhBao/fundamentals_of_software_analytics
/exercise1/1_3_author_consolidation.py
UTF-8
665
3.03125
3
[]
no_license
#!/usr/bin/env python import sys data = sys.stdin.read() author_dict = {} author_email_set = set(data.split("\n")) for author_email in author_email_set: try: author = author_email.split(',')[0] email = author_email.split(',')[1] if author in author_dict: author_dict[author].a...
true
4f6c53b89e95991fd19a97da1ab7845e768901ce
Emmzy17/gui_registration
/tkinter projects/first.py
UTF-8
395
2.875
3
[]
no_license
from tkinter import * window = Tk() window.geometry("300x300") window.title("Welcome") labell = Label(window, text = "Weclcome To tkinter",fg="blue",relief = "solid", bg ="yellow", font=("arial", 16, "bold")) labell.pack(fill=BOTH, padx=2, pady =2) button = Button(window, text= "Demo", fg = "white", bg="red", rel...
true
971a430597343855287d4738ede8421bfc7ecd21
cool-RR/python_toolbox
/test_python_toolbox/test_file_tools/test_atomic.py
UTF-8
1,830
2.578125
3
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
permissive
# Copyright 2009-2017 Ram Rachum. # This program is distributed under the MIT license. import python_toolbox from python_toolbox import temp_file_tools from python_toolbox import cute_testing from python_toolbox import file_tools def test(): with temp_file_tools.create_temp_folder( p...
true
0d1e3216490434dcdd5f03ec4acec099f5299bf0
hteppl/ssk_alliance_volley
/main.py
UTF-8
896
2.71875
3
[]
no_license
import datetime import random import vk_api from time import sleep token = '' # vkhost.github.io name = 'ФИО' str_1 = 'Запись на ИГРОВУЮ ТРЕНИРОВКУ 23' str_2 = 'Уровень «любой»' vkq = vk_api.VkApi(token=token) owner = -202633307 count = 3 print(name + " hosted!") while True: sleep(random.randint(10, 15)) ...
true
4678af8fcdf1298a65b38272bae04759eb477b8e
Javierfs94/Modulo-Programacion
/Python/repetitivas/Ejercicio9.py
UTF-8
586
4.21875
4
[]
no_license
''' Mostrar en pantalla los N primero numero primos. Se pide por teclado la cantidad de numeros primos que queremos mostrar. @author: Fco Javier Frias Serrano ''' import math while True: mostrar = int(input("Introduzca cuantos numeros primos quiere mostrar: ")) if mostrar > 0: break; ...
true
664641c7f7b57dd0f899b6859ba5659d99eca2cc
mablscmo/SME_Scripts
/Tools/strength.py
UTF-8
471
3.046875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jan 1 21:48:30 2021 @author: monte """ import numpy as np def strength(gf, exc, T=5770): '''Determines the strength of spectral lines using the weak-line approximation. Only works for lines of the same element and ionisationstage. Takes the gf value and the excitati...
true
41f601b6f7f441ba4919e4709d092833404e7fa4
oswalgarima/leetcode-daily
/arrays/intersection_two_arr.py
UTF-8
391
3.578125
4
[ "MIT" ]
permissive
""" 349. Intersection of Two Arrays https://leetcode.com/problems/intersection-of-two-arrays/ Given two arrays, write a function to compute their intersection. Example: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2] """ # Runtime: 44ms class Solution: def intersection(self, nums1: List[int], nums2: List[i...
true
52049090a0a36804520ff23d4bfb7cfef8e5e12d
thomasmontoya123/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/101-lazy_matrix_mul.py
UTF-8
399
3.28125
3
[]
no_license
#!/usr/bin/python3 """Lazy matrix multiplication module """ import numpy def lazy_matrix_mul(m_a, m_b): """function that multiplies two matrices. Parameters ---------- m_a : list of list matrix a m_b : list of list matrix b ...
true
e00173c6fd152a4249205d60932b07682965f808
AysenurKavlak/assigment3
/deneme.py
UTF-8
523
3.421875
3
[]
no_license
class multi(): set_message: str = None set_count: int = 0 set_display: str = None set_display: str = None def a(self): print(self.set_message, " ", self.set_count) md = multi md.set_message = "Hello World!" md.set_count = 3 print(md.set_message, "Count:", md.set_count) for i in ...
true
e587c6763b0654de21beceea032187d34653fb6d
janiosl/python.ds
/RPA/pyagAbrirFechar.py
UTF-8
569
3.78125
4
[]
no_license
""" #Programa simples para abrir e fechar um aplicativo #Python DS """ #Bibliotecas usadas import pyautogui as pyag from time import sleep from pyautogui import click, doubleClick, moveTo #Usar código abaixo no prompt para capturar as posições #pyag.position() #Gravar posições capturadas nas variáveis abaixo foto_py...
true
bf75f25724bd8953a03d8d391720dbc365e04f7b
tmdgkr07/dust
/Gangwon/test.py
UTF-8
1,454
2.59375
3
[]
no_license
#-*-coding:utf-8-*- import requests import urllib.request import pandas as pd import json import pprint dust_data=' ' api_key = "1FmuBg8TmJiwfSk8v7kigut57VG5pwtbsovBmJDPqCHLQm%2Bbd3uZi9k1hXIswLNsSnXxNnAH7ysAEkev4z1%2BHw%3D%3D" dust = 'dust' city = "강원" dust_File = 'dust_Gangwon.json' url_dust = "http://openapi.a...
true
f1b159e288d244e2e88e1fe685aa72d7ee1de744
ndcolter-mcafee/opendxl-bootstrap-python
/dxlbootstrap/generate/app.py
UTF-8
2,854
2.640625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- ################################################################################ # Copyright (c) 2018 McAfee LLC - All Rights Reserved. ################################################################################ from __future__ import absolute_import from __future__ import print_function i...
true
d2d23dd32983cbc3a315a4edd240453d4c78c786
gabriellaec/desoft-analise-exercicios
/backup/user_309/ch132_2020_04_01_10_48_10_967826.py
UTF-8
160
2.921875
3
[]
no_license
from math import radians from math import cos def calcula_trabalho(F,teta,s): teta_em_rad = radians(teta) trab = F*cos(teta_em_rad)*s return trab
true
3da63a00b15867c0247d2285bffaecb7637337c7
baxterdemers/gerrygrade
/cleanStateLeg2016.py
UTF-8
2,213
2.734375
3
[]
no_license
#%% import pandas as pd import warnings import ccm warnings.filterwarnings("ignore") def fix_upper_chamber(df): """ fix the issues from the MEDSL data set pertaining to the 2016 election results for upper chambers of state legislatures. Expects 2016 MEDSL results column names. """ df["party"][ ...
true
225771f457448ba2f33477c32557e9dce9fb832b
ahmedfathy74/Al-algorithms
/AI-Package/MachineLearning/MachineLearning.py
UTF-8
7,203
3.046875
3
[]
no_license
''' Online Python Compiler. Code, Compile, Run and Debug python program online. Write your code in this editor and press "Run" button to execute it. ''' import math class item: def __init__(self, age, prescription, astigmatic, tearRate, needLense): self.age =...
true
e5718ff42de69bfd3cfa17937c22baa79bbf336d
AK-1121/code_extraction
/python/python_13087.py
UTF-8
75
3.03125
3
[]
no_license
# Converting two lists to a list of dictionaries in Python dict(zip(S, L))
true
6fe6347c8c7e61c2dd86a256f6c376b2465934f1
ardin/block-excessive-ua
/block-excessive-ua.py
UTF-8
3,348
2.640625
3
[]
no_license
#!/usr/bin/python ''' Block if User-Agent requests are too high in X seconds ''' import time import os import sys import argparse import re from datetime import datetime from pathlib import Path debug = None ua_count = {} # count ua_time = {} # time def log(message,level="INFO"): if (level == 'DEBUG' and...
true
91e79a4d2c04d9b59a7d452b6dcfcad423db3ba0
littleqingqing/littleqingqing
/ML_project/week3/act_max_test.py
UTF-8
3,123
2.90625
3
[]
no_license
import numpy as np import tensorflow as tf import matplotlib.pyplot as plt def generate_data(size): x = np.random.uniform(-1, 1, (size, 2)) y = np.prod(x, axis=1) y[y < 0] = -1 y[y >= 0] = 1 return x, y def activation_hist(network, neuron, n=10000, data=None): # network: Keras model # ne...
true
c8430cdb05cdc8897e1e8ca973fb3697817690ce
project-capo/app-drive-and-visualize
/src/navi/components/avoidance/rodeo_swap.py
UTF-8
5,477
2.59375
3
[ "Unlicense" ]
permissive
import time import math from amber.tests.hokuyo_example import HokuyoListener from navi.tools import logic from navi.components.component import Component __author__ = 'paoolo' class RodeoSwap(Component, HokuyoListener): """ Used to change values to avoid something. """ def __init__(self): ...
true
9f9f2b618fd5c664dd4fc053494232037f842aef
thuttenlocher/Computing_in_Python_Course_edX
/3.3.5 Excercise 2.py
UTF-8
1,714
3.890625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Mar 22 15:17:22 2020 @author: Tyler H """ lyrics = ["I wanna be your endgame", "I wanna be your first string", "I wanna be your A-Team", "I wanna be your endgame, endgame"] lines_of_sanity = 6 #lyrics = ["This was a triumph", "I'm making a note here: huge success...
true
51e16058bd63cc6ef2c227f13708b129a97bc6a5
jms30/SDN_Firewall
/src/connection_tracking.py
UTF-8
1,428
2.796875
3
[]
no_license
#! usr/bin/env python import logging class TrackConnection(): """ Firewall Connection Tracking. Add seen flows to dictionary and track them from incoming packets. """ def __init__(self): logging.info("Stateful Firewall --> Connection Tracking can be possible...") ...
true
2d14678986b4fa166585b0849c12c05c20e1c5aa
HIjack2015/solveSwordOffer
/字符串/替换空格.py
UTF-8
765
3.046875
3
[]
no_license
class Solution: def replaceSpace(self, s: str) -> str: count_space=0 for i in s: if i ==' ': count_space=count_space+1 s_arr=[*s] last=len(s) new_arr =s_arr+ [None] * (count_space*2) for i in range(len(s)-1,-1,-1): if s_arr[i]==...
true
8570d6d53be44b07a1fb19162001e71b08abccad
TSLsun/clinical-data-AI-analytics
/homework/hw2/plotting.py
UTF-8
817
2.765625
3
[]
no_license
# import matplotlib # matplotlib.use("AGG") import matplotlib.pyplot as plt def plot_hu_distribution(hu_image): fig = plt.figure(figsize=(15, 7.5)) plt.hist(hu_image.flatten(), bins=80, color='c') plt.xlabel("Hounsfield Units (HU)") plt.ylabel("Frequency") plt.show() def plot_ct_scan(image): ...
true
0a048f1b9b667b53aebae4056acf817b76b42cc3
sunepoulsen/buildtools
/lib/modules/abstractexception.py
UTF-8
624
3.171875
3
[]
no_license
# ============================================================================== # Classes # ============================================================================== ## # \brief Declares an exception to be throwed then calling abstract functions or # classes. # # class AbstractException( E...
true
dd16356f4b1dedc973cb2a2ed3f498797b77ead2
OmkarGhadge/FaceRecognition
/face_recognition/landmarking_expression.py
UTF-8
1,620
2.875
3
[]
no_license
import cv2 as cv import os import numpy as np import dlib detector = dlib.get_frontal_face_detector() #dlib detector gives face coords predictor = dlib.shape_predictor("face_recognition\shape_predictor_68_face_landmarks.dat") mood = input("Enter your mood: ") frames = [] outputs = [] cap = cv.VideoCapture(0) whi...
true
ccdf8160085c0fe24ca53995430547013270c427
awesome-archive/transistor
/transistor/persistence/newt_db/collections.py
UTF-8
3,689
3.140625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ transistor.persistence.newt_db.collections ~~~~~~~~~~~~ This module implements container classes for storing python objects in newt.db. :copyright: Copyright (C) 2018 by BOM Quote Limited :license: The MIT License, see LICENSE for more details. ~~~~~~~~~~~~ """ import newt.db class Spider...
true
b28e3009cf62caf571fee35b440be1d26b8114ad
AGiannoutsos/End-to-End-Lane-Detection
/scripts/classic_line_detector.py
UTF-8
3,498
3.328125
3
[]
no_license
import cv2 import numpy as np from google.colab.patches import cv2_imshow class Classic_Line_Detector(): def __init__(self, low_threshold=30, high_threshold=100, gaussian_kernel=5, triangle_top_factor=0.1): self.low_threshold =...
true
56f45ce42f916f8dcaf54c2a0b5fb8344a08ab5d
gvvynplaine/pyquil
/pyquil/magic.py
UTF-8
8,097
2.828125
3
[ "Apache-2.0" ]
permissive
############################################################################## # Copyright 2018 Rigetti Computing # # 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://ww...
true
9743d7f2f89cdba79931e34e81724efb534aa4ad
SofiPrez/programacion1
/unidad_2_python/ejercicio_9.py
UTF-8
527
3
3
[ "Python-2.0" ]
permissive
#!/usr/bin/python akira =int(input ("ingrese nro de pasajeros: ")) if akira ==0: print "no hay transporte" elif akira==1 and akira< 2: print "su transporte es bicicleta" elif akira==2 or akira<3: print "su transporte es moto" elif akira==3 or akira<5: print "su transporte es auto" elif akira==5 or akira<13: ...
true
4ee534c3a1cf0b10a6bec05f76063d80cf04c970
Koubae/CSV-Reader
/01-simple/ssn_readers/employment_reader.py
UTF-8
2,771
3.359375
3
[]
no_license
import csv from itertools import islice from collections import namedtuple from datetime import datetime employment = r'ssn_readers\csv_dir\employment.csv' def csv_extractor(file_name): # General CSV extractor with open(file_name, 'r') as f: rows = csv.reader(f, delimiter=',', quotechar='"') yie...
true
777a00a2e0d8d40a39ee0ef7b647bef718b0a896
Mamba413/Ball
/Python-package/Ball/utilize.py
UTF-8
5,462
2.515625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/7/24 20:26 # @Author : Yanhang Zhang # @Mail : zhangyh93@mail2.sysu.edu.cn # @File : utilize.py import numpy as np import math from sklearn.metrics.pairwise import euclidean_distances from Ball.wrap_c import bcor_test_wrap_c def examine_None(x):...
true
97b38247430bd81ff067d402bf1efc038df3b7c3
marcodenisi/advent-of-code
/2018/03/03.py
UTF-8
1,076
3.3125
3
[]
no_license
import re with open('input.txt') as f: data = f.read() claims = data.split('\n') #Part 1 claim_regex = re.compile(r''' \# ([0-9]+) #id \s\@\s ([0-9]+) # left distance \, ([0-9]+) # top distance \:\s ([0-9]+) # width [x] ([0-9]+) # height ''', re.VERBOSE) # init matrix matrix = [[0 for x in range(1000)]...
true
80a0ba6ebf8d919e3de1550786a62ca2475dc6c3
perrylea/mqtt-google
/mqtt.py
UTF-8
2,913
2.6875
3
[]
no_license
#Simple MQTT Client publishing example for Google Cloud Platform import datetime import os import time import paho.mqtt.client as mqtt import jwt project_id = 'pro-adapter-182205' cloud_region = 'us-central1' registry_id = 'cradlepoint-iot' device_id = 'Cradlepoint-IOT' algorithm = 'RS256' mqtt_hostname = 'mqtt.google...
true
43f48b7db1f42f236e211f56c65a029a65d25686
Takashiidobe/learn-python
/scratch/scratch.py
UTF-8
164
3.875
4
[]
no_license
print("Please enter your name for a greeting, followed by the enter key.") user_name = input() greeting = "Hello, " response = greeting + user_name print(response)
true
069d2e0223c2bbee9a287894acaf1d597ea3590e
rayd512/Necromancer-Game
/gravestone.py
UTF-8
814
3.09375
3
[]
no_license
import pygame import colors import math class GraveStone(pygame.sprite.Sprite): def __init__(self, x, y, graveSize, enemySpeed): pygame.sprite.Sprite.__init__(self) self.image = pygame.image.load("./grave0000.png") self.rect = self.image.get_rect() self.speed = 0 self.rect.x...
true
a7099eafbefa9d3b857af4d026ca7a547155ad38
python-workshop/fsdse-python-assignment-171
/tests/test_longest_common_substr.py
UTF-8
545
3.21875
3
[]
no_license
from unittest import TestCase class TestLongest_common_substr(TestCase): def test_longest_common_substr(self): try: from build import longest_common_substr except ImportError: self.assertFalse("no function found") self.assertRaises(TypeError, longest_common_substr,...
true
5f9528648e53e294ccf9286c2d09c8bd0a5e47e9
MITgcm/xmitgcm
/xmitgcm/llcreader/stores.py
UTF-8
3,800
3.21875
3
[ "MIT" ]
permissive
import fsspec import os import zarr class BaseStore: """Basic storage class for LLC data. Parameters ---------- fs : fsspec.AbstractFileSystem base_path : str, optional Where to find the data within the filesystem shrunk : bool, optional Whether the data files have been tagged...
true
9ecc74e60c78b75c254642f84592313e36cb1cef
svyatoslavn1000/collecting_information
/lerua_parser/items.py
UTF-8
1,264
2.515625
3
[]
no_license
# Define here the models for your scraped items # # See documentation in: # https://docs.scrapy.org/en/latest/topics/items.html import scrapy from itemloaders.processors import MapCompose def prepare_data(value): price = int(value.replace(' ', '')) return price def prepare_image(value): try: ph...
true
597b71a9fb0b805fbd81767c912b7c669b85d33c
yanpan9/Some-Code
/Math/70.py
UTF-8
278
3.125
3
[]
no_license
class Solution: def climbStairs(self, n: int) -> int: fst, snd = 1, 1 if n == 1: return snd else: count = 1 while count < n: fst, snd = snd, fst+snd count += 1 return snd
true
bdadf861c24c8da9f2ad33a4a739761124bad029
Pruthvi77/Cent
/PycharmProjects/untitled/venv/ListComprehension.py
UTF-8
672
4.0625
4
[]
no_license
ex = [items for items in range(0,10000,2)] print(ex) ex = [items for items in range(1,10000,2)] print(ex ) ex1= [num for num in range(10)] print(ex1) ex2= [num*3 for num in range(10,20)] print(ex2) ex3= [num for num in range(10,20,2)] print(ex3) #--------- using if in For loop ex4= [num for num in range(10) if nu...
true
c995dfdfd88b94faff5bc2a819511961ad91bbe3
denys-meloshyn/quantum-cloning
/config.py
UTF-8
1,004
2.75
3
[]
no_license
import os from pathlib import Path import yaml from constants import Constants class Config: def __init__(self, config_file=Constants.Default.config_file_path): assert os.path.exists(config_file), """Create configuration file `{}` in your home directory ({})""".format(Constants.Default.config_f...
true
4a5512838376d067a1bd2a84c8552105aac8ae50
Willyou2/Personal-Projects
/tetris.py
UTF-8
11,131
3.1875
3
[]
no_license
# Name = William Cen # # Partners = leq, dgajaraw # Updated Animation Starter Code from tkinter import * from random import * import copy #################################### # customize these functions #################################### def init(data): data.sPiece = [ [ False, True,...
true
51bf8ae6bc0b93112bdc11037b655e659fb66ad6
geertvd/adventofcode
/2017/day10/part1.py
UTF-8
1,155
3
3
[]
no_license
input_lengths = map(int, open("day10/input.txt", "r").read().split(',')) circular_list_length = 256 circular_list = range(circular_list_length) current_position = 0 skip_size = 0 for input_length in input_lengths: if input_length: stop = current_position + input_length if current_position + input_le...
true
b26eca3febc32d55f1adf9a64e7fc01790349a7c
amisha1garg/Arrays_In_Python
/SumOfSeries.py
UTF-8
561
4.1875
4
[]
no_license
# Write a program to find the sum of the given series 1+2+3+ . . . . . .(N terms) # User function Template for python3 class Solution: def seriesSum(self, n): # code here sum = 0 sum += n * (n + 1) / 2 return int(sum) # { # Driver Code Starts # Initial Template for P...
true
c56e5d298639bc6fa06d0e9c08a12f2d8be0b438
EROIN/Spoj-Programs
/SBank/Sbank.py
UTF-8
326
2.890625
3
[]
no_license
t=int(input()) for test in range(t): a=int(input()) y=[] dict={} j=0 for i in range(a): str=input() y.append(str) if str not in dict: dict[str]=1 j+=1; else: dict[str]+=1 y=list(dict.keys()) y.sort() for i in range(j): print(y[i],dict[y[i]]) print('') if test!=t-1: i...
true
3e0b901d91af402196c528d36d34017a52953654
0x47root/Python-Scripts
/makehidden.py
UTF-8
255
3.15625
3
[]
no_license
file_name = input("What wordlist do you want to make hidden?: ") with open(file_name, 'r') as file: data = file.readlines() length = len(data) for i in range(length): data[i] = "." + data[i] with open(file_name, 'w') as file: file.writelines(data)
true
cffa93b081da2d54f81a4a47f7eb74a9f5f97e61
wuhaochen/multinet
/multinet/information_measure.py
UTF-8
2,959
2.78125
3
[ "MIT" ]
permissive
from __future__ import division import dit import itertools import multinet as mn from collections import Counter def extract_count(g, layers, ignore_self_loop=True): c = Counter() for u,v in g.edges(): if ignore_self_loop and u == v: continue word = '' for layer in layer...
true
c05df32a287a5c1d8797ee3b465ad6485001b036
HiouaniHalim/READMENEW
/PROJECT__1.py
UTF-8
397
2.546875
3
[]
no_license
__all__ = ['TRANSFORM'] class TRANSFORM(object): __slots__ = ['__VALUE_KILOGRAM__'] def __init__(self, KILOGRAM=None): self.__VALUE_KILOGRAM__ = KILOGRAM def __mul__(self): VAR = 'G' return self.__VALUE_KILOGRAM__ * 10 ** 3, VAR def __pow__(self): VAR...
true
ca235a326bcc39be6c953ce093b5af8d862d705a
geoflows/D-Claw
/python/pyclaw/evolve/rp/rp_burgers.py
UTF-8
1,634
2.90625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # encoding: utf-8 r""" Riemann solvers for Burgers equation .. math:: u_t + \left ( \frac{1}{2} u^2 \right)_x = 0 :Authors: Kyle T. Mandli (2009-2-4): Initial version """ # ============================================================================ # Copyright (C) 2009 Kyle T. Mand...
true
503c83e908a9acaad3872260be8a55e8204abb39
mi-kol/settlers_python
/DisplayingOfMap.py
UTF-8
14,712
2.765625
3
[]
no_license
#Settlers of Catan import random import pygame types = ["bread", "sauce", "cheese", "ham", "pepperoni"] def play(): input1 = input("How Many Players?: ") numplayers = input1 return str(input1) numplayers = 0 colors = ['red', 'blue', 'white', 'orange', 'green', 'brown'] playernames = [] playercolor = ...
true
fb7c5119cd48a4a5cf79b65360fbee306982460d
Vahid-Esmaeelzadeh/CTCI-Python
/Chapter5/basicOperations.py
UTF-8
799
3.328125
3
[]
no_license
def getBit(num: int, i: int) -> int: return int((num & (1 << i)) != 0) def setBit(num: int, i: int) -> int: return num | (1 << i) def clearBit(num: int, i: int) -> int: mask = ~(1 << i) return num & mask def updateBit1(num: int, i: int, val: bool) -> int: if val: return setBit(num, i) ...
true
faa8868e9fc0b6be65518ccbe3f35b58c5164d7f
mikeyii/pyimgbot
/__init__.py
UTF-8
3,368
2.578125
3
[]
no_license
import pyautogui from math import floor import random import time from . import humanmouse import clipboard imageDir = 'images/' retina = True # Images part def _fixRetina(coords): if retina and coords: x, y = coords x = floor(x / 2) y = floor(y / 2) return x, y return coords...
true
b85c8e83e9540bebf22644907e4c172ef38e1051
BluCodeGH/parachute
/parachute.py
UTF-8
5,823
2.53125
3
[]
no_license
import importlib from io import BytesIO import json import os from shutil import copyfile import subprocess import sys import re import readline from colorama import init, Fore, Style from dulwich import porcelain init(autoreset=True) def say(text, depth=0): print(depth * " " + Fore.BLUE + "! " + Style.RESET_ALL +...
true
e96a806618bbfd09de32776077c8bac92cac12f3
AlexLaroche7/phys512-2020
/fourier_transforms/spectral_leakage.py
UTF-8
145
2.546875
3
[]
no_license
import numpy as np N=1024 x=np.arange(N) k=15.4 y=np.cos(2*np.pi*x*k/N) yft=np.fft.fft(y) xx=np.linspace(0,1,N)*2*np.pi win=0.5-0.5*np.cos(xx)
true
dd2b7ce7ca5ef0b82123b38a24c6d48cb21b39e4
gupthaisready/hackerrank_challenges_in_Python
/30_days_of_code/Day08_Dictionaries.py
UTF-8
426
3.6875
4
[]
no_license
num_phone_book_entries = int(input()) phone_book = {} while num_phone_book_entries > 0: num_phone_book_entries -= 1 key_name, value_phone = input().split() phone_book[key_name] = value_phone while True: try: search_name = input() if search_name in phone_book: print(f"{search...
true
4d016f751f1db95a46bf605b91274dbbb8c97cf3
balaramkantipudi/InterviewBit-1
/Stack and Queue/RAIN.py
UTF-8
748
3.0625
3
[]
no_license
__author__ = 'Vivek' # @param A : tuple of integers # @return an integer def trap(self, A): n = len(A) if n <= 2: return 0 left = [0]* n right = [0] * n Max = A[0] left[0] = A[0] for i in range(1, n) : if A[i] < Max : left[i...
true
6716f48fb283c43688a92edda12a173850ca546d
sugataach/al-gore-rhythms
/core/algorithms/binary_search/binary_search.py
UTF-8
1,080
4.46875
4
[]
no_license
''' Binary search works on sorted arrays, it will search for a given element and return it's index or -1 if not found. O(logN) -> Time O(1) -> Space ''' def binary_search(arr, k): min_value = 0 max_value = len(arr)-1 while True: if min_value > max_value: return -1 mid = (min_va...
true
9fea8b34162a450c5d55bac775da781196f84a3a
AdamZhouSE/pythonHomework
/Code/CodeRecords/2785/60585/246393.py
UTF-8
280
2.8125
3
[]
no_license
def trying(i,degree): if i==n: return degree%360==0 return trying(i+1,degree+option[i])|trying(i+1,degree-option[i]) n=eval(input()) option=[] for _ in range(n): temp=eval(input()) option.append(temp) if trying(0,0): print('YES') else: print('NO')
true
a9073b48bd995c9416b7ecbd53f56f4656b2f401
msollami/mpy
/mpy/core.py
UTF-8
25,596
3.21875
3
[]
no_license
# coding=utf-8 import os, glob import numpy as np from infix import shift_infix as infix from collections import OrderedDict """ Base mma-like functions. """ # =============================================================================== # Types # ======================================================...
true
233e43372bd8678398d2537400f663ca533df8a0
Zabrane/linbin
/genplot.py
UTF-8
2,722
3.09375
3
[ "MIT" ]
permissive
#!/usr/bin/python import re import sys import matplotlib.pyplot as plt import matplotlib as mpl import math import colorsys from optparse import OptionParser def linear (x): return x def log2 (x): return math.log (x, 2) def log10 (x): return math.log (x, 10) parser = OptionParser () parser.add_option (...
true
c51207e9df69521f2223a3b0e35e736aac477a2a
84KaliPleXon3/Simple-Yet-Hackable-WhatsApp-api
/whatsapp.py
UTF-8
29,345
2.609375
3
[ "Apache-2.0", "MIT" ]
permissive
# SWAMI KARUPPASWAMI THUNNAI # ============================================================ # Simple yet Hackable! WhatsApp API [UNOFFICIAL] for Python3 # Note: The author gives permission to use it under Apache 2.0 # Special Thanks To: alecxe, For reviewing my code! # ===========================================...
true
b7d33d0296c4e47f99bdaf46723c97c9404e27e9
FermiQ/puq
/examples/discontinuous/1dsin/lhs.py
UTF-8
227
2.625
3
[ "MIT", "LicenseRef-scancode-public-domain" ]
permissive
from puq import * def run(): x = UniformParameter('x', 'x', min=0, max=2) host = InteractiveHost() uq = LHS([x], 500, True) prog = TestProgram('./sin.py', desc='Sine Function') return Sweep(uq, host, prog)
true
6a3f21e4e9c56f4dcdc7103cf2c45ec76f000d03
ParitoshBarman/Python-Practice
/Chapter07-Loops/12_pr04.py
UTF-8
231
4
4
[]
no_license
number = int(input("Enter the number--> ")) prime = True for i in range(2, number): if (number%i == 0): prime = False break if prime: print("This number is Prime") else: print("This number is not Prime")
true