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
669a7f37c472ee37b869e4e4aeff918967b9b9a7
mollyincali/whatsinyourcart
/src/graphing.py
UTF-8
5,752
2.96875
3
[]
no_license
''' file for graph codes used throughout project ''' import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt sns.set() def color_theme(): ''' set up color theme for visuals ''' color1 = '#F1D78C' color2 = '#F6A811' color3 = '#F46708' color4 = '#EF727F' color...
true
14245468f7edaa6458853cc6195b4daa280a8f07
feiline/TheWitchat_conversationalRPG
/PythonScripts/ScrapeShortCombatTactics.py
UTF-8
917
2.84375
3
[]
no_license
from bs4 import BeautifulSoup from requests import get import re enemies = ["Ghoul", "Dog", "Drowner", "Nekker", "Wraith", "Water hag", "Griffin_(creature)", "Noonwraith", "nightwraith"] tactics = "" for x in enemies: url = 'https://witcher.fandom.com/wiki/' + x response = get(url) html_soup = BeautifulSou...
true
4c44a88b4bd683b3e96646e48ef7eb396adde7c1
M0use7/python
/python基础语法/day15-类和对象/02-内置类属性.py
UTF-8
1,745
4
4
[]
no_license
"""__author__ = 余婷""" """ 内置类属性就是魔法属性 魔法属性:属性名的前面和后面都有两个下划线 魔法方法:方法的前后都有两个下划线 """ import datetime class Person: """人类""" # 类的字段 number = 61 def __init__(self, name1, age1, height1): # 对象的属性 self.name = name1 self.age = age1 self.height = height1 # 对象方法 def run...
true
d20631f119111e6056d2f6176f24fdd5bd0ed524
Has3ong/X3DViewer
/toWeb3D/docs/PythonSAI/SFVec4d.py
UTF-8
1,233
2.875
3
[]
no_license
from . import * # SFVec4d defines an abstract node interface. # SFVec4d is a 4-tuple set of double-precision floating-point values, specifying a 3D homogeneous vector. class CSFVec4d(CX3DField): m_values = [0.0, 0.0, 0.0, 0.0] def __init__(self): self.m_values = np.double([0.0, 0.0, 0.0, 0.0]) #...
true
5b15325235f3f1a70b9f8899c42e919c738116a4
mapyJJJ/LearnSpiderDemo
/douban_Top250/douban_Top250.py
UTF-8
1,769
2.875
3
[]
no_license
#!/usr/bin/python3 # # 爬取Top250 存储到Mongodb中 # import urllib.request import pymongo from lxml import etree url='https://movie.douban.com/top250?start=0&filter=' headers={'User-Agent':'Mozilla/4.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36'} data={} def save_MongoDB(da...
true
f2e9e65f78af281a95a352928376d160199b56a7
tmacmilan/dgl
/python/dgl/model_zoo/chem/mpnn.py
UTF-8
5,077
2.875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # coding: utf-8 # pylint: disable=C0103, C0111, E1101, W0612 """Implementation of MPNN model.""" import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Parameter import dgl.function as fn import dgl.nn.pytorch as dgl_nn class NNConvLayer(nn.Module): """ ...
true
c24c7fd38a80dc528976410ffc046adc03f445cb
ToraNova/library
/guides/python/pysample/requests/request_auth.py
UTF-8
1,071
2.765625
3
[ "MIT" ]
permissive
#!/usr/bin/python3 #allows HTTP requests import requests #basic authentication from the same module from requests.auth import HTTPBasicAuth #this module disable printing of keystrokes import getpass #actual script usage code if __name__ == "__main__": #target domain setup host_domain_name = "mmls.mmu.edu.my"...
true
a5b3f08392551ee95066436d48e2113ad074e311
bdpaul99/HW2
/SI364-HW2.py
UTF-8
3,906
3.796875
4
[]
no_license
## HW 2 ## SI 364 F17 ## Due: September 24, 2017 ## 500 points ##### ## [PROBLEM 1] ## Edit the following Flask application code so that if you run the application locally and got to the URL http://localhost:5000/question, you see a form that asks you to enter your favorite number. Once you enter a number and submi...
true
21d1d38713fec3e21ca9082525a90da358205923
brock7/scripts
/3rdparty/telnetbrute.py
UTF-8
1,801
2.671875
3
[]
no_license
#!usr/bin/python #Telnet Brute Forcer #http://www.darkc0de.com #d3hydr8[at]gmail[dot]com import threading, time, random, sys, telnetlib from copy import copy if len(sys.argv) !=4: print "Usage: ./telnetbrute.py <server> <userlist> <wordlist>" sys.exit(1) try: users = open(sys.argv[2], "r").readlines() except(IO...
true
17e2c92d9dbd2a9f5c03ffbbddd4bac1f49ad259
cag/dms-calendar-viewer
/server.py
UTF-8
2,321
2.765625
3
[ "MIT" ]
permissive
#!/bin/env python import re import requests from collections import OrderedDict, namedtuple from datetime import datetime from bs4 import BeautifulSoup from flask import Flask, jsonify, render_template app = Flask(__name__) EVENT_LINK_HREF_RE = re.compile(r'^/events/view/(?P<id>\d+)$') APP_URL = 'https://calendar.dall...
true
ac86cb791b4cec7b5d5c79b439a2e31b8c0a598a
Iamsdt/60daysofudacity
/day41/Code.py
UTF-8
1,584
2.515625
3
[]
no_license
import os from PIL import Image import torch train_dir = "" # check train first trains = os.listdir(train_dir) for i in trains: j = os.listdir(train_dir + "/" + i) for file in j: path = train_dir + "/" + i + file try: array = Image.open(path) except: ...
true
542688ba190d1d8ec2bdf91c6a3182e58a0b3c6f
kmieluu/PandS-Problem-Set-2019
/if-statements/PS2019Q10.py
UTF-8
967
3.90625
4
[]
no_license
# Agata Chmielowiec, Navan 2019 # Write a function that displays in range [0,4] functions x, x^2 and 2^x # reference: https://web.microsoftstream.com/video/f0788c1c-c7bd-4347-98ac-477186938ed7 # reference2: https://matplotlib.org/tutorials/introductory/pyplot.html import matplotlib.pyplot as pl import numpy as np #De...
true
cd0e86b4aad148f2894b7c2d94a59a4cc9d3640f
youssef-abbih/python_projects
/gui_password_generator/main.py
UTF-8
4,560
3.03125
3
[]
no_license
from tkinter import * from PIL import ImageTk, Image from tkinter import messagebox from random import randint, choice, shuffle import pyperclip import json # ---------------------------- PASSWORD GENERATOR ---------------------------- # letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', ...
true
dfa1ca49f3944b0d490e2a07bcbca92dacf582c8
stevearc/dql
/dql/expressions/visitor.py
UTF-8
2,662
3.5625
4
[ "MIT" ]
permissive
""" Visitor classes for traversing expressions """ import re FIELD_RE = re.compile(r"[\w\-]+(?![^\[]*\])", re.U) class Visitor(object): """ Visitor that replaces field names and values with encoded versions Parameters ---------- reserved_words : set, optional Set of (uppercase) words th...
true
0cfd51e47344f0ef742982ad0445672aa79c9546
VLD62/PythonFundamentals
/00.EXAMS/24March2019/Problem 1. Build a building.py
UTF-8
488
3.765625
4
[]
no_license
if __name__ == "__main__": budget = float(input()) m = float(input()) n = int(input()) for i in range (0,n): current_money = float(input()) print(f'Investor {i+1} gave us {current_money:.2f}.') m += current_money if m >= budget: print(f'We will manage to bui...
true
a9b4657ebbe84b42283c61e52b31d314d9641cf0
taohyson/newbie
/python/runoob/Python break 语句.py
UTF-8
201
3.046875
3
[]
no_license
#!D:\Python\Python27 #!D:\Python\Python36 # -*- coding: UTF-8 -*- for num in range(10): if 4 == num: break else: print(num) num = 11 while num < 20: if 13 == num: break print(num) num += 1
true
b1554172fe88a74ba695684312c5a62384862afc
funggor123/stock_price_prediction
/prediction/model/ae_model/vae.py
UTF-8
1,708
2.6875
3
[ "MIT" ]
permissive
from __future__ import print_function import torch import torch.utils.data from torch import nn, optim from torch.nn import functional as F # VAE reference code # ref: https://github.com/pytorch/examples/blob/master/vae/main.py # ref: https://shenxiaohai.me/2018/10/20/pytorch-tutorial-advanced-02/ # Tutorial of VAE ...
true
fdb83376f6c0f9f9d9720e9c443a2cd025b5e227
simonw/django-feedstream
/feedstream/models.py
UTF-8
3,113
2.546875
3
[]
no_license
from django.db import models from django.utils import simplejson from django.template import Template, Context import feedparser, time, datetime ISO_KEY = '__iso_datetime__' FORMAT_STRING = '%Y-%m-%dT%H:%M:%S' class FeedType(models.Model): name = models.CharField(max_length = 100, unique = True) template = mo...
true
b56df4bf0bb7a099f8752246be111c725df8dea8
thenav56/AXFR2Route53
/AXFR2Route53.py
UTF-8
8,336
2.640625
3
[ "MIT" ]
permissive
#!/usr/bin/env python from __future__ import print_function import argparse ''' This script allows transfer of DNS from an upstream DNS server via AXFR as defined in RFC 5936 and submits entries to Route 53 via boto3. It uses the UPSERT action to either create a record or update the existing one. You can use it to do ...
true
864397f463bf23889d3283f4e398b0f626cecc2c
mariatvspt/Channel470News
/documents/parse_news.py
UTF-8
1,149
2.546875
3
[]
no_license
from newspaper import Article import newspaper import json import os urls = {'yahoo_trump': 'https://news.search.yahoo.com/search?p=trump&fr=uh3_news_vert_gs&fr2=p%3Anews%2Cm%3Asb'} for name, url in urls.items(): cnn_paper = newspaper.build(url, memoize_articles=False) all_articles = [] i = cnn_paper.size...
true
23e8e55d93bf64f974446a4df23a4587772d1cd3
coderjourney/04-python-repl-strings-numbers
/planets_v2.py
UTF-8
67
2.859375
3
[]
no_license
1 + 1 5 / 4 print("There are %s planets, plus %s" % (8, "pluto"))
true
45f72636d49df1c43aa311cb5892b20109487374
almoratalla/mimo-python-projects
/using_lists/team_size_checker.py
UTF-8
325
3.84375
4
[ "MIT" ]
permissive
team_1 = ["Mia", "Lisa", "Liam"] team_2 = ["James", "Ty", "Ava"] size_1 = len(team_1) size_2 = len(team_2) if size_1 != size_2: print("Teams must have the same size!") else: print("Game on!") if size_1 == 3: print("Rounds left: 3") elif size_1 == 2: print("Rounds left: 2") else: print("Final rou...
true
5a1649c98d41a6d461ba82ae990dc86a7ce8d441
heshuanianlu/supergame
/onitama/connect/__init__.py
UTF-8
6,295
2.59375
3
[]
no_license
from onitama.connect.room import Room from users.models import User def _print(fn): print(fn.__name__) return fn class Server(object): def __init__(self): self.client = {} self.hall = [] self.room = {} self.ready = [] def get_message(self, message: str, self_id): ...
true
58f30367d10050495d371ad9ff76b96b9042d9b4
fgolubic/DigitalSeal
/DigitalSignature.py
UTF-8
4,682
2.875
3
[]
no_license
''' Created on May 7, 2019 @author: Filip ''' from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_v1_5 from Crypto.Hash import SHA3_224, SHA3_256, SHA3_384, SHA3_512, SHA224, SHA256, SHA384, SHA512 class DigitalSignature: def __init__(self, signatureFile, hashAlgorithm, keyLength...
true
e0c9a9317209f3dd058b4d17d84c17a030d881c4
dspice2003/sandbox
/testquestion.py
UTF-8
144
3.046875
3
[]
no_license
name = input("Enter word:") name1 = input("Enter word:") name2 = input("Enter word:") print(" " + name + " " + name1 + " " + name2 + "")
true
d173adfbf3264bb700f431d145d14db5a19925c9
PervasiveWellbeingTech/Subliminal-Room
/vision/demos/design-clinic/demo4.py
UTF-8
1,460
2.53125
3
[]
no_license
# Screen brightness + Hue lights import libs from phue import Bridge import time import sys import oscilliate_lights as osc import reset import screen_brightness as screen bridge_ip = '192.168.1.2' b = Bridge(bridge_ip) lights = b.get_light_objects() up = True delay_mode = 'BREATHING' osc.OPTIONS = { 'r': 255, 'g': 25...
true
313ef2eb0c0ddc716e2ecd6d9897b988fcc17053
vickiniu/college-checklist
/student.py
UTF-8
2,061
2.53125
3
[]
no_license
from porc import Client from income import * from scholarship import * from fedaid import * from finaid import * class student: def __init__(self, race, GPA, SAT, gender, income, residency, household_size, other, ZIP): self.__race = race if(GPA): self.__GPA = float(GPA) else: self.__GPA = None if(SAT): ...
true
ee55b0c762501e52aa927a10e90edcb789d58cdc
FaboBence/HackMarathon_MechaHU_3
/HackMarathon3/image_processing.py
UTF-8
3,170
2.984375
3
[ "MIT" ]
permissive
import cv2 import numpy as np import matplotlib.pyplot as plt from skimage.measure import EllipseModel import copy # Constants BLUR_KERNEL_SIZE = (25,25) BASE_THRESHOLD = 0 # 160 THRESHOLD_OF_MAX_BRIGHTNESS = 1/7 MAX_R_SQUARE = 10000 def pre_process(img): # Image processing max_brightness = np.max(img) # Bl...
true
3e685deb8cc4976bee2cef4b4ee4656f84c03ae5
thefab/configparser_extended
/configparser_extended/ecp.py
UTF-8
36,445
2.953125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # # This file is part of configparser_extended library # released under the MIT license. # See the LICENSE file for more information. import configparser from configparser import NoOptionError, NoSectionError try: from backports.configparser.helpers import OrderedDict except ImportError: ...
true
c21d06695fc05032d5293214d5d0b7c6dd010d45
amarynets/python-project-lvl1
/brain_games/engine.py
UTF-8
1,361
3.703125
4
[]
no_license
import random import prompt USER_INPUTS = { 'str': prompt.string, 'int': prompt.integer, 'real': prompt.real } CORRECT_MSG = 'Correct!' WRONG_MSG = "'{user_answer}' is wrong answer ;\ (. Correct answer was '{correct_answer}'." def generate_random_number(): return random.randint(0, 100) def check_...
true
1e138c40dfef511005c9d8030f9a5626bd356eaa
aaronhwoo/python-challenge
/PyPoll/main.py
UTF-8
1,938
3.359375
3
[]
no_license
# modules import os import csv #Set path for file csvpath = os.path.join("Resources", "election_data.csv") #storage variables total_votes = 0 candidates = {} percentage_vote = 0 winner = "" winner_votes = 0 #open data file and skip header with open(csvpath, newline="") as csvfile: csvreader = csv.reader(csvfile,...
true
2ec729e0a0c31eac5276c4bbd179e73166c1cd67
kaacun/ML-lesson
/knn-practice/feature_extract.py
UTF-8
842
3.171875
3
[]
no_license
import numpy as np import re def extract(data): # features = char_len(data) # features = word_count(data) features = keyword_count(data) return np.array(features) # 本文文字列の長さ def char_len(data): features = [[len(feature)] for feature in data[:,3]] return features # 本文の単語数 def word_count(data):...
true
2bb87ce6b5d5a24406ede6b0f27ab23bfb9cee5f
spencerwalls/ENGG-6500
/Assignment 2/regression.py
UTF-8
3,506
3.921875
4
[]
no_license
# This program takes as input 5 different datasets, i.e. one for # each parking lot. Therefore, the original dataset was divided # into five different datasets, and the program thus takes # as input "lot1.csv", "lot2.csv", "lot3.csv", "lot4.csv", and # "lot5.csv", which were all submitted with the assignment # ...
true
0aea9a251e84e221d8d0cbb45cd6c06f9e25bee7
SohamSaha/DataFederationTest
/openfile.py
UTF-8
1,935
2.84375
3
[]
no_license
#coding: utf-8 from bs4 import BeautifulSoup import urllib2 import sys filename="goldPriced.txt" gold = "https://www.investing.com/commodities/gold-historical-data" req = urllib2.Request(gold, headers={'User-Agent' : "Magic Browser"}) con = urllib2.urlopen( req ) soup = BeautifulSoup(con, "html.parser") goldPrice ...
true
1bad5d33860e158cb3aa025ad4ea7183d61fc1b4
lexa946/time_bot
/logic_bot.py
UTF-8
7,702
2.90625
3
[]
no_license
import sqlite3 from telebot import types import config import time from threading import Thread thread_count = 0 class Logic: def __init__(self, bot): self.command_all_post = 'SELECT * FROM posts' self.bot = bot def __time_convert(self, mode, time_data): """ :param mode: unix...
true
6852b49df2401ef28b6fe8ba49285367d41eba84
Altaier-byte/text_File_Manipulation
/txt_File_Manipulation.py
UTF-8
353
3.390625
3
[]
no_license
phrase = input("Enter the word you want to search and the line number: ") line_number = 0 list_of_results = [] with open('fru_veg.txt', 'r') as read_file: for line in read_file: line_number += 1 if phrase in line: list_of_results.append((line_number, line.rstrip())) print("Your search result is: " ...
true
ed9ae847e31dfeecbf3bfb320596da077cc8c94a
shiv125/Competetive_Programming
/codeforce/411/prob2.py
UTF-8
356
2.828125
3
[]
no_license
n=input() def fun(n): lookup={} lookup[1]='a' lookup[2]='aa' lookup[3]='aab' lookup[4]='aabb' # lookup[5]='aabba' # lookup[5]='aabbaa' #lookup[6]='aabbac' string='' x=n/4 y=n%4 for m in range(x): string+=lookup[4] if y!=0: string+=lookup[y] #print len(string) print string fun(n) #for i in range(1,n+1)...
true
3253a2aa83dbeb1f4146c7fca2a4e155d08f9b91
sonic03/sonic03
/Untitled1.py
UTF-8
617
3.75
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[49]: r=input("sayı1:") r=int(r) b=input("sayı2:") b=int(b) if r<b: for x in range(r,b): print(x) elif r>b: for x in range(r,b,-1): print(x) else: print("sayılar eşit") # In[93]: list(range(1,20)) # In[96]: for x in enumerate(list(ran...
true
d7ec470d2ac4ad0b4e00b793400b9a3a44d276a9
liamjstoll/discordbot
/subredditDBQuery.py
UTF-8
3,170
3.171875
3
[ "MIT" ]
permissive
import sqlite3 import pandas as pd def read_from_subredditDB(subreddit,index): conn = sqlite3.Connection('test.db') c = conn.cursor() # switch statement to map column names to an index in the db if index == 'subreddit': i=0 elif index == 'hot': i=1 elif index == '...
true
1f985b2cb36c2f6c2245440f453aabaf8ca97029
ClaudiaSianga/Python-para-Zumbis
/Lista1/exercicio1_guilhermelouro_03.py
UTF-8
562
4
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # 3) Escreva um programa que leia a quantidade de dias, horas, minutos e segundos do usuário. Calcule o total em segundos. dias = input("Digite uma quantidade de dias: ") horas = input("Digite uma quantidade de horas: ") minutos = input("Digite uma quantidade de minutos: "...
true
bfae4c9af8ce4b8b13af1ed0e4fc0b9b1a113c1a
MyutoLu/mysite---test
/practice/views.py
UTF-8
403
2.609375
3
[]
no_license
from django.shortcuts import render from django.http import HttpResponse # Create your views here. def practice(request): return HttpResponse('Hello World!') def mydate(request, year, month, day): return HttpResponse(str(year) + '/' + str(month) + '/' +str(day)) def myyear(request, year): context = {} ...
true
b4acf1d64c62e50f3c651c060c770d312d468fe3
JacobDowns/kalman
/ukf_test.py
UTF-8
3,360
2.875
3
[]
no_license
from model.inputs import * import numpy as np from model.adot_inputs_elevation_dependent import * from model.forward_model.forward_ice_model import * import matplotlib.pyplot as plt from sigma_points_scalar import * """ Simple unscented Kalman filter """ class UKF(object): def __init__(self): # SMB para...
true
193ef6ab3ff30776aa1cebd10ae950dc73670931
rolang12/archivospythonclase
/id_user.py
UTF-8
434
2.84375
3
[]
no_license
a=["rolan123","dario456","pineres789"] b=input("Enter the user: ") c=input("Enter the ID: ") print(b+c) con=0 while True: if b+c in a: print("Welcome") break else: print("User or ID incorrect, try again: ") con+=1 b=input("Enter the user: ") c=input("Enter the ID:...
true
7689754a45081e3c896545d60b885d20a522edf9
jmgdelgado/Area_Python
/mysensores/DHT11.py
UTF-8
2,289
3.25
3
[]
no_license
""" INSTALACION DEL DRIVER (Yo lo he usado con un dht11 con placa, no necesita pull up) ------------------------------------------------------------ INSTALAMOS GIT (si no lo está) sudo apt-get install git build-essential python-dev git clone https://github.com/adafruit/Adafruit_Python_DHT.git cd Adafruit_Python_DHT sud...
true
3be81850d8c5b3e853defb5b193ad3bee977c6bc
devdjangoreact/foodsafe_searchEngine
/searchEngine-爬虫/proceses_item_for_mysql.py
UTF-8
938
2.65625
3
[]
no_license
import redis import MySQLdb import json def process_item(): #创建redis数据库链接 rediscli = redis.Redis(host="49.233.21.252",port=6379,db=0) #创建mysql数据库链接 conn = MySQLdb.connect(host="127.0.0.1",port=3306,user="root",passwd="24301234",db="foodmate",charset='utf8') offset = 0 while True: #获取数据...
true
bd7374bbb746fc41fe349d7446f11a3eb4c954e9
rajkonkret/python-szkolenie
/wt_3_12.py
UTF-8
216
3.703125
4
[]
no_license
def is_it_quibc(number_1): return(round(pow(number,1.0/3.0),8) % 1 == 0) try: number = int(input('Podaj liczbę: ')) print('Jest sześcianem ?:', is_it_quibc(number)) except: print('Incorrect value!')
true
c11c24a11ded08fbd17c829ecf467f83db2b2e9d
pschulam-attic/subtype
/covariance.py
UTF-8
2,877
2.921875
3
[ "MIT" ]
permissive
import numpy as np from copy import copy def row_vec(x): x = x.ravel() return np.atleast_2d(x) def col_vec(x): return row_vec(x).T class Covariance: def __copy__(self): param = self.__dict__ new_cov = type(self)(**param) return new_cov class DiagonalCovariance(Covariance...
true
6ec62f24954fb6be9bed15f66e35abd6d7cb12d1
HyperQueryEmbedding/hqe
/src/mphrqe/utils.py
UTF-8
579
3.3125
3
[ "MIT" ]
permissive
"""Utility methods.""" from typing import Mapping, Optional, Sequence __all__ = [ "get_from_nested_dict", ] def get_from_nested_dict(d: Mapping, key: Sequence[str], default=None) -> Optional[float]: """ Get a value from a nested dictionary. :param d: The dictionary. :param key: T...
true
ef44c15386289fd7501a9256ee58ffd7bf9f5420
lorosanu/xi-ml-topicdiscovery
/python/lib/xi/ml/common/logger.py
UTF-8
2,076
2.84375
3
[ "MIT" ]
permissive
# encoding: utf-8 import sys import logging # Module: handle the predefined and updatable loggers ROOT = 'xi.ml' PATH = '.' FNAME = 'python-xi-ml' loggers = {} def create(name): """Create a new logger with the class name and return it""" if not name.startswith(ROOT): return None if ROOT not ...
true
b17fa6755339f80cc2005382958e2075673215d3
AdamZhouSE/pythonHomework
/Code/CodeRecords/2125/60617/307277.py
UTF-8
204
3.09375
3
[]
no_license
if __name__=='__main__': K=int(input()) if K==2: ans="4 5; 1 2; 2 1; 3 4; 4 3; 1 4" ans=ans.split("; ") for pair in ans: print(pair) exit() print(K)
true
33133f9da46eeca75179ceeb845078812a2162e7
ramakristipati/trex-core
/scripts/automation/trex_control_plane/interactive/trex/cmds_server/cmds_zmq_server.py
UTF-8
2,550
2.5625
3
[ "GPL-1.0-or-later", "GPL-2.0-or-later", "GPL-2.0-only", "Apache-2.0" ]
permissive
#!/bin/python3 from argparse import * import sys import zmq from argparse import * import json import subprocess import time import os class Cmds_server: def __init__(self, args): self.context = zmq.Context() self.socket = self.context.socket(zmq.REP) self.socket.bind("ipc://{}".format(args...
true
051a4f0c90d58e63c3ca08f8f7b4075f196e7cfc
marcinbogdanski/marcin_ai
/marcin/rl_basic/gridworld/agent_fixed.py
UTF-8
4,651
3.203125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from gridworld import GridworldEnv import pdb class HistoryData: def __init__(self, t_step, observation, reward, done): self.t_step = t_step self.observation = observation self.reward = reward self.action = None self.done = ...
true
e53aeb37de3aab4396ed682f07d53a481d160bc2
dustinandrews/nethack_py_interface
/nhpyinterface/nhstate.py
UTF-8
2,388
2.65625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Feb 6 17:39:19 2018 @author: dandrews """ from nh_interface import NhInterface import pickle class NhState: """ Class to understand stuff about the game, like inventory and items. """ DEBUG_PRINT = False progress_filename = "nh_progress.dat" def __...
true
7f0dbbf99b06db4c06b06660f34cca472064b335
TinR-xujun/Python
/game/Tank Battle/tank02.py
UTF-8
1,747
3.796875
4
[]
no_license
''' 新增功能: 加载主窗口 pygame官方网站 www.pygame.org ''' #导入pygame模块 import pygame SCREEN_WIDTH=700 SCREEN_HEIGHT=500 BG_COLOR = pygame.Color(0,0,0) class MainGame(): window=None def __init__(self): pass #开始游戏 def startGame(self): #加载主窗口 #初始化窗口 pygame.display.init() ...
true
ae9ee5ac49296e151ecc019011cf3ff71e06b11f
gufu1995/diplom_software
/backup/convPDTtoPython/dataToPng.py
UTF-8
934
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Sep 17 11:35:58 2020 @author: Gunna """ import pickle import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator myRange, angleVec, X, Y = pickle.load( open( "dataset/xyscan_range_angle_x_y.p", "rb" ) ) for i in range( len( myRange ) ): fig =...
true
16fbbd4243ef7bff3dac6f79e95ca202b71dbfc1
shobhit-nigam/snape_mar
/day3/files/files_2.py
UTF-8
166
3.078125
3
[]
no_license
fa = open("books.txt", "r") stra = fa.read(6) print(type(stra)) print("read content is -->", stra) stra = fa.read(7) print("read content is -->", stra)
true
c4e09386df26eb0f896219af0f3daadd6963ce94
raejoon/graph-process
/graph-simulate/solo2.py
UTF-8
5,275
2.640625
3
[]
no_license
import random from constants import INTERVAL CONFIG_PATH_VECTOR = True CONFIG_CLAMPING = True JITTER = 10 ALPHA = 50 class SoloNode(object): """ Solo Node behaves in the following manner. 1. When it starts, it broadcasts a beacon and reschedules a broadcast for INTERVAL after. 2. Any r...
true
87feda1138870139961953a796978c2f8ac1d4a6
mplanchard/baseutils
/tests/baseutils/test_option.py
UTF-8
358
3
3
[ "MIT" ]
permissive
"""Tests for option-related utilities.""" import typing as t import pytest from baseutils.option import exists @pytest.mark.parametrize( "value, exp", ((None, False), ([], True), ({}, True), (1, True), ((1, 2, 3), True),), ) def test_exists(value: t.Any, exp: bool) -> None: """It exists if it's not Non...
true
c3c9dea67a37518928a5b73fdfa2302540d3459b
infigenie/pygsp
/pygsp/graphs/nngraphs/imgpatches.py
UTF-8
3,482
2.90625
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- import numpy as np from pygsp.graphs import NNGraph # prevent circular import in Python < 3.5 class ImgPatches(NNGraph): r"""NN-graph between patches of an image. Extract a feature vector in the form of a patch for every pixel of an image, then construct a nearest-neighbor grap...
true
38eedf7141bd58c75fa1039f8183d43135f638a5
jchen8tw-research/CTF
/Games/FireShell2020/WarmupROX/sol2.py
UTF-8
252
2.609375
3
[]
no_license
from pwn import * r = remote('142.93.113.55', 31087) r.sendlineafter('start:', 'start') r.sendlineafter('Input:', 'a'*26) res = r.recvline().split('Output: ')[1].strip() flag = '' for i in range(26): flag += chr(ord('a') ^ ord(res[i])) print flag
true
c2ced27a7304bed8c3cd45f0edde76ceae40ac34
SharathHebbar/sicp2
/surveillence/pirwithbuzzer.py
UTF-8
1,989
2.53125
3
[ "MIT" ]
permissive
#main codes and configuration from: #https://circuitdigest.com/microcontroller-projects/raspberry-pi-iot-intruder-alert-system #added buzzer code from: #https://circuitdigest.com/microcontroller-projects/raspberry-pi-motion-detector-pir-sensor import RPi.GPIO as gpio import picamera import time import smtpli...
true
3d4fcd304db53be0a3ba02c7e8f3ad9cd0c7208a
myhohner/seleniumDeom0719
/bussiness_lib.py
UTF-8
1,947
2.515625
3
[]
no_license
import time from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from seleniumDemo import object_store class Doclever(object): def __init__(self, p_driver): self.driver = p_driver #登陆docle...
true
06c366e29c1aa64931b31c4d6720fbc40ecdcfcd
UWPL/zaatar
/silp.py
UTF-8
35,082
2.875
3
[]
no_license
from z3 import * from itertools import * from timeit import default_timer as timer class Relation: """ Relations """ def __init__(self, name, arity): self.name = name self.arity = arity def __eq__(self, other): return self.name == other.name def __repr__(self): retur...
true
077330c888954729a61f72b7a1d7ac20d2c9c0b9
ryndvs96/aoc
/2018/day5/solve.py
UTF-8
382
3.328125
3
[]
no_license
line = input() def rec(s): while True: if s == '': return s n = len(s) print(n) rem = None for j in range(1, n): i = j - 1 if s[i] != s[j] and s[i].lower() == s[j].lower(): rem = i if rem == None: ...
true
02880959b7d6ec962ea263342e50d165daf40ecc
stasvorosh/pythonintask
/INBa/2015/ZORIN_D_I/task_10_7.py
UTF-8
3,683
3.890625
4
[ "Apache-2.0" ]
permissive
#Задача №10, Вариант 7 #Напишите программу "Генератор персонажей" для игры. Пользователю должно быть предоставлено 30 пунктов, которые можно распределить между четырьмя характеристиками: Сила, Здоровье, Мудрость и Ловкость. Надо сделать так, чтобы пользователь мог не только брать эти пункты из общего "пула", но и возвр...
true
623b5fea4c91bb4a4aabf8754b5f4e65ac8f6148
lukehollis/augustan-era-intertext
/intertext.py
UTF-8
4,977
3.171875
3
[]
no_license
import pdb import itertools from concurrent import futures from db import mongo from cltk.text_reuse.text_reuse import TextReuse AUTHORS = ["P. Vergilius Maro", "M. Annaeus Lucanus", "Sextus Propertius", "Martial", "Statius, P. Papinus", "Catullus", "Q. Horatius Flaccus (Horace)"] class Intertext: def __init__...
true
d843d7322c0723fe7b36341f605531941eda6ce5
cyberpirate/cSpeed
/server.py
UTF-8
1,011
3.171875
3
[]
no_license
#!/usr/bin/python3 ''' Simple udp socket server ''' import socket import sys HOST = '' # Symbolic name meaning all available interfaces PORT = 34196 # Arbitrary non-privileged port # Datagram (udp) socket try : s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) print('Socket created') except Exc...
true
4171fde576b165bbc4b7586370e682a0e6c76377
dannyoleary1/Final-year-project---Twitter-Analysis-using-Machine-Learning
/fyp/fyp_webapp/TwitterProcessing/preprocessor.py
UTF-8
2,999
2.921875
3
[]
no_license
import re import nltk import string from nltk.corpus import stopwords from nltk.stem.porter import * from fyp_webapp import config #TODO Add docs #Picks up on the following regex emoticons_str = r""" (?: [:=;] # Eyes [oO\-]? # Nose (optional) ...
true
463b7addefea6effc51f8877c129cf42979e46d3
Prev/full-stack-flask-app
/tests/test_post.py
UTF-8
907
2.53125
3
[]
no_license
def test_get_post_list(client): """ Test GET /posts """ response = client.get('/posts') assert response.status_code == 200 data = response.get_json() assert data['page'] == 1 assert data['per_page'] == 10 assert data['total'] == 2 assert len(data['result']) == 2 def test_get_post(client): """ Test GET /pos...
true
8df83445e494e7137b3ba2721433d7d63ba88244
tudormihaieugen/DataScientistCourse
/Courses/Course1.py
UTF-8
1,530
4.15625
4
[]
no_license
# # Type of variables # a = 5 # print(type(a)) # # # Power: ** (double * operator) # print(2 ** 3) # =8 # # # Area of circle # pi = 3.14159 # radius = 2.2 # area = pi * (radius ** 2) # # # string concat # hi = "Hello there" # name = "Ana" # greet = hi + " " + name # print(greet) # # three_times = name * 3 # print(thre...
true
0ea740e33e7782cfceafc0770930f2d7f42c1130
pegi3s/dockerfiles
/id_mapping/scripts/map-ids
UTF-8
5,095
2.609375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/python3 import os import argparse import time from unipressed.id_mapping.types import From, To from unipressed import IdMappingClient from typing import get_args def validate_db(db_str, valid_dbs, db_type): if not db_str in get_args(valid_dbs): print( f'Error: The specified {db_typ...
true
df7e55908df2dca68c9f319dbeb7bb88a0785ad2
sirebellum/Resource-Prediction
/predict.py
UTF-8
4,443
2.875
3
[]
no_license
from __future__ import print_function import sys, os import swf # Custom swf reading code import numpy as np from mpl_toolkits.mplot3d import Axes3D import sklearn.metrics as metrics import models from math import sqrt # Returns 1 if dividing by 0 def safe_divide(value1, value2): if value2 == 0: return 1...
true
58b2a4a04cd643ae608d965f7706b5f3223b3f71
securesystemslab/zippy
/zippy/benchmarks/src/micro/arith-binop.py
UTF-8
525
3.125
3
[ "BSD-3-Clause" ]
permissive
# zwei 10/09/13 # arithmetic ops (partially extracted from spectralnorm) import time def docompute(num): for i in range(num): sum = 0.0 j = 0 while j < num: sum += 1.0 / (((i + j) * (i + j + 1) >> 1) + i + 1) j += 1 return sum def measure(num): print("Start timing...") start = time.time() for run ...
true
c653832b5c410132b2501e723d595d221304c473
SigurdSundberg/FYS3150
/project2/code/main.py
UTF-8
12,673
2.765625
3
[]
no_license
import sys from os import system import os import subprocess import numpy as np def delete_files(paths, kwargs=0): """Deletes files and directory if not files present. If only paths is supplied, then it deletes all files in directory and the directory. If kwargs are passed, then it only deletes the respe...
true
d6a183f57abdaee29129a682a87bc0bcf8894904
ghayth82/PDBChallenge
/merge2.py
UTF-8
1,609
2.546875
3
[]
no_license
import os import csv directory = "features/deviceMotion_walking_rest" counter = 0 for filename in os.listdir(directory): filename = directory + "/" + filename print(filename) walk = open(filename, 'r') lst = csv.reader(walk, delimiter=',') lines1 = list(lst) walk.close() newlines = [...
true
9086916a81463ca8f3b124d3769d3349d477f01c
yujingmu/test_web
/Web_AutoTest_03_BasePage/Common/base_page.py
UTF-8
5,635
2.875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/9/18 22:16 # @Author : yimi # @File : base_page.py # basepage # 常用的方法函数封装起来 # 加入日志,截图功能 from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import...
true
667105a521f60db7545c2d9db86219055aa21673
lynnlyk/python-spider-learning
/cookie-demo/load_cookie.py
UTF-8
1,707
2.859375
3
[]
no_license
''' http模块包含了一些关于cookie的模块 - CookieJar - 管理存储cookie,向传出的http请求添加cookie - cookie存储在内存中,CookieJar实例回收后cookie将消失 - FileCookieJar(filename, delayload=None, policy=None): - 使用文件管理cookie - filename是保存cookie的文件 - MozillaCookieJar(filename, delayload=None, policy=None): - 创建m...
true
968a85b0ddd6f45fbac8e4bf3893ae918a2f67ad
kar12thik/Code-Kata
/Sorting/Problem 7.py
UTF-8
441
2.96875
3
[]
no_license
N, K = [int(x) for x in input().split()] l1 = [int(x) for x in input().split()] pos = 0 def search(arr, n): u = N - 1 l = 0 while l <= u: mid = (u+l) // 2 if arr[mid] == n: globals()['pos'] = mid + 1 return True else: if n > mid: ...
true
cc6bfd58e9222ebca95380e25be08cf2b05a7d77
Mo-rot/Python-case
/Python自动化测试/web自动化_51job招聘网自动搜索职位.py
UTF-8
1,315
3.125
3
[]
no_license
# 实例:自动化打开浏览器,进入51job招聘网站,搜索职位招聘信息和选择职位地区 from selenium import webdriver # 打开Chrome浏览器,然后进入网站 driver = webdriver.Chrome(r"D:\chromedriver.exe") driver.implicitly_wait(5) driver.get("https://jobs.51job.com/") # 定位到输入框,然后输入搜索内容 driver02 = driver.find_element_by_id("kwdselectid") driver02.send_keys("自动化测试工程师...
true
b393e235fcac843d8dc4e1930e457c937e4f49bb
HareeshGunti/Python-Demo
/Scope.py
UTF-8
252
3.15625
3
[]
no_license
i = 42 # global variable def someFunction(): global i print("global i : " + str(i)) # i = 41 # due to assignment becomes local i = 41 print("local i : " + str(i)) someFunction() print("global i : " + str(i))
true
ab24b070f65b7526dcc7cb849d91561a3d287fcc
4dw1tz/Hangman-Game
/Hangman Game.py
UTF-8
3,463
3.546875
4
[]
no_license
#Hangman Game from tkinter import * import random from turtle import * speed(11) def Draw(Lives): global Word penup() width(10) if Lives==10: setpos(0,-150) pendown() forward(150) elif Lives==9: setpos(150,-150) left(90) pendown() ...
true
a655aaa5e274a3c848be0aae4d868711b8e251a9
Ben-Baert/Exercism
/python/beer-song/beer.py
UTF-8
800
4.09375
4
[]
no_license
def verse(verse_nr): if verse_nr == 0: return "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n" if verse_nr == 1: return "1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more...
true
bb12a2104e0a8a11742c49dc04088b0a7953de50
mozman/ezdxf
/src/ezdxf/addons/genetic_algorithm.py
UTF-8
21,308
2.875
3
[ "MIT" ]
permissive
# Copyright (c) 2022, Manfred Moitzi # License: MIT License from __future__ import annotations from typing import ( Sequence, Iterable, Optional, Callable, Union, ) import abc import copy from dataclasses import dataclass import json import random import time # example usage: # examples\addons\op...
true
ffc49581fd5e529e0fccd573102e606bbd3342c5
frankzl/mlcv-algorithms
/10-clustering/kmeans.py
UTF-8
1,497
3.015625
3
[]
no_license
import numpy as np import math class KMeansModel: def __init__(self, clusters_k): self.k = clusters_k self.centroids = None self.cluster_assign = None """ data should be a numpy array containing all the data points """ def init(self, data): idx = np.random.randint(...
true
09486fe86ecc5a973a01627c35308dabe0c52d0a
yash309/HDOC
/Getting min at top.py
UTF-8
367
2.953125
3
[]
no_license
d=dict() def _push(a,n): global d min1=a[0] s=[] s.append(a[0]) d[0]=min1 for i in range(1,n): if(a[i]<min1): min1=a[i] d[i]=min1 else: d[i]=min1 s.append(a[i]) return s def _getMinAtPop(stack): for i in range(len(st...
true
716645c48d05781c3d6824a69ec24463a5cc92a8
nothingthere/python
/ClaudioDeepChainMap.py
UTF-8
977
3.40625
3
[]
no_license
#!/usr/bin/python3 # Author: Claudio <3261958605@qq.com> # Created: 2017-05-06 12:45:25 # Commentary: # Code: ''' 允许在所有元素字典中赋值和删除的ChainMap子类 ''' from collections import ChainMap class ClaudioDeepChainMap(ChainMap): '''允许在所有元素字典中赋值和删除的ChainMap子类.''' def __setitem__(self, key, val): for mapping in se...
true
775bf8fecba47f24dddaee66c36ad6a9cb635c7b
michael-c-hoffman/pytest_external_data
/tests/conftest.py
UTF-8
453
2.625
3
[]
no_license
import pytest import importlib def pytest_generate_tests(metafunc): for fixture in metafunc.fixturenames: if "data_" in fixture: metafunc.parametrize(fixture, load_tests(fixture)) def load_tests(name): # Load module which contains test data tests_module = importlib.import_module('.'+na...
true
92e5b8455f6048021b8b46e57e73548aa308df5b
Badr-MOUFAD/Delta-LeGrand-python-script
/plateauNewSolution/newEquationMotion.py
UTF-8
3,555
2.671875
3
[]
no_license
from Analysis import euclidienNorm, VectorFunction, algorithmNewtonRaphson from simulationNacelle.equationMotion import sinPi3, cosPi3 import numpy as np # constant #a = 1371 # length triangle corner e = 0 # distance slider - plan R = 792 # distance axis / robot center d = 20 # distance axis / joint a = (R - d) ...
true
80b336743b3a899c7f3260a7b18cd90749eb3d66
filosfino/leetcode
/Algorithms/Q48_Rotate_Image.py
UTF-8
572
3.234375
3
[]
no_license
class Solution: def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ def rotate_single_position(i, j): t1, t2, t3, t4 = matrix[i][j], matrix[j][-i-1], matrix[-i-1][-j-1], matrix[-j-1][...
true
4af9ceee7c5780e58f88c5ca2a6423a357d1f170
robertodr/solver
/test_cg.py
UTF-8
5,425
2.828125
3
[ "MIT" ]
permissive
from functools import partial from operator import ge, le from typing import Callable, Dict, List, Tuple import numpy as np import zarr from fixpoint import * from numpy import linalg as LA from utils import * def cg(A, b, rtol=1.0e-8, etol=1.0e-8, max_it=25, x_0=None): if x_0 is None: x = np.zeros_like(...
true
ecb0dcc8e90975862bf5b0d06145ddceb7fca8a3
chin8628/Pre-Pro-IT-Lardkrabang-2558
/Prepro-Onsite/W5_D1_Countup_Recur.py
UTF-8
203
2.6875
3
[]
no_license
""" W5_D1_Countup_Recur """ def main(inputn, index=1): """ wow nee main """ if index <= inputn: print(index) main(inputn, index + 1) else: return 0 main(int(input()))
true
e158c12b8fd0c1f7c0d6930efac8404a4fb85290
Excloudx6/SnitchDNS
/app/lib/base/password_complexity.py
UTF-8
1,429
3.375
3
[ "MIT" ]
permissive
class PasswordComplexityManager: def __init__(self, min_length, min_lower, min_upper, min_digits, min_special): self.min_length = int(min_length) self.min_lower = int(min_lower) self.min_upper = int(min_upper) self.min_digits = int(min_digits) self.min_special = int(min...
true
4a59ce52bb11f3fc82e4c65ab4f56f7b9b882cf3
PatrickStaar/visual_odometry_practice
/model/util.py
UTF-8
3,058
2.5625
3
[]
no_license
import os from PIL import Image from keras.layers import * from depthmap import Depth from pose_utils import * from math import atan2 def conv(inputs, filters, kernel, stride=(1, 1), padding='valid', input_shape=None, name=None): return Conv2D(filters=filters, kernel_size=kernel, ...
true
98cd093db37569da58271994027e3baad0ab336e
liam-white-17/capstone-chess-ai
/chess_lib/chess_piece.py
UTF-8
11,569
3.203125
3
[]
no_license
import re from abc import abstractmethod from chess_lib.move import Move, Castle, PawnPromotion from chess_lib.chess_utils import is_valid, is_capture, Color, is_check, convert_rank_file_to_int class Piece: """ Abstract class used to represent a piece on the game board """ name = '*' has_moved = F...
true
2b39fdec2e187e63e622b649426603a1789370ae
jedzej/tietopythontraining-basic
/students/serek_wojciech/lesson_05_lists/character_picture_grid.py
UTF-8
657
3.390625
3
[]
no_license
#!/usr/bin/env python3 """Character picture grid exercise""" GRID = [['.', '.', '.', '.', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['O', 'O', 'O', 'O', 'O', '.'], ['.', 'O', 'O', 'O', 'O', 'O'], ['O', 'O', 'O', 'O', 'O', '.'], ['O', 'O',...
true
6279fecf1bf1b6091bae5bb2b590407943636217
Avynn/Cat-GAN
/src/model.py
UTF-8
1,594
2.71875
3
[ "MIT" ]
permissive
import tensorflow as tf import imagePipeline def weightVariable(shape): initial = tf.truncated_normal(shape, stddev=0.01) return tf.Variable(initial) def biasVariable(shape): initial = tf.constant(0.0, shape=shape) return tf.Variable(initial) def model(flatInputImages, labels): xDrop = tf.nn.dro...
true
c1e59bc6c420b1af585d8a7ee6b8c703e416a112
ayoubc/competitive-programming
/online_judges/codechef/FIRESC.py
UTF-8
954
2.96875
3
[]
no_license
import sys sys.setrecursionlimit(10 ** 6) class Solution: def dfs(self, s): self.vis[s] = True self.cnt +=1 for u in self.graph[s]: if not self.vis[u]: self.dfs(u) def solve(self, n, graph): self.vis = [False] * (n+1) self.gr...
true
eb9915dca912c67e7884b01026ad4af5ce9ce9a9
rsamhollyer/Digital-Crafts-Classes
/Programming-102/Python_102/11_class methods.py
UTF-8
1,048
3.75
4
[]
no_license
#1 class Vehicle: def __init__(self, category, wheels, speed, top_speed, position, acceleration): self.category = category self.wheels = wheels self.speed = speed self.top_speed = top_speed self.position = position self.acceleration = acceleration def mov...
true
781bb3ae79d9c307568a33e94a963ce41ddd2028
bansal19/PizzaParlour
/Classes/Order.py
UTF-8
3,928
3.328125
3
[]
no_license
from enum import Enum from Classes.Pizza import Pizza from Classes.Drink import Drink from Classes.MenuItem import MenuItem class Order: """ An Order class """ total_orders = 0 def __init__(self): self.order_items = [] self.order_number = Order.total_orders self.order_status = OrderStatus.STARTED self.dis...
true
58b2eadc62d8bf7b641c38f66c41206b24c5b41e
nakajima-john-shotaro/AIcon2
/aicon/backend/models/big_sleep/ema.py
UTF-8
2,098
2.8125
3
[ "MIT" ]
permissive
# Exponential Moving Average (from https://gist.github.com/crowsonkb/76b94d5238272722290734bf4725d204) """Exponential moving average for PyTorch. Adapted from https://www.zijianhu.com/post/pytorch/ema/ by crowsonkb """ from copy import deepcopy import torch from torch import nn class EMA(nn.Module): def __init__...
true