repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
kianpu34593/base4gpaw
BASIC/optimizer.py
<filename>BASIC/optimizer.py import os from ase.eos import EquationOfState from ase.optimize import BFGS from gpaw import GPAW from ase.io.trajectory import Trajectory from ase.io import read,write from fractions import Fraction import numpy as np from ase.dft.bee import BEEFEnsemble from ase.parallel import parprint,w...
kianpu34593/base4gpaw
tutorial/Cu_bulk.py
<filename>tutorial/Cu_bulk.py from gpaw import GPAW,Mixer,Davidson from ase.calculators.calculator import kptdensity2monkhorstpack as kdens2mp from actgpaw import bulk_autoconv as bulk_ac # input the material element = 'Cu_mp-30' #the name should be the same as the cif file element_atom = bulk_ac.bulk_builder(element)...
kianpu34593/base4gpaw
BASIC/tests/test_actgpaw.py
""" Unit and regression test for the actgpaw package. """ # Import package, test suite, and other packages as needed import actgpaw import pytest import sys def test_actgpaw_imported(): """Sample test, will always pass so long as import statement worked""" assert "actgpaw" in sys.modules
kianpu34593/base4gpaw
BASIC/__init__.py
""" BASIC A Python package for Bulk Adsorption Surface energy calculation with automatIc Convergence """ # Add imports here from .utils import * # Handle versioneer from ._version import get_versions versions = get_versions() __version__ = versions['version'] __git_revision__ = versions['full-revisionid'] del get_ver...
kianpu34593/base4gpaw
tutorial/Cu_surf.py
from ase.db import connect from gpaw import GPAW, Mixer, MixerDif, Davidson, PoissonSolver from actgpaw import surf_autoconv as surf_ac # read the optimized conventional cell in the database element = "Cu_mp-30" element_bulk = connect("final_database/bulk.db").get(name=element) h = element_bulk.h xc = element_bulk.xc ...
kianpu34593/base4gpaw
BASIC/surface.py
from pymatgen.core.surface import SlabGenerator, generate_all_slabs from pymatgen.io.ase import AseAtomsAdaptor from ase.db import connect from ase.build import surface from pymatgen.io.cif import CifWriter import numpy as np from collections import Counter from itertools import chain from pymatgen.analysis.adsorptio...
kianpu34593/base4gpaw
BASIC/surf_autoconv.py
<reponame>kianpu34593/base4gpaw from gpaw import GPAW,Mixer,MixerDif,MixerSum,Davidson from ase.constraints import FixAtoms from ase.build import surface from ase.io import write,read from ase.db import connect import os import BASIC.optimizer as opt from ase.parallel import parprint,paropen,world import numpy as np im...
kianpu34593/base4gpaw
BASIC/converge_calc.py
<reponame>kianpu34593/base4gpaw import os from typing import Type from ase.parallel import paropen, parprint, world from ase.db import connect from ase.io import read from glob import glob import numpy as np from gpaw import restart import BASIC.optimizer as opt import sys from ase.calculators.calculator import kptdens...
kianpu34593/base4gpaw
BASIC/non_converge_calc.py
from copy import Error import os from typing import Type from ase.parallel import paropen, parprint, world from ase.db import connect from ase.io import read from glob import glob import numpy as np from gpaw import restart import BASIC.optimizer as opt import sys from ase.constraints import FixAtoms,FixedLine import p...
kianpu34593/base4gpaw
BASIC/utils.py
import os import sys from pymatgen.io.cif import CifWriter from pymatgen.core.structure import Structure from pymatgen.ext.matproj import MPRester from autocat import adsorption from ase.db import connect from pymatgen.core.surface import SlabGenerator, generate_all_slabs from pymatgen.io.ase import AseAtomsAdaptor fro...
peterfabakker/pyEX
pyEX/stats.py
import pandas as pd from datetime import datetime from .common import _getJson, PyEXception, _strOrDate, _reindex, _toDatetime def stats(token='', version='', filter=''): '''https://iexcloud.io/docs/api/#stats-intraday Args: token (string); Access token version (string); API version f...
liuqiaoping7/tensorflow
tensorflow/python/saved_model/load_v1_in_v2.py
# Copyright 2019 The TensorFlow 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 applica...
liuqiaoping7/tensorflow
tensorflow/python/keras/callbacks.py
<filename>tensorflow/python/keras/callbacks.py # Copyright 2015 The TensorFlow 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/lice...
prashanthellina/livereload_server
setup.py
from setuptools import setup, find_packages setup( name="livereload_server", version='0.1', description="A livereloading HTTP server for static files", keywords='http,server,livereload', author='<NAME>', author_email="Use the github issues", url="https://github.com/prashanthellina/livereloa...
prashanthellina/livereload_server
livereload_server/__init__.py
#!/usr/bin/env python import os import re import argparse import mimetypes from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler import tornado.ioloop import tornado.web # This JS snippet below is embedded dynamically in every # HTML response sent back from this server. The JS co...
ServiceAndMaintenance/SNM-Email-Crawler
email_crawler.py
<reponame>ServiceAndMaintenance/SNM-Email-Crawler import urllib,re fot = open("emails.csv", "a+") filepath = 'urls.csv' with open(filepath) as fp: line = fp.readline() cnt = 1 while line: print("Line {}: {}".format(cnt, line.strip())) line = fp.readline() site = line f = urllib.urlopen(line) s = f.read...
RenaudBCEREMA/gpn-gitlearn
exercice/script.py
class Complex(): def __init__(self, Re, Im) : self.Re = Re self.Im = Im def add(self, A) : pass def sub(self,B) : pass def norm(self) : pass def arg(self): pass def __str__(self) -> str: return f"" if __name__ == '__main__': A ...
observerss/python.ts
plugins/Dummy/__init__.py
<gh_stars>10-100 #!/usr/bin/env python # -*- coding: utf-8 -*- class Dummy: def dummy(self): return "dummy"
observerss/python.ts
plugins/MultiProcessor.py
<gh_stars>10-100 #!/usr/bin/env # -*- coding: utf-8 -*- import multiprocessing as mp import random import time from concurrent.futures import ProcessPoolExecutor if mp.get_start_method() == "fork": methods = mp.get_all_start_methods() mp.set_start_method("forkserver" if "forkserver" in methods else "spawn", fo...
observerss/python.ts
plugins/Excel/__init__.py
import openpyxl class Excel: def __init__(self): self.workbook = None def open_workbook(self, name): self.workbook = openpyxl.open(name) def read_cell(self, row: int, col: int): return self.workbook.active._cells[(row + 1, col + 1)].value def write_cell(self, row: int, col: ...
observerss/python.ts
plugins/Threader.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Threader: 用于测试多线程的模块""" import random import threading import time from concurrent.futures import ThreadPoolExecutor executor = ThreadPoolExecutor(10) lock = threading.Lock() counter = 0 def incr(value: int): global counter # sleep 0 - 0.0001 second time.s...
vathanahim/API_Clean_Up
test.py
import numpy as np import streamlit as st import pandas as pd import requests import json from pandas.io.json import json_normalize import matplotlib.pyplot as plt import plotly.express as px from streamlit.file_util import streamlit_read url = "https://api.yelp.com/v3/businesses/search" api_key = '<KEY...
Alberto-X3/Alberto-X3
Utils.py
<reponame>Alberto-X3/Alberto-X3 import discord from typing import * from NewClass import AttrDict from json import load from traceback import format_exc from io import BytesIO ''' You can see all the events in the following URL: https://discordpy.readthedocs.io/en/latest/api.html#event-reference ''' EVENT = AttrD...
Alberto-X3/Alberto-X3
Modules/nicks.py
<reponame>Alberto-X3/Alberto-X3 from discord import Client, Member from Utils import Help, EVENT, send_exception HELP = Help(vanish=True, order_1793=True) EVENTS = [EVENT.on_member_update, EVENT.on_ready] sep = " | " DEV = "Dev" MOD = "Mod" SUP = "Sup" VIP = "VIP" SLY = "Sly" ALB = "Aty" nicks = { 8322446305820...
Alberto-X3/Alberto-X3
Modules/ban.py
import discord import Utils HELP = Utils.Help("bans a user by iD", f"_{Utils.Prefix}ban iD (reason)_\nrequires Admin.ban") EVENTS = [Utils.EVENT.on_message] ALIASES = [] async def __main__(client: discord.Client, _event: int, message: discord.Message): try: user_perms = Utils.perms(str(message.author.id...
Alberto-X3/Alberto-X3
NewClass/__init__.py
<reponame>Alberto-X3/Alberto-X3<filename>NewClass/__init__.py __author__ = "<NAME>" from .AttrDict import AttrDict
Alberto-X3/Alberto-X3
Modules/ping.py
<gh_stars>1-10 import discord import Utils import datetime HELP = Utils.Help("shows the ping") EVENTS = [Utils.EVENT.on_message] ALIASES = ["🏓"] async def __main__(client: discord.Client, _event: int, message: discord.Message): try: api: float = round(client.latency, 2) msg: float = round((date...
Alberto-X3/Alberto-X3
Modules/credits.py
import discord import Utils HELP = Utils.Help("displays the credits", "here are the credits with the code...") EVENTS = [Utils.EVENT.on_message] ALIASES = ["c", "code"] async def __main__(client: discord.Client, _event: int, message: discord.Message): try: await message.channel.send(embed=discord.Embed(d...
Alberto-X3/Alberto-X3
Modules/restart.py
import discord import Utils HELP = Utils.Help("restarts the Bot", "requires Admin.Bot.restart") EVENTS = [Utils.EVENT.on_message] ALIASES = ["re"] async def __main__(client: discord.Client, _event: int, message: discord.Message): try: user_perms = Utils.perms(str(message.author.id)) if user_per...
Alberto-X3/Alberto-X3
Modules/antispam.py
import discord import Utils from datetime import timedelta HELP = Utils.Help(vanish=True, order_1793=True) EVENTS = [Utils.EVENT.on_message] async def __main__(client: discord.Client, _event: int, message: discord.Message): try: if message.author.bot or message.author.id in Utils.DATA.IDs.Admins or mes...
Alberto-X3/Alberto-X3
Modules/blacklisted_chars.py
<reponame>Alberto-X3/Alberto-X3<filename>Modules/blacklisted_chars.py """ deletes all messages with blacklisted content only """ from discord import Message, Client from Utils import Help, EVENT, send_exception HELP = Help(vanish=True, order_1793=True) EVENTS = [EVENT.on_message] BLACKLISTED = ( "\u200b", "\...
Alberto-X3/Alberto-X3
NewClass/AttrDict.py
from typing import * _KT = TypeVar('KT') # Key type. _VT = TypeVar('VT') # Value type. _VT_co = TypeVar('VT_co', covariant=True) # Value type covariant containers. class AttrDict(dict): def __init__(self, data: dict) -> None: for key in list(data.keys()): if type(data[key]) == dict...
Alberto-X3/Alberto-X3
Modules/new_talk.py
import discord import Utils from random import randrange EVENTS = [Utils.EVENT.on_voice_state_update] name_range = [1, 1793] async def __main__(client: discord.Client, _event: int, member: discord.Member, before: discord.VoiceState, after: discord.VoiceState): try: if before.channel i...
Alberto-X3/Alberto-X3
Modules/super_logger.py
from discord import Client, Message, Member, User, VoiceState, Role, TextChannel, Embed, Color, File from Utils import Help, Union, EVENT, DATA, send_exception HELP = Help(vanish=True, order_2004=True) EVENTS = [ EVENT.on_message, EVENT.on_message_delete, EVENT.on_message_edit, EVENT.on_ready, EVE...
Alberto-X3/Alberto-X3
Modules/no_dead_chat.py
<reponame>Alberto-X3/Alberto-X3<gh_stars>1-10 """ deletes message with "https://tenor.com/view/pacman-gif-21447981" only content and sends "https://tenor.com/view/server-chat-is-dead-stayin-alive-ive-been-kick-aroud-active-members-gif-17860742" to the chat """ from discord import Message, Client from Utils import Help,...
Alberto-X3/Alberto-X3
levels_config_sqlite.py
<filename>levels_config_sqlite.py """ DB-Structure: ======================== lvl: ------------------------ :user:<int> ID from the user :level:<int> LVL from the user :xp:<int> XP from the user """ from sqlite3 import connect create = "CREATE TABLE IF NOT EXISTS lvl\n" \ "(user integer, level i...
Alberto-X3/Alberto-X3
Modules/ping_me_for_help.py
import discord import Utils HELP = Utils.Help(vanish=True, order_1793=True) EVENTS = [Utils.EVENT.on_message] async def __main__(client: discord.Client, _event: int, message: discord.Message): try: if message.content == client.user.mention: await message.channel.send(f"My Prefix is `{Utils.P...
Alberto-X3/Alberto-X3
Modules/debugger.py
import discord import Utils HELP = Utils.Help(_help="Is a module for debugging the bot", vanish=True) EVENTS = [Utils.EVENT.on_message] ALIASES = ["db", "debug", "bug", "bugs", "exception", "exceptions", "error", "errors"] async def __main__(client: discord.Client, _event: int, message: discord.Message): try: ...
Alberto-X3/Alberto-X3
Modules/delete.py
import discord import Utils HELP = Utils.Help("deletes the amount of messages (max 99)", f"_{Utils.Prefix}delete iD (reason)_") EVENTS = [Utils.EVENT.on_message] ALIASES = ["del"] async def __main__(client: discord.Client, _event: int, message: discord.Message): try: user_perms = Utils.perms(str(message...
Alberto-X3/Alberto-X3
Modules/archived_modules/admin.py
<gh_stars>1-10 import discord import Utils from os import listdir from json import load DATA = Utils.AttrDict(load(open("Configs.json"))) Prefix = DATA.CONSTANTS.Prefix author = DATA.Author author_id = DATA.Author_id HELP = Utils.Help(vanish=True) EVENTS = [Utils.EVENT.on_message] async def __main__(client: discor...
Alberto-X3/Alberto-X3
Modules/img.py
<reponame>Alberto-X3/Alberto-X3<filename>Modules/img.py import discord import Utils HELP = Utils.Help("lists all profiles", "shows you the history from all profiles of the Bot and the creator") EVENTS = [Utils.EVENT.on_message] ALIASES = ["imgs", "profile", "profiles"] _00 = "https://media.discordapp.net/attachments...
Alberto-X3/Alberto-X3
Modules/sticky_roles.py
""" adds automatically a role to a member to have it "clued" on the member """ from discord import Member, Client, Guild from Utils import EVENT, send_exception EVENTS = [EVENT.on_member_update, EVENT.on_ready] ROLES = { "WARNING: SPOILER!!!": 861238496484130816, "WARNING: NO PERMS FOR THIS PERSON!!!": 86132...
Alberto-X3/Alberto-X3
Modules/rules.py
import discord import Utils EVENTS = [Utils.EVENT.on_raw_reaction_add, Utils.EVENT.on_ready] async def __main__(client: discord.Client, _event: int, reaction: discord.RawReactionActionEvent = None): try: if _event == Utils.EVENT.on_raw_reaction_add: await accept(client, reaction) if...
Alberto-X3/Alberto-X3
Modules/kill.py
import discord import Utils HELP = Utils.Help("~~kills the Bot...~~ really dangerous", "is very dangerous... so be careful with it\nrequires Admin.Bot.kill") EVENTS = [Utils.EVENT.on_message] ALIASES = ["most-dangerous-cmd"] async def __main__(client: discord.Client, _event: int, message: discord.Message): try:...
Alberto-X3/Alberto-X3
Modules/kick.py
<reponame>Alberto-X3/Alberto-X3 import discord import Utils HELP = Utils.Help(f"kicks a user by iD", f"_{Utils.Prefix}kick iD (reason)_\nrequires Admin.kick") EVENTS = [Utils.EVENT.on_message] async def __main__(client: discord.Client, _event: int, message: discord.Message): try: user_perms = Utils.perm...
Alberto-X3/Alberto-X3
Modules/join.py
import discord import Utils import datetime EVENTS = [Utils.EVENT.on_member_join, Utils.EVENT.on_member_remove] async def __main__(client: discord.Client, _event: int, member: discord.Member): try: channel = await client.fetch_channel(Utils.DATA.IDs.Channels.Welcome) if _event == Utils.EVENT.on...
Alberto-X3/Alberto-X3
Modules/unban.py
import discord import Utils from json import load HELP = Utils.Help("unbans a user with the given iD", f"_{Utils.Prefix}unban iD (reason)_\nrequires Admin.unban") EVENTS = [Utils.EVENT.on_message] ALIASES = [] async def __main__(client: discord.Client, _event: int, message: discord.Message): try: user_...
Alberto-X3/Alberto-X3
Modules/perms.py
<gh_stars>1-10 import discord import Utils HELP = Utils.Help(f"shows you your permissions", f""" > *{Utils.Prefix}perms* shows you your perms > *{Utils.Prefix}perms [USER-ID|USER-MENTION]* shows you perms from other > *{Utils.Prefix}perms [USER-ID|USER-MENTION] [add|+] [PERMISSION]* adds permissions for a user > *...
Alberto-X3/Alberto-X3
Modules/event_cardgifter2020_cards.py
import discord import Utils HELP = Utils.Help(order_2004=True, vanish=True) EVENTS = [Utils.EVENT.on_message] ALIASES = [] async def __main__(client: discord.Client, _event: int, message: discord.Message): try: if message.channel.id != 821843251195412530: return log: discord.TextCha...
Alberto-X3/Alberto-X3
Modules/level.py
from discord import Embed, Client, Message, Role, NotFound, Member, User from Utils import Help, EVENT, send_exception, Prefix, DATA from sqlite3 import connect from random import choice from typing import Tuple, Dict, Union from datetime import datetime, timedelta HELP = Help("shows you your XP", f"{Prefix}level (iD...
Alberto-X3/Alberto-X3
Modules/on_ready.py
import discord import Utils from typing import List from asyncio import sleep from datetime import datetime, timedelta from aiohttp import ClientSession EVENTS = [Utils.EVENT.on_ready] async def __main__(client: discord.Client, _event: int): try: print(f"Logged in as {client.user}") await clie...
Alberto-X3/Alberto-X3
Modules/__init__.py
from os import listdir import importlib import Utils MODULES = [module.replace(".py", "") for module in listdir("./Modules") if module.endswith(".py") and not module == "__init__.py"] libs = {} for lib in MODULES.copy(): libs[lib] = importlib.import_module(f"Modules.{lib}") if not hasattr(libs[lib], "__ma...
Alberto-X3/Alberto-X3
Modules/mars.py
from aiohttp import ClientSession, ClientResponse from discord import Client, Message, Embed from datetime import datetime, timedelta from asyncio import sleep as asleep import Utils HELP = Utils.Help("shows recent pictures from Mars") EVENTS = [Utils.EVENT.on_message] ALIASES = ["m"] # only got better reading days...
Alberto-X3/Alberto-X3
Bot.py
<gh_stars>1-10 from typing import * from asyncio import create_task import datetime import discord import Modules import Utils # to be sure, that there is a DB import levels_config_sqlite del levels_config_sqlite intents = discord.Intents.all() client = discord.Client(intents=intents) TOKEN = Utils.DATA.CONSTANTS.T...
Alberto-X3/Alberto-X3
Modules/corona_status.py
<filename>Modules/corona_status.py import discord import Utils from datetime import datetime, timedelta from asyncio import sleep from aiohttp import ClientSession, ClientResponse EVENTS = [Utils.EVENT.on_raw_reaction_add, Utils.EVENT.on_ready] id_channel: int = 808742319066579014 id_message: int = 80904849118671673...
wolcomm/eos-prefix-list-agent
prefix_list_agent/worker.py
<filename>prefix_list_agent/worker.py<gh_stars>1-10 # Copyright (c) 2019 <NAME>. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to in writing, soft...
wolcomm/eos-prefix-list-agent
tests/00_unit/test_exceptions.py
<reponame>wolcomm/eos-prefix-list-agent # Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to...
wolcomm/eos-prefix-list-agent
tests/01_integration/conftest.py
<reponame>wolcomm/eos-prefix-list-agent<gh_stars>1-10 # Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable la...
wolcomm/eos-prefix-list-agent
prefix_list_agent/agent.py
# Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to in writing, software # distributed unde...
wolcomm/eos-prefix-list-agent
tests/01_integration/test_agent_daemon.py
# Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to in writing, software # distributed unde...
wolcomm/eos-prefix-list-agent
tests/00_unit/test_agent.py
# Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to in writing, software # distributed unde...
wolcomm/eos-prefix-list-agent
tests/00_unit/test_worker.py
# Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to in writing, software # distributed unde...
wolcomm/eos-prefix-list-agent
prefix_list_agent/__meta__.py
<reponame>wolcomm/eos-prefix-list-agent #!/usr/bin/env python # Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by appli...
wolcomm/eos-prefix-list-agent
prefix_list_agent/cli.py
<filename>prefix_list_agent/cli.py # Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to in w...
wolcomm/eos-prefix-list-agent
tests/00_unit/test_cli.py
<gh_stars>1-10 # Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to in writing, software # d...
wolcomm/eos-prefix-list-agent
tests/00_unit/test_base.py
<filename>tests/00_unit/test_base.py # Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to in...
wolcomm/eos-prefix-list-agent
tests/00_unit/conftest.py
# Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to in writing, software # distributed unde...
wolcomm/eos-prefix-list-agent
tests/01_integration/rptk_stub.py
<reponame>wolcomm/eos-prefix-list-agent # Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to...
wolcomm/eos-prefix-list-agent
prefix_list_agent/exceptions.py
# Copyright (c) 2019 Workonline Communications (Pty) Ltd. All rights reserved. # # The contents of this file are licensed under the MIT License # (the "License"); you may not use this file except in compliance with the # License. # # Unless required by applicable law or agreed to in writing, software # distributed unde...
LordPov/net-tests
summary.py
#!/usr/bin/env python import fnmatch import os def find_files(pattern, location='.'): for file in os.listdir(location): if fnmatch.fnmatch(file, pattern): yield file def extract_times(file): all_times = [] for line in open(file): if 'icmp_seq' in line: all_times....
LordPov/net-tests
summary-g.py
<reponame>LordPov/net-tests #!/usr/bin/env python import summary summary.summary('pt-g-*')
LordPov/net-tests
summary-s.py
<filename>summary-s.py #!/usr/bin/env python import summary def extract_speeds(file): for line in open(file): if 'Download:' in line: download = float(line.split(' ')[1]) elif 'Upload:' in line: upload = float(line.split(' ')[1]) return download, upload def output(s...
LordPov/net-tests
summary-t.py
<reponame>LordPov/net-tests<filename>summary-t.py #!/usr/bin/env python import summary summary.summary('pt-t-*')
subhajeet2107/pylexer
pylex/config/lexer_dict_config.py
<reponame>subhajeet2107/pylexer """ * This file is part of the subhajeet2107/pylexer package. * * (c) <NAME> <<EMAIL>> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. """ from pylex.config.lexer_config import LexerConfig from pylex.config.token_defin...
subhajeet2107/pylexer
tests/test_lexer.py
import unittest from pylex.config.lexer_dict_config import LexerDictConfig from pylex.token import Token from pylex.lexer import PyLexer class TestLexer(unittest.TestCase): def get_algebra_config(self): return LexerDictConfig({ '\\s' : '', '\\d+': 'number', '\\+' : 'plus', '-' : 'minus', '\\*' : 'm...
subhajeet2107/pylexer
pylex/error/custom_exception.py
""" * This file is part of the subhajeet2107/pylexer package. * * (c) <NAME> <<EMAIL>> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. """ class UnknownTokenException(Exception): pass class IllegalArgumentError(ValueError): pass
subhajeet2107/pylexer
setup.py
from setuptools import setup, find_packages version = '1.0.0' license = 'MIT License' setup( name = 'pylexer', version = version, license = license, author = '<NAME>', author_email = '<EMAIL>', url = 'https://github.com/subhajeet2107/pylexer/', long_description_content_type='text/markdown'...
subhajeet2107/pylexer
pylex/config/lexer_config.py
<gh_stars>0 """ * This file is part of the subhajeet2107/pylexer package. * * (c) <NAME> <<EMAIL>> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. """ import abc, six @six.add_metaclass(abc.ABCMeta) class LexerConfig: """ Lexer Config base ...
subhajeet2107/pylexer
pylex/token.py
""" * This file is part of the subhajeet2107/pylexer package. * * (c) <NAME> <<EMAIL>> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. """ from pylex.error.custom_exception import IllegalArgumentError class Token: """ Token Implementation class...
subhajeet2107/pylexer
pylex/lexer.py
<reponame>subhajeet2107/pylexer """ * This file is part of the subhajeet2107/pylexer package. * * (c) <NAME> <<EMAIL>> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. """ import re from pylex.config.lexer_config import LexerConfig from pylex.error.cu...
subhajeet2107/pylexer
pylex/config/token_defination.py
<filename>pylex/config/token_defination.py """ * This file is part of the subhajeet2107/pylexer package. * * (c) <NAME> <<EMAIL>> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. """ import re from pylex.error.custom_exception import IllegalArgumentEr...
utya/sms-gammu-gateway
run.py
<reponame>utya/sms-gammu-gateway import os from flask import Flask from flask_httpauth import HTTPBasicAuth from flask_restful import reqparse, Api, Resource, abort from support import load_user_data, init_state_machine pin = os.getenv('PIN', None) ssl = os.getenv('SSL', False) user_data = load_user_data() machine =...
numb3r33/Xtreme-ML-HACK
src/models/cross_validation.py
<filename>src/models/cross_validation.py import numpy as np from sklearn.metrics import mean_squared_error import matplotlib.pyplot as plt def cross_validate_contacts(X, y, timestamps, model, features, plot=False, contact_types=None): errors = [] for timestamp in timestamps: mask = X.date < timestamp Xtr ...
numb3r33/Xtreme-ML-HACK
src/features/build_features.py
<reponame>numb3r33/Xtreme-ML-HACK import pandas as pd import numpy as np from sklearn.preprocessing import LabelEncoder class Dataset(object): def __init__(self, dataset): self.dataset = dataset def add_week(self): self.dataset = self.dataset.assign(week=self.dataset.date.dt.week) return self def add_month...
numb3r33/Xtreme-ML-HACK
src/data/make_dataset.py
<filename>src/data/make_dataset.py<gh_stars>1-10 import numpy as np import pandas as pd from itertools import product def get_contacts_df(contacts): contacts_grouped = contacts.groupby(['CONTACT.TYPE', 'START.DATE'])['Contacts'].sum().unstack().fillna(0) dates = np.tile(contacts_grouped.columns.values, cont...
numb3r33/Xtreme-ML-HACK
src/features/average_features.py
<gh_stars>1-10 import pandas as pd import numpy as np def prepare_average_features(contacts_df, contacts_df_sub, contacts_test): def get_quarter_mean(row): prev_start_date = row['date'] + pd.DateOffset(-90) # mask = (contacts_df.dates >= prev_quarter_start_date.values[0]) & (contacts_df.dates < row['date'].v...
TLIsolator/AppDevelopmentProject
Forms.py
<filename>Forms.py<gh_stars>0 from wtforms import Form, StringField, RadioField, SelectField, TextAreaField, validators, PasswordField from wtforms.validators import EqualTo, Email, ValidationError import main password_holder = None class CreateUserForm(Form): firstName = StringField('First Name', [validators.Leng...
TLIsolator/AppDevelopmentProject
StorageManager.py
<gh_stars>0 # Please read the instruction before using # This will control all persistent storage (eg. Add, Delete, Modify) # Note: Do not modify this before asking me (HF) # HF import shelve class StorageManager(): def __init__(self): # error checking try: self.__db = shelve.open('st...
TLIsolator/AppDevelopmentProject
main.py
<filename>main.py """ This file will deal with overall of the project Most classes will be linked to this file This is to manage all different class to make it organised Note: Do not modify this before asking me (HF) """ from StorageManager import StorageManager from Admin import Admin db = None # HF d...
TLIsolator/AppDevelopmentProject
app.py
<gh_stars>0 from flask import Flask, render_template, request, redirect, url_for, flash from Forms import CreateUserForm, LoginForm, SignUpForm import User import main app = Flask(__name__) main.init() # Main page # Current is Login Page @app.route('/') def home(): return render_template('home.html') # Called ...
ScarryBear77/skelvis
skelvis/objects.py
from typing import Union, NewType, List, Dict, Final, Tuple import k3d import numpy as np from k3d.objects import Group, Line, Points, Text, Drawable from .jointset import JointSet Color = NewType('Color', Union[str, int]) PositionTimestamps = NewType('PositionTimestamps', Dict[str, np.ndarray]) Positions = NewType(...
ScarryBear77/skelvis
skelvis/jointset.py
<filename>skelvis/jointset.py from typing import Tuple, List import numpy as np from abc import ABCMeta, abstractmethod class JointSet(metaclass=ABCMeta): def __init__(self): self.names: np.ndarray = np.array([]) self.number_of_joints: int = 0 self.limb_graph: List[Tuple[int, int]] = [] ...
ScarryBear77/skelvis
skelvis/loss.py
<gh_stars>1-10 import numpy as np def L2(pred: np.ndarray, gt: np.ndarray) -> np.ndarray: return np.linalg.norm(np.subtract(pred, gt), ord=2, axis=-1) def L1(pred: np.ndarray, gt: np.ndarray) -> np.ndarray: return np.linalg.norm(np.subtract(pred, gt), ord=1, axis=-1)
ScarryBear77/skelvis
skelvis/visualizer.py
<filename>skelvis/visualizer.py import pickle from typing import Optional, List, Dict, Callable, IO, Tuple import ipywidgets as widgets import k3d import numpy as np from IPython.display import display from ipywidgets import Play, Checkbox, IntSlider, Button, ColorPicker, VBox, Tab, HBox, Accordion, Widget, Label from...
shivaco/DBL-python-webhook
listener.py
<reponame>shivaco/DBL-python-webhook import sys, datetime, json, re from discord import Webhook, RequestsWebhookAdapter, Embed, Color from flask import Flask, request, abort, jsonify from pymongo import MongoClient import os with open("settings.json") as settings: data = json.load(settings) webhook_pas...
Carl-Rabbit/quick-web
BUVBack/app.py
<filename>BUVBack/app.py from flask import Flask, request, jsonify from flask_cors import CORS import json import os import calculate_iou FILE_ABS_PATH = os.path.dirname(__file__) app = Flask(__name__) CORS(app) @app.route('/api/test/counter/', methods=['POST']) def update_counter(): params = request.json ...
Carl-Rabbit/quick-web
BUVBack/calculate_iou.py
<reponame>Carl-Rabbit/quick-web # -*- coding: utf-8 -*- import numpy as np import shapely from shapely.geometry import Polygon, MultiPoint # 多边形 def calculate_iou(linedata): # line1 = [2, 0, 2, 2, 0, 0, 0, 2] # 四边形四个点坐标的一维数组表示,[x,y,x,y....] # a = np.array(linedata["line1"]).reshape(4, 2) # 四边形二维坐标表示...
mbs38/mqttRuleBackend
ruleBackend.py
import time import paho.mqtt.client as mqtt import signal import sys import threading topics=[] publisher=None subscriber=None connected=None def disconnecthandler(mqc,userdata,rc): print("Disconnected from broker") global connected connected = False def init(host,port,user=None,password=<PASSWORD>): ...
mbs38/mqttRuleBackend
example_rule.py
import ruleBackend import time host="localhost" port=1883 user = "" password = "" ruleBackend.init(host,port,user,password) # if you need authentication change user and password accordingly ####################################################### # Which states do you want to be available? someBool1 = ruleBackend.Stat...
mbs38/mqttRuleBackend
ruleRunner.py
<filename>ruleRunner.py<gh_stars>0 #!/bin/python3 # Copyright 2022, <NAME>, www.maxbrueggemann.de # This program searches the current directory for python files # that have a filename beginning with "rRun". These files are then # executed as subprocesses. The subprocesses will be terminated when # the corresponding fil...