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 |
|---|---|---|---|---|---|---|---|---|---|---|
4cb6a0f3aa8307235a749af9b1cf40fc5cf5aae2 | mahmoud/lithoxyl | /lithoxyl/ewma.py | UTF-8 | 2,701 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import math
import time
# 1-, 5-, and 15-minute periods, per Unix load average
DEFAULT_PERIODS = (60, 300, 900)
DEFAULT_INTERVAL = 5
class EWMAAccumulator(object):
"An exponentially-weighted moving average (EWMA) accumulator"
def __init__(self,... | true |
449fa3c03319a58064ededcf85db3f966e52dcab | m-squared96/Dash-Visualiser | /dash_graphing1.py | UTF-8 | 3,018 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
import json
from textwrap import dedent as d
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
app = dash.Dash(__name__)
styles = {
'pre':{
'border':'thin lightgrey solid',
'overflowX':'scroll'
}
}... | true |
8fa14f9abb2e4238f9bb8aa101c13ec50c480595 | soonler/Python000-class01 | /Week_02/G20190343010296/week02_G20190343010296_customer.py | UTF-8 | 1,672 | 3.453125 | 3 | [] | no_license | class Customer(object):
def __init__(self, raw_total_price, item_count):
self._raw_total_price = raw_total_price
self._item_count = item_count
@property
def payment(self):
return self._raw_total_price * 1.0
class NormalCustomer(Customer):
@property
def payment(self, no_di... | true |
8c6712a9ba6dd602593723ea148649573fd3ba93 | randomcodegen/sm_rando | /rom_tools/memory.py | UTF-8 | 4,873 | 3.140625 | 3 | [] | no_license | from .address import Address
from encoding import free_space
class AllocationError(Exception):
pass
class Extent(object):
""" extents describe free space by having a start place and a size """
def __init__(self, start, size):
self.start = start # the beginning address of the extent
self.s... | true |
08c105f8ddb5d49a666faac627859e1a9f657264 | Scare983/Carwash-Simulation | /carwash.py | UTF-8 | 7,874 | 3.375 | 3 | [] | no_license | """
Carwash example.
Covers:
- Waiting for other processes
- Resources: Resource
Scenario:
A carwash has a limited number of washing machines and defines
a washing processes that takes some (random) time.
Car processes arrive at the carwash at a random time. If one washing
machine is available, they start t... | true |
44030b69c1a389cb68fbcdce602a47adc65cd268 | jonas-hagen/databird | /tests/drivers/test_command.py | UTF-8 | 1,212 | 2.515625 | 3 | [
"MIT"
] | permissive | from databird_drivers.standard import CommandDriver
import datetime as dt
import glob
def test_args_render():
config = dict(
command="cp",
patterns=dict(default=["-v", "simple_{date:%Y-%m-%d}.txt", "{target_file}"]),
)
cd = CommandDriver(config)
context = dict(date=dt.date(2019, 3, 1)... | true |
4dc5ca4effa88893645f3cc6d86009d2ed4e85ba | epiphany40223/epiphany | /pds-queries/compare-listserve-and-pds/compare-listserve.py | UTF-8 | 10,233 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
sys.path.insert(0, '../../python')
import csv
import os
import re
import ECC
import PDSChurch
from pprint import pprint
##############################################################################
def csv_parkey(member):
return "' {}".format(str(member['family']['ParKey'].s... | true |
dba06f79725be6a01ae0a77ef4a0e123d7667eb3 | lephu0803/Big-O | /Day12/bai6.py | UTF-8 | 1,059 | 3.609375 | 4 | [] | no_license | class Node:
def __init__(self,x):
self.data = x
self.next = None
class LinkedList:
def __init__(self):
self.head = None
self.tail = None
self.length = 0
def insertTail(self,x):
p = Node(x)
self.length+=1
if self.head==None:
self.he... | true |
e944940327859dd001bcb13a0a4516bf3dcd3f80 | janelia-flyem/flyemflows | /obsolete/DVIDSparkServices/graph_comparison.py | UTF-8 | 11,790 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | import logging
import h5py
import numpy as np
import pandas as pd
from neuclease.merge_table import normalize_merge_table, MERGE_TABLE_DTYPE
from DVIDSparkServices.util import Timer
from DVIDSparkServices.io_util.labelmap_utils import mapping_from_edges
logger = logging.getLogger(__name__)
def load_and_normalize_... | true |
4ca58aa7c22f4d36be60304928c702a09fff8974 | maduhu/lqn | /fabios_alpha_sim_src/sim/poc/myquids.py | UTF-8 | 17,733 | 3.125 | 3 | [] | no_license | ###################################################
# Liquidity Network Simulation
#
# This code provides a crude simulation for
# the liquidity network as proposed on
# www.feasta.org
# It is just a starting point to get a feeling
# of the dynamics. Later, a proper
# Agent Based Modeling approach should be adopted
#
#... | true |
162fd78d66055bc9e4a004f7f5758d907e90d697 | DaudHaidar/Tugas--2- | /Soal No 1.py | UTF-8 | 629 | 3.484375 | 3 | [] | no_license | sambutan = ( "SELAMAT DATANG", "======== MENU =======",)
menu = ( "1. DAFTAR KONTAK", "2. TAMBAHKAN KONTAK", "3. KELUAR" )
nama = []
no_telephone = []
def TambahKontak():
banyak_data = int(input("JUMLAH KONTAK :"))
for x in range(banyak_data):
nama_kontak = str(input("NAMA : "))
... | true |
029439f9966e7c1e7da98ce8ad8afa713a0c0b15 | akurek/playwright-pytest-examples | /tests/step_defs/test_steps_web.py | UTF-8 | 1,771 | 3.09375 | 3 | [] | no_license | """
This module contains step definitions for web.feature.
It uses Selenium WebDriver for browser interactions:
https://www.seleniumhq.org/projects/webdriver/
Setup and cleanup are handled using hooks.
For a real test automation project,
use Page Object Model or Screenplay Pattern to model web interactions.
Prer... | true |
8827e1ffe71536bf3f62d7154bcf39cc19e2f782 | FantasyTable/fantasytable-script | /fantasyscript/operators/merge.py | UTF-8 | 1,718 | 2.6875 | 3 | [] | no_license | from ..datatypes.arraybox import ArrayBox
from . import *
class Merge:
def __init__(self, exp):
# - Set expression
self.exp = exp
# - Initialize values
self.id = []
self.tree = {}
self.errors = []
self.stack = {}
self.refs = []
self.result... | true |
2cd31e051171492c340d50a008dc66bbdf113f7e | kaptainkohl/boxD | /server/models/message.py | UTF-8 | 1,832 | 2.875 | 3 | [] | no_license | class Message(object):
def __init__(self, msg):
self.__message = msg
def get_message(self):
return self.__message
class LineClaimedMessage(Message):
def __init__(self, point1, point2, owner):
if not (isinstance(point1, tuple) and isinstance(point2, tuple)):
raise Val... | true |
7d72f56f3e0c62f4d518723bf83fd774122d4b5c | apsvidyA/Flower-Classification | /texture/lr_test.py | UTF-8 | 1,220 | 2.71875 | 3 | [] | no_license | import cv2
import numpy as np
import os
import glob
import mahotas as mt
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import classification_report, confusion_matrix
def extract_features(image):
textures = mt.features.haralick(image)
ht_mean = textures.mean(axis=0)
return ht_mean
trai... | true |
0389980157da5e674b61a1ed27de66036906b103 | CSLOYOLAFALL2017/lab7s2018-cooneygavin | /GavinCooneyVaneriaLab7.py | UTF-8 | 1,875 | 4.4375 | 4 | [] | no_license | # Grace Cooney, Nick Gavin, Michael Vanaria
# Course CS151.01
# Date: March 21, 2018
# Lab Number 7
# Problem Statement: You've been hired to study the movie industry and how much money various movies have made over the past few decades.
# Data in: Inputs
# Data out: File name, max profit,
# Other files needed: movies.... | true |
55220437aa523f1039482b8a5d09916385b85686 | nadegdasenkova/skillf-project | /module_0/main.py | UTF-8 | 1,636 | 3.8125 | 4 | [] | no_license | import numpy as np
# функция угадывания
def game_core_v3(number):
count = 0 # счетчик попыток
_min = 1 # минимальное значение
_max = 100 # максимальное значение
_mid = int(_max / 2) # середина диапазона по умолчанию
# Если угадываемое число уже равно пороговым значениям, то нам повезло)
... | true |
0e0dc4d3f63e3d50e1a622f50cf8696bb882451b | arp95/robot_target_tracking | /code/replay_buffer.py | UTF-8 | 1,420 | 2.828125 | 3 | [
"MIT"
] | permissive | import numpy as np
import torch
# References:
# 1. https://github.com/ksengin/active-target-localization/blob/master/target_localization/util/replay_buffer.py
class ReplayBuffer(object):
def __init__(self, state_dim, action_dim, max_size=100000):
self.buffer = []
self.max_size = int(max_size)
... | true |
4ad147f1738b065e96b130b46633eb80ef9cf0a4 | engineer-man/felix | /python/cogs/games.py | UTF-8 | 23,972 | 3.0625 | 3 | [
"MIT"
] | permissive | from random import choice, seed, sample
from time import time
from discord.ext import commands
from discord import Member, Embed, Message
seed()
"""This is a cog for a discord.py bot.
It will provide a connect4 type game for everyone to play.
"""
COLUMN_EMOJI = ('1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣')
CANCE... | true |
26bfc45597bcbe5c83c4cadf3727e065fae5e5fe | grishhenkvika1/DAEN500 | /bmi.py | UTF-8 | 800 | 3.90625 | 4 | [] | no_license | def main():
# getting height and weight
height = input('enter height(meter) : ')
weight = input('enter weight(kg) : ')
# parsing to its data
try:
height = float(height)
weight = float(weight)
except:
print("invalid input !!")
raise
# calculating BMI
bmi = ... | true |
4a833f1430f2b478d79722b09031ed205e19b98f | Metatab/publicdata | /publicdata/chis/recode.py | UTF-8 | 2,817 | 3.265625 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2017 Civic Knowledge. This file is licensed under the terms of the
# MIT License, included in this distribution as LICENSE
"""
Recode some variables
"""
import pandas as pd
def age_group_parts(v):
try:
y1, y2, _ = v.replace('-', ' ').split()
return y1, y2
except ValueError:
... | true |
f9dc5655911368cb6dd8ef17ec09312cfab88979 | Smallflyfly/pyQt5 | /QFileDialogDemo.py | UTF-8 | 1,686 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding:utf-8 -*-
"""
@author:fangpf
@time: 2020/11/03
"""
import sys
from PyQt5.QtCore import QDir
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QWidget, QPushButton, QVBoxLayout, QLabel, QTextEdit, QFileDialog, QApplication
class QFileDialogDemo(QWidget):
def __init__(self)... | true |
0b2ef2f8320b5c3e14ad2202061d8bc7cf094c01 | yuravg/cadence_netlist_format | /cadence_netlist_format/cadence_netlist_format.py | UTF-8 | 4,244 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
"""Format Cadence Allegro Net-List file (cnl - Cadence Let-List) to readable view
"""
import os
import datetime
try:
from tkinter import Frame, Label, Button, StringVar
from tkinter.filedialog import askopenfilename
except ImportError: # for version < 3.0
from Tkinter import Frame, ... | true |
d3298103413c3e78ba337b5bdcc7bfae4efff50e | msmr1109/Python | /cookie/read_safari_cookie.py | UTF-8 | 3,775 | 2.828125 | 3 | [] | no_license |
from struct import *
def read_int4_be(f):
return unpack(">i", f.read(4))[0]
def read_int4_le(f):
return unpack("<i", f.read(4))[0]
class Cookie:
def __init__(self, f, pos):
self.f = f
self.f.seek(pos)
self.pos = pos
self.cookie_size = read_int4_le(f)
unknown1 ... | true |
0d64a18ed3167e1f347f928c6e9a522e9d0fa40b | Asobu77/python_basic | /Section_3/14.py | UTF-8 | 239 | 3.5625 | 4 | [] | no_license | # 文字の代入
print('a is {}'.format('a'))
print('a is {} {} {}'.format('a', 'b', 'c'))
print('a is {2} {1} {0}'.format('a', 'b', 'c'))
print('My name is {name} {family}.'.format(name='Asobu', family='Takahashi'))
print(help(format))
| true |
fe8b6de2b0f7f829ba9bd431cbd5dc5ab1834a3a | njberejan/fantasci | /predictor/objects.py | UTF-8 | 14,651 | 2.515625 | 3 | [] | no_license | import requests
import json
class Player:
def __init__(self, dictionary, game):
self.game = game
for key, value in dictionary.items():
self.name = dictionary[key]['name']
if dictionary.get('rushing') is None:
self.rush_attempts = 0
self.rush_yards = 0... | true |
8ab8719ef8bf039d33fdcd26d5fa10df78a7aa2d | GeorgianBadita/LeetCode | /medium/SetMatrixZeroes.py | UTF-8 | 1,184 | 3.375 | 3 | [] | no_license | # https://leetcode.com/explore/interview/card/top-interview-questions-medium/103/array-and-strings/777/
from typing import List
class Solution:
def setZeroes(self, matrix: List[List[int]]) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
if no... | true |
ec620685e2f71cc328eb970e2708c982b3dd23db | Peruz/rust_read_csv | /pyread.py | UTF-8 | 522 | 2.984375 | 3 | [] | no_license | """ naive python to have a simple comparison """
import time
import numpy as np
t0 = time.time()
with open("uspop.csv") as f:
next(f)
list_lat = []
list_long = []
for line in f:
line = line.rstrip()
l_split = line.split(",")
l0 = l_split[0]
l3 = l_split[3]
l4 = ... | true |
55dfbb2435aba7f7f1cd5dc389c8240b1a73a0b2 | jiangxianshen/BaiduFace | /02_FaceDetect.py | UTF-8 | 574 | 2.6875 | 3 | [] | no_license | from aip import AipFace
import base64
""" 你的 APPID AK SK """
APP_ID=''
API_KEY=''
SECRET_KEY=''
'''创建应用'''
client=AipFace(APP_ID,API_KEY,SECRET_KEY)
'''人脸检测图片参数传入'''
filepath='girl_1.jpg'
with open(filepath,'rb') as f:
base64_data=base64.b64encode(f.read())
image =str(base64_data,'utf-8')
imageType='BASE64'
""" ... | true |
70790840b43173aec6f36f80a29cea54b874e473 | MerciaReginasl/ProjetoLocaVeiculos_ifpb | /LocaVeiculos_ifpb (2).py | UTF-8 | 1,542 | 3.546875 | 4 | [] | no_license | # Importar a biblioteca
from sqlite3 import*
# Estabeleça uma conexão com um banco de dados
# LocaVeiculos = Este arquivo em disco é usado para manter o banco de dados e suas tabelas
# Criamos uma classe "generica" chamada connect() que representa o bd
conn=connect('LocaVeiculos.db')
# cursor: é um interado... | true |
cb259d166c5e0dee89479d6a6bf216b9385f9d00 | andavid0/TerrainLOS-popper | /pipelines/experimental-connectivity/ACV/find_acv.py | UTF-8 | 1,468 | 3.40625 | 3 | [] | no_license | # find_acv.py
#
# Takes as an argument the deired acv as a percentage and the log to search. The log data is
# assumed to be of the format:
# file.hgt, ew: num, sw: num, (eo, so), acv%
#
# This script then returns all log entries within +/- 1 percentage of the
# desired ACV.
#
# Author: Sam Mansfield
import sys
imp... | true |
231fd1eadcedd3ca1d6117e577e00572f5271738 | boraanand/x9115RAN | /hw/code/2/3.3.py | UTF-8 | 144 | 2.75 | 3 | [] | no_license | def right_justify(str):
num_spaces = 70 - len(str)
for i in range(num_spaces):
print '',
print str
right_justify('allen')
| true |
a20b5a6010dda2e2cc0bedbec3d5b004107a4a38 | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/223/users/4330/codes/1594_1805.py | UTF-8 | 188 | 3.546875 | 4 | [] | no_license | x1=float(input("Insira Xa:"))
y1=float(input("Insira Ya:"))
x2=float(input("Insira Xb:"))
y2=float(input("insira Xb:"))
xm=(x2 + x1)/2
ym=(y2 + y1)/2
print(round(xm,1))
print(round(ym,1)) | true |
7972fa2cb18ac710abfa6b64ed3572ea9957e327 | gcherubini/py-tibia | /make_rune.py | UTF-8 | 4,276 | 2.8125 | 3 | [] | no_license | import pyautogui
import time
from util import log, AnomObject, rgbToHex, loadConfigFromJson
pyautogui.PAUSE = 0.3
pyautogui.FAILSAFE = False
CONFIG = loadConfigFromJson()
#### START EXTRA CONFIG
extraConfig = AnomObject(
logoutWhenNotAlone = True,
runeMagicSpell = 'adori gran flam',
mlTrainingSpell = 'e... | true |
364b58145836a008c8160a05f3583b6ab1598078 | Karaca7/Asenkron-Programlama-Asyncron-Programing | /asyncdeneme3.py | UTF-8 | 2,209 | 3.375 | 3 | [] | no_license |
import asyncio
"""
async def x():
asyncio.create_task(y())
#while True:
print("x1")
await asyncio.sleep(10)
print("x2")
async def y():
while True:
print("y1")
await asyncio.sleep(5)
... | true |
45d6e32cd5f88b5fc82442b79ea59cda6a7553e9 | russeladrianlopez/30-Days-of-Code | /Python3/Day2-Operators.py | UTF-8 | 1,423 | 4.8125 | 5 | [] | no_license | '''
Day 2: Operators
Task:
Given the meal price (base cost of a meal), tip percent (the percentage of
the meal price being added as tip), and tax percent (the percentage of the
meal price being added as tax) for a meal, find and print
the meal's total cost.
Note: Be sure to use precise values for your calculations,
or... | true |
3fc8496690b68f6fe8fafa113a57580d4265c8f0 | cofinley/2017-Fall | /Python/Assignments/Connor Finley - Assignment 03 - madlibs.py | UTF-8 | 598 | 3.734375 | 4 | [] | no_license | '''
Connor Finley
Advanced Python
Assignment 3: Files, strings, and functions
Madlibs
Sep. 14, 2017
'''
def madlibs(inputname, outputname):
adjective = input("Enter an adjective: ")
noun1 = input("Enter an noun: ")
verb = input("Enter an verb: ")
noun2 = input("Enter an noun: ")
f = open(inputname, 'r')
c... | true |
880c9210104ca6ed95502890466a21ae0ff2c6e2 | tonysajan/Project | /login.cgi.py | UTF-8 | 1,652 | 2.59375 | 3 | [] | no_license | #!C:\Python27/python.exe
import cgi
import mysql.connector as conn
def htmlTop():
print("""Content-type:text/html\n\n
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset ="utf-8"/>
<title>My Server Side Template</title>
... | true |
5f8d2c173f84aaac5c5749087d067d34e38b56ce | Iliaromanov/Summer_2019 | /Classes and Objects/staticmethod_and_classmethod.py | UTF-8 | 596 | 4.5 | 4 | [] | no_license |
# Class method is to access class variables without having any objects
# static method is to make functions not related to self within a class
class Dog:
dogs = []
def __init__(self, name):
self.name = name
self.dogs.append(self)
@classmethod # decorator
def num_dogs(cls):
... | true |
33c2b5034ab4151f3cd68149faff0b0ec9b1468c | bjamesm70/Python_Examples | /MusicBrowser/jukebox_2.py | UTF-8 | 16,016 | 3.515625 | 4 | [] | no_license | # jukebox_2.py
# A GUI interface that shows you artists, their albums,
# and the songs in those albums.
# Version 2: Consolidating code into fewer classes to
# make it easier to manage: DRY: Don't Repeat Yourself!
# I've left in all the print statements for debugging purposes.
# They can be removed if you like.
# L... | true |
b00ae864386d9466d6dff659ad2af0d76ad7abb0 | commandblockguy/bz80 | /unprettify.py | UTF-8 | 587 | 2.90625 | 3 | [
"MIT"
] | permissive | import sys
import re
# Token level unprettifier
with open(sys.argv[1],'rb') as ifile:
with open(sys.argv[2],'wb') as ofile:
contents = ifile.read()
contents = re.sub(b"[\\x11\\x09]+([\\x3F,\\x3E,\\x04])", b"\\1", contents) # Remove ) and } before a newline, colon, or arrow
contents = re.sub(b"\\x2A([\\x3F,\\x0... | true |
a4b9a52bb30134ef4f9c9a5fecd1abec4387e7fb | tiandiyijian/CTCI-6th-Edition | /08.05.py | UTF-8 | 457 | 2.65625 | 3 | [] | no_license | class Solution:
def multiply(self, A: int, B: int) -> int:
def mul(small, big):
if small == 1:
return big
s = small >> 1
half = mul(s, big)
if small & 1 == 1:
return big + half + half
else:
return hal... | true |
a43f1da8a7a9a2680b00ac6f5bcdd4b0c4a7e7a6 | codwang/My-Pythonproject | /PythonApplication/PythonApplication1/PythonApplication1.py | UTF-8 | 1,233 | 4.5 | 4 | [] | no_license | #1.运用输入输出函数编写程序,将华氏温度转换成摄氏温度。
#换算公式:C=(F-32)*5/9,其中C为摄氏温度,F为华氏温度。
F=float(input("请输入华氏温度:"))
C=(F-32)*5/9
print("摄氏温度为:",round(C,1))
#2.编写程序,根据输入的长和宽,计算矩形的面积并输出。
l=int(input("请输入矩形的长:"))
w=int(input("请输入矩形的宽:"))
s=l*w
print("矩形的面积为:",s)
#3.编写程序,输入三个学生的成绩计算平均分并输出。
arr=input("请输入三个学生的成绩:")
a,b,c=map(int,arr.split())
... | true |
4678b44ff0823847e6ce23333bb9448428fb94b7 | wenckerm1lder/Rgstry-roof | /cincanregistry/checkers/github.py | UTF-8 | 4,544 | 2.75 | 3 | [
"MIT"
] | permissive | from ._checker import UpstreamChecker, NO_VERSION
import requests
import datetime
class GitHubChecker(UpstreamChecker):
"""
Class for checking latests possible releases of given repository by
release, tag release or commit.
Uses GitHub API v3: https://developer.github.com/v3/
Unauthenticated requ... | true |
7b13801b18b3af420859957a67a12437613fab34 | vipero7/practice | /Algorithm/kmeans.py | UTF-8 | 1,353 | 2.515625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.preprocessing import normalize
import algo
import mysql.connector
dbconfig = {'host': '127.0.0.1',
'database': 'travel_feed',
'user': 'root',
'password': '7787',
}
conn = mysql.connector.connect(**dbconfig)
cursor = co... | true |
cfb3ae7ddc8236f0bcb95fb4fde10d0a437b71d0 | 2amitprakash/Python_Codes | /WebSources/html_scrap_ex2.py | UTF-8 | 815 | 3 | 3 | [
"MIT"
] | permissive | # importing the libraries
from bs4 import BeautifulSoup
import requests
url="https://wolterskluwer.com/products-services/support/offices/united-states.html"
# Make a GET request to fetch the raw HTML content
html_content = requests.get(url).text
# Parse the html content
soup = BeautifulSoup(html_content, "lx... | true |
a965f25552a371b7fdcfd8a04d4b57def42e8447 | gjwei/leetcode-python | /medium/Maximum XOR of Two Numbers in an Array.py | UTF-8 | 583 | 2.96875 | 3 | [] | no_license | class Solution(object):
def findMaximumXOR(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
m, mask = 0, 0
for i in range(31, -1, -1):
mask |= (1 << i)
s = set()
for n in nums:
s.add(n & mask) # reserve left b... | true |
0de813922e82a21b8d022a43c2f7504296a451b0 | xluo-uno/CSCI3550-Luo-Project | /student-grader/autograder/source/reference-implementation/broken-server.py | UTF-8 | 526 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
import socket
import sys
import time
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if len(sys.argv) != 2:
print >>sys.stderr, "ERROR: expected exactly 1 parameter:"
print >>sys.stderr, " %s <PORT>" % sys.argv[0]
exit(1)
sock.bind(("0.0.0.0", int(sys.argv[1])))
sock.li... | true |
6335e1ded60e27a1cb1dc0ff1b217d2b7e41bc43 | bksahu/dsa | /dsa/patterns/top_k/connect_ropes.py | UTF-8 | 1,224 | 4.21875 | 4 | [
"MIT"
] | permissive | """
Given ‘N’ ropes with different lengths, we need to connect these ropes into one big rope with minimum cost.
The cost of connecting two ropes is equal to the sum of their lengths.
Example 1:
Input: [1, 3, 11, 5]
Output: 33
Explanation: First connect 1+3(=4), then 4+5(=9), and then 9+11(=20). So the total cost is 3... | true |
181263a15138325a614e08c2b5500e284f3d128e | K-Edward/s_201111215 | /src/ds_spark_wiki_wordcount2.py | UTF-8 | 1,153 | 2.515625 | 3 | [] | no_license |
import os
from operator import add
import pyspark
from pyspark.mllib.feature import HashingTF
def doIt2():
#word_count = spark.sparkContext.textFile(os.path.join("data","ds_spark_wiki2.txt")).flatMap(lambda x: x.split(' ')).map(lambda x: (x.lower().rstrip().lstrip().rstrip(',').rstrip('.'), 1)).reduceB... | true |
54b5b9f97ed24b91ea5f9291846435aff3823d84 | donchanee/Algorithm-PS | /백준/재귀/10870.py | UTF-8 | 189 | 3.078125 | 3 | [] | no_license | # https://www.acmicpc.net/problem/10870 피보나치 수
def fibo (num):
if num<2:
return num
else:
return fibo(num-1)+fibo(num-2)
n = int(input())
print(fibo(n))
| true |
0336d16d2931daec739f66241d3ea27616d375f2 | mathwiz/TDD | /python/rename/renamer2.py | UTF-8 | 3,961 | 3.109375 | 3 | [] | no_license | import os
import sys
import re
extension = '.wav'
va_pattern = r'VA -'
std_regex = r'(.+) - (.+) \((\d{2}) (.+)\)(\.wav)'
va_regex = r'(.+) - (.+) - (.+) \((\d{2}) (.+)\)(\.wav)'
def start():
path = os.path.dirname(os.path.realpath(sys.argv[0]))
result = walk(path)
print("Folders scanned: %s" %(result['... | true |
fdc5748822d139c1edca7280ec91a4951030b7e1 | harpninja/ray | /hitable_class.py | UTF-8 | 660 | 2.953125 | 3 | [
"MIT"
] | permissive | '''
Hitable class
'''
from abc import ABC
import vector_class as v
class Hitable(ABC):
'''
Abstract base class for a hit on a surface.
'''
def hit(self, this_ray, t_min, t_max, rec):
pass
class hit_record:
'''
Record of a ray hitting scene geometry.
'''
def __init__(self, t=0.0... | true |
fb4da2ea2ec63897e00fe19d495016cb15c736b2 | clongfellow/3Dboiz2020 | /testingproj.py | UTF-8 | 5,286 | 2.5625 | 3 | [] | no_license | from __future__ import print_function
import math
import pyproj
import csv
import laspy
import scipy
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn import preprocessing
import mpl_toolkits.mplot3d
from matplotlib import path
R = 6378137
f_... | true |
af5f0ec4693ab85caa6298e8b29b7543b254ca1a | PatrickC05/cmimc-2021 | /optimize1.py | UTF-8 | 3,196 | 3 | 3 | [] | no_license | import numpy as np
import math
# edit to the name of the input file
num = '1'
f = open('uniqueproducts'+num+'.txt', 'r')
n,m = map(int, f.readline().strip().split())
subsets = []
def get_combos(primes,max):
maxes = [int(math.log(max,i)) for i in primes]
nums = []
for i in range(len(primes)):
pows =... | true |
44a5266943b7e099f6a11437d4dbb98a1cdeb6fa | JulyKikuAkita/PythonPrac | /cs15211/BinaryTreePostOrderTraversal.py | UTF-8 | 7,424 | 3.53125 | 4 | [
"Apache-2.0"
] | permissive | __source__ = 'https://leetcode.com/problems/binary-tree-postorder-traversal/#/solutions'
# https://github.com/kamyu104/LeetCode/blob/master/Python/binary-tree-postorder-traversal.py
# Time: O(n)
# Space: O(1)
# Tree
#
# Description: Leetcode # 145. Binary Tree Postorder Traversal
#
# Given a binary tree, return the po... | true |
0632e684f0eafd875086245fa5633978c0198d4c | morooka-akira/simple-cryptocurrency | /tests/blockchain_test/block_test.py | UTF-8 | 722 | 2.828125 | 3 | [] | no_license | from blockchain.block import Block
import json
def test_init():
actual_transaction = 'transaction'
actual_previous_block = 'previous_block'
block = Block(actual_transaction, actual_previous_block)
assert block.timestamp is not None
assert block.transaction is actual_transaction
assert block.pre... | true |
b95715b614f4d7e8ddd76cab8a9b1e2b8fa396f7 | joyonto51/python_data_structure_practice | /dictionaries/add_key_to_dictionary.py | UTF-8 | 127 | 2.78125 | 3 | [] | no_license | my_dict = {'name': 'Jaman', 'age': 26}
my_dict.update({'district': 'Dinajpur'})
my_dict['village'] = 'Nalpur'
print(my_dict) | true |
ec0b1c10c78a28a15573a1d280565278694e0eb5 | mavalos90/codewars_katas | /python/6_kyu/deaf_rats_of_hamelin.py | UTF-8 | 882 | 3.859375 | 4 | [] | no_license | # The Deaf Rats of Hamelin
# 6kyu
'''
Story
The Pied Piper has been enlisted to play his magical tune and coax all the rats out of town.
But some of the rats are deaf and are going the wrong way!
Kata Task
How many deaf rats are there?
Legend
P = The Pied Piper
O~ = Rat going left
~O = Rat going right
Example
ex1 ~... | true |
55596d8d7b478dbec42c4046bcb78c8e6e34a5d8 | sdpython/cpyquickhelper | /cpyquickhelper/profiling/event_profiler.py | UTF-8 | 13,879 | 2.8125 | 3 | [
"MIT"
] | permissive | """
@file
@brief Profiling class.
"""
import sys
import inspect
import numpy
import pandas
from ._event_profiler import CEventProfiler # pylint: disable=E0611
from ._event_profiler_c import ( # pylint: disable=E0611
_profiling_start, _profiling_stop,
_profiling_n_columns, _profiling_log_event,
_profiling_... | true |
07c72938013ee7b9be7fa8f5eec0fdea0331490f | orr19-meet/YL1-201718 | /Lab3/lab3.py | UTF-8 | 616 | 3.234375 | 3 | [] | no_license | import turtle
##turtle.register_shape("shape1", ((50,0), (50,50), (0,50), (-50,25),(0,0)))
##turtle.shape("shape1")
turtle.register_shape("spiderman.gif")
turtle.shape("spiderman.gif")
##turtle.forward(500)
##turtle.color("Red")
##turtle.color("Blue")
##turtle.forward(500)
##turtle.left(145)
##turtle.color("Green")
##t... | true |
40d36a2130cd03fe038dca68b7c8ab377f3398c3 | MarcianoPazinatto/TrabalhosdePython | /aula15_manipulação de arquivos/aula15_exerc.py | UTF-8 | 202 | 3.53125 | 4 | [] | no_license | nome1=input('Digite um nome: ')
nome=open('Nome.txt','a')
#nome.write(f'{nome1}\n')
nome.write('{}\n'.format(nome1))
nome.close()
nome=open('Nome.txt',)
for linha in nome:
print(linha)
nome.close() | true |
2bc4dc2266abc6b8520eae17a021d559c3320576 | P90-RushB/leetcode | /二分模板/441. 排列硬币.py | UTF-8 | 1,420 | 3.703125 | 4 | [] | no_license | class Solution:
def arrangeCoins(self, n: int) -> int:
# 方法一,直接一行一行减
# layer = 0
# # 从第一层开始,如果硬币数n大于等于下一层应该有的硬币数,就继续
# while n >= layer+1:
# n -= layer + 1
# layer += 1
# return layer
# 方法二,这是二分法的第二类应用:找最后一个小于target的数的序号。
# 由于我用的模板是《... | true |
21240de9394b7cbd7d03de7650ec2388942490d5 | Bioinformatics-pipelines/JVis_paper | /proof_of_principle/joint_metrics.py | UTF-8 | 3,409 | 2.6875 | 3 | [] | no_license | from anndata import AnnData
import numpy as np
import os
import scanpy.api as sc
from scipy.sparse import vstack
from sklearn import preprocessing
import sys
from scipy import sparse
from sklearn.neighbors import NearestNeighbors
from sklearn.metrics.cluster import adjusted_rand_score
# Run louvain algorithm
def eval... | true |
c97515f499c5cffba0ad939816465116ed6d7562 | gtstewar/CSC495 | /UnitTests/TestCases/GuardTest.py | UTF-8 | 623 | 2.8125 | 3 | [] | no_license | from Pyskell.Language.Syntax.Guard import *
from Pyskell.Language.EnumList import L
from Pyskell.Language.Syntax.QuickLambda import __
import unittest
class GuardTest(unittest.TestCase):
def test_guard(self):
self.assertEqual("fit", ~(Guard(L[1, ..., 5]) | g(lambda x: len(x) > 100) >> "rua"
... | true |
40f247366b8dd5d2db4f9099bf4a3afbd05fcdf8 | artmountain/ChaosTalk | /LotkaVolterra.py | UTF-8 | 2,466 | 3.453125 | 3 | [] | no_license | # Evolution of the Lotka-Volterra equations
#
# Art Mountain 2019
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# What type of plot to show
showPhaseSpace = 1
nPoints = 1000
# Definition of parameters
# The equations we are solving are
# dx = a x - b xy
# dy = -cx + d xy
a = 1
b = 1
c = 2
... | true |
f6b8cb47b1bfe8862607dc440cc51cf7a04579ba | ZGCdeGithub/python-study | /10-2 regex/regex_test2.py | UTF-8 | 708 | 3.640625 | 4 | [] | no_license | import re
#compile 编译正则表达式,生成一个正则对象
# 参数
# pattern 正则字符串
# flag 标识符
pat = re.compile('\d{3}')
s = 'wqa123asd23dasd324asd1232234'
res = pat.search(s, 0, 10)
print(res)
print(res.span())
print(res.group(0))
print(res.start(), res.end())
# match 和search只要匹配一个就不会再进行匹配
# 若想匹配多个结果,使用findall
# findall 查找多个匹配
# 参数:
# stri... | true |
6d0203ed28ed30f780aebeb7461a8d8b971d0d49 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_85/78.py | UTF-8 | 1,490 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
import sys
def line():
return sys.stdin.readline().strip()
def intline():
return map(int, line().split())
def main(argv):
t = int(line())
for caseno in xrange(t):
row = intline()
l,t,n,c = row[:4]
ais = row[4:]
assert len(ais) == c
dists ... | true |
cd663d12623026243c160f04d167ab5349be3348 | ArthurSpillere/Exercicios_Entra21_Python | /Uri/uri1019.py | UTF-8 | 144 | 3.375 | 3 | [] | no_license | tempo=int(input())
horas=tempo//3600
resto=tempo%3600
minutos=resto//60
resto=resto%60
segundos=resto
print(f'{horas}:{minutos}:{segundos}') | true |
aff637ff83158a631b263d879bd204241dc78e25 | erickrribeiro/URI | /1160/1160.py | UTF-8 | 402 | 3.515625 | 4 | [] | no_license | n = int(input(""))
t = 0
for i in range(n):
PA, PB, G1, G2 = input("").split()
PA = int(PA)
PB = int(PB)
G1 = float(G1)
G2 = float(G2)
while(PA <= PB and t < 101):
t += 1
PA += int(PA * (G1 /100.00))
PB += int(PB * (G2 /100.00))
if t > 100:
print("Ma... | true |
5f22733000536b8ac5c6b523c1986b1f7bbce2f0 | datormx/PythonExercises | /python-dojo/PythonDojo_Reto8.py | UTF-8 | 433 | 3.578125 | 4 | [] | no_license | mug = 75
coffee_bag = 150
amount_mugs = int(input('How many mugs? '))
amount_coffee_bag = int(input('How many coffee bags? '))
total_mugs_weight = amount_mugs * amount_mugs
total_coffee_bag_weight = amount_coffee_bag * coffee_bag
total_weight = total_mugs_weight + total_coffee_bag_weight
print(f'''
The total weight... | true |
20fe4aafb4fe9fda0a5f2032f232ab20c97eb9ee | bakirillov/msc-thesis | /index.py | UTF-8 | 1,413 | 2.8125 | 3 | [] | no_license | import argparse
import numpy as np
import pandas as pd
from Bio import SeqIO
from Bio.Seq import Seq
from logic import Logic
if __name__ == "__main__":
parser = argparse.ArgumentParser("Indexing a genome for targets")
parser.add_argument(
"genome",
metavar="Genome",
help="A genome of i... | true |
3e005fdabc6245a3eaf4dd7eee9068aa5b0f07e9 | jcraley/jhu-sz-detect | /nn/encoderclassifier.py | UTF-8 | 955 | 2.71875 | 3 | [] | no_license | import torch
from torch import nn
class EncoderClassifier(nn.Module):
"""
A encoder and classifier stage
"""
def __init__(self, encoder, classifier):
super(EncoderClassifier, self).__init__()
self.encoder = encoder
self.classifier = classifier
self.softmax = nn.Softmax... | true |
1a643ef757ba717c49aecd01bc84fa3744fa4853 | mlspec/mlspec-lib | /mlspeclib/mlobject.py | UTF-8 | 13,497 | 2.578125 | 3 | [
"MIT"
] | permissive | # pylint: disable=attribute-defined-outside-init
""" Functions for loading and saving files to disk. """
import semver
from box import Box
import datetime
from pathlib import Path
import marshmallow.class_registry
from marshmallow import ValidationError
from mlspeclib.io import IO
from mlspeclib.mlschema import MLSch... | true |
b35d6603d49dfc867f7242045e3c086acb957e6f | wilixx/python_training | /python_design_pattern/sourcemaking/Singleton.py | UTF-8 | 474 | 3.5 | 4 | [] | no_license | '''
Created on Jan 22, 2018
Introduction:
Ensure a class only has one instance, and provide a global point of
access to it.
@author: Dr.Guo
'''
"""
Ensure a class only has one instance, and provide a global point of
access to it.
"""
class My_Singleton(object):
def foo(self):
print("A")
A_singleton = My_... | true |
ee850a873a1ea338016bc3bfdc542208dfcb67e3 | pavlin-policar/rosalind | /mprt.py | UTF-8 | 539 | 2.625 | 3 | [] | no_license | import re
import sys
import requests
if __name__ == "__main__":
codes = [l.strip() for l in sys.stdin]
strings = []
for code in codes:
res = requests.get("http://www.uniprot.org/uniprot/%s.fasta" % code)
res = res.content.decode("utf-8")
split = res.split('\n')
_, *fasta =... | true |
54846df13be1a8de1ea05ca0c6d98903a561ca60 | garyzccisme/diamond-digger | /utils/logger.py | UTF-8 | 1,697 | 3.140625 | 3 | [] | no_license | import logging
import sys
# TODO: Add functionality to output logs to a file.
def get_logger(name, level=logging.INFO, context=None):
"""
Get a custom logger.
This function should be used to generate loggers within the codebase. The purpose is to unify the
logging style across the package components f... | true |
b2fce8c906e65c437213684f1054861b2e7782e1 | helbertsandoval/trabajo10_sandoval-sanchez-helbert_cesar_maira_paz | /smenu01.py | UTF-8 | 1,988 | 3.578125 | 4 | [] | no_license | import libreria
# ESTE TIPO DE MENU PERMITIRA LA OPCION DE AGREGAR NOTAS Y SACAR SU PROMEDIO
def agregar_nombre():
libreria.pedir_nombre("ingrese nombre del alumno:")
nota1 = libreria.pedir_numero("ingrese nota1:", 0, 20)
nota2 = libreria.pedir_numero("ingrese nota2:", 0, 20)
nota3 = libreria.pedi... | true |
61b9e610d8dd22de0216db0591dad59f09fc3532 | rafaelmorgado/logica-algoritmos | /EstruturaDeDecisao/l2ex12.py | UTF-8 | 2,473 | 3.890625 | 4 | [] | no_license | ''' 12) Faça um programa para o cálculo de uma folha de pagamento, sabendo que os descontos são do Imposto de Renda, que depende do salário bruto (conforme tabela abaixo) e 3% para o Sindicato e que o FGTS corresponde a 11% do Salário Bruto, mas não é descontado (é a empresa que deposita). O Salário Líquido corresponde... | true |
99ebe094614e5f4283c0fc9ed0b8fe1bfb614644 | sparky18/plottest | /test.py | UTF-8 | 915 | 2.96875 | 3 | [] | no_license | import matplotlib
matplotlib.use('Agg')
import networkx as nx
import matplotlib.pyplot as plt
G=nx.path_graph(8)
nx.draw(G)
plt.savefig("simple_path.png") # save as png
plt.clf()
G = nx.Graph()
G.add_edge('a','b')
G.add_edge('a','c')
G.add_edge('c','d')
G.add_edge('c','e')
G.add_edge('c','f')
G.add_edge('a','d')
p... | true |
273f68811c09797303a9a65f732e8e30dc13bbce | lucxt18/lucxt18 | /misc/walsh_hadamard.py | UTF-8 | 5,387 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Walsh-ordered Hadamard tranforms.
Longer description of this module.
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the Licen... | true |
b4c5fe995a5f3b116e58c5979d57a0cc80cace7a | katotetsuro/kaggle-google-landmark-recognition | /siamese_network.py | UTF-8 | 1,818 | 2.75 | 3 | [] | no_license | import chainer
import chainer.links as L
import chainer.functions as F
from chainer.links.model.vision.resnet import ResNet50Layers
def create_model(weight='auto', activate=F.sigmoid):
resnet = ResNet50Layers(pretrained_model=weight)
model = chainer.Sequential(
lambda x: resnet(x, layers=['res5'])['re... | true |
63bc025724a544fbe0128b43017e00ab8775a52e | IgorPereira1997/CursoEmVideoPython | /ExerciciosPython/ex109.py | UTF-8 | 859 | 3.703125 | 4 | [] | no_license | import moedas
def validar():
try:
p = float(input('Digite o preço desejado: R$'))
return p
except:
print('Erro, valor digitado é inválido!\n\n')
return False
def main():
flag = False
while not flag:
value = validar()
if not value:
pass
... | true |
59b2dc132cd1faf892215dddd4a13dd47b500dfa | EFTIHIA96/apdd | /read_problem.py | UTF-8 | 2,207 | 3.875 | 4 | [] | no_license | from itertools import combinations
from networkx import Graph
from networkx.classes.function import density
# pip install networkx
def read_problem(path):
# Create an empty Graph
graph = Graph()
# initialize students
students = 0
enrollments = 0
# open file with read rights
file = open(pat... | true |
ab4b10bbc778db6e0b59d3d0aff290d98ae4597f | awebsters/SeetGeak-Quality-Assurance-Example | /qa327_test/frontend/test_sell.py | UTF-8 | 6,978 | 2.578125 | 3 | [
"MIT"
] | permissive | from time import sleep
import pytest
from seleniumbase import BaseCase
from qa327_test.conftest import base_url
from unittest.mock import patch
from qa327.models import db, User
from werkzeug.security import generate_password_hash, check_password_hash
# Moch a sample user
test_user = User(
email='test_frontend@... | true |
c59784695abd8fd1d534a563ef679cf783f4ecde | GladkayaIF/netology-py-hw-adv | /hw7_interview/interview.py | UTF-8 | 1,919 | 4 | 4 | [] | no_license | BRACKETS = {'(': ')', '{': '}', '[': ']'}
class Stack:
def __init__(self):
self.stack = []
def is_empty(self):
length = self.size()
return length == 0
def push(self, element):
self.stack.append(element)
def pop(self):
return self.stack.pop()
def peek(sel... | true |
84e0927b3666f6446d016f7420d17a5d22c121e0 | jvbrink/cse4schools | /Sandvika/scripts/test.py | UTF-8 | 83 | 2.9375 | 3 | [] | no_license | from pylab import *
x = linspace(0,2*pi,1000)
plot(x,sin(x))
plot(x,cos(x))
show() | true |
0e1228a5f7aea831e1c83750a7d18f14f8f0f86a | haiou90/aid_python_core | /day10/week_test/04_test.py | UTF-8 | 726 | 3.703125 | 4 | [] | no_license | def find_no_repetition(chars):
for r in range(len(chars)):
if chars[r] not in chars[r + 1:len(chars)] and chars[r] not in chars[:r - 1]:
return chars[r]
result = find_no_repetition("ABCACDBEFD")
print(result)
def get_repeating_info(target):
dict_repeat_info = {}
for char in target:
... | true |
0ce72c1232dc780883c943b3538e7d6ee9c761f9 | PR850/LeetCode---Algorithms | /PalindromeNumber/Palindrome_Number.py | UTF-8 | 162 | 3.359375 | 3 | [] | no_license |
def isPalindrome(x):
try:
if x == int(str(x)[::-1]):
return True
else:
return False
except:
return False
| true |
986a68457b31d9f552fd74cc4ac389dcc34f9e58 | Abhishek-Ravichandran/tennis-project | /mc_simulator.py | UTF-8 | 6,260 | 3.1875 | 3 | [] | no_license | from engine import Point
from collections import Counter
class TennisMonteCarloSimulator:
"""
Monte-Carlo simulator for a tennis match. Should not be re-used to simulate
another tennis match after calling simulate()!
"""
def __init__(self, surface, player_a_label, player_b_label, sets_in_... | true |
4abec4c8073edf3249f75ed63dc4cbd4337565df | githuan/python_journey | /Python3_for_SysAdmin/bin/exercises/iterating_over_lists.py | UTF-8 | 625 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python3.7
# My third Python 3 for Administrator Exercise.
users = [{'admin': False, 'active': False, 'name': 'Jasmine'}, {'admin': False, 'active': True, 'name': 'Remi'}, {'admin': False, 'active': False, 'name': 'Ellyse'}, {'admin': True, 'active':True, 'name': 'Jayson'}]
line = 1
for user in users:... | true |
f3988041204998e9a08d6033a68543298e8d7f22 | eduardotp1/Compilador | /parser.py | UTF-8 | 9,594 | 2.703125 | 3 | [] | no_license | from token import *
from tokenizer import *
from prePro import *
from node import *
class Parser:
def parseProgram():
if Parser.tokens.actual.type=='SUB':
t=Parser.tokens.selectNext()
if Parser.tokens.actual.type=='MAIN':
t=Parser.tokens.selectNext()
... | true |
a62094cad5f9d2467a8ca132faff13b533d20ea7 | Zero-Two-Developers/Zero-Two-Bot | /cogs/misc/enquete.py | UTF-8 | 3,468 | 2.53125 | 3 | [] | no_license | import asyncio
import discord
from discord.ext import commands
from discord.ext.commands import Cog
def color(zt):
c = zt.config('colors')['default2']
return discord.Colour.from_rgb(c[0], c[1], c[2])
class enquete(Cog):
def __init__(self, zt):
self.zt = zt
@commands.cooldown(1, 5, commands.Bu... | true |
a8b528dd250396421671c3980db0b7ba845e2afa | ARAI-Hiroki/nand2tetris-python | /my_module/tests/chap03/test_dff.py | UTF-8 | 382 | 3.078125 | 3 | [] | no_license | import unittest
from src.chap03.dff import *
class TestDff(unittest.TestCase):
def setUp(self) -> None:
self.dff = Dff()
def test_something(self):
dff = self.dff
expected = (
0,
1,
)
result = (
dff.clock(1),
dff.clock(1... | true |
3e119d7c8fe7b3b4df8d6026eaa908dacb069174 | osmandi/programarcadegames | /Capítulo 5/Empezando.py | UTF-8 | 5,251 | 3.90625 | 4 | [
"MIT"
] | permissive | #Nunca llamar un programa como pygame..py
#Importar la librería
import pygame
#Inicializa el motor de juegos
pygame.init()
#Las constantes se escriben en mayúsuculas
# Definir algunos colores
NEGRO = ( 0, 0, 0)
BLANCO = (255, 255, 255)
VERDE = (0, 255, 0)
ROJO = (255, 0, 0)
#Están escritas en mayúsc... | true |
7acccf1454a486efd47ef9dd0f351da4f4fdb5b9 | ron21-meet/meet2019y1lab6 | /turtleshapes.py | UTF-8 | 156 | 3.75 | 4 | [
"MIT"
] | permissive | import turtle
turtle.speed(0.1)
num_pts = int(input("pick a number"))
for i in range(num_pts):
turtle.lt(360/num_pts)
turtle.fd(100)
turtle.done()
| true |
94a68326b84d98f64d97756c6f96d5ad664fb6f2 | almome/SistemasDistribuidos_ZMQ | /server.py | UTF-8 | 3,261 | 3.28125 | 3 | [] | no_license | #!/usr/bin/python2
# -*- coding: utf-8 -*-
# Grado de Ingeniería Informática
# Asignatura Sistemas Distribuidos
# Fecha: 08/06/2015
# Autores:
# José Carlos Solís Lojo
# Alejandro Rosado Pérez
# Alexandra Morón Méndez
# Juan Manuel Hidalgo Navarro
# Descripción:
# Servidor de una aplicación de transferencia ... | true |
7092de5ae227caea741df9a45a389f0ea562a81f | HHHHhgqcdxhg/bangumiDesktopAssistant | /config.py | UTF-8 | 1,027 | 2.703125 | 3 | [] | no_license | import json,os
PATH = os.path.dirname(__file__)
with open(f"{PATH}/src/db/config.json","r") as f:
configDict = json.load(f)
class Colors:
def __init__(self):
self.dict = configDict["colors"]
for k,v in self.dict.items():
if type(v) == str:
v = f"\"{v}\""
... | true |
91660be56f869dc44102d035dcf2b7d6851b14f6 | kimth007kim/python_choi | /파이썬forbeginner/Chap09Function/Module1.py | UTF-8 | 209 | 2.984375 | 3 | [] | no_license | ##함수 선언 부분 ##
def func1():
print("Module.py의 func1()이 호출됨.")
def func2():
print("Module.py의 func2()이 호출됨.")
def func3():
print("Module.py의 func3()이 호출됨.")
| true |
306cdd8cbc4879986127680cddd20285c78a069e | scalabli/quo | /examples/prompts/no-wrapping.py | UTF-8 | 209 | 3.15625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import quo
session = quo.Prompt()
if __name__ == "__main__":
answer = session.prompt("Give me some input: ", wrap_lines=False, multiline=True)
quo.echo(f"You said: {answer}")
| true |