repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/home/date_time_testing_try_2.py
import time from datetime import date days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] while True: if my_birthday.year%4==0: days_in_month[1] = 29 elif my_birthday.year%4!=0: days_in_month[1] = 28 today = date.today() today = date.fromtimestamp(time.time()) # today ...
jonahmakowski/PyWrskp
src/web21/app/routes.py
<filename>src/web21/app/routes.py from flask import request, render_template, redirect from app import app import sys import os try: pyWrkspLoc = os.environ["PYWRKSP"] except KeyError: os_ = input('Would you like to use the "HOME" env varible?') if os_ == 'y': pyWrkspLoc = os.environ["HOME"] + ...
jonahmakowski/PyWrskp
src/other/school_notes.py
<reponame>jonahmakowski/PyWrskp import os import datetime import json try: pyWrksp = os.environ["PYWRKSP"] except KeyError: pyWrksp = os.environ["HOME"] + input('Since you do not have the PYWRSKP env var ' '\nPlease enter the pwd for the pyWrskp repo not including the ...
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/classes/polygon.py
import turtle class Polygon: def __init__(self, sides, side_length): self.sides = sides self.side_length = side_length def draw(self, t, loc=(0,0), fill=False): t.pu() t.goto(loc) t.pd() if fill: t.begin_fill() for s in range(self.sides):...
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/classes/class_1_extras.py
<gh_stars>0 import pygame pygame.init() def which_color(x, radius, current_color, screen): BLACK = (0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) PURPLE = (251, 0, 255) YELLOW = (255, 247, 0) TEAL = (0, 255, 255) ORANGE = (255, 196, 0) ...
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/classes/Combo.py
import tkinter as tk class app(tk.Frame): def __init__(self, i, master=None): super().__init__(master) self.master = master self.i = i self.i_2 = i self.i_3 = i self.pack() self.createWidgets() def createWidgets(self): self.btnFrame = tk.Frame(sel...
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/home/random_names_or_partners.py
a_or_b = input('would you like partners, three person groups, half and half, or one person?\n') if a_or_b == ('partners'): from random import randint names = [] while True: name = input('What name would you like to add?\n') if name == (''): break names.append(name) w...
jonahmakowski/PyWrskp
src/other/docs.py
<filename>src/other/docs.py<gh_stars>0 class docs: def __init__(self): self.file_name = input('What is the file name?') def read(self): file = open(self.file_name, 'r') print(file.read()) return file def create(self, pr=True, add=None, text=None): text = '' ...
jonahmakowski/PyWrskp
src/other/schedule.py
<gh_stars>0 import os import json class Schedule: def __init__(self, show=True, name='schedule_data.txt'): try: self.pyWrskp = os.environ["PYWRKSP"] except KeyError: self.pyWrskp = os.environ["HOME"] + input('Since you do not have the PYWRSKP env var ' ...
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/class2020/class_4_2.0_.py
<reponame>jonahmakowski/PyWrskp import tkinter as tk from tkinter.filedialog import askopenfilename, asksaveasfilename class Application(tk.Frame): def __init__(self, name, save_loc, master=None): super().__init__(master) self.master = master self.pack() self.createWidgets() ...
jonahmakowski/PyWrskp
src/classroom_tools/classroom_tools.py
from random import randint as r import classroom_tools_extras import sys sys.path.append('../notes') import notes class Classroom: def __init__(self): self.roster = [] self.teacher = '' self.princaple = '' self.school_name = '' self.add_roster() def add_roster(self): ...
jonahmakowski/PyWrskp
src/math-game/game_extras.py
<gh_stars>0 from random import randint def add(min_num, max_num): num1 = randint(max_num, min_num) num2 = randint(max_num, min_num) a = num1 + num2 return num1, num2, a def sub(min_num, max_num, neg): num1 = randint(max_num, min_num) num2 = randint(max_num, min_num) a = num1 - num2 if ...
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/classes/class_3_homework.py
<reponame>jonahmakowski/PyWrskp class House: def __init__(self, family_members_list, pets_list): self.family = family_members_list self.pets = pets_list def new_family_member(self): pet = input('Are you adding a pet? (y/n) ') if pet == 'y': name = input('What is the ...
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/home/caculator.py
<gh_stars>0 # This is a simple calculator in the shell def use(num1, t, num2): try: num1 = float(num1) num2 = float(num2) if t == '+': a = num1 + num2 q = '{} + {}'.format(num1, num2) elif t == '-': a = num1 - num2 q = '{} - {}'.format...
jonahmakowski/PyWrskp
src/other/random_gen.py
from random import randint as r from time import sleep as wait # RANDOM GEN class RandomGen: def __init__(self, version): self.lis = [] if version == 'num': length = int(input('What do you want to range to be, 0 to')) self.lis = range(length) self.num() ...
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/home/fun_game.py
<gh_stars>0 import time name = input('What is your name?\n') if name == ('Jonah'): password = input('What is the password?\n') if password != ('Jo'): exit() if name != ('Jonah'): if name == ('Noah'): password = input('What is the password?\n') if password != ('No'): ...
jonahmakowski/PyWrskp
src/other/game.py
<reponame>jonahmakowski/PyWrskp<gh_stars>0 from time import sleep class Game: def __init__(self, debug=False, health=200, cheat=True): self.number = 1 self.number_killed = 1 self.health = health self.attacks = [{'name':'blast', 'damage min':1, 'damage max':20}, ...
jonahmakowski/PyWrskp
src/password_maker/password_saver.py
<reponame>jonahmakowski/PyWrskp import json import os try: pyWrkspLoc = os.environ["PYWRKSP"] except KeyError: pyWrkspLoc = os.environ["HOME"] + input('Since you do not have the PYWRSKP env var ' '\nPlease enter the pwd for the pyWrskp repo not including the ' ...
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/home/dice_roll.py
from random import randint as rand print('Welcome to DICE SPIN!') while True: try: sides = int(input('How many sides would you like your dice to have? ')) break except: print('you did not enter a number') nums = [] tick = 1 nums = [*range(1, sides, 1)] spin_nums = [] tick = 1 while ...
jonahmakowski/PyWrskp
src/alarm/run_time_only.py
from time_only import work hour = int(input('What is the hour number - form 1 to 24')) mint = int(input('What is the min number')) work(hour, mint)
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/home/tk_testing.py
import tkinter as tk labels = {} buttons = {} entrys = {} root= tk.Tk() canvas1 = tk.Canvas(root, width = 1000, height = 1000/2, relief = 'raised') canvas1.pack() label1 = tk.Label(root, text='Calculate') label1.config(font=('helvetica', 14)) canvas1.create_window(1000/2, 25, window=label1) labels['label1'] = labe...
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/classes/Class_one.py
<filename>src/other/Other_from_2020-2021/classes/Class_one.py import class_1_extras # here we start with pygame: import pygame def draw(): pygame.init() screen = pygame.display.set_mode([1375,750]) pygame.display.set_caption("Paint") keep_going = True mouse_down = False # defines colors ...
jonahmakowski/PyWrskp
src/catalog/catalogue.py
<gh_stars>0 # This is a simple catalog app import json import time import fuction import tkinter as tk from fuzzywuzzy import process class catalog: def __init__(self, books): self.books = books while True: new_title = input('Please write the title of your book: ') new_au...
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/home/extra_turtle_stuff.py
def draw_hex(sides, length_of_sides, t): for i in range(sides): t.forward(length_of_sides) t.right(360 / sides) def turn(length, turn, left_or_right, t): if left_or_right == 'right': for i in range(length): t.forward(1) t.right(turn) elif left_or_right == 'le...
jonahmakowski/PyWrskp
src/other/Other_from_2020-2021/class2020/class_4_2.0.py
<reponame>jonahmakowski/PyWrskp import tkinter as tk from tkinter.filedialog import askopenfilename, asksaveasfilename class Application(tk.Frame): def __init__(self, name, save_loc, master=None): super().__init__(master) self.master = master self.pack() self.create_widgets() ...
jonahmakowski/PyWrskp
src/sudoku/solve_mm1.py
<gh_stars>0 """ Early prototype of the sudoku solver, witten by <NAME>. A simple 'brute force' algorithm was implemented; the prototype appears to work, but enhancements and testing is desired (cf comments at the bottom of this file). """ import numpy as np class Board: def __init__(self, nrows=9, ncols=9): ...
MichaelAlexanderDenton/Nyaa-scrapper
NyaaPy/__init__.py
# -*- coding: utf-8 -*- """ NyaaScraper NyaaScraper is Feed parser and a web scraper for Nyaa.si and sukebei.nyaa. NyaaScraper modules: DataProcess.py --> contains DataProcess class. has all the necessary methods for extracting data from both RSS and the website NyaaRSS.py --> contains NyaaRSS c...
MichaelAlexanderDenton/Nyaa-scrapper
NyaaPy/DataProcess.py
<reponame>MichaelAlexanderDenton/Nyaa-scrapper<filename>NyaaPy/DataProcess.py """ ----Creating the automated directory needs its own function called by __init__ ----requests.exceptions.HTTPError: 404 Client Error: NOT FOUND for url: https://nyaa.si/download/647951 """ import helpers import requests import urll...
MichaelAlexanderDenton/Nyaa-scrapper
NyaaPy/helpers.py
filters= tuple({'no filter', 'no remake', 'trusted only'}) # m_cat = "Anime" # s_cat = "Raw" cats = [ {"All Categories": [None]}, {"Anime" : [ "None", "Anime Music Video", "English-translated", "Non-English-translated", "Raw", ] }, {"Audio": [ ...
MichaelAlexanderDenton/Nyaa-scrapper
NyaaPy/NyaaRSS.py
<gh_stars>0 """ TODO: ---overwrite/not existing torrent files/data ---Check query if user has submitted valid input ---Add more debug console data. ---if page returns empty, put an exception. ---category needs to be parse and converted. ---get files by their tier (tr...
MichaelAlexanderDenton/Nyaa-scrapper
NyaaPy/NyaaScraper.py
""" TODO: ---if page returns empty, put an exception. ---category needs to be parse and converted. ---get files by their tier (trusted, success, not-trusted, neutral...) ---Add an exception if the page scrapped returned nothing ---Magnet links file can have more file info as...
vsaveris/common-data-model-schema
test.py
<filename>test.py ''' File name: cdm.py Example usage code of the Common Data Model Schema Extraction class. Author: <NAME> email: <EMAIL> License: MIT Date last modified: 03.04.2020 Python Version: 3.7 ''' import cdm import sys c = cdm.CDM(path = sys.argv[1], core_path = sys.argv[2], base_path = s...
vsaveris/common-data-model-schema
cdm.py
<reponame>vsaveris/common-data-model-schema ''' File name: cdm.py Common Data Model Schema Extraction class. Author: <NAME> email: <EMAIL> License: MIT Date last modified: 03.04.2020 Python Version: 3.7 ''' import json class CDM(): ''' CDM Schema Extraction class implementation. Args: ...
Xvezda/vishop
setup.py
<filename>setup.py #!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2020 Xvezda <<EMAIL>> # # Use of this source code is governed by an MIT-style # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. from os import path from setuptools import setup, find_packages h...
huzhijiang123/testprj
restful_server/images.py
<reponame>huzhijiang123/testprj """ /images endpoint for Glance v1 API """ import copy from webob.exc import HTTPBadRequest from webob.exc import HTTPConflict from webob.exc import HTTPForbidden from webob.exc import HTTPMethodNotAllowed from webob.exc import HTTPNotFound from webob.exc import HTTPRequestEntityTooLar...
huzhijiang123/testprj
restful_client/http.py
<reponame>huzhijiang123/testprj # Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/license...
huzhijiang123/testprj
restful_client/client.py
import os import sys import re import http class Client(object): """Client for the OpenStack Images v1 API. :param string endpoint: A user-supplied endpoint URL for the glance service. Such as http://10.20.11.2:35357 """ def __init__(self, endpoint): """Initialize a...
huzhijiang123/testprj
restful_server/server.py
""" RestFul API Server """ import os import sys import eventlet import router # Monkey patch socket, time, select, threads # NOTE(jokke): As per the eventlet commit # b756447bab51046dfc6f1e0e299cc997ab343701 there's circular import happening # which can be solved making sure the hubs are properly and fully imported ...
huzhijiang123/testprj
restful_server/router.py
import images import wsgi class API(wsgi.Router): """WSGI router for Glance v1 API requests.""" def __init__(self, mapper): images_resource = images.create_resource() mapper.connect("/images", controller=images_resource, action='create', ...
nancymukuiya14/Monty-blog
tests/user_test.py
<reponame>nancymukuiya14/Monty-blog import unittest from app.models import User class UserModelTest(unittest.TestCase): def setUp(self): ''' testcase to create an instance of User class. ''' self.new_user = User(password = '<PASSWORD>') def test_password_setter(self): ...
Adeon18/Solver_Algorithms
main.py
<reponame>Adeon18/Solver_Algorithms import os from sys import platform # Check for user system linux = False bad_os = False if platform == "linux" or platform == "linux2": linux = True elif platform == "win32": bad_os = True scripts = { 1: "maze/main.py", 2: "sudoku/main.py", 3: "crossword/main.p...
Adeon18/Solver_Algorithms
sudoku/sudoku_ADT.py
<reponame>Adeon18/Solver_Algorithms<gh_stars>1-10 import pygame class Sudoku: def __init__(self, path, vizual=None): self.grid = self.read_grid(path) if vizual: self.vizual = vizual def read_grid(self, path): """ takes the path to conditions and convert the...
Adeon18/Solver_Algorithms
maze/maze.py
""" Implemention of the Maze ADT. """ import turtle import pygame from dataclasses import dataclass from lliststack import Stack class Maze: """ Class for representing Maze objects. Attributes: maze: The list of lists representing the maze. _start: The starting position of the maze; marked...
Adeon18/Solver_Algorithms
graph_colorizer/main.py
''' Realizing graph colorizing by backtracking. ''' def read_file(path): ''' Reads from file and converts info into graph. ''' with open(path) as file: lines = file.readlines() lines = [x for x in lines] new_lines = [] for line in lines: new_line = line.strip().split(" ") ...
Adeon18/Solver_Algorithms
maze/main.py
''' Main script with visualization ''' import pygame import sys from os import path, pardir import time from maze import * from pygame_helpers import * class Game: """ A general visualization class for pygame """ DARKPINK = (219, 0, 189) DARKBLUE = (95, 0, 219) LIGHTBLUE = (138, 138, 219) ...
Adeon18/Solver_Algorithms
crossword/crossword.py
''' module containing crossword solving algorithm using backtracking ''' import pygame import random DIRECTIONS = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]] class Crossword: ''' class representing crossword has methods to read it from file and solve it ''' def __init__(s...
Adeon18/Solver_Algorithms
maze/pygame_helpers.py
""" This module contains pygame helpers for visualization """ import pygame from maze import * class Tile(pygame.sprite.Sprite): """ A tile object that gets colored during the process """ TILESIZE = 0 def __init__(self, game, maze, grid_x, grid_y): self.groups = game.all_sprites p...
Mu-L/ArchiveBox
archivebox/core/urls.py
from django.contrib import admin from django.urls import path, include from django.views import static from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.conf import settings from django.views.generic.base import RedirectView from core.views import HomepageView, SnapshotView, PublicIndexV...
nanda-nainadurai/powerbi-generate-pdf-api
GeneratePDF.py
<gh_stars>0 import msal import requests import json import time import sys f = open('data.json',"r") config = json.load(f) f.close # Tenant/Report specific configurations TENANT_ID = config['tenant_id'] WORKSPACE_ID = config['workspace_id'] REPORT_ID = config['report_id'] # Service Principal Credentials CLIENT_ID =...
Karryanna/res-counterfitting
counterfitting.py
<reponame>Karryanna/res-counterfitting<filename>counterfitting.py import ConfigParser import numpy import sys import time import random import math import os from copy import deepcopy import json from numpy.linalg import norm from numpy import dot from scipy.stats import spearmanr class ExperimentRun: """ This clas...
tago-io/analysis-example-downlinkDashboard-py
analysis.py
# Analysis Example # Sending downlink using dashboard # Using an Input Widget in the dashboard, you will be able to trigger a downlink to # any LoraWaN network server. # You can get the dashboard template to use here: http://admin.tago.io/template/5f514218d4555600278023c4 # # Environment Variables # In order to use thi...
EndlessTrax/spondy-news
tests/conftest.py
from datetime import timedelta import pytest from django.utils import timezone from aggregator.models import Entry @pytest.fixture def example_entry(db): """Test article fixture""" entry = Entry.objects.create( title="Awesome Article Title", description="A great article about all the things....
EndlessTrax/spondy-news
aggregator/management/commands/startjobs.py
# Standard Lib import re import logging from datetime import timedelta # Third Party import feedparser from dateutil import parser from apscheduler.schedulers.blocking import BlockingScheduler from apscheduler.triggers.cron import CronTrigger from django_apscheduler.jobstores import DjangoJobStore from django_apschedu...
EndlessTrax/spondy-news
spondy_news/sitemap.py
<filename>spondy_news/sitemap.py from django.contrib.sitemaps import Sitemap from django.shortcuts import reverse class StaticPageSitemap(Sitemap): changefreq = "daily" priority = 0.5 def items(self): return ["homepage"] def location(self, item): return reverse(item)
EndlessTrax/spondy-news
aggregator/apps.py
<reponame>EndlessTrax/spondy-news<filename>aggregator/apps.py from django.apps import AppConfig class ContentAggregatorConfig(AppConfig): name = "aggregator"
EndlessTrax/spondy-news
spondy_news/feeds.py
from django.contrib.syndication.views import Feed from aggregator.models import Entry class LatestEntriesFeed(Feed): title = "Spondy News Feed" link = "https://spondy.news" description = "Published entries on Spondy News" def items(self): return Entry.objects.filter(is_published=True).order_b...
EndlessTrax/spondy-news
tests/test_spondy_news.py
<reponame>EndlessTrax/spondy-news<filename>tests/test_spondy_news.py from django.urls import reverse import pytest from spondy_news.feeds import LatestEntriesFeed @pytest.mark.django_db def test_admin_action_publish_selected(client, example_entry): """Checks the that the custom admin function changes an entrys ...
EndlessTrax/spondy-news
aggregator/models.py
<gh_stars>1-10 from django.db import models CATEGORY_CHOICES = [ ("ARTICLE", "Article"), ("RESEARCH", "Research"), ("EVENT", "Event"), ] class Entry(models.Model): class Meta: verbose_name_plural = "entries" title = models.CharField(max_length=200) description = models.TextField() ...
EndlessTrax/spondy-news
tests/test_aggregator.py
from django.urls import reverse import pytest from pytest_django.asserts import assertTemplateUsed from aggregator.management.commands.startjobs import delete_rejected_entries from aggregator.models import Entry def test_class_str_repr(example_entry): """Tests the models __str__ function""" assert str(examp...
EndlessTrax/spondy-news
aggregator/views.py
from django.views.generic import ListView from .models import Entry class HomePageView(ListView): """Main homepage view""" template_name = "homepage.html" model = Entry def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) # Filters the newest 25 articl...
EndlessTrax/spondy-news
aggregator/admin.py
<filename>aggregator/admin.py<gh_stars>1-10 from django.contrib import admin from .models import Entry def publish_selected(modeladmin, request, queryset): queryset.update(is_published=True) publish_selected.short_description = "Publish the selected posts" @admin.register(Entry) class EntryAdmin(admin.ModelA...
A-Bak/remove-dirs
test/directory_test_case.py
import unittest import os import shutil class DirectoryTestCase(unittest.TestCase): def setUp(self) -> None: for dir in self.dir_paths: if not os.path.exists(dir): os.makedirs(dir) for file, content in self.file_contents.i...
A-Bak/remove-dirs
test/logging_test_case.py
<filename>test/logging_test_case.py import unittest import logging import os class LoggingTestCase(unittest.TestCase): def setUp(self) -> None: super().setUp() self.logger = logging.getLogger(__name__) dir_name = 'test' log_file_name = ...
A-Bak/remove-dirs
rmdirs/__main__.py
<reponame>A-Bak/remove-dirs from .utils import * import sys import argparse if __name__ == '__main__': description = ''' Python utility for removing all subdirectories of a directory while preserving all the files located in the subdirectories. The files are ...
A-Bak/remove-dirs
test/rmdirs_string_util_test.py
<gh_stars>0 import unittest import os import rmdirs.utils from logging_test_case import LoggingTestCase from directory_test_case import DirectoryTestCase class TestrmdirsStringUtil(LoggingTestCase, DirectoryTestCase): """ Test rmdirs utility. """ def setUp(self) -> None: self.di...
A-Bak/remove-dirs
test/rmdirs_test.py
import unittest import os import rmdirs from logging_test_case import LoggingTestCase from directory_test_case import DirectoryTestCase class TestRmdirs(LoggingTestCase, DirectoryTestCase): """ Test rmdirs utility.""" def setUp(self) -> None: self.dir_paths = [ 'test/test...
A-Bak/remove-dirs
rmdirs/utils.py
from typing import List import os import shutil import logging __all__ = ['remove', 'new_file_name', 'rename_if_exists'] class Char(str): """ Single character. """ class FilePath(str): """ An absolute or a relative path to a file system resource. """ class FileName(str): """ Full file name of a file i...
A-Bak/remove-dirs
setup.py
<reponame>A-Bak/remove-dirs import setuptools with open('ReadMe.md', 'r') as f: long_description = f.read() with open('requirements.txt', 'r', encoding='UTF-16') as f: required = f.readlines() setuptools.setup( name="rmdirs", version="0.1.1", author="A-Bak", author_email="<EMAIL>", ...
karakuri-musha/JetRunStep
Common/kmg_common.py
<gh_stars>0 #!/usr/bin/python3 #----------------------------------------------------------------------------- # KMG Common    Create 2021.09 # # 共通関数を定義したファイルです。他のプログラムから呼び出して使用します。 # # Author : <EMAIL>ROKU@Karakuri-musha # License : See the license file for the l...
karakuri-musha/JetRunStep
Common/kmg_json.py
#!/usr/bin/python3 #----------------------------------------------------------------------------- # KMG JSON    Create 2021.09 # # 共通関数を定義したファイルです。他のプログラムから呼び出して使用します。 # # Author : <EMAIL>ROKU<EMAIL> # License : See the license file for the license. # # [変数記名...
karakuri-musha/JetRunStep
Common/kmg_subprocess.py
<reponame>karakuri-musha/JetRunStep<filename>Common/kmg_subprocess.py #!/usr/bin/python3 #----------------------------------------------------------------------------- # KMG Subprocess    Create 2021.09 # # 共通関数を定義したファイルです。他のプログラムから呼び出して使用します。 # # Author : GENROKU@<...
karakuri-musha/JetRunStep
JetRunStep.py
#!/usr/bin/python3 #----------------------------------------------------------------------------- # Jetson Nano Run Step cmd Tool (JetRunStep)   Create 2021.09 # # このツールは、Jetson Nanoの環境の更新履歴をトレースできる情報を管理するツールです。 #  Ubuntuにおいてインストールコマンドなどを実行する際に、このコマンドを通して実行する #  ことで、下記の管理情報をもとに環境更新履歴を生成します。 #  また、あ...
karakuri-musha/JetRunStep
Common/kmg_file.py
<filename>Common/kmg_file.py #!/usr/bin/python3 #----------------------------------------------------------------------------- # KMG file    Create 2021.09 # # 共通関数を定義したファイルです。他のプログラムから呼び出して使用します。 # # Author : <EMAIL>ROKU@Karakuri-musha # License : See the license...
karakuri-musha/JetRunStep
JetRunStep_func.py
<gh_stars>0 #!/usr/bin/python3 #----------------------------------------------------------------------------- # JetRunStep Function    Create 2021.09 # # JetRunStepツールで使用する独自関数を定義したファイルです。 # ツールのメインプログラムから呼び出して使用します。 # # Author : GENROKU@Karakuri-musha # License : See ...
KyleBringmans/Pac-Man
featureExtractors.py
<gh_stars>1-10 # featureExtractors.py # -------------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a l...
KyleBringmans/Pac-Man
analysis.py
<reponame>KyleBringmans/Pac-Man # analysis.py # ----------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a li...
KyleBringmans/Pac-Man
valueIterationAgents.py
# valueIterationAgents.py # ----------------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to ht...
KyleBringmans/Pac-Man
qlearningAgents.py
# qlearningAgents.py # ------------------ # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.be...
emadbagheri96/PyTse
setup.py
import setuptools from pathlib import Path setuptools.setup( name="pytse", author="<NAME>", version="1.3.0", long_description=Path("README.md").read_text(), long_description_content_type='text/markdown', description="A small web crawler for tsetmc.com", packages=setuptools.find_packages(excl...
emadbagheri96/PyTse
tests/test_response.py
from pytse.pytse import PyTse,SymbolData from unittest.mock import patch from pathlib import Path from nose.tools import assert_equal,assert_is_not_none,assert_is_instance def test_server_response(): with patch('pytse.pytse.PyTse._PyTse__get_data_from_server') as mock_get: mock_get.return_value=...
emadbagheri96/PyTse
pytse/constants.py
BASE_URL = "http://www.tsetmc.com/tsev2/data/MarketWatchInit.aspx?h=0&r=0" CLIENT_TYPE_URL="http://www.tsetmc.com/tsev2/data/ClientTypeAll.aspx" SYMBOL_PAGE_URL="http://www.tsetmc.com/loader.aspx?ParTree=151311&i={inscode}"
MichaelSeaman/char-rnn
frequent_flush.py
from time import sleep import sys import threading class Frequent_flush(threading.Thread): def __init__(self, delay): threading.Thread.__init__(self) self.delay = delay self.daemon = True def run(self): while True: sys.stdout.flush() sleep(self.delay) ...
MichaelSeaman/char-rnn
callback.py
<gh_stars>0 import numpy as np from keras.utils import np_utils import sys import os from keras.callbacks import Callback from generate import sample, generate class Generate_Text(Callback): def __init__(self, gen_text_len, idx_to_char, char_to_idx, text, maxlen, vocab): self.gen_text_len = gen_text_len ...
MichaelSeaman/char-rnn
model_file.py
import os import time import numpy as np class ModelFile(): def __init__(self, model_directory='', model='', weights='', history=''): self.model = model self.weights = weights self.history = history if(model_directory): self.model_directory = model_directory ...
MichaelSeaman/char-rnn
rnn.py
<reponame>MichaelSeaman/char-rnn from keras.models import Sequential from keras.layers import Dense, Activation, Dropout from keras.layers import LSTM from keras.optimizers import Adam from keras.utils import np_utils import numpy as np def preprocess_text(filename, SEQ_LEN): text = open(filename).read() n_cha...
MichaelSeaman/char-rnn
generate.py
''' Copied from keras tutorials' char-rnn Example script to generate text from Nietzsche's writings. At least 20 epochs are required before the generated text starts sounding coherent. It is recommended to run this script on GPU, as recurrent networks are quite computationally intensive. If you try this script on new...
MichaelSeaman/char-rnn
train_rnn.py
#!/usr/bin/env python from keras.models import load_model from keras.callbacks import ModelCheckpoint, EarlyStopping, History from callback import * from sklearn.model_selection import train_test_split from rnn import preprocess_text, build_model, vectorize_data from frequent_flush import Frequent_flush from model_fil...
MichaelSeaman/char-rnn
graph_training.py
import numpy as np import matplotlib.pyplot as plt import os import getopt import sys HISTORY_FILE = 'model_history.npy' def main(argv): global HISTORY_FILE if(argv): inputFile = argv[0] else: print("History file or model directory needed") sys.exit(0) if(os.path.isdir(inputFi...
apastoriza/tf-ninja
tfninja/tf102/softmax101_numpy.py
<reponame>apastoriza/tf-ninja<gh_stars>0 # coding=utf-8 import numpy as np def run_softmax(): y = [0.1, 0.2, 0.3, 0.4, 0.1, 0.2, 0.3] softmax_y = np.exp(y) / np.sum(np.exp(y)) print(y) print(softmax_y) z = [0.1, 0.2, 0.3, 4.0, 0.1, 0.2, 0.3] softmax_z = np.exp(z) / np.sum(np.exp(z)) prin...
apastoriza/tf-ninja
tfninja/resources/mnist_input_data.py
<filename>tfninja/resources/mnist_input_data.py # coding=utf-8 from tensorflow.examples.tutorials.mnist import input_data from tfninja.resources import config def gather_data(): train_dir = config.paths['dir'] + 'data' data_sets = input_data.read_data_sets(train_dir=train_dir, one_hot=True) return data_...
apastoriza/tf-ninja
tfninja/resources/config.py
<filename>tfninja/resources/config.py<gh_stars>0 # coding=utf-8 paths = dict( dir='/tmp/tf-ninja/' )
apastoriza/tf-ninja
tfninja/utils/tensorfactory.py
# coding=utf-8 import tensorflow as tf DEFAULT_STD_DEV = 0.01 def random_normal_variable(shape, variable_name, std_dev=DEFAULT_STD_DEV): variable = tf.Variable(tf.random_normal(shape, stddev=std_dev), name=variable_name) return variable
apastoriza/tf-ninja
tfninja/tf101/session105.py
# coding=utf-8 # single neuron and TensorBoard # --(weight)--(input)-->[output=f(input, weight)]--(output)--> import tensorflow as tf from tfninja.resources import config from tfninja.utils import loggerfactory logger = loggerfactory.get_logger(__name__) MAX_ITERATIONS = 100000 TARGET_RESULT = 0.0000000001 DESCENT...
apastoriza/tf-ninja
tfninja/utils/loggerfactory.py
<gh_stars>0 # coding=utf-8 import logging import logging.config def get_logger(name): logger = logging.getLogger(name) handler = logging.StreamHandler() formatter = logging.Formatter('%(asctime)s (%(threadName)-10s) %(name)-12s %(levelname)-8s %(message)s') handler.setFormatter(formatter) ...
apastoriza/tf-ninja
tfninja/tf101/session103.py
# coding=utf-8 import tensorflow as tf from tfninja.utils import loggerfactory logger = loggerfactory.get_logger(__name__) CONSTANT_A = tf.constant([100.0]) CONSTANT_B = tf.constant([200.0]) CONSTANT_C = tf.constant([10.0]) add_operation = tf.add(CONSTANT_A, CONSTANT_B) multiply_operation = tf.multiply(...
apastoriza/tf-ninja
tfninja/tf102/softmax102.py
<reponame>apastoriza/tf-ninja # coding=utf-8 import numpy as np import tensorflow as tf from random import randint from tfninja.resources import config from tfninja.resources import mnist_input_data from tfninja.utils import loggerfactory from tfninja.utils import time logger = loggerfactory.get_logger(__name__) B...
apastoriza/tf-ninja
tfninja/hello/hello.py
<filename>tfninja/hello/hello.py # coding=utf-8 import tensorflow as tf from tfninja.utils import loggerfactory logger = loggerfactory.get_logger(__name__) hello = tf.constant('hello ninjas!!') session = tf.Session() logger.info(session.run(hello))
apastoriza/tf-ninja
tfninja/tf103/lenet101_softmax.py
<gh_stars>0 # coding=utf-8 import tensorflow as tf import numpy as np from tfninja.tf103 import lenet101_softmax_model from tfninja.resources import mnist_input_data from tfninja.utils import loggerfactory from tfninja.utils import tensorfactory BATCH_SIZE = 128 TEST_SIZE = 256 NUM_CLASSES = 10 LEARNING_RATE = 0.001...
apastoriza/tf-ninja
tfninja/tf101/session101.py
<reponame>apastoriza/tf-ninja # coding=utf-8 import tensorflow as tf from tfninja.utils import loggerfactory logger = loggerfactory.get_logger(__name__) with tf.Session() as session: # create a sensor x x = tf.placeholder( tf.float32, # data type [1], # tensor shape (one dimension)...
apastoriza/tf-ninja
tfninja/tf103/lenet101_softmax_model.py
<gh_stars>0 # coding=utf-8 import tensorflow as tf PADDING_TYPE = 'SAME' IMAGE_NUMBER = 1 INPUT_CHANNEL = 1 KERNEL_SIZE = [1, 2, 2, 1] def model(x, w1, w2, w3, w4, w_o, p_keep_conv, p_keep_hidden): conv1 = _create_conv_layer_dropout(x, w1, p_keep_conv) conv2 = _create_conv_layer_dropout(conv1, w2, p_keep_co...