blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
2f0bf03d7d65eaab396037f4a22d2eae20205941 | Python | cy2260/euler | /summationOfPrimes/summationOfPrimes.py | UTF-8 | 335 | 3.671875 | 4 | [] | no_license | import math
def isPrime(n):
if n < 2:
return False
for i in range(2, int(math.sqrt(n)+1)):
if n%i == 0:
return False
return True
def sumOfPrimes(n):
if n < 3:
return 2
sum = 2
for i in range(3, n, 2):
if isPrime(i) == True:
sum += i
... | true |
673f5329c0f435c1117bf36d42ca4d26a9796e5e | Python | wuqiangroy/tornado_wq | /definitions_readonly.py | UTF-8 | 990 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# _*_ coding:utf-8 _*_
import pymongo
from tornado import httpserver, options, web, ioloop
options.define('port', default=8000, help='run on the given port', type=int)
class Application(web.Application):
def __init__(self):
handlers = [(r'/(\w+)', WordHandler)]
conn = pymon... | true |
ad690f5818329ddabd85f013670163018b2de0df | Python | brendlin/BGSuggest | /BGActionClasses.py | UTF-8 | 26,753 | 2.5625 | 3 | [] | no_license | import math
from TimeClass import MyTime
from Settings import HistToList
#------------------------------------------------------------------
def InsulinActionCurve(time_hr,Ta) :
if time_hr < 0 :
return 0
result = 1 - math.pow(0.05,math.pow(time_hr/float(Ta),2))
return result
#--------------------... | true |
77a6fc276e871cff0e23db293e7babc6a5355480 | Python | yycarry1994/Pycharm_Project | /postgresql/tkinter/Entry.py | UTF-8 | 488 | 3.515625 | 4 | [] | no_license | import tkinter
win = tkinter.Tk()
win.title("yudanqu")
win.geometry("400x400+200+50")
'''
Entyr:输入控件,用于显示简单文本内容
'''
#密文显示
entry1 = tkinter.Entry(win, show="*") #show="*" 可以表示输入密码
entry1.pack()
#绑定变量
e = tkinter.Variable()
entry2 = tkinter.Entry(win, textvariable=e)
entry2.pack()
#e代表输入框这个对象
#设置值
e.set("shdahdah... | true |
2db9b0e29c70a61788b19f77fc6fc8d2a2b5c941 | Python | LangfeldN/python_ | /analyseKassenlogs/scanSeitenwechsel.py | UTF-8 | 1,399 | 2.921875 | 3 | [] | no_license |
## Dieses Script soll alle Dateien in einem Ordner scannen und auflisten
import os
import time
def log(text):
import time
print(time.ctime() + ' --- ' + text)
def changeDir():
print ('Aktuelles Verzeichnis:\t\t\t' + os.getcwd())
s_input = raw_input('Bitte Verzeichnis angeben:\t\t')
... | true |
ec31afe0f308e58b7a24ff57633448579833a3bb | Python | ai-kmu/etc | /algorithm/2023/0726_2601_Prime_Subtraction_Operation/Myunghak.py | UTF-8 | 996 | 3.671875 | 4 | [] | no_license | # 우선 max(nums)이하의 모든 소수를 구함
# nums를 오른쪽 부터 탐색하며 자신의 오른쪽 숫자보다 큰 수가 나올 시
# 해당 숫자를 감소시켜 줌
class Solution:
def get_eratosthenes(self, n):
is_prime = np.ones(n+1, dtype=bool)
is_prime[:2] = False
N_max = int(np.sqrt(n))
for j in range(2, N_max+1):
is_prime[2*j::j] = False
... | true |
de6939046c5f9d0596b4da2362e95f71071aece8 | Python | philusnarh/PROJECT | /antenna-plots/make_ant_table.py | UTF-8 | 3,716 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
#
#python make_ant_table.py --layout KAT7_layout.txt --tname newKAT7_Ant_Table
#
import shutil
import sys
import os
from pyrap.tables import table, makearrcoldesc, makecoldesc, makescacoldesc,maketabdesc
import numpy as np
def create_table (ndim=None,name=None):
names = makescacoldesc("NAM... | true |
be54fdbcf85439499d4eea8259f4c7b26fb5f931 | Python | phil-bergmann/2016_DLRW_brain | /brain/tsne.py | UTF-8 | 7,185 | 2.625 | 3 | [] | no_license | from __future__ import print_function
import numpy as np
import pylab as plt
import timeit
from bhtsne import bh_tsne
import zipfile
import brain.globals as st
from brain.data import extract_mat, normalize
def run_bhtsne(data_set, theta=0.5, perplexity=50):
""" Runs the bh-tsne on the given data
:t... | true |
9807fbae8464ff61e9bd88496696e4f75225d891 | Python | DanielSMS98/practica1_5 | /parYimpar.py | UTF-8 | 167 | 4.1875 | 4 | [] | no_license | #Mi primer programa en python
num = int(input("Dame un numero: "))
if num % 2 == 0:
print(f'Tu numero {num} es par')
else:
print(f'Tu numero {num} es impar')
| true |
bb5f870a2c9a60d431a0487796a53993c8957923 | Python | Alvin2580du/alvin_py | /spyders/budejie_spyder.py | UTF-8 | 1,290 | 2.53125 | 3 | [] | no_license |
import requests
import urllib.request
from bs4 import BeautifulSoup
from urllib import error
from tqdm import trange, tqdm
import urllib.parse
import pandas as pd
from pyduyp.logger.log import log
"""
百思不得姐: http://www.budejie.com/text/2
"""
def urlhelper(url):
try:
req = urllib.request.Request(url)
... | true |
2111b05354e0eff21ff90331ca670b319297fdcb | Python | riokko/lesson2 | /if_practice2.py | UTF-8 | 1,018 | 4.28125 | 4 | [] | no_license | def comparison(str1, str2):
if type(str1) is str:
if type(str2) is not str:
return 0
elif type(str1) is not str:
return 0
if str1 == str2:
return 1
if str1 != str2:
if len(str1) > len(str2):
return 2
elif str(str2) == 'learn':
... | true |
48d7b03ea9df3cbe94c46147d34787a2397a7443 | Python | wilstep/frisco-crime | /Fourier/time-2.py | UTF-8 | 1,351 | 3.1875 | 3 | [] | no_license | import zipfile
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import csv
import math
from datetime import datetime
from fourier import Fourier
twopi = 2.0 * math.pi
t0 = np.datetime64("2003-01-06")
swk = 7.0 * 24.0 * 3600.0 # seconds per week
## read training file
z = zipfile.ZipFile('.... | true |
aaa488754a37edb929a891c98ff5729be7e54b14 | Python | Penguinhedgehog/CS2302-PatrickBrannan | /CS2302/Lab 8/Lab 8.py | UTF-8 | 2,515 | 4.09375 | 4 | [] | no_license | #Patrick Brannan
#Last Edited on 5/11/2019 - Due 5/9/2019
#For this program, we are implementing a trigonometric functions with random values
#And we are finding the partitions of a list using backtracking.
import math
import mpmath
import random
import numpy as np
#Part 1, randomized algorithm
def random_tr... | true |
c8976d1a4cbdd38333448e04d16d36a5e148e1ca | Python | fc860325/Leetcode | /HW2.py | UTF-8 | 345 | 3.1875 | 3 | [] | no_license | class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
if (x >= 0 ):
x = int(str(x)[::-1])
else:
x = -(int(str(-x)[::-1]))
if(x < 2**31-1 and x >= -(2**31)):
return x
el... | true |
4acfd21e5c5200c28b05fb29675c4b991e10b2b6 | Python | serg-the-engineer/geo-garry | /geo_garry/gmaps/geocode.py | UTF-8 | 4,330 | 2.609375 | 3 | [
"MIT"
] | permissive | import logging
from typing import Optional
from ..cache import CacheableServiceAbstract
from ..dataclasses import Coordinates, CoordinatesAddress
from ..federal_subjects import FEDERAL_SUBJECT_CODES
from .api import GoogleMapsApi
from .address import GoogleMapsAddress, ADDRESS_SCHEMAS
from . import cache
logger = logg... | true |
bcc0afc3c00b027e2ca8cfaab7f12abbc62d1b05 | Python | ctir006/Python-and-C-code-submitted-in-HackerRank-contests | /Class_Work_Assignments/DP/Max_sum_increasing_sub_sequence.py | UTF-8 | 349 | 2.84375 | 3 | [] | no_license | def msis_help(l,i,j,sum):
if j>=len(l):
return 0
if l[i]<l[j]:
s=l[i]+l[j]+msis_help(l,j,j+1,sum)
if s>sum[0]:
sum[0]=s
return sum[0]
else:
return msis_help(l,i,j+1,sum)
def msis(l,r):
for i in range(len(l)):
msis_help(l,i,i,r)
print(r[0])
r[0]=0
a=[20,3,1,15,16,2,12,13]
... | true |
67abbd766a96ba7ec8f20225ecfee1c61c5d0839 | Python | snehasg95/API-Programming | /food_truck_api.py | UTF-8 | 4,538 | 3.65625 | 4 | [] | no_license | import requests
import datetime
from collections import OrderedDict
from utils import loadJson
# Test Description
# a. Build the url and fetch data fom endpoint using python's requests library - make a GET call to retrieve data
# Create a dictionary mapping to map days of week with the position in week: egs: Sun... | true |
8ebdbf297ccc2130c54936b1b59f5278d5ca957a | Python | Opturne/Udacity_ud036 | /PythonApplicationSandbox/mindstorms.py | UTF-8 | 476 | 3.984375 | 4 | [] | no_license | import turtle
def draw_square(someturtle):
someturtle.forward(100)
someturtle.right(90)
someturtle.forward(100)
someturtle.right(90)
someturtle.forward(100)
someturtle.right(90)
someturtle.forward(100)
someturtle.right(90)
window = turtle.Screen()
window.bg... | true |
5155a10457405db952c4cec0b09fd8f2f264b911 | Python | iharthi/uniplate | /uniplate/attestation.py | UTF-8 | 3,018 | 2.578125 | 3 | [] | no_license | import uniplate_engine
import datetime
import locale
import odf.draw
locale.setlocale(locale.LC_ALL, '')
class TableLoader(uniplate_engine.TableLoader):
prefix = '::'
marks = {
'3': "3 (удовлетворительно)",
'4': "4 (хорошо)",
'5': "5 (отлично)",
}
@classmethod
def process... | true |
52bc5e7159ecea67a2f6b26df8bf688975a0bfbf | Python | ForwardDaniel/Python-class | /lesson5/Global_and_Locals.py | UTF-8 | 158 | 2.65625 | 3 | [] | no_license | Numbers = 10 #global space
def increment():
global Numbers
Numbers+=1 #local space
print (Numbers)
return
increment()
increment()
increment()
| true |
c3cb72bdb6404aa4812d288a64197a28750b02ea | Python | Loneranger001/PyQtDesktopapps | /learnpyqt.com/signalsslots.py | UTF-8 | 1,696 | 2.8125 | 3 | [] | no_license | from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QPushButton, QFileDialog
import os
import sys
from PyQt5 import QtGui
from PyQt5.QtCore import Qt
class MainWindow(QMainWindow):
# Initialize the class
def __init__(self):
super(MainWindow, self).__init__()
self.windowTitleChanged.c... | true |
6104f4a30b6c0887aec4aba947a3f7a24ce5f637 | Python | Arcaderat/DiscordGifBot | /gifbot.py | UTF-8 | 2,468 | 2.765625 | 3 | [] | no_license | import re
import json
import discord
import requests
client = discord.Client()
with open("./commands.json") as f:
commands = json.load(f)
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
#ignore own messages
if ... | true |
bc3c2bf20b4fed60f8867298b3dd489286663798 | Python | Vovanuch/python-basics-1 | /elements, blocks and directions/other/x_y_multiply.py | UTF-8 | 53 | 2.609375 | 3 | [] | no_license | '''
x and y, *=
'''
x = 2
y = 1
x *= y + 1
print(x) | true |
68ba75846a67f0fb26b5edd1890646c1471c9cb2 | Python | patrick-gao/OpenCV-Sudoku | /sudoku.py | UTF-8 | 2,402 | 3.75 | 4 | [] | no_license | # Checks if sudoku boards are legal
import math
#################################################
# Helper functions
#################################################
def almostEqual(d1, d2, epsilon=10**-7):
# note: use math.isclose() outside 15-112 with Python version 3.5 or later
return (abs(d2 - d... | true |
3cc5d8688cefaf0f553e649a340e807bfb6bf043 | Python | Philippe-Storiane/cnam | /rcp209/2017-05-04-dl-with-keras/ex2.py | UTF-8 | 1,999 | 2.921875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.utils import np_utils
from keras.optimizers import SGD
from keras.callbacks import TensorBoard
tensorboard = TensorBoard(log_dir="_mnist", write_graph=False,... | true |
c1182f88e1c08fbe72935d8ad5cfead224b9297d | Python | eric-s-s/mvm_dicetables | /gui_model.py | UTF-8 | 21,380 | 2.734375 | 3 | [] | no_license | """model and viewmodel for prototype"""
from __future__ import absolute_import
from decimal import Decimal
try:
from itertools import izip_longest as zip_longest
except ImportError:
from itertools import zip_longest
import dicetables as dt
import numpy as np
import filehandler as fh
from textcalc import Text... | true |
9745ca7b491d5a9f2fe08d7e8cd4c0e7efd4580a | Python | ahmedhamza47/basics | /66.py | UTF-8 | 893 | 3.734375 | 4 | [] | no_license | for i in range(5):
user_input = int(input("Guess the number: "))
if (user_input == com_input + 1) or (user_input == com_input + 2) or (user_input == com_input + 3):
print("The number is a little high.")
elif (user_input == com_input - 1) or (user_input == com_input - 2) or (user_input == com_input - 3):
pri... | true |
502aeb693fd86a8f6e1e1a77b9c18aa83dbf48c8 | Python | YufanWangYuki/Computer_CU | /1_threshold.py | UTF-8 | 1,947 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 24 07:42:38 2019
@author: lenovo
"""
from PIL import Image
import numpy as np
import cv2
import time
def fillHole(im_in):
im_floodfill = im_in.copy()
# Mask used to flood filling.
# Notice the size needs to be 2 pixels than the image.
h, w = im_in.sh... | true |
e5ee4ba8d0062909a1835601fb7509a87f7646a3 | Python | silverfield/pythonsessions | /s07_graph_plotter/exercises/leftright_doc.py | UTF-8 | 2,178 | 3.4375 | 3 | [
"MIT"
] | permissive | __author__ = 'ferrard'
class LeftRightDoc:
# ---------------------------------------------------------------
# Initialisation
# ---------------------------------------------------------------
def __init__(self, max_width=40):
self._lines = []
self._max_width = max_width
# -------... | true |
53f653f31cc4d1c0df3ca25a856389ef95eb1e60 | Python | supermareo/chinese_checkers | /app.py | UTF-8 | 21,779 | 2.53125 | 3 | [] | no_license | # coding=utf-8
import os
import re
import easygui
import pygame
from Model import *
from calculator import calc
from widgets import Button
pygame.init()
# 定义一些共用属性
# 尺寸
WINDOW = (1200, 670)
# 标题
TITLE = "国际数棋"
# 初始化界面与标题
SCREEN = pygame.display.set_mode(WINDOW)
pygame.display.set_caption(TITLE)
# 刷新相关
FPS = 30
CLO... | true |
ee6283fc9dd162047b0212db57c40408f4092acb | Python | Thyagaraja9573/Projects | /missingpositiveint/missingpositiveint.py | UTF-8 | 262 | 3.1875 | 3 | [] | no_license | array = [-7,-6,-4,-3,-1,0,1,2,4,7]
def fSmallestPositiveInt(a):
posInt = max(a)
for i in a:
if i > 0 and i-1 > 0 and i-1 < posInt:
if not i-1 in a:
posInt = i-1
return posInt
print(fSmallestPositiveInt(array))
| true |
2ed2f3454805461d32722c6842394e7659439a4a | Python | beebel/HackBulgaria | /Programming0/week1/5-Saturday-Tasks/solutions/10_reverse_int.py | UTF-8 | 400 | 3.671875 | 4 | [] | no_license | text = input("Enter number: ")
n = int(text)
def posN(num):
pos = []
while (num > 0):
lastPosN = num % 10
pos.append(lastPosN)
num = (num - lastPosN) // 10
return pos
def reverse(a):
result = ""
list = posN(a)
for e in list:
result = result + str(e)
if resu... | true |
237013ff4ad16c8deffca0a2857a425b1748dd7b | Python | PaddyFerry/FYP-Music-Tool | /src/test/test_structure.py | UTF-8 | 634 | 2.6875 | 3 | [] | no_license | from src.song import structure, read
import numpy as np
sr, song = read.read("test/testfiles/structure.wav")
song = read.startend(song)
bpm = 100
ret = structure.find_segments(song, bpm)
def test_split_pos():
"""Check functionality"""
arr = [1, 1, 1, 1, -1, -1, 1, -1]
assert np.allclose(structure.split_p... | true |
af0974802b747be00e1943e702afb5413b101d74 | Python | arch1904/Python_Programs | /Insertion_Sort.py | UTF-8 | 274 | 3.421875 | 3 | [] | no_license | list=[10,9,8,7,6,5,4,3,2,1]
def insertionsort():
global list
for i in range (1,len(list)):
temp=list[i]
j=i-1
while temp<list[j] and j>=0 :
list[j+1]=list[j]
j-=1
list[j+1]=temp
print(list)
insertionsort()
| true |
7000ccd6b22fcf1b15a86b2469228dba74f4f8de | Python | Agchai52/DeepGyro | /preprocess/calibration.py | UTF-8 | 1,013 | 2.53125 | 3 | [] | no_license | import numpy as np
'''
Specify the calibration information. The following
parameters are for the NVIDIA Shield tablet.
'''
# Downsampling factor. For example, the image
# resolution is halved when scaling is set to 0.5
scaling = 0.5
# Camera intrinsics [fx 0 cx; 0 fy cy; 0 0 1] at
# the original re... | true |
2174d21c573b7829c447c61176f64cd4471a7fa3 | Python | katebee/gems-and-snakes | /fruit-machine/fruit_machine.py | UTF-8 | 2,819 | 4.28125 | 4 | [] | no_license |
import random
class Player(object):
"""Player has a fund of cash (integer) to play machines with"""
def __init__(self, wallet_fund):
self.wallet_fund = wallet_fund
def gamble(self, machine):
if (self.wallet_fund - machine.play_cost) > 0:
self.wallet_fund -= machine.play_cost
... | true |
139249704c412a527e048f67576388efcf3b5d10 | Python | parkjinhong03/DMS-Clone | /Server/V3/api/service/music/music_apply.py | UTF-8 | 2,247 | 2.84375 | 3 | [] | no_license | '''
기상 음악 신청 모듈
'''
from Server.V2.DB_func.service.Music.music_count import music_count
from Server.V2.DB_func.service.Music.music_exist import music_exist
from Server.V2.DB_func.connect import connect
from flask_jwt_extended import jwt_required, get_jwt_identity
from flask_restful import reqparse
from flask import re... | true |
924abb453c93de19f1f53ffe5249a70a59bfe052 | Python | RomanMatiiv/algorithms_HSE | /data_structure/tests/test_doubly_linked_list.py | UTF-8 | 1,138 | 3.578125 | 4 | [] | no_license | from data_structure.linked_list import DoublyLinkedList
def test_insert():
llist = DoublyLinkedList()
llist.insert_head(1)
assert llist.get_head() == 1
assert llist.get_tail() == 1
llist.insert_tail(2)
assert llist.get_tail() == 2
llist.insert_head(3)
assert llist.get_tail() == 2
... | true |
26ec8d06605b93afd0c11ba6670615c92dd27d30 | Python | saga9017/laboratory | /Word2Vec/final_test.py | UTF-8 | 3,379 | 2.671875 | 3 | [] | no_license | import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
import operator
f = open("C:/Users/Lee Wook Jin/source/repos/Fasttext_embedding/fasttest_neg5_sub_vs_1.txt", 'r', encoding='utf-8')
word_to_id={}
word_to_count={}
hidden_weights=[]
i=0
while True:
line = f.readline().split(' ')
if len(... | true |
4c976b8f09bb74a822eb1886765808f0d632bde4 | Python | RyuKoki/010123131 | /mandelbrot_threading/mandelbrot_version1.py | UTF-8 | 3,416 | 2.96875 | 3 | [] | no_license | ###################################################################
# Author : Onpinya Phokhahutthakosol
# Student ID : 62-010126-2026-1
# Subject Name : 010123131 Software Development Practice I
# Date : 24 July 2020
# File name : mandelbrot_version1.py
#################################################################... | true |
753146b86e9f71c96d09cdc11472bc58eb79f715 | Python | agathantavrazou/dapt_rmt_jan_21_mid-bootcamp-project | /ultimation.py | UTF-8 | 14,312 | 3.015625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import datetime
import warnings
import matplotlib.pyplot as plt
import seaborn as sns
import pickle
import time
from sklearn.metrics import mean_absolute_error, mean_squared_error
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegressi... | true |
ce24171577c695a56176450f44722176ac16973f | Python | jose-gilberto/mitx-python | /lect-01/workingObjects.py | UTF-8 | 156 | 3.1875 | 3 | [] | no_license | # Working with objects
5
type(5)
#<class 'int'>
3.0
type(3.0)
#<class 'float'>
True
type(True)
#<class 'bool'>
None
type(None)
#<class 'NoneType'>
| true |
bd8b1045b79eb6dce331a837e684436f19777a87 | Python | LeonardoCella/CBRAP | /arm/Exponential.py | UTF-8 | 544 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''Exponentially distributed arm.'''
__author__ = "Olivier Cappé, Aurélien Garivier"
__version__ = "$Revision: 1.5 $"
from random import random
from math import isinf,exp,log
from arm.Arm import Arm
class Exponential(Arm):
"""Exponentially distributed arm, possibly truncated"""
def __init_... | true |
0cbdee3f6ef7edbc6e1e8c63229df8ffef9cc46e | Python | LabsTeam33/PhoneBook2 | /menu.py | UTF-8 | 4,644 | 3.859375 | 4 | [] | no_license | # coding=utf-8
__author__ = 'supremist'
""" Модуль для інтерактивного спілкування з користувачем через консоль"""
def print_menu(items):
""" Друкує меню з пунктів items
:param items: список пунктів для друку"""
for index, item in enumerate(items):
print(str(index) + ') ' + item)
def request(max_... | true |
f438399d2f604275d8f8662b8e6436a5855514e0 | Python | xjbldn/QuantChaos | /classical_kickedrotor.py | UTF-8 | 1,530 | 3.359375 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from typing import Optional
class KickedRotor1D:
def __init__(
self, kicking_strength: float, initial_state: Optional[np.ndarray] = None
) -> None:
if initial_state == None:
initial_state = np.random.rand(2, 1)
elif len(initial_state) != 2:
... | true |
4aa40495757d0bebd2ea791f7f32e8b0c8e35075 | Python | s-n-1-0/boin_simpleccepconv | /main_convert.py | UTF-8 | 2,632 | 2.75 | 3 | [] | no_license | #
# 変換処理(時間がなかったためstftを使っていない(=サイズが大きい波形を生成できない))
# a_pathとb_pathとresult_pathを指定してください。
#
from lib import wavefile
from scipy import signal
import numpy as np
import matplotlib.pyplot as plt
from scipy.fft import fft, ifft
def add_subplot():
global pcount
global fig
pcount += 1
return fig.add_subplot(3... | true |
3c41bd52301f8a731a9699294bf34c936654ef2f | Python | pyjune/python3_doc | /3_5.py | UTF-8 | 554 | 3.9375 | 4 | [] | no_license | # 3번 반복 - i가 0, 1, 2인 동안 반복
for i in range(3):
print(i)
# i를 5, 6, 7인 동안 반복
for i in range(5, 8):
print(i)
# i의 증감 폭 지정
for i in range(0, 6, 2):
print(i)
for i in range(5, 0, -2):
print(i)
# x가 리스트의 원소
a = [10, 20, 30]
for x in a:
print(x)
# for를 사용한 메뉴 출력
menu = ['','Americano', 'Latte', 'E... | true |
346ad65a351e4addce26bc488f947fa0594307f5 | Python | yuexizhaohong/python | /example/test_xlwt.py | UTF-8 | 266 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
#encoding:utf8
import xlwt
workbook = xlwt.Workbook()
sheet1 = workbook.add_sheet('sheet1', cell_overwrite_ok=True)
sheet1.write(0,1,'aaaaaaaaaaaaaaaaaaa')
sheet1.write(3,2,'bbbbbbbbbbbbbbbbbbb')
workbook.save('/tmp/test.xls')
print 'sucess'
| true |
f2c4fb55f5ac75ae5b0f0cb3576082be3aba651c | Python | nobe0716/problem_solving | /codejam/2020/qual/d-esab-atad.py | UTF-8 | 1,449 | 2.859375 | 3 | [] | no_license | t, b = list(map(int, input().split()))
"""
00101011110100110010
00101011010000110010.
"""
class QueryMgr:
def __init__(self):
self.turn = 0
def query(self, idx):
print(idx + 1, flush=True)
self.turn += 1
return int(input())
for _ in range(t):
query_mgr = QueryMgr()
... | true |
03fdcbffe434818b10978003e2870e471de68142 | Python | Foxboron/infoscr | /client.py | UTF-8 | 654 | 2.796875 | 3 | [
"MIT"
] | permissive | import subprocess
import sys
import time
import requests
from os import listdir
def print_characters(TIME, output):
for letter in output:
print(letter, end="", flush=True)
time.sleep(TIME)
print()
def play_scenes(settings):
while True:
req = requests.get(IP+"/scene", headers={"S... | true |
78533bba71e07e2a712efc67e3a2c2a07b180956 | Python | SpicyKong/problems | /BOJ/Q_1267.py | UTF-8 | 454 | 3.28125 | 3 | [] | no_license | # https://www.acmicpc.net/problem/1267 문제 제목 : 핸드폰 요금 , 언어 : Python, 날짜 : 2019-10-15, 결과 : 성공
import sys
N = int(sys.stdin.readline())
list_a = list(map(int, sys.stdin.readline().split()))
#sum_a = sum(list_a)
Y_fee = 0
M_fee = 0
for fee in list_a:
Y_fee += (fee//30+1)*10
M_fee += (fee//60+1)*15
if M_fee == Y... | true |
5bbcecf2b74ffafa95cf3652c41fa4740594524f | Python | thetechbuilder/german-credit-solution | /solution/gensyn.py | UTF-8 | 6,948 | 2.8125 | 3 | [] | no_license | #License: Public Domain
#
#gensyn.py
#
"""Genetic algorithm implementation for neural network synthesis
Unit tests are in the current directory (test_gensyn.py, test.py)
"""
#standard modules:
from random import sample, choice, randint, gauss, randrange
from itertools import chain
import math
#making 'ga' and 'nn' fol... | true |
281b321933e0074221f0503aa737bd0796cab0b3 | Python | pyguren/ethical_hacking | /WebScraper/WebScraper.py | UTF-8 | 1,205 | 3.578125 | 4 | [] | no_license | from bs4 import BeautifulSoup
import requests
url = "http://www.howtowebscrape.com/examples/simplescrape1.html"
webpage = requests.get(url)
soup = BeautifulSoup(webpage.content, "html.parser")
print(soup.head) #Obtiene la etiqueta head de la pagina
print(soup.title) #Obtiene la etiqueta titulo de la pagina
print(sou... | true |
3e4e7c85be4aa2b564311716eaf21c4b05d0bf54 | Python | jscho12/Openstreetmap | /audit.py | UTF-8 | 4,356 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# Taken from Udacity's Case Study
import xml.etree.cElementTree as ET
import pprint
import re
import codecs
from collections import defaultdict
OSMFILE = ("Bohemia.osm")
street_type_re = re.compile(r'\b\S+\.?$', re.IGNORECASE)
expected = ['Avenue', 'Bridge', 'Boulevard', 'Cir... | true |
74684530c572312b7c63e5b02c529614f005b4b1 | Python | hoklavat/beginner-python | /26_Iterator.py | UTF-8 | 472 | 4.78125 | 5 | [] | no_license | #26- Iterator
my_list = [1, 2, 3, 4, 5, 6, 7]
for element in my_list:
print(element)
#Iterator
my_iter = iter(my_list)
print(type(my_iter))
print(next(my_iter))
#Generator Function
def my_gen(x, y):
for i in range(x):
print("i is %d" % i)
print("y is %d" % y)
yield i % y
my_object = ... | true |
403202efbe182b57b8759900b51ecb066b036e47 | Python | peraktong/LEETCODE_Jason | /636. Exclusive Time of Functions.py | UTF-8 | 741 | 2.828125 | 3 | [] | no_license | class Solution:
def exclusiveTime(self, n: int, logs: List[str]) -> List[int]:
# one way + stack ?
ans = [0] * n
stack = []
pre = 0
for log in logs:
num, ty, time = log.split(":")
time = int(time)
num = int(num)
if ty == "start... | true |
034fcf0d0d29d7bd7deef3c09d2fd38f2d502312 | Python | R-Stefano/betse-ml | /betse/gui/interact.py | UTF-8 | 1,987 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
# Copyright 2014-2019 by Alexis Pietak & Cecil Curry.
# See "LICENSE" for further details.
import matplotlib.pyplot as plt
class PolyPicker(object):
"""
Allows the user to interactively select cell polygons from a graph.
Once selected, polygons turn bright blue.
The process is ... | true |
688fa38e0652e1f22516987964058b9a9f7962dc | Python | zhouf1234/untitled3 | /python的xml模块.py | UTF-8 | 555 | 3.03125 | 3 | [] | no_license | import xml.etree.ElementTree as ET
tree = ET.parse('data.xml')
root = tree.getroot()
# 读取xml内容
print(root.tag)
for child in root:
print(child.tag, child.attrib, child.attrib['name'])
print()
# 修改xml 内容
for node in root.iter('year'):
# print(node.tag, node.text)
new_year = int(node.text) + 10
node.tex... | true |
ff1bc9cf7d63e2eca101d0a72ca0c49af6af9da4 | Python | hhabibullah/General-Python | /if_else.py | UTF-8 | 214 | 3.8125 | 4 | [] | no_license |
x = int(raw_input('Enter the number'))
r = x%2
if r==0:
print('Even')
if x>5:
print('you are great')
else:
print('You are not great')
else:
print('odd')
print('Have a nice time')
| true |
5b8b180aa1e109a1ae361216f63f3d8107d4faab | Python | zhangzhiyong111/word2vecDemo | /preProcess.py | UTF-8 | 1,552 | 2.75 | 3 | [] | no_license | #encoding="utf-8"
#!/usr/bin/env python
import sys
import jieba
import json
import re
import unicodedata
reload( sys )
sys.setdefaultencoding( "utf-8" )
"""
# This is the preproces for the word2vec training
# the input the format like this : {"content":"we just use the number","time":"2016-10-01","websiteId":"32547... | true |
9cd104da71690a9d7e6453868c0c3b253bdb61e4 | Python | chintu0019/DCU-CA146-2021 | /CA146-test/markers/picker.py/picker.py | UTF-8 | 398 | 3.90625 | 4 | [] | no_license | #!/usr/bin/env python3
a = int(input())
b = int(input())
c = int(input())
print((1 + c) % 2 * a + c % 2 * b)
# | | | |
# ----------- -----
# A B
#
# Expressions A and B both use modulus two.
#
# One of them will be 0, and the other will be 1.
#
# Multiplying by 0 make... | true |
1d4495896906815d4295dc0bbc62ad621fde8a78 | Python | yaroslavshtogun/Intorduction-to-Python-and-Data-Science | /testModule.py | UTF-8 | 581 | 3.875 | 4 | [] | no_license |
# User-Defined Function with one parameter
def fahrenheitToCelsius(t):
return (5/9)*(t - 32)
# User-Defined Function with several parameters
def futureValue(p, r, m, t):
## Find the future value of a savings account deposit
# p - principal, the amount deposited
# r - annual rate of interest i... | true |
51f2953492e72a4e797957fb04913793367d5e42 | Python | ntthanhdat/Machine-Learning-PRJ | /calculator.py | UTF-8 | 1,148 | 2.953125 | 3 | [] | no_license | import pandas as pd #Data manipulation
from sklearn import linear_model
import numpy as np #Data manipulation
import matplotlib.pyplot as plt # Visualization
import os
plt.rcParams['figure.figsize'] = [8,5]
plt.rcParams['font.size'] =14
plt.rcParams['font.weight']= 'bold'
#path ='dataset/'
path = 'datafull.csv'
datas... | true |
1a5386f016cc62a1c244f34cf649064f554582de | Python | Djcoldcrown/unfinished-natsim-code | /attack_scripts/Ground_attack.py | UTF-8 | 2,136 | 3.859375 | 4 | [
"BSD-2-Clause"
] | permissive | import random
import sqlite3
def ground_attack(nat1_name, nat2_name, nat1_soldiers, nat2_soldiers):
#TODO: get nation names from DB, get amount of soldiers from DB,add tanks to script,add infra damage
random_roll_nat1 = random.randint(1, nat1_soldiers)
random_roll_nat2 = random.randint(1, nat1_soldie... | true |
b0a848b77ba1ebb9ef6893952d1fab848c86f7b8 | Python | JohanOsinga/NCAP-Video-Analyser | /ncap_video_analyser.py | UTF-8 | 21,140 | 2.625 | 3 | [] | no_license | """ncap_video_analyser.py
"""
from __future__ import division
import math
import time
from tkFileDialog import askopenfilename
from Tkinter import *
from PIL import Image, ImageTk
import cv2
import numpy as np
import matplotlib.pyplot as plt
class NCAPVideoAnalyser(object):
"""NCAPVideoAnalyser
"""
def _... | true |
3d4b0db9bd6dc80b928ca37a93cfa80c2c75910b | Python | LiHengofChina/_python | /002.Artificial_Intelligence/worspace/month04/day02/08_math_6.py | UTF-8 | 478 | 3.546875 | 4 | [] | no_license | '''
简单的数学指标
标准差
'''
import numpy as np
import pandas as pd
data = pd.read_json('../data_test/ratings.json')
# print(data)
print("================" * 20)
fracture = data.loc['Fracture']
# print(fracture)
#
# pandas的接口 #总体标准差
print(fracture.std())
# numpy的接口中 #样本标准差
print(np.std(fracture... | true |
3393204f54a9bf48e551a7549aff8d35ec644e10 | Python | robinvanleeuwen/bitcoin-api | /portfolio.py | UTF-8 | 3,041 | 2.96875 | 3 | [] | no_license | from pprint import pprint
from setup import get_kraken_api
from log import log
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[cls]
... | true |
e8e6e461b33ed1d4f51d1459bdb96b0a8458e751 | Python | mersibon/glioma-classification | /scripts/losses.py | UTF-8 | 2,517 | 2.78125 | 3 | [] | no_license |
import numpy as np
import tensorflow as tf
import keras.backend as K
# two tensors
def dice(y_true, y_pred):
#computes the dice score on two tensors
sum_p=K.sum(y_pred,axis=0)
sum_r=K.sum(y_true,axis=0)
sum_pr=K.sum(y_true * y_pred,axis=0)
dice_numerator =2*sum_pr
dice_denominator =sum_r+sum_... | true |
c51c4e7afa7a710cbe81fc256cce69993cb2d8e0 | Python | amal7654/assignment-fun | /ass4.py | UTF-8 | 163 | 3.765625 | 4 | [] | no_license | values=10
result=list(map(lambda x:2**x,range(values)))
print("thr total values are:",values)
for i in range(values):
print("2 raised to power",i ,"is",result[i]) | true |
5932891fff6c899e5d70029a5ddf9468832ca385 | Python | JudaCol/2E-LIRP_Model-Genetic-Solution | /functions.py | UTF-8 | 16,146 | 3.21875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import openpyxl as px
# Funcion para lectura y obtencion de datos de inicio
# La funcion devuelve la demanda de los clientes, capacidad de los vehiculos de primer nivel y segundo nivel, capacidad de los centros locales y regionales
def read_data(n_clientes, n_product... | true |
908fe987617bebe9c59a5c9f436879d70b28ed61 | Python | franjagon/AprendiendoGitHub | /M1_P05tf_Prof.py | UTF-8 | 894 | 4.3125 | 4 | [] | no_license | # Modulo 1 - Programa con lista de True/False 5 de Ramón Maldonado (que no funciona... ver 'arara' y 'arrar')
def isAnagramEle(p1, p2):
ListaComparacionLetras = []
if len(p1) == len(p2):
for caracter1 in p1:
noPongasFalse = False
for caracter2 in p2:
if cara... | true |
625525b043d337b00976c0b763bd14e6b820d327 | Python | zweed4u/rotate_left | /rot_left.py | UTF-8 | 1,114 | 4.4375 | 4 | [] | no_license | #!/usr/bin/python3
# https://www.hackerrank.com/challenges/ctci-array-left-rotation/problem
def rotLeft(a, d):
"""
a: List[int]
d: int - number of times to rotate
ie. 4 & [1,2,3,4,5] -> [2,3,4,5,1] -> [3,4,5,1,2] -> [4,5,1,2,3] -> [5,1,2,3,4]
"""
new_a = []
length_of_array ... | true |
ce858ae781fba3a91f1557f73e707b2cba562fbc | Python | google/pytype | /pytype/tests/test_operators3.py | UTF-8 | 969 | 2.71875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | """Test operators (basic tests)."""
from pytype.tests import test_base
from pytype.tests import test_utils
class ConcreteTest(test_base.BaseTest,
test_utils.OperatorsTestMixin):
"""Tests for operators on concrete values (no unknowns)."""
def test_div(self):
self.check_expr("x / y", ["x=1"... | true |
7a392302e8b1c2409ff0b6985751f6ec0f59928c | Python | JonasSinjan/PlasmaUROP | /090918final.py | UTF-8 | 11,405 | 2.640625 | 3 | [] | no_license | import numpy as np
from scipy.constants import m_e, eV, m_p
from scipy.integrate import dblquad
import matplotlib.pyplot as plt
import scipy as sp
from scipy.optimize import curve_fit
from mpl_toolkits.mplot3d import Axes3D
T_e = 1 * eV
v_te_sqr = 2 * T_e / m_e
cs = np.sqrt(eV / m_p) # cold bohm speed for 1... | true |
34b43c8b0d969c65419a2a7b2d7083f87b0a1de4 | Python | leeiopd/algorithm | /2022/python/211122_algospot_JOSEPHUS.py | UTF-8 | 274 | 3.21875 | 3 | [] | no_license | C = int(input())
for _ in range(C):
N, K = map(int, input().split())
alive = [x + 1 for x in range(N)]
kill = 0
while len(alive) > 2:
del alive[kill]
kill = (kill + K - 1) % len(alive)
print(*alive) # print(" ".join(map(str, alive)))
| true |
2a79224b717cf5d189b986c0a03f670332c8f151 | Python | Caleydo/taco_server | /taco_server/src/generator.py | UTF-8 | 1,680 | 3.125 | 3 | [] | permissive | import numpy as np
import random
__author__ = 'Reem'
# creates an array with random float values within a range with size
def random_floats_array(low, high, size):
return [random.uniform(low, high) for _ in range(size)]
# creates an array with random int values within a range with size
def random_int_array(low, ... | true |
b2a1fedcaf9107a787ad9763e250f1d053cda4bd | Python | Danielauler/spotify_py | /spotify/playlist/tests/test_models.py | UTF-8 | 2,520 | 2.53125 | 3 | [
"MIT"
] | permissive | # coding=utf-8
from django.test import TestCase
from model_mommy import mommy
from django.utils.timezone import datetime
from playlist.models import Record, Genre, Band, Music, Playlist
class TestRecord(TestCase):
def setUp(self):
self.record = mommy.make(Record, name='Sony Music')
def test_re... | true |
2b67ebb9b58fdd9a8ca73bc6acb89367a040b9b4 | Python | managorny/python_basic | /homework/les06/task_5.py | UTF-8 | 1,675 | 4.28125 | 4 | [] | no_license | """
5. Реализовать класс Stationery (канцелярская принадлежность).
Определить в нем атрибут title (название) и метод draw (отрисовка).
Метод выводит сообщение “Запуск отрисовки.”
Создать три дочерних класса Pen (ручка), Pencil (карандаш), Handle (маркер).
В каждом из классов реализовать переопределение метода draw.
Для... | true |
f2d207594f01db90d4f7a808f99c4894ba3ce459 | Python | Shamyukthaaaa/Python_assignments | /books_dict.py | UTF-8 | 821 | 3.6875 | 4 | [] | no_license | books=dict()
num=int(input("Enter the number of items to be added: "))
for i in range(num):
animals[input("Enter book {}: ".format(i+1))]=input("Enter author {}: ".format(i+1))
print(animals)
#update method
books.update({'Wings of Fire':'A.P.J. Abdul Kalam'})
print(books)
#copy method
books_copy=books.copy... | true |
a0e9c64ce56e596456be16b2e490b71ee6916736 | Python | Atlas8008/brainfuck-transpiler | /interpreter/state.py | UTF-8 | 844 | 3.140625 | 3 | [
"MIT"
] | permissive | from .getch import getch
class State:
def __init__(self):
self.tape = [0]
self.index = 0
self.neg_offset = 0
def r(self):
self.index += 1
if self.neg_offset + len(self.tape) - 1 < self.index:
self.tape.append(0)
def l(self):
self.index -= 1
... | true |
861ea8fafabd3e6ca7be68bbc5cfdcdf4f22d299 | Python | arsezzy/python_base | /lesson2/lesson2_5.py | UTF-8 | 894 | 3.78125 | 4 | [] | no_license | #!/usr/bin/python3
rating = [7, 5, 5, 3, 3]
print(f'current rating is {rating}')
again_input = 'y'
while again_input.startswith('y'):
try:
new_position = int(input('Please enter a new natural value:\n'))
except ValueError:
print('you did not enter natural value')
new_position = 0 ... | true |
701dde97143e6646e419ec0aa8858d46982e1041 | Python | little-endian-0x01/Practice-Questions | /Random/RotateMatrix/Code.py | UTF-8 | 1,475 | 3.765625 | 4 | [] | no_license | # Author - Shivam Kapoor
# This code is written as minimal as possible.
import math
# Taking inputs.
dimension = int(input("Please Enter the number of rows/columns: "))
# Initializing the matrix.
Matrix = [[0 for x in range(dimension)] for y in range(dimension)]
# Taking inputs in matrix.
for i in range(dimension):
... | true |
01a72dfaa2435c3ac2e03507c580d54e46290437 | Python | cotarelorodrigo/crypto-telegram-bot | /handler_functions.py | UTF-8 | 1,409 | 2.640625 | 3 | [] | no_license | from dotenv import load_dotenv
import urllib.request
import requests
import json
import os
load_dotenv()
LUNACRUSH_API_KEY = os.environ.get("LUNACRUSH_API_KEY")
def help(update, context):
context.bot.send_message(chat_id=update.effective_chat.id, text="Aca van los comandos que tiene el bot")
def get_coin_info(co... | true |
342a7e91240e0fd7fbe69555e098d6bf3a9cb992 | Python | pilgrim2go/aws-ec2-cloudflare-lambda | /cloudflare.py | UTF-8 | 796 | 2.5625 | 3 | [
"MIT"
] | permissive | # Testing Cloudflare API Use Case
import requests
import os
cf_email = os.getenv('CLOUDFLARE_EMAIL')
cf_api_key = os.getenv('CLOUDFLARE_API_KEY')
cf_zone_id = os.getenv('CLOUDFLARE_ZONE_ID')
cf_dns_id = os.getenv('CLOUDFLARE_DNS_ID')
arecord_name = "cdemo.cybr.rocks"
ip_address = "54.243.159.71"
url = 'https://api.c... | true |
1d9b7688aa9463c95e8f2b704db4cddc17f2557b | Python | MatthewNg20/MatthewNg20.github.io | /Decision_Tree.py | UTF-8 | 3,309 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 26 21:33:41 2021
@author: Matthew
"""
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn import metrics
from sklearn.tree import plot_tree
hf... | true |
1bee69aa247178e00462cf0f9cf268c1126f1170 | Python | shrey920/IT200-DSA | /lab11/p3.py | UTF-8 | 589 | 3.53125 | 4 | [] | no_license | def main():
n=int(input("Enter n:"))
print("Enter the numbers: ")
A=[0]*n
for i in range(n):
A[i]=int(input())
quickSort(A,0,n)
print("The sorted list is: ",A)
def quickSort(A,low,high):
if low<high-1:
quickSort(A,low,p)
quickSort(A,p,high)
merge(A,low,p,high)
def merge(A,low,mid,high):
a=A[low:m... | true |
a05fa198cc2ce265edca087302ca20fdcce81d36 | Python | ashirbadomm/pythonformoodle | /ex5.py | UTF-8 | 576 | 3.5 | 4 | [] | no_license | import os
import time
from threading import Thread
def pingcheck(counter,ip):
counter+=1
print ("In thread no "+str(counter)+" pinging "+ip)
response=os.system("ping -c 1 " + ip)
if response==0: print(ip,"is active")
else: print (ip,"is inactive")
print ("Sleeping for 5 secs")
time.sleep(5)... | true |
cba474da060e5b42562af15044e5722f5fffd444 | Python | sandyaganesh/variant-filtering | /models.py | UTF-8 | 3,904 | 3.171875 | 3 | [
"CC0-1.0"
] | permissive | # This file is for functions that apply the filters to the families based on
# the different inheritance models (ar, xl, xldn, ch, addn, ad)
# where:
# ar: autosomal recessive
# xl: x-linked
# xldn: x-linked de novo
# ch: compount heterozygous
# addn: autosomal dominant de novo
# ad: autosomal dominant
# The functions... | true |
d7245dc739e8454ee58f3d627ba9ebe8de9d3e9e | Python | Nokorot/PythonGeneral | /Snake/options.py | UTF-8 | 899 | 2.71875 | 3 | [] | no_license |
import pygame
from sprite import ShitFromFile
#scolor = (0,255,0)
snakes = {}
snake = None
dificolty = 1
def color_replace(surface, find_color, replace_color):
s = surface # surface.copy()
for x in range(s.get_size()[0]):
for y in range(s.get_size()[1]):
if s.get_at([x, y]) == find_color... | true |
3deee457d2407fa7dfa6d4db450b55f1bfcc1489 | Python | John-Nagle/Overbot | /gc/src/qnx/drivers/lms/tests/python/readscanline.py | UTF-8 | 3,089 | 2.9375 | 3 | [] | no_license | #
# readscanline.py -- read one LIDAR scan line from a log file
#
#struct LidarScanLineHeader {
# uint64_t m_timestamp; // CLOCK_REALTIME, in nanoseconds
# float m_tilt; // tilt angle of unit. 0=straight down, pi/2=straight ahead
# uint8_t m_sensorid; // which LMS (future expansion)
# uint8_t m_statusB... | true |
75c7b2a19257c2d4d117b36c0323a9f7bfd5975a | Python | pvthinker/Nyles | /tools/movietools.py | UTF-8 | 4,092 | 3.203125 | 3 | [
"MIT"
] | permissive | import subprocess
import os
devnull = open(os.devnull, 'wb')
class Movie():
""" Home made class to generate mp4 """
def __init__(self, fig, name='mymovie', framerate=30):
""" input: fig is the handle to the figure """
self.fig = fig
#dpi = fig.get_dpi()
canvas_width, canvas_he... | true |
b96889e75885059a3f5a55e4e382be38125a6530 | Python | hoidn/viachallenge | /db.py | UTF-8 | 2,381 | 2.59375 | 3 | [] | no_license | import numpy as np
import sqlite3
import cPickle
dbmap = {'connection': None, 'cursor': None}
def create_events():
sql_command = """
CREATE TABLE events (
time VARCHAR(50),
type VARCHAR(10),
medallion VARCHAR(35));"""
dbmap['cursor'].execute(sql_command)
def insert_events(events):
curso... | true |
595f9fa3698008c44c3f8bbe23b00f3558b4d091 | Python | AngusWG/simple-event-bus | /simple_event_bus/core/async_event_bus.py | UTF-8 | 1,567 | 2.703125 | 3 | [
"MIT"
] | permissive | # encoding: utf-8
# @Time : 2021/8/4 12:04
# @author : zza
# @Email : z740713651@outlook.com
# @File : async_event_bus.py
import inspect
from typing import Callable, Union
from simple_event_bus.core.event import EVENT_TYPE, Event
from simple_event_bus.core.event_bus import EventBus
class AsyncEventBus(EventBus)... | true |
197623a5e2e2189c315c886ffce8ae797a944cf2 | Python | txdevops/Exe_decompile_poc | /decom.py | UTF-8 | 2,294 | 2.953125 | 3 | [
"MIT"
] | permissive | import glob, os, time, difflib, re
import pandas as pd
from subprocess import check_output
def exe_scanner_creation(filename):
global exe_files_list
exe_files_list = []
if glob.glob("dist/{}.exe".format(filename)):
for fn in glob.glob("dist/{}.exe".format(filename)):
exe_files_list.app... | true |
4cfbd0e97b69ed6e0b4ab895479081813c5e5809 | Python | amisolanki/assignments | /assignment1/pro13.py | UTF-8 | 567 | 3.515625 | 4 | [] | no_license | print("This program illustrate the difference between Raw string and Normal string")
print("*****************************************************************")
print("The below line demostrate the example of \"normal string\"")
print("*****************************************************************")
print("Ami:\\sola... | true |
90269b464af97d18add6c4bcae7ab4159ee62220 | Python | Chaminou/stupidity | /generateur.py | UTF-8 | 3,440 | 2.703125 | 3 | [] | no_license |
import tqdm
import pickle5 as pickle
import random
import pyspiel
import numpy as np
import tensorflow as tf
import copy
from open_spiel.python import rl_environment
from open_spiel.python.algorithms import dqn
from open_spiel.python.algorithms import random_agent
import parameters
def eval_against_random_bots(env,... | true |
6c8e07447a0ccc26d823bc5d122ea684ce4c34dd | Python | BbChip0103/dacon_kooro_news_crawler | /nlp2cnt.py | UTF-8 | 512 | 2.578125 | 3 | [] | no_license | #-*-coding: utf-8
from collections import Counter
from konlpy.tag import Okt
FONT_PATH = '/usr/share/fonts/truetype/nanum/NanumBarunGothic.ttf'
with open('donga_corona.txt', 'r') as f:
text = f.read()
spliter = Okt()
nouns = spliter.nouns(text)
nouns = [word for word in nouns if len(word) >= 2]
# stop_words = ... | true |
8a5b10e8ea1c88f06ae917ca593fd9359e9f34e4 | Python | sheiny/Automata | /Automata.py | UTF-8 | 4,508 | 3.09375 | 3 | [] | no_license | import sys, getopt
# Function to open the file that contains the description of
# the Automata
def openfile(argv):
fileToUse = 'Automata.txt'
try:
opts, args = getopt.getopt(argv,"hi:o:",["ifile="])
# print("opts; ", opts)
except getopt.GetoptError:
# print ("Error: unknow input file")
return fileToUse
#... | true |
aeab9e629c0557692d6755a77e5ee0bfe7118401 | Python | kikei/asin-jan-converter | /src/main.py | UTF-8 | 1,439 | 2.671875 | 3 | [
"MIT"
] | permissive | import getopt
import sys
import jancode
import amazon
import yahoo
import cache
import identifiers
def usage():
script = 'main.py'
print('''Usage: {script} [options] <command> [<args>]
Options:
-h, --help Display this help.
Following commands are supported. See {script} <command> --help to show more detail.... | true |
c644ed8e0f28be79f3922c03d8e608a6795d1d9b | Python | fflores97/Rational-Matrix-Machines | /rmm/.ipynb_checkpoints/rmm_utils-checkpoint.py | UTF-8 | 4,256 | 3.171875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import os
from rmm import rmm_plot
def complex_mesh(real, imaginary):
"""
Function takes in arrays of real and imaginary values
and returns a meshgrid of complex numbers
"""
XX, YY = np.meshgrid(real,imaginary)
Z = (XX + 1j*YY).flatten()
... | true |