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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
78659a84c3c02d1ee5253df1797038aea9d100b9 | Python | raman934/python-2019 | /ce18.py | UTF-8 | 203 | 4.125 | 4 | [] | no_license | # RG
# 2.8
num = int(input("Enter value of num:\n"))
for i in range(10):
print(num, end="")
print(" x ", end="")
print(i+1, end="")
print(" = ", end="")
print(num*(i+1))
| true |
01039bf36d296b61f7786938f3345c6f43716169 | Python | microsoft/electionguard-python | /src/electionguard/ballot_validator.py | UTF-8 | 4,303 | 2.5625 | 3 | [
"MIT"
] | permissive | from .ballot import CiphertextBallot, CiphertextBallotContest, CiphertextBallotSelection
from .election import CiphertextElectionContext
from .logs import log_warning
from .manifest import (
ContestDescriptionWithPlaceholders,
InternalManifest,
SelectionDescription,
)
def ballot_is_valid_for_election(
... | true |
d2e7de57b27fb729ba9c813f9833cd8a15ecf559 | Python | jitendrarmore/JIMO | /scripts/python/ip-validation.py | UTF-8 | 724 | 3 | 3 | [] | no_license | import re
import csv
with open('ip.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
iplist = []
for row in readCSV:
iplist.append(row[0])
print(iplist)
#
def get_valid_ip_list(address):
list = []
#score = float(raw_input())
list.append(address)
s = list
ipv4_address = re.compile('^(... | true |
465fe9553a8a577ddbd840eb2b0d4aed5b5a7b83 | Python | SEU-yoooooer/PyRankine | /step3/node.py | UTF-8 | 2,463 | 3.0625 | 3 | [
"MIT"
] | permissive |
"""
Step 3-json :Basic Object-Orientation Abstraction and Data Representation of The Ideal Rankine Cycle
class Node
──┐ ┌──
│ │
component A ├─⇒ Node ⇒─┤ component B
│ │
──┘ ... | true |
c29d10f3034c1d70e757f2c139c4914420f31144 | Python | 4mod3/matrix_mul_fyp | /scripts/verify.py | UTF-8 | 2,784 | 2.71875 | 3 | [] | no_license | import numpy as np
def IEEE_floating_mul(a, b):
buffer_ = np.array([a,b], dtype=np.uint64)
print("multiply: {:016X}".format(buffer_[0]), ' | ', "{:016X}".format(buffer_[1]))
buffer_.dtype = np.float64
print(buffer_[0])
buffer_[0] = buffer_[0] * buffer_[1]
buffer_.dtype = np.uint64
ret... | true |
9384bcfdef149743dd9175b17f168b306aedd561 | Python | Polladin/AOC | /2018/task_12.py | UTF-8 | 3,340 | 2.96875 | 3 | [] | no_license |
def load_input(filename):
rules = []
rules_result = []
with open(filename) as f:
_raw_lines = f.readlines()
initial_state = [_ch for _ch in _raw_lines[0].split()[2]]
for _idx in range(2, len(_raw_lines)):
_rule = [_raw_lines[_idx][_idx_ch] for _idx_ch in range(5)]
... | true |
9e5e3e7776e67305215c356b20057f1ffb60bc6e | Python | stuart-clark-45/climate | /src/station_data_importer.py | UTF-8 | 3,797 | 2.859375 | 3 | [] | no_license | import logging
from datetime import datetime, timedelta
from typing import Tuple, List
from src.service.noaa import NOAA
from pandas import DataFrame
class GeoPointBounds:
def __init__(self, lat: Tuple[float, float], lon: Tuple[float, float]) -> None:
"""
:param lat: tuple with the following for... | true |
5b600e26c80de888cb9cf80573cbb7f529d0fe05 | Python | ak1103dev/valuable-union | /services/router/controller.py | UTF-8 | 577 | 2.71875 | 3 | [
"MIT"
] | permissive | import pika
import json
def send(method, data):
connection = pika.BlockingConnection(pika.ConnectionParameters(host='rabbitmq'))
channel = connection.channel()
exchange_name = 'app'
routing_key = method
channel.exchange_declare(exchange=exchange_name, exchange_type='topic', durable=True)
channel.basic_p... | true |
67590fb4ee9ede3aa942df5ddc9a043365911457 | Python | snwokenk/Orses_Core | /Orses_Wallet_Core/Wallet.py | UTF-8 | 9,695 | 2.65625 | 3 | [
"MIT"
] | permissive | from Crypto.Hash import SHA256, RIPEMD160
import json
from CryptoHub_Util import FileAction
from CryptoHub_Cryptography.Encryption import EncryptWallet
from CryptoHub_Cryptography.Decryption import WalletDecrypt
from CryptoHub_Util import Filenames_VariableNames
from CryptoHub_Database.UpdateData import UpdateData
i... | true |
1401ff2d897dd2043d653b0583de590e24783040 | Python | toshiki-h/research | /review-research/qt/src/Reviewer/gomi/testpy.py | UTF-8 | 267 | 2.671875 | 3 | [] | no_license | import re
pattern = re.compile(r'Patch Set [0-9]+: Abandoned')
pattern2 = re.compile(r'Change has been successfully cherry-picked as')
for line in open("test.txt", "r"):
if(pattern.match(line)):
print line.strip()
if(pattern2.match(line)):
print line.strip()
| true |
bde4836149ab7429a4460ab17cef5e041140783b | Python | joaops-sousa/Projeto_APD | /logica/historico.py | UTF-8 | 1,144 | 2.78125 | 3 | [
"MIT"
] | permissive | from logica import usuario
from logica import filme
historico_geral =[]
def registrar_filme_assistido(cod_filme,cpf):
user = usuario.buscar_usuario(cpf)
movie = filme.buscar_filme(cod_filme)
if user == None or movie == None:
return False
else:
aux = [user,movie]
his... | true |
12c8c950b0d45fd0e2248b67ef4e75f1400ee973 | Python | akshatabhat/conditional-drones-1 | /stuff_segmentation/lib/trainers/unreal_stuff_trainer.py | UTF-8 | 2,231 | 2.5625 | 3 | [] | no_license | from lib.datasets.unreal_stuff import UnrealStuff, UnrealStuffBuilder
from lib.models.segnet import get_model
from lib.trainers.functional import cross_entropy2d, get_iou
from lib.trainers.trainer import Trainer
from statistics import mean
from torch.utils.data import DataLoader
from tqdm import tqdm
import torch
cla... | true |
8c89f41fdce36704a11fe6053f912418180e0b85 | Python | ufosc/swampymud | /tests/test_world.py | UTF-8 | 29,698 | 2.9375 | 3 | [
"MIT"
] | permissive | """unit tests for the swampymud.world module"""
import unittest
import importlib
import warnings
from swampymud import world as mudworld
from swampymud.character import CharacterClass
from swampymud.item import Item
from swampymud.location import Location
import swampymud.inventory as inv
def import_class(modname, cla... | true |
4efaf0276a3c8bca498923a29a37952eb2722d3a | Python | urbanekstan/Portfolio | /University/Josephus.py | UTF-8 | 4,276 | 4.03125 | 4 | [] | no_license | ###################################################
# File: Josephus.py
# Description: Determines which soldier goes free
# Student Name: Stanley Urbanek
# Course Name: CS 313E
# Date Created: 4/5/2015
######################################################
class Link(object):
# initialize link
def __init_... | true |
d5c22cd5f1952bc00f556d1c5d9184174d9a7f6c | Python | xxristoskk/curation_station | /eda.py | UTF-8 | 5,396 | 2.71875 | 3 | [] | no_license | import spotipy as sp
import json
import curation_station as cs
import functions as f
import pickle
from tqdm import tqdm
##### Load the saved data
nd = json.load(open('/home/xristsos/Documents/nodata/bigNoOct7.json','r'))
gb = json.load(open('/home/xristsos/Documents/nodata/glory_oct7.json','r'))
data = nd + gb
data =... | true |
a734d31f3cc4a20864ac47c9ef8ac9c50e514bb0 | Python | BentleyJOakes/rtamt | /rtamt/node/stl/xor.py | UTF-8 | 1,110 | 2.6875 | 3 | [
"BSD-2-Clause-Views",
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 21 22:24:09 2019
@author: NickovicD
"""
from rtamt.node.stl.node import Node
class Xor(Node):
"""A class for storing STL Xor nodes
Inherits TemporalNode
"""
def __init__(self, child1, child2, is_pure_python):
"""Constructor for Xor node
... | true |
58db3f5a62e15277a3be42bfca89e315d30bb72a | Python | sgillies/babibl-web | /bibl.py | UTF-8 | 1,066 | 2.8125 | 3 | [] | no_license |
from collections import defaultdict
import csv
from datetime import datetime
from jinja2 import Template
from unidecode import unidecode
# Get template
template = Template(open("template.html").read())
bibl = defaultdict(list)
for row in csv.DictReader(open("bibl.csv")):
key = unicode(row['short_new'], "utf-8")
... | true |
958878fc956305e2185f265a79e2d6e254ecbc6a | Python | pranavtalwar/COMP2119-Assignments | /Programming Assignment 1/grapher.py | UTF-8 | 1,933 | 3.5 | 4 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import time
def f1(n):
if(n<=2):
return 1
else:
return (f1(n-1) + f1(n-2))
def f2(n):
if (n<=2):
return 1
else:
p = 1
q = 1
for i in range(3,n+1):
r = p+q
p=q
q=r
... | true |
78ade02cdefbf57c6f80ac9fb7f529a9252ee6ec | Python | bilaleluneis/dataStructureVisualizer | /data_structure/arrays/abstract.py | UTF-8 | 811 | 3.0625 | 3 | [] | no_license | __author__ = "Jieshu Wang and Bilal El Uneis"
__since__ = "July 2019"
__email__ = "foundwonder@gmail.com and bilaleluneis@gmail.com"
from abc import ABC, abstractmethod
from typing import Optional
class ArrayIndexOutOfBoundError(Exception):
pass
class AbstractArray(ABC):
def __init__(self) -> None:
... | true |
74aab0a4f2dad2e914fb3229d3e6c7d056b217ab | Python | Moon123421/test1 | /005.py | UTF-8 | 162 | 3.21875 | 3 | [] | no_license | num1 = 21
if num1%3 == 0 and num1%7 ==0:
print('21*n')
elif num1%3 == 0:
print('3*n')
elif num1%7 == 0:
print('7*n')
else:
print('nothing')
| true |
ad1c71c6db76fe9b515b3735e89717dfd3efb2d0 | Python | VaishaliWalia04/Python_GUI | /openingpage.py | UTF-8 | 4,791 | 2.515625 | 3 | [] | no_license | from tkinter import *
from PIL import ImageTk
class frontpage:
def __init__(self, root):
self.root = root
self.root.title('HARYANA GYM')
### MENUBAR
menubar = Menu(root, bg="red")
menubar.add_command(label="Home", font="arial 20 bold",command=self.home_window)
me... | true |
e5b6b60d3e8e849ddcff794820bc977f6341a2f1 | Python | mcarifio/coding-problems | /pl/python3/staircase/staircase.py | UTF-8 | 4,111 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
f'''
doc:
format: yaml
name: {__name__}:script
usage:
bash: &usage env {__name__.upper()}_LOGLEVEL=DEBUG python3 {__name__}
description: |
There's a staircase with N steps, and you can climb 1 or 2 steps at a time. Given N, write a function that
returns the number of uniq... | true |
0fc081cfce0090bbd3072af7c17ed90db28edd29 | Python | 1358889590/RainbowDQN_highway | /Rainbow/memory.py | UTF-8 | 10,548 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
import torch
Transition_dtype = np.dtype([('timestep', np.int32), ('state', np.uint8, (84, 84)), ('action', np.int32), ('reward', np.float32), ('nonterminal', np.bool_)])
blank_trans = (0, np.zeros((84, 84), dtype=np.uint8), 0, 0.0, False)
de... | true |
d19e4a804fb7617c5ab5594807f9b330d2b5ccd6 | Python | lanzo-siega/MIAS-data | /setup.py | UTF-8 | 857 | 2.859375 | 3 | [] | no_license | import os
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
# setting the working directory
os.chdir('/path/to/directory/')
# loading the csv file with each row corresponding to the .pgm fies in the dataset
table = pd.read_csv('all_mias_info.csv')
# recoding severity from ch... | true |
5ad2927629807fddf11e60ac529ccc6f1e9460c4 | Python | warnj/dive-planner | /must_do_dives.py | UTF-8 | 5,261 | 3.140625 | 3 | [] | no_license | '''
This program is used to identify if days in the future (or past) are considered
diveable for a subset of dive sites specified by dive_sites.json
'''
import data_collect
import interpreter as intp
import dive_plan
from datetime import datetime as dt
import json
# returns list of tuples [slack, info str] of the s... | true |
0a8b93c86f1f59ac957d675eef30b726dc06c777 | Python | aakibinesar/Rosalind | /Algorithmic Heights/rosalind_3_degarray.py | UTF-8 | 380 | 2.59375 | 3 | [] | no_license | file = open('rosalind_deg.txt','r').readlines()
vertices, edges = (int(val) for val in file[0].split())
my_data = [[int(val) for val in line.split()] for line in file[1:]]
count = 0
L = []
for k in range(1,vertices+1):
count = 0
for i in range(2):
for j in range(0,edges):
if my_data[j][i] == k:
count+=... | true |
2e574fc9673e278c76b31b5f81a5e1ff85640a9f | Python | kevincentius/learn-reversi | /ekai-reversi-1-layer-visualization/test/ekai/test_leaky_relu.py | UTF-8 | 1,235 | 2.515625 | 3 | [] | no_license | '''
Created on 2 Apr 2018
@author: Eldemin
'''
import unittest
from ekai.ai.network.input_layer import InputLayer
from ekai.ai.network import dense_layer
from ekai.ai.network.dense_layer import DenseLayer
from ekai.ai.network.activation.leaky_relu import LeakyRelu
from ekai.ai.network.output_layer import Out... | true |
35d98954daf0595a015f16e4a4d4a518d9d13fe7 | Python | codingskynet/FractalViewer | /src/preference.py | UTF-8 | 2,548 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | from PyQt5 import uic
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PIL.ImageQt import ImageQt
import sys
import json
from fractal import Fractal
class Preference(QDialog):
backup_config = None
edited_config = None
isEdited = False
parent = None
def __i... | true |
8c495c2b7f02e5515cf5ff4821f76984afadce99 | Python | activehuahua/python | /pythonProject/exercise/7/7.5.py | UTF-8 | 1,353 | 3.484375 | 3 | [] | no_license | import time
db={}
dbTime={}
def newuser():
prompt='login desired:'
while True:
name=input(prompt)
if db.get(name):
prompt='name taken, try another:'
continue
else:
break
pwd=input('password:')
db[name]=pwd
dbTime[name]=time.strftime("%Y-%... | true |
3d40ad1148e9fc342e3ab137ff77ba89dd08c8fc | Python | omondi9004/python-sequence | /more.py | UTF-8 | 151 | 2.9375 | 3 | [] | no_license | import turtle
wn = turtle.Screen()
tess = turtle.Turtle()
tess.shape("turtle")
tess.forward(-300)
tess.left(-90)
tess.forward(-300)
wn.exitonclick()
| true |
c8fb555c1837aab17ab579dc6eff3c712024ca75 | Python | Gaurav-dawadi/Python-Assignment | /Data Types/question12.py | UTF-8 | 287 | 3.953125 | 4 | [] | no_license | """Write a Python script that takes input from the user and displays that input
back in upper and lower cases."""
takeInput = input("Enter any word: ")
upperCase = takeInput.upper()
lowerCase = takeInput.lower()
print("All UpperCase: ", upperCase)
print("All LowerCase: ", lowerCase) | true |
2b986a453bcdb614b7bbf834becfc9a1c010c17c | Python | percevalw/treeprinter | /treeprinter/tests/test_default_printer.py | UTF-8 | 1,639 | 3.578125 | 4 | [] | no_license | from unittest import TestCase
from treeprinter.printers.default_printer import TreePrinter
class Tree(object):
def __init__(self, tag, children=None):
self.children = children or []
self.tag = tag
class TestDefaultPrinter(TestCase):
def setUp(self):
self.tree = \
Tree("an... | true |
63ae6de905de36fe15af821f1c945604b420656e | Python | SiddhantKapil/tefla | /tefla/resize.py | UTF-8 | 3,053 | 2.8125 | 3 | [
"MIT"
] | permissive | """Resize and crop images to square, save as tiff."""
from __future__ import division, print_function
import os
from PIL import Image
from multiprocessing import cpu_count
from multiprocessing.pool import Pool
import click
from tefla.utils import util
N_PROC = cpu_count()
def resize(fname, target_size):
# pri... | true |
613c88c90c2ebe547e56b68ee699a17713ac14ce | Python | jwreplogle/my-py-files | /tkinter and display.py | UTF-8 | 4,788 | 2.90625 | 3 | [] | no_license | #import
import RPi.GPIO as GPIO
import time
import tkinter as tk
GPIO.setwarnings(False)
# Define GPIO to LCD mapping
LCD_RS = 7
LCD_E = 8
LCD_D4 = 25
LCD_D5 = 24
LCD_D6 = 23
LCD_D7 = 18
LED_ON = 15
# Define some device constants
LCD_WIDTH = 20 # Maximum characters per line
LCD_CHR = True
LCD_CMD = False
LCD... | true |
5c45e18e9288862bdf9cc7f4ca5c018f8910ba74 | Python | parky83/python0209 | /st01.Python기초/py12리스트/py12_ex07_학생성적.py | UTF-8 | 1,209 | 4.21875 | 4 | [] | no_license | # 1. List 만들기.
# 2. 학생수 입력 받기. 최소 4명이상
# 3. 학생 성적 입력 받기. 몇 번 입력 받아야 하는가?
# 4. 3번 학생의 성적을 100점으로 바꾸시오.
# 5. list에서 마지막 학생 삭제.
# 6. list에서 첫번째 값을 출력하시오.
# 7. 평균을 구하고 출력.
gradeSum=0
glist=[]
while True:
n=input("학생수를 입력하시오 :")
n=int(n)
if n<4:
print("학생수는 최소 4 이상이어야 합니다.")
else:
break ... | true |
eb06685370b9bb9482daa4153a8c9c2b0c143de1 | Python | AndreiPi/ChatBotMedical | /Interfata/chatBot/main.py | UTF-8 | 1,233 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# encoding=utf8
# decoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from flask import Flask, render_template
from flask import request
import requests
import validators
app = Flask(__name__)
lista = [("Inima", "Inima sau cordul este organul reprezentativ al aparatului cardiova... | true |
cab9dac6697211c377cbc7530ca44a2b8d70aa94 | Python | gistable/gistable | /all-gists/94ca536b0a5c96c9751b82150f20c95a/snippet.py | UTF-8 | 595 | 2.8125 | 3 | [
"MIT"
] | permissive | def persist_cache_to_disk(filename):
def decorator(original_func):
try:
cache = pickle.load(open(filename, 'r'))
except (IOError, ValueError):
cache = {}
atexit.register(lambda: pickle.dump(cache, open(filename, "w")))
def new_func(*args):
if tup... | true |
e4274cdd285668076a795f8dfa142bebc84e89df | Python | andreplacet/reinforcement-tasks-python-classes | /exe01.py | UTF-8 | 582 | 4.5 | 4 | [] | no_license | # Exercicio 01
class Bola:
def __init__(self, cor, circunferencia, material):
self.cor = cor
self.circunferencia = circunferencia
self.material = material
def mostrar_cor(self):
print(f'A cor da bola é {self.cor}')
def trocar_cor(self):
new_color = str(input('Infor... | true |
e6b92fceb83bb4df9144929716e7c9abf50a3208 | Python | victorvde/dota2_nohats | /kvlist.py | UTF-8 | 1,282 | 3.125 | 3 | [
"MIT"
] | permissive | # Copyright (c) Victor van den Elzen
# Released under the Expat license, see LICENSE file for details
from collections import MutableMapping
class KVList(MutableMapping):
def __init__(self, *args, **kwargs):
self.list = []
self.update(*args, **kwargs)
def last_index(self, key):
l = le... | true |
7db7484b0f883aa936b6bbdb5a810146a5f3e96e | Python | thangduong3010/Python | /Practice/ds_using_dict.py | UTF-8 | 451 | 3.6875 | 4 | [] | no_license |
ab = {
"Swaroop": "swaroop@abc.com",
"Larry": "larry@wall.com",
"Matsumoto": "matz@ruby.com"
}
print("Swaroop's address: {}".format(ab["Swaroop"]))
print("There are {} contacts in the book\n".format(len(ab)))
for name, address in ab.items():
print("Contact {} at {}".format(name,address))
for name in... | true |
2113819ce7bc420bcdd7a0c1b009e13d9a47722d | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_2_neat/16_0_2_cameron274_B.py | UTF-8 | 879 | 3.515625 | 4 | [] | no_license | def flip(S, n):
#flips the top n pancakes
for i in range(n):
if S[i] == "+":
S[i] = "-"
elif S[i] == "-": S[i] = "+"
flipped = S[:n]
flipped.reverse()
return flipped + S[n:]
def run_test():
S = list(raw_input())
# print(S)
flips = 0
for b_in... | true |
02a883b5fefc0da4860b7177f2c2f98b4ad640ff | Python | AntonZamyatin/Bioinformatics-Algorithms | /philo.py | UTF-8 | 5,162 | 3.171875 | 3 | [] | no_license | """Filogenetics algorithms."""
M = [[None, 'A', 'B', 'C', 'D'],
['A', None, 16, 16, 10],
['B', None, None, 8, 8],
['C', None, None, None, 4],
['D', None, None, None, None]]
def pgma(M, type='w'):
"""Function.
It implements WPGMA or UPGMA
philogenetics algorithms.
M - distance mat... | true |
354ef01b970727348d636c8f97c47e6ab49ae062 | Python | xvanov/brilliant | /quant/interview_ev.py | UTF-8 | 848 | 3.328125 | 3 | [] | no_license | import random
from time import sleep
def ev():
# number of steps to reach 3 distinct vertices
p1 = 2/3
p2 = 1/3
N = 100
x = 2
def recur(x):
if x > 10:
return 1
else:
return p1*x+p2*recur(x+1)
p = recur(x)
print(p)
def sim(N_distinct, vertices, v... | true |
3102642657ba232c00817928b01cb1cd68c608ad | Python | ph20/packer-blackarch | /isourl.py | UTF-8 | 1,747 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script for obtaining BlackArch iso url and sha1sum
"""
import os
import sys
import datetime
from urllib.request import urlopen
from urllib.error import URLError
try:
from lxml import html as html
except ModuleNotFoundError as import_error:
print("Can't find ... | true |
94431569415bde1323361dd08ecf559efbfffedc | Python | DanielMalheiros/geekuniversity_programacao_em_python_essencial | /Exercicios/secao06_estruturas_de_repeticao/exercicio08.py | UTF-8 | 406 | 4.53125 | 5 | [] | no_license | """8- Escreva um programa que leia 10 números e escreva o menor valor lido e o maior
valor lido."""
maior_valor = -99999
menor_valor = 99999
for n in range(10):
valor = int(input(f"Insira um valor {n+1}/10: "))
if valor > maior_valor:
maior_valor = valor
elif valor < menor_valor:
menor_val... | true |
e16c06c1b2415e80599612673decfae97e19271b | Python | KorfLab/Rosalind | /IPRB/iprb_sam.py | UTF-8 | 334 | 2.71875 | 3 | [] | no_license | #!/usr/lib/python2.7
#iprb_sam.py
import sys
try:
k = int(sys.argv[1])
m = int(sys.argv[2])
n = int(sys.argv[3])
except IndexError:
sys.exit("Need 3 integers, k, m, and n.")
pop = k + m + n
dom_total = 1 - float(n)/pop*float(n)/(pop-1) - float(n)/pop*float(m)/(2*pop) - float(m)/(2*pop)*float(m)/(2*pop)
print ... | true |
9edeaad967b3c575fd2029705b95bdadcad4dc96 | Python | sushil79g/python-learning | /Untitled-7.py | UTF-8 | 585 | 2.984375 | 3 | [] | no_license | start = 0; end = 0;
large = 0
ls = []
for x in range(len(s)):
if s[x] >= s[x-1] and x!=(len(s)-1):
continue
elif x == (len(s)-1):
if s[x] >= s[x-1]:
end = x
if (end-start+1)> large:
large = end-start
a = start
b = end+1
start = end
else:
end = x... | true |
ecb96a8b2a57e485ae33c6c97432c262ef0ce4a5 | Python | kevin-bot/Python-pythonPildorasInformaticas | /ArchivosExternos/Manejo_archivos.py | UTF-8 | 1,207 | 3.671875 | 4 | [] | no_license |
#se importa la libreria io con su metodo open
from io import open
# se crea un nombre del archivo que va a ser igual al metodo open elcual no pide dos parametros
# uno es el nombre del archivo que vamos abrir, el otro el modo en el que lo vamos a leer lectura, escritura, ..
# si se ejecuta tal como esta aca el cod... | true |
27009fe4065b69bf070241c66508f832b9bb697e | Python | johnny-yue/pyex | /tests/test_orderbook.py | UTF-8 | 6,736 | 2.5625 | 3 | [] | no_license | import pytest
from src.model.exchange import *
class TestPyex:
def test_order(self):
o = Order("K00001", Side.sell, 12.3, 100)
assert(o.filled() == False)
o.fill(20, 11)
assert(o.leave_qty == 80)
assert(o.status == OrderStatus.partial_fill)
o.fill(80, 11.4)
... | true |
6f9a6786cff9fc44c30832c98e68b436b00c828d | Python | zhou-upup/pycharm02 | /MachineLearningTrainingTest.py | UTF-8 | 951 | 3.0625 | 3 | [] | no_license | # -*- coding = utf-8 -*-
# @Time : 2021/10/10 11:48
# @Author : 周孝尚
# @File : MachineLearningTrainingTest.py
# @Software : PyCharm
# import numpy
# import matplotlib.pyplot as plt
# numpy.random.seed(2)
#
# x = numpy.random.normal(3, 1, 100)
# y = numpy.random.normal(150, 40, 100) / x
#
# plt.scatter(x, y)
# plt.show()... | true |
d8f8e08efb7e0e9134c5ee0f78f8b256b26822b1 | Python | ByeongjunCho/Algorithm-TIL | /2115_벌꿀채취.py | UTF-8 | 1,769 | 3.34375 | 3 | [] | no_license | # SWEA 2115. [모의 SW 역량테스트] 벌꿀채취
def makemaxmap():
for i in range(N):
for j in range(N-M+1):
makeMaxSubset(i, j, 0, 0, 0)
# i: 행, j: 열, cnt: 고려한원소수
# sum: 부분집합에 속한 원소의 합
# powSum: 부분집합에 속한 원소의 이익
def makeMaxSubset(i, j, cnt, sum, powSum):
if sum > C: # 부분집합의 합은 목표량C를 초과하면 리턴
return
... | true |
6c1531c16aab4efaa24f5cacb0e710219badb1b8 | Python | wanglezi/Visual_Story_Telling | /coherence_vector/parsetree.py | UTF-8 | 4,632 | 2.5625 | 3 | [
"MIT"
] | permissive | import logging
import sys
import os
import shlex
import subprocess
import traceback
import itertools
from multiprocessing import Pool
from functools import partial
def make_grid(testgrid_path,trees):
testgrid_base=os.path.dirname(testgrid_path)
content_path=os.path.join(testgrid_base,'tmp.txt')
if type(tre... | true |
3914423bf48ec3b95a74d0416578d21c61efc2f5 | Python | jihongsheng/python3 | /python入门/day_10_类/10-11-重写父类的方法-具体没看懂,后面研究.py | UTF-8 | 2,334 | 4.03125 | 4 | [] | no_license | # -*- coding: UTF-8 -*-
# 对于父类方法,只要它不符合自雷模拟的实物的行为,都可以对其进行重写,为此,可在自雷中定义一个这样
# 的方法,即它与要重写的父类方法同名。这样,Python将不会考虑这个父类方法,而只关注你在子类中定义的
# 相应方法。
# 假设Car 类有一个名为fill_gas_tank() 的方法,它对全电动汽车来说毫无意义,因此你可能想重写它。
# 下面演示了一种重写方式:
class Car(): # ❶
"""一次模拟汽车的简单尝试"""
def __init__(self, make, model, year):
"""初始化汽车的... | true |
8d863018b3621195e35a0d9de4b200f2fd480f69 | Python | poppaw/Python-game_statistic | /reports_part_2/printing.py | UTF-8 | 378 | 2.671875 | 3 | [] | no_license | from reports import *
def print_all_reports (file_name, year, title, genre):
collected = collect_returns(file_name, title)
for i in collected:
print (i)
if __name__ == '__main__':
file_name = 'game_stat.txt'
year = 2000
title = "Counter-Strike"
genre = "First-person shooter"
prin... | true |
81f474216a8ccd8701557f3bb65ea656ad6b0848 | Python | anhdungle93/keras_examples | /helping_script.py | UTF-8 | 777 | 2.609375 | 3 | [] | no_license | from tensorflow.keras import Model
import numpy as np
def get_intermediate_layer(model, layer_name, test_input):
return Model(inputs=model.input, outputs=model.get_layer(layer_name).output)
def get_intermediate_output(model, layer_name, test_input):
intermediate_model = Model(inputs=model.input, outputs=model... | true |
ac39541003fc3755ae4e2fcd0e9a9e1468d7fd19 | Python | zy964c/Misc | /sort.py | UTF-8 | 237 | 3.3125 | 3 | [] | no_license | x = {'c': [3, 2], 'a': [4, 0], 'b': [0, 43]}
sorted_x = sorted(x.items(), key=lambda mysum: mysum[0])
print sorted_x
sorted_x1 = dict(sorted_x)
sorted_x2 = sorted(sorted_x1.items(), key=lambda mysum: sum(mysum[1]))
print sorted_x2
| true |
a81c60d211b229c9cecd8cc3f47815f8a9dc77ab | Python | khushboo1510/leetcode-solutions | /Medium/817. Linked List Components.py | UTF-8 | 863 | 3.546875 | 4 | [] | no_license | """
https://leetcode.com/problems/linked-list-components/
We are given head, the head node of a linked list containing unique integer values.
We are also given the list G, a subset of the values in the linked list.
Return the number of connected components in G, where two values are connected if they appear consecut... | true |
ccc66fefb0b093a2b7581d8a1fe7b6a0329f509a | Python | varesa/mustikkaBot | /src/modulemanager.py | UTF-8 | 8,677 | 2.65625 | 3 | [] | no_license | import imp
import os
import platform
import re
import sys
import logging
if platform.system() == "Windows":
import ctypes
import exceptions
class ModuleManager:
"""
A primary module that manages enabling/disabling/loading of pluggable modules
"""
log = logging.getLogger("mustikkabot.modulemanag... | true |
135f75a9971502e2d33f0a601de5c255863f5935 | Python | rafaelperazzo/programacao-web | /moodledata/vpl_data/303/usersdata/299/71690/submittedfiles/testes.py | UTF-8 | 168 | 3.125 | 3 | [] | no_license | a=(float(input('que horas são?[0-23] '))
if a>3 and a<12:
print('bom dia')
elif a>=12 and a<18:
print('boa tarde')
elif a<0 or a>23
print('hora inválida') | true |
7df1e9c44f1b8889737650ea50df53e7010ed58e | Python | miuml/mi_Python_Modules | /mi_Error.py | UTF-8 | 5,096 | 2.625 | 3 | [] | no_license | # !/usr/bin/env python
"""
MI Errors - All app specific exceptions are defined here.
"""
# --
# Copyright 2012, Model Integration, LLC
# Developer: Leon Starr / leon_starr@modelint.com
# This file is part of the miUML metamodel library.
# This program is free software: you can redistribute it and/or modify
# it unde... | true |
815bae62593411cc53ad7f26f206e4e766a06085 | Python | charlesrwinston/PoliticalClassifier | /classifier/twitter_data.py | UTF-8 | 2,357 | 2.796875 | 3 | [] | no_license | # twitter_data.py
#
# Module responsible for getting all the twitter data
# Charles Winston
# Import dependencies
import json
from google.cloud import bigquery
from twitter import Twitter, OAuth, TwitterHTTPError, TwitterStream
# Import local libraries
import screen_names
# Variables that contains the user crede... | true |
9f7f9bb0fc871088a24b629b9c8a89f9cb6db618 | Python | python4004/ATM_waiting_time | /atm_assignment | UTF-8 | 924 | 2.671875 | 3 | [] | no_license | #!usr/lib/python3
from random import uniform
arrive_time=[]
start_time=[]
waiting_time=[]
service_time=[]
completion_time=[]
system_time=[]
for i in range (1000):
arrive_time.append(0)
for i in range (1000):
completion_time.append(0)
for i in range (1000):
start_time.append(0)
for i in range (1000):
waiting_time.ap... | true |
ded24e0d36e0dfce58b704a2e69b4b7f078155e1 | Python | jki14/competitive-programming | /2013/facebook.com/hackercup/qualification/proa.py | UTF-8 | 592 | 3.1875 | 3 | [] | no_license | from sys import stdout
def solution(s):
#todo: check if s is valid
f = [0 for i in xrange(26)]
for c in s:
if 'a' <= c and c <= 'z':
f[ord(c) - ord('a')] += 1
elif 'A' <= c and c <= 'Z':
f[ord(c) - ord('A')] += 1
f = sorted(f)
return sum([f[i] * (i + 1) for i... | true |
499dd6ee950f378c218b3c041f5f3da4d1356f4d | Python | marcelo-gs/100DaysOfCode_Python | /Day029/Password-manager/main.py | UTF-8 | 4,875 | 3.046875 | 3 | [] | no_license | import tkinter
from tkinter import messagebox
from PIL import Image, ImageTk
from random import choice, randint, shuffle
import pyperclip
import json
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F'... | true |
a9c2be02a73588bf039d68fdf7f944571aab26a2 | Python | pnijhara/h2o4gpu | /tests/python/open_data/glm/test_lasso_sparsity.py | UTF-8 | 1,369 | 2.90625 | 3 | [
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # -*- encoding: utf-8 -*-
"""
ElasticNet_h2o4gpu solver tests using Iris dataset.
:copyright: 2017-2018 H2O.ai, Inc.
:license: Apache License Version 2.0 (see LICENSE for details)
"""
import time
import sys
import random
import numpy as np
import logging
import h2o4gpu
print(sys.path)
logging.basicConfig(level=log... | true |
860f82f3b3ed73e28bc50854d9e618190610a935 | Python | bbnsdevelop/python_3_estudos | /python3/poo/testeSample.py | UTF-8 | 117 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
# coding: utf-8
from Sample import Sample
def main():
x = Sample()
print(type(x))
main() | true |
c2109c961564d4266eb4d12fead70688ad05ee25 | Python | smerdis/mukerji-ay250 | /final_project/two_stage_model.py | UTF-8 | 4,388 | 2.96875 | 3 | [] | no_license | # This file contains the functions that implement the two-stage model of suppression described in
# https://www.sciencedirect.com/science/article/pii/S0042698908002290 <--- this paper
# which I tried to fit to the threshold data previously
#
# For this project, I'm fitting it to the individual trial data
# So some of t... | true |
0df3fae19b1dd926983ea8d5f55fd8e4710ea42c | Python | yxleung/MLTools | /evaluate/test/fasttext/news.py | UTF-8 | 1,445 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import fastText as ft
from utils import fasttext_utils
import classification.classification_visualization as cv
from sklearn.metrics import classification_report, confusion_matrix
def print_results(N, p, r):
print("N\t" + str(N))
print("P@{}\t{:.3f}".format(1, p))
print("R@{}\t{:... | true |
70b16abc6fd386076e8fd7bfa7a51bd52dd3a0e5 | Python | mnishiguchi/python_notebook | /MIT6001x/week3/isPalindrome.py | UTF-8 | 870 | 4.1875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# example of a “divide and conquer” algorithm
def isPalindrome(s):
# First, convert the string to just characters,
# by stripping out punctuation and converting upper case to lower case
def toChars(s):
s = s.lower()
ans = ''
for c in s:
... | true |
5cb76c4e571a191d3aea2aa593387b2a54d35280 | Python | KATO-Hiro/Somen-Soupy | /snippets/math/permutation.py | UTF-8 | 1,389 | 3.59375 | 4 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | class Permutation:
"""Count the total number of permutations.
nPr % mod.
Args:
max_value: Max size of list. The default is 500,050
mod : Modulo. The default is 10 ** 9 + 7.
Landau notation: O(n)
See:
https://atcoder.jp/contests/abc133/submissions/6275589
"""
def ... | true |
b0db94826fc29e39415392b9af0a839cd7766af5 | Python | ritwikranjan/mlProject | /mushrooms_naive_bayes/mushroom.py | UTF-8 | 1,371 | 2.734375 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn import metrics
df = pd.read_csv('mushrooms.csv')
le = LabelEncoder()
df = df.apply(le.fit_transform)
Y = df.values[:, 0]
X = df.values[:, 1:]
X_train, X_test, Y_tra... | true |
8dc5a4fdee32b8d3f762a348251f3a7cd7104262 | Python | wsdm-cup-2017/catsear | /python/msgraph/to_original.py | UTF-8 | 705 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
import sys
# alignment from MS
in1 = sys.argv[1]
# original file
in2 = sys.argv[2]
ms = dict()
with open(in1) as f:
for line in f:
line = line[:-1].split('\t')
if "nationality" in in2:
v = 3 * int(line[2])
if v > 7:
v = 7
else:
... | true |
05bfe1cefc50caa80d4faa0e34fff87fea226b99 | Python | bar2104y/Abramyan_1000_tasks | /Results/Python/Minmax/22.py | UTF-8 | 233 | 3.421875 | 3 | [] | no_license | n = int(input())
min1, min2 = 1000,1001
for i in range(n):
tmp = int(input())
if tmp < min2:
if tmp < min1:
min2 = min1
min1 = tmp
else:
min2 = tmp
print(min1, min2) | true |
d4298b2ba8009eef76e67523e435617e5285ac5f | Python | doanh123/projecteuler | /problem2.py | UTF-8 | 337 | 3.5625 | 4 | [] | no_license | #By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
from fibonaccigenerator import fib
def foo():
sum = 0
a = fib()
while True:
b=a.next()
if b>4000000:
break
if b%2==0:
sum +=b
print sum
foo()
... | true |
fda41934f6180a03780ac152b7c0da76bb168928 | Python | srinath047/Python-for-Industrial-Engineering | /Six Sigma/Probability Sampling/Stratified Random Sampling.py | UTF-8 | 501 | 2.9375 | 3 | [] | no_license | # Import StratifiedShuffleSplit
from sklearn.model_selection import StratifiedShuffleSplit
# Set the split criteria
split = StratifiedShuffleSplit(n_splits=1, test_size=4)
# Perform data frame split
for x, y in split.split(df, df['product_strata']):
stratified_random_sample = df.iloc[y].sort_values(by='product_id... | true |
d22107a3a2e8c17473f44c42e708d42a82ea3f31 | Python | ktemirbekovna/Sets_Dictionary_6 | /Problem_000.py | UTF-8 | 154 | 2.75 | 3 | [] | no_license | menu = {'lagman': 120, 'plov': '120', 'borsh': 100}
menu["besh_barmak"] = "130"
print(menu)
menu['lagman'] = 135
print(menu)
menu.pop("borsh")
print(menu) | true |
df2568ee0821ce6510e56d01280ad62720b9675d | Python | ajmainankon/Cyber-Security-random | /midpoint.py | UTF-8 | 3,127 | 3.40625 | 3 | [] | no_license | def coord(x,y):
"Convert world coordinates to pixel coordinates."
return x+320, y+240
def findzone(x1, y1, x2, y2):
delx = x2 - x1
dely = y2 - y1
if abs(delx) > abs(dely):
if (delx>0 and dely>0):
return 0
if (delx<0 and dely>0):
return 3
... | true |
b161791d5ee4c3074682c21660ba83e98554931d | Python | yatrik-s/PyExercise | /Exercide6.9.py | UTF-8 | 136 | 3.015625 | 3 | [] | no_license | # Exercise 6.9
data = 'X-DSPAM-Confidence: 0.8475'
atpos = data.find(':')
number = float(data[atpos + 1:])
print 'Number is: ', number
| true |
1d756ac541a35036ed09a124866342237a332d28 | Python | kazuma-shinomiya/leetcode | /121.best-time-to-buy-and-sell-stock.py | UTF-8 | 400 | 2.921875 | 3 | [] | no_license | #
# @lc app=leetcode id=121 lang=python3
#
# [121] Best Time to Buy and Sell Stock
#
# @lc code=start
class Solution:
def maxProfit(self, prices: List[int]) -> int:
minPrice = sys.maxsize
maxPrice = 0
for price in prices:
minPrice = min(price, minPrice)
maxPrice = ma... | true |
22ab084ac6b9e63fc862e101c6954d4d59daccaf | Python | kevin-cai1/COMP9321-ass2 | /fuel_model/file_read.py | UTF-8 | 1,162 | 2.71875 | 3 | [] | no_license | import pandas as pd
from sklearn.preprocessing import scale
df4 = pd.read_excel("fuel_data/price_history_checks_oct2019.xlsx", skiprows=2)
df3 = pd.read_excel("fuel_data/price_history_checks_sep2019.xlsx", skiprows=2)
df1 = pd.read_excel("fuel_data/service-station-price-history-jul-2019.xlsx", skiprows=2)
df2 = pd.re... | true |
e2e3234937397e6319a22871acaf158a2ceafaf9 | Python | JiHyeonMon/-pre-Algorithm | /bak-class1/day3/bak10872.py | UTF-8 | 241 | 3.53125 | 4 | [] | no_license | #10872
#0보다 크거나 같은 정수 N이 주어진다. 이때, N!을 출력하는 프로그램을 작성하시오.
def fac(a):
if a>1:
return a * fac(a-1)
else:
return 1
a = int(input())
print(fac(a))
| true |
ef935f7011da0119103bb4cb06c02e8f95a6660f | Python | google/binplist | /binplist/binplist.py | UTF-8 | 34,529 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | true |
5ffe3918e45b1e2e6b03e67333c285539d79c28d | Python | tomosh22/practical-3 | /specification-4/main.py | UTF-8 | 3,180 | 3.515625 | 4 | [] | no_license | from tkinter import Tk, Button, Entry, Label, Frame, Text, END, messagebox
from calc import *
def add(name, values, text, sets):
# if name or values are empty display error message
if "" in [name.get(), values.get()]:
messagebox.showinfo("No name and value", "Please enter a name and values")
r... | true |
1182764fe32c493a7ff363fc86f42c1c9e2ae8a0 | Python | srlindemann/amp | /im/kibot/metadata/test/test_contract_symbol_mapper.py | UTF-8 | 2,987 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | from unittest.mock import patch
import pandas as pd
import helpers.unit_test as hut
import im.kibot.metadata.load.contract_symbol_mapping as csm
class TestContractSymbolMapper(hut.TestCase):
def test_get_contract1(self):
"""
Valid input returns a valid output.
"""
with self._mock... | true |
74f27626fc1f4bb483982734bf910b1a62d6f0ab | Python | flashwade03/PythonScripts | /game_solver/progressbar_ex.py | UTF-8 | 281 | 2.71875 | 3 | [] | no_license | from progressbar import ProgressBar
import time,sys
progress = 0
def main():
pb = ProgressBar(100)
global progress
while progress != 101:
progress += 1
pb.setProgress(progress)
time.sleep(0.1)
if __name__ == "__main__":
sys.exit(main())
| true |
19f15e44adeb5e3bb0d559cb72c867ad717fda83 | Python | xxTesting/12ProTesting | /testing/test_pytest.py | UTF-8 | 405 | 2.78125 | 3 | [] | no_license | import pytest
from python.calc import Calc
class TestCalc:
def test_add(self):
self.calc = Calc()
result = self.calc.add(1, 2)
print(result)
assert 3 == result
def test_div(self):
self.calc = Calc()
result = self.calc.div(2,2)
assert 1 == result
if _... | true |
4c63cf3144170da234fb10aae7816e4dddba618f | Python | Aasthaengg/IBMdataset | /Python_codes/p03803/s732752110.py | UTF-8 | 232 | 3.421875 | 3 | [] | no_license | card = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]
alice, bob = map(int, input().split())
if card.index(alice) > card.index(bob):
print('Alice')
elif card.index(alice) < card.index(bob):
print('Bob')
else:
print('Draw')
| true |
bc6570606e3c9ff28b533ccd076b077136711ddd | Python | sauerseb/Week-Six-Assignment | /world.py | UTF-8 | 801 | 3.34375 | 3 | [
"MIT"
] | permissive | # Evan Sauers
# CIS-125-82A
# Collaborated with Marisa Gross, Rebekah Orth, and Dr.Neumann
# world.py
# Populate Function, world & height & weight parameters, returns a value
def populate(world,h,w):
pass
# Display Function, world & height & weight parameters, returns a value
def display(world,h,w):
pass
# G... | true |
773e355d72b62090b0a3221ef1cca1b4d6c597d1 | Python | maniaclogic/titanic_model | /code_titanic.py | UTF-8 | 2,809 | 3.390625 | 3 | [
"MIT"
] | permissive | import pandas as pd
from matplotlib import pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import LabelEncoder
df = pd.read_csv('train.csv')
dfi = df.set_index('PassengerId')
dfi.shape
dfi.columns
dfi.describe()
dfi.info()
#Write a program that calculates the number of survi... | true |
7d0d7451ff49a4e848e4f8ac5742bdb94a023044 | Python | anasm-17/Hiroku-Test | /app.py | UTF-8 | 4,673 | 2.703125 | 3 | [] | no_license | import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import numpy as np
import altair as alt
import vega_datasets
alt.data_transformers.enable('default')
alt.data_transformers.disable_max_rows()
app = dash.Dash(__name__, assets_folder='assets')
server = app.server
ap... | true |
572d1ab67a684225a901cda6a8b240e421e54fc1 | Python | TechNerdPython/JARVIS | /jarvis.py | UTF-8 | 22,485 | 3 | 3 | [] | no_license | import pyttsx3
import datetime
import speech_recognition as sr
import wikipedia
import webbrowser
import os
import smtplib
import time
import math
import random
import json
import requests
import pytz
from googletrans import Translator
engine = pyttsx3.init("sapi5")
voices = engine.getProperty("voices"... | true |
eeacd96cdc2a14251d18ce11713a476c924e15cb | Python | gwasserfall/fix-me | /simulation/instance.py | UTF-8 | 1,610 | 2.515625 | 3 | [] | no_license | from simulation.messaging import checksum
import socket
class BrokerInstance():
def __init__(self, host="127.0.0.1", port=5000):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
self.sock.connect((host, port))
self.logon()
except Exception as e:
raise
def logon(self):
data = self... | true |
d23fe11b32ceed0f850c156619d6539c78027845 | Python | BreakBB/v_commender | /v_commender/utilities.py | UTF-8 | 488 | 2.890625 | 3 | [] | no_license | import json
from random import shuffle
def save_recommendations_to_file(predicted_list):
file_name = "predicted.json"
# print("Saving " + str(len(predicted_list)) + " items to " + file_name, flush=True)
with open(file_name, "w") as f:
f.write(json.dumps(predicted_list))
def split_data_set(data_... | true |
0b185e0bfb09455f6824fe62e40f136ed61d0e32 | Python | janesferr/WADD-Courses | /WA170 - Programming with Python/WA170_textbook_example_programs/Ch_07_Student_Files/drawpolygon.py | UTF-8 | 388 | 4.15625 | 4 | [] | no_license | from turtle import Turtle
def drawPolygon(t, vertices):
"""Draws a polygon from a list of vertices.
The list has the form [(x1, y1), ..., (xn, yn)]."""
t.up()
(x, y) = vertices[-1]
t.goto(x, y)
t.down()
for (x, y) in vertices:
t.goto(x, y)
def main():
t = Turtle()
t.hidetur... | true |
3c83dee3aaf6eb7cffc040e715ae042a2cfa633e | Python | ccirelli2/asyncio | /asyncio_/asyncio_notes.py | UTF-8 | 1,613 | 4 | 4 | [] | no_license | # LEARN ASYNCIO
'''
Coroutines: Coroutines look like a normal function, but in their
behaviour they are stateful objects with resume() and pause() — like methods.
Pause: The way a coroutine pauses itself is by using the 'await'
keyword. When you 'await' another coroutine, you 'step off'
the event loop an... | true |
a66311a6c4b086cbf6c593104e129af553d7fb69 | Python | acgis-ungu0008/testing-testing | /EfeUngun/exercise3.py | UTF-8 | 221 | 3.78125 | 4 | [] | no_license | ##Exercise 3:Square merers to hectares
##Input: square meters is 10000
##Output: <Sq m> aq.m = <z> hectares
sqm=10000
sqm_per_hectares=0.0001
hectares=sqm*sqm_per_hectares
print "%d sq.m = %d hectares" % (sqm, hectares) | true |
3d42f6f21d40a87e841a3491ca61ac9ccce15eda | Python | Lab41PaulM/Circulo | /circulo/unit_tests/metrics.py | UTF-8 | 8,003 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | import random
import unittest
import numpy as np
import circulo.metrics
import igraph
from circulo.metrics import VertexCoverMetric
class TestMetrics(unittest.TestCase):
def setUp(self):
self.G=igraph.load("karate.gml")
membership=[
[0,1,2,3,7,11,12,13,17,19,21],
... | true |
be965d2ca76bae91268499202a3064c418a5d140 | Python | wsgan001/PyFPattern | /Data Set/bug-fixing-5/741b941f332d037a32bb70427865eeddc888ee0d-<_validate_config>-fix.py | UTF-8 | 510 | 2.546875 | 3 | [] | no_license | def _validate_config(self, loader, path):
'\n :param loader: an ansible.parsing.dataloader.DataLoader object\n :param path: the path to the inventory config file\n :return the contents of the config file\n '
if super(InventoryModule, self).verify_file(path):
if (p... | true |
d5b7d36e21add6c213ddd159d08fadf250ef1fe4 | Python | alexw9988/filter_tree | /tree/item.py | UTF-8 | 11,561 | 2.625 | 3 | [] | no_license |
import time
from collections.abc import MutableMapping
from PyQt5 import QtCore, QtGui, QtWidgets
from parameters import ParameterModel
from save_info import SaveModel
class FilterItem(QtGui.QStandardItem):
"""
The FilterStep class used for all filter tree steps.
The step can take any of the following... | true |
f2d6192ca63304a9692aef7435403feaed22f6b7 | Python | Aasthaengg/IBMdataset | /Python_codes/p03433/s032160900.py | UTF-8 | 108 | 2.9375 | 3 | [] | no_license | n, a = map(int, [input() for i in range(2)])
if n-500*(n//500) <= a:
print("Yes")
else:
print("No") | true |