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
2c97d49c00384af546b1ccd5563ab7b17fb40fe9
hujianli94/Python-code
/18.python标准库/使用python定时执行任务/使用APScheduler实现cron计划任务.py
UTF-8
887
2.921875
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf8 -*- # auther; 18793 # Date:2019/9/1 13:09 # filename: 使用APScheduler实现cron计划任务.py from datetime import datetime import os from apscheduler.schedulers.blocking import BlockingScheduler def tick(): print('Tick! The time is: %s' % datetime.now()) if __name__ == '__main__': ...
true
ab5ad59d58d7e3bb7596d4fe5537938896003cb1
mcxxtyhd/python-test-Opencv
/test/test2.py
UTF-8
354
2.71875
3
[]
no_license
#保存图片 import cv2 cap = cv2.VideoCapture(0) i=0 while(1): ret, frame = cap.read() cv2.imshow("capture", frame) if cv2.waitKey(1) & 0xFF == ord(' '): i=i+1 imgName="i_"+str(i) cv2.imwrite("img/"+imgName+".jpeg", frame) if cv2.waitKey(1) & 0xFF == ord('e'): break cap.release...
true
43e618ac93f958156d5757f9d68ba995dab38b19
xiongmengmeng/xmind-technology
/10.ploty画图/ploty-2.py
UTF-8
4,638
2.78125
3
[]
no_license
from pyecharts.charts import * # from pyecharts.components import Table from pyecharts import options as opts # from pyecharts.commons.utils import JsCode import random # import datetime from pyecharts.globals import ThemeType #二.细节,各种配置学习 # 1.主题设置 # x_data = ['Apple', 'Huawei', 'Xiaomi', 'Oppo', 'Vivo', 'Meizu'] # ...
true
95ce0f603b11092de240641bd1e8ca308b928272
yordanovagabriela/HackBulgaria
/week3/Pandas/panda_network.py
UTF-8
3,551
2.9375
3
[]
no_license
import re import json from graph import bfs class PandaAlreadyThere(Exception): pass class PandasAlreadyFriends(Exception): pass class InvalidEmail(Exception): pass class Panda: def __init__(self, name, email, gender): self.name = name self.gender = gender check_email...
true
02393fabe9d00acf95c99f64b591d493a8392725
JavierIbarra/Arquitectura
/assembler.py
UTF-8
11,957
3.03125
3
[]
no_license
try: import tkinter as tk from tkinter import filedialog import tkinter.font as tkFont import tkinter.messagebox as MessageBox except ImportError: print(ImportError,"Se requiere el modulo Tkinter") from funciones import * import operator def beep_error(f): def applicator(*args, **kwargs): ...
true
30864e87a8cc833a67812185099d4546f287cb46
codecrafters-io/languages
/starter_templates/redis/python/app/main.py
UTF-8
445
2.75
3
[ "MIT" ]
permissive
# Uncomment this to pass the first stage # import socket def main(): # You can use print statements as follows for debugging, they'll be visible when running tests. print("Logs from your program will appear here!") # Uncomment this to pass the first stage # # server_socket = socket.create_server(...
true
217e51f73489f43bf7f838b1ef1a783a54c5c41c
Svens1234/lambda
/main.py
UTF-8
1,689
4.09375
4
[]
no_license
#Map, filter and lambda expressions #map #def sum_of_two_numbers(x): #return x+x #number_list = [1, 2, 3, 4, 5, 6, 7] #result = map(sum_of_two_numbers, number_list) #print(result) #for item in result: #print(item) #for item in map(sum_of_two_numbers, number_list): #print(item) #print(list(map(sum_of_t...
true
d7d8c5c011a5fe1454ea1d07dd3cd3ad048731c8
LinMeiChi/pyETL
/ETL_ptt.py
UTF-8
3,522
2.828125
3
[]
no_license
import requests from bs4 import BeautifulSoup import os import re if not os.path.exists('ptthomework'): #如果沒有資料夾,就自己創一個 os.mkdir('ptthomework') #創一個資料夾存文章內容 headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36'} url = 'h...
true
af0a5a39dae845b72ac529d6dc0ec025b4409e59
mitschabaude/nanopores
/nanopores/tools/pdesystem.py
UTF-8
16,456
2.671875
3
[ "MIT" ]
permissive
""" General-purpose PDE System class """ import numpy from dolfin import * from .illposed import * from .errorest import * from .utilities import _call from collections import OrderedDict parameters["refinement_algorithm"] = "plaza_with_parent_facets" __all__ = ["PDESystem", "LinearPDE", "NonlinearPDE", "GoalAdaptiv...
true
61f5f60a888addec71ff1a6acc1ab8fa3ef45147
bopopescu/Projects-1
/tepy/pay0d5/module_time.py
UTF-8
838
3.203125
3
[]
no_license
#!/usr/bin/env python #encoding=utf-8 #lau.liu@9street.org """ import time # x = time.localtime() # print(x) # print(x.tm_year) # print('this is 973 day:%d' %x.tm_yday) # print(time.strftime("%Y-%m-%d %H:%M:%S",x)) # print(time.strptime('2017-09-18 13:28:51',"%Y-%m-%d %H:%M:%S" )) # # print(time.gmtime(time.time())) ...
true
c101c38ae3e6d134b3d024f91fa73a8789aa9f5d
Halkazemi93/python
/hr_pro.py
UTF-8
3,040
4.15625
4
[]
no_license
from datetime import datetime now = datetime.now() print("""Welcome to HR Pro 2019 """) print(""" Options: 1. Show Employees 2. Show Managers 3. Add an Employee 4. Add a Manager 5. Exit """) manager_list = [] employee_list = [] class Employee: def __init__(self, name, age, salary, employmen...
true
8e52fe7e2734ccafd4977dc73203ea66f6ddb870
razerboot/DataStrcutures-and-Algorithms
/python/uc_tree_1.py
UTF-8
2,046
2.78125
3
[]
no_license
#!/bin/python from collections import defaultdict,Counter from fractions import Fraction as fc import sys class count(): def __init__(self,key): self.c=key def dfs(graph,vi,u,stack): vi[u]=1 for v in graph[u]: if vi[v]==0: dfs(graph,vi,v,stack) stack.append(u) def reverse(gra...
true
d3300dfd423c08995b2ab37e655a397bf972f1e6
wallshock/wdi
/sqrtpolowa.py
UTF-8
256
3.140625
3
[]
no_license
import math def pifinder(e): def f(e): if e == 0: return math.ceil(0.5 + (0.5)*math.sqrt(0.5)) return round(math.sqrt(0.5) * math.sqrt(0.5+0.5*(math.sqrt(f(e-1)))),2) return 2/f(e) print(pifinder(17))
true
9bfffd3fce5f67e70f1d92119f1bdf230f7f5a1f
NiShuang/pro_log_analyze
/download.py
UTF-8
1,757
2.734375
3
[]
no_license
# -*- coding: UTF-8 -*- import os import sys import zipfile import requests from config.config import config from utils.multi_thread import WorkManager reload(sys) sys.setdefaultencoding("utf-8") zip_path = config['zip_path'] log_path = config['log_path'] log_url_file = config['log_url_file'] thread_num = config['...
true
ecdb880dc76952711e11079098e3b88ae02ce4d6
jbobko23/Zadania-Jakub-Bobko
/1.7.py
UTF-8
732
3.640625
4
[]
no_license
print('Obliczanie pierwiastkow rownania kwadratowego:'); a = float(input('Podaj a:')); b = float(input('Podaj b:')); c = float(input('Podaj c:')); delta = (b*b)-4*a*c; if (delta < 0): delta = abs(delta); pdelta = pow(delta, 1 / 2.0); print('Delta ujemna: '); print('X_1: (-'+str(b)+'+'+str(pdelta)+'i)...
true
e7da2f1a5909e39c9029742fdd8852c458cdc93a
yybeatall/56kon2
/app56konPro/createTaskDeliveryPro.py
UTF-8
1,223
2.546875
3
[]
no_license
#usr/bin/python #encoding:utf-8 #综合版测试--创建任务并发送 import unittest from time import sleep from method56kon import createTask from method56kon import changeBusiness from method56kon import createDelivery from method import setParam56kon from appium import webdriver class MyTestCase(unittest.TestCase): def setUp(self)...
true
ea9f878b8a7844f8223d8a76c3b659c9f0103f3c
kian-weimer/SeniorDesignLab1
/LCD.py
UTF-8
1,873
2.859375
3
[]
no_license
import adafruit_character_lcd.character_lcd as characterlcd import board import digitalio import ThermometerCode import RPi.GPIO as GPIO class LCD: website_on = False def __init__(self): GPIO.setup(13, GPIO.OUT) #for turning on and off the LCD GPIO.output(13, 0) GPIO....
true
78604c0f4975e80371d6b3f75f52b39bc09af1ce
yfL-fengzifei/my_pytorch_notebook
/my_ssd/model_VGGbase.py
UTF-8
8,357
2.875
3
[]
no_license
import torch import torch.nn as nn import torch.nn.functional as F # from math import sqrt import torchvision # device=torch.device("cuda" if torch.cuda.is_available() else "cpu") """ 基础卷积操作,output=(Dinput+2pad-d(Dkernel-1)-1)/stride + 1 #nn.Conv2d() in_channels: out_channels: kernel_size: stride:默认等于1 padding:默认等于0(...
true
b8dbdb5071bccdb9473b4730461d831684b291cc
01090841589/ATM
/그외/08 4주/타일 붙이기.py
UTF-8
398
2.953125
3
[]
no_license
import sys sys.stdin = open("타일붙이기.txt") def inf_sec(N, num): global total if N == 0: total += num return if N >= 1: inf_sec(N-1, num) if N >= 2: inf_sec(N-2, num*2) if N >= 3: inf_sec(N-3, num) T = int(input()) for tc in range(1, T+1): N = int(input()) ...
true
c8d98a30fb2280ef39573618fc4c4fec67a47130
emleddin/Basic-Scripts
/Basic_Diagrams/Free_Energy_Diagram.py
UTF-8
1,149
2.953125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt # Energy Values as a list into this variable. # The script will assume each value corresponds to a reaction coordinate in sequence energies=[-52.3,-38.5,-40.1,-28.6,-43.4,-39.2,-58.4] outputfile="output.png" ############################ Nothing below this line nee...
true
d54a1ab72291f6430c7d0fc27a3230cf85aa6e85
lrdurrant/music_app
/music_api/spotify_api/spotify_api_helpers.py
UTF-8
1,667
2.828125
3
[]
no_license
from difflib import SequenceMatcher import spotipy from spotipy.oauth2 import SpotifyClientCredentials auth_manager = SpotifyClientCredentials() sp = spotipy.Spotify(auth_manager=auth_manager) ''' helper function to compare similarity of strings as a ratio ''' def similar(a, b): return float(SequenceMatcher(None,...
true
ebb4e9e147e345b562a9b1bb900cdc30582d3686
dvannoy/python-examples
/kafka/sample_kafka_consumer.py
UTF-8
1,480
2.609375
3
[]
no_license
""" Simple kafka-python sample based on example at https://kafka-python.readthedocs.org/en/latest/usage.html and also used example at http://www.makedatauseful.com/kafka-consumer-simple-python-script-and-tips/. * enter topic as parameter when running script (ex. python sample_kafka_consumer.py python-sample-topic-1) ...
true
e0904d5c90332d722ce63016487230c9b69be026
jdeath777/python101
/InClassExercises/animalBehaviour.py
UTF-8
801
4.1875
4
[]
no_license
class Animal: voice = '' behave = '' animal_type = '' def __init__(self, animal_type, voice, behave): self.voice = voice self.behave = behave self.animal_type = animal_type #first way to do this def cat(self): print(f"The {self.animal_type} sounds {self.voice} and ...
true
6a755feb4d93d2fda155525e354d32dc582bfd98
proTao/leetcode
/23. HashTable/706.py
UTF-8
5,707
3.515625
4
[]
no_license
from collections import namedtuple pair = namedtuple("pair", "key value") PERTURB_SHIFT = 5 class MyHashMap: def __init__(self): """ Initialize your data structure here. 类似于python的内建dict,设计本set的策略: 1. 使用开放寻址法解决冲突 2. 使用与python内部一致的二次哈希函数 3. 桶个数每次加倍 4. 负载因子的...
true
31cd97fc7e127b4f2d02e1a627ee1a8ae3a8485d
stasvorosh/pythonintask
/INBa/2015/Serdechnaya_A_M/task_1_25.py
UTF-8
627
3.734375
4
[ "Apache-2.0" ]
permissive
# Задача 1. Вариант 25. # Напишите программу, которая будет сообщать род деятельности и псевдоним под которым скрывается София Шиколоне. # После вывода информации программа должна дожидаться пока пользователь нажмет Enter для выхода. print("Софи Лорен - итальянская певица и актриса. Полное имя - София Виллани Шиколоне...
true
0627a0deb7a49202182f5db47b880a6dc4443859
slownet/remove-islands
/tests.py
UTF-8
4,843
3.421875
3
[]
no_license
import unittest from unittest import TestCase from main import get_neighbours, is_border_node, get_cells_to_remove, remove_cells TEST_MATRIX = [ [1, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 1], [0, 0, 1, 0, 1, 0], [1, 1, 0, 0, 1, 0], [1, 0, 1, 1, 0, 0], [1, 0, 0, 0, 0, 1], ] class TestIsBorderLine(Te...
true
5887bed7f0d7b0551335e3b0c72b1847f05dd3a2
bvsbrk/Algos
/src/Codeforces/educational_round_37/A.py
UTF-8
410
2.53125
3
[]
no_license
if __name__ == '__main__': for _ in range(int(input().strip())): n, k = [int(i) for i in input().strip().split()] arr = [int(i) for i in input().strip().split()] for i in range(len(arr)): arr[i] -= 1 l = [10 ** 10 for i in range(n)] for i in arr: for j...
true
c434222318f11b6eb8ee555459982f4c34a7947d
PabloRO07/SIUNTREF
/Dsp/FMM.py
UTF-8
434
2.53125
3
[]
no_license
import numpy as np from matplotlib import pyplot as plt from punto1 import singenerator as sg import scipy as sc def FMM(x, M): L = len(x) y = np.zeros(L) N = L-M for i in range(N): y[i] = np.sum(x[i:M+i])/M return y [xt,T]=sg.singenerator(44100, 10e3, 0.5, 1, 2) salida=FMM(xt,2) fig...
true
1a1dab58f1579297328e0e065af5431aa116b13c
vipin-s0106/DataStructureAndAlgorithm
/Queue1/Introduction.py
UTF-8
1,104
3.703125
4
[]
no_license
class Node: def __init__(self,data): self.data = data self.next = None class Q: def __init__(self): self.end = None def enque(self,data): new_node = Node(data) if (self.end == None): self.end = new_node else: new_node.next = self.end ...
true
9ac3e3b9e610149df1d6544afe310effcbf02c98
jonaskas/Programa-o
/Fichas de avaliação/Python_fp_2_aval/exercicio5.py
UTF-8
830
4.34375
4
[]
no_license
""" Exercicio 5 """ saldo = float(input('Introduza o valor do seu saldo bancario: ')) #Tabela print('\n\n*************************') print('* 1-Creditar saldo *') print('* *') print('* 2-Debitar saldo *') print('*************************\n\n') operacao = int(input('Escolha se quer Cre...
true
ded31113a20f35a5890280ceb184786ff5c5f5e7
Oladunsi/TicTacToe
/Tic_Tac_Toe_4by4.py
UTF-8
7,070
3.9375
4
[]
no_license
from IPython.display import clear_output import random # this is printing of the tic-tac board def display_board(board): clear_output() print(" | | | ") print(" " + board[13] + " | " + board[14] + " | " +board[15] + " | " +board[16]) print("----------------------------") print...
true
a9ad803a988714ee7707a209ba6c6c16cb4bb26e
Neddon13/precourse_recap
/precourse_recap.py
UTF-8
143
3.828125
4
[]
no_license
user_input = input("What's your favorite colour?") if user_input == ("purple"): print("That's mine too") else: print("Mine is purple")
true
c77b5799f5297a236fcbc140ae32e2f1a1f83206
IlyasDevelopment/Yandex-Algorithm-Training
/Homework_4/A_simple_dict/main.py
UTF-8
253
3.578125
4
[]
no_license
n = int(input()) dict_a, dict_b = {}, {} for i in range(n): first, second = input().split() dict_a[first] = second dict_b[second] = first word = input() if word in dict_a: print(dict_a[word]) elif word in dict_b: print(dict_b[word])
true
3f9a5ee6a4e387595aeacb5d9ee425634c2ac143
whitequark/kicad-boardview
/pcbnew2boardview.py
UTF-8
4,907
2.578125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "0BSD" ]
permissive
#!/usr/bin/env python import sys import re import argparse import pcbnew def skip_module(module, tp=False): refdes = module.Reference() if refdes == "REF**": return True if tp and not refdes.GetText().startswith("TP"): return True if not tp and refdes.GetText().startswith("TP"): ...
true
5450eb594902b56b14b49fbcc285a475bfeb8987
gauranshkumar/mirror-backend
/src/utils.py
UTF-8
7,941
2.578125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @author: gauransh """ import subprocess as sp from moviepy.editor import * import os import requests from lxml.html import fromstring import speech_recognition as sr import os import subprocess import wave from ibm_cloud_sdk_core.authenticators import IAMAuthenticator ...
true
88f252e76294d8746164fc4e1a087e5cc48bc56b
roger6blog/LeetCode
/SourceCode/Python/Problem/00147.Insertion Sort List.py
UTF-8
2,900
4.5625
5
[]
no_license
''' Level: Medium Tag: LinkList Given the head of a singly linked list, sort the list using insertion sort, and return the sorted list's head. The steps of the insertion sort algorithm: Insertion sort iterates, consuming one input element each repetition and growing a sorted output list. At each iteration, insert...
true
6d024e6adc6f6ad9b12ae735d35a8ff353e48865
douglasbruce88/CompletePython
/Section 10/challenge.py
UTF-8
375
3.4375
3
[]
no_license
# append times tables to existing file, first col right justified with open(".\\Section 10\\challenge.txt", 'w') as existing: print("Existing", file=existing) with open(".\\Section 10\\challenge.txt", 'a') as append: for i in range(1, 13): # what does > do exactly? doesnt seem nevessary print(...
true
1d608534bde97662a35a30719debda0222eb6e4e
douglowe/NAEI_WRF_Emission_Tools
/Combined_Python_Scripts_for_anthro_emiss/MODULE_bng_to_latlon_local.py
UTF-8
4,517
3.078125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thur May 23 2019 Local copy of bng_to_latlon, to allow for use of numpa functions. @author: mbessdl2 """ from math import sqrt, pi, sin, cos, tan, atan2 from numba import jit # # see https://github.com/fmalina/bng_latlon for original version # @jit(n...
true
33e94b25a54159d690e33630a2d4ec90c5ac19dc
kumarsunil1388/My-project
/password_gen.py
UTF-8
309
3.546875
4
[]
no_license
import string import random s1 = string.ascii_lowercase s2 = string.ascii_uppercase s3= string.punctuation s4=string.digits plen =int(input("Enter your password len ")) s=[] s.extend(s1) s.extend(s2) s.extend(s3) s.extend(s4) random.shuffle(s) print("Your password is") print("".join(s[0:plen]))
true
301383a50f519aa8146ec5ea57c65d571f5b8902
device999/Machine_Learning
/HelloWorld/DataTypes_I/bshecht/strings.py
UTF-8
1,479
4.6875
5
[]
no_license
#1. Write a Python program to find smallest and largest word in a given string def get_smallest_string(s): a = s.split() smallest = a[0] for element in a: if len(smallest) > len(element): smallest = element return smallest def get_largest_string(s): a = s.split() larges...
true
b1398cfdf236a4d4b8e4d9e368ee457d08d80680
demisto/content
/Packs/FiltersAndTransformers/Scripts/MapPattern/MapPattern.py
UTF-8
21,540
3.015625
3
[ "MIT" ]
permissive
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 import fnmatch import json import re from typing import Any, Dict, Generator, List, Optional, Tuple, Union, Callable DEFAULT_ALGORITHM = 'literal' DEFAULT_PRIORITY = 'first_match' def demisto_get(obj: Any, path: Any) -> Any: ...
true
3d29749ee45dff114ca2091a90d8dd1f3c9c8380
Git008/pystats
/chi2_contingency_test.py
UTF-8
315
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jan 24 20:39:04 2018 @author: Administrator """ from scipy.stats import chi2_contingency def test_chi2_contingency(): #双向表/列联表 table = [[120, 110], [150, 170]] chi2, p, dof, expected = chi2_contingency(table, correction=False) print("P=", p)
true
5b7d74986dcc4b60a0b22c598ac9965c257452c5
chenqim/Python3
/spider/spider_douban.py
UTF-8
837
3.890625
4
[ "MIT" ]
permissive
''''' 第一个示例:简单的网页爬虫 爬取豆瓣首页 同级目录下有有无douban.html文本文件都可以 ''' import urllib.request import codecs #定义一个写入文本的函数 def writetxt(path, content, code): with codecs.open(path, 'a', encoding=code) as f: f.write(content) return path + ' is ok!' #网址 url = "http://www.douban.com/" #请求 request = urllib.request.Requ...
true
b020c13c127491a80701edd42e80b59dce137875
CallumShepherd/ICTPRG-Python
/W3/Quiz Questions/Q4.py
UTF-8
517
3.53125
4
[]
no_license
# Question 4 user = input('Enter username: ') password = input('Enter password: ') if (user == 'bob'): if (password == 'password1234'): print('Access granted!') else: print('Access denied.') elif (user == 'fred'): if (password == 'happyPass122'): print('Access granted!') else: ...
true
42377849d3614d9ad2d3db55c8064efb128db8b2
ramos-ph/roman-numbers
/integer_to_roman.py
UTF-8
982
3.828125
4
[]
no_license
numerals = { 1: { "1": "I", "2": "II", "3": "III", "4": "IV", "5": "V", "6": "VI", "7": "VII", "8": "VIII", "9": "IX", }, 10: { "1": "X", "2": "XX", "3": "XXX", "4": "XL", "5": "L", "6": "LX", "7": "LXX", "8": "LXXX", "9": "XC" }, 100: { ...
true
1f2d8f53ffb0bbae04c0df5052d0e70287f2c76b
fretboardfreak/space
/space.py
UTF-8
1,912
2.5625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python3 # Copyright 2015 Curtis Sand # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
true
e1c1f5ee88c917f1fc260c716f4a96cfa0f32fc9
Borghezane/GeracaoDeTabelas
/Gerador.py
UTF-8
954
2.84375
3
[]
no_license
import itertools as it a = raw_input("Digite o nome do arquivo\n") #input() arq = open( a ,"r+") saida = open("saida.csv", "w") con = [] for line in arq.readlines(): con.append(line.replace("\n","")) table = list(it.product(["V","F"], repeat = len(con) ) ) i = 1 maxC = len(max(con)) #print " "*3, saida.write("...
true
0fdf6ede065a4653fe85b8ae047008a167b5ba4e
hhismans/randname
/main.py
UTF-8
3,171
3.625
4
[]
no_license
""" personal project that make no sense. trying to genereate random name by analysis sequence of letter in a lot of name """ #IMPORT import unicodedata import time import re import random from random import randint #FUNCTION def iterate(iterable): iterator = iter(iterable) item = iterator.next() for next...
true
6eb2c0366e83c05765a3fd1c0bc100229a79db65
JinhaoPlus/LiaoxuefengPython
/ch5_functional_programming/5.1.1-map&reduce.py
UTF-8
1,060
3.59375
4
[]
no_license
from functools import reduce def f(x): return x * x r = map(f, [1, 2, 3, 4, 5, 6, 7, 8, 9]) print(list(r)) def add(x, y): return x + y print(reduce(add, list(range(1, 101)))) def str2int(s): def fn(x, y): return x * 10 + y def char2num(s): return {'0': 0, '1': 1, '2': 2, '3':...
true
57a5925df97b9ef94dc73701d5c4c60d206b8e2b
j-l5662/MazeSolver
/main.py
UTF-8
1,121
3.125
3
[]
no_license
from maze import Maze, drawMaze, solveMaze import argparse import dijkstra as d import astar as a from pen import Pen import turtle import io from PIL import Image def saveScreen(imageName): ts = turtle.getscreen() ps = ts.getcanvas().postscript(colormode='color') out = io.BytesIO() img = Image.open(...
true
d41e0877d97286309cf7af83cf4d2f803fe29717
fhoneck/farmsystems
/runstream.py
UTF-8
1,635
3
3
[]
no_license
import streamlit as st import pandas as pd st.set_page_config(layout="wide") sheet = pd.read_csv("streamsheet.csv") col1, col2 = st.beta_columns(2) a = col1.number_input(label = "First Year",value = 1950,min_value = 1871,max_value = 2020) b = col2.number_input(label = "Last Year",value = 1980,min_value = 1871,max_valu...
true
53612b7d9c3b0da322070ae1bc921661c9701b57
BorodiMadalin/phyton3
/row_song.py
UTF-8
160
3.59375
4
[]
no_license
def repeat_stuff(stuff,num_repeats=10): return stuff * num_repeats lyrics=(repeat_stuff("Row ",3)) + "Your Boat. " song = repeat_stuff(lyrics) print(song)
true
de7e663b839656de9e5e1807b3af8952f499115e
tmu-nlp/100knock2020
/kiyuna/chapter04/knock33.py
UTF-8
967
3.265625
3
[]
no_license
r"""knock33.py 33. 「AのB」 2つの名詞が「の」で連結されている名詞句を抽出せよ. [URL] https://nlp100.github.io/ja/ch04.html#33-aのb [Usage] python knock33.py """ import os import sys from typing import Dict, List from knock30 import mecab_into_sentences sys.path.append(os.path.join(os.path.dirname(__file__), "../../")) from kiyuna.utils.messag...
true
4c28bed5642e7be7789fe804e1e0c145cca27f94
ZPeng-Learn/6.438
/ps6/computational/gibbs_comb_sampler.py
UTF-8
5,771
2.71875
3
[]
no_license
import argparse import numpy as np from collections import OrderedDict from utils import OrderedSet, visualize, plot_mixing from bp import belief_propagation def sample(nodes, node_neighbors, edge_potential, traversal_order): ''' nodes: list of (i, j) nodes nodes: dictionary node (i, j) -> neighbors of no...
true
a2a47ab4b127b9bb7e959c73edb7e95e55ac9814
randolphfrank/MarchMadnessPython
/textBlobTrain.py
UTF-8
1,082
2.765625
3
[]
no_license
from textblob.classifiers import NaiveBayesClassifier import pickle neg_tweets = open('../negative_tweets.txt', 'r').read() pos_tweets = open('../positive_tweets.txt', 'r').read() train_data = [] neg_tweets = neg_tweets.split(', \"') pos_tweets = pos_tweets.split(', \"') max_add = 1000 count = 0 for i in neg_twee...
true
46bc13599be27155434c1c0565dea59ae53ca667
ShreyaGupta12/Codechef-Long-Challenge-Feb-2021
/Frog Sort.py
UTF-8
545
2.671875
3
[]
no_license
from math import ceil for _ in range(int(input())): n=int(input()) w=list(map(int,input().split())) s=list(map(int,input().split())) a=list(range(n)) b=sorted(w) c=0 if b==w : print(0) continue if n==2: if w[0]==1: print(0) else: pr...
true
ebbbfcd0f961fd16f3776c6c2937c4ec46c6e353
ignatovasashka/Programming-Basics-with-Python
/03.py
UTF-8
843
3.390625
3
[]
no_license
days = int(input()) roomType = input() mark = input() moneyPerRoom = 0.0 if roomType == "room for one person": moneyPerRoom = 18.0 elif roomType == "apartment": moneyPerRoom = 25.0 if days <= 10: moneyPerRoom = 0.7*moneyPerRoom elif days > 10 and days <= 15: moneyPerRoom = 0...
true
ad01dabbc2e4c046c7501f6d9cc9253e613f70a3
rjassef/sims_maf
/python/lsst/sims/maf/plots/perceptual_rainbow.py
UTF-8
757
2.625
3
[]
no_license
from matplotlib.colors import LinearSegmentedColormap def makePRCmap(): colors = [[135, 59, 97], [143, 64, 127], [143, 72, 157], [135, 85, 185], [121, 102, 207], [103, 123, 220], [84, 146, 223], [69, 170, 215], ...
true
39e89a6eeec9d7c9389c173b84e70ef1f762b29e
SAMashiyane/hashlookup.py
/hashlookup.py
UTF-8
1,402
2.625
3
[]
no_license
#!/usr/bin/python import json import urllib print"***************************************************" print"* Priv8 online Hashlist Cracker *" print"* Coded by SAM355 *" print"* ashiyane.org *" print"*****...
true
156575d318887fc5a2e3aeff088b53b100e7d39a
PriyankaKhire/ProgrammingPracticePython
/Remove Linked List Elements.py
UTF-8
940
3.46875
3
[]
no_license
# https://leetcode.com/problems/remove-linked-list-elements/ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def removeVal(self, prev, node): if(prev == node): r...
true
1d90b11a311421367ad844adfb0e19982d6f8fad
Wendy-Omondi/alx-higher_level_programming
/0x07-python-test_driven_development/5-text_indentation.py
UTF-8
685
4.09375
4
[]
no_license
#!/usr/bin/python3 """prints a text with 2 new lines after each of these characters: ., ? and : """ def text_indentation(text): """prints indented text. """ if type(text) != str: raise TypeError("text must be a string") flag = 0 new_string = "" for i in text: if flag == 1: ...
true
7c28cc34a020656a0a4112233fe90e51d1d6a814
tylerharter/simulator
/SCanalyzer/service/yelp.py
UTF-8
2,019
2.84375
3
[ "Apache-2.0" ]
permissive
import requests import pandas as pd import geopandas as gpd from pyproj import Transformer def get_search_point(borders): max_x, min_x, max_y, min_y = borders # TODO: this might miss some locations, use diagonal radius = int(max(max_x - min_x, max_y - min_y) / 2) centroid_x = (max_x + min_x) / 2 c...
true
df8282155cdaff0446293ac3b17f1553a1ba4ae3
andribas404/tom-calculator
/tests/integration/test_order_get.py
UTF-8
2,204
2.546875
3
[ "MIT" ]
permissive
"""Test /order/{item_id} endpoint.""" import datetime import decimal import uuid import pytest from sqlalchemy.future import select from tom_calculator.models import Discount, Order, Tax @pytest.mark.asyncio class TestOrderGet: """Test order get.""" @pytest.fixture(autouse=True) async def _setup(self, ap...
true
2893fe711fba4a36e4619853dda707e64c6399fa
pyk/sanic-instrumentation-guide
/simulate_request.py
UTF-8
540
2.78125
3
[]
no_license
""" This script is to simulate a user requests. Run: python simlate_request.py """ import random import requests def main(): # Generate a random number of requests while True: n = random.randint(1, 10) for _ in range(n): requests.get("http://localhost:8080") m = rand...
true
325363025f9abdc450dca61fe6d7700684955ef0
Freshman23/My_study_project
/python_basics/lesson_2/task_2.py
UTF-8
303
3.53125
4
[]
no_license
my_list = (input('Введите через запятую элементы списка:\n')).split(',') end = (len(my_list) - 2, len(my_list) - 1)[len(my_list) % 2 == 0] for ind, el in enumerate(my_list[:end:2]): my_list[2*ind], my_list[2*ind+1] = my_list[2*ind+1], my_list[2*ind] print(my_list)
true
1bc0031510add098424fd3a602ed2c68445f64c6
nicolasilvac/MCOC-NivelacionPython
/27082109/000619.py
UTF-8
1,325
3.828125
4
[]
no_license
import numpy as np a = np.zeros(3) #crea una matriz de 1 fila y 3 columnas print a #[ 0. 0. 0.] print type(a[0]) #entrega el tipo de elemento numero 0 del array a #<type 'numpy.float64'> z = np.zeros(10) print z #[ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] z.shape = (10, 1) #cambia la forma del array p...
true
845d6fd36995fd049f9f961790999ab421712b14
choidslab/teamlab-python-basic
/chapter12/lab_9/ex_pickle1.py
UTF-8
203
2.90625
3
[]
no_license
import pickle with open('list.pickle', 'wb') as pf: test = [1, 2, 3, 4, 5] pickle.dump(test, pf) with open('list.pickle', 'rb') as pf: test_pickle = pickle.load(pf) print(test_pickle)
true
247a3b875b4b05e840583bbe8ab5ca6a803deb66
pungkiapriw/face
/private/python/program.py
UTF-8
7,357
2.78125
3
[ "MIT" ]
permissive
import face_recognition import cv2 import numpy as np import random import mysql.connector import smtplib from datetime import datetime import time import re mydb = mysql.connector.connect( host="localhost", user="root", password="", database="face" ) currenttime = time.time() mycursor = mydb.cursor() # query="...
true
cfd6a0d0d59d31e5171afcfd4e272e1aa8828804
ErykUrban/pp1
/03-FileHandling/After class/2.23.py
UTF-8
220
3.296875
3
[]
no_license
import re a='' txt= open('land.txt', 'r') for i in txt: a+=i pattern = re.compile(r'\d') matches = pattern.findall(a) suma=0 for match in matches: suma+=int(match) print(f'suma cyfr wystepujaca w pliku: {suma}')
true
789cabb6ecdf8b67e5ed46f4889540f95f0e02c4
amitji/Market-Movement-Prediction-Machine-Learning
/StockPredictionHelper.py
UTF-8
14,746
2.578125
3
[]
no_license
import quandl import pandas as pd import nsepy as nse from datetime import date, timedelta import numpy as np import glob class StockPredictionHelper: # def __init__(self): # self.result_df = [] def getData(self, ticker, real_time_flag): if real_time_flag ==...
true
a13e8c056a95d21c6806c33e2d16bddf24c74469
lian2377/ProjectScanner
/ScanProjectStructure.py
UTF-8
3,932
2.53125
3
[]
no_license
import os, json def scan(projectPath, fileOutput = False, suffixList = None): rootDir = str(projectPath).replace("\\", os.sep) rootDir = rootDir.replace("/", os.sep) projectName = rootDir.rstrip(os.sep).split(os.sep)[-1] getSuffix = lambda s:s.split('.')[-1] fileList = [] for (dirpath, dirnames...
true
8733f77f41796be0585fc1395f8a95c5b758dbb2
nlbrown2/todo-cli
/utility.py
UTF-8
919
3.640625
4
[]
no_license
""" Utility module for common helper functions """ ITEM_KEY = "todo_items" #used to store where items are stored within objects def read_word(inputs, prompt): """ reads a word from inputs or if inputs is empty, provides prompt to the user. Modifies inputs to hold the whitespace separated user input from pr...
true
6ae9fd1c2e7b9f54cc57e6af291e4fb4d3350296
Denisalik/Innoroom
/modules/queues/auxiliary.py
UTF-8
2,632
2.703125
3
[]
no_license
from misc import queries async def get_users_in_queue_ordered(title): """ Return users joined to queue ordered by surname and name. :param title: :return: """ users = await queries.get_users_in_queue(title) sorted_users = sorted(users, key=lambda x: (x['surname'], x['name'])) return s...
true
8b6cb96f285504201879ea6196156ee08286c76e
aqpan/aq-code
/debtCalc3.py
UTF-8
1,357
3.53125
4
[]
no_license
# debtCalc3.py # Anqi Pan # ECS32A Fall 2018 # #part3:handle two exceptions #debt_amount or debt_amountf: total debt debt_amount= input('Enter amount of debt:') #interest or interestf: yearly interest rate interest= input('Enter % interest rate:') #payment or paymentf: monthly payment payment = input('Enter...
true
d7e21831364d463235e2275a75d49b95b9ac0e06
lsaint/topsy
/tests/topsy/test_permission_checker.py
UTF-8
1,724
2.703125
3
[]
no_license
"""Test permission checker class, which is used to get user permissions on board.""" import unittest import accounts.adapters.memory_storage as accounts_memory_storage import notes.adapters.memory_storage as notes_memory_storage from accounts.core.entities import User from notes.core.entities import Board from topsy....
true
1efcfcea3092471359f20ca02761b256192e19cc
alessandraburckhalter/Bootcamp-Exercises
/dictionary/02-nested-dictionaries.py
UTF-8
1,348
4.375
4
[]
no_license
# Using the dictionary from the Nested dictionaries exercise below, write a function countFriends() that accepts a dictionary as an argument and returns a new dictionary that includes a new key friends_count def countFriends(a_dic): count = 0 for friends in a_dic['friends']: count += 1 a_dic['friends_count'...
true
a4c14545e73035c1c04f38d78440abc998fa6926
L-Oshowa/boids_simulation
/main.py
UTF-8
1,052
2.75
3
[]
no_license
import numpy as np import asyncio from Interface_Graphique import run_tk, MainFrame async def await_inf_loop(window): """ Tell __main__ to wait for the tk loop to finish. The infinite loop will end when an error occurs => the window is closed. Parameters: window: Entire tk_window that will b...
true
87be2f978ca1ff10e351d38f259868670f54b7bf
nandinigarg19/Library-Using-Django
/catalog/models.py
UTF-8
4,637
2.796875
3
[]
no_license
from django.db import models from django.urls import reverse from django.utils.html import format_html import uuid from datetime import date class Genre(models.Model): name = models.CharField(max_length=200, help_text="Enter a book genre (e.g. Science Fiction)") def __str__(self): return self.name #...
true
079fe3f4ba41cbb8f16e670d7feb3f8fdf7f8531
CyborgVillager/ja-django-git
/basic_craiglist_scrap/craiglist_scrap_info.py
UTF-8
1,491
3
3
[]
no_license
from bs4 import BeautifulSoup import requests import pandas as pd import lxml # Scraping for web server rack base_url = "https://chicago.craigslist.org/search/sss?query=computer+server&sort=rel" # Send get http request page = requests.get(base_url) # Verify we had a successful get request call if page.status_code ==...
true
cff7db115868ab774186bef7a0234a62e359e11a
laowantong/paroxython
/tests/test_filter_programs_with_import.py
UTF-8
7,286
2.625
3
[ "MIT" ]
permissive
import json from pathlib import Path import pytest import context from paroxython.filter_programs import ProgramFilter db = json.loads(Path("examples/mini/programs_db.json").read_text()) def test_init(): dbf = ProgramFilter(db) print(dbf.selected_programs) assert dbf.selected_programs == { "as...
true
cf74f89e9b9c2c31ce9e5a5ee3c9074e67c8a542
Aasthaengg/IBMdataset
/Python_codes/p02847/s718220966.py
UTF-8
101
3.421875
3
[]
no_license
s = input() week = ['SUN','MON','TUE','WED','THU','FRI','SAT'] s = week.index(s) s = -s print(s + 7)
true
42d0c9d6fa8b4697f2ad13c9cb16fc7a5a9cba2b
ravengg11/Labb5
/7.py
UTF-8
255
3.328125
3
[]
no_license
import math X = float(input("Первое число = ")) N = int(input("Второе число = ")) T = 1.0 S = 1.0 Fa = 1.0 for i in range(1,2*N): Fa = Fa*i S = S*X if i//2 == 0: S = S*(-1) T = T+S/Fa print (T)
true
9332f911b41e40769962486e18eca5dcbceab532
Kori3a/M-PT1-38-21
/Tasks/Olga Tuchinskaya/HW7/characters.py
UTF-8
784
4.15625
4
[]
no_license
from random import randint class Creature: def __init__(self, health, attack, level): self.health = health self.attack = attack self.level = level class Hero(Creature): def __init__(self): Creature.__init__(self, randint(170, 280), randint(20, 40), 23) class Monster(Creatu...
true
c27cc49c376013d5e8c78123e61f7b73b7fa7c82
vigneshwarsripad/NetworkAnalysis
/Graph/Python/remove_nodes_from.py
UTF-8
142
2.828125
3
[]
no_license
G = nx.path_graph(3) # or DiGraph, MultiGraph, MultiDiGraph, etc e = list(G.nodes) e [0, 1, 2] G.remove_nodes_from(e) list(G.nodes) []
true
420d5bbbd54d2d08f76d4cde450ce4e79f5f2988
LiuYPersonal/Face-recognition
/PCA.py
UTF-8
2,452
2.875
3
[]
no_license
import cv2 import numpy as np #Vectorize def vectorize(img): w,h=img.shape tmp=img.reshape(w*h) img_mean=np.mean(tmp) tmp=np.subtract(tmp,img_mean) tmp=tmp/np.linalg.norm(tmp) return tmp #load image def load_img(filepath,N_class,N_image): X=[] for i in range(0,N_class): for j in...
true
c80f9653613b78a0c519ae516a427af2855a0c17
gosebastian12/Set_Piece_Strategy
/src/visualizations/pitch_plotting.py
UTF-8
18,023
3.328125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tues Jan 19 09:40:01 CST 2020 @author: Sebastian E. Gonzalez Script Purpose: This script contains a collection of functions that are used for visualizations created that involve some sort of overlay on a soccer field which helps put the displayed data in i...
true
e8120ba426935cbde08fbb277da22191c1415507
abdallahash/students_data
/students.py
UTF-8
4,755
3.828125
4
[]
no_license
#First we declare the class #### class student: #number of students is a class variable used to count the number of students in the class. number_of_students = 0 #then we declare the method in the class which is __init__ def __init__(self, name, Id, grade): self.name = name ...
true
8d90d293c6b19b227facd413a5049b0727c3c09a
scan3ls/holbertonschool-web_back_end
/0x0D-NoSQL/9-insert_school.py
UTF-8
276
2.703125
3
[]
no_license
#!/usr/bin/env python3 """ 9-insert_school docstring """ def insert_school(mongo_collection, **kwargs): """ Inerts new document in collections """ mongo_collection.insert_one(kwargs) new_document = mongo_collection.find(kwargs) return new_document[0]['_id']
true
e021650ba7cb15eb0f6932c99c7132011a6f49b0
sam4410/gcp-course
/section3/compute-engine/factors.py
UTF-8
230
3.78125
4
[ "MIT" ]
permissive
number = int(input("Please Enter any Number: ")) value = 1 print("Factors of a Given Number {0} are:".format(number)) while (value <= number): if(number % value == 0): print("{0}".format(value)) value = value + 1
true
f09298cb0090be30f8d0eae106f01f02c3004758
MopkoBb/pythonAlgorithms
/numberof1.py
UTF-8
1,455
2.90625
3
[]
no_license
class Solution: def NumberOf1(self, n): # real = [] # num = 0 # if n == 0: # return 0 # if n > 0: # binary = list(bin(n))[2:] # else: # binary = list(bin(n))[3:] # for a in binary: # if a == '1': # ...
true
11f8d6202e2a76133d02f70ebafa4574bf001bc6
aditinayak01/Artificial-Intelligence
/Spam Filter/q2_classifier.py
UTF-8
4,141
3.203125
3
[]
no_license
import os,math import csv import argparse #Naive Bayes Implementation for Spam-Ham def naiveBayes(test_file,train_file,output_file): groundTruth = {} spamDict = {} hamDict = {} for line in train_file: line_content = line[0].split(" ") groundTruth[line_content[0]] = line_content[1] ...
true
e8c5ac150ad6f310102cead8fe2e87a0233efcab
shibuiwilliam/mlweb
/web.py
UTF-8
2,894
2.6875
3
[]
no_license
import numpy as np def insert_csv(data): import csv import uuid tuid = str(uuid.uuid1()) with open("./logs/"+tuid+".csv", "a") as f: writer = csv.writer(f, lineterminator='\n') writer.writerow(["sepalLength","sepalWidth","petalLength","petalWidth"]) writer.writerow(data) ret...
true
599a4a43208a81eff37c94cf026ca67d29bfe28b
nralsaeed/Snowfall_Scavenging_MCS
/Snowfall_growth_modules.py
UTF-8
42,671
2.921875
3
[ "MIT" ]
permissive
##Binning modules used for the MCS profile data: import numpy as np import pandas as pd from scipy.stats import binned_statistic_2d as bin2d from scipy.interpolate import pchip import statsmodels.api as sm from planetThermo import pco2 from planetThermo import tco2 def closest_nonzero(lst, start_index): nonzeros...
true
ae0fe95a834ff25df45e0723c01267dbfb50d638
thonyeh/Linear-Programming
/simplex.py
UTF-8
7,559
3.125
3
[]
no_license
from math import * from time import sleep from numpy import * from Tkinter import * print 'A CONTINUACION INGRESE LOS DATOS DEL PROBLEMA A MINIMIZAR.' print '' def vuelva(): print 'INGRESE LOS DATOS DE OTRO PROBLEMA:' print '' main() def main(): A=[] b=[] cont=0 m=input('Ingrese el numero d...
true
5e05f613dcbfd4e3a6045db74ff1d2bb80a2f76d
itischrisd/PythonforSecurity
/Python Fundamentals/ex2a_math_operation.py
UTF-8
39
2.734375
3
[]
no_license
num1 = 4 num2 = 12 print(num1 * num2)
true
b682d96118b73ba88500d556b53cc39b2e472c01
MaT1g3R/csc148
/misc/remove_nippon.py
UTF-8
7,329
2.796875
3
[]
no_license
set1 = """えいが 映画 movie おんがく 音楽 music ざっし 雑誌 magazine スポーツ sports デート date(romantic, not calendar) テニス tennis テレビ TV アイスクリーム icecream あさごはん 朝ご飯 breakfast おさけ お酒 sake;alcohol おちゃ お茶 green tea コーヒー coffee ばんごはん 晩ご飯 dinner ハンバーガー hamburger ひるごはん 昼ご飯 lunch みず 水 water いえ 家 hom...
true
8d1b984c798bb159003d9f41d9c4d472bb1a963f
cvincentc/CSV_to_Excel
/code.py
UTF-8
3,220
2.828125
3
[]
no_license
import xlrd import csv import sys import getopt import pandas as pd from datetime import datetime from openpyxl.workbook import Workbook from openpyxl.styles import Alignment, Border, Side, Font from openpyxl import load_workbook import xlsxwriter import openpyxl #Styling for excel file def format_fn(fi...
true
cac49a9a2cb753bb81c45ac1d2d887b1f48dd9bb
fullern1/previouscode
/Python/CMSC437 - GUI - Homework/hw6.py
UTF-8
625
3.265625
3
[]
no_license
from Tkinter import * import time def create_window(): window = Toplevel(root) w, h = root.winfo_screenwidth(), root.winfo_screenheight() canvas = Canvas(window,width=w,height=h) canvas.create_text(w/2,h/2,text="this will close after 3 seconds",font="Arial") canvas.pack() window.overrideredirec...
true
0474629e66ad833804aadec5cf39dd14e35b7e36
sh-hhh/HogwartsHomework
/homework0704/page/addresslist_page.py
UTF-8
1,517
2.546875
3
[]
no_license
from appium.webdriver.common.mobileby import MobileBy from time import sleep from homework0704.page.base_page import BasePage from homework0704.page.add_member_menu_page import AddMemberMenuPage from homework0704.page.contact_detail_info_page import ContactDetailInfoPage # 通讯录页面 class AddressListPage(BasePage): _...
true
ce725c0eb9d7008ee64cd2b49ed0b074798e8b80
sruthy-github/sruthy-python-files
/data structure/exception handling/try except.py
UTF-8
126
3.515625
4
[]
no_license
a=int(input("Enter 1st number")) b=int(input("Enter 2nd number")) try: print(a/b) except: print("exception occured")
true