repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
NoOneZero/Neuro | test_1_lineral/frame.py | import pygame
class Frame:
def __init__(self, start_pos, end_pos, goal_pos, frame_color = [255, 255, 0], goal_color = [255,0,20], width=5):
self.start_pos = start_pos
self.end_pos = end_pos
self.goal_pos = goal_pos
self.frame_color = frame_color
self.goal_color = goal_color
... |
NoOneZero/Neuro | else/character.py | <reponame>NoOneZero/Neuro
import config
import random
from common.web import Web
class Character:
iterator = 0
web_father = None
web_mother = None
characters_all = []
characters_web_temp = []
max = 0
def __init__(self, person = None, web = None):
self.person = person
if we... |
NoOneZero/Neuro | test_4_move_round/activityTest.py | <gh_stars>0
from common.activity import Activity
from common.dataWriter import DataWriter
from common.geneticAlgorithmParams import GeneticAlgorithmParams
from common.monitor import Monitor
from common.character import Character
from test_4_move_round.personTest import PersonTest
from test_4_move_round.characterTest i... |
NoOneZero/Neuro | test_4_move_round/geneticAlgorithmParamsTest.py | from common.geneticAlgorithmParams import GeneticAlgorithmParams
class GeneticAlgorithmParamsTest(GeneticAlgorithmParams):
def __init__(self) -> None:
super(GeneticAlgorithmParamsTest, self).__init__()
self.max_iteration = 1000 # Кількість циклів в 1 еопосі
self.max_epoch = 1000 # Кількі... |
NoOneZero/Neuro | test_4_move_round/characterTest.py | from common.web import Web
from common.character import Character
class CharacterTest(Character):
counter = 0
characters_all = []
def __init__(self, person=None, web=None) -> None:
super(CharacterTest, self).__init__(person, web)
self.person = person
self.web = web or Web(randomiz... |
NoOneZero/Neuro | test_1_lineral/activityTest.py | from common.activity import Activity
from common.dataWriter import DataWriter
from common.geneticAlgorithmParams import GeneticAlgorithmParams
from common.monitor import Monitor
from common.web import Web
from test_1_lineral.personTest import PersonTest
from test_1_lineral.characterTest import CharacterTest
from test_... |
NoOneZero/Neuro | cars/Beast.py | <reponame>NoOneZero/Neuro
import random
import pygame
import math
import config
class Beast:
def __init__(self, position = [10, 10], floor = 100, ceiling = 900, speed = [0, 0], size = 20, color = [200, 140, 70], only_circle = False):
self.set_params(position, floor, ceiling, speed, size, color ,only_circ... |
NoOneZero/Neuro | cars/Scene_car_test.py | import pygame
import random
import config
from Scene import Scene
from cars.Beast import Beast
from cars.Lazer_of_death import Lazer_of_death
from cars.character_beast import Character_beast
class Scene_car_test(Scene):
alive = []
def __init__(self):
super().__init__()
def init_battlefield(self):
... |
NoOneZero/Neuro | cars/character_beast.py | <filename>cars/character_beast.py
from character import Character
import random
import config
import math
class Character_beast(Character):
def __init__(self, person = None, web = None):
super().__init__(person, web)
if Character_beast.iterator == 1: person.frame_color = [0, 0, 255]
# if Ch... |
NoOneZero/Neuro | cars/Lazer_of_death.py | import random
import pygame
from cars.Beast import Beast
class Lazer_of_death:
def __init__(self, position = 50):
self.position = position
def update(self, add_position = 0):
self.position += add_position
def draw(self, display):
pygame.draw.line(display, [255, 0, 0], [self.positi... |
NoOneZero/Neuro | test_1_lineral/geneticAlgorithmParamsTest.py | from common.geneticAlgorithmParams import GeneticAlgorithmParams
class GeneticAlgorithmParamsTest(GeneticAlgorithmParams):
# list_start_population = [16, 64, 256, 1024, 4096]
#
# list_count_elitism = [0, 0.001, 0.01, 0.1, 0.2]
# list_count_of_alive_after_epoch = [0.03125, 0.0625, 0.125, 0.25, 0.5]
... |
NoOneZero/Neuro | main.py | <gh_stars>0
import common.activity as test
import test_1_lineral.activityTest as test1
import test_2_spin.activityTest as test2
import test_3_lineral_and_spin.activityTest as test3
import test_4_move_round.activityTest as test4
def main():
activity = test1.ActivityTest() # activity = test.Activity()
activity.... |
NoOneZero/Neuro | test_4_move_round/personTest.py | <reponame>NoOneZero/Neuro<gh_stars>0
from common.person import Person
class PersonTest(Person):
def __init__(self) -> None:
super().__init__() |
NoOneZero/Neuro | else/config.py | FILE_NAME = 1 # Імя файла для запису даних
SHOW_INFO = True
DISPLAY_POSITION = (50,30)
DISPLAY_SIZE = (1700, 1030)
DISPLAY_COLOR = (48, 189, 221)
FPS = 240
MAX_COUNTER = 3000 # Кількість циклів в 1 еопосі
MAX_EPOCH = 1000 # Кількість епох
START_POPULATION = 10 # Кількість осіб взагалі
COUNT_OF_ALIVE_AFTER_EPOCH = 10... |
Shura1oplot/sqluploadergen | sqluploadergen.py | <filename>sqluploadergen.py
#!/usr/bin/env python3
import sys
import os
import tempfile
import shutil
import subprocess
import openpyxl
MAP_TYPES = {
"bigint": "Int64",
"bit": "bool",
"char": "string",
"date": "DateTime",
"datetime": "DateTime",
"datetime2": "DateTime",
"datetimeoffset": ... |
Shura1oplot/sqluploadergen | cx_setup.py | import sys
import os
from cx_Freeze import setup, Executable
if sys.version_info[:2] != (3, 8):
raise Exception("Python 3.8 required!")
build_exe_options = {
"build_exe": os.path.abspath("build_exe"),
"packages": [],
"excludes": ["tkinter", "distutils"],
"include_files": ["assets", "example"],
}... |
Shura1oplot/sqluploadergen | configure.py | # [SublimeLinter @python:3]
import sys
import os
from pathlib import Path
import platform
PROG_VERSION = "0.1.0"
# TCL_VERSION = "8.6"
SDK_BASE_DIR = "%ProgramFiles(x86)%\\Windows Kits\\10\\Include"
VC_DIR = "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build"
def main(argv=sys.a... |
ShashankSetty42/MAL-Telegram-Bot | server.py | from bot import telegram_chatbot
import mal_scraper
bot = telegram_chatbot("config.cfg")
#get anime name and return info string
def make_reply(msg):
reply = None
if msg is not None:
reply = format_reply(mal_scraper.scrape_page(msg))
return reply
#convert the dictonary value returned f... |
ShashankSetty42/MAL-Telegram-Bot | mal_scraper.py | <filename>mal_scraper.py
from bs4 import BeautifulSoup as soup
from urllib.request import urlopen as ureq
def scrape_page(anime_name):
#dictonary to store anime info
dict_data = {
"Title": "",
"Image": "",
"Score": "",
"Episodes": "",
"Genre": "",
"D... |
silentwrath/Profile_REST_API | hellow.py | <gh_stars>0
print("helloo world")
"180": {
"name": "ETM186",
"description": "check POST API call for enabling dptsa is working",
"tags": [
"RESTAPI",
"PP",
"Phase12"
],
"suites": [
"sanity",
"smoke"
]
}
}
|
bachya/simplisafe-python | tests/sensor/test_base.py | """Define base tests for Sensor objects."""
# pylint: disable=unused-argument
import aiohttp
import pytest
from simplipy import API
from simplipy.device import DeviceTypes
from tests.common import TEST_AUTHORIZATION_CODE, TEST_CODE_VERIFIER, TEST_SYSTEM_ID
@pytest.mark.asyncio
async def test_properties_base(arespon... |
bachya/simplisafe-python | tests/system/test_v3.py | <filename>tests/system/test_v3.py<gh_stars>10-100
"""Define tests for v3 System objects."""
# pylint: disable=protected-access,too-many-arguments,unused-argument
from datetime import datetime
import logging
import aiohttp
import pytest
import pytz
from simplipy import API
from simplipy.errors import (
EndpointUna... |
bachya/simplisafe-python | simplipy/api.py | <reponame>bachya/simplisafe-python
"""Define functionality for interacting with the SimpliSafe API."""
from __future__ import annotations
import asyncio
from datetime import datetime, timedelta
from json.decoder import JSONDecodeError
import sys
from typing import TYPE_CHECKING, Any, Callable
from aiohttp import Clie... |
bachya/simplisafe-python | simplipy/device/sensor/v3.py | """Define a v3 (new) SimpliSafe sensor."""
from typing import cast
from simplipy.device import DeviceTypes, DeviceV3
class SensorV3(DeviceV3):
"""A V3 (new) sensor.
Note that this class shouldn't be instantiated directly; it will be
instantiated as appropriate via :meth:`simplipy.API.async_get_systems`.... |
bachya/simplisafe-python | tests/system/test_base.py | <filename>tests/system/test_base.py
"""Define base tests for System objects."""
# pylint: disable=too-many-arguments,unused-argument
from datetime import datetime
import aiohttp
import pytest
from simplipy import API
from simplipy.system import SystemStates
from tests.common import (
TEST_ADDRESS,
TEST_AUTHO... |
bachya/simplisafe-python | simplipy/device/sensor/v2.py | <filename>simplipy/device/sensor/v2.py
"""Define a v2 (old) SimpliSafe sensor."""
from typing import cast
from simplipy.device import Device, DeviceTypes
from simplipy.errors import SimplipyError
class SensorV2(Device):
"""A V2 (old) sensor.
Note that this class shouldn't be instantiated directly; it will b... |
bachya/simplisafe-python | tests/test_api.py | """Define tests for the System object."""
# pylint: disable=protected-access,too-many-arguments
from datetime import datetime
from unittest.mock import Mock
import aiohttp
import pytest
from simplipy import API
from simplipy.errors import InvalidCredentialsError, RequestError
from .common import (
TEST_ACCESS_TO... |
bachya/simplisafe-python | simplipy/system/__init__.py | """Define V2 and V3 SimpliSafe systems."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime
from enum import Enum
from typing import TYPE_CHECKING, Any, Callable, Dict, List, cast
from simplipy.const import LOGGER
from simplipy.device import DeviceTypes
from simplipy.... |
cbb2020/gcn | gcn/test.py | # from __future__ import division
# from __future__ import print_function
# import time
# import tensorflow as tf
# from gcn.utils import *
# from gcn.models import GCN, MLP
from utils import load_data
# Set random seed
# seed = 123
# np.random.seed(seed)
# tf.set_random_seed(seed)
# Settings
# flags = tf.app.flags... |
CatTanker/cncnet-discord-bot | discord_utils.py | class DiscordParseException(Exception):
"""An exception that is thrown when parsing Discord's representation of a channel / role / user mention fails."""
def parse_discord_str(content_str: str, type_chars: str) -> int:
"""Parses Discord's representation of a channel / role / user mention into an ID."""
if ... |
CatTanker/cncnet-discord-bot | utils.py | <filename>utils.py
import asyncio
# https://phoolish-philomath.com/asynchronous-task-scheduling-in-python.html
async def run_periodically(wait_time, coro, *args):
"""
Helper for schedule_task_periodically.
Wraps a coroutine in another coroutine that will run the
given coroutine indefinitely
:param... |
CatTanker/cncnet-discord-bot | data_classes.py | <filename>data_classes.py
import json
import discord
from distutils.util import strtobool
from typing import List
from datetime import datetime
from dataclasses import dataclass
from dataclasses_json import dataclass_json
@dataclass_json
@dataclass
class BotConfig(object):
game_name: str = 'CnCNet game'
gam... |
CatTanker/cncnet-discord-bot | irc_client.py | import pydle
import logging
from data_classes import *
Base = pydle.featurize(pydle.features.RFC1459Support, pydle.features.TLSSupport, pydle.features.CTCPSupport)
class IRCClient(Base):
def __init__(self, *args, **kwargs):
self.event_handlers = {}
super().__init__(*args, **kwargs)
def even... |
CatTanker/cncnet-discord-bot | discord_cncnet_bot.py | import discord
import os.path
import asyncio
import logging
import signal
from irc_client import IRCClient
from discord.ext import commands
from discord.ext.commands import has_permissions
from typing import *
from data_classes import *
from discord_utils import *
from utils import *
GAME_TIMEOUT = 35
class Discor... |
jsravn/feed | nginx/fake_graceful_nginx.py | #!/usr/bin/env python3
import signal
import sys
import time
def sigquit_handler(sig, frame):
time.sleep(0.5)
print('Received sigquit, doing graceful shutdown')
sys.exit(0)
# Can't do anything in this handler - python libs are not thread safe, so not safe to call e.g. print.
def sighup_handler(sig, frame)... |
sebastiangithub94/coockietest | {{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/settings/base.py | <gh_stars>0
"""
Django settings for {{ cookiecutter.project_name }} project.
"""
from os import environ, getenv
from os.path import abspath, basename, dirname, join, normpath
from sys import path
########## PATH CONFIGURATION
BASE_DIR = dirname(dirname(__file__) + "../../../")
# Absolute filesystem path to the confi... |
sebastiangithub94/coockietest | {{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/settings/production_example.py | from .base import *
ALLOWED_HOSTS = [
'{{ cookiecutter.domain_name }}',
]
{% if cookiecutter.heroku == "y" or cookiecutter.heroku == "Y" %}
# Parse database configuration from $DATABASE_URL
import dj_database_url
DATABASES['default'] = dj_database_url.config()
# Honor the 'X-Forwarded-Proto' header for request.i... |
wang502/rabbitmq-demo | crawler/amqp/amqp.py | import pika
import os
import sys
# type denotes whether it is producer or consumer queue
class ConnectionManager:
def __init__(self, q_type, queue):
self.connection = None
self.channel = None
self.queue = queue
self.q_type = q_type
if q_type == "PRODUCER":
self.p... |
wang502/rabbitmq-demo | routing/subscribe.py | <gh_stars>0
from amqp.amqp import *
import sys
q_type = "CONSUMER"
exchange = "routing_demo"
ex_type = "direct"
# queue - routing_key pairs
dic = {"ERROR":"errors", "DEBUG": "debugs", "INFO": "infos"}
conn = ConnectionManager(q_type, exchange, ex_type)
conn.get_connection()
conn.init_queue(dic)
print(" [*] Waiting fo... |
wang502/rabbitmq-demo | crawler/crawl.py | <reponame>wang502/rabbitmq-demo
# author: <NAME>
# email: <EMAIL>
# Part of RabbitMQ-Demo project
# crawl.py
# Consume all url messages in message broker, and parse the corresponding web page
##################################################################################
import pika
from bs4 import BeautifulSoup
im... |
wang502/rabbitmq-demo | routing/amqp/amqp.py | <reponame>wang502/rabbitmq-demo
import pika
import os
import sys
import logging
class ConnectionManager:
def __init__(self, q_type, exchange, ex_type):
self.q_type = q_type
self.ex_type = ex_type
self.exchange = exchange
self.connection = None
self.channel = None
if ... |
wang502/rabbitmq-demo | routing/publish.py | <filename>routing/publish.py<gh_stars>0
from amqp.amqp import *
import sys
q_type = "PRODUCER"
exchange = "routing_demo"
ex_type = "direct"
# queue - routing_key pairs
dic = {"ERROR":"errors", "DEBUG": "debugs", "INFO": "infos"}
conn = ConnectionManager(q_type, exchange, ex_type)
conn.get_connection()
conn.init_queue... |
wang502/rabbitmq-demo | HelloWorld/send.py | <reponame>wang502/rabbitmq-demo
import pika
import os
#from amqp import *
import json
from amqp.amqp import *
conn = ConnectionManager("PRODUCER", "hello")
conn.get_connection()
conn.init_queue()
chan = conn.get_channel()
chan.basic_publish(exchange='',
routing_key=conn.queue,
bod... |
wang502/rabbitmq-demo | HelloWorld/receive.py | <filename>HelloWorld/receive.py
import pika
import os
from amqp import *
import json
conn = ConnectionManager("CONSUMER", 'hello')
conn.get_connection()
conn.init_queue()
chan = conn.get_channel()
def callback(ch, method, properties, body):
d = json.loads(body)
print(" [X] Received %r" %(d.get("word")))
chan... |
wang502/rabbitmq-demo | crawler/publish.py | <filename>crawler/publish.py
# author: <NAME>
# email: <EMAIL>
# Part of RabbitMQ-Demo project
# /crawler/publish.py
# Publish list of urls to message broker
################################################
import pika
import os
import sys
from amqp.amqp import *
# set up connection and channel to RabbitMQ server
con... |
joostboonzajerflaes/unofficial_beam_redis | unofficial_beam_redis/io/redisio.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
joostboonzajerflaes/unofficial_beam_redis | setup.py | <reponame>joostboonzajerflaes/unofficial_beam_redis<gh_stars>1-10
from distutils.core import setup
setup(
name = 'unofficial_beam_redis',
packages = ['unofficial_beam_redis', 'unofficial_beam_redis.io'],
version = '0.6',
license='Aapache 2.0',
description = 'An unofficial apache beam sink for redis... |
marceloBarrand/fase4-gr17 | blog/urls.py | <gh_stars>1-10
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from . import views
urlpatterns = [
url(r'^$', views.post_list, name='post_list'),
url(r'^login/$', auth_views.login, {'template_name': 'blog/login.html'}, name='login'),
url(r'^post/(?P<pk>\d+)/$', views.p... |
kokose1234/ChatApp | Tools/packet_type_maker.py | from os import walk
from os.path import join
from posixpath import splitext
from pathlib import Path
def save_packet_header(names, packet_type):
from io import StringIO
import binascii
import shutil
output_str = StringIO()
output_str.write('namespace ChatApp.Common.Net.Packet.Header;\n\npublic en... |
fuaad001/personal-gallery | gallery/models.py | from django.db import models
# Create your models here.
class Location(models.Model):
location_name = models.CharField(max_length = 25)
def __str__(self):
return self.location_name
def save_location(self):
self.save()
def delete_location(location_id):
Location.objects.filter(... |
fuaad001/personal-gallery | gallery/views.py | from django.shortcuts import render, redirect
from django.http import HttpResponse, Http404
from .models import Image, Location, Category, Photographer
# Create your views here.
def index(request):
'''
view function to display landing page
'''
images = Image.objects.all()
return render(request, ... |
fuaad001/personal-gallery | gallery/tests.py | from django.test import TestCase
from .models import Location, Category, Photographer, Image
# Create your tests here.
class LocationTestClass(TestCase):
def setUp(self):
self.loc = Location(location_name = 'Mombasa, Kenya')
# Testing instance
def test_instance(self):
self.assertTrue(isin... |
Zrachel/ERNIE | ernie/client.py | <reponame>Zrachel/ERNIE
#coding=utf-8
import requests
import json
import time
start_time = time.time()
texta = "now suppose you have such a system"
textb = "such thin"
json_data = {'line':[texta, textb]}
r = requests.post('http://10.255.124.15:8808/prob_paddle', json = json_data)
print(json.loads(r.text)['prob'])
prin... |
Zrachel/ERNIE | ernie/finetune/classifier.py | # Copyright (c) 2019 PaddlePaddle Authors. 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/licenses/LICENSE-2.0
#
# Unless required by app... |
Zrachel/ERNIE | ernie/server.py | <reponame>Zrachel/ERNIE
# coding=utf-8
import reader.task_reader as task_reader
from model.ernie import ErnieConfig
from finetune.classifier import create_model_predict, evaluate
from optimization import optimization
from utils.args import print_arguments
from utils.init import init_pretraining_params, init_checkpoint... |
Zrachel/ERNIE | ernie/predict_duanSegment.py | # coding=utf-8
import reader.task_reader as task_reader
from model.ernie import ErnieConfig
from finetune.classifier import create_model_predict
from finetune.classifier import evaluate
from optimization import optimization
from utils.args import print_arguments
from utils.init import init_pretraining_params
from util... |
Zrachel/ERNIE | ernie/script/plot_fscore_duanall.py | <gh_stars>0
import matplotlib.pyplot as plt
import os
import sys
import pdb
def plot_all(dir, id, fileout):
x = []
y = []
stepstart = 20000
for i in range(1000000):
step = stepstart + 2000 * i
#print step
filename=dir + "/" + "step_" + str(step)
if os.path.exists(filenam... |
eL1x/timetable-optimizer | src/Classwork.py |
class Classwork:
def __init__(self, classwork_name, random_day, random_hour, id, num_of_students=0):
self._classwork_name = classwork_name
self._day = random_day
self._hour = random_hour
self._id = id
self._num_of_students = num_of_students
@property
def classwork_... |
eL1x/timetable-optimizer | src/TimetablePlotter.py | <filename>src/TimetablePlotter.py<gh_stars>0
import matplotlib.pyplot as plt
from src.configuration import *
days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']
colors = ['pink', 'lightgreen', 'lightblue', 'wheat', 'salmon']
day_label = 'Timetable'
fig_width = 10
fig_height = 6
def convert_hour(hour):
... |
eL1x/timetable-optimizer | src/Student.py | import random
import src.configuration as conf
class Student:
def __init__(self, id, first_name='Jan', last_name='Kowalski'):
self.id = id
self.first_name = first_name
self.last_name = last_name
self.timetable = []
self.fitness = 0
def generate_random_timetable(self, s... |
eL1x/timetable-optimizer | src/BeeAlgorithm.py | <gh_stars>0
import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import random
from copy import deepcopy
import src.configuration as conf
from src.Bee import Bee
from src.Classwork import Classwork
class BeeAlgorithm:
def __init__(self, num_of_bees, num_of_sites, num_of_elite_... |
eL1x/timetable-optimizer | tests/test_Student.py | <filename>tests/test_Student.py<gh_stars>0
import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import pytest
from src.Student import Student
from src.Subject import Subject
from src.Classwork import Classwork
sub = Subject('First', 1)
@pytest.fixture
def classworks_with_overlapp... |
eL1x/timetable-optimizer | src/configuration.py | DURATION_OF_ONE_CLASSWORK = 90
DURATION_OF_ONE_CLASSWORK_IN_HOURS = 1.5
DIFFERENCE_BETWEEN_STARTING_CLASSES = 15
SLOTS_DURING_ONE_CLASSWORK = 6
NUM_OF_STUDENTS = 50
NUM_OF_BEES = 200
NUM_OF_ELITE_BEES = 100
NUM_OF_OTHER_BEES = 50
NUM_OF_SITES = 50
NUM_OF_ELITE_SITES = 100
PATCH_SIZE = 2
MAX_GENS = 300
MAX_NUM_OF_STUDEN... |
eL1x/timetable-optimizer | src/main.py | import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import src.configuration as conf
import pickle
from src.BeeAlgorithm import BeeAlgorithm
names = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']
for num_of_students in [60, 80, 100]:
for index in [5, 6, 7]:
conf.N... |
eL1x/timetable-optimizer | src/bees_algorithm.py | from src.Bee import Bee
class Population:
def __init__(self, num_of_bees, num_of_students, names_of_subjects):
self.num_of_bees = num_of_bees
self.bees = [Bee(num_of_students, names_of_subjects) for _ in range(num_of_bees)]
def generate_random_population(self, search_space):
f... |
eL1x/timetable-optimizer | src/startingPopulationGenerator.py | <filename>src/startingPopulationGenerator.py<gh_stars>0
import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import src.configuration as conf
from src.Bee import Bee
import pickle
starting_population = [Bee(conf.NUM_OF_STUDENTS, conf.NAMES_OF_SUBJECTS) for _ in range(conf.NUM_OF_BE... |
eL1x/timetable-optimizer | src/Bee.py | <gh_stars>0
from src.Student import Student
from src.Subject import Subject
from src.configuration import MAX_NUM_OF_STUDENTS, SPARE_TERMS
import random
class Bee:
def __init__(self, num_of_students, names_of_subjects):
self.students = [Student(id) for id in range(num_of_students)]
self.num_of_ter... |
eL1x/timetable-optimizer | src/Plotter.py | import matplotlib.pyplot as plt
class Plotter:
def plot_cost_function(self, cost_function):
plt.plot(cost_function)
plt.xlabel('Number of iterations')
plt.ylabel('Value of cost function')
plt.title('Optimization process')
plt.show()
|
eL1x/timetable-optimizer | src/Subject.py | import random
from src.Classwork import Classwork
import src.configuration as conf
class Subject:
def __init__(self, name, id, num_of_terms):
self.id = id
self.name = name
self.num_of_terms = num_of_terms
self.terms = []
def generate_random_terms(self):
for index in ra... |
rhasoff/SA-Flask-WTForms | app.py | from flask import Flask, render_template
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, \
SubmitField
from wtforms.validators import ValidationError, DataRequired, \
Email, EqualTo, Length
app = Flask(__name__, template_folder='.')
app.conf... |
Rubtsowa/numba | numba/cuda/decorators.py | from __future__ import print_function, absolute_import, division
from numba import config, sigutils, types
from warnings import warn
from .compiler import (compile_kernel, compile_device, declare_device_function,
AutoJitCUDAKernel, compile_device_template)
from .simulator.kernel import FakeCUDAKe... |
jdbrice/root-io | rootio/TDirectory.py | <reponame>jdbrice/root-io<filename>rootio/TDirectory.py
from rootio import TBuffer
class TDirectory (object) :
def __init__(self, file, dirname, cycle) :
self.fFile = file
self._typename = "TDirectory"
self.dir_name = dirname
self.dir_cycle = cycle
self.fKeys = []
def to_json( self ) :
obj = {
'fSee... |
jdbrice/root-io | rootio/ROOT.py | <reponame>jdbrice/root-io
# -*- coding: utf-8 -*-
# @Author: jdb
# @Date: 2017-06-14 17:52:34
# @Last Modified by: Daniel
# @Last Modified time: 2017-09-21 09:23:26
import logging
from . import UnZip
import json
from rootio.StreamerDict import Streamers
from rootio.IOData import IOData
def BIT( n ) :
return (1... |
jdbrice/root-io | rootio/ttree/TTree.py |
from box import Box
class TTree(object):
def __init__(self):
pass
def draw(self, args):
if str == type(args):
args = { "expr" : args }
args = Box(args)
if "expr" not in args or None == args['expr']:
args['expr'] = ""
selec... |
jdbrice/root-io | rootio/ttree/TDrawVariable.py | <gh_stars>1-10
class TDrawVariable(object) :
def __init__(self):
pass |
jdbrice/root-io | rootio/Histogram.py | import logging
import matplotlib.pyplot as plt
import numpy as np
import copy
import sys
from IPython.display import display
class Histogram(object) :
def __init__(self, hist_obj=None) :
self.logger = logging.getLogger( "rootio.TFile" )
# disctionary of edges for axes
self.edges ... |
jdbrice/root-io | rootio/StreamerDict.py | <reponame>jdbrice/root-io
import rootio.CustomStreamers as CustomStreamers
import rootio.DirectStreamers as DirectStreamers
from box import Box
# Does Not work!!!
StreamerDict = {
"CustomStreamers" : {
"TList" : CustomStreamers.TList,
"TObject" : CustomStreamers.TObject,
"TNamed" : [
... |
jdbrice/root-io | rootio/DirectStreamers.py | <filename>rootio/DirectStreamers.py
import logging
# from pdb import set_trace as bp
def TKey( buf, key ) :
logging.getLogger("DirectStreamers.TKey").debug( "( buf=%s, obj=%s )", buf, key )
key['fNbytes'] = buf.ntoi4()
key['fVersion'] = buf.ntoi2()
key['fObjlen'] = buf.ntou4()
key['fDatime'] = buf.ClassStrea... |
jdbrice/root-io | rootio/CustomStreamers.py |
import sys
import logging
from rootio.IOData import IOData, BIT
import math
import json
def TList( buf, obj ) :
logging.getLogger("CustomStreamers.TList").debug( "TList( buf=%s, obj=%s )", buf, obj )
# stream all objects in the list from the I/O buffer
if '_typename' not in obj :
obj['_typename'] = "TList";
# o... |
jdbrice/root-io | rootio/ttree/TSelector.py | <reponame>jdbrice/root-io<filename>rootio/ttree/TSelector.py
class TSelector(object) :
def __init__(self) :
self.branches = [] # list of branches to read
self.names = [] # list of member names for each branch in tgtobj
self.directs = [] # indication if only branch without any... |
jdbrice/root-io | rootio/TBuffer.py | # -*- coding: utf-8 -*-
# @Author: jdb
# @Date: 2017-06-14 17:36:08
# @Last Modified by: Daniel
# @Last Modified time: 2017-09-26 17:47:21
from rootio.ROOT import ROOT as ROOT
from rootio.StreamerDict import Streamers
from rootio.IOData import IOData
import struct
import logging
import json
import sys
class TBuff... |
jdbrice/root-io | rootio/TFile.py | import rootio.ROOT as ROOT
from rootio import TBuffer
from rootio import TDirectory
from rootio.StreamerDict import Streamers
from rootio.IOData import IOData
import os
import logging
from . import UnZip
import box
import json
class TFile (object) :
def __init__(self, url) :
self.logger = logging.getLogger( "r... |
jdbrice/root-io | rootio/ROOTJS.py | <filename>rootio/ROOTJS.py<gh_stars>1-10
from IPython.display import display
import logging
import json
class ROOTJS(object) :
LOAD_MIMETYPE = "application/vnd.rootjs_load.v0+json"
EXEC_MIMETYPE = "application/vnd.rootjs_exec.v0+json"
JS_MIMETYPE = "application/javascript"
HTML_MIMETYPE = "... |
jdbrice/root-io | rootio/ttree/TDrawSelector.py | <reponame>jdbrice/root-io
from rootio.ttree.TSelector import TSelector
from rootio.ttree.TDrawVariable import TDrawVariable
import logging
class TDrawSelector(TSelector):
def __init__(self):
self.logger = logging.getLogger("TDrawSelector")
self.ndim = 0
self.vars = [] # array of expression... |
jdbrice/root-io | rootio/IOData.py | <filename>rootio/IOData.py
from box import Box
def BIT( n ) :
return (1 << n)
io_data = {
"kBase": 0, "kOffsetL": 20, "kOffsetP": 40,
"kChar": 1, "kShort": 2, "kInt": 3, "kLong": 4, "kFloat": 5, "kCounter": 6, "kCharStar": 7, "kDouble": 8, "kDouble32": 9, "kLegacyChar ": 10,
"kUChar": 11, "kUShort":... |
jdbrice/root-io | rootio/UnZip.py | <gh_stars>1-10
import struct
import zlib
import gzip
import logging
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
def getChar( arr, curr ) :
return struct.unpack( 'c', arr[curr:curr+1] )[0]
def getCode( arr, curr ) :
return struct.unpack( 'b', arr[curr:curr+1] )[0]
def R_... |
jdbrice/root-io | tests/__init__.py | from __future__ import absolute_import
import unittest
import doctest
import sys
import os
def main():
runner = unittest.TextTestRunner(verbosity=1 + sys.argv.count('-v'))
# suite = all_tests_suite()
# raise SystemExit(not runner.run(suite).wasSuccessful())
if __name__ == '__main__':
import os
... |
jdbrice/root-io | rootio/__init__.py | <reponame>jdbrice/root-io
version = "0.0.1"
from .TBuffer import TBuffer
from .TFile import TFile
from .TDirectory import TDirectory
from .Histogram import Histogram
from .ROOTJS import ROOTJS
|
jdbrice/root-io | tests/read_file_object.py | # -*- coding: utf-8 -*-
# @Author: jdb
# @Date: 2017-06-14 17:36:12
# @Last Modified by: Daniel
# @Last Modified time: 2017-09-21 11:11:23
import rootio.TBuffer as TBuffer
from rootio.TFile import TFile
import json
import rootio.make_json_serializable
import logging
import sys
logging.basicConfig(filename='examp... |
xebialabs-community/xlr-logreport-plugin | src/main/resources/restapi/logger/getLogConfig.py | # Copyright 2020 XEBIALABS
#
# 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, copy, modify, merge, publish, distribute, sublice... |
xebialabs-community/xlr-logreport-plugin | src/main/resources/restapi/logger/generatelogger2.py | # Copyright 2020 XEBIALABS
#
# 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, copy, modify, merge, publish, distribute, sublice... |
xebialabs-community/xlr-logreport-plugin | src/main/resources/restapi/logger/getLogAppenders.py | <filename>src/main/resources/restapi/logger/getLogAppenders.py
# Copyright 2020 XEBIALABS
#
# 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 r... |
ahmedbilal/whoishiring | whoishiring/whoishiring.py | <reponame>ahmedbilal/whoishiring
import argparse
import re
import webbrowser
from urllib.parse import urljoin
import bs4
import requests
def extract_comment(element):
if isinstance(element, bs4.element.Tag):
# if the comment have img with 0 width, it means that the comment
# is actual comment not... |
itsMagondu/IoTNeuralNetworks | noisefilter/apps/filter/models.py | from __future__ import unicode_literals
from django.db import models
class Data(models.Model):
reading = models.FloatField(null=True, blank=True)
prevreading = models.FloatField(null=True, blank=True)
output = models.FloatField(null=True, blank=True)
error = models.FloatField(null=True, blank=True)
... |
itsMagondu/IoTNeuralNetworks | noisefilter/noisefilter/__init__.py | <reponame>itsMagondu/IoTNeuralNetworks
""" noisefilter """
|
itsMagondu/IoTNeuralNetworks | noisefilter/apps/filter/kalmanfilter.py | # Kalman filter in Python adopted from http://scipy-cookbook.readthedocs.io/items/KalmanFiltering.html
import numpy as np
import matplotlib.pyplot as plt
import time
class KalmanFilter:
def __init__(self, base_value=24, iterations=200, initial_guess=20.0, posteri_estimate=4.0, data=[], plot=False):
# inti... |
itsMagondu/IoTNeuralNetworks | noisefilter/apps/filter/urls.py | """urlconf for the base application"""
from django.conf.urls import url
from .views import *
urlpatterns = [
url(r'^ann/$', ANNView.as_view(), name='ann'),
url(r'^kalman/$', KalmanView.as_view(), name='kalman'),
url(r'^$', index, name='index'),
] |
itsMagondu/IoTNeuralNetworks | noisefilter/apps/filter/neuralnetwork.py | <filename>noisefilter/apps/filter/neuralnetwork.py<gh_stars>0
from __future__ import division
import numpy as np
def tanh(x):
return np.tanh(x)
def tanh_deriv(x):
return 1.0 - np.tanh(x)**2
def logistic(x):
return 1/(1 + np.exp(-x))
def logistic_derivative(x):
return logistic(x)*(1-logistic(x))
def... |
itsMagondu/IoTNeuralNetworks | noisefilter/apps/filter/views.py | <gh_stars>0
import numpy as np
import time
import json
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from django.http import HttpResponseRedirect, HttpResponse, JsonResponse
from django.views.generic.base import TemplateView
from django.core import serializers
from django.shortcuts impor... |
itsMagondu/IoTNeuralNetworks | noisefilter/apps/filter/admin.py | from django.contrib import admin
from .models import (Data, KalmanConfiguration, ANNConfiguration, TrainingExample,
AnnResult, KalmanResult)
# Register your models here.
class DataAdmin(admin.ModelAdmin):
fields = ['reading', 'prevreading', 'output', 'error', 'truevalue', 'kalmanvalue']
l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.