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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0e18d59e8c698cc85ca4ec64a0693a411103adeb | Python | Cici-Zhong/NNML-Assignment | /assignment4/assignment4.py | UTF-8 | 13,585 | 2.796875 | 3 | [] | no_license | import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
def a4_rand(requested_size, seed):
''' PS: Returns array of pseudo-random values from 0 to 1.
Array sizes are requested_size, seed - some pseudo-random initializer
'''
requested_size = list(requested_size)
start_i = round(see... | true |
c0393960b4cc16fe90fd3924dbcb373fe36f5bb5 | Python | Shiva123-gsp/bank-app | /bank.py | UTF-8 | 2,244 | 2.53125 | 3 | [] | no_license | from flask import Flask, render_template, request,url_for
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///banking.db'
db = SQLAlchemy(app)
class Customer(db.Model):
sno = db.Column(db.Integer(), primary_key=True)
name = db.Column(db.String(length... | true |
e4ebad57c35332cf305a57ca1408c9031eda2e20 | Python | passion4energy/pyPESTO | /pypesto/startpoint/uniform.py | UTF-8 | 643 | 2.90625 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from .util import rescale
def uniform(**kwargs) -> np.ndarray:
"""
Generate uniform points.
"""
# extract input
n_starts = kwargs['n_starts']
lb = kwargs['lb']
ub = kwargs['ub']
if not np.isfinite(ub).all() or not np.isfinite(lb).all():
raise ValueError('Can... | true |
18148ce7c7bcf7f978cb98e1e862b869d902dff0 | Python | PedroLuiz99/fatec-5sem-lpbd | /src/generator/location_resolver.py | UTF-8 | 2,755 | 3.03125 | 3 | [] | no_license | import os
import sys
import json
import geojson
import requests
from shapely.geometry import shape
citynames = {
"São Paulo": 1,
"Rio de Janeiro": 2,
"Cajamar": 3,
"Queimados": 4,
"Guarulhos": 5
}
MAPS_API_KEY = os.getenv("MAPS_API_KEY")
BASE_MAPS_URL = 'https://maps.googleapis.c... | true |
c428f74a85c10334800cf8f6d77c7bc99513ab2b | Python | cauMLlab/AttentionLSTM_timeseries_prediction | /Stock_Dataset.py | UTF-8 | 3,848 | 2.640625 | 3 | [] | no_license | from pandas_datareader import data as pdr
import yfinance as yfin
from torch.utils.data import Dataset
import pandas as pd
from sklearn.model_selection import TimeSeriesSplit
## t+1 부터 t+5 까지 동시에 예측
## data preperation
## dataset은 i번째 record 값을 출력해주는 역할을 함.
## if input feature is 2 demension, then 인풋으로는 2차원을 주고, ... | true |
f340b158c5ec3ef7bbbefdc6d88d673339e62f3c | Python | Aasthaengg/IBMdataset | /Python_codes/p02258/s313104193.py | UTF-8 | 249 | 3.09375 | 3 | [] | no_license | N = int(input())
min_v = int(input())
r = int(input())
max_v = r - min_v
if min_v > r:
min_v = r
for _n in range(2, N):
r = int(input())
if max_v < r - min_v:
max_v = r - min_v
if min_v > r:
min_v = r
print(max_v)
| true |
0ddf3ef9b9e226cecaf48a42a0a5c461476b66c8 | Python | li871804050/kaggle | /zhengqi/coe_assoc.py | UTF-8 | 623 | 2.953125 | 3 | [] | no_license | import pandas as pd
import numpy as np
np.set_printoptions(threshold=np.nan, suppress=True)
if __name__ == '__main__':
train_data = pd.read_csv('data/zhengqi_train.txt', '\t')
# train_data = np.array(train_data)
# value = train_data[:, 0:-1]
# target = train_data[:, -1:]
# cor = np.corrcoef(train_d... | true |
50bd57bc593acff2c6050dd7f4b14c7a380f04da | Python | dtmacroh/KattisCode | /divideby100.py | UTF-8 | 149 | 3.15625 | 3 | [] | no_license | # divideby100
# Author: Debbie Macrohon
# Description:
n = int(input())
m = int(input())
res = n/m
if (n%m==0):
print(int(res))
else:
print(res)
| true |
dc8e1ece29f6e6f335afa9f7dcf94e7fee4195b0 | Python | cajogos/easy-steps | /python/chapter-009/tk_window.py | UTF-8 | 168 | 3.1875 | 3 | [] | no_license | from tkinter import *
window = Tk()
window.title('Label Example')
label = Label(window, text = 'Hello World!')
label.pack(padx = 200, pady = 50)
window.mainloop()
| true |
e7b5919393114a55bec3d1646c23b57ce10cf30f | Python | joonaspessi/courses | /SGN-41007/Week7/ex7_45.py | UTF-8 | 1,667 | 2.859375 | 3 | [
"MIT"
] | permissive | import numpy as np
from scipy.io import loadmat
from sklearn.feature_selection import RFECV
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
from sklearn.model_selection import cross_val_score
import matplotlib.pyplot as plt
if __name__ == "__main__":
data = loadmat("... | true |
e2457135dee76958bc835e9184acab4c38be4941 | Python | SohuEmily/Multimodal-short-video-dataset-and-baseline-classification-model | /aggregate_download_data_to_a_json_file/aggravate_data_utils.py | UTF-8 | 8,546 | 2.84375 | 3 | [] | no_license | import os
import sys
import pathlib
import pandas as pd
import json
def clean_specified_type_file(data_root=None, specified_type_list=["*/*/*.mp4", "*/*/*.jpeg", "*/*/*.txt"]):
"""
:param data_root: To delete the root of the file
:param specified_type_list: To delete the relationship between the specified... | true |
407d45b099781f396d4c5db41128980c828728c2 | Python | madlad33/iris_prediction_with_api | /iris_prediction/prediction/serializers.py | UTF-8 | 1,158 | 2.578125 | 3 | [] | no_license | from rest_framework import serializers
from .models import Flower
import pandas as pd
class FlowerSerializer(serializers.ModelSerializer):
def create(self, validated_data):
# Get the required data and read the pickled data to make
# prediction and save it with the result
sepal_length = sel... | true |
842869006a4e8e5fb9c6212b1e7925c515d71e67 | Python | fernandavincenzo/exercicios_python | /0-25/007_Media.py | UTF-8 | 173 | 4.09375 | 4 | [] | no_license | n1 = float(input('Por favor, insira sua primeira nota: '))
n2 = float(input('Agora, insira sua segunda nota: '))
print('O valor da sua média é: {:.2f}'.format((n1+n2)/2))
| true |
1fc7f82ed7ab7bd222d05e590c4eb39974c9c933 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2095/60870/255151.py | UTF-8 | 117 | 3.078125 | 3 | [] | no_license | a = input()
b = input()
a_int = int(a, 2)
b_int = int(b, 2)
res_int = a_int + b_int
res = bin(res_int)
print(res[2:]) | true |
db5ff758715bd0b335b63d912594e0467a709dc2 | Python | gpf71/OnTap | /starterbot.py | UTF-8 | 5,151 | 3.109375 | 3 | [] | no_license | import os
import time
import re
import OnTap
from slackclient import SlackClient
# Many thanks to Matt Makai for the shell that runs the bot.
# https://www.fullstackpython.com/blog/build-first-slack-bot-python.html
# instantiate Slack client
slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
# starterbot... | true |
d682ab8765f048c4b8ef10b4826734e0a0365855 | Python | avejgreen/Python | /RayTracer/Enter_Exit_Tester.py | UTF-8 | 439 | 3.09375 | 3 | [] | no_license | import tkinter as tk
def motion_cmd(event):
canvas.itemconfigure(position_text, text=str(event.x)+', '+str(canvas_height + 1 - event.y))
root = tk.Tk()
canvas_width = 200
canvas_height = 200
canvas = tk.Canvas(root, width=canvas_width, height=canvas_height, bd=0)
position_text = canvas.create_text(2, canvas_he... | true |
3d0e4ac9de71327d7f92fab0e827f1ad75f873b3 | Python | 13555785106/PythonPPT-01 | /LessonSample/chapter09/19_02_迭代器.py | UTF-8 | 342 | 3.359375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
class Fibs:
def __init__(self):
self.a = 0
self.b = 1
def next(self):
self.a, self.b = self.b, self.a + self.b
return self.a
def __iter__(self):
return self
fibs = Fibs()
print fibs.next()
print fibs.next()
print fibs.nex... | true |
97c1d9e2810e7b7e37c2aeb17895bdb8374c9246 | Python | dwtcourses/emora_stdm | /emora_stdm/state_transition_dialogue_manager/macro.py | UTF-8 | 1,435 | 2.90625 | 3 | [] | no_license |
from abc import ABC, abstractmethod, abstractproperty
from emora_stdm.state_transition_dialogue_manager.ngrams import Ngrams
from typing import Union, Set, List, Dict, Callable, Tuple, NoReturn, Any
class Macro(ABC):
@abstractmethod
def run(self, ngrams: Ngrams, vars: Dict[str, Any], args: List[Any]):
... | true |
e09303d956b80549bbf7336c6cb3cacbac6fafa6 | Python | memoryleak47/diagrammer | /src/debug.py | UTF-8 | 240 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python3
indent = 0
def funcOn(msg):
global indent
print("\t"*indent + msg + " {")
indent += 1
def func(msg):
global indent
print("\t"*indent + msg)
def funcOff(msg):
global indent
indent -= 1
print("\t"*indent + "}")
| true |
a368ac116b44c9668a100f69a6c48413450a43d0 | Python | Iflgit/GB_Algoritms | /lesson6/l3t1.py | UTF-8 | 923 | 3.6875 | 4 | [] | no_license | # 1. В диапазоне натуральных чисел от 2 до 99 определить, сколько из них
# кратны любому из чисел в диапазоне от 2 до 9.
MIN_ITEM: int = 2
MAX_ITEM: int = 99
array = [num for num in range(MIN_ITEM, MAX_ITEM + 1)] # [2..MAX_ITEM]
# print(array)
value_count = {num: 0 for num in range(2, 9 + 1)} # [2:0..9:0]
# print(v... | true |
ba76db70515883d184b8a3e17bb109a334de04b3 | Python | Aasthaengg/IBMdataset | /Python_codes/p03088/s073225556.py | UTF-8 | 854 | 3.03125 | 3 | [] | no_license | n = int(input())
memo = [{} for i in range(n+1)]
mod = 10**9+7
#想定解法の写経
def ok(last4):
#隣接する二つを入れ替えてAGC二ならないかどうかをチェック
for i in range(4):
t = list(last4)
if i >= 1:
t[i], t[i-1] = t[i-1], t[i]
if "".join(t).count('AGC') >= 1:
return False
return True
def dfs(no... | true |
37d320dd361241ab3c5308ddee61167865012c77 | Python | colbrall/enhancer_promoter_manuscript | /bin/set_length.py | UTF-8 | 633 | 3.328125 | 3 | [] | no_license | '''
set_length.py
@author Laura Colbran
makes everything the same length by changing the start/end locations
keeps regions centered.
USAGE:
python set_length.py PATH/TO/BED/FILE N
N = desired length (bp)
'''
import sys
def main():
s = [str.split(line.strip(),'\t') for line in open(sys.argv[1], 'r')]
ta... | true |
3c40a47c1f77f50c9e6f79b96d8ddecd69267ed9 | Python | juliatiller2/Quick-Tools-for-the-Observational-Astronomer | /lines.py | UTF-8 | 773 | 3.234375 | 3 | [
"MIT"
] | permissive | '''
This script returns the restframe wavelength(s) of any line in the dictionary below.
As many lines can be added as wanted.
'''
import numpy as np
# currently holds the lines I use most frequently in my work
dic = {'ha':6562.8,'ciii':[1906.8,1908.78],'lya':1215.67,\
'civ':1548.48,'oiii':[4959.,5007.],'cii':2326.0,... | true |
3ae69bf6a2a1f8a19aeb3a4bef9caa837ea6bbb9 | Python | choco59/Reconocimiento | /Reconocimiento.py | UTF-8 | 3,819 | 2.75 | 3 | [] | no_license | import face_recognition
import cv2
from flask import Flask, request, jsonify, render_template
from flask_restful import Resource, Api
from flask_cors import CORS
from datetime import datetime
import requests
import json
app = Flask(__name__)
api = Api(app)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
... | true |
66fc79c0b9726894bced761d92a23205395e147a | Python | ygorclima/apd | /Ator/TestAtor.py | UTF-8 | 1,874 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | import unittest
import ControllerAtor
class TestAtor(unittest.TestCase):
def setUp(self):
ControllerAtor.RemoverTodosAtores()
def test_sem_ator(self):
atores = ControllerAtor.BuscarAtores()
self.assertEqual(0, len(atores))
def test_adicionar_ator(self):
ControllerA... | true |
f675361c45bf037be77a138594f244047abad81b | Python | Cristiananc/producaoalimentos | /app.py | UTF-8 | 2,407 | 2.59375 | 3 | [] | no_license | import os
import json
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_cytoscape as cyto
app = dash.Dash(__name__)
app.title = "Producao alimentos"
server = app.server
app.scripts.config.serve_locally = True
app.css.config.serve... | true |
15eb02b0b1079192061edcbb2ecb8a20063056ff | Python | rangure/DailyEnglishWords | /generatewords.py | UTF-8 | 765 | 2.546875 | 3 | [] | no_license | import random
import os, sys
n_new=20
n_old=20
n_hard=10
def getday():
logfile=open("log.txt",'r')
line=logfile.readline().split()
logfile.close()
return int(line[1])
day=getday()
pool=[]
cur=open("./Words/%d/words.txt"%(day+1),'r')
l=cur.readlines()
poolnew=l[2:].copy()
cur.close()
... | true |
a49cdae7f71ff77fc2c2f9cff408a32e92f7ba11 | Python | ksbengal11/EightQueens | /genetic.py | UTF-8 | 5,342 | 3.828125 | 4 | [] | no_license | import random
class Chromosome:
Genes = None
Fitness = None
def __init__(self, genes, fitness):
self.Genes = genes
self.Fitness = fitness
class Population:
Queens = None
PopulationSize = None
population = []
weights = []
def __init__(self, Queens = 8, Size = 10):
... | true |
8c96902bdcb253019932b45e65bda17458c523bc | Python | Linzyan/learning | /Josering/Josephus/adapter/readers.py | UTF-8 | 1,568 | 2.96875 | 3 | [] | no_license | # 实现三种类分装,统一接口
import csv
import zipfile
from Josephus.entities import Reader as rd
class Txt_reader(rd.Reader):
def __init__(self, file_name):
self.file_name = file_name
self.content = []
def read_file(self):
f = open(self.file_name, 'r', encoding='utf-8')
for line in f.readline... | true |
8e84ba64459b19804f9b5f21fb9bd64ac463fbe5 | Python | Assessor/Phytnon-Coursera | /type_triangle.py | UTF-8 | 893 | 4.15625 | 4 | [] | no_license | '''
Даны три стороны треугольника a,b,c. Определите тип треугольника с заданными сторонами.
Выведите одно из четырех слов: rectangular для прямоугольного треугольника,
acute для остроугольного треугольника, obtuse для тупоугольного треугольника
или impossible, если треугольника с такими сторонами не существует.
'''
a =... | true |
94cbfb8d94ccf120ee09f3afc028be8b98b837e6 | Python | grantj-re3/csv2xml_tpl | /utils/csvgetcol.py | UTF-8 | 566 | 3.109375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
# Python 2 or 3
# Extract one column from a CSV file. Handles quoted columns.
##############################################################################
import sys
import csv
if len(sys.argv) != 3:
print("Usage: %s COLUMN_NUM_BASE0 CSV_FILENAME" % sys.argv[0])
sys.exit()
col_num = int(sy... | true |
8658d5929680ce7a4098f33563f75eb32184c8bd | Python | willwallis/StockNotify | /controllers/junkyard.py | UTF-8 | 1,188 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# Importing some of Google's AppEngine modules:
from google.appengine.ext import webapp
# Import modules used by this controller
from controllers import render_view
# Returns a list of US stocks for autocomplete
# Removed for performance reasons.
def stock_list():
USStocks = db.GqlQuery("... | true |
78f380ecc1a81ba9f779b7d32d17e6c8a1529a10 | Python | wwwwodddd/Zukunft | /atcoder/abc027_b.py | UTF-8 | 159 | 2.59375 | 3 | [] | no_license | n=int(input())
a=list(map(int,input().split()))
s=sum(a)
if s%n==0:
a[0]-=s//n
for i in range(1,n):
a[i]+=a[i-1]-s//n
print(n-a.count(0))
else:
print(-1) | true |
e834bfe44b3491b80930dca4882b466db75d9e58 | Python | ArthuruhtrA/Fall-2014 | /eyecu/eyecuTester.py | UTF-8 | 4,331 | 3.984375 | 4 | [] | no_license | """
EyecuBST tester program. Two test programs are provided. One
can be used to confirm that tree insertion is correct and producing
a valid binary search tree. The second test program tests the entire
set of requirements.
Author: Aaron Deever
File: eyecuTester.py
"""
from random import shuffle, seed
import time... | true |
dd45af89906d323b88a910ba8a3b54c6d1a17766 | Python | Safintim/3_bars | /bars.py | UTF-8 | 2,041 | 3.4375 | 3 | [] | no_license | import json
import argparse
def create_parser():
parser = argparse.ArgumentParser(prefix_chars='-+/')
parser.add_argument('file', type=is_json, help='Path to json file')
return parser
def is_json(filepath):
if filepath.lower().endswith('.json'):
return filepath
raise argparse.ArgumentTyp... | true |
332aa49d58c3f27d570f17732c2f17b2121d2ea5 | Python | mohanadkaleia/cuby | /cuby.py | UTF-8 | 7,876 | 3.5 | 4 | [] | no_license | import copy
import argparse
import numpy as np
from enum import Enum
class Direction(Enum):
Forward = 'f'
Reverse = 'r'
class Cell:
def __init__(self, color):
self.color = color
def __repr__(self):
return self.color
class Face:
def __init__(self, size, color, label):
... | true |
046be5bbf0a2bcb3c5e9bf03f108fdf2f75463d8 | Python | callous4567/UoE-Projects | /SimAndVis/C1/fast_ising.py | UTF-8 | 12,794 | 2.828125 | 3 | [] | no_license | import numpy as np
from numba.experimental import jitclass
from numba import types
variable_specification = [
('good_luck', types.unicode_type),
('lx', types.int32)
]
@jitclass(variable_specification)
class fast_ising():
def __init__(self, lx):
good_luck = "Godspeed, mate. It actually works!"
... | true |
cb223015be2127aa46e5a4e1b56b424cef3faf3f | Python | CaptainHaddok/VierOpEenRijGIP | /Interface1.py | UTF-8 | 2,045 | 2.90625 | 3 | [] | no_license | import pygame
class color:
black = (0, 0, 0)
white = (255, 245, 214)
blue = (69, 81, 255)
green = (81, 173, 83)
red = (255, 100, 69)
yellow = (245, 218, 83)
pygame.init()
screen = pygame.display.set_mode((0,0),pygame.FULLSCREEN)
running = True
screen.fill(color.white)
font = pygame.font.Fon... | true |
646ff99a18042109eea8b20b9f66346f570a7586 | Python | awesome-python/moler | /moler/cmd/unix/su.py | UTF-8 | 7,045 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Su command module.
"""
__author__ = 'Agnieszka Bylica, Marcin Usielski, Michal Ernst'
__copyright__ = 'Copyright (C) 2018-2019, Nokia'
__email__ = 'agnieszka.bylica@nokia.com, marcin.usielski@nokia.com, michal.ernst@nokia.com'
import re
from moler.cmd.commandtextualgeneric import CommandT... | true |
a41a22c4669caac0582df016bfe3fe6aad939b62 | Python | Nandita-saini1212/nandita | /13.py | UTF-8 | 89 | 3.359375 | 3 | [] | no_license | from math import pi
r= 6
v=4.0/3.0*pi*r**3
print("the volume of the sphere is : ",v)
| true |
d385e8520a85c9e47ce44340f2c51debddafbc1c | Python | MatRH/TP3-Gunplas | /pilas.py | UTF-8 | 1,356 | 3.421875 | 3 | [] | no_license | class Pila():
'''Representa una pila.
'''
def __init__(self):
self.datos = []
def __str__(self):
display = '['
for dato in self.datos:
display += str(dato)
display += ']'
return display
def apilar(self,dato):
'''Metodo para apilar datos a la pila.
'''
return self.datos.append(dato)
def desap... | true |
11c7e6a28903ec19704639795a79fc836ed1cf63 | Python | Foreman1980/GitRepository | /GeekBrains/02 ООП на Python/hamsters.py | UTF-8 | 729 | 3.21875 | 3 | [] | no_license | from random import randint
class Hamster:
health = 1
position = [0, 0]
def __init__(self, id, map):
self.id = id
self.health = randint(1, 4)
self.position = self.getClearPosition(map)
def onShot(self, strength):
self.health -= strength
return self.health > 0
... | true |
58cf6b5236819f7207f5d75fa97f728b3c82695c | Python | zinni/desafios | /test_segundograu.py | UTF-8 | 694 | 3.359375 | 3 | [] | no_license | from unittest import TestCase
from segundograu import baskara
class TestBaskara(TestCase):
def test_baskara_positivo(self):
esperado = (-1.0, -3.0)
resposta = baskara(1,4,3)
self.assertEqual(resposta, esperado)
def test_baskara_negativo(self):
esperado = 'raiz irreal'
... | true |
91fba87084a011ccc7875dcffbb79f9500ee32ff | Python | Shunyao-Wang/bus_prediction | /code/crawler/crawler.py | UTF-8 | 3,066 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Python3.5
import requests # 导入requests
from bs4 import BeautifulSoup # 导入bs4中的BeautifulSoup
import os
import pandas as pd
import numpy as np
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.221 Safari/537.36 SE 2.X M... | true |
53fab7b1bd36bb2703851f37e655c7e0430c503b | Python | Vijay1234-coder/data_structure_plmsolving | /Dynamic Programming/LCS(longestCommonSubsequence)/LCS_recursion.py | UTF-8 | 658 | 4.0625 | 4 | [] | no_license |
''''''
'''LCS Problem Statement: Given two sequences, find the length of longest subsequence present in both of them.
A subsequence is a sequence that appears in the same relative order, but not necessarily contiguous.
For example, “abc”, “abg”, “bdf”, “aeg”, ‘”acefg”, .. etc are subsequences of “abcdefg”.
x:"ABCDGH"
... | true |
db1257bfc3acae0ce94a5794b0b723c76b4d71fa | Python | ScandiacusTeam/coursePython3 | /datatype.py | UTF-8 | 507 | 4.125 | 4 | [] | no_license | # Strings
print("Hello Word")
print('Hello Word')
print(type("Hello world"))
print("Bye " + "World") # concatenacion
# Numbers
print(100) # int
print(30.5) # float
# Boolean
True
False
# List
[10, 20, 30, 55]
['hello world', 'Bye', 'Adios']
[10, 'Hello', True, 20.1]
# Tuples
(10, 20, 30, 55)
#Dictorionies
{ "N... | true |
c99cae715f327a2fbafea701a9ca2b3da7ebc8b9 | Python | XTmingyue/Algorithm | /回溯/077_Combine.py | UTF-8 | 1,640 | 3.609375 | 4 | [] | no_license | #!/usr/bin python
# -*- coding: utf-8 -*-
# @Time : 2021/1/26 9:33 下午
# @Author : xiongtao
# @File : 077_Combine.py
# @Title : 77. 组合
'''
给定两个整数 n 和 k,返回 1 ... n 中所有可能的 k 个数的组合。
示例:
输入: n = 4, k = 2
输出:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]
'''
class Solution:
# 题目的意思表明1~n中的数不能重复使用,k表明了深度优... | true |
a2268a9fb458ffcb340108c79fee5c645499f137 | Python | bucaar/CG-CodeForLife | /Molecules.py | UTF-8 | 13,189 | 3.03125 | 3 | [] | no_license | import sys
import math
from itertools import permutations
#prints to stderr
def debug(*msg):
msg = [str(x) for x in msg]
print(' '.join(msg), file=sys.stderr)
#prints the sample in a nice way
def print_sample(sample):
if sample["health"] < 0:
debug("{}: ? Rank {}".format(sample["id"], sample["rank... | true |
0d7e7378e1204328349e7b21e79a0d58fea2fa64 | Python | ygohko/shippugssga | /gss.py | UTF-8 | 95,776 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Copyright (c) 2005 - 2020 Yasuaki Gohko
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, co... | true |
33dbbf2724dca1c810fef66b5613b7a20271c6c6 | Python | 2lu3/useful-tools | /crop_video_file.py | UTF-8 | 1,516 | 2.734375 | 3 | [
"MIT"
] | permissive | from moviepy.editor import *
import subprocess
import os, tkinter, tkinter.filedialog
import ffmpeg
class Test():
def __init__(self)
pass
def get_file_path():
root = tkinter.Tk()
root.withdraw()
fTyp = [("", "*")]
iDir = os.path.abspath(os.path.dirname(__file__))
file_path = tkinter.fi... | true |
445b2c8813f9b2c6a25d5cd64db7876a1db98df8 | Python | grzegorzmatczak/PyQt5WeatherApp | /src/utilities/select_day.py | UTF-8 | 971 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
from time import gmtime, strftime
class SelectDay():
def __init__(self):
super().__init__()
def select(self, data, day):
selected_day = []
now = strftime("%Y-%m-%d", gmtime())
print("Date :{}".format(now))
... | true |
8eed13dc98114ca638b8abdce610c9d0dfad2ed3 | Python | ayanagy/python | /functions_test/charindex.py | UTF-8 | 228 | 3.25 | 3 | [] | no_license |
def ch_index(text,character):
list=[]
for y,char in enumerate(text):
if char==character:
list.append(y)
return list
print(ch_index("hi iti","i"))
if __name__ == '__main__':
pass | true |
859103bccde0ddc7f6f0ce3b1091c290a0659416 | Python | PoonamGhutukade/Machine-learning | /Week3/Linear_Algebra/ChildMatrix.py | UTF-8 | 953 | 3.75 | 4 | [] | no_license | # from Week3.ParentMatrix import Parent
from Week3.Linear_Algebra.ParentMatrix import Parent
# single inheritance used here
# child class access constructor of parent class
class Child(Parent):
# class parameterised Constructor
def __init__(self, result):
# from super class init method , we are acc... | true |
d7835a72082169285594536831da8be7dbf9e090 | Python | ivanmillan36/MegaChess | /piezas/peon.py | UTF-8 | 1,338 | 3.34375 | 3 | [] | no_license | import tablero
def getMovimientos(board, x, y):
posicionInicial = [x,y]
pieza = tablero.getPieza(board, x, y)
color = tablero.getColor(pieza)
movimientosPosibles = []
if(color == 'black'):
if (tablero.posicionVacia(board, x, y + 1)):
movimientosPosibles.append([x,y+1])
... | true |
34f3e4dd58d64ff09fe06a723ff008a72258f726 | Python | MDCGP105-1718/portfolio-Ellemelmarta | /Python/ex5.py | UTF-8 | 652 | 4.125 | 4 | [] | no_license | n = 99
#for n in range(99,1,-1):
#working code for the range command as long as the while command is commented out
while n>1:
print(f"{n} bottles of beer on the wall, {n} bottles of beer.")
n-=1
#this n-=1 takes 1 from n allowing me to use n still for the next line which means it is 1 lower than the line ab... | true |
e818db7c5506042389e7555e87ffa2740b09c08f | Python | dennisarmbruster95/mirobot-py | /mirobot/mirobot_server.py | UTF-8 | 3,619 | 2.8125 | 3 | [
"MIT"
] | permissive | import time
from mirobot import Mirobot
from time import sleep
import socket
class MirobotServer:
def __init__(self, ip="192.168.178.143", port=5005, buffer_size=1024):
print("Server ist starting...", end="")
self.__address = ip
self.__port = port
self.__buffer_size = buffer_size
... | true |
353809c604dedab284cb9682fdad4317cc582cb2 | Python | fgd-haha/cookbook | /src/1_数据结构和算法/1.3_deque双向链表.py | UTF-8 | 281 | 4.09375 | 4 | [] | no_license | from collections import deque
# 双向链表
# 不设maxlen则无限大
q = deque(maxlen=3)
q.append(1)
q.append(2)
q.append(3)
print(q) # deque([1, 2, 3], maxlen=3)
# 先进先出
q.append(4)
print(q) # deque([2, 3, 4], maxlen=3)
print(q.pop()) # 4
print(q.popleft()) # 2
| true |
0586d46e89b0e4d0500e6075b043d5fcb928b4ea | Python | hankerkuo/PythonPractice | /simple_CNN/test_folder/1202.py | UTF-8 | 360 | 2.703125 | 3 | [] | no_license | import numpy as np
w = np.array([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
])
a = np.ones((16, 5, 5))
b = np.arange(16 * 5 * 5)
b = np.reshape(b, (16, 5, 5))
c = a * b
g = [1,2,3]
d = [-1, -2, -3]
c = []
c.append(g)
c.append(d)
g = g * 2
# output_dim = 5
# w_flattern = np.repeat(w, output_dim, axis=0)
print(c... | true |
4846f18d54d910abece4d1a78163108e1322846a | Python | dasmith2/djaveAPI | /djaveAPI/response.py | UTF-8 | 796 | 2.515625 | 3 | [
"MIT"
] | permissive | from django.http import JsonResponse
from djaveAPI.problem import Problem
OK = {'OK': True}
OK_RESPONSE = JsonResponse(OK)
def problem_response(message_or_problem, status_code=None):
""" message_or_problem can be a string or a Problem. If you pass in a
Problem, you shouldn't also pass in a status_code because I... | true |
4ce849b4f87c8eca4e8c9320ee99342f86159643 | Python | tbrack/github-latest | /main.py | UTF-8 | 817 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Project Name: github-latest
File Name: main.py
Author: Travis Brackney
Class: Python 230 - Self paced online
Date Created 10/6/2019
Python Version: 3.7.2
"""
import sys
import json
import requests
# Use Like python githubber.py JASchilz
# (or another user name)
def get_event_time(userna... | true |
9a8fc36909a29a2de6caf039812b1f5aed55918f | Python | dushyantkhosla/viz4ds | /99-Miscel/AnatomyOfMatplotlib-master/exercises/4.2-spines_ticks_and_subplot_spacing.py | UTF-8 | 293 | 3.203125 | 3 | [
"MIT",
"CC-BY-3.0"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
# Try to reproduce the figure shown in images/exercise_4.2.png
# This one is a bit trickier!
# Here's the data...
data = [('dogs', 4, 4), ('frogs', -3, 1), ('cats', 1, 5), ('goldfish', -2, 2)]
animals, friendliness, popularity = zip(*data)
| true |
569f6c5bf56f606e3e94d7aaf45c7e6fa50b5e52 | Python | rutujashingare/Face-Mask-Recognition-using-Principal-Component-Analysis-- | /Face_Recognition.py | UTF-8 | 3,533 | 2.640625 | 3 | [] | no_license | import cv2
import time
import numpy as np
# importing algorithms
from PCA import pca_class
from TwoDPCA import two_d_pca_class
from TwoD_Square_PCA import two_d_square_pca_class
# importing feature extraction classes
from images_to_matrix import images_to_matrix_class
from images_matrix_for_2d_square_pca import imag... | true |
1d0650db73085f9497ec53a51eacc578ae50242b | Python | sryoya/python-block-chain-for-data-certification | /hash_generator.py | UTF-8 | 631 | 2.65625 | 3 | [] | no_license | import hashlib
hash = hashlib.sha256()
print(hash.block_size)
#with open('all.pdf', 'rb') as f:
# chunk = f.read()
# hash.update(chunk)
# while True:
#hash_value = hashlib.sha256(f.read()).hexdigest()
#hash.update(f.read())
#for chunk in iter(lambda: f.read(2048 * hash.b... | true |
be7f35f4965cd3444bb23533ab5e812ab1bee08e | Python | war16641/python | /lol/unitmodel.py | UTF-8 | 13,336 | 2.9375 | 3 | [] | no_license | from copy import deepcopy
from GoodToolPython.mybaseclasses.tools import is_sequence_with_specified_type
import numpy as np
from enum import unique,Enum
import itertools
from typing import TypeVar, Generic,List
from enum import Enum, unique
from functools import reduce
@unique
class DamageType(Enum):
"""伤害的类型"""
... | true |
276538f20a497dc58488f38bacd5958620e51912 | Python | ameera3/Binary_Search_Tree | /BSTIterator.py | UTF-8 | 901 | 3.75 | 4 | [] | no_license | from BSTNode import BSTNode
# Class name: BSTIterator
# Instance Variables: curr (the current node)
# Description: Implements a BST Iterator
# Methods: constructor, iter, next, getVal, equality
class BSTIterator:
# Constructor. Use the argument to initialize the current BSTNode
# in this BSTIterator.
d... | true |
8ba23a5dbc076d3f4cf0bc161d511fbf1fc57ed9 | Python | XiaoR128/MachineLearning | /多项式拟合/CG_regular.py | UTF-8 | 2,320 | 2.90625 | 3 | [] | no_license | #带正则项的共轭梯度法
import matplotlib.pyplot as pt
from numpy import *
from scipy.interpolate import spline
import numpy as np
import random
M=10 #多项式函数的阶数加1
k=160 #训练集点的个数
ln=-20
langmuda=e**ln
# 在0-2*pi的区间上生成k个点作为输入数据
X = np.linspace(0,1,k,endpoint=True)
Y = np.sin(2*np.pi*X)
test = np.sin(2*np.pi*X)
z = ones((k,M))
... | true |
3d907441bf582ce1ae35c4deda4bc4f206ece9db | Python | houruijie/Common_Service | /test.py | UTF-8 | 1,077 | 2.546875 | 3 | [] | no_license | # 测试程序的执行
from service import Service
from sanic.response import json
sv = Service("DNS","DNS_test")
def FBNQ(num):
if num ==1:
return 1
elif num==2:
return 1
else:
a=1
b=1
while num > 2:
c=a
a=b
b=c+b
num=num-1
... | true |
df557eb033896186acab384f7f142a68a7bd5afb | Python | xing3987/python | /python1/py1/代理池/proxypool03.py | UTF-8 | 2,197 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 19 23:11:25 2018
@author: Administrator
"""
from proxypool01 import RedisClient
from proxypool02 import Crawler
test_url='https://m.weibo.cn'
pool_upper=10000
class Getter():
def __init__(self):
self.redis=RedisClient()
self.crawler=Crawler()
... | true |
cc92486e73d335a9c0b6557fe02a7b364ef4976d | Python | gxyzwangyi/detect-malware | /demo.py | UTF-8 | 1,521 | 2.546875 | 3 | [] | no_license | #coding:utf-8
import requests
from bs4 import BeautifulSoup
#ISO-8859-1
url="http://shouji.baidu.com/software/95000.html"
class demo:
def __int__(self):
pass
def d(self):
r=requests.get(url,allow_redirects=False)
#print(r.content)
soup = BeautifulSoup(r.content,"html.parser",... | true |
a1236c77db282a62b319d66e5738e00ba5486c66 | Python | noath/toloka-kit | /src/client/assignment.py | UTF-8 | 6,642 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | __all__ = [
'Assignment',
'AssignmentPatch',
'GetAssignmentsTsvParameters'
]
from attr.validators import optional, instance_of
import datetime
from decimal import Decimal
from enum import Enum, unique
from typing import List, Optional
from .primitives.base import attribute, BaseTolokaObject
from .primitive... | true |
b10594cbe132f45e5ca9edf36b9c4dde87a15119 | Python | shg9411/algo | /algo_py/boj/bj2441.py | UTF-8 | 71 | 3.484375 | 3 | [] | no_license | n = int(input())
for i in range(n):
print(str('*'*(n-i)).rjust(n))
| true |
bfc258b7a1225c29f073af2896ad4d2030ebc724 | Python | bonita-sy/portfolio | /algorithm/boj/2753.py | UTF-8 | 109 | 3.171875 | 3 | [] | no_license | year = input()
if (year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0)):
print "1"
else:
print "0"
| true |
5286167bc20b790d56b859d0d8987ab8d2894125 | Python | dalong0514/script | /test_epub2pdf.py | UTF-8 | 1,017 | 3.015625 | 3 | [] | no_license | import glob, os, time
from pathlib import Path
import ebooklib
from ebooklib import epub
from weasyprint import HTML
def makepdf(html):
"""Generate a PDF file from a string of HTML."""
htmldoc = HTML(string=html, base_url="")
return htmldoc.write_pdf()
def epub2html(epub_path):
book = epub.read_epub(e... | true |
22e865d7146056cf389e5029529d67cb49288400 | Python | ankitsingh03/dataproject-sqlalchemy | /main.py | UTF-8 | 8,391 | 2.75 | 3 | [] | no_license | from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Date, func
from sqlalchemy.orm import sessionmaker
from collections import defaultdict
import csv
import json
engine = create_engine('postgresql://ankit:ankit@localhost:5432/ank... | true |
3c7b174c8983484145ef7dbe6cca958b62d1ed7c | Python | moonlight035/algorithm | /iamsochun/Leetcode98.py | UTF-8 | 1,284 | 2.96875 | 3 | [] | no_license | import sys
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def isValidBST(self, root: TreeNode) -> bool:
def done(node: TreeNode):
if not node:
return [sys.maxsize, -sys.maxsize, True]
... | true |
8917425022166c6e0abb2daf46b1635628b1a7ab | Python | notmycall/codeforces-solutions | /A Set/344A.py | UTF-8 | 196 | 3 | 3 | [] | no_license | n = int(input())
m = []
c = 1
for i in range(n):
m.append(input())
for x in range(n-1):
if m[x][1] == m[x+1][0]:
c += 1
print(c)
# https://codeforces.com/problemset/problem/344/A
| true |
70dd59afe4d2e115c777484f0eb0010275c6b084 | Python | hackaholic/robotics | /raspberry/ultrasonic/distance.py | UTF-8 | 945 | 3.078125 | 3 | [] | no_license | import RPi.GPIO as gpio
import time
#disabling warning
gpio.setwarnings(False)
#selecting board
gpio.setmode(gpio.BOARD)
trig = 37 # pin to trigger ultrasonic wave
echo = 38 # pin to recive echo
def distance():
# setting pin 7 for output
gpio.setup(trig,gpio.OUT)
gpio.output(trig,0)
#setting pin 8... | true |
b48e6c61f148bcfbcbb68d26df98f369b016e853 | Python | mohammedthasincmru/royalmech102018 | /odd.py | UTF-8 | 311 | 4.125 | 4 | [] | no_license | '''a=int(input("enter the value of a:"))
b=int(input("enter the value of b:"))
c=a/b
print(c)'''
'''a=int(input("enter the value of a:"))
b=int(input("enter the value of b:"))
c=a**b
print(c)'''
a=int(input("please enter a number:"));
if(a%2==0):
print("this number is even")
else:
print("the number is odd")
| true |
e7f3ba0dbd84471e985ab6f0ee93f94d5ac7a618 | Python | Aasthaengg/IBMdataset | /Python_codes/p02846/s561540105.py | UTF-8 | 474 | 2.9375 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
t, tt = map(int, input().split())
a, aa = map(int, input().split())
b, bb = map(int, input().split())
if a*t+aa*tt == b*t+bb*tt or a*t == b*t:
print('infinity')
exit()
diff1 = a*t-b*t
diff12 = a*t+aa*tt - (b*t+bb*tt)
if diff1*diff12>0:
... | true |
b36d84d23220df7ee7c5972f2c9846f304f47589 | Python | ChloeChepigin/HPM573S18_CHEPIGIN_HW11 | /InputData.py | UTF-8 | 1,041 | 2.5625 | 3 | [] | no_license |
POP_SIZE = 2000 # cohort population size
SIM_LENGTH = 15 # length of simulation (years)
ALPHA = 0.05 # significance level for calculating confidence intervals
DELTA_T = 1/52 # years (length of time step, how frequently you look at the patient)
DISCOUNT = 0.03
TRANSITION_MATRIX_NODRUG = [
[0, ... | true |
2b35b6ca53e91aca07acb49026a91f963435af19 | Python | synthetic-corpus/python-movies | /entertainment_center.py | UTF-8 | 6,223 | 3.09375 | 3 | [] | no_license | #Joel Gonzaga submission
#This page is all original Code
# Purpose of this document is to auto-create a website with input from both 'media.py' and 'fresh_tomatoes.py'
import media
import fresh_tomatoes
import random
#Below are 9 total movie objects. Input is Title, film duration, year, logline, poster URL, youtube li... | true |
18f8da1256120665e7e3ff56f00f50ee0c9a2f66 | Python | Sachinx0e/pytorch_cluster | /src/exploratory/generate_graph.py | UTF-8 | 2,278 | 2.578125 | 3 | [
"MIT"
] | permissive | from data import data_utils
import networkx as nx
from loguru import logger
import obonet
from tqdm import tqdm
import pandas as pd
def generate_iptmnet_gml():
# read the data
_iptmnet_df, graph, _proteins = data_utils.read_data()
# save the graph to gml
out_file = "data/input/iptmnet_graph_cleaned_di... | true |
ef41d773641394776697393573aa34cd2191c708 | Python | ninjaxtv/Python | /quiz.py | UTF-8 | 400 | 3.40625 | 3 | [] | no_license | user_input = input(">>> ")
if user_input.lower() == "hello":
print("hello, how are you!")
elif user_input.lower() == "what is your age":
print("I am 11 years old")
elif user_input.lower() == "What is your favourite item to eat":
print("I love white sauce pasta")
elif user_input.lower() == "Wh... | true |
8835430b9a2adc37fc8bcd8697e00b892ed4b8a0 | Python | hamedhaghighi/Ambient-VAE | /commons/arch.py | UTF-8 | 8,112 | 2.9375 | 3 | [
"MIT"
] | permissive | """ Define architectures for generative models.
Generation modes: Unconditional, Conditional, Auxillary Conditional
Loss types: Vanilla, Wasserstein
Loss addons: Gradient Penalty
"""
# pylint: disable = C0103, C0111, C0301, R0913, R0903, R0914
import tensorflow as tf
import utils
def loss_vanilla(d_logit, d_gen_l... | true |
34aa5fc9ce98b2a17ecd61e54759a5d1e85c5972 | Python | BorisKunda/PythonPlayground | /IndentationExercise.py | UTF-8 | 337 | 2.921875 | 3 | [] | no_license | def perform_a():
print("a")
def perform_b():
print("b")
def perform_c():
print("c")
def perform_d():
print("d")
def perform_e():
print("e")
def perform_f():
print("f")
def perform_g(a, b):
if a > b:
perform_a()
else:
perform_b()
perform_c()
# executi... | true |
446583a4b56eae4bb505cf86472e28dfc3d7ad93 | Python | lambda-my-aws/blog-app-01 | /app01/views.py | UTF-8 | 1,245 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | """ MAIN VIEWS FOR FLASK APP"""
import boto3
import json
from . import App
from flask import (
Flask,
jsonify,
request,
make_response,
render_template,
redirect,
flash,
)
def send_message(payload, queue_name, session=None, client=None):
"""
Function to send a message in SQS
:... | true |
1a10dcb2dda8d6e5a195f5f9ae5e2a953560410a | Python | kin7274/Dugeundugeun-Python | /4장/연습문제5.py | UTF-8 | 149 | 3.40625 | 3 | [] | no_license | giho=input("기호를 입력하시오 : ")
middle=input("중간에 삽입할 문자열을 입력하시오 : ")
print(giho[0:1] + middle + giho[-1:])
| true |
270dd4f617afba84a47bfa112816ea083853cd5f | Python | backman-git/leetcode | /sol386.py | UTF-8 | 1,325 | 3.546875 | 4 | [] | no_license |
class Solution(object):
# TLE
def lexicographicalOrder(self,a,b):
if a==b:
return 0
sA=str(a)
sB=str(b)
for idx,c in enumerate(sA):
if idx < len(sB) and sA[idx] != sB[idx]:
if str(sA) < str(sB):
return -1
else:
return 1
elif idx >=len(sB):
return 1
return -1
def... | true |
60c12e411594204fedea2b94590e2b93ec3eb4c5 | Python | PenguinRage/Playground | /python/peakhell.py | UTF-8 | 219 | 2.765625 | 3 | [] | no_license | import urllib, pickle
source = urllib.urlopen("http://www.pythonchallenge.com/pc/def/banner.p")
data = pickle.load(source)
source.close()
for elt in data:
print "".join([e[1] * e[0] for e in elt]) #list comprehension | true |
819372e3af5c124237c2968e41768ff8f48851a0 | Python | 8563a236e65cede7b14220e65c70ad5718144a3/docker-microservices-repo | /Python_Blueprints_Nameko/Chapter05/notes.py | UTF-8 | 2,262 | 3.453125 | 3 | [] | no_license | """
Building a Web Messenger with Microservices
Requirements
A user can go to a website and send messages
A user can see messages that others have sent
Messages automatically expire after a configurable amount of
time
What is Nameko
Nameko is an open-source framework us... | true |
421c27fdd02e7f92faf4e48be635304ed9575438 | Python | avilla2/cis422-project1 | /visualization.py | UTF-8 | 2,355 | 3.46875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
def plot(ts):
"""
:param ts: Time series data
:return: No return - plots graph
Displays data according to their time indices
"""
if type(ts) == list:
ax = None
for t in ts:
new_df1 = t.set_in... | true |
cd5b0dca64b0090eb68854a58bc06d0087331417 | Python | aleksandr1101/TowerDefenceFGame | /game.py | UTF-8 | 2,254 | 2.765625 | 3 | [] | no_license | import pygame
import pygame.freetype
import utils
import unit
import tower
from os import path
from board import Board
import commands
# initializing game
pygame.init()
# ticks per second
tps = 60
clock = pygame.time.Clock()
# create the screen
screenX = 900
screenY = 580
screen = pygame.display.set_mode((screenX, ... | true |
6b7f5e75dd04e8a48a6e7a3f262149da8720f334 | Python | wangtaocarl10/Financial-Data-Analysis | /new.py | UTF-8 | 25,882 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import xlwt
import openpyxl
from openpyxl.styles import Color, PatternFill, Font, Border
from openpyxl.styles.differential import DifferentialStyle
from openpyxl.styles import colors
from openpyxl.formatting.rule import Color... | true |
da791c32de733ba1372844efba26bc86e17e08f5 | Python | ECCO-GROUP/ECCOv4-py | /ecco_v4_py/test/test_tile_plot.py | UTF-8 | 2,550 | 2.53125 | 3 | [
"MIT"
] | permissive | """
Test routines for the tile plotting
"""
from __future__ import division, print_function
import warnings
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
import pytest
import ecco_v4_py as ecco
from .test_common import llc_mds_datadirs,get_test_array_2d
@pytest.mark.parametrize("vdict",[... | true |
fc0706285bb8913711a6ea00b7bb06795cf485bc | Python | SwagLag/Perceptrons | /tests/PerceptronNetworkTest/test_XOR.py | UTF-8 | 1,304 | 3.09375 | 3 | [] | no_license | import unittest
from classes.Activation import Step
from classes.Perceptron import Perceptron
from classes.PerceptronLayer import PerceptronLayer
from classes.PerceptronNetwork import PerceptronNetwork
class PerceptronNetwork_XOR(unittest.TestCase):
"""Builds and tests a perceptron network based on the XOR logic... | true |
c3a412d737ab66a92d00aee3b3ae73c891b6b659 | Python | HuNorman/Python-Web-crawler-Job-Hunting | /Douban/douban/pipelines.py | UTF-8 | 714 | 2.546875 | 3 | [] | no_license | from scrapy.conf import settings
import pymongo
class DoubanPipeline(object):
def __init__(self):
# 获取setting主机名、端口号和数据库名称
host = settings['MONGODB_HOST']
port = settings['MONGODB_PORT']
dbname = settings['MONGODB_DBNAME']
# 创建数据库连接
client = pymongo.MongoClient(hos... | true |
935a6b7c5e72356bb7d685e3fc8cc07eebb12d59 | Python | kevinjdonohue/PythonCodingForBeginners | /Student_Files/Python/Examples/M01DataTypes.py | UTF-8 | 793 | 3.671875 | 4 | [] | no_license | def foo():
None;
class MyClass:
None;
v0 = None; # NoneType
v1 = 25; # int
v2 = 2.6; # float
v3 = True; # bool
v4 = "hello"; # str
v5 = []; # list
v6 = (); # tuple
v7 = {1}; # set
v8 = {}; # dict
v9 = range(10);... | true |
2d43ad6a6f53d1a2bd4047167c84b27f9ad4752b | Python | netromdk/alfred-band | /band.py | UTF-8 | 5,843 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# encoding: utf-8
from __future__ import unicode_literals
import os
import sys
from multiprocessing import Process, Queue
from HTMLParser import HTMLParser
from workflow import Workflow3, web, ICON_INFO, ICON_WEB, ICON_NOTE, ICON_SYNC
from workflow.notify import notify
class Result:
def __init__... | true |
8e117af9da9b185cdaea46b7473a5bb7b379672f | Python | caseydv/boolean-solver | /boolean_solver/quine_mccluskey/logic.py | UTF-8 | 2,587 | 2.765625 | 3 | [] | no_license | import sys
def getSetBits(x):
bits = 0
while x:
bits += x & 1
x >>= 1
return bits
def regroup(groups, size):
delList = []
groupSize = len(groups)
regroups = [[] for i in range(groupSize-1)]
#all groups
for i in range(groupSize - 1):
#all strings... | true |
833a4805ce7fa72d08b7390954a469573b6e9e2c | Python | Rodolfo-SFA/FirstCodes | /ex032.py | UTF-8 | 174 | 3.6875 | 4 | [
"MIT"
] | permissive | ano = int(input('Escreva o ano: '))
bis = ano % 4
if bis == 0:
print('O ano de {} é bissexto.'.format(ano))
else:
print('O ano de {} não é bissexto.'.format(ano))
| true |