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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
16b60954ed5364a8f89003a9df00db7e15d58325 | Python | AshwinCS/Game | /modules/button.py | UTF-8 | 4,725 | 3.140625 | 3 | [] | no_license | """Module for the button class and the button set."""
import logging
import pygame as pg
from . import screen as sc
class ButtonSet(object):
"""Class to interact with a set of buttons at the same time."""
def __init__(self, buttons):
"""Set instance variables."""
self.buttons = buttons
... | true |
8b43662b1e26a5cab30e732e15d718f11978ba2b | Python | NimraSadaqat/events_calendar | /calender_app/models.py | UTF-8 | 841 | 2.609375 | 3 | [] | no_license | from djongo import models
# Create your models here.
class Event(models.Model):
title = models.CharField(max_length=200)
# description = models.TextField()
start_time = models.DateField()
year = models.CharField(max_length=5, blank=True)
month = models.CharField(max_length=5, blank=True)
day = ... | true |
4c727349ce73e8509bd6816d21e5df3a79b912e5 | Python | nsabine/ose_scripts | /docker_list_images.py | UTF-8 | 553 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
try:
# For Python 3.0 and later
from urllib.request import urlopen
except ImportError:
# Fall back to Python 2's urllib2
from urllib2 import urlopen
import json
def get_jsonparsed_data(url):
"""Receive the content of ``url``, parse it as JSON and return the
object.... | true |
647c5180eb8a58114f7293f24d12940d766518a7 | Python | Dmitry-15/10_laba | /Zadaniy/zadanie2.py | UTF-8 | 750 | 4.15625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
def cylinder():
def circle():
return math.pi * r ** 2
r = float(input("Введите радиус: "))
h = float(input("Введите высоту: "))
answer = input("Хотите получить 1) площадь боковой поверхности цилиндра,"
" или 2) пол... | true |
afdebff1ebcc5aa8b3302ad9c1a32ee7c5283dc7 | Python | openGDA/gda-diamond | /configurations/i20-config/scripts/xes/setOffsets.py | UTF-8 | 2,460 | 2.5625 | 3 | [] | no_license | from BeamlineParameters import JythonNameSpaceMapping
#
# This script will change the offsets for the motors in the spectrometer, based on supplied values from the user.
#
def setFromExpectedValues(expectedValuesDict):
"""
Using the supplied dictionary of expected motor positions, this calculates the require... | true |
e1b80ed0979e41efd603abb1e7b073bb7f6ee16d | Python | H-H2648/Deep-Dream | /VGG.py | UTF-8 | 968 | 2.65625 | 3 | [] | no_license | from collections import namedtuple
import torch
import torch.nn as nn
from torchvision import models
#These corresponds to the layer conv1_1, conv2_1, conv3_1, conv4_1, conv5_1
focusConv = ['0', '5', '10', '19', '28']
#use gpu
device = torch.device("cuda:0" if torch.cuda.is_available else "cpu")
class VGGModel(nn.Mod... | true |
698c7984b18132f442885026bfddbe79c757c0d9 | Python | acaciooneto/cursoemvideo | /aula-15-pratica.py | UTF-8 | 484 | 3.875 | 4 | [] | no_license | cont = soma = 0
while cont <= 10:
print(cont, '-> ', end='')
cont += 1
print('Acabou')
while True:
num = int(input('Digite um número: '))
if num == 0:
break
soma += num
#print('A soma vale {}.'.format(soma))
print(f'A soma vale {soma}') #f'string, veio depois do python 3.6 e substitui o .fo... | true |
de1cfee24a8a79f5249d8b2b79dbb94375e7838b | Python | ESA-PhiLab/hypernet | /beetles/scripts/multispectral/run_multispectral_experiments.py | UTF-8 | 3,466 | 2.8125 | 3 | [
"MIT"
] | permissive | import clize
import pandas as pd
from ml_intuition.data.io import save_ml_report
from scripts.multispectral.train_classifier import train_and_eval_classifier
from scripts.multispectral.train_regression import train_and_eval_regression
def run_experiments(*,
dataframe_path: str,
... | true |
30930b547b83c5cc4f118e0f1977fad0946f03d2 | Python | Ihyatt/fandor_challenge | /server.py | UTF-8 | 2,611 | 2.875 | 3 | [] | no_license | """Fandor Challenge"""
import os
from jinja2 import StrictUndefined
import psycopg2
from model import Movie, Ratings, connect_to_db, db
from flask import Flask, render_template, redirect, request, flash, session, jsonify
from flask_debugtoolbar import DebugToolbarExtension
from operator import attrgetter
import oper... | true |
d07090a1fd16de9966221b178fe9d6ada3536198 | Python | KardeslerSporSalonuUygulamasi/SporSalonu | /PythonScripts/main.py | UTF-8 | 1,057 | 3.171875 | 3 | [
"BSL-1.0"
] | permissive | import sys
class Uyeler:
salonAdi="Kardeşler Spor Salonu"
def __init__(self, Id, adSoyad, yas, kilo, dogumTarihi):
self.Id = Id
self.adSoyad = adSoyad
self.yas = yas
self.kilo = kilo
self.dogumTarihi = dogumTarihi
def yazma(self):
liste = [str(self.Id),"\... | true |
31ad1ea1fc59feee866627878bc151894583a79b | Python | cl-conway/AGN-code | /make_sinusoid_data.py | UTF-8 | 4,572 | 2.65625 | 3 | [] | no_license | """
Description:
File to produce data files of sinusoids that have the same time stamps of PG1302-102
with different error bars. This is to be used be julia CARMA in order to test whether
periodic can be found.
"""
import math
import pandas as pd
import numpy as np
User= 'C'
using_fake_errors= False
if... | true |
6ea633f37f5d48e9ca0d78f9c1ac948dbf532424 | Python | TTwelves/Data-structure-and-algorithm | /14.最长公共前缀.py | UTF-8 | 709 | 3.3125 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=14 lang=python3
#
# [14] 最长公共前缀
#
# @lc code=start
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
# max和min函数不能用于空的字符串,所以首先判断是否为空
# if not: 等价于 if strs is NONE:
if not strs:return ""
# 选出一个最小的字符串和一个最大的字符串,相互比较
# 此处的最大和最小字母是按... | true |
9ef18c7de5bbac0c73a9a7542fe627945a232bfe | Python | Yashg19/enrique | /testcases/tet_gui.py | UTF-8 | 7,174 | 2.734375 | 3 | [] | no_license | from PyQt4.QtGui import *
from PyQt4.QtCore import *
import pandas as pd
from functools import partial
import magellan as mg
from collections import OrderedDict
class DataModel():
def __init__(self, df):
self.dataframe = df
def getDataFrame(self):
""" Returns reference to the dataframe.
... | true |
cf1be284f3e04209ac8cdea7b5e51551df512b5a | Python | noegodinho/EC | /TTP/CycleCross.py | UTF-8 | 2,586 | 3.4375 | 3 | [] | no_license | import random
def cycle_cross(indiv_1,indiv_2,prob_cross):
size = len(indiv_1[0])
value = random.random()
positions = [0]*size
crosses = []
if value < prob_cross:
while(sum(positions)<size):
#get first unocupied place
i = getUnocupied(positions)
temp1 = [... | true |
53af02d96030a8c733174cd01d92512c6c6a35e3 | Python | pstreich/Gesichtserkennung | /Raspberry Pi Quellcode/prozess2.py | UTF-8 | 2,472 | 2.859375 | 3 | [] | no_license | #Bibliotheken einbinden
import RPi.GPIO as GPIO
import sys
import time
import datetime
import numpy as np
import gspread
import oauth2client.client
import json # zum Einlesen der Google Zugangsdaten aus entsprechender Datei
import cPickle
#json Dateiname fuer Google Zugangsdaten
JSON_FILENAME = 'pitest-c7f0752... | true |
6545b45b926c8d154a7c39e617a00dc8e7d131d2 | Python | ReWKing/StarttoPython | /操作列表/创建数值列表/动手试一试/4-6 奇数.py | UTF-8 | 158 | 3.1875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding:utf-8 -*-
# Author:William Gin
single_numbers = list(range(1, 21, 2))
print(single_numbers)
for i in single_numbers:
print(i)
| true |
2700a64075fd3999e6b7f1f2a4f4309adef2a04b | Python | charlierkj/Gradient-Health-Project | /train.py | UTF-8 | 2,154 | 2.546875 | 3 | [] | no_license | import tensorflow as tf
import tensorflow_datasets as tfds
def preprocess(feature):
image, label = feature["image"], feature["label"]
image = tf.cast(image, tf.float32)
image = image / 255
shape = tf.shape(image)
h, w = shape[0], shape[1]
ratio = w / h
if ratio >= 1:
image = tf.image.resize(image, ... | true |
d1e4515dc066a8e1bf27395801317e579217a88e | Python | SpatialDays/csvs-enso-server | /src/ensoserver/domain/services.py | UTF-8 | 2,046 | 2.796875 | 3 | [] | no_license | import logging
from datetime import datetime
from typing import Tuple, List
import requests
from ensoserver.config import enso_invalid_value, LOG_LEVEL, LOG_FORMAT
from urllib3 import HTTPResponse
logging.basicConfig(level=LOG_LEVEL, format=LOG_FORMAT)
logger = logging.getLogger(__name__)
def download_enso_values(... | true |
de168f084fcd182b2aff9f6c606c13fdce7ccb04 | Python | RLBat/CMEECourseWork | /Week2/Code/using_name.py | UTF-8 | 499 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
""" Shows how to distinguish between the module being run directly or called from another module """
__author__ = 'Rachel Bates r.bates18@imperial.ac.uk'
__version__ = '0.0.1'
## IMPORTS ##
# None
## CONSTANTS ##
# None
## FUNCTIONS ##
# None
###############
if __name__ == '__main__': ... | true |
43cdc856f2f80c5de08850d9db2307a823ea43de | Python | slowrunner/Carl | /Examples/imu/di_BNO055/di_code/di_easy_inertial_measurement_unit.py | UTF-8 | 9,491 | 2.828125 | 3 | [] | no_license | # https://www.dexterindustries.com
#
# Copyright (c) 2018 Dexter Industries
# Released under the MIT license (http://choosealicense.com/licenses/mit/).
# For more information see https://github.com/DexterInd/DI_Sensors/blob/master/LICENSE.md
#
# EASIER WRAPPERS FOR:
# IMU SENSOR,
# LIGHT AND COLOR SENSOR
# TEMPERATURE... | true |
55682f5562b715c8b8481602d3c89eecee3e1078 | Python | joaojunior/data_structures_and_algorithms | /python_implementations/tests/algorithms/test_insert_sort.py | UTF-8 | 585 | 3.359375 | 3 | [
"MIT"
] | permissive | import random
import pytest
from algorithms.sorting.insert_sort import InsertSort
@pytest.fixture
def insert_sort():
return InsertSort()
def test_array_already_sorted_asc(insert_sort):
items = [0, 1, 2, 3, 4]
insert_sort.sort(items)
assert list(range(5)) == items
def test_array_sorted_desc(inse... | true |
601ecb3cd29091911203fba9daaf77e7840dd589 | Python | xuruyi136/py1 | /HttpRequest.py | UTF-8 | 1,472 | 2.921875 | 3 | [] | no_license | import requests
import abc
'''
请求方法抽象类
'''
class AbsMethod:
@abc.abstractmethod
def request(self, url, attach):
pass
'''
Get 方法
'''
class Get(AbsMethod):
'''
请求
'''
def request(self, url, attach) -> requests.Response:
res = requests.post(url, attach)
if not res.o... | true |
1ba84d888a60206c1484f3490d28bc7f6588a6f6 | Python | iamani123/ML1819--task-104--team-15 | /Phase-2/Normalisation_Standardisation.py | UTF-8 | 830 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 29 04:50:52 2018
@author: advancerajat
"""
import numpy as np
newX=np.zeros((30000,23))
X=np.genfromtxt('credit_card.csv', delimiter = ',',usecols=(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23))
#min1=np.min(X, axis=0)
##max1=np.max(X, axis=... | true |
a07f46dbc91965e2fa88319d943faf391c89944f | Python | ZSerhii/Beetroot.Academy | /Homeworks/HW7.py | UTF-8 | 1,246 | 4.8125 | 5 | [] | no_license | print('Task 1. Dict comprehension exercise.\n')
print('''Make a program that given a whole sentence (a string) will make a dict
containing all unique words as keys and the number of occurrences as values.
''')
print('Result 1:\n')
vSentence = 'Verbs like Put - Put - Put no change'
vDict = {vKey : vSentence.split()... | true |
39607dc92e188ce36fc1fd6f7f67065d86d1d5e1 | Python | cooperbaerseth/STAM_exp1 | /exp1_mnist_stam.py | UTF-8 | 8,005 | 2.671875 | 3 | [] | no_license | from __future__ import print_function
import random
from keras.datasets import mnist
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sn
import pandas as pd
plt.interactive(True)
def accuracy_eval(progress):
correct = 0.0
for i in range(0, progress):
if x_clusterInd[i] == y_trai... | true |
c88f457ca71e8697fbf8cb664e4e98d395203736 | Python | caro-01/leccion-03-python-tipos-variables-expresiones | /practica.py | UTF-8 | 86 | 3.171875 | 3 | [] | no_license | # Hilera "Hola mundo"
print("Hola Mundo")
print("Hola América")
print("Hola Costa Rica") | true |
5bba5d5605c57c7349e335c0bb58a5ad3d53b152 | Python | Vinceeee/mypy | /mutiltasking/multiprocessing_sample.py | UTF-8 | 1,528 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 多进程的优点
# - 避免全局线程锁,进程可控制
# 多进程的缺点
# - 消耗内存,跨进程访问较麻烦
import multiprocessing
from random import randint
import time
from os import getpid
def run(instance,func_name):
"""
这特么蛋碎的东西
一定要最顶层才能够被pickled
不然就不能执行对象方法
"""
func = getattr(instance,func_name... | true |
3981e979d7950cf734766af2f4c24aafc9245d68 | Python | shreya-chow/FinalProject | /finalproj_test.py | UTF-8 | 3,001 | 2.625 | 3 | [] | no_license | from finalproj import *
import unittest
class GetDataTests(unittest.TestCase):
def testYelpGetData(self):
table()
g_id = getgoogledata("48104")
y_data = getyelpdata(g_id)
self.assertEqual(type(y_data), list)
self.assertEqual(type(y_data[8]), dict)
self.assertTrue("... | true |
2d54d6ef6fd87412443137c292d002e2cf220e06 | Python | rxharja/taxonomic_protein_analysis | /app/tools.py | UTF-8 | 7,688 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
import subprocess,os
from app.ld_json import Ld_json
from app.splitter import Splitter
#This is our swiss army knife class. I went back and forth on structuring these methods defined in this class but decided on just putting them all into one class called tools because that would have been too m... | true |
aca05b63fa7f5048ecd6348315034b7f1bc98a30 | Python | joshuahonguyen/algorithm-datastructure-practice | /list_temple.py | UTF-8 | 491 | 3.734375 | 4 | [] | no_license | list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for l in range(0, len(list)):
lol = []
lol2 = []
for n in range(0, l+1):
lol.append(list[n])
for n2 in range(len(list)-1-l, len(list)):
lol2.append(list[len(list)-1-n2])
print(lol2,lol)
for l in range(0, len(list)):
lol3 = []
lol... | true |
0954a0177a4f2c14607724195de90f423139ed2f | Python | XiaoxiaoLiu/pyLAR | /core/ialm.py | UTF-8 | 4,745 | 3.09375 | 3 | [] | no_license | """ialm.py
Implements the inexact Lagrangian multiplier approach (IALM) to solve
the matrix deconvolution problem
\min_{P,C} ||P||_* + \gamma ||C||_1, s.t. ||M-P-C||_{fro} < eps
that was proposed as an approach to solve Candes et al.'s robust
PCA formulation, cf.,
[1] Candes et al., "Robust Principal Component Anal... | true |
b01c1d9d1eb9716771cfb739b424d1f46146e71d | Python | 0xB9/MyBBscan | /version_check.py | UTF-8 | 734 | 2.609375 | 3 | [] | no_license | from huepy import *
import requests
import json
currentVersion = "v3.1.1"
repo = "https://api.github.com/repos/0xB9/MyBBscan/releases/latest"
response = requests.get(repo)
release = json.loads(response.text or response.content)
latestVersion = release["tag_name"]
def checkVersion():
if response.ok:
if latestVersi... | true |
5d834c66a34746d4ff747112b55455e7e449e82d | Python | Shaonianlan/Python_exercise | /python_test/xml_parse/test.py | UTF-8 | 682 | 3.265625 | 3 | [] | no_license | from xml.sax.handler import ContentHandler
from xml.sax import parse
class HeadlineHandler(ContentHandler):
in_handline = False
def __init__(self,headlines):
ContentHandler.__init__(self)
self.headlines = headlines
self.data = []
def startElement(self,name,attrs):
if name == 'h1':
self.in_handline = Tr... | true |
03679184a023e639884230ab4c8d064a055a29dd | Python | lkhamsurenl-zz/research | /HolyImpl/src/model/grid.py | UTF-8 | 16,915 | 3.265625 | 3 | [] | no_license | import copy
from src.model.edge import Edge
from src.model.graph import Graph
from src.model.vertex import Vertex
from src.model.weight import Weight
from src.algorithms.traversal import bfs
__author__ = 'Luvsandondov Lkhamsuren'
class Grid(Graph):
"""
Grid is subclass of Graph with grid structure.
"""
... | true |
79e39d933042f28a788332acbb14710547eed3f9 | Python | bucketzxm/pyquark | /src/io/aio.py | UTF-8 | 631 | 2.578125 | 3 | [
"MIT"
] | permissive | from galileo_config import AIO_MAPPINGS
'''
Aio represents analog IO of Galileo board
'''
class Aio(object):
def __init__(self, arduino_id):
if isinstance(arduino_id, int):
arduino_id = "A%d" % arduino_id
pin = AIO_MAPPINGS[arduino_id]
pin.select()
self.arduino_id = a... | true |
3d7b6c3525ebb38fb260e0fd8d8037b850f04dec | Python | ericwgz/TCSS554A_HW1 | /TCSS554A/processing.py | UTF-8 | 1,107 | 2.9375 | 3 | [] | no_license | from nltk.corpus import stopwords
from nltk.tokenize import RegexpTokenizer
from nltk.tokenize.treebank import TreebankWordDetokenizer
from nltk.stem.snowball import SnowballStemmer
import glob
read_files = glob.glob(".\\transcripts\\transcripts\\*.txt")
# Combine all corpus to single txt file and change char... | true |
9bffe8ab58f0b949ad7bf10a964a50e848f5b913 | Python | philipptrenz/climate-keywords | /scripts/script_pre_assign_files.py | UTF-8 | 2,374 | 2.609375 | 3 | [] | no_license | import argparse
import os
import pandas as pd
def main():
parser = argparse.ArgumentParser(description='Extracts annotations of annotated files')
parser.add_argument('-i', '--in', help='in directory', default="data/evaluation")
parser.add_argument('-s', '--standard', help='in directory', default="data/eva... | true |
389ff1c4c2fd51e2762a93598814cc279908992c | Python | sprax/1337 | /python3/test_l0152_maximum_product_subarray.py | UTF-8 | 266 | 2.71875 | 3 | [] | no_license | import unittest
from l0152_maximum_product_subarray import Solution
class Test(unittest.TestCase):
def test_solution(self):
self.assertEqual(6, Solution().maxProduct([2, 3, -2, 4]))
self.assertEqual(0, Solution().maxProduct([-2, 0, -1]))
| true |
407a01688a3b84768d4e60139984d28881d799dd | Python | sym170030/ML | /Assignment5.py | UTF-8 | 5,725 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[51]:
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 13 19:27:26 2018
@author: Siddharth Mudbidri
"""
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error
import numpy as np
df_path... | true |
49368324baec718a4ad75409fdf4da810a7a55a7 | Python | kisho-stack/Hackathon_semana_7 | /controllers/profesores_controller.py | UTF-8 | 8,285 | 3.296875 | 3 | [] | no_license | from classes.profesor import Profesor
from classes.curso import Curso
from classes.profesor_curso import Profesor_curso
from helpers.menu import Menu
from helpers.helper import print_table, input_data, pregunta
from classes.salon import Salon
from classes.profesor_salon import Profesor_salon
class Profesores_controlle... | true |
2648263fecc606af858550f2715997977e79b91c | Python | lastlegion/SimpleCV-Experiments | /Affine.py | UTF-8 | 798 | 2.6875 | 3 | [] | no_license | import SimpleCV
import math
from PIL import Image
def ScaleRotateTranslate(image, angle, center = None, new_center = None, scale = None,expand=False):
if center is None:
return image.rotate(angle)
angle = -angle/180.0*math.pi
nx,ny = x,y = center
sx=sy=1.0
if new_center:
(nx,ny) = ne... | true |
c5406cc3ee4bbce5780f051e6b2640859fca10b5 | Python | BurakYyurt/Neural_Nets | /input_iris.py | UTF-8 | 980 | 2.5625 | 3 | [] | no_license | from model import NN
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from sklearn import metrics
df = pd.read_csv("iris.data", header=None)
df.columns = [1, 2, 3, 4, "class"]
mapping = {"Iris-setosa": 0, "Iris-versicolor": 1,"Iris-virginica":2}
df = df.replace({"class": mapping})
X = df[[1, ... | true |
410d1bb9d398735965e6e7cc370342c7f52c6c68 | Python | Rubber-Conquest/dfgboat | /food-master/mytestsd(fixed).py | UTF-8 | 4,813 | 2.828125 | 3 | [] | no_license | import telebot
from telebot import types
bot = telebot.TeleBot("944485905:AAHrw7jtHjnAVxqU7GsPS_xrhPPO6fUdiqU")
@bot.message_handler(commands=["start"])
def start(m):
msg = bot.send_message(m.chat.id, "Hello")
keyboard = types.ReplyKeyboardMarkup(resize_keyboard=True)
keyboard.add(*[types.Keyboar... | true |
e8182751ca51bbd98ac24f02c9c0374217a4f478 | Python | zwhubuntu/CTF-chal-code | /geek_localhost.py | UTF-8 | 198 | 2.75 | 3 | [] | no_license | f = open('d:/ip_table2.txt', 'wb')
for i in range(0, 256):
for j in range(0, 256):
strr = "169.254." + str(i) + "." +str(j) + chr(13)
print strr
f.write(strr)
f.close()
| true |
af4ea4cc20f4acaaee928a1885eca5f5ec355c12 | Python | mfojtak/deco | /deco/tokenizers/sentencepiece.py | UTF-8 | 7,732 | 2.78125 | 3 | [
"MIT"
] | permissive | import sentencepiece as spm
import collections
import tensorflow as tf
import codecs
import numpy as np
class SentencepieceTokenizer(object):
"""Runs end-to-end tokenziation."""
def __init__(self, vocab_file, model_file, do_lower_case=True):
self.vocab = self.load_vocab(vocab_file)
self.inv_vocab = {v: k ... | true |
5b73bbc626d610712b752f5bde0633fc3f2e2248 | Python | dimk00z/3_bars | /bars.py | UTF-8 | 2,943 | 3.6875 | 4 | [] | no_license | import json
from os import path
from math import radians, cos, sin, asin, sqrt
def load_bars_from_json(json_file_name):
if not path.exists(json_file_name):
return None
with open(json_file_name, 'r', encoding='cp1251') as file_handler:
json_file = json.load(file_handler)
return json_file
... | true |
8b44fc698202dca5ac57ab229d0f3a06f2f611be | Python | mn113/projecteuler-solutions | /076-100/euler081.py | UTF-8 | 1,743 | 3.703125 | 4 | [] | no_license | #! /usr/bin/env python
# Project Euler problem 081: find minimal sum traversing 80x80 matrix
from itertools import *
f = open('euler081_mini.txt')
# Retrieve lines:
rows = f.readlines()
# Build matrix:
matrix = {}
# Iterate over stored lines:
for i in range(len(rows)):
row = rows[i]
if row:
n... | true |
d067570712e743b5227adb3bccc6688eb1c8e370 | Python | dawidoberda/work_repo | /MPN&HS&ECN_organizer/main.py | UTF-8 | 674 | 2.640625 | 3 | [] | no_license | #ENG:ESD data
from Parser_csv import ParserCsv
import datebase_manager
def main():
first_file = 'MPN_previous (copy).csv'
second_file = 'MPN_today (copy).csv'
mpn_compare_file = 'MPN_compare.csv'
csv_parser_mpn = ParserCsv(first_file, second_file, mpn_compare_file)
indicators = []
indicators =... | true |
b0c7cfe50da2d8fe1972cd00d4dcb8c9bca48f3f | Python | daansteraan/Random-Code | /project_mortgage_calculator.py | UTF-8 | 1,142 | 4.0625 | 4 | [] | no_license | """
Mortgage Calculator -
Calculate the monthly payments of a fixed term mortgage over given Nth terms \
at a given interest rate. Also figure out how long it will take the user to \
pay back the loan. For added complexity, add an option for users to select \
the compounding interval
"""
name = '*** Mortgage Calcu... | true |
592504b3b70f8fecd6f6a660eb89fde162294664 | Python | Qqwy/python-multiple_indexed_collection | /multi_indexed_collection.py | UTF-8 | 15,202 | 3.6875 | 4 | [
"MIT"
] | permissive |
# These names are skipped during __setattr__ wrapping; they do not cause the containers to be updated.
_RESTRICTED_NAMES = [
'_multi_indexed_collections', '__setattr__',
'__dict__', '__class__'
]
class AutoUpdatingItem():
"""When mixing in this class
all changes to properties on the object cause the `M... | true |
b906887703e83e0ab1074473b8214b940fbf82d1 | Python | vinaykshirsagar/footyball-analysis | /Continuous ProRel back.py | UTF-8 | 4,056 | 3.484375 | 3 | [] | no_license |
#Dictionaries associates team with the year of changed league and point tally in that league.
#There is a dictionary for promoted teams and a dictionary for relegated teams.
#Code intended for promotion and relegation from first league
from parse_text import Data
years = sorted(list(Data.keys()))
toBePromoted = {... | true |
f249980d06aada69655e0601027b7d050f320bb2 | Python | Anseik/algorithm | /study/백준/boj_1050_물약.py | UTF-8 | 1,429 | 2.71875 | 3 | [] | no_license | import sys
from collections import defaultdict
sys.stdin = open('boj_1050_물약.txt')
N, M = map(int, input().split())
mat_dict = defaultdict(int)
for i in range(N):
name, cost = input().split()
cost = int(cost)
mat_dict[name] = cost
target = ''
for j in range(M):
tmp = input()
idx = tmp.index('=')
... | true |
d51ab0eaec9ed8dec40bc1772a2d5f6889951b66 | Python | oconnorb/sndrizpipe | /sndrizpipe/mkrefcat.py | UTF-8 | 7,406 | 2.703125 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
# S.Rodney 2014.05.06
def writeDS9reg( catalog, regfile, color='green', shape='diamond',
linewidth=1 ):
""" Write out a DS9 region file from the given catalog
catalog may be a file name or an astropy table object.
"""
from astropy.coordinates import ICRS
from... | true |
90eb6e2066072ca67715466c85e635c9f9a38b65 | Python | segelmark/udacity-full-stack-projects | /projects/02_trivia_api/backend/flaskr/__init__.py | UTF-8 | 6,438 | 2.734375 | 3 | [] | no_license | import os
from flask import Flask, request, abort, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
import random
from models import setup_db, Question, Category
ENTRIES_PER_PAGE=10
def format_entities(entities):
"""Formats categories correctly"""
return [entity.format() for entity in... | true |
2307e654f7ff70cb518688e0ccfafc3e9178d83f | Python | zcmarine/continued_cs | /continued_cs/algorithms/island_count/test_module.py | UTF-8 | 2,407 | 3.1875 | 3 | [] | no_license | import logging
import pytest
from continued_cs.algorithms import island_count
logger = logging.getLogger('continued_cs.algorithms.island_count')
logger.setLevel(logging.DEBUG)
def test_initialize_tracker_grid():
tracker_grid = island_count.initialize_tracker_grid(nrows=3, ncols=5)
assert len(tracker_grid) ... | true |
c776c8c5ddf3188a59c067c24a075d59c3fec450 | Python | FelSiq/antiderivative-solution-insertion-on-images | /symbol-recognition/runall.py | UTF-8 | 1,167 | 2.515625 | 3 | [
"MIT"
] | permissive | """Run all scripts in this subrepository."""
import sys
import sklearn
import balancing
import augmentation
import preprocessing
import symbol_recog
if __name__ == "__main__":
if len(sys.argv) > 1:
print("Skip flags: {}".format(sys.argv[1:]))
if {"b", "a", "p"}.isdisjoint(sys.argv):
print("B... | true |
11354d0f4f93b2696ab8b8ec35014b158417f49c | Python | zarina494/fisrt_git_lesson | /5/5.4.py | UTF-8 | 1,767 | 3.140625 | 3 | [
"MIT"
] | permissive | product_list = ['bread','cheese','egg','meat']
# buterbrod 0+1
# biphsteks 2+3
# gamburger 0+2+3
# 4isburger 0+1+2+3
cook_list = []
print('U vas imeyutsya takie produkty:', product_list)
product = input('Vozmte product:')
i = 0
while product != '0' and i <= len(product_list):
if product in product_list:
coo... | true |
cc677c71f06b744dc739000d0cee678131ef629f | Python | MAlexa315/Practice | /Python_Basic_(Part -I).py | UTF-8 | 3,220 | 4.25 | 4 | [] | no_license | # https://www.w3resource.com/python-exercises/python-basic-exercises.php
# 1. Write a Python program to print the following string in a specific format (see the output). Go to the editor
# Sample String : "Twinkle, twinkle, little star, How I wonder what you are! Up above the world so high, Like a diamond in the sky. T... | true |
e4fed73a697534c18a9a9bc7c10a37648f6ccd09 | Python | Yuchizz12/py2_samples | /Chapter2/list0202_1.py | UTF-8 | 822 | 3.296875 | 3 | [] | no_license | import tkinter
import math
def hit_check_circle():
dis = math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))
if dis <= r1 + r2:
return True
return False
def mouse_move(e):
global x1, y1
x1 = e.x
y1 = e.y
col = "green"
if hit_check_circle() == True:
col = "lime"
... | true |
799497d996505edd2cea28608b3e6d5d2a90ea73 | Python | whglamrock/leetcode_series | /leetcode1002 Find Common Characters.py | UTF-8 | 702 | 3.359375 | 3 | [] | no_license |
from collections import Counter
class Solution(object):
def commonChars(self, A):
"""
:type A: List[str]
:rtype: List[str]
"""
minCount = {}
for c in 'abcdefghijklmnopqrstuvwxyz':
minCount[c] = 2147483647
for s in A:
sCount = Counter... | true |
d4052a129349e4237be0dabe75248bce50dcd8bb | Python | nandy23/python-belajar | /Studi Kasus/ganjilgenap.py | UTF-8 | 133 | 3.53125 | 4 | [] | no_license | bil = int(input("Masukan Bilangan : "))
if (bil % 2 == 0):
print(bil, "Bilangan genap")
else:
print(bil, "Bilangan Ganjil")
| true |
31889fc34db741cf320daddb315a503a4b2da44a | Python | taoranzhishang/Python_codes_for_learning | /study_code/Day_25/时间模块/04取更精确的当前时间time.clock().py | UTF-8 | 116 | 2.96875 | 3 | [] | no_license | import time
start = time.clock()
num = 0
for i in range(10000):
num += i
end = time.clock()
print(end - start)
| true |
14bf1b2da9b4e80767900e106bb1de54831d62c3 | Python | anyboby/A3C_CartPole | /src/optimizer.py | UTF-8 | 966 | 2.859375 | 3 | [] | no_license | import threading
import constants as Constants
"""
The optimizer calls MasterNetwork.optimize() endlessly in a loop, possibly from multiple threads
"""
class Optimizer(threading.Thread):
stop_signal = False
write_summaries = False
def __init__(self, master_network):
threading.Thread.__ini... | true |
a3b04085d613fa14e97a2475166335138ad02a51 | Python | kissisland/loganalyzer | /guanjia.py | UTF-8 | 833 | 2.578125 | 3 | [] | no_license | import requests, csv
from lxml import html
from multiprocessing.dummy import Pool
all_data = []
def getHtml(page_num):
res = requests.get("http://www.zizhiguanjia.com/zs/pn{}".format(page_num))
selector = html.fromstring(res.content)
for info in selector.xpath("//div[@class='zsbase-r']/ul/li/div[@class='kn... | true |
ddb9898ee0841ea859e820a7a245956252d1acf6 | Python | th00tames1/- | /prep_sum.py | UTF-8 | 858 | 2.765625 | 3 | [] | no_license | f=open('stn_summer.csv','r')
f1=open('prep_sum.csv','w')
d={}
for line in f:
data=line.split(',')
station=int(data[0])
year=int(data[1])
month=int(data[2])
day=int(data[3])
if data[7]!='':
prep=float(data[7])
else:
prep=0
if not station in d.keys():
... | true |
b00e6e877588e3a2a71c3367888beec19d305712 | Python | ehudkr/expected-risk-frequencies | /expected_frequencies/expected_frequencies.py | UTF-8 | 14,926 | 2.796875 | 3 | [] | no_license | import math
import warnings
import altair as alt
# from typing import List
from .risk_conversions import calculate_exposed_absolute_risk
PERSON_SHAPE = (
"M1.7 -1.7h-0.8c0.3 -0.2 0.6 -0.5 0.6 -0.9c0 -0.6 "
"-0.4 -1 -1 -1c-0.6 0 -1 0.4 -1 1c0 0.4 0.2 0.7 0.6 "
"0.9h-0.8c-0.4 0 -0.7 0.3 -0.7 0.... | true |
a258651c1dd842794526c74ca9196f180bcf4709 | Python | tslearn-team/tslearn | /docs/examples/misc/plot_distance_and_matrix_profile.py | UTF-8 | 4,593 | 2.875 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Distance and Matrix Profiles
============================
This example illustrates how the matrix profile is calculated. For each
segment of a timeseries with a specified length, the distances between
each subsequence and that segment are calculated. The smallest distance is
returned, except... | true |
f3888f1b4413ca3fc14509aa19a0fccac7e6aecf | Python | Elliot47/Crawler | /crawler.py | UTF-8 | 1,466 | 2.703125 | 3 | [] | no_license | import re
import requests
from bs4 import BeautifulSoup
from time import sleep
def links_in_html(content, visited, folder, depth=0):
soup = BeautifulSoup(content, 'lxml')
links = soup.find_all('a')
target_base = ' https://example.site.ru/{}'
for a in links:
link = a.get('href')
stash_url = 'https://stash.site... | true |
39cb950f5db5360d0e0486fe02f304534d805dea | Python | AndersonSM/P1-Solutions | /aplicacao.py | UTF-8 | 410 | 3.40625 | 3 | [] | no_license | # coding utf-8
# aplicacao_polinomios
# Anderson Sales
def calcula(lista, valor):
soma = 0
for i in range(len(lista)):
soma += int(lista[i]) * valor**i
print soma
while True:
entrada = raw_input()
if entrada == "fim":
break
if entrada[0] == "p":
lista = e... | true |
979114aaf5b3cb158bef4f506157cff45106719f | Python | olga3n/adventofcode | /2020/day_21_allergen_assessment_1.py | UTF-8 | 2,754 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
def parse_records(data):
records = []
for line in data:
first, second = line.split(' (contains ')
ingredients = first.split(' ')
allergens = second[:-1].split(', ')
records.append((set(ingredients), set(allergens)))
return records
de... | true |
ff12f3c17794b6c9913e04a26ede6d1ebfacc000 | Python | intellihr/python_json_logger | /json_logger/utils.py | UTF-8 | 1,582 | 2.84375 | 3 | [] | no_license | PATCHED_LOGGER_METHODS = ('debug', 'info', 'warning',
'error', 'critical', 'exception')
class LoggerAdapter:
def __init__(self, logger, args_adapter):
self.logger = logger
self.args_adapter = args_adapter
def __getattr__(self, name):
method = getattr(self.log... | true |
3300cb36e1ee9e6ff8dd133e0bc39e021b65e066 | Python | J3B60/Sort-Algorithms-Coursework | /Bubblesort2.py | UTF-8 | 825 | 3.390625 | 3 | [] | no_license | import random as rd
#/ Bubble Sort /#
#///////////////#
#/ Input Array /#
#///////////////#
A = ['P/\R',3,complex(3,6),float('NaN'),'g',float('inf'),4.32]
#///////////////#
print ("Input Array: ", A)
n = len(A) #Number of elements remaining
swapped = False
i = 1 #Element in Array
NoNaN = 0 #Number of NaNs
R... | true |
9b6bf6d2e849bfed7b88997bab22de9f423b357d | Python | pizzicatomania/pythonClass | /pythonTest/xmlTest.py | UTF-8 | 1,205 | 2.578125 | 3 | [] | no_license | from bs4 import BeautifulSoup
import urllib.request as REQ
url = 'http://rss.joins.com/joins_news_list.xml'
weather = 'http://web.kma.go.kr/weather/forecast/mid-term-rss3.jsp?stnId=109'
response= REQ.urlopen(weather)
soup = BeautifulSoup(response, 'html.parser')
# print(soup)
for itemElem in soup.findAll('location'):... | true |
db74f634dfb0cb3ad7d97f7a3e43ba6309756db2 | Python | lizzzcai/PyCon-Note | /PyConAPAC2018_Practical_Python_Design_Patterns/what_is_type.py | UTF-8 | 166 | 3 | 3 | [] | no_license |
TestWithType = type('TestWithType', (object,), {})
print(f'type(TestWithType): {type(TestWithType)}')
ins1 = TestWithType()
print(f'type(ins1): {type(ins1)}')
| true |
0c01e3de99d39bba0cdbad3c8e3acde251fbdc7f | Python | reddymadhira111/Python | /programs/pra1.py | UTF-8 | 141 | 2.875 | 3 | [] | no_license | s="ababbcdeab"
l=[]
l1=[]
for i in s:
l.append(i)
print(l)
for i in l:
j=l.count(i)
l1.append(j)
print(l1)
d=dict(zip(l,l1))
print(l2) | true |
96e5d960672a720ae8ebbc5f0b5b4015fd0da34a | Python | vishalre/HashtagGenerator | /HashtagGenerator/DL Model/modeling.py | UTF-8 | 8,477 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# TensorFlow 2.0.0 is required for this code to work.
# Uncomment and run the following line to install the CPU version.
# !pip uninstall tenserflow
!pip install tensorflow==2.0.0-beta0
# !pip install pyspark
# !pip install 'h5py<3.0.0'
# !pip install selenium
# !pip install colabcode
# !pip ... | true |
31957089e015913f03da408ad0b7aff30e2ff9f6 | Python | snkemp/__Kavascript | /KML/src/parser.py | UTF-8 | 1,274 | 2.546875 | 3 | [] | no_license |
import os, re, code
from src.utils import *
from src.elements import *
class Token:
def __init__(self, match):
self.name = match.lastgroup
self.literal = match.group(0)
def __repr__(self):
return f'<{self.name} : {self.literal}>'
def tokenize(filename, pattern):
with open(fi... | true |
26eb57500bba43a4f713d8718b715f62f0c3fa8a | Python | SerhiiKhyzhko/SoftServe | /functions/ET8_fibonacci_nums.py | UTF-8 | 2,539 | 3.921875 | 4 | [] | no_license | from decorators_and_additional_vars.decorators import input_integer_data_validation, length
from decorators_and_additional_vars.additional_vars import fib_nums
from custom_exceptions.exceptions import InvalidLength, InvalidInteger
@length
@input_integer_data_validation
def fibonacci_length(length: int) -> list:
'... | true |
e2b3ebb80f38e86cff0826c1f4d1f0532e326e09 | Python | Sahil94161/projects | /ass17.py | UTF-8 | 2,291 | 3.890625 | 4 | [] | no_license | # Q1. Write a python program using tkinter interface to
# write Hello World and a exit button that closes the interface.
# Ans-
# from tkinter import *
# import sys
# def exit():
# sys.exit()
# w=Tk()
# l=Label(w,text="Hello World",width=50,bg="green",fg="red")
# l.pack()
# b=Button(w,text="Exit",width=25,bg="yell... | true |
051b31499b8f629a25768f2dcb46a603c255be8c | Python | cskuntal10/investment | /mutualfund/interface.py | UTF-8 | 2,981 | 2.765625 | 3 | [] | no_license | import tkinter as tk
from core import get_investment_suggestions, invest
from consts import MF_DETAILS
class InvestMenu(tk.Frame):
def __init__(self, root, *args, **kwargs):
tk.Frame.__init__(self, root, *args, **kwargs)
label_scheme = tk.Label(self, text="Scheme")
label_amount = tk.Lab... | true |
c41f2e329ee9e74511a814e44157caf3adec9d6f | Python | Apollo1840/United_Kagglers | /tools/data_loader.py | UTF-8 | 838 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
import os
# some predefined value for illustration
PROJECT_FOLDER = 'United_Kagglers'
def change_dir_to_UKa():
path = os.getcwd()
while(os.path.basename(path) != PROJECT_FOLDER):
path = os.path.dirname(path)
os.chdir(path)
def load_data(DATA_PATH):
... | true |
e378dbd9cd343eae0beba8226a4d16ff0c5cff76 | Python | plygrnd/snoowatch | /src/snoowatch/log.py | UTF-8 | 636 | 2.78125 | 3 | [
"MIT"
] | permissive | import logging
def log_generator(__name__):
# We want the logger to reflect the name of the module it's logging.
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
# Create a console logger for when this runs as a streaming processor
# TODO: implement streaming processing
co... | true |
be23a9316ec3a8af5378ea40b73919d55c02693a | Python | ding8848/my_pygames | /src/crazyforhoney.py | UTF-8 | 2,705 | 2.875 | 3 | [] | no_license | import sys, pygame, random
bear = pygame.image.load('/Users/bob/Desktop/my_pygames/res/bear.png')
honey = pygame.image.load('/Users/bob/Desktop/my_pygames/res/honey.png')
coin = pygame.image.load('/Users/bob/Desktop/my_pygames/res/coin.png')
eat = pygame.image.load('/Users/bob/Desktop/my_pygames/res/eat.png')
backgrou... | true |
544540a8f7b3775a532801b78ec4401f7903aa99 | Python | Akashdeepsingh1/project | /2020/meetingRoom.py | UTF-8 | 1,366 | 3.890625 | 4 | [] | no_license | class Classy:
def __init__(self):
pass
def meetingRoom(self, intervals):
'''
:param intervals:
:return:
Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required.
... | true |
92c7158bdd3c61c0f9ac574c75bf7633846ae258 | Python | zxlzhangxiaolan/uploader | /P2M++/drawloss2.py | UTF-8 | 2,033 | 3 | 3 | [
"BSD-3-Clause"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
# save loss txt所在的路径
loss_save = '/home/fullo/公共的/fullo-Pixel2MeshPlusPlus-master/Pixel2MeshPlusPlus/results5/coarse_mvp2m/logs/train_loss_record.txt'
loss_save2 = '/home/fullo/公共的/fullo-Pixel2MeshPlusPlus-master/Pixel2MeshPlusPlus/results5/coarse_mvp2m/logs/vaild_los... | true |
f5c799e4e296ef87eef72a854684e9b1dfb3632c | Python | Azrrael-exe/sda-db | /SQL/select.py | UTF-8 | 259 | 2.78125 | 3 | [] | no_license | import sqlite3
from datetime import date
from random import randint, choice
conn = sqlite3.connect('sda.db')
c = conn.cursor()
res = c.execute("SELECT nombre, apellido FROM estudiantes WHERE sexo='Femenino'");
for row in res:
print row
conn.close();
| true |
2417d3ba0477b64cbe72d6b1c2f828a718f0afa1 | Python | lshang0311/pandas-examples | /format_datetime.py | UTF-8 | 394 | 3.34375 | 3 | [] | no_license | import pandas as pd
"""
datetime format:
https://docs.python.org/3.6/library/datetime.html#strftime-and-strptime-behavior
"""
str_data = r"""
date,weather
20180304,cloudy
20180305,sunny
20180306,rain
"""
df = pd.read_csv(pd.compat.StringIO(str_data))
print(df)
print(df.dtypes)
# int64 -> datetime64[ns]
df['date']... | true |
3b609e0eb30b3494ec05ba3db18ab96c196b8c55 | Python | paozhuanyinyuba/A-Lightwe-Classification-Project-based-on-PyTorch | /experiments/recognition/dataset/minc.py | UTF-8 | 11,106 | 2.625 | 3 | [
"MIT"
] | permissive | ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: Weinong Wang
## Tencent, Youtu
## Email: weinong.wang@hotmail.com
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import torch
import torch.utils.data as data
# import torchvision
from torchv... | true |
671a3b0d3b2a4a1a88eb55119c2a03aa5f9995d2 | Python | nmessa/Python-2020 | /Lab Exercise 11.19.2020/mapleLeaf.py | UTF-8 | 1,600 | 3.640625 | 4 | [] | no_license | ## mapleLeafBounce.py
## Author: nmessa
## This program takes a maple leaf drawn with the lines function and animates it.
## When collision with wall is detected, the maple leaf "bounces"
import pygame, sys
pygame.init()
dots = [[221, 432], [225, 331], [133, 342], [141, 310],
[51, 230], [74, 217], [58, 153... | true |
9292c8eb0f90d2c893ec44718de781dd2694c792 | Python | DarthYogurt/StockAnalyzer | /betaCalculator.py | UTF-8 | 785 | 3.46875 | 3 | [] | no_license |
#This will calculate the BETA given a list of EOD data
AAPL = [1.0,2.0,3.0] #,4,5,6,7,8,9,10]
SNP = [1.0,2.0,3.0]
#Returns list of returns of size n-1
def getReturns(eodData):
dailyReturns = []
for i in range(1,len(eodData)):
dailyReturns.append( (eodData[i]-eodData[i-1])/eodData[i-1] )
return dailyReturns
#... | true |
2dcbef211ffb4a4cd5d718fe692f16981ff7b783 | Python | ZanataMahatma/Python-Exercicios | /Funções em Python/ex102.py | UTF-8 | 1,477 | 4.8125 | 5 | [] | no_license | '''Exercício Python 102: Crie um programa que tenha uma função fatorial() que receba
dois parâmetros: o primeiro que indique o número a calcular e outro chamado show,
que será um valor lógico (opcional) indicando se será mostrado ou não na tela o processo
de cálculo do fatorial.'''
def fatorial(n, show=False):
"""... | true |
a5bde5e88e09003927d22ed735fd24ef7da57310 | Python | CptIdea/clicks | /visualisator.py | UTF-8 | 6,297 | 3.03125 | 3 | [] | no_license | import math
import PySimpleGUI as sg
def visualise_clicks(clicks, colors):
layout = [
[sg.Graph(canvas_size=(600, 600), graph_bottom_left=(-105, -105), graph_top_right=(105, 105),
background_color='white', key='graph')]
]
window = sg.Window('Раскрашенный граф', layout, grab_any... | true |
7fc07c36982ac03394388ab4e55156c52348f628 | Python | bolozna/cpython-sampling | /crandom.py | UTF-8 | 1,257 | 2.9375 | 3 | [] | no_license | """Module for sampling uniformly random elements from dict and set data structures in linear time.
"""
import ctypes,random
dummy_key='<dummy key>'
ulong_len = ctypes.sizeof(ctypes.c_ulong)
py_object_len=ctypes.sizeof(ctypes.py_object)
entry_len=ulong_len+2*py_object_len
table_size_offset=ulong_len*4
table_pointer_off... | true |
b35b79d1d957f6b5b020e532f9a9381665eba76c | Python | andromedarabbit/blog | /utils/markov.py | UTF-8 | 3,494 | 3 | 3 | [] | no_license | from pathlib import Path
import re
import random
import frontmatter
from datetime import datetime, timedelta
START_OF_LINE = "AVeryLongMarkerForStartOfLine"
END_OF_LINE = "AVeryLongMarkerForEndOfLine"
class MarkovWordChain:
def __init__(self):
self.map = {}
def add(self, word, nextWord):
#print "A... | true |
fbeeb6859ec10a05b4dfbb706e4e920ad01dbc62 | Python | kiranmahi2593/k | /dictionaries.py | UTF-8 | 2,480 | 3.921875 | 4 | [] | no_license | #--------------------------Dictionaries-------------------------------------#
def Create_dict(DictInput):
Userdict = dict()
for i in range(DictInput):
UserDictKey = input("Enter the Key:")
UserDictValue = input("Enter the Value:")
Userdict[UserDictKey] = UserDictValue
... | true |
d92937a9f36eb388ba2f86cfe3a261743893ce3b | Python | Programamcion-DAM/Leer-y-representar-funciones | /test.py | UTF-8 | 4,359 | 2.90625 | 3 | [] | no_license |
from urllib import parse
from http.server import HTTPServer, BaseHTTPRequestHandler
import cv2
import numpy as np
import PIL
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.models import Sequential
import matplotlib.pyplot as plt
from imutils.contours ... | true |
168aebbddfe194c8cd9f98bd0aa531297f27c4c8 | Python | MaukWM/Spectrangle | /agents/random_agent.py | UTF-8 | 394 | 2.78125 | 3 | [] | no_license | import random
import move
import state
from agents import agent
class RandomAgent(agent.Agent):
def get_move(self, s: state.State) -> move.Move:
possible_moves = s.get_all_possible_moves(self.index)
possible_moves = list(possible_moves)
mv = random.choice(possible_moves)
return mv... | true |
696856abf0ba829fa417238188bb9c2c517adea9 | Python | rduvalwa5/Jenkin_Examples | /src/Test_Volume_Calculations.py | UTF-8 | 2,457 | 2.71875 | 3 | [] | no_license | '''
Created on Sep 10, 2017
@author: rduvalwa2
'''
import unittest
from VolumeCalculation import math_volumeCaluculations
import math
class test_VolumeCalcualtions(unittest.TestCase):
def setUp(self):
print("Set up")
def test_Pi(self):
inst = math_volumeCaluculations()
... | true |
8f891daaff4f464cdadc9ca1d0187521b530160f | Python | EdwardPeng19/AI_Risk | /A榜code/loct_code/feature_recieve_addr_info.py | UTF-8 | 2,692 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import os
import numpy as np
import pandas as pd
file_name = 'dealed_data/target_recieve_addr_info_dealed.csv'
# 这里面是提取recieve_addr_info表里面的特征
print('......读取表并合并表')
train_target = pd.read_csv('data/train_target.csv')
train_recieve_addr_in... | true |
315300baa30fcecb799e1b9de3df05e422571122 | Python | robertvari/python_alapok_211106_1 | /Photo_To_Excel/PhotoToExcel.py | UTF-8 | 2,149 | 2.84375 | 3 | [] | no_license | import os
from openpyxl import Workbook
from openpyxl.styles import Font
from PIL import Image, ExifTags
# open folder and get all files and folders
photo_folder = r"C:\Work\_PythonSuli\pycore-211106\photos"
file_list = os.listdir(photo_folder)
# filter file_list to get only .jpg and .jpeg formats
clean_file_list = ... | true |