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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c558f72d7fad0e834ae7fb4ace391bf26e32d018 | Python | varnar217/lesson2 | /ana.py | UTF-8 | 461 | 2.921875 | 3 | [] | no_license | doing={"Как дела ?": "Хорошо!", "Что делаешь?": "Программирую"}
def ask_user():
while True:
bufer_string=input('пользователь\n')
#print(doing[bufer_string])
try :
doing[bufer_string]
print(doing[bufer_string])
break
#pass
exce... | true |
0b44063b8709f7f10a66acf22e36c97fa0a33acf | Python | VinACE/producer_shield | /ihealthdata/utils/configmanager.py | UTF-8 | 1,171 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | import configparser as configParser
import os
class ConfigManager:
def __init__(self):
self.config_parser = configParser.ConfigParser()
file_name = os.path.join(os.getcwd(), 'config.ini')
print(file_name)
print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
self.config_parser.read(os.p... | true |
d08a4abdd7297beddb3baea6c13c8d519a2b31f8 | Python | PhraxayaM/amazon_practice_problems | /Batch #1/Medium/sum of nodes with even valued grandparents.py | UTF-8 | 1,161 | 3.65625 | 4 | [] | no_license | """
Given a binary tree, return the sum of values of nodes with even-valued grandparent. (A grandparent of a node is the parent of its parent, if it exists.)
If there are no nodes with an even-valued grandparent, return 0.
Example 1:
6
/ \
7 8
/ \ / \
2 7 1 3
/... | true |
d73a8134ed8c4b477d2567b8ca74566a25e3b271 | Python | shangpf1/python-homework | /2018-12/test6.py | UTF-8 | 941 | 4.46875 | 4 | [] | no_license | # 总结 filter reduce map函数的用法
# 处理序列中的每个元素,得到的结果是一个“列表”,该列表元素个数及位置与原来一样
# map()
# filter 遍历序列中的每个元素,判断每个元素得到布尔值,如果是True则留下来
people = [
{'name':'alex','age':1000},
{'name':'lucy','age':10000},
{'name':'jack','age':9000},
{'name':'rose','age':18}
]
# 过滤掉people中年龄大于18的人 -- filter函数
res = filter(lambda p... | true |
70b28f5d2698f122d136fd81f91db79828079cfc | Python | senoa95/agbot_deploy | /src/agbot_nav/src/pp_controller.py | UTF-8 | 5,749 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
import math
from geometry_msgs.msg import Point32,Pose
import transforms3d as tf
import numpy as np
pi = 3.141592653589793238
#class to define vehicle position on a coordinate system at a certain heading
class Point:
def __init__(self,inputX = 0,inputY = 0,inputHeading = 0):
... | true |
26c9efd8c141da03e02fe38882bfc32fc3235cf9 | Python | MareboinaRavi/python | /ds_problem.py | UTF-8 | 242 | 3.015625 | 3 | [] | no_license | class A(object):
def method(self):
print('I am from class A')
class B(A):
def method(self):
print('I am from class B')
class C(A):
def method(self):
print('I am from class C')
class D(C,B):
pass
d = D()
d.method()
print(D.mro()) | true |
8646bc886ecb534ffb03bf13ebaad0ebc03db246 | Python | aklys/Black_Jack | /Card_Deck.py | UTF-8 | 1,663 | 3.8125 | 4 | [] | no_license | import random
class Deck:
def __init__(self):
self.deck = []
def generate_std_deck(self):
std_cards = {"Suits": ["S", "C", "H", "D"],
"Value": ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"J", "Q", "K"]}
for i in std_cards["... | true |
9e281e072c7da292fc16de4928efa8362c5e7b6e | Python | JiaoZexin/PyDemo | /kaike/first/3Demo1.py | UTF-8 | 789 | 4.28125 | 4 | [] | no_license | height = 0;
while height < 170:
height = int(input('继续输入身高:'))
print('已经找到人去搬水了~')
print('''课外题一:for 循环能确定循环次数while 不能确定循环次数 需要有跳出while循环的条件 break等''')
print('课外题二')
sum1 = 0;
for i in range(1, 101):
sum1 += i;
print('使用for循环打印1-100之间的和:', sum1)
sum2 = 0;
i = 1;
while i < 101:
sum2 += i;
i+=1;
print(... | true |
a25da94f8d1616a2e12fe90111b9dffba4df10ea | Python | matib99/DWave | /CVRPTW/cvrptw_problem.py | UTF-8 | 11,731 | 2.8125 | 3 | [] | no_license | from qubo_helper import Qubo
from itertools import combinations, permutations
class CVRPTWProblem:
def __init__(self, sources, costs, time_costs, capacities, dests, weights, time_windows, vehicles_num, time_blocks_num):
self.costs = costs
self.time_costs = time_costs
self.capac... | true |
ac7fbcd1e9769eed2c78fb322966e4f338107b17 | Python | prajaktaaD/Basic-Python1 | /Loop_control_statements.py | UTF-8 | 215 | 3.59375 | 4 | [] | no_license | x=int(input("enter the num of items:"))
i=1
stock=7
while(i<=x):
if(i<=stock):
print("issue product=",i)
i+=1
continue
else:
print("out of stock")
i=i+1
break
| true |
b1f9f2485b8629fe5e6c66ad4148ec2653e403c3 | Python | moriken0921/python_study | /応用編/14.ファイル読み書き/sample01.py | UTF-8 | 259 | 2.671875 | 3 | [] | no_license | import sys
import io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
f = open('/Users/kentomori/Documents/GitHub/python_study/応用編/14.ファイル読み書き/read.txt', 'r', encoding='utf-8')
for row in f:
print(row)
f.close()
| true |
f1f9f5c4a4bf5a5925354d2d2d496fe803e611eb | Python | iliankostadinov/thinkpython | /Chapter17/Exercise_17_2.py | UTF-8 | 1,317 | 4.3125 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
"""
Write a definition for a class named Kangaroo with the following methods:
1. An __init__ method that initializes an attribute named pouch_contents to an
empty list.
2. A method named put_in_pouch that takes an object of any type and adds it to
pouch_contents .
3. A __str__ method that retur... | true |
6e0c368df092c622b3142de56e274d79d7d5b2b5 | Python | AnhQuann/nguyenanhquan-fundameltal-c4e14 | /Fundamentals/session04/homework/serious_4.py | UTF-8 | 282 | 3.75 | 4 | [] | no_license | bacteriaB = int(input('How many B bacteria are there? '))
minute = int(input('How much time in minute will we wait? '))
looptime = int(minute/2)
for i in range(looptime):
bacteriaB=bacteriaB*2
print('After {0} minutes, we would have {1} bacterias'.format(minute, bacteriaB))
| true |
6a98bac5d88bd86227178b30a590a05484929bc1 | Python | adamtorok96/GitSpider | /GitSpider.py | UTF-8 | 2,281 | 2.609375 | 3 | [] | no_license | from urllib.parse import urlparse
import requests
import scrapy
def has_directory(url, directory='.git'):
return has_file(url, directory + '/')
def has_file(url, file):
full_url = '%s/%s' % (url, file)
r = requests.get('%s' % full_url, allow_redirects=False, timeout=2)
valid_codes = [
200... | true |
7236b15a549a3d089335f590d202bf652f243374 | Python | vqpv/stepik-course-58852 | /7 Циклы for и while/7.3 Частые сценарии/4.py | UTF-8 | 156 | 3.34375 | 3 | [] | no_license | n = int(input())
summa = 0
for i in range(n + 1):
if (i ** 2) % 10 == 2 or (i ** 2) % 10 == 5 or (i ** 2) % 10 == 8:
summa += i
print(summa)
| true |
9b27b5880b9536253d2c152c13e51d39924726bd | Python | njokuifeanyigerald/corona-tracker-with-python-speech | /app.py | UTF-8 | 4,372 | 2.640625 | 3 | [] | no_license | import requests
import json
import pyttsx3
import speech_recognition as sr
import re
import threading
import time
APIKEY= 't_Hc1GB4FOkj'
PROJECTTOKEN = 'tN9U7jFUG2JB'
RUNTOKEN = 'tPFHv-guQC-5'
class Data:
def __init__(self, api_key, project_token):
self.api_key = api_key
self.project_token = pr... | true |
5e88ce42705287e37b5d0a0d9ef2583c9dd837b5 | Python | meelement/Chatette | /chatette/units/slot/rule_content.py | UTF-8 | 6,115 | 2.828125 | 3 | [
"MIT"
] | permissive | from __future__ import print_function
from random import randint
from chatette.parsing.parser_utils import UnitType, remove_escapement, \
add_escapement_back_in_unit_ref
from chatette.units import Example, RuleContent, may_get_leading_space, \
may_ch... | true |
00545c1b131034dcece76ce13e9d8f7ed4b59e63 | Python | tom-frantz/chesslet | /chesslet/player.py | UTF-8 | 1,554 | 3.34375 | 3 | [] | no_license | # chesslet/player.py
class InvalidPasswordException(Exception):
pass
class AlreadyLoggedInException(Exception):
pass
class PlayerNotLoggedIn(Exception):
pass
class Player:
def __init__(
self,
uuid,
password,
account_name,
highscore=0,
... | true |
5ff040107357dbb848198d127eb6af7f1dc7c77a | Python | text-master/textmaster | /clf/model_saver.py | UTF-8 | 1,383 | 2.640625 | 3 | [] | no_license | import random
import time
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.naive_bayes import MultinomialNB
import csv
from sklearn.model_selection import train_test_split
from sklearn.externals import joblib
def get_topic_list(topic_name):
with open('validated_csv/' + topic_name + '.csv',... | true |
bcbb0d0b29cceb830ffa0b5ebea159f083a4af7a | Python | l-iberty/machine_learning | /VAE-PyTorch/main.py | UTF-8 | 4,512 | 2.59375 | 3 | [] | no_license | import os
import torch
import torchvision
from torch.utils.data import DataLoader
from model import VAE
import numpy as np
import matplotlib.pyplot as plt
np.set_printoptions(threshold=np.inf)
train_data = torchvision.datasets.MNIST(
"mnist", train=True, transform=torchvision.transforms.ToTensor(), download=False... | true |
7bcfee0f33d2ce389920ebeb6b8e3c507e9bc9c5 | Python | olekstomek/mcod-backend-dane.gov.pl | /mcod/lib/validators.py | UTF-8 | 1,893 | 2.65625 | 3 | [] | no_license | import json
import falcon
class RequestValidator(object):
__parsers__ = {
'json': 'parse_json',
'querystring': 'parse_querystring',
'query': 'parse_querystring',
'form': 'parse_form',
'headers': 'parse_headers',
'cookies': 'parse_cookies',
'files': 'parse_fi... | true |
b6010b150a77287b2a7983609b87006f010a1b3b | Python | jiafulow/emtf-nnet | /emtf_nnet/sparse/indexed_slices_value.py | UTF-8 | 4,250 | 2.828125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # The following source code was originally obtained from:
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/framework/indexed_slices.py
# ==============================================================================
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed unde... | true |
b3d98203d15b30a2bda8338765a29fce1e00b9b6 | Python | gabriellaec/desoft-analise-exercicios | /backup/user_148/ch127_2020_04_01_16_38_55_817376.py | UTF-8 | 90 | 2.65625 | 3 | [] | no_license | import math
def calcula_elongacao(A, k0, w, t):
x = A*(math.cos(k0+w*t))
return x | true |
9c241670b30c669c6c75323d6f3a4fa10be39a41 | Python | JulyKikuAkita/PythonPrac | /cs15211/EscapeTheGhosts.py | UTF-8 | 2,795 | 3.796875 | 4 | [
"Apache-2.0"
] | permissive | __source__ = 'https://leetcode.com/problems/escape-the-ghosts/'
# Time: O()
# Space: O()
#
# Description: Leetcode # 789. Escape The Ghosts
#
# You are playing a simplified Pacman game. You start at the point (0, 0),
# and your destination is (target[0], target[1]). There are several ghosts on the map,
# the i-th ghos... | true |
de2f36c719af40f30acd0766a95de21701fc03d0 | Python | AGarrow/blank_anthropod | /anthropod/scripts/contacts_migrate_to_object.py | UTF-8 | 570 | 2.53125 | 3 | [] | no_license | '''Migrate contact info from a list of 3-tuples to objects.
'''
from anthropod.core import db
def migrate_contacts(thing):
contacts = thing['contact_details']
fieldnames = ('type', 'value', 'note')
contacts = [dict(zip(fieldnames, tpl)) for tpl in contacts]
thing['contact_details'] = contacts
retu... | true |
8d445b5c2c9416d9fe9f934bd266344ed3ce24f1 | Python | ncollins/lis.py | /test_eval.py | UTF-8 | 2,737 | 2.984375 | 3 | [] | no_license |
from lex import tokenize
from parse import parse_tokens
from evaluate import eval_in_env, Environment
def test_eval_add_const():
exp = ['+', 3, 4]
res = eval_in_env(exp, Environment([]))
assert res == 7
def test_eval_if():
exp = ['if', True, 3, 4]
assert eval_in_env(exp, Environment([])) == 3
... | true |
7257775d1582f5e39d4db78a0f446f728d9a5da7 | Python | bkrive19/cl-starter | /Tera.py | UTF-8 | 8,570 | 3.78125 | 4 | [] | no_license | def clear():
from os import system, name
# for windows
if name == 'nt':
_ = system('cls')
# for mac and linux(here, os.name is 'posix')
else:
_ = system('clear')
clear()
print("In this story- you can't choose where you were born. You can't choose how you were born.")
print("H... | true |
409ba4b750be06250235bf656b68eb27a1d6d80a | Python | u2386/leet | /6-ZigZag Conversion/solution.py | UTF-8 | 565 | 3.453125 | 3 | [] | no_license | # coding: utf-8
class Solution(object):
def convert(self, s, numRows):
"""
:type s: str
:type numRows: int
:rtype: str
"""
if len(s) < numRows or numRows == 1:
return s
pat = ['' for _ in range(len(s))]
x, d = 0, 1
for c in s:
... | true |
6f521329035b9dff09b1ed425d1a0919108acba3 | Python | moonrollersoft/subtitles | /src/series_parser.py | UTF-8 | 546 | 3.1875 | 3 | [
"MIT"
] | permissive | import re
SERIES_SEPARATOR_GROUP_REGEX = '( ?[eE]| ?[xX])'
SERIES_GROUPS_REGEX = r'([0-9]+){}([0-9]+)'.format(SERIES_SEPARATOR_GROUP_REGEX)
class SeriesFilenameParser:
def __init__(self, filename):
pattern = re.compile(SERIES_GROUPS_REGEX)
matched_pattern = pattern.search(filename)
self.... | true |
8a583f173cbd0fef0e7b56218608702f2f7f0172 | Python | mvilchis/aprendizaje_proyecto | /adaBoostClassifier.py | UTF-8 | 310 | 2.5625 | 3 | [] | no_license | from sklearn.ensemble import *
from sklearn.metrics import accuracy_score
# Ensemble algorithms used
model_adaBoost = AdaBoostClassifier(n_estimators=100)
model_adaBoost.fit(x_train, y_train)
predictions_ada = model_adaBoost.predict(x_test)
print(accuracy_score(y_test, predictions_ada))
# 30% de accuracy
| true |
b876de9f50db039afa9a8c0cd3e57c189d6280c0 | Python | rubenglezant/ORDENADOS | /FINAL2/GetInfoCRM/getDataWeb.py | UTF-8 | 2,606 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python
# Obtiene los datos de la Web
import urllib2
import base64
import json
def GetAtributoEspecial(idOportunidad, nombreAtributo):
# Obtenemos los atributos especiales
username = '2d486e42771eee18125b8aef3afe216d'
password = '4c2TNRdi'
req = urllib2.Request('https://infeci.capsulecrm.co... | true |
2fc35c39c629ba365fd15b2eb3a3fa19e169f708 | Python | carodewig/advent-of-code | /advent-py/2015/day_14.py | UTF-8 | 1,350 | 3.4375 | 3 | [] | no_license | """ day 14: reindeer olympics """
import re
from collections import defaultdict
import attr
@attr.s
class Reindeer:
name = attr.ib()
speed = attr.ib()
fly_duration = attr.ib()
rest_duration = attr.ib()
distance = attr.ib(init=False, default=0)
seconds_flown = attr.ib(init=False, default=0)... | true |
f0c8ab54dd61c02bf6d0027ff472e730b34475d0 | Python | mittagessen/kraken | /kraken/contrib/generate_scripts.py | UTF-8 | 1,125 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
"""
Script fetching the latest unicode Scripts.txt and dumping it as json.
"""
from urllib import request
import json
import regex
uri = 'http://www.unicode.org/Public/UNIDATA/Scripts.txt'
re = regex.compile(r'^(?P<start>[0-9A-F]{4,6})(..(?P<end>[0-9A-F]{4,6}))?\s+; (?P<name>[A-Za-z]+)')
with ... | true |
ee99f365816dcaaed2fd14038874b72fa39e58f1 | Python | kinow/mint | /scripts/compute_trapezoidal_bilinear_flux.py | UTF-8 | 2,215 | 2.65625 | 3 | [
"0BSD"
] | permissive | import vtk
import argparse
import numpy
parser = argparse.ArgumentParser(description='Write line point data to file')
parser.add_argument('-p', type=str, default="(0., 0.),(1., 0.)",
help='Interlaced xy points')
parser.add_argument('-o', type=str, default="line.vtk",
help='Out... | true |
9a8cc7686318e3e7e120bd3a51030b720c6bb418 | Python | aarontinn13/MPCS-52011 | /project9/commentstripper.py | UTF-8 | 2,855 | 2.875 | 3 | [] | no_license | def stripcomments(path):
with open(path, 'r') as r:
with open('nocomments.out', 'a+') as w:
flag = False
for i in r.readlines():
found = False
#remove all blank lines
if i == '\n' or i == '\t\n':
continue
... | true |
5be6a12a0a9d8575cf6324c1c31c026707f41933 | Python | chefe996/chatbot | /ruchatbot/bot/unittest_dummy_answering_machine.py | UTF-8 | 472 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import unittest
from dummy_answering_machine import DummyAnsweringMachine
class TestDummyAnsweringMachine(unittest.TestCase):
def setUp(self):
self.bot = DummyAnsweringMachine()
def test_echo(self):
input_phrase = u'входная фраза'
self.bot.push_phrase('test', ... | true |
0afa60580c1406cc9ca89cf696efa54002dcea9c | Python | zongdaoming/MDN | /Machine_Learning_Models/hmm.py | UTF-8 | 2,622 | 3.15625 | 3 | [] | no_license | import numpy as np
states = ('Healthy', 'Fever')
observations = ('normal', 'cold', 'dizzy')
start_probability = {'Healthy': 0.6, 'Fever': 0.4}
transition_probability = {
'Healthy': {'Healthy': 0.7, 'Fever': 0.3},
'Fever': {'Healthy': 0.4, 'Fever': 0.6},
}
emission_probability = {
'Healthy': {'normal': ... | true |
4f9e819867ae5b1d8d144f41ee0e978a1eadc19f | Python | JunaidRana/MLStuff | /Boruta/KNN_Boruta.py | UTF-8 | 701 | 2.828125 | 3 | [] | no_license | import pandas as pd
import numpy as np
#This dataset is organised by feature importance.
df = pd.read_csv('normcleve_knn.csv')
df1 = df
array = df1.values
#We already know the feature importance and ranking through Boruta files.
#Here we are taking only two columns and our accuracy rate is still 96.7 %
X = array[:,0:2... | true |
e090229ec5ac01f07fece9baa2789a77b578dc9e | Python | lizuyao2010/summer_ttic | /binary_words_withdic.py | UTF-8 | 2,733 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python
import json
from nltk.tokenize import word_tokenize
word2ind={}
relation2ind={}
flag=1
# count number of questions
count=0
def encode_word(text,dic,fw):
codes=[]
for word in text:
if word in dic:
codes.append(str(dic[word]))
print >> fw, ' '.join(codes)
def encode_rel... | true |
0a22bd2be69aac2818d324f8ac61245e276a023a | Python | jimmykimani/andela-14- | /Day_0/prime/test_prime_numbers.py | UTF-8 | 1,601 | 3.59375 | 4 | [] | no_license | import prime_numbers
import unittest
class PrimeNumbersTest(unittest.TestCase):
"""prime number test for Integer, """
def test_if_value_is_integer(self):
self.assertEqual(prime_numbers.prime_numbers("three"), "only Integers alowed")
def test_zero_is_not_prime(self):
self.assertEqual(prim... | true |
9feaa100a5150d6f4512d59d88acd6f094f9a8b3 | Python | michaelfisher/python | /ex4.py | UTF-8 | 942 | 4.21875 | 4 | [] | no_license | #How many cars are available in total?
cars = 100
#How many seats are available in each car
space_in_a_car = 4.0
#How many people will be driving a car
drivers = 30
#How many people will not be driving, but still need a ride
passengers = 90
#How many cars will not be driven?
cars_not_driven = cars - drivers
#How m... | true |
2ef92a85dd1366079d8533f694ca12e5d85d794a | Python | samantha-jian/learn-python-in-hacker-way | /courses/novice/exercises/week1/1-student.py | UTF-8 | 210 | 3.296875 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf8 -*-
str1 = ' 《五音集韻》說:「人死為鬼,人見懼之;鬼死為魙,鬼見怕之。」 '
str2 = '我愛紅娘'
msg = str1.strip()
print msg + str2
| true |
8f0a1394e5998457f3fd84b45421927175e1d035 | Python | hmvege/LatViz | /latviz/latviz.py | UTF-8 | 6,474 | 2.953125 | 3 | [
"MIT"
] | permissive | import subprocess
from pathlib import Path
from typing import Optional
import numpy as np
import pyvista as pv
from loguru import logger
from tqdm import tqdm
def create_animation(
frame_folder: Path,
animation_folder: Path,
observable: str,
animation_type: str,
time_slice: Optional[int] = None,
... | true |
d15fdf75281dca89838b55220537518e7790e556 | Python | boratw/metalearn-gym | /metalearn/test2.py | UTF-8 | 3,545 | 2.515625 | 3 | [
"MIT"
] | permissive | import gym
import numpy as np
import tensorflow as tf
import random
input_state = tf.placeholder(tf.float32, [None, 4])
input_action = tf.placeholder(tf.float32, [None, 5])
input_qvalue = tf.placeholder(tf.float32, [None, 1])
global_step = tf.placeholder(tf.int64)
w1 = tf.Variable(tf.truncated_normal([4, 40], stddev... | true |
1a52adcaabb5a781a9298e4fe221892cfbbbb012 | Python | jinzaizhichi/akshare | /akshare/datasets.py | UTF-8 | 1,631 | 2.84375 | 3 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
# !/usr/bin/env python
"""
Date: 2022/5/9 18:08
Desc: 导入文件工具,可以正确处理路径问题
"""
from importlib import resources
import pathlib
def get_ths_js(file: str = "ths.js") -> pathlib.Path:
"""Get path to data "ths.js" text file.
Returns
-------
pathlib.PosixPath
Path to file.
... | true |
99803194f6b7415a5cb2d1f3bd3859d1ffd294de | Python | GIA-USB/LARC-2017 | /MOTORS/ServoPWM.py | UTF-8 | 1,269 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python
import pigpio
import time
ORDENHA = 4
APRIETA = 3
pi = pigpio.pi()
pi.set_mode(ORDENHA, pigpio.OUTPUT)
pi.set_mode(APRIETA, pigpio.OUTPUT)
#print("setting to: ",pi.set_servo_pulsewidth(APRIETA, 1000)) # Mover servo
#print("set to: ",pi.get_servo_pulsewidth(APRIETA))
#time.sleep(1)
veces = 4
for i ... | true |
195d51c2342b895c0cd185d873ce50f8c269a057 | Python | yiyscut/drumExtractor | /features.py | UTF-8 | 3,903 | 2.9375 | 3 | [] | no_license | #functions for extracting features from audio signals
from scipy import *
import numpy as np
from rect import halfWave
from stft import *
#dexters
def hfc(X):
hfcs = np.zeros(X.shape[0])
for k in range(X.shape[0]):
print("K = ", k)
hfcs[k] = np.sum(np.abs((X[k, :])*k))
return hfcs
def RMS... | true |
1a34da58fc77170054d3895ecaef9e7752d0c462 | Python | dekasthiti/pythonic | /yoga/bit_manipulation/hamming_dist.py | UTF-8 | 600 | 3.796875 | 4 | [] | no_license | from argparse import ArgumentParser
class Solution:
def hammingDistance(self, x: int, y: int) -> int:
tmp = x ^ y # Find bits that are different
return bin(tmp).count('1')
#461. Hamming Distance
if __name__ == '__main__':
sol = Solution()
parser = ArgumentParser()
parser.add_argume... | true |
864258ba5b2653f2e89ac51a424cfbcc2c2953ab | Python | lalitkapoor112000/Python | /List Comprehension.py | UTF-8 | 53 | 2.609375 | 3 | [] | no_license | squares=[i**2 for i in range(1,11)]
print(squares)
| true |
1979bd3ba191453f760c4f78a3cd0fcff44b0a83 | Python | sukritsangvong/Hearts | /heartCard.py | UTF-8 | 2,177 | 3.5 | 4 | [] | no_license | import random
from heartCard import *
from playable import *
from takeCardFromBoard import *
def generatePlayers():
'''Makes a list containing the 4 player objects.'''
players = []
for i in range(4):
players.append(player())
return players
class player:
'''An object that has... | true |
7bc623835e7991b1db0893422c4c025d4cd0a271 | Python | zhengguorong/pomes_lstm | /utils/helper.py | UTF-8 | 2,936 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import collections
import os
import sys
import numpy as np
# 将数据转换为字词向量
def data_process(file_name):
datas = []
# 提取每行诗的标题和内容,去除长度小于5和大于79的数据,并按诗的字数排序
with open(file_name, "r") as f:
for line in f.readlines():
try:
line = line.decode('UTF-8') #如果... | true |
6b21fc15855b6ff9c307277fe543a70b5f621e33 | Python | helloira-al/Classic-CS-in-Python-Notes | /fibonacci_sequence1/main.py | UTF-8 | 788 | 4.59375 | 5 | [] | no_license | #the code below implements explicit memoization to calculate the nth Fibonacci value
fibonacci_cache = {}
def fibonacci(n):
# check if n is aleady stored in the cached values
if n in fibonacci_cache:
return fibonacci_cache[n]
# otherwise calculate the nth term
# check if n is an integer
... | true |
d835bc2dcf4e0eae753f65be219fdeeb78e51e40 | Python | Nashluffy/49er-sense-edge | /serverSocket.py | UTF-8 | 967 | 3.234375 | 3 | [] | no_license | import socket
from gpiozero import LED
from time import sleep
led = LED(17)
port = 12345
try:
s = socket.socket()
print 'Socket successfully created!'
except:
print 'Socket creation failed'
try:
s.bind(('', port))
print 'Socket binded to %s' %(port)
except:
print 'Failed to... | true |
3c33e6654e4ea6933fbb88f34fff739f9c9019f8 | Python | ec-geolink/d1lod | /d1lod/d1lod/people/documents.py | UTF-8 | 3,264 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | """
file: documents.py
author: Bryce Meucm
Gets n scimeta documents off the D1 Solr index and saves them in a
subdirectory.
"""
def getDocuments(n=100, start=0):
"""Get `n`, staring at `start` documents off the CN's Solr index."""
base_url = "https://cn.dataone.org/cn/v1/query/solr/"
fie... | true |
a6e57ddfac99abf9f9c5a8e38de1333917fb38f6 | Python | zhanghao-esrichina/bigdata-project | /basic_grammar/进程线程/多线程同步.py | UTF-8 | 1,119 | 3.484375 | 3 | [] | no_license | '''
共享数据
如果多个线程对某个数据进行修改,则可能出现不可预料对结果,为了保证数据的正确性,需要对多个线程进行同步,一个一个的完成。
使用thread对象的Lock和Rlock可以实现简单的线程同步,这两个对象都有acquire方法和release方法
对于那些需要每次只允许一个线程操作的数据,可以将其操作放到acquire和release方法之间
'''
import threading
import random
import time
lock = threading.Lock()
list1 = [0]*10
def set_list_value():
# 获取线程锁,如果已经上锁则等待释放
... | true |
60d38ee0cf31c1ae303a16b4f3e76dbf3d0b3625 | Python | mla96/Paired-Autoencoder-Image-Fusion | /Registration/registration.py | UTF-8 | 3,919 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
"""
This file contains functions to register a moving image to a fixed image.
"""
import numpy as np
import SimpleITK as sitk
from PIL import Image
# Print registration metrics
def command_iteration(method):
print("{0:3} = {1:10.5f} : {2}".format(method.GetOptimizerIteration(),
... | true |
393be373e6fe3c2f5de36b37bc3cc8f3bbd5117c | Python | shiqing881215/Python | /object&database/constructorDestructor.py | UTF-8 | 742 | 4.1875 | 4 | [] | no_license | class PartyAnimal :
x = 0
name = ""
# This is the constructor
def __init__(self, name) :
self.name = name
print "I'm constructing", self.name
# method, each python class at least has one variable called self
def party(self):
self.x = self.x+1
print self.name, " says ", self.x
# This is the destructor
... | true |
616091877321a52df078b3140aab37938e9cad19 | Python | JHadley1406/udemy_coursework | /threading/extending_thread_class.py | UTF-8 | 378 | 3.46875 | 3 | [] | no_license | import threading
class MyThread(threading.Thread):
# MUST override run method
def run(self):
print(threading.current_thread().getName())
print("Egyptian Pyramid")
for x in range(0, 5):
for j in range(0,x+1):
print("*", end=" ")
print("\n")
pyr... | true |
3e5ca0ec28ce534fac4adf576bbe9ece1770e0d6 | Python | GiaKhangLuu/BasicOpenCV | /chapter06.py | UTF-8 | 628 | 2.546875 | 3 | [] | no_license | # JOINING IMAGE
import cv2
import numpy as np
img1 = cv2.resize(cv2.imread('imgs/khang.jpeg'), (200, 200))
img2 = cv2.resize(cv2.imread('imgs/drinking.jpeg'), (200, 200))
#imgHor = np.hstack([img1, img2])
#imgVer = np.vstack([img1, img2])
#mix = np.vstack([imgHor, imgHor])
imgGray = cv2.cvtColor(img1, cv2.COLOR_BGR2... | true |
f02b85c56ff40f547428a52f0f74d7823f2c40b1 | Python | idmakers/python | /2scompement.py | UTF-8 | 489 | 4.125 | 4 | [] | no_license |
def twos_comp(val, bits):
"""compute the 2's compliment of int value val"""
if (val & (1 << (bits - 1))) != 0: # if sign bit is set e.g., 8bit: 128-255
val = val - (1 << bits) # compute negative value
return val # return positive value as is
#Going from a binary string is particularly easy...... | true |
660a38ea2a39a10c0f1f792157109a1c80f0b7d0 | Python | garrettBJohnson/cautious_cauliflower | /stats_quiz.py | UTF-8 | 714 | 3.609375 | 4 | [] | no_license | def question(prompt, hint, answer):
'''
prompt - string
hint - string
answer - string
'''
while True:
response = input(prompt)
if response is "?":
print(hint)
elif response is not None:
print(answer)
break
##### Quiz: Stats edition ##... | true |
aa1e7e58712e55155657d5eb8b58e592cb671ab3 | Python | bopopescu/clearglass-test | /utility/utility.py | UTF-8 | 1,457 | 2.765625 | 3 | [] | no_license | import time
import json
from datetime import datetime,date
def json_date_serial(obj):
"""JSON serializer for objects not serializable by default json code"""
if isinstance(obj, datetime) or isinstance(obj, date):
serial = obj.isoformat()
return serial
else:
jsonEncoder = json.JSONEncoder()
return jsonEnco... | true |
6b1d94bc13e54664ada6c6b414f5ebfd72c725b7 | Python | yflfly/learn_pytorch | /2D函数优化实例.py | UTF-8 | 1,803 | 3.25 | 3 | [] | no_license | import numpy as np
import torch
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def himmelblau(x):
return (x[0] ** 2 + x[1] - 11) ** 2 + (x[0] + x[1] ** 2 - 7) ** 2
x = np.arange(-6, 6, 0.1) # x.shape=(120,)
y = np.arange(-6, 6, 0.1) # y.shape=(120,)
X, Y = np.meshgrid(x, y) # X.... | true |
4ff5763256f6fda6c0322aefd5256fe05057299f | Python | gregtuck/Greco-Roman | /train_model.py | UTF-8 | 3,073 | 2.9375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import keras
import cv2 as cv
from keras.layers import Dense, Conv2D, MaxPooling2D, Dropout, Flatten
from keras.models import Sequential
from keras.preprocessing.image import ImageDataGenerator
# get the dataset that was created on convert_to_csv.py
data_set = pd.read_csv(r'/ho... | true |
8bfddfb38c922dd4fab1b87dd4744afaf3606b12 | Python | vprogramer/Zephyr | /task_three.py | UTF-8 | 175 | 3.40625 | 3 | [] | no_license |
number_of_sides = [4, 6, 8, 12, 20]
# Looking for probabilities.
for i in number_of_sides:
p = ((int(i >= 5) * 1/i) * 0.2)/(0.2 * (0 + 1/6 + 1/8 + 1/12 + 1/20))
print(p)
| true |
b45d6d4f0326c560145af9214f2b80f5992b8f24 | Python | MayankMaheshwar/DS-and-Algo-solving | /2022-convert-1d-array-into-2d-array/2022-convert-1d-array-into-2d-array.py | UTF-8 | 268 | 3.140625 | 3 | [] | no_license | class Solution:
def construct2DArray(self, original: List[int], m: int, n: int) -> List[List[int]]:
ans = []
if len(original) == m*n:
for i in range(0, len(original), n):
ans.append(original[i:i+n])
return ans | true |
457de3c25dbc217a237ed2e1a9d9641c9920c132 | Python | Akhilesh09/MS_Projects | /Deep Learning - Individual Projects/DL_HW1/code/main.py | UTF-8 | 6,960 | 3.25 | 3 | [] | no_license | import os
import matplotlib.pyplot as plt
from LogisticRegression import logistic_regression
from LRM import logistic_regression_multiclass
from DataReader import *
data_dir = "../data/"
train_filename = "training.npz"
test_filename = "test.npz"
def visualize_features(X, y):
'''This function is used to plot a... | true |
103fe5b2624efb525cbfe836e7ae8c14ba0c9b67 | Python | GregoireHENRY/python-template-quick | /{{cookiecutter.repo_name}}/ssot.py | UTF-8 | 1,480 | 2.6875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
"""
Update single sources of truth (name, version) in all listed files according to
their respective rules.
"""
import re
import sys
from pathlib import Path
from typing import Optional # noqa: F401
from pudb import set_trace as bp # noqa: F401
from {{cookiecutter.repo_name}} import VERSION... | true |
85a2115df5804eb1c88e496df58fbded00f832c3 | Python | civodlu/trw | /tests/test_callback_learning_rate_finder.py | UTF-8 | 2,114 | 2.765625 | 3 | [
"MIT"
] | permissive | import unittest
import collections
import trw
import torch.nn as nn
import torch
import numpy as np
import functools
def create_simple_regression(factor, nb_samples=100):
i = np.random.randn(nb_samples, 1).astype(np.float32)
o = i * np.float32(factor)
datasets = collections.OrderedDict()
sampler = tr... | true |
497627f2add34c2befb15acd0c11f2c0a3bff5fc | Python | kagnew-j/Algorithm | /chapter 3_search and sort problem_09_insertion_sort.py | UTF-8 | 2,743 | 4.25 | 4 | [] | no_license | #chapter 3_search and sort
#problem_09_insertion_sort
# 삽입 정렬 for easy explanation
def find_ins_idx(r,v):
"""
for문 활용한 삽입 위치 반환 함수
입력 : 리스트 r, 삽입될 숫자값 v
출력 : 삽입해야할 index
"""
for i in range(len(r)): # 이미 정렬된 리스트를 앞에서부터 확인
if v < r[i]: # v값보다 i번 위치 값이 크면
return i ... | true |
0ec52c24e9e1b4cff727ebe0fb25e638ecaf3376 | Python | grant-ward/BotNet | /linux/generate.py | UTF-8 | 2,212 | 3.078125 | 3 | [] | no_license | import os
import ipaddress,time
print("Welcome! this script will configurate the agent with your configurations!")
if os.path.isfile("settings.py"):
while True:
delete = input("\nDo you wanna clean your old configuration? for a new configuration?\n [Y/n] ")
if delete in ("Y","y","Yes","yes","YES"... | true |
2ff660bb8b9e8c36ed778a2200ee054e748db8b8 | Python | kanokanoka/pytest | /library/re_test/test.py | UTF-8 | 187 | 3.015625 | 3 | [] | no_license | # re is the regular expression library
import re
pattern = r"test"
words = "aaatestcomand"
match = re.match(pattern,words)
print(match)
search = re.search(pattern,words)
print(search)
| true |
d2f675e265034581b1775b8a4ea18a5994a1c0f7 | Python | albertosanfer/MOOC_python_UPV | /Módulo 3/Práctica3_1.py | UTF-8 | 462 | 4.375 | 4 | [
"Apache-2.0"
] | permissive | # A continuación tenemos un input en el que le pediremos un número al usuario y
# lo guardaremos en la variable entrada. Después, deberemos guardar en la
# variable mayorQueTres el valor True si ese número es mayor que tres y False
# en caso contrario.
# Nota, acordaros de realizar la conversión de tipos en el input
e... | true |
8c77ee59994fae2170c76870aa54c90d16714571 | Python | furious-luke/polecat | /tests/test_model.py | UTF-8 | 1,897 | 2.5625 | 3 | [
"MIT"
] | permissive | from polecat.db.schema import Role
from .models import Actor, Address, schema
def test_construct_related():
actor = Actor(
first_name='Johnny',
last_name='Depp',
address={
'country': 'USA'
}
)
assert isinstance(actor.address, Address)
assert actor.address.c... | true |
0b967a39f036a24a61092216645b523d6c896bb8 | Python | linheimx/python_master | /oop_design_pattern/factory_method/elevator_schedule_example_improve_v2.py | UTF-8 | 2,991 | 3.015625 | 3 | [] | no_license | import datetime
from constant import *
class Singleton(type):
_instance = None
def __call__(cls, *args, **kwargs):
if cls._instance is None:
cls._instance = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instance
class ScheduleFactory(object):
@staticmethod
... | true |
cbbadc112f3c78627ec6b673825a965f9ed07a85 | Python | baton96/Intelligent-Systems | /fuzzy/fuzzy.py | UTF-8 | 3,023 | 2.953125 | 3 | [] | no_license | import math
import numpy as np
def trapezoid(val, bottomLeft, upperLeft, upperRight, bottomRight):
if val < bottomLeft:
return 0
elif val < upperLeft:
return (val - bottomLeft) / (upperLeft - bottomLeft)
elif val < upperRight:
return 1.0
elif val < bottomRight:
return ... | true |
0ef181fc65ef4d9507291281727156896440e8d7 | Python | antaramunshi/GUIwithTkinter | /script1.py | UTF-8 | 764 | 3.078125 | 3 | [] | no_license | from tkinter import *
window = Tk()
def km_to_miles():
miles = float(e1_value.get())*.6
t1.insert(END, miles)
def kg_conversion():
grams = float(e1_value.get())*1000
t1.insert(END, grams)
pounds = float(e1_value.get())*2.20462
t2.insert(END,pounds)
ounces = float(e1_value.get())*35.274
t... | true |
5675d37cbe0584ddb9af838910bef90b3066e133 | Python | wogusqkr0515/python | /06/selfStudy06-01.py | UTF-8 | 150 | 3.390625 | 3 | [] | no_license | i, hap = 0, 0
for i in range(0, 101, 1) :
if i % 7 == 0 :
hap = hap + i
print("0과 100 사이에 있는 7의 배수 합계 : %d" % hap) | true |
69d96e181d13b8bcde631c4c63180c974399c39a | Python | andreas-harmuth/registreringstidende-api | /temp.py | UTF-8 | 47 | 2.578125 | 3 | [] | no_license | s = "%s jhej %s" % ("hej med dig","f")
print(s) | true |
63c7ff66d30610c85fe4c646615fd4ff1e8c9323 | Python | metapy/metapy | /demos/twitter-test.py | UTF-8 | 599 | 2.546875 | 3 | [] | no_license | import twitter, getpass
import pickle
try:
auth = pickle.load(open("../auth.p"))
data = auth['twitter']
except Exception:
print "ERROR: Run 'authorize.py twitter' first!"
exit()
# API stuff
api = twitter.Api(
consumer_key=data['CONSUMER_KEY'],
consumer_secret=data['CONSUMER_SECRET'],
access_token_key=data['OA... | true |
f860b8ffea3340bbeed346ce2c0f3f7044b8c730 | Python | lqs4188980/CodingPractice | /Python/same_tree/same_tree.py | UTF-8 | 362 | 2.9375 | 3 | [] | no_license | class Solution(object):
def isSameTree(self, p, q):
if q is None or p is None:
if q is None and p is None:
return True
else:
return False
if q.val != p. val:
return False
return self.isSameTree(q.left, p.left) and \
... | true |
f09298e5cdd1a3840e726c93353428dab9008315 | Python | dilya123/pythoMonth1 | /lesson3/lesson3.py | UTF-8 | 754 | 3.8125 | 4 | [] | no_license | posuda = "not ok"
if posuda == "ok":
print("Пойдешь гулять")
print("Купим мороженное")
else:
print("минус Карманные деньги")
print("Махач, Мясо, Рубилово, Жестокость")
name = input("Введите ваше имя хозяин ")
if name == "Султанмурат":
age = int(input("Введите ваш возраст! "))
if age > 16:
... | true |
0225f639ff71094da33fbbd0d0621e5b4830bedd | Python | skibold/cs6364 | /ABGame.py | UTF-8 | 1,011 | 3.046875 | 3 | [] | no_license | '''Same output as MiniMaxGame, just fewer nodes evaluated'''
from MorrisBoard import Board
from Algorithms import *
def static_est(board, pos):
return board.mid_end_estimate_white(pos)
def successor(board, pos, d):
if d % 2 == 0:
if board.num_white(pos) == 3:
return board.gen_hop_4_whit... | true |
ac4ade34ddd4ca7c334c4b2266255cb1befe1027 | Python | jghibiki/Byte-le-Royale-2018 | /game/server/server_control.py | UTF-8 | 3,944 | 2.8125 | 3 | [] | no_license | import random
import os
import json
import platform
import shutil
import sys
from datetime import datetime, timedelta
class ServerControl:
def __init__(self, wait_on_client, verbose):
self._loop = None
self._socket_client = None
self.verbose = verbose
self.wait_on_client = wait_... | true |
3783146adc74640381a0da5575f5789d73f0f429 | Python | FattestCat/dt-manager | /tournament.py | UTF-8 | 884 | 3 | 3 | [] | no_license | from __future__ import annotations
from team import Team
from bracket import Bracket, OlimpicBracket
class Tournament:
def __init__(self, teams: list[Team], bracket: Bracket):
self.teams: list[Team] = teams
self.bracket: Bracket = bracket
@classmethod
def generate_blank_tournament(cls):
... | true |
7317af033e842d7ff45ee11aa49706a8531eb0ff | Python | Aasthaengg/IBMdataset | /Python_codes/p02415/s341896845.py | UTF-8 | 37 | 3.171875 | 3 | [] | no_license | x=input()
x=str.swapcase(x)
print(x)
| true |
1b9799c0d1fefc7a3c163b8f7fc2bea829420f34 | Python | tomkowz/python-fav-memes-rest-api | /api/helpers/meme_dto.py | UTF-8 | 455 | 2.546875 | 3 | [
"MIT"
] | permissive | from api.model.meme import Meme
class MemeDTO:
@staticmethod
def to_json(meme):
json = dict()
json['keywords'] = meme.keywords
json['filename'] = meme.filename
return json
@staticmethod
def from_json(json):
meme = Meme()
if 'keywords' in json:
... | true |
a8f205318e28e4a77e1073f9a3af65c4d4ae811d | Python | JohnyXXX/Telephone-DB | /module.py | UTF-8 | 4,159 | 3.46875 | 3 | [] | no_license | from json import dump, load
from sys import stderr
class TelephoneExist(Exception):
"""Класс исключения если тнлефон уже имеется в БД"""
pass
class TelephoneDB(dict):
"""
Класс БД на основе списка. Должен добавлять,
искать, изменять и удалять из БД.
"""
def __init__(self):
try:
... | true |
38d4aa078ff32ea4bdf7ee454daf5316532b56f3 | Python | gentry-atkinson/pip_test | /segmentation_visuals.py | UTF-8 | 2,042 | 3.5625 | 4 | [] | no_license | #Author: Gentry Atkinson
#Organization: Texas University
#Data: 7 April, 2021
#Visualize the segmentation of a signal with 3 methods
#Method 1: regular breaks every 150 samples
#Method 2: 150 samples centered on a PIP
#Method 3: Divide segments at PIPs, resample each segment to 150
from scipy.signal import resample
f... | true |
21f999112a80a9df9255b6b828a36ad35cb5c9c9 | Python | vishakha2907/Assignments | /Palindrome/Palindrome.py | UTF-8 | 342 | 3.890625 | 4 | [] | no_license | def rev(temp):
remainder = 0
reverse = 0
while(temp != 0):
remainder = temp % 10
reverse = reverse * 10 + remainder
temp = int(temp / 10)
return reverse
#main() function
n = int(input("Enter a number: "))
temp = n
res = rev(temp)
if (res == n):
print(" Number is Palindrome")
else:
print("Numbe... | true |
92cfa90e905543b414d503fa44d065835deb9154 | Python | JuanchoVoltio/python-2021-III | /Taller04/ejemplo-while_break_continue.py | UTF-8 | 369 | 3.671875 | 4 | [] | no_license |
first_question = '¿Qué edad tiene? '
second_question = '¿En qué ciudad vive? '
age = 0
city = ''
while not ( age > 18 and city == 'Medellín' ):
age = int ( input ( first_question ))
if( age < 18 ):
continue
city = input ( second_question )
#pregunta 3
#pregunta 4
else ... | true |
9166b5ffbf21cd941a06a7c3f4219ae5ee15af25 | Python | Jeonseoghyeon/APR | /백준/삼성A형 대비/1260(BFS,DFS).py | UTF-8 | 746 | 2.875 | 3 | [] | no_license | def dfs (start,visit):
visit.append(start)
for i in range(N+1):
if arr[start][i] == 1 and i not in visit:
visit = dfs(i,visit)
return visit
def bfs (start):
queue = [start]
visit = [start]
while queue:
c = queue.pop(0)
for i in range(N+1):
if arr[... | true |
d6fdcf359f60ad2d07ecd46409eb96a99ee47f7f | Python | alenthomas/days_between_dates | /dBd.py | UTF-8 | 920 | 3.5625 | 4 | [
"MIT"
] | permissive | import calendar
import time
_months = {1:31, 2:28, 3:31, 4:30, 5:31, 6:30, 7:31, 8:31,
9:30, 10:31, 11:30, 12:31}
def days_in_month(month, year, leap=False):
if month == 2:
if calendar.isleap(year):
return 29
return _months[month]
def find(d1, m1, y1, d2, m2, y2, count=0):
... | true |
4a90c00464a7e9874457b10742e45c51374eb7ad | Python | TEC-2014092195/IC1802-introduccion-a-la-programacion | /Proyectos/Bracket v2/Clases.py | UTF-8 | 10,054 | 2.921875 | 3 | [
"MIT"
] | permissive | from tkinter import *
class Boton_Grupos(Button):
Grupo_Seleccionado=None
Entrada=None
lst_Otro1=None
lst_Otro2=None
lst_Otro3=None
lst_Otro4=None
lst_Otro5=None
lst_Otro6=None
lst_Otro7=None
def __init__(self,lista_grupo,entrada,otra1,otra2,otra3,otra4,otra5,o... | true |
9214b4111f945e548eb4d5736ef618692aa2f7f4 | Python | Edyta2801/Python-kurs-infoshareacademy | /code/Day_15/kod zajecia/hello.py | UTF-8 | 846 | 3.40625 | 3 | [] | no_license | import SimpleGUICS2Pygame.simpleguics2pygame as simplegui
# wiadomosc wyswietlana
message = "Welcome"
# handler - funkcja wywołana na skutek jakiegos zdarzenia (eventu)
def click():
"""Handler for mouse click"""
global message
message = "Good job!"
def draw(canvas):
"""Handler przerysowujący okno"""
... | true |
94c6a0e4186158d20b2d68add6ec564b07bee40d | Python | Gleysson/RNA | /neural/search_grid.py | UTF-8 | 996 | 2.828125 | 3 | [] | no_license | class SearchGrid:
def __init__(self, type="classifier"):
self.etas = []
self.epochs = []
self.neurons = []
self.setValues(type)
def setValues(self, type):
if(type=='classifier'):
self.etas = [0.06, 0.08, 0.1 , 0.12]
self.epochs = [500, 500, 700,... | true |
881101b7b98c840fce6151810ee94833b43b2d64 | Python | huangxi2000/tpshop2 | /scripts/test_login.py | UTF-8 | 1,103 | 2.59375 | 3 | [] | no_license | import os
import sys
sys.path.append(os.getcwd())
import pytest
import time
from base.read_yaml import ReadYaml
from base.get_driver import get_driver
from page.page_in import PageIn
def get_data():
res = ReadYaml("data_login.yaml").read_yaml()
list1 = []
for data in res.values():
list1.append((... | true |
47967c2e227aabd087a0b5bdbcfd79c8d46a3835 | Python | cr0cK/algorithms | /quicksort/list_comprehensions.py | UTF-8 | 445 | 3.578125 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*
from random import randint
def qsort1(list):
"""Quicksort using list comprehensions"""
if list == []:
return []
else:
pivot = list[0]
lesser = qsort1([x for x in list[1:] if x < pivot])
greater = qsort1([x for x in list[1:] if x... | true |
ccde62c0e25c12b0e05be9d4ce19580b46cf15ba | Python | noahadelstein/mathemagic | /sample_python/cardDeck (2013).py | UTF-8 | 2,706 | 4.28125 | 4 | [] | no_license | #-------------------------------------------------------------------------------
# Name: cardDeck.py
# Purpose: class Deck representing a deck of cards
# constructor - creates a new deck of 52 cards in standard order
# getCardList - returns list of cards in deck
# shuff... | true |
8246f286ecb2ca85f2b347fe109ea1e197542d76 | Python | chantigit/pythonbatch1_june2021data | /Python_9to10_June21Apps/project1/listapps/app3.py | UTF-8 | 298 | 3.875 | 4 | [] | no_license | #Iterable & Iterator (next() & iter() functions)
#Preparing iterable using list
setA={10,2,30,4,50}
#Preparing iterator
elements=iter(setA)
print(next(elements)) #10
print(next(elements)) #2
print(next(elements)) #30
print(next(elements)) #4
print(next(elements)) #50
print(next(elements)) # | true |