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 |
|---|---|---|---|---|---|---|---|---|---|---|
fb97bd46e7ab6564b729c9d3015844090ff7fef2 | hugoziviani/metodology | /t_student.py | UTF-8 | 298 | 3.21875 | 3 | [] | no_license | # Teste T de Student
import statistics
import math
def statistic(data_1, data_2):
s = len(data_1)+len(data_2)
st1 = statistics.stdev(data_1)
st2 = statistics.stdev(data_1)
return abs((statistics.mean(numbers1) - statistics.mean(numbers2))/math.sqrt(pow(s1,2) + math.pow(s2,2))/s)
| true |
31ea76dc2216c1a60757ab73745da2db425bada1 | jerabekjak/smoderp2d-optim-sens | /model/smoderp2d/stream_functions/stream_f.py | UTF-8 | 8,489 | 2.96875 | 3 | [] | no_license | # @package model.smoderp2d.stream_functions.stream_f Module to calculate the stream reaches runoff.
import math
import sys
from inspect import currentframe, getframeinfo
from model.smoderp2d.providers import Logger
# Jen na debug, umi to zjistit nazev souboru a radek odkud se\n
# <em>print frameinfo.filename, frame... | true |
a1c65edd1c56d08030d04110d2869168a5726e08 | neTpyLUKa/captcha-recognition | /captcha.py | UTF-8 | 2,203 | 2.671875 | 3 | [] | no_license | import pytesseract
import argparse
import cv2
import os
def dist(x, y, sqrtFlag=True):
if sqrtFlag:
return sum((x - y) ** 2)
else:
return sum((x - y) ** 2) ** 0.5
WHITE = (216, 217, 219)
BLACK = (25, 26, 27)
min_dist = 23000
inFileName = "labels.txt"
ap = argparse.ArgumentParser()
ap.add_argu... | true |
e091cb6f681f603ce8f2def7a368d7dbf3f1e701 | realfan-1s/LeetCode_Easy | /CommonCharacters.py | UTF-8 | 567 | 3.125 | 3 | [] | no_license | def HashTable(A: list[str]):
minfreq = [float("inf")] * 26
for word in A:
freq = [0] * 26
for char in word:
freq[ord(char) - ord("a")] += 1
for i in range(26):
minfreq[i] = min(minfreq[i], freq[i])
res = []
for i in range(26):
res.extend(chr(i + o... | true |
fc06b9bef5e064694e7fed03b6907e4d6a191b47 | storyskya/python_student | /zhuanhuan_class.py | UTF-8 | 3,931 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding=utf-8 -*-
# filename zhuanhuan_class.py
# author MaxD
import string
import sys
sys.tracebacklimit = 0
class wendu_class:
'''温度转换类'''
def Hua_She(temp):
tf = (5/9) * temp - 32
print()
print(f'{temp}f = {tf}c')
def She_Hua(temp):
tf = (9/... | true |
e9cee7e5ae99ef732f075a02d71a5ba6e2fd153a | No-Way-Jose/utsc-tree-project | /SQL.py | UTF-8 | 3,894 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | import sqlite3
from sqlite3 import Error
def createConnection(database):
"""
Create a database connection to the SQLite database
"""
connection = None
# Try connecting to the database
try:
connection = sqlite3.connect(database)
except Error as e:
print(e)
# Return the c... | true |
2347dbe6d953bacd3f443ec1b2ef41625adeb207 | qwuscu/leetcode | /SetMismatch.py | UTF-8 | 703 | 2.75 | 3 | [] | no_license | class Solution:
def findErrorNums(self, nums: List[int]) -> List[int]:
lookup={}
ans=[None]*2
n=len(nums)
for num in nums:
if num not in lookup:
lookup[num]=1
else:
ans[0]=num
for i in range(1,n+1):
# when if... | true |
aad8788a8d058a1279b5548ac995878e4667976d | bagreve/Nivelacion | /23082019/001230.py | UTF-8 | 1,089 | 3.90625 | 4 | [] | no_license | # Este es el ejercicio final del quinto video de nivelacion, que consiste en sumar todos los numeros
# negativos de la lista, tanto con for como con while.
given_list3 = [7,5,4,4,3,1,-2,-3,-5,-7] # Se crea la lista
total6 = 0 # se crea la variable total6 para poder ir sumando
i = 0 # y un contador q... | true |
90b7350f93c04da87f788e28b81cceb6db0a5e02 | wzy-99/Industry-Steam-Forecast | /model.py | UTF-8 | 5,355 | 2.765625 | 3 | [] | no_license | import torch
import torch.nn as nn
from torchsummary import summary
class LinearBN(nn.Module):
def __init__(self, in_dim, out_dim, act='relu'):
super(LinearBN, self).__init__()
self.linear = nn.Linear(in_features=in_dim, out_features=out_dim)
self.bn = nn.BatchNorm1d(num_features=out_dim)
... | true |
0c5316b34a0ccc2c0020a33796475ce44b9a61cb | benawabe896/BigData | /3_Assignment/4_Problem/asymmetric_friendships.py | UTF-8 | 378 | 2.5625 | 3 | [] | no_license | import MapReduce
import sys
mr = MapReduce.MapReduce()
def mapper(record):
key = "|".join(sorted(record))
mr.emit_intermediate(key, record)
def reducer(key, records):
if len(records) == 1:
mr.emit((records[0][0], records[0][1]))
mr.emit((records[0][1], records[0][0]))
if __name__ == '__main__':
inputdata = ... | true |
7617266c53f5a76254cedebd6b358c7fb522ed33 | techdragon/tl | /tl/utils/path.py | UTF-8 | 726 | 2.953125 | 3 | [
"LicenseRef-scancode-other-permissive"
] | permissive | # tl/utils/path.py
#
#
""" path manipulation funcions. """
## basic import
import os
## homedir function
def homedir():
""" try to locate the homedir .. otherwise return current working directory. """
try: homedir = os.path.abspath(os.path.expanduser("~"))
except: homedir = os.getcwd()
return homed... | true |
2469bf507d38ee4e7a49072b87a12416a5a7c1e7 | wufan2132/three_son_chess | /pycode/chess/piece.py | UTF-8 | 763 | 3.484375 | 3 | [] | no_license | user_color = {1: "blue", 2: "red"}
# 棋子类
class piece(object):
# 类的静态变量用于自动给棋子标记id
user1_count = 0
user2_count = 0
def __init__(self, user):
self.user = user
self.color = user_color[user]
self.pos = [0, 0]
if user == 1:
self.id = piece.user1_count
... | true |
0265cafd1d0f8c63cf17066518264db3dce9067f | kfr2/flask-swaggervalidator | /flask_swaggervalidator/decorators.py | UTF-8 | 4,361 | 2.59375 | 3 | [
"ISC"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import os
from functools import wraps
import flask
from swagger_validator import SwaggerValidator
_FLASK_DEBUG_VARIABLE = 'FLASK_DEBUG'
def _validate_flask_request(request, swagger_spec_path, operation_id):
"""
Args:
re... | true |
5a98a12458589bc8b0ff27d59e1ccb4eed3bfc5b | bhavya2403/Learning-Python | /Learning/Algorithms/GreedyAlgorithms/water_connection.py | UTF-8 | 1,036 | 2.734375 | 3 | [] | no_license | # not done yet
def solve(houses, ABlist, BAlist, Wlist):
ttPair, tanks, taps = set(), [], []
for i in range(1, houses+1):
if i not in ABlist:
if BAlist[i] not in BAlist:
ttPair.add((BAlist[i], i))
else:
taps.append( ( i, Wlist[(BAlist[i... | true |
e77e7d4bc26f69c1130d50f764262ee20d40108d | Cynthia59/FtpTools | /common/myFTP.py | UTF-8 | 1,456 | 2.5625 | 3 | [] | no_license | #encoding: utf-8
"""
@project = FtpTools
@file = ftp
@function = ftp下载方法
@author = Cindy
@create_time = 2018/6/15 13:52
@python_version = 3.x
"""
import ftplib, socket, sys
class Ftp(object):
def __init__(self, host, username, password, buffer_size=8192):
self.host = host
self.username = username
... | true |
98e20e85822a6888cc6f86d965f04df4e6f1d126 | Olfi01/IndefiniteLoop | /src/enums.py | UTF-8 | 688 | 2.921875 | 3 | [] | no_license | """A package that contains all the enums used by the game."""
from enum import Enum, IntEnum
class GameState(Enum):
"""Represents the state of the game. At first, only MainMenu and InGameMode0 will ever be used."""
MainMenu = 0,
InGameMode0 = 1,
InLevelEditor = 2,
InGameMode1 = 3,
PausedGameMo... | true |
0d376c1485457dd74ff19942b468664d81305ae8 | savadev/LeetCodeProblemSet | /powxn.py | UTF-8 | 526 | 3.4375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
class Solution(object):
def myPow(self, x, n):
"""
:type x: float
:type n: int
:rtype: float
"""
if n == 0:
return 1
if n < 0:
n = -n
x = 1 / x
res = 1
while n > 0:
if n... | true |
63aa92cccb43164c3bd9a152bc5714a6c334abb2 | zhaodelong/RSA-example | /sageRSA.py | UTF-8 | 465 | 2.765625 | 3 | [] | no_license | # sage RSA
# Learn from Network Security class
# Demo for https://factorable.net/weakkeys12.extended.pdf
# Philip Knous presentation
p = Primes().next(ZZ.random_element(2^1024))
p
q = Primes().next(ZZ.random_element(2^1024))
q
n = p * q
n
e = 65537
d = mod(e, (p - 1) * (q - 1)) ^(-1)
M = 123456789 # plain text
C = mo... | true |
a900f9cb55560ccdba75c5818e5772711298c6d6 | rizki140699/Indodax | /build/lib/indodax/Price.py | UTF-8 | 342 | 2.546875 | 3 | [
"MIT"
] | permissive | import requests as rq
import time
class price:
@staticmethod
def price(coin):
while True:
try:
m = coin+'idr'
url = 'https://indodax.com/api/ticker/'+m
r = rq.get(url)
return r.json()
except rq.exceptions.ConnectionError:
time.sleep(5... | true |
fc2b4845b79e9a573fec5361495e555b50cf4116 | theboyarintsev/Python | /Part 2/4 Task.py | UTF-8 | 508 | 2.890625 | 3 | [] | no_license | # Дан список, заполненный произвольными целыми числами.
# Найдите в этом списке два числа, произведение которых максимально.
# Выведите эти числа в порядке неубывания через пробел.
# Решение должно иметь сложность O(n), где n - размер списка.
# То есть сортировку использовать нельзя.
| true |
34755bf754e0ba06b5aa65b65422951682a84248 | chrisglass/django-simple-sso | /simple_sso/utils.py | UTF-8 | 332 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
from random import choice
import string
KEY_CHARACTERS = string.letters + string.digits
SIMPLE_KEYS = [
'username',
'first_name',
'last_name',
'email',
'is_staff',
'is_superuser',
]
def gen_secret_key(length=40):
return ''.join([choice(KEY_CHARACTERS) for _ in rang... | true |
99fe88b01f13bb36ae32475a133fca8909cff0ea | Jerrydepon/LeetCode | /4_linkedlist/easy/160. Intersection of Two Linked Lists.py | UTF-8 | 1,059 | 3.515625 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
# find the difference in length of two lists
# move (difference) steps from head of longer list
# move one step for each list to find the match
class Solution(object):
def g... | true |
d2187e09aeeaa9a8f6773a95a924aa43a5ef28cd | MrMurilinnu/calculadorademediaponderada | /Mediaponderada.py | UTF-8 | 550 | 3.609375 | 4 | [] | no_license | import math
peso1 = int(input('peso da primeira avaliação: '))
peso2 = int(input('peso da segunda avaliação: '))
peso3 = int(input('peso da terceira avaliação: '))
peso4 = int(input('peso da quarta avaliação: '))
nota1 = int(input('Nota da primeira avaliação: '))
nota2 = int(input('Nota da segunda avaliação: '))
... | true |
d4396e3fe69300795ff6176ffa347fe965c42746 | GentFromPhoenix/CS101_Udacity | /Unit1Q.py | UTF-8 | 4,428 | 4 | 4 | [] | no_license | # Tim Chesebrough - Udacity - CS101
# Introduction to Computer Science
# ---------------------------------------------------------
# Lesson 1 - Sessions -------------------------------------
# ---------------------------------------------------------
# print 1 + 2 + 3
# Need to add a decimal to obtain real numbers
# pr... | true |
b0d6a998438033e748893664a3599167b15af852 | saiborra1979/EDCensus | /explainability/ex_run_mdl.py | UTF-8 | 4,466 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
EXAMPLE SCRIPT TO SHOW HOW TO LOAD AND RUN A GPYTORCH MODEL
Assumed folder structure:
On my HPF, the TOP_LEVEL_FOLDER == see /hpf/largeprojects/agoldenb/edrysdale/ED/
TOP_LEVEL_FOLDER
---CensusFlow
------{all the python scripts, etc}
---output
------flow
---------test
------... | true |
8f0953bb09a8b6de65ef57b5cd98bf91ec10cd53 | danzzang/python_algorithm | /sw expert/모의SW 테스트/수영장.py | UTF-8 | 595 | 2.75 | 3 | [] | no_license | def calc(x):
global price
global minimum
if x >= 12:
if price < minimum:
minimum = price
result.append(minimum)
return
price += plan[x] * day
calc(x + 1)
price -= plan[x] * day
price += month
calc(x + 1)
price -= month
if x + 2 <= 12:
price += month_3
calc(x + 3)
pr... | true |
463bd4681b1a4e3809d988830730417b3e9d27d3 | thewishy/clock | /lib_cal.py | UTF-8 | 578 | 2.9375 | 3 | [] | no_license | import time
import datetime
import os
def dt_parse(t):
# Example: 2017-09-30 08:30:00
if (t is not None and t != "None"):
return datetime.datetime.strptime(t[0:19],'%Y-%m-%d %H:%M:%S')
else:
return None
def read_from_backup():
try:
f = open('nextalarm.txt', 'r')
datafro... | true |
ed553749aa38b3f14807d18b7c1ab072b0982808 | zhpbo/LeetCode_By_Python | /codes_auto/1574.maximum-product-of-two-elements-in-an-array.py | UTF-8 | 343 | 3.015625 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=1574 lang=python3
#
# [1574] maximum-product-of-two-elements-in-an-array
#
class Solution:
def maxProduct(self, nums: List[int]) -> int:
res = float("-inf")
nums.sort()
res = max((nums[0]-1)*(nums[1]-1),(nums[-1]-1)*(nums[-2]-1),(nums[0]-1)*(nums[-1]-1))
re... | true |
56728909f2d9b9b6670480b0fb6425fbe63fef9a | andreassteph/flatpages_index | /flatpages_index/utils.py | UTF-8 | 1,885 | 3.078125 | 3 | [] | no_license | """
Utility Functions for handling files and paths
"""
import os
import re
from os.path import isfile, abspath
from collections import namedtuple
LinkElement=namedtuple("LinkElement", ["title", "url","desc", "thumb_url","image", "date"])
ImageLinkElement=namedtuple("LinkElement", ["title", "url","desc","thumb_url"])
... | true |
471fcfbabd87ca35fa5dbb3612a36ee0ebfc2221 | rdemorais/pucrj-pucpr-ufmg | /scripts/alignment.py | UTF-8 | 4,547 | 2.578125 | 3 | [
"MIT"
] | permissive | from transformers import AutoTokenizer # Or BertTokenizer
from transformers import T5Tokenizer
from data.scripts.anntools import Collection
from pathlib import Path
import json
import os
def extract_keyphrases(keyphrases, text, tokens):
tags = {}
for keyphrase in sorted(keyphrases, key=lambda x: len(x.text))... | true |
fe108c9ecc9a85eb30b414201a2642ed921a78f9 | Philip-Loeffler/python | /SectionFive/safelyRemoveValuesFromList.py | UTF-8 | 495 | 3.53125 | 4 | [] | no_license | data = [4, 5, 104, 105, 110, 120, 130, 130, 150,
160, 170, 183, 185, 187, 188, 191, 350, 360]
min_valid = 100
max_valid = 200
# this code will only work when the data is sorted
# 1. process the low values in the list
stop = 0
for index, value in enumerate(data):
if value >= min_valid:
stop = in... | true |
5127e6a233d3b3f446d393bb9b502965f8f56d8d | dener-ufv/CCF-110 | /Listas-de-Exercicios/Lista-1/ex19.py | UTF-8 | 171 | 4.4375 | 4 | [] | no_license | a = float(input("Digite A: "))
b = float(input("Digite B: "))
if a < b:
print("A é menor que B")
elif a > b:
print("A é maior que B")
else:
print("A é igual a B") | true |
8eb8080c0b5ca1ed6a88e0bfa8222a82b863f7e4 | ujjwal6298/gui-face-detection | /GuiFaceDectection (1).py | UTF-8 | 6,499 | 2.59375 | 3 | [] | no_license | from tkinter import *
import cv2
from tkinter import messagebox
import os
import shutil
import numpy
from pathlib import Path
class FaceDetection():
def __init__(self, root):
self.root = root
self.haar_file = 'haarcascade_frontalface_default.xml'
Label(self.root, bg='white', height=2).pac... | true |
853e10de6a0ab8fe3ab6319fb1db4b3155176010 | hujuu/py-test | /paiza/B008sysの使い方.py | UTF-8 | 376 | 2.984375 | 3 | [] | no_license | # coding: utf-8
import sys
nm = input().split()
n = int(nm[0])
m = int(nm[1])
if n == 0:
print(0)
sys.exit()
if m == 0:
print(0)
sys.exit()
live_lst = []
for x in range(0, m):
live = input().split()
live_lst.append(live)
res = 0
for x in range(0, m):
temp = 0
for y in range(0, n):
temp = temp + int(l... | true |
f0524159506cb95c651154c354f68c186cbaa266 | i1196689/GitPython | /python_lessons/day_12.py | UTF-8 | 910 | 4.21875 | 4 | [] | no_license | '''
d={"a":123,"b":456,"c":"xyz"}
print(d)
import json
json_str=json.dumps(d)
print(json_str)
print(type(json_str))
d1=json.loads(json_str)
print(d1)
print(type(d1))
from string import Template
template=Template('$s是我最喜欢的编程语言,$s非常容易学习,而且功能强大。')
print(template.substitute(s="python"))
template3=Template("${h}hello ... | true |
23d092501ed1a6eca6cfd13bb9fb7ccb09a742f0 | hudkmr/Code_Database | /PCDU_Characterization/misc.py | UTF-8 | 186 | 3.125 | 3 | [] | no_license | #Miscellaneous Functions
import time
def current_time():
return time.strftime("%d%H%M")
def int_to_str(val):
temp = hex(val)[2:]
while len(temp) < 4:
temp = '0'+temp
return temp | true |
8b057143fe3c4de672df697497882d8c5b31ff95 | Dormitabnia/KenCode | /python/29.两数相除.py | UTF-8 | 1,388 | 2.96875 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=29 lang=python3
#
# [29] 两数相除
#
# @lc code=start
class Solution:
# runtime beats 81.85 % (32 ms)
# memory usage beats 97.46 % (14.8 MB)
def divide(self, dividend: int, divisor: int) -> int:
if divisor == 1:
res = dividend
elif divisor == -1:
... | true |
2be78ba55876a7ee8167e581cf013ee3ce1269cb | rombakh/pynet_test | /test_yaml.py | UTF-8 | 324 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import yaml
import json
from pprint import pprint as pp
my_list = ['one', 'two', 'whatever', 1, 2, 10, {'hostname': 'router', 'ip_address': '10.1.1.12'}]
with open("test_file.yml", "w") as f:
f.write(yaml.dump(my_list, width=50, indent=4, default_flow_style=False))
f.write(json.dumps(my_lis... | true |
a4b24b93aa879e7d6c558688a9e5c73f5b18ae09 | PENGUI2/ferriswheel | /ferris/channel.py | UTF-8 | 2,543 | 2.6875 | 3 | [
"MIT"
] | permissive | from __future__ import annotations
from typing import TYPE_CHECKING, cast
from .base import BaseObject
from .message import Message
if TYPE_CHECKING:
from .connection import Connection
from .types import Data
__all__ = ('Channel',)
class Channel(BaseObject):
"""
Represents a channel in FerrisChat.... | true |
93f94080a377e14df55dee6b18ec55dc56e70221 | alamastor/udacity-catalog | /tests/unit/test_catagory.py | UTF-8 | 2,017 | 2.8125 | 3 | [] | no_license | import pytest
from app.models.catagory import Catagory
from app.models.item import Item
@pytest.fixture
def mock_session(mock):
return mock.patch('app.models.catagory.db.session')
def test_create_calls_Catagory(mock, mock_session):
mock_init = mock.patch(
'app.models.catagory.Catagory.__init__', ret... | true |
aab8a5c4fb266cd8df994ce9ce1c8d123a69ad27 | statistics-exercises/central-limit-theorem-5 | /test_main.py | UTF-8 | 1,315 | 3.0625 | 3 | [] | no_license | import unittest
import scipy.stats as st
from main import *
class UnitTests(unittest.TestCase) :
def test_xplot(self) :
fighand = plt.gca()
figdat = fighand.get_lines()[1].get_xydata()
this_x, this_y = zip(*figdat)
for i in range(len(this_x)) :
self.assertTrue( xmin + np... | true |
428102048081bb78a6c30d9fcd3ec2e7ba89ec6e | marcoAureliosm/Listas-de-atividades-03-de-python | /questão23.py | UTF-8 | 1,247 | 3.515625 | 4 | [] | no_license | numero=int(input("DIGITE UM NUMERO -999"))
if numero<=999 and numero >99:
cent = numero//100
dec = numero//10
uni = (dec*10)-numero
if uni >1 and dec > 1 and cent < 1:
print("UNIDADES {} DEZENAS {} CENTENAS {}".format(abs(uni), dec, cent))
elif uni ==1 and dec > 1 and cent < 1:
... | true |
60fb9a2d49700a6ea81546b1533d2eccbc3c2331 | HOONITANG/Git-Tutorial | /my_module.py | WINDOWS-1253 | 88 | 2.921875 | 3 | [] | no_license | def sub(a,b):
return a-b
def add(a,b):
return a+b
def mul(a,b):
return a*b #ּ
| true |
2a51ca258b9522432d1e23e9d1cefffc57a8e090 | csendranshi/Python_100_DaysOfCode | /Day_1_to_25/Day_14/higherlower.py | UTF-8 | 856 | 3.34375 | 3 | [] | no_license | from art import logo,vs
from gamedata import data
import random
run = True
score=0
while run:
print(logo)
A = random.randint(0,len(data)-1)
B = random.randint(0,len(data)-1)
if A==B:
continue
print(f"Compare A: {data[A]['name']}, a {data[A]['description']}, from {data[A]['country']}.")
... | true |
b31a9ddc729ecb6f94e6dc8364688c56569be97f | glory0fNothing/Ch2 | /SL2_15.py | UTF-8 | 493 | 4.4375 | 4 | [] | no_license | def sale_price():
#Get the original price of the item
original_price = float(input("Enter the item's original price: "))
#Calculate 20 percent of the original price.
#This is the amount of the discount.
discount = original_price * .20
#Subtract the discount from the original pr... | true |
f2978087f9d95cafb27d6abe97adcf973a2e8336 | MariosPitsali/algorithms-practice | /dictionaries.py | UTF-8 | 529 | 3.4375 | 3 | [] | no_license | fruit = {"orange": "a sweet, orange, citrus fruit",
"apple": "good for making cider",
"lemon": "a sour, yellow, citrus fruit",
"grape": " a small, sweet fruit growing in trees",
"lime": "a sour, green, citrus fruit"}
print (fruit)
veg = {"cabbage": "every child's favorite",
... | true |
0d299770d9ebd8e28d01a08dd49f69b9f7d0b924 | KonradMarzec1991/Codewars-LeetCode | /Codewars/Python/6kyu/6kyu_Remove the parentheses.py | UTF-8 | 271 | 3.671875 | 4 | [] | no_license | def remove_parentheses(s):
counter = 0
new_string = ''
for ch in s:
if ch == '(':
counter += 1
if ch == ')':
counter -= 1
continue
if not counter:
new_string += ch
return new_string
| true |
f44934fb5aec417eeafdc7aadfc7041d2f25d9cf | wojciechroman/Numeric_Methods_1 | /Lista_2/zadanie4.py | UTF-8 | 114 | 3.140625 | 3 | [] | no_license | from math import sqrt
for n in range(2, 24, 2):
x = 2**(-n)
y = (x**4)/(sqrt(x**4 + 4) + 2)
print(y)
| true |
e45c7d36676315e2a97a70dba8f652c137569127 | bing1100/sweeper | /machine_learning_plan.py | UTF-8 | 498 | 2.890625 | 3 | [] | no_license | # Inteligence module
# Going to use a decision tree to record patterns and so that
# the program will run faster as it collects more information
# The decision tree will work in this way:
# We will have a fixed algorithm to look for patterns.
# The decision tree will be updated every time a pattern has been
# sol... | true |
f30177c05802168ba2c78d4ff6fe1085e0e6428b | lishuang1994/ubuntu_Test | /06day/02-我的详细信息.py | UTF-8 | 292 | 3.53125 | 4 | [] | no_license | a = int(input("请输入a的值"))
b = int(input("请输入b的值"))
c = int(input("请输入c的值"))
d = int(input("请输入d的值"))
e = a+b
print("我的年龄是%d"%e)
f = a*b
print("我的身高是%d"%e)
g = d*c
print("我的体重是%d"%g)
h = d*b
print("我的腿长是%d"%h)
| true |
50f53240343a392b200a16cd78ed8fa2b7d869d7 | mezhebovskyy/studying | /structure_models/working_with_files/cars.py | UTF-8 | 588 | 3.140625 | 3 | [] | no_license | fileName = "cars.txt"
class Car:
def __init__(self, hp=0, mod=""):
self.hp = hp
self.mod = mod
database = []
database.append(Car(125, "jetta"))
database.append(Car(119, "jetta1"))
database.append(Car(111, "jetta2"))
database.append(Car(150, "jetta3"))
f = open(fileName, "a")
for i in database:
... | true |
43b7692cef9873e1e6fa5e9071350c645f71f551 | spikeyball/CB-Challenges | /ABCCheck.py | UTF-8 | 310 | 3.375 | 3 | [] | no_license | def ABCheck(str):
my_ans = 'false'
for i in range(0, len(str) + 1):
try:
print(str[i], str[i + 4])
if str[i].lower() == 'a' and str[i + 4].lower() == 'b':
my_ans = 'true'
except:
continue
return my_ans
print ABCheck(raw_input())
| true |
091230cf635cb3c082dcdb6c9f5cfa65e8bc0824 | 1098813507/Taller-de-Algoritmos | /31.py | UTF-8 | 254 | 3.703125 | 4 | [] | no_license | print("triple o cuarta parte")
num=int(input("digite un numero"))
triple=num*3
cuarta=num%4
if num>=10
print("el triple del numero "+str (num)+"en"+str(triple))
else:
print("la cuarta parte del numero"+str(num)+"es"+str (cuarta))
| true |
e12b9caf6e9ae433bfd93d35db1b10102bd223d8 | sugataach/al-gore-rhythms | /core/data_structures/binary_search_tree/bst.py | UTF-8 | 873 | 4.0625 | 4 | [] | no_license | '''
Implement a Binary Search Tree, where the node values are integers.
Insert -> O(logN) (worst case -> O(n), since BST can degrade to a linked list)
Delete -> O(logN)
Search -> O(logN)
'''
class BSTNode:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self... | true |
d91711ae0c8ccd414480aa2990b876ae2b99dbd6 | TH-Williamson/Class-Projects | /GradesFileReader.py | UTF-8 | 944 | 4 | 4 | [] | no_license | import csv
# Dictionary that maps student names to a list of scores
grades = {}
# Use with statement to guarantee file closure
with open('grades.csv', 'r') as csvfile:
grades_reader = csv.reader(csvfile, delimiter=',')
first_row = True
for row in grades_reader:
# Skip the first row with column na... | true |
6515382a2014285702e2d41602b6cbbb8b7bce11 | Kiruthika-Lakshmanan/python-excercises | /revnum.py | UTF-8 | 171 | 3.328125 | 3 | [] | no_license | a=86776587658
b=1
flag=0
while(a>0):
num=a%10
a=a//10
if(num==b):
flag=1
break
elif(flag==0):
print("the digit not found")
| true |
b71a76390961117f678738a889082dda82ac51dc | erikseulean/cryptoscraping | /crypto/libs/scraping/rank_scrapping.py | UTF-8 | 570 | 2.859375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
url = "https://coinmarketcap.com{path}"
def scrap_rankings():
page = requests.get(url.format(path='/historical'))
contents = page.content
soup = BeautifulSoup(contents, 'html.parser')
ul = soup.find_all('ul', {'class': 'list-unstyled'})
return [elem... | true |
0b0e8f1353f60ba1c6c7c958902ab14db99db1d9 | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/mkdir01/lesson09/test_mailroom.py | UTF-8 | 9,076 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
from io import StringIO
from datetime import date
from contextlib import redirect_stdout
import ast
import pytest
from mailroomOO import *
from mailroomOO import input_dollars
def make_group_for_testing():
gd1 = Group_Donors()
gd1.add_donor(Individual_Donor('John Doe', 500.05))
gd1.ad... | true |
73087cc7fcac71b3d2722d8e01f13c8e54551a50 | koper921/Otto_kaggle_docker | /train.py | UTF-8 | 950 | 2.59375 | 3 | [] | no_license | from imblearn.pipeline import Pipeline
from sklearn.decomposition import PCA
from sklearn.metrics import precision_score, log_loss
from sklearn.model_selection import train_test_split
from model import XGBoostClassifierWithEarlyStop
import pandas as pd
df_train = pd.read_csv(r"C:\Users\MyPC\Documents\AIC-partage\TC1\... | true |
a2b10e917d30ba2d7b05aeb96d5175e2153c44b1 | ben-schulz/foowise | /foowise/channels/Theory.py | UTF-8 | 1,142 | 2.640625 | 3 | [
"MIT"
] | permissive | from . import Sequent as S
from ..math import LinAlg as m
class Theory:
def __init__(self, \
cla=None,
table=None, alphabet=set(), constraints=set()):
self.alphabet = alphabet
self.constraints = constraints
self.cla = cla
if cla:
self... | true |
ccb1712d713e921e87d307c9833003ba7126fc32 | Dutta-SD/CC_Codes | /Competitions/Atcoder/ABC_203/C.py | UTF-8 | 631 | 2.71875 | 3 | [] | no_license | n, k = map(int, input().split())
frnd = {}
for _ in range(n):
v, m = map(int, input().split())
frnd[v] = frnd.get(v, 0) + m
money = k
finalpos = 0
key = list(frnd.keys())
key.sort()
i = 0
# print(key)
# print(frnd)
key.append(float('inf'))
while money > 0 and i < len(key):
if key[i] - finalpos > mone... | true |
2acb3966cf324fac28da30d03b15d0135adab53c | eflipe/python-exercises | /apunte-teorico/gg/consecutives_numbers.py | UTF-8 | 453 | 4.5625 | 5 | [] | no_license | #Given K and a binary number, check if there exists k consecutive 1’s in the binary number.
# Python program to check if there
# is k consecutive 1's in a binary number
# fucntion to check if there are k
# consecutive 1's
def check(s,k):
# form a new string of k 1's
new = "1"*k
# if there is k 1's at an... | true |
5acfbb09e4d3b66673bbe5284b47b53b5cf60613 | xavieryang007/tensorflow_learn_note | /1/1-1/code/test_read.py | UTF-8 | 1,601 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 6 18:52:37 2017
@author: 代码医生 qq群:40016981,公众号:xiangyuejiqiren
@blog:http://blog.csdn.net/lijin6249
"""
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
plotdata = {"batchsize": [], "loss": []}
def moving_average(a, w=10):
... | true |
9be566ebd322a9053328137fd6083798406cfaf8 | codeBeefFly/bxg_python_basic | /Day03/10.元组的使用场景.py | UTF-8 | 1,012 | 4.5 | 4 | [] | no_license | '''
自动组包
自动解包
交换数据
格式化输出
让列表不可被修改,保护数据安全
'''
'''--------------------- 自动组包 ---------------------'''
# 定义多个变量
# a,b = 10,20
# t = ('酸奶','可乐','矿泉水')
# 组包
# g = 30,40,50
# print(type(g))
# print(g)
'''--------------------- 自动解包 ---------------------'''
# t = ('酸奶','可乐','矿泉水')
# 解包
# a,b,c = t
# print(a,b,c)
'''--------... | true |
90648c0b7eb30c81538dc26316b99995d3f15c05 | vulgarman/Python | /小杨/图形编程/带图标的窗口.py | UTF-8 | 1,427 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from PyQt4 import QtGui
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
# 新建一个类Example,继承自QtGui.QWidget
# 重写类的构造函数,以方便给其增加新的属性
# 继承类的构造函数增加属性首先显示调用父类的构造函数来继承父类的所有属性,
# 使用super().__init__()或parentClassName.__init__()
# 给类Example增加了initUI属性。
# 基本上就是这么个写法,其他的后面具体在学习
class Example(QtGui.QW... | true |
0583288959add7c05b690b586ee51bf61bcb1ca7 | phodge/stackwar | /stackwar/surveyutils.py | UTF-8 | 2,608 | 3.25 | 3 | [
"MIT"
] | permissive | import csv
from typing import Iterator, Set, Tuple
from stackwar import get_squash_path
def get_cols(year: int) -> Tuple[str, str]:
if year == 2020:
# Which programming, scripting, and markup languages have you done
# extensive development work in over the past year, and which do
# you wa... | true |
dbf31f18bcf6d9fb95a678fad5a580562e8f46ad | lamorenove/Ejercicios-Python | /Modulo1/04_Cuarta_semana.py/Funciones de Orden Superior/Funcion_orden_Superior_03_map.py | UTF-8 | 382 | 4.15625 | 4 | [] | no_license | """
La función map nos permite aplicar una
función sobre cada uno de los elementos de
una colección(listas,tuplas,etc,...).
Haremos uso de esta función siempre que
tengamos la necesidad de transformar el
valor de cada elemento en otro.
"""
def doblar(numero):
return numero*2
numeros = [2, 5, 10, 23, 50, 33]... | true |
9b78719ff4f791e4798d3ce65a774860ddf7edb4 | tir-bogo/tar-extract | /extract.py | UTF-8 | 7,602 | 3.375 | 3 | [
"Apache-2.0"
] | permissive | """
Module contains class to extract tar and gz files
"""
import re
import tarfile
import gzip
from pathlib import Path
#pylint: disable-msg=too-many-arguments
#pylint: disable-msg=invalid-name
#pylint: disable-msg=no-else-return
class Extract:
"""
This class takes care of extracting files
"""
file_... | true |
1d250a0bf48a30abaf67e9a9162614662f2a8e89 | oborogri/python3_aws | /instance_server.py | UTF-8 | 2,498 | 3.078125 | 3 | [] | no_license | #!/usr/bin/python3
# A Python3 script that establish SSH connection to the new instance on AWS
# It will copy check_server script from local machine and will check if nginx webserver is runnig on that instance
# If nginx not runnig - it will install and start the webserver
# The user is presented with info messasges a... | true |
7e8ea947fbabeb7e0980bc3f16245f3cc90f0a8b | yuzi0924/testTwo | /warehouse.py | UTF-8 | 2,053 | 3.265625 | 3 | [] | no_license | # 原始贝叶斯
# # 共含6个文档
# import bayes as bayes
#
# ListOPosts = [['my', 'dog', 'has', 'flea',
# 'problems', 'help', 'please'],
# ['maybe', 'not', 'take', 'him',
# 'to', 'dog', 'park', 'stupid'],
# ['my', 'dalmation', 'is', 'so', 'cute',
# 'I', 'love'... | true |
6f122299a4008f474cce635d8d03ab0457763b7c | oliia/Zookeeper | /Problems/Update a list/task.py | UTF-8 | 125 | 3.3125 | 3 | [] | no_license | numbers = [4, 1, 0, 3, 2, 5]
# put your python code here
for i in range(len(numbers) - 1):
numbers[i] = i
print(numbers)
| true |
4fcef86322d229763bd9e4e9f7b5148e82763c53 | sbisw002/qutip-lattice | /qutip_lattice/tests/test_lattice.py | UTF-8 | 74,894 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
import pytest
from qutip import *
from qutip_lattice import *
from scipy.sparse import (csr_matrix)
_r2 = np.sqrt(2)
def _assert_angles_close(test, expected, atol):
"""Assert that two arrays of angles are within tolerance of each other."""
np.testing.assert_allclose(test % (2 * np.pi), ex... | true |
e872dce70741224687ba64cf93e437c330c2ac0e | lilinxi/210429_YoloV3_Experiment | /dataset/transform.py | UTF-8 | 13,966 | 2.921875 | 3 | [
"MIT"
] | permissive | from typing import List
import numpy
import PIL.Image
import torch
import torchvision
def rand(min: float, max: float) -> float:
return numpy.random.rand() * (max - min) + min
class Compose(object):
"""
复合多种变换操作
"""
def __init__(self, transforms):
self.transforms = transforms
def... | true |
45fb98ffbacbed56d9e1149c72dd92f902e1e9dc | xiphodon/spider_hs_code | /linkedin_email_parse.py | UTF-8 | 4,897 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/11/11 12:15
# @Author : GuoChang
# @Site : https://github.com/xiphodon
# @File : linkedin_email_parse.py
# @Software: PyCharm
import os
import settings
import json
import pymssql
linkedin_email_dir = settings.linkedin_email_dir
linkedin_email_json... | true |
2545720846a4f8ceb7f1e9cd22dcb4c923a8b8c8 | daterrell2/datatools | /datatools/base_source.py | UTF-8 | 1,040 | 2.71875 | 3 | [] | no_license | from more_itertools import peekable
from collections import OrderedDict
class DBSource:
def __init__(self, *args, **kwargs):
self.initialize(*args, **kwargs)
def initialize(self):
pass
def extract(self):
records = self.db.execute(self.select)
for row in records:
... | true |
131c4f6f42f2fa0c1f2aa3a5e9db772e88fc1645 | simonstead/harry_potter | /harry_potter.py | UTF-8 | 2,071 | 3.53125 | 4 | [] | no_license | import unittest
PRICE = 8
class HarryPotter(unittest.TestCase):
def test_single_book(self):
quantities = [0,0,0,0,1]
total = self.calc_price(quantities)
expected_total = 8
self.assertEqual(total, expected_total)
def test_two_separate_books(self):
quantities = [0,0,1,0,... | true |
85d823a57e5a67ac750a988cd7343458b2924349 | RunSheng-Li/my_code | /python数据分析/pandas_DataFrame对象2.py | UTF-8 | 886 | 4.09375 | 4 | [] | no_license | """
本文件讲解了如下内容
1.用嵌套字典生成DataFrame对象
2.DataFrame转置
"""
import pandas as pd
# 嵌套字典是python广泛使用的数据结构,如下
# 直接将这种数据结构作为参数传递给DataFrame()构造函数,pandas就会将外部的键解释成列名称,将内部的键解释为索引标签
# 解释嵌套结构时,可能并非所有位置都有相应的元素存在,pandas会用NaN填补缺失的元素
nestdict = {
'red': {2012: 22, 2013: 33},
'white': {2011: 13, 2012: 22, 2013: 16},
'blue': ... | true |
0f568778659b38fa747d2308c12b7348bab6d0ac | cryptobuks1/Encrypted_QR_Code | /qrcrypto/generate_qr.py | UTF-8 | 2,208 | 2.96875 | 3 | [
"MIT"
] | permissive | # Make qr code and return as image.pil.pilimage
def make_qr(data, size=2):
import qrcode
import datetime
import os
qr = qrcode.QRCode(
version=size,
error_correction=qrcode.constants.ERROR_CORRECT_H,
box_size=10,
border=2,
)
qr.add_data(data)
qr.make(fit=True)
img = qr.make_image()
retur... | true |
f9111f9dd96b191627622d3fcc04d64bfe785c1a | Pandinosaurus/ensae_teaching_cs | /_unittests/ut_data/test_data_competition.py | UTF-8 | 2,644 | 2.640625 | 3 | [
"MIT"
] | permissive | """
@brief test log(time=3s)
"""
import os
import unittest
import pandas
from pyquickhelper.loghelper import fLOG, get_password
from pyquickhelper.pycode import get_temp_folder, is_travis_or_appveyor
from pyquickhelper.filehelper import zip_files
from ensae_teaching_cs.data.crypt_helper import encrypt_data, decryp... | true |
1402d5135c9ff60a9367204f80e9f4ff56183575 | gngoncalves/cursoemvideo_python_pt2 | /desafio113.py | UTF-8 | 890 | 4.46875 | 4 | [] | no_license | def leiaInt(num):
while True:
try:
n1 = int(input(num))
except KeyboardInterrupt:
n1 = 0
print('O usuário preferiu não digitar esse número.')
break
except:
print('\033[31mErro! Digite um número inteiro válido.\033[m')
co... | true |
277c0540f25e63b79423d4b6dff815a78036d2b5 | OlegLobanow/Python | /les 3 dz 2.py | UTF-8 | 718 | 3.59375 | 4 | [] | no_license | # Урок три задание два
name = input('Введите имя ')
surname = input('Введите фамилию ')
year = int(input('Введите год рождения '))
city = input('Введите город ')
email = input('Введите email ')
telephone = input('Введите телефон ')
def my_func(имя, фамилию, год_рождения, город, email, телефон):
return '... | true |
6b2e99d8b5a7589a948da6db26c64ced6d35e391 | mori97/CycleGAN-chainer | /models.py | UTF-8 | 4,955 | 2.609375 | 3 | [
"MIT"
] | permissive | import chainer
import chainer.functions as F
import chainer.links as L
class Discriminator(chainer.Chain):
"""Discriminator of Cycle-GAN. (70x70 PatchGAN)
Note: Batch normalization will be instance normalization
if batch size is 1.
"""
def __init__(self):
super(Discriminator, self).... | true |
e537e7940f837cb21116edaa4fb8159728484878 | malekhnovich/PycharmProjects | /Chapter5_executing_control/Chapter7_encapsulation/exception_example.py | UTF-8 | 273 | 4.15625 | 4 | [] | no_license | try:
#try block
strAge=input('Enter your age')
intAge=int(strAge)
print('You are {} years old.'.format(intAge))
except ValueError:
#except block---executed only if valueError
#exception is raised in the try block
print('Enter your digits 0-9!')
| true |
55d828e1fe55e1ff6bf3ce466222509c0af7e0cb | karinlinna/methodvec | /demo/split.py | UTF-8 | 2,063 | 2.65625 | 3 | [] | no_license | #载入需要的模块
import pandas as pd
import os
test_corpus=[]
os.getcwd() #获取当前工作路径,查看是否是自己的目标路径
os.chdir('/Users/ljl/Downloads/glove/glove.py-master/MV_L') #如果不是,改到目标路径
path = '/Users/ljl/Downloads/glove/glove.py-master/MV_L'
os.listdir(path) #查看目标路径下有哪些数据
datalist = []
num = 1
file_train = open('/Users/ljl/Downloads/glove... | true |
6059b002d104e783b347512e76f35aad9e5f7880 | cmh1027/NLP-practice | /practice/w2vec/word2vec.py | UTF-8 | 3,018 | 2.640625 | 3 | [] | no_license | import torch
import random
from collections import Counter
import argparse
import torch.nn as nn # use plan embeding
import sys
sys.path.append('..')
from common.optimizer import SGD
from common.util import preprocess, create_context_target, convert_one_hot
from w2vec.CBow import CustomCBOW
from w2vec.SkipGram import ... | true |
38ad3bf3c8bf96c438d50d890fbd51fcf4fb43e9 | robrogers3/python-tests | /graphs/Node.py | UTF-8 | 1,043 | 3.453125 | 3 | [] | no_license | class Node:
def __init__(self, data, neighbors = []):
self.data = data
self.neighbors = neighbors
self.state = 'unvisited'
self.longest_path = 0
def __str__(self):
buffer = '{} ' * len(self.neighbors)
data = [n.getData() for n in self.neighbors]
formatted... | true |
7fe347e4f753288f94be8cb7a6005e20cc495b8e | timerickson/kmy | /kmy/address.py | UTF-8 | 430 | 3.078125 | 3 | [
"MIT"
] | permissive | class Address:
def __init__(self):
self.city: str = ""
self.street: str = ""
self.telephone: str = ""
@classmethod
def from_xml(cls, node):
address = cls()
address.init_from_xml(node)
return address
def init_from_xml(self, node):
self.city = node... | true |
60977039619c71cefa989163924e73363381b60d | kwright-ciat/pyball | /pyball.py | UTF-8 | 9,937 | 3.109375 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/python
# Created by Keith Wright
# Uses Python 2.7
import os
import sys
import time
import random
import pygame
from pygame.locals import *
if not pygame.font: print 'Warning, fonts disabled'
if not pygame.mixer: print 'Warning, sound disabled'
def load_high_score():
filename = 'highscore.txt'
try:... | true |
12ba312f953f0f494eed663ed33fedda54d6f923 | saeedahmadian/RNN | /Main.py | UTF-8 | 1,489 | 2.734375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import KFold
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import LSTM
from tensorflow.keras.... | true |
f5cef1b8f51d5f0abb00d20ca3bdd75f62891725 | QiuHongHao123/Algorithm-Practise | /Others/括号生成L22.py | UTF-8 | 1,577 | 3.796875 | 4 | [] | no_license | from typing import List
class Solution:
def generateParenthesis(self, n: int) -> List[str]:
'''
给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并且有效的括号组合。
我的做法
:param n:
:return:
'''
result=[]
def output(done:str,remain_L,remain_R):
'''
我考虑插... | true |
5611a4941497e1aad3926024ffe4625bda7fe04c | ghazisarhan/nagmq | /cgi/rebootcgi.py | UTF-8 | 1,611 | 2.671875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | #!/usr/bin/python26
"""
This is a CGI that will add 20 minutes of downtime for whatever host
accesses it. It's intended to be called from the shutdown scripts of
hosts, so that hosts that are being shut down in a controlled manner
don't cause spurious alerts.
"""
import time, zmq, os, socket
from datetime import timed... | true |
955b78fd0f4fee338f51fa644ec57d95e9338fe6 | kwh3884858/d-minor | /interpolation.py | UTF-8 | 3,426 | 3.921875 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Lagrange(object):
"""Build Lagrange interpolation polynomial and compute its value.
The formula is:
L(x) = sum_(i=1)^n y_i * prod_(1<=j!=i<=n) (x - x_j) / (x_i - x_j)
>>> x0 = [1, 2, 3, 4, 5]
>>> y0 = [0, 2, 12, 42, 116]
>>> f = Lagrange(x... | true |
3c8562b522737b40eebd609620f5b96d08ea70c8 | JeDeveloper/SimulationThingy | /entity.py | UTF-8 | 1,006 | 2.921875 | 3 | [] | no_license | class Entity:
def __init__(self, name, genome, age=0, **kwargs):
self.__name = name
self.genome = genome
self.__num_mates = kwargs['num_mates']
self.__offspring_count = kwargs['offspring_count']
self.__lifespan = kwargs['lifespan']
self.__age = age
# accessors
... | true |
16903f042c658fb82690b0d06027b74e46126d80 | hsuanju-wang/dcard-crawler | /dcard-mongodb/dcard_mongodb.py | UTF-8 | 4,877 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import requests, json
h= {'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36'}
import threading
import argparse
import datetime,time
from dcard import Dcard
from pymongo import MongoClient
from pycorenl... | true |
a403a293801cb85d1e61c96fda8a9cddb9e8bf59 | parkerahall/dailycodingchallenge | /4-9-19.py | UTF-8 | 171 | 3.078125 | 3 | [] | no_license | def square_sort(integers):
return sorted([x ** 2 for x in integers])
integers = [-9, -2, 0, 2, 3]
expected = [0, 4, 4, 9, 81]
assert square_sort(integers) == expected | true |
0c5d87ce65dd8d8c540af759eddb56c4186594db | olopez15401/Python_Exercises | /t_shirt.py | UTF-8 | 214 | 3.234375 | 3 | [] | no_license | def make_shirt(size='Large', printed_message="Shawn hates tabs"):
print("The size of this shirt is " + size + " and it prints " +
printed_message)
make_shirt('xl','Python 3 or bust')
make_shirt('m')
| true |
e1ee67a437570c9dafd68a889854a78e130704b8 | sebastian-schlecht/highway | /highway/debug.py | UTF-8 | 2,277 | 2.84375 | 3 | [
"MIT"
] | permissive | import os
import sys
import time
from .engine import Node
from .modules.base import StreamWriter
import pickle
from scipy.misc import imsave
try:
import Queue
except:
import queue as Queue
class ImgDumper(StreamWriter):
"""
Saves all images in a batch to a directory named by the index in the batch.
... | true |
0c19b305e315f3e0c925e2d2f3d7e94290649d1b | jakeT-wagner/Connect4 | /connect/board.py | UTF-8 | 1,284 | 3.234375 | 3 | [] | no_license | import pygame
from .constants import DBLUE, WHITE, YELLOW, RED, GRAY, WIDTH, HEIGHT, SQUARE_SIZE, RADIUS, PADDING, ROWS, COLS
from .piece import Piece
class Board:
def __init__(self, win):
self.board = []
self.win = win
self.initiate_board()
self._draw()
def draw_plastic(s... | true |
6652c81fa4dd61ce46403d1e4cb1b15d53879a8e | FleishmanLab/membrane_prediction | /output2html.py | UTF-8 | 7,699 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
"""
a group of functions to create HTML output for a prediction
"""
def create_html(topo_entry, best_path, sec_path, wins):
from ProcessEntry import topo_string_rostlab_format
from timeit import default_timer
import os
# print 'making win plot'
# make_win_plot(... | true |
768439f651cb98d008ada84dc561cb184ffa4b80 | wentaohe/NNS-Challenge | /codes/find_similar_questions.py | UTF-8 | 3,510 | 3.15625 | 3 | [] | no_license | from load_questions import load_questions
from find_nouns import find_nouns
from strip_nouns import strip_nouns
from search_through_dict import search_through_dict
from sentence_transformers import SentenceTransformer
from sklearn.metrics.pairwise import cosine_similarity
old_questions = load_questions()
old_nouns_di... | true |