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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6a73b94fb08993358186ac27122e2699be3a9cee | Python | gurb/melden | /Mesh.py | UTF-8 | 2,117 | 2.765625 | 3 | [] | no_license | import pygame
from OpenGL.GL import *
import numpy
from ctypes import sizeof, c_void_p
class Mesh:
def __init__(self, position, size, texture=None):
self.textureID = self.load_texture(texture)
self.vertices = (
-0.5, -0.5, 0.0, 1.0, 0.0, 0.0, 0.25, 0.75,
0.5, -0.5... | true |
407d98161603d214426eb72758bb77a3c7b04389 | Python | shalinkpatel/Deep-Forest | /code/deep_tree.py | UTF-8 | 9,457 | 3.109375 | 3 | [
"MIT"
] | permissive | import torch as th
from torch import nn as nn
import matplotlib.pyplot as plt
from math import pi
import shap
from collections import defaultdict
import numpy as np
class Leaf(nn.Module):
"""
Main leaf node class. This is the leaf of a decision tree
"""
def __init__(self):
"""
Init fun... | true |
b0ceadb91eb4a95ef4a0cd93ca22d7ac79c3106d | Python | dtashima/butter-bowl-o-matic-5000 | /test/team.py | UTF-8 | 3,611 | 2.859375 | 3 | [] | no_license | from decimal import Decimal
import unittest
from buttercup.team import Team, Record, League, handleWinLose, topTeams
class Test(unittest.TestCase):
def testRecord(self):
rec1 = Record(5,2,1)
rec2 = Record(6,2,1)
self.assertTrue(rec1 < rec2)
rec1 = Record(5,2,1)
rec2 = Reco... | true |
ab74d3c9c25dbaf93b9126fa4197e68be13ecfb3 | Python | wenwei-dev/motor-calibration | /MapperFactory.py | UTF-8 | 8,676 | 3.140625 | 3 | [] | no_license | #
# Robot PAU to motor mapping
# Copyright (C) 2014, 2015 Hanson Robotics
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any la... | true |
a7152f0d2c264ba66c50914c96214250d9e53257 | Python | GeorgiosGoniotakis/lyrics-genre-classification | /lib/exceptions/GenreFileExceptions.py | UTF-8 | 164 | 3.03125 | 3 | [
"MIT"
] | permissive | class GenreFileNotExists(Exception):
def __init__(self, filepath):
super(str, "File containing the genres does not exist on path: {}".format(filepath))
| true |
a9cd5a549dc3f6783646f671397528d14bb76728 | Python | MoeezArif/SoftwareTesting | /pytest/signupPage.py | UTF-8 | 1,474 | 2.65625 | 3 | [] | no_license |
import unittest
import time
import selenium.webdriver as webdriver
from selenium.webdriver.support.ui import Select
class SignupPage():
def __init__(self,driver):
self.driver=driver
self.type_fullname_id='fullname'
self.email_textbox_id='email'
self.textbox_password_... | true |
a9fd34971788aedc4ac21ac70f5ab7219516b25c | Python | florentinolim/pythonestudos | /pythonCursoEmVideo/TerceiroMundo/Listas/Exercicios/79 VariosValoresNumericosIneditos.py | UTF-8 | 697 | 4.46875 | 4 | [] | no_license | '''Crie um programa onde o usuário possa digitar varios valores numéricos e cadastre em uma lista.
Caso o numero já exista, ele não será adicionado.
No final, serão exibidos todos os valores únicos digitados
em ordem crescente.'''
valores = list()
while True:
num = (int(input('Digite um valor: ')))
if nu... | true |
36a073bd63a530469cbb4542ea70e999873d417d | Python | mbaeumer/fiftyseven | /part4/ex26/v1-simple-input/core.py | UTF-8 | 258 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
from math import log
from math import ceil
def calculateMonths(balance, apr, downpayment):
i = (apr/100)/365
result = -1/30 * log(1 + balance/downpayment*(1-(1+i)**30))/log(1+i)
result = ceil(result)
print(result)
return result
| true |
6cf64236e3078fc65acee85f48c610a38cbe88ed | Python | oristar1024/2DGP | /Drills/Drill 05/Drill 05.py | UTF-8 | 1,049 | 3.3125 | 3 | [] | no_license | from pico2d import *
open_canvas()
grass = load_image('grass.png')
character = load_image('animation_sheet.png')
points = [203, 535], [132, 243], [535, 470], [477, 203], [715, 136], [316, 225], [510, 92], [692, 518], [682, 336], [712, 349]
frame = 0
motion = 100 # 캐릭터의 이동방향을 표현하는 스프라이트 시트의 y값
x = 25
y = 50
def move... | true |
126761edb4f56f15f5287d57f2a9a93efc60b514 | Python | Sanjaynavgurukul/Python | /Conversion/Type conversion/type-conversion.py | UTF-8 | 181 | 3.6875 | 4 | [] | no_license | number_1 = raw_input('Please type first number:--')
number_2 = raw_input('Please type second number:--')
number_x = int(number_1)
number_y = int(number_2)
print number_x * number_y
| true |
0fe7db237998b59fd5243c00801fe7b36ee4515f | Python | niketanrane/CodingDecoding | /Codeforces/149A.py | UTF-8 | 389 | 2.984375 | 3 | [] | no_license | from math import ceil
def main():
k = int(input())
month = list(reversed(sorted(map(int, input().split()))))
#print(month)
h = 0
for i,m in enumerate(month):
if h >= k:
print(i)
break
h += m
else:
if h >=k:
print(len(mo... | true |
bbf3cd0f831b297e15ff99e65b959a1976bb685f | Python | kouma1990/AtCoder-code-collection | /contests/ABC1-100/ABC34/c.py | UTF-8 | 204 | 3.015625 | 3 | [] | no_license | import math
w,h = (int(i)-1 for i in input().split())
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
print(combinations_count(w+h,w)%(10**9+7)) | true |
7ad82a375bf0b7361e603c8dd1c8314fce262491 | Python | lin13k/practice | /algo_problems/extra/timeit_test.py | UTF-8 | 249 | 2.8125 | 3 | [] | no_license | import timeit
code = '''
import random
a = [(random.randint(1, 10000), random.randint(1, 10000), random.randint(1, 10000), random.randint(1, 10000)) for i in range(1000)]
sorted(a, key=lambda x: x[0])
'''
print(timeit.timeit(code, number=100))
| true |
86b05a5713a3a157981b2fe8822a37219bf831b7 | Python | RalphMao/D-PCA | /D-PCA/test.py | UTF-8 | 628 | 2.75 | 3 | [] | no_license | #! /usr/bin/python
import os
os.system("rm result")
times = 100
n = [25,100,800]
par = [0.025*i for i in range(41)]
res = [0 for i in range(41)]
for i in range(3):
for j in range(41):
for k in range(times):
os.system("echo "+str(n[i])+" "+str(par[j])+ " " + str(k)+"|./test >> result")
file... | true |
e2f1efd853999b21067146ffb63f9e182746da6c | Python | suqcnn/research-project | /src/Communication.py | UTF-8 | 2,564 | 3.15625 | 3 | [] | no_license | import socket
import threading
from abc import ABC, abstractmethod
EXIT = 'exit'
ENCODING = 'utf-8'
BUFFER_SIZE = 16
class Communicator(threading.Thread, ABC):
"""
Abstract class for bidirectional traffic handling
"""
def __init__(self, name, host, port, other_host, other_port):
"""
... | true |
d310a269a3614aae311a99be089ad2b52ce33e6d | Python | kxukai/lstm_segment | /lstm/lstm_net.py | UTF-8 | 8,272 | 2.6875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
"""
定义模型类
"""
import os
import numpy as np
import tensorflow as tf
from keras.utils import np_utils
from keras.models import Sequential, load_model
from keras.layers.core import Dense, Dropout
from keras.layers.embeddings import Embedding
from keras.layers.recurrent import LSTM
from keras.callbac... | true |
a9bf9c555df1c8de4bb79415b8be9fe34a9bfed9 | Python | kourgeorge/project-origin | /utils.py | UTF-8 | 2,388 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | __author__ = 'gkour'
import numpy as np
from scipy.signal import lfilter
def discount_rewards(r, gamma):
discounted_r = np.zeros_like(r).astype(float)
running_add = 0
for t in reversed(range(0, len(r))):
running_add = running_add * gamma + r[t]
discounted_r[t] = running_add
... | true |
87fd5b5e89cff4a1a43eb5c5a0a42feacef8113c | Python | xiaoyaoxiaoxian/Gammatone-filters | /GTF/GTF.py | UTF-8 | 17,922 | 2.53125 | 3 | [] | no_license | import ctypes
import os
import numpy as np
import matplotlib.pyplot as plt
# from numpy.ctypeslib import ndpointer
class CParamsType:
"""Data type convertor for c function arguments"""
def from_param(self, param): # called by ctypes
typename = type(param).__name__
if hasattr(self, 'from_'+typ... | true |
538c4373cf917c59101922f77c912c87c41afb9d | Python | vaibhavkrishna-bhosle/DataCamp-Data_Scientist_with_python | /24-Working with Dates and Times in Python/Dates and Calendars/Which day of the week?.py | UTF-8 | 406 | 3.609375 | 4 | [] | no_license | '''Hurricane Andrew, which hit Florida on August 24, 1992, was one of the
costliest and deadliest hurricanes in US history. Which day of the week did it make landfall?
Let's walk through all of the steps to figure this out.'''
# Import date from datetime
from datetime import date
# Create a date object
hurricane_an... | true |
c87fd651b97f48acceb4ffa0751f8229e2b01cbe | Python | johncornflake/dailyinterview | /imported-from-gmail/2020-05-28-flatten-dictionary.py | UTF-8 | 810 | 3.875 | 4 | [] | no_license | Hi, here's your problem today. (You've reached the end of the problems for now - in the meanwhile, here is a random question. And visit
CoderPro
for more practice!) This problem was recently asked by Google:
Given a nested dictionary, flatten the dictionary, where nested dictionary keys can be represented through... | true |
f8da4a15f31b03f49fa544305c4e688f6f333bb4 | Python | gab50000/TensorflowTests | /main.py | UTF-8 | 1,047 | 2.703125 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
def neuro():
n_in = 4
n_hidden = 3
n_out = 2
initializer = tf.contrib.layers.variance_scaling_initializer()
input_ = tf.placeholder(dtype=tf.float32, shape=[None, n_in])
hidden = tf.layers.dense(input_, n_hidden, activation=tf.nn.sigmoid)
output =... | true |
0eac862d62ccfa7f3ea467558634496e42228e9a | Python | seanybaggins/MatrixAlgebra | /book/sources/0000--Python_Linear_Algebra_Packages_pre-class-assignment.py | UTF-8 | 8,082 | 3.796875 | 4 | [] | no_license | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.10.3
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
#
# # Supplemental Materials: Python Linear Algebra P... | true |
dcf2398e984a66bb3628b6e2680e46a4a99538a4 | Python | tsimkins/svn-import-agSciencesCollege | /agSciencesCollege/ploneimport/form.py | UTF-8 | 2,572 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
from ploneimport import ploneify, commit
# File Format (Tab Separated)
# id, fieldset, type, title, description
# Node that there can be only one FormFolder. Like the Highlander.
# The FormFolder should be the first line.
formFolderId = None
def fromFile(fileName, doCommit=True):
createA... | true |
a7afd98a0bcde9e9cf5ddb2f86a40eb56c4ddaa7 | Python | ZHZ01/PaddleSleeve | /PrivBox/inference/membership_inference/rule_based_mem_inf.py | UTF-8 | 1,357 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES... | true |
0e8cba401d6dc9e88f1b0b94a10f2861c896a986 | Python | Ariangelo/Sistemas-Embarcados | /ESP8266/Arduino IDE/andarilho/andarilho/python/andarilho/lib/tts_manager.py | UTF-8 | 1,241 | 2.640625 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: tts_manager
# Purpose:
#
# Author: ari
#
# Created: 02/09/2022
# Copyright: (c) ari 2022
# Licence: <your licence>
#-------------------------------------------------------------------------------
import pyttsx... | true |
5a71aad09b865045b9d1d72cb0e4e3906fd90074 | Python | lusineduryan/ACA_Python | /Basics/Homeworks/Homework_6/Exercise_2_fast determinant.py | UTF-8 | 615 | 3.546875 | 4 | [] | no_license | # https://www.khanacademy.org/math/algebra-home/alg-matrices/alg-determinants-and-inverses-of-large-matrices/v/finding-the-determinant-of-a-3x3-matrix-method-1
def fast_deter(arg):
res = 0
N1 = arg
for i in range(len(arg)):
if i > 0:
N1 = N1[1:]
N1.append(arg[i-1])
N... | true |
fe25649368ff5a1eca15a5f9b7111800dcae635d | Python | Sakibapon/BRAC | /CSE/CSE 422/CSE422 AI LAB/Lab01/lab01task04.py | UTF-8 | 272 | 3.625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun May 26 22:10:43 2019
@author: Musavvir
"""
num = int( input ( "Please enter the number of copies to be printed: "))
if num > 100:
print ("\n Total cost: ", 5000 + (num-100)*30)
else:
print ("\n Total cost: ", num * 50) | true |
4068c1eb4543d850d3cdc4056509cce999237c92 | Python | Yifei-Liu/knee | /test/test_evaluation.py | UTF-8 | 2,852 | 2.578125 | 3 | [
"MIT"
] | permissive | import math
import unittest
import numpy as np
import knee.evaluation as evaluation
class TestEvaluation(unittest.TestCase):
def test_mae_0(self):
points = np.array([[0,0], [1,1], [2,2]])
knees = np.array([0,1,2])
expected = np.array([[0,0], [1,1], [2,2]])
result = evaluation.mae(p... | true |
51ec8a05fe535559a3ae78d3d772f7583dc7037c | Python | Deetanshu/Recurrent-Neural-Networks | /RNN_Keras_HP.py | UTF-8 | 1,438 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 23 12:10:09 2018
@author: deept
"""
#Imports
import numpy as np
from numpy import array
from pickle import dump
from keras.preprocessing.text import Tokenizer
from keras.utils import to_categorical
from keras.models import Sequential
from keras.layers import Dense, LSTM, ... | true |
008f40410765cbdea195397272e4afd670a3a434 | Python | chaitanyak52/fairing | /fairing/preprocessors/base.py | UTF-8 | 4,544 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive |
from fairing.constants import constants
from fairing import utils
import os
import fairing
import tarfile
import glob
import logging
import posixpath
import tempfile
class BasePreProcessor(object):
"""
Prepares a context that gets sent to the builder for the docker build and sets the entrypoint
input_fi... | true |
8bba5e37fb32b52fc55ad3fa22eefa2a8c4886cc | Python | LucasBalbinoSS/Mini-jogos-Python | /joguinhos/jogo_adivinhação.py | UTF-8 | 519 | 3.859375 | 4 | [
"MIT"
] | permissive | print('\033[1;35m-\033[m' * 20)
print('\033[1;34mJOGO DA ADIVINHAÇÃO')
print('\033[1;35m-\033[m' * 20)
from random import randint
na = randint(0, 5)
n = int(input('Tente adivinhar o número que o computador está pensando: '))
print()
c = 0
while n != na:
n = int(input('Errou! o número não é %i\nTente acertar nova... | true |
3b287ae224362122f5f12c04c31e4462c9baa8e0 | Python | Tyler-Pearson/OpenAI | /first_ai/tf_nn.py | UTF-8 | 4,217 | 2.921875 | 3 | [] | no_license | import gym
import random
import numpy as np
import tflearn
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.estimator import regression
from statistics import mean, median
from collections import Counter
print "hello"
LR = 1e-3
env = gym.make('CartPole-v0')
env._max_episode_ste... | true |
4b0613ade60bfcc00b4a9cf043953e71212fbe1e | Python | DannyRH27/RektCode | /Python/Easy/maxConsecutiveOnesII.py | UTF-8 | 518 | 3.234375 | 3 | [] | no_license | def findMaxConsecutiveOnes(nums):
max = 0
temp = 0
zero_count = 0
zero_idx = 0
i = 0
while i < len(nums):
if nums[i] != 0:
temp += 1
i+=1
if temp > max:
max = temp
if nums[i] == 0 and zero_count == 0:
temp +=1
zero_count +=1
i+=1
zero_idx = i
... | true |
ad451b4e0860146b95f224f5c93615bbdfb92dec | Python | Ayu-99/python2 | /session26.py | UTF-8 | 1,299 | 4.0625 | 4 | [] | no_license | # In classification we need to predict about it belongs to which group
# we need more than one classes
# regression is predicting continuous data
# classification is prediction of class labels or what is the category
# Decision Trees
from sklearn.datasets import load_iris
# load iris is a dataset in scikit
from sklear... | true |
1e1220d60b98207b305c82abde11f2cd29f4305e | Python | sgbm0592/test_automation | /factory_driver/factory_driver.py | UTF-8 | 1,140 | 2.671875 | 3 | [
"MIT"
] | permissive | from selenium.common.exceptions import TimeoutException
from selenium.webdriver.firefox.webdriver import WebDriver
import utils_selenium.config_helper as config
import factory_driver.chrome_driver as chrome_driver
import factory_driver.firefox_driver as firefox_driver
def get_driver() -> WebDriver :
config.load_co... | true |
7b691224a308cf72042eae043dfb5e47a2135ad5 | Python | kikei/jalWatcher | /src/start.py | UTF-8 | 5,559 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | import os
import time
from selenium import webdriver
from logger import getLogger
def getBrowser(logdir='geckodriver.log', headless=True):
options = webdriver.FirefoxOptions()
if headless:
options.add_argument('-headless')
browser = webdriver.Firefox(options=options, log_path=logdir)
return browser
class ... | true |
1c752c8e3037a0048614672c11d672c7d4aea07a | Python | harsh-vishnoi/RATION-DISTRIBUTION-ANALYSIS-AND-PREDICTION-SYSTEM | /Machine Learning in Python/REGRESSION MAIN/polynomial_regression.py | UTF-8 | 1,662 | 3.375 | 3 | [
"MIT"
] | permissive | #Polynomial Regression
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#Importing the Dataset
dataset = pd.read_csv('Final_file_of_family_data.csv')
X = dataset.iloc[:,[4,9,12,13]].values
y = dataset.iloc[:,8:9].values
#Splittung the data into training and test set
from sklearn.cross_validat... | true |
281d0ad046ac02e49a34ddc4aa285fa481670dbc | Python | agyenes/greenfox-exercises | /13 python_exam/22.py | UTF-8 | 566 | 4 | 4 | [] | no_license | # Create a function that takes a filename as parameter,
# it should count the words in the file and is should return it as a number
# if the file not exists or any other error occures return 0
def count_words_in_file_content(filename):
try:
content = get_content_from_file(filename)
except:
return 0
count... | true |
ece54649544dd86f9987c31f1ee4bb71f2b78d7b | Python | Dawad81/IS211_Assignment14 | /recursion.py | UTF-8 | 999 | 3.734375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module creates recursive functions."""
def fibonacci(n):
if n<0:
print("Input must be a positive number!")
elif n == 1:
return 0
elif n == 2:
return 1
else:
return fibonacci(n-1) + fibonacci(n-2)
def gcd(a, b):
... | true |
3c80d59f44a985d3d101127b4718b95156edb427 | Python | robertdavidwest/easternBody_westernMind | /app/models.py | UTF-8 | 799 | 2.609375 | 3 | [] | no_license | # models.py
from views import db
class ChakraAttribute(db.Model):
__tablename__ = 'chakra_attributes'
primary_key = db.Column(db.Integer, primary_key=True)
chakra_number = db.Column(db.String, nullable=False)
attribute_type = db.Column(db.String, nullable=False)
attribute_description = db.Column(d... | true |
552111459fa8b10ca4c33433fe537cb4178f4a77 | Python | BertJorissen/pybinding | /pybinding/repository/graphene/utils.py | UTF-8 | 273 | 2.921875 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | permissive | from math import sqrt
from .constants import hbar, vf
def landau_level(magnetic_field: float, n: int):
""" Calculate the energy of Landau level n in the given magnetic field. """
lb = sqrt(hbar / magnetic_field)
return hbar * (vf * 10**-9) / lb * sqrt(2 * n)
| true |
d5a633d8919b692aa1ddea221d304570e052eba9 | Python | ricardovergarat/1-programacion | /Git/Registro-de-gastos-GUI/Registro de gastos.py | UTF-8 | 2,526 | 3.046875 | 3 | [] | no_license | from tkinter import *
import datetime
from screeninfo import get_monitors
import time
def medidor_de_pixeles(ventana):
horizontal1 = Frame(ventana,bg="red",width=700,height=1).place(x=0,y=350)
horizontal2 = Frame(ventana,bg="red",width=700,height=1).place(x=0,y=380)
vertical1 = Frame(ventana,bg="red",width=1,heig... | true |
f87fe4a97b37ccb834ade621d31d89c72c4d33c4 | Python | spin13/weather_api | /owm.py | UTF-8 | 3,324 | 2.796875 | 3 | [
"MIT"
] | permissive | # -*- encoding: utf-8 -*-
import env
import requests
import json
import datetime
import slack
from pytz import timezone
from dateutil import parser
OWM_API_KEY = env.OWM_API_KEY
def get_forecast(lat='35.681298', lon='139.766247', cnt=3):
ENDPOINT = 'http://api.openweathermap.org/data/2.5/forecast'
params = {
... | true |
a4708a754adcd537139fcaea1d87e55555af04bd | Python | sxmeng2017/nlp- | /flask源码学习/python自带方法/装饰器.py | UTF-8 | 776 | 3.375 | 3 | [] | no_license | """
看着装饰器很有趣,但一直没写过多写几个放这
"""
import time
def implement_of_time_cost(f):
def decorator(*args, **kwargs):
start = time.time()
f(*args, **kwargs)
end = time.time()
print(end - start)
return decorator
def implement_of_name(f):
def decorator(*args, **kwargs):
print('it ... | true |
4ce6a5acca5d25103a375ce414cc213fa3c545f2 | Python | chris414862/LiSSA | /SSModel/VectroizerInterface.py | UTF-8 | 1,154 | 3.015625 | 3 | [] | no_license | import pandas as pd
'''
This is an interface for classes that perform vectorization for a 'Model' class. Each 'Model' type will have
individual repuirements/expectations for the vectors representing a method. This interface allows for flexibility
in the implementation to meet these requirements. This class conta... | true |
a46f5bc1adc7eca6f38113bd1b810c2e6a5fe9b3 | Python | huxuan/fangmi-api | /app/message/__init__.py | UTF-8 | 7,330 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: __init__.py
Author: huxuan
Email: i(at)huxuan.org
Description: Message related API.
"""
from datetime import date
from flask import Blueprint
from flask import request
from flask.ext.restful import Api
from flask.ext.restful import Resource
from flask.ext.restful... | true |
a6a3e599840dd828d21f4b7ecd9fca5953adc83c | Python | victormelo/DSB2017-1 | /sje_scripts/lung_segmentation.py | UTF-8 | 4,356 | 2.796875 | 3 | [] | no_license | import numpy as np
import dicom
from glob import glob
from skimage.transform import resize
from skimage import morphology, measure
from sklearn.cluster import KMeans
def lung_segmentation(patient_dir):
"""
Load the dicom files of a patient, build a 3D image of the scan, normalize it to (1mm x 1mm x 1mm) and ... | true |
ab6436bdf7025a59d4ce481107f4802d78988da8 | Python | farazahmadkhan15/cicflowmeter-NIDS | /src/cicflowmeter/utils.py | UTF-8 | 894 | 3.296875 | 3 | [
"MIT"
] | permissive | import uuid
from itertools import islice, zip_longest
import numpy
def grouper(iterable, n, max_groups=0, fillvalue=None):
"""Collect data into fixed-length chunks or blocks"""
if max_groups > 0:
iterable = islice(iterable, max_groups * n)
args = [iter(iterable)] * n
return zip_longest(*arg... | true |
ff2edf85de4f3d974fdf42c06e6e81b8b13a5db9 | Python | chrysrod/Emporio-Serrana-API | /application/controllers/notifications.py | UTF-8 | 1,265 | 2.65625 | 3 | [] | no_license | from datetime import datetime, timedelta
from application.controllers.products import Products
class Notifications:
def __init__(self):
self.products = Products()
def get_products_close_to_expiration_date(self):
time_till = datetime.now() + timedelta(days=30)
time_till_timestamp = d... | true |
106d13335dd08b8b49d2287d1a11ddaad24736e6 | Python | oceanbei333/leetcode | /1232.缀点成线.py | UTF-8 | 1,267 | 3.046875 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=1232 lang=python3
#
# [1232] 缀点成线
#
# @lc code=start
from typing import Coroutine
class Solution:
def checkStraightLine(self, coordinates: List[List[int]]) -> bool:
if coordinates[0][0] == coordinates[1][0]:
for port in coordinates[2:]:
if port[0] !=... | true |
050e7c68c0049ef387ee2b8d4bed9ccb6bcbcc05 | Python | alapsraval/python-data-analysis | /PyPoll/main.py | UTF-8 | 2,669 | 3.859375 | 4 | [] | no_license |
# In this challenge, you are tasked with helping a small, rural town modernize its vote-counting process.
#(Up until now, Uncle Cleetus had been trustfully tallying them one-by-one, but unfortunately, his concentration isn't what it used to be.)
# You will be give a set of poll data called [election_data.csv].
# Th... | true |
04a9a107af70c71c24e7513214a771fff702d364 | Python | atalebizadeh/DS-Career-Track | /Data Science is Software/Debugging/delta_debugging/run_ddebug.py | UTF-8 | 669 | 2.90625 | 3 | [
"CC-BY-4.0",
"CC-BY-3.0",
"MIT"
] | permissive |
from ddebug import delta_debug
from sudoku import draw_sudoku, solve_sudoku
def test_sudoku(constraints):
try:
status, solution = solve_sudoku(constraints)
return "PASS" if status == 'Optimal' else "FAIL"
except:
return "FAIL"
if __name__ == '__main__':
constraints = [(1,1,9), (... | true |
00baf3b04c277d68733a0fc7a944724c888f43c5 | Python | svilendobrev/svd_bin | /convert/xls2csv.py | UTF-8 | 7,046 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function #,unicode_literals
USE_XLRD=0
#this puts ints as floats :/ and formatting_info is not there yet
def letter2index0_openpyxl( a):
import xlrd.xlsx
r = xlrd.xlsx._UPPERCASE_1_REL_INDEX[a]
assert r>0
return r-1
#if 123 is... | true |
1d743940fa0d4007ee6ef4a8d63a299fd5ad9dbc | Python | alexlwn123/kattis | /Python/zoo.py | UTF-8 | 627 | 3.6875 | 4 | [] | no_license | from collections import OrderedDict
def main():
case = 0
n = int(input())
while n != 0:
animals = {}
case += 1
for _ in range(n):
line = input().split()
animal = line[-1].lower()
if animal in animals:
animals[animal] += 1
... | true |
a64b6cca22f061e4b0b6b5e125499ec50730ec68 | Python | new-cainiao/new_Fruit | /bullet.py | UTF-8 | 1,112 | 3.546875 | 4 | [] | no_license | import pygame
from pygame.sprite import Sprite
class Bullet(Sprite):
"""一个对飞船发射的子弹进行管理的类"""
def __init__ (self,ai_setting,screen,ship):
"""在子弹所处的位置创建一个子弹对象"""
super(Bullet,self).__init__()
self.screen=screen
#在(0,0)出创建一个表示子弹的矩形,在设置正确的位置
self.rect=pygame.Rect(... | true |
03289ac4e1d42a67f8581b10b3b2e596455dfc06 | Python | RohanPhadnis/SlitherAI | /neural_network.py | UTF-8 | 1,478 | 3.453125 | 3 | [] | no_license | import random
from abc import ABC, abstractmethod
class Neuron:
def __init__(self, num_inputs: int):
self.weights = [random.random() * random.choice([-5, 5]) for _ in range(num_inputs)]
self.bias = random.randint(-5, 5)
def output(self, inputs: list):
return sum([inputs[n] * self.wei... | true |
015897a86d3816aff3efa699b136ac943d5c9edd | Python | orhanelam/ElevateECE | /Navigation /H7Camera.py | UTF-8 | 3,399 | 2.796875 | 3 | [] | no_license | # This example shows how to use the USB VCP class to send an image to PC on demand.
# Host Code
#
#!/usr/bin/env python2.7
import sys, serial, struct
import time
class H7Camera():
def __init__(self, port_name="/dev/ttyACM0"):
#Exact port name may vary
self.port_name = port_name
se... | true |
e5a6bc4db501bb73b7515b042cd17fb79c0447f6 | Python | brochj/Image-Recognition-OpenCV | /LBPHFaceRecognizer/recognizer.py | UTF-8 | 2,633 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 2 12:06:21 2018
@author: broch
"""
import cv2
import numpy as np
recognizer = cv2.face.LBPHFaceRecognizer_create()
recognizer.read('trainer/trainer.yml') # arquivo que foi gerado pelo trainer.py baseado no dataset das pessoas que quero reconhecer
cascadePath = "haarca... | true |
631c8aa9db8efc4b141544b67e17773691f91f83 | Python | YutaUra/kome | /kome/insert.py | UTF-8 | 2,560 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | from typing import List, Optional, Union
from kome.expression import BasicExpression, P, Premitive, force_expression
from kome.field import Field
from kome.source import QueryObject
from kome.table import BasicTable
from kome.utils import format_quotes
InsertableValue = Union[Premitive, P]
# query
"""
INSERT INTO テーブ... | true |
58a6ba952501f6bf65b88fdc0197bcbf66725d24 | Python | eirikhoe/advent-of-code | /2015/23/sol.py | UTF-8 | 2,570 | 3.328125 | 3 | [] | no_license | from pathlib import Path
class Device:
"""A Class for the state of an IntCode program"""
def __init__(self, data):
data = data.split("\n")
reg_names = "ab"
self.reg = dict(zip(list(reg_names), [0] * len(reg_names)))
self.instr_ptr = 0
self.instrs = []
for line... | true |
5e65e9e0f19c829b36017e4954f1c7e09ff57c69 | Python | ssongkim2/algorithm | /gravity/sol2.py | UTF-8 | 593 | 2.703125 | 3 | [] | no_license | import sys
sys.stdin = open('input.txt')
T = int(input())
for tc in range(1, T+1):
F = int(input())
numbers = list(map(int, input().split()))
number = numbers[::]
for i in range(len(number)):
for j in range(len(number)-i-1):
if number[j] > number[j+1]:
number[j], num... | true |
6bb0d124c9281e1c9ba126dba3292c374ae3f65f | Python | JorgeOchoaTobar/Practica2s12017_201314795 | /EDD_Python/Cola.py | UTF-8 | 2,696 | 3.125 | 3 | [] | no_license | #JORGE BILLY OCHOA TOBAR
#201314795
import os
from graphviz import Digraph
import NodoCola
nodo = NodoCola
class Cola(object): #Clase Cola
def __init__(self): #constructor
self.__primero = None
self.__ultimo = None
self.__tam = 0
def ColaVacia(self): #Para sab... | true |
ad1d638cb8d8ba26da9412916bd3e27955f1c00f | Python | MajorV/TCRNet-2 | /center_crop_chip.py | UTF-8 | 1,368 | 3.203125 | 3 | [
"MIT"
] | permissive | """
Crops 40x80 chips to 20x40 chips to generate qcf filters.
"""
## Crop Images
import glob
from scipy.io import loadmat, savemat
def crop(input_img,d1,d2):
'''
This function returns a cropped image.
input_img = input image
d1 = rows of cropped image
d2 = column of cropped image
'''
m,n... | true |
a47da18de9d658c22295f3d01bd2f76939f024bf | Python | aashvi22/ReinforcementLearning | /test2.py | UTF-8 | 10,014 | 3.09375 | 3 | [] | no_license | import tensorflow as tf
import gym
import Box2D
import os
import numpy as np
import matplotlib.pyplot as plt
#%matplotlib inline
# WAYS TO MAKE A PROGRAM LEARN:
# # - CHANGE LEARNING RATE
# # - ADD LAYERS
# # - ADD NODES
# TODO: Load an environment
env = gym.make("LunarLander-v2")
# TODO: Print observation and ac... | true |
7386c856ead543cc38f8438b0275f9715a1dfb14 | Python | hareq/pythonTestTool | /InterfaceAutotest/common/trd/xmloperate.py | UTF-8 | 291 | 2.671875 | 3 | [] | no_license | #-*- coding:utf-8 -*-
import xml.dom.minidom
def getnodeValue(text,TagName,Attribute):
dom = xml.dom.minidom.parse(text)
root = dom.documentElement
itemlist = root.getElementsByTagName(TagName)
item = itemlist[0]
un = item.getAttribute(Attribute)
return un
| true |
38e211e7df0784ab668fab3050de35141b0210b8 | Python | Zengyingpi/Portfolio | /Robotics/System_Id_for_Stopping_Distance_of_a_Wheeled_Robot/simulation_dev/project_root/src/mybot_motion_plan/scripts/mock_mission.py | UTF-8 | 3,655 | 2.53125 | 3 | [] | no_license | #! /usr/bin/env python
# import ros stuff
import rospy
from std_msgs.msg import String
from sensor_msgs.msg import LaserScan
from geometry_msgs.msg import Twist, Point
from nav_msgs.msg import Odometry
from tf import transformations
import math
import random
# robot state variables
position_ = Point()
yaw_ = 0
# ma... | true |
fbdaa1a397eac150612215a3be4231961301f4a1 | Python | lilunjiaax/test | /shennumber.py | UTF-8 | 2,281 | 2.84375 | 3 | [] | no_license | import csv
import xlrd
import xlwt
class Copy():
'''
获取表格操作指针
'''
data0 = xlrd.open_workbook('shenfenseed.xlsx')
data1 = xlrd.open_workbook('outschool.xls')
data2 = xlrd.open_workbook('njupt.xls')
def __catch_seed(self):
infor_dict = {}
table = Copy.data0.shee... | true |
1337dd0ad7111a20f2126e764880422e10b96ea2 | Python | blak3irwin/F3 | /AO-Scraper.py | UTF-8 | 2,869 | 2.859375 | 3 | [] | no_license | from bs4 import BeautifulSoup
import urllib.request
import os
import re
import sys
import time
import csv
from collections import Counter
#define array for PAX
PAX=[]
#defines array for building list of urls
urls = []
#categories to find PAX
categories=['disney','purple-cobra','any-given-sunday', '... | true |
785011b9dad5ef5efd815e1a27e7a82fc442f56f | Python | XiaoMaGe-hero/object-detection-using-mobilenet_ssd | /xml_jpg_seg.py | UTF-8 | 977 | 2.59375 | 3 | [] | no_license | # 原始数据xml文件和jpg文件是交叉混合在一起的,我们先将他们从
# D:\iqiyi\short_expose\labeled_20_9_25\labeled_20_9_25
# 分开到 D:\iqiyi\short_expose\labeled_20_9_25\prepared_20_9_25\annotations
# 和 D:\iqiyi\short_expose\labeled_20_9_25\prepared_20_9_25\jpgs
import os
import shutil
source = r'D:\iqiyi\short_expose\labeled_20_9_25\labeled_20_... | true |
9c88aecc092299acf39dd8f71c61d1698271e5eb | Python | Randdyy/Myfirst-Codes | /math/陈天博_feibo.py | UTF-8 | 139 | 3.171875 | 3 | [] | no_license | import time
num = int(input())
l=[1,1]
for i in range(1, num-1):
x=l[-1]+l[-2]
l.append(x)
time.sleep(10)
print(l)
| true |
5f2caedd3f4f278c4edf9d882c24e4bcd8a5d04e | Python | Safa-98/nn-morpho-analogy | /store_cnn_embeddings.py | UTF-8 | 2,742 | 2.6875 | 3 | [] | no_license | from data import Task1Dataset
import torch, torch.nn as nn
from cnn_embeddings import CNNEmbedding
import torch.nn.functional as F
import numpy
from utils import pad
from sklearn.model_selection import train_test_split
from copy import copy
def encode_word(voc, word):
'''Encodes a word into a list of IDs thanks to... | true |
b58c10ad08ede3a355f120906c7ec4cea5b2c2f1 | Python | forgetbear/B_PYTHON_GIS | /PythonForArcGIS/SF_PFA2/ch15/script/boxes.py | UTF-8 | 1,587 | 2.6875 | 3 | [] | no_license | # boxes.py
# Usage: No arguments required
import arcpy, os
#############################
length = 3
width = 6
# Find the paremeter of a box
perimeter = 2*length + 2*width
# Check if the box is square
if length == width:
ans = True
else:
ans = False
print perimeter
print ans
#############################
# ... | true |
542ee1f93392e49f48947a104365a367942d29a5 | Python | IrvingArielEscamilla/PythonExercises | /Separador.py | UTF-8 | 212 | 3.359375 | 3 | [] | no_license | def separate(message):
n =8
subString= [message[i:i+n] for i in range(0,len(message),n)]
return subString
def run():
message = str(input('Dame el mensaje:'))
print(separate(message))
run() | true |
fdf3052d48797bf9b2cfe8138d8cd7055c83beeb | Python | webclinic017/investtrack | /analysis/v2/utils.py | UTF-8 | 1,898 | 2.578125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
import time
import math
import logging
from scipy import stats
from datetime import date, datetime, timedelta
def mark_mov_avg(ts_code, df, ma_freq):
'''
标记股票的ma
'''
print('mark mov avg' + ma_freq + ' started on code - ' + ts_code + ',' +
datetime.now()... | true |
03dba88a848614efee0955e73d71ae4eb5910d86 | Python | ammonb/chess-contest-server | /random_chess_client.py | UTF-8 | 4,547 | 3.125 | 3 | [] | no_license | import logging
import socket
import argparse
import random
import chess
logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d %I:%M:%S %p', level=logging.DEBUG)
def get_move(fen):
# parse fen into python-chess object
board = chess.Board(fen=fen)
# all legal moves
legal_moves = list(bo... | true |
542de4400988fe73b649c632d6903e7ae31a51a4 | Python | HsiangYangChu/LIBCDD | /libcdd/data_distribution_based/lsdd_cdt.py | UTF-8 | 7,204 | 2.5625 | 3 | [] | no_license | import numpy as np
import math
import time
from scipy.stats import norm
from .base_distribution_detector import BaseDistributionDetector
class LSDDCDT(BaseDistributionDetector):
def __init__(self, train_size=400, window_size=200, u_s=0.02, u_w=0.01, u_c=0.001, bootstrap_num=2000):
super().__init__()
... | true |
5068008333ea1bcd3056e060496d8d90da7cc024 | Python | geo-j/simulation_station | /main.py | UTF-8 | 3,136 | 2.5625 | 3 | [] | no_license | """
This is the main runnable file of the project
"""
import simulation
import actors
import constants as ct
import events as e
import strategies as s
import numpy as np
from itertools import count
unique = count()
sim = simulation.Simulation(s.PriceDrivenChargingStrategy())
def init(sim):
arrival_hours = []
... | true |
8aa8c1b788f1bbde3010c348c4d4b43acfa19f93 | Python | mackhack321/python | /fizzbuzz.py | UTF-8 | 220 | 3.359375 | 3 | [] | no_license | n = 1
while n <= 100:
if n % 3 == 0 and n % 5 == 0:
msg = 'fizzbuzz'
elif n % 3 == 0:
msg = 'fizz'
elif n % 5 == 0:
msg = 'buzz'
else:
msg = n
print(msg)
n = n + 1
| true |
e159ef1a01111b282be9772d3b3484ed585454ee | Python | lienordni/ProjectEuler | /80.py | UTF-8 | 2,366 | 3.0625 | 3 | [] | no_license | import math
def lien(x): # Needs nothing
li=list(str(x))
for i in range(0,len(li)):
li[i]=int(li[i])
return li
def continued_fraction(d): # Continued Fraction of sqrt(d) # Needs math
r=int(math.sqrt(d))
if r*r==d:
return [[r],[]]
a=r
p=0
q=1
f=[]
while True:
p=a*q-p
q=(d-p*p)//q
a=(r+p)//q
f.ap... | true |
73a723e18ceaa8444c2395c6879f32716491f6ae | Python | alexanderdg/thumper_robot | /motorcontroller.py | UTF-8 | 4,662 | 2.71875 | 3 | [] | no_license | import serial
import time
from threading import Thread
class Motorcontroller:
print ("Open serial communication")
print ("Succeeded to open serial communication")
def __init__(self, default=0):
self.ser=serial.Serial(port='/dev/motorcontroller',
baudrate=115200,
... | true |
c579988dc7f088c2183fb035de9356071bc83ea7 | Python | nicokuzak/leetcode | /easy/largest_common_prefix.py | UTF-8 | 835 | 3.796875 | 4 | [] | no_license | """Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
Example 1:
Input: strs = ["flower","flow","flight"]
Output: "fl"
Example 2:
Input: strs = ["dog","racecar","car"]
Output: ""
Explanation: There is no common prefix amo... | true |
dd759c55522bd3e1e84df8b83f98fa333f248004 | Python | mikitachab/mtswm2-breast-cancer | /py/utils.py | UTF-8 | 745 | 3.65625 | 4 | [] | no_license | import itertools
import functools
def map_key_to_every_value(key, values):
return [{key: value} for value in values]
def merge_dicts(dicts):
return functools.reduce(lambda a, b: {**a, **b}, dicts)
def product_from_dict(grid):
"""
return list of dict with combinations of items from dict iterators v... | true |
9cfb77164ec3f8e033529bf63aea3c9a3bf4526c | Python | spseol/PyQt4Doc | /Layouts/Grid.py | UTF-8 | 718 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 20 14:11:19 2014
@author: edith
"""
from PyQt4 import QtGui
import sys
class Ui(QtGui.QWidget):
def __init__(self):
super(Ui, self).__init__()
self.setup()
def setup(self):
grid = QtGui.QGridLayout()
j = 1
tlacitka = []
... | true |
795deeb24098501a4d4d02098e6b9cc9ffb5d2d8 | Python | Krewn/krewn.org | /Art/MkRef.py | UTF-8 | 533 | 2.671875 | 3 | [] | no_license | import sys
name = sys.argv[1]
link = sys.argv[2]
op=''
op+='<!DOCTYPE html>\n'
op+='<html>\n'
op+='<head>\n'
op+='<meta http-equiv="Refresh" content="3;'+link+'">\n'
op+='</head>\n'
op+='<body>\n'
op+='<p>'+name+' is an artist: <a href="'+link+'">'+link+'</a></p>\n'
op+='<p>You will be redirected to the address in th... | true |
025da55f1a0ca3cf32a900f9d4ca9567d9b1394c | Python | blendle/research-summarization | /rnn/textrank.py | UTF-8 | 2,475 | 2.90625 | 3 | [
"ISC"
] | permissive | import numpy as np
import networkx as nx
from sklearn.metrics import pairwise_distances
from sklearn.feature_extraction.text import TfidfVectorizer
def textrank_tagger(tokenized, w2v_model):
"""
TextRank based on cosine similarity between TF-IDF-reweighted w2v sentence sums.
"""
idf_weights = idf_weig... | true |
c900295a3acd974069c50214d0fda00a4d0bb8ea | Python | Siddhesh-Agarwal/sierra | /test/test-0.py | UTF-8 | 1,253 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | from sierra import *
title('The title goes here')
head('Sierra!', type='h2', color="#0388fc")
openBody()
with open_tag('newTag') as t: # Opening a tag 'newTag'
with div('someClass') as d: # Creating a div within 'newTag'
p('Some text') # Adding a paragraph
... | true |
f0cf7b0966871524aceab734c4c34f151359ef10 | Python | 2332256766/python_test | /m_exam/exam_1.py | UTF-8 | 1,436 | 2.828125 | 3 | [] | no_license | from sklearn.neural_network import MLPClassifier
import numpy as np
# np.set_printoptions(suppress=True,precision=-1)
'''加载数据'''
print('加载数据...')
data = np.loadtxt('imagesData.txt',delimiter=',')
data = np.mat(data)
print('行',data.shape[0],'type:',type(data))# 10000行 784列
'''划分集'''
m = data.shape[0]
train_set = data[... | true |
7c70af86ff4cfd5525f10337982128e567deb7e1 | Python | dibya-pati/BigData | /HW-2/a2_pati.py | UTF-8 | 25,129 | 2.796875 | 3 | [] | no_license |
# coding: utf-8
# # Assignment 2 #
# import findspark
# findspark.init()
import pyspark
import random
from tifffile import TiffFile
import io
import zipfile
import numpy as np
from operator import add
from pyspark.sql import SparkSession
import operator
spark_session = SparkSession.builder.appName("Assignment2").... | true |
8a32ecce39c6797dc69270548e2b2cc01ce4b5a4 | Python | siyuzhou/Neet | /neet/automata/eca.py | UTF-8 | 19,590 | 3.90625 | 4 | [
"MIT"
] | permissive | """
Elementary Cellular Automata
============================
The :class:`neet.automata.eca.ECA` class describes an `Elementary Cellular
Automaton <https://en.wikipedia.org/wiki/Elementary_cellular_automaton>`_
with an arbitrary rule. The ``ECA`` class is **not** a fixed sized network.
This means that the size is dete... | true |
12322cfac0629dcc6c6f15ff3c1f840bd880f5ae | Python | bryanvallejo16/HelsinkiRegionTravelTimeMatrix2018 | /codes/tests/centrality-analyses/analyze_most_accessible_places.py | UTF-8 | 1,655 | 2.578125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC-BY-4.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Analyze the most accessible areas with PT and Car.
Created on Wed Jun 13 13:38:04 2018
@author: hentenka
"""
import pandas as pd
import geopandas as gpd
from glob import glob
import os
# Filepaths
matrix_dir = r"C:\HY-Data\HENTENKA\Data\HelsinkiTravelTimeMatrix2018_2"
files = glob(os.pa... | true |
57094930e96a948f87a2ad6daf6c604a742c8062 | Python | s93971005/python-and-Taiwan-stock-market | /Trading/2_2_buy_with_dividend_price.py | UTF-8 | 4,336 | 3.203125 | 3 | [] | no_license | import sys
sys.path.append('D:\Trading')
import utility_f as uf
import pandas as pd
import yfinance as yf
import numpy as np
import datetime
import traceback
try:
#讀取高配息清單
data = pd.read_excel('D:/Trading/dividend_list.xlsx')
#獲取代號
target_stock = data['代號'].tolist()
#獲取今日日期
today = datetime.date... | true |
a55f882b6c7e6b9a7e4f2a87943f4bd23ba2c30b | Python | deZakelijke/projecteuler | /01to50/24.py | UTF-8 | 880 | 3.390625 | 3 | [] | no_license | from operator import itemgetter
permList = []
# prints all permutations of array
# n must be len(array)
def perm(n, array):
if n == 1:
temp = combine(array)
permList.append(temp)
else:
for i in range(n-1):
perm(n-1, array)
if n%2 == 0:
array[i] ... | true |
c5c7c15f8d3a775f0ce119c6e95a4d1cc93fcb9b | Python | dgnsrekt/yfs | /yfs/cleaner.py | UTF-8 | 15,338 | 3.234375 | 3 | [
"MIT"
] | permissive | """A module for cleaning tables, fields and values."""
from functools import partial
from typing import Dict, Optional, Union
import pendulum
from pendulum import DateTime
from pydantic import validator
from requests_html import HTML
numbers_with_suffix = {
"T": 1_000_000_000_000,
"B": 1_000_000_000,
"M... | true |
66a3b0d1b9a4865baa11a0c1e95b6fb0672f5d90 | Python | SirRujak/OpenSpeech-Prediciton | /src/trainer.py | UTF-8 | 16,156 | 2.984375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Used to train a neural network to predict words."""
import pickle
import os
import numpy as np
import tensorflow as tf
import generator
from openspeechsetup import *
'''
class DataHolder:
"""A simple holder class for keeping embeddings."""
def __init__(self):
... | true |
79e7bc3d1716ccb4e511c30ad84bc18e82132e88 | Python | admason/Stock_Management | /ETA_calc.py | UTF-8 | 887 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[15]:
# Incorporate a list
# Nearest wednesday
import datetime as dt
from datetime import date, timedelta
days =[14,42,70,100]
q = int(input("Quantity: "))
s = str(input("Source: "))
dt = datetime.datetime.now()
daynum = int(dt.strftime("%w"))
#print(daynum)
type(daynum... | true |
fbf63522cf3e1a3e352d699450f7555de8b2a37a | Python | Sugarsugarzz/RentCrawler | /rentcrawler/rentcrawler/pipelines.py | UTF-8 | 14,512 | 2.75 | 3 | [] | no_license | import csv
import datetime
from scrapy.exceptions import DropItem
import pymysql
import re, time
from rentcrawler.items import HouseItem
import requests
'''
数据预处理
'''
class ParsePipeline():
# 时间格式规范化
def parse_time(self, date):
# 链家发布时间格式处理
if re.match('今天', date):
date =... | true |
b3149b9ef73cb46355152b8e3740e14686b9a8e7 | Python | jannettim/MCDM | /app/swing_table.py | UTF-8 | 4,642 | 2.65625 | 3 | [
"MIT"
] | permissive | import pandas as pd
import seaborn
from bokeh.models import ColumnDataSource, DataTable, TableColumn, FactorRange, Legend, HoverTool, CategoricalTicker
from bokeh.plotting import figure
import os
def create_swing_table(filter_col=None):
file_path = os.path.dirname(os.path.abspath(__file__))
cb_color_map = ... | true |
3944e6ca64867ae870cd9b9e1d8cb4cc2117a59a | Python | rdmueller/aoc-2018 | /day03/python/rdmueller/solution.py | UTF-8 | 2,355 | 3.859375 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import re
# tag::Fabric[]
class Fabric:
fabric = []
width = 0
height = 0
def __init__(self, width, height):
self.fabric = []
self.width = width
self.height = height
for x in range(width):
self.fabric.append([])
for y in ra... | true |
ebcbd2235e2d2d18afc382ed0e5116d966b6e18f | Python | jasonbohne123/elliptical-curves | /Tori.py | UTF-8 | 1,281 | 3.296875 | 3 | [] | no_license | #Most of this code for outputting the plot of a torus came from https://scipython.com/book/chapter-7-matplotlib/examples/a-torus/
#and was NOT created by me, Jason Bohne, however I did comment the code such that one can change the paramters to
#produce different tori
import numpy as np
import matplotlib.pyplot as plt... | true |
ad8fce96312eaf386a9c3361c1ea7bcaffd33695 | Python | RaiManish3/ProjectEulerCode | /problems1_20/pe18_max_path_sum1.py | UTF-8 | 730 | 3.5 | 4 | [] | no_license | # from operator import add #this adds list elements componentwise
# l1,l2=[1,2,3],[1,2,3]
# print map(add,l1,l2)
lst=[]
def take_int():
str1=raw_input()
return list(map(int,str1.split()))
# --------------------------------------Take Multiline Input-------------------------------
def input_data(lines):
gl... | true |